Sun One Directory Data Migration Guide
In this article
Migrating data from Sun ONE Directory Server (also known as iPlanet Directory Server or Sun Java System Directory Server) to a modern LDAP directory like OpenLDAP or 389 Directory Server is a common task when retiring legacy infrastructure. This guide walks you through a safe, step-by-step migration that preserves your directory tree, entries, and schema definitions, and minimizes downtime.
What You'll Need
- Access to the source Sun ONE Directory Server (admin credentials with read access to the entire directory tree).
- Access to the target LDAP server (admin credentials, typically
cn=Directory Manageror equivalent). - A workstation with LDAP tools installed:
ldapsearch,ldapmodify,ldapadd, andldapcompare(usually from OpenLDAP or 389 clients). - Enough disk space to store LDIF export files and schema files.
- A test environment that mirrors your production setup, if possible.
Step-by-Step
- Inventory your source directory. Run
ldapsearch -h source_host -p 389 -D "cn=Directory Manager" -w password -b "" -s base "(objectClass=*)" namingContextsto list all naming contexts (base DNs). Note the main suffix and any subordinate suffixes. - Export the schema. Sun ONE stores schema in files (e.g.,
99user.ldif). Copy these files from the server (usually under/etc/mps/config/slapd-) or use/schema/ ldapsearchon thecn=schemaentry. Save all schema files to a local folder. - Export the data to LDIF. Use
ldapsearchto dump the entire directory tree:ldapsearch -h source_host -p 389 -D "cn=Directory Manager" -w password -b "dc=example,dc=com" -s sub "(objectClass=*)" > data.ldif. Ensure you include operational attributes likemodifyTimestampif needed. - Review and clean the LDIF. Open the LDIF file and remove any Sun ONE-specific entries (e.g.,
nsslapd-*operational attributes) that the target server does not understand. Also check for duplicate DNs or malformed entries. - Prepare the target server. Install and configure your target LDAP server (e.g., 389 DS or OpenLDAP). Create the root suffix and any needed backend databases.
- Load the schema. Convert Sun ONE schema to the target format. For OpenLDAP, you may need to convert attribute and objectclass definitions to slapd.conf or cn=config format. For 389 DS, you can often import the schema files directly after some tweaking. Use
ldapaddto add schema entries if your target supports dynamic schema. - Import the data. Use
ldapaddorldapmodifyto load the LDIF into the target server:ldapadd -h target_host -p 389 -D "cn=Directory Manager" -w password -f data.ldif. Alternatively, use the server's offline import tool (e.g.,ldif2dbfor 389 DS) for faster bulk loading. - Verify the migration. Run
ldapsearchon the target to compare entry counts and sample entries with the source. Check that all objectclasses and attributes are present and correctly mapped. - Test authentication and access. Bind as a few sample users and test group membership, ACLs, and any applications that depend on the directory.
- Switch over traffic. Once testing passes, update your applications to point to the new server. Keep the old server running for a rollback period if possible.
Common Mistakes
- Ignoring schema differences. Sun ONE uses proprietary schema elements (e.g.,
nsrole,cosAttribute) that may not exist in the target. Map them to standard equivalents or define custom schema. - Forgetting operational attributes. Attributes like
entryUUID,creatorsName, andmodifiersNamemay be server-specific. Strip them or let the target regenerate them. - Not cleaning the LDIF. Sun ONE exports may contain line breaks or special characters that break import. Use a tool like
dos2unixand validate withldapsearchafter import. - Skipping a test run. Always test in a non-production environment first.
- Overlooking referrals and replication. If your source has replication agreements, ensure you export from a single master to avoid inconsistencies.
Tips
- Use
ldapsearch -LLL -o ldif-wrap=noto avoid line wrapping in the LDIF, which can cause import issues. - Export the schema and data separately to simplify troubleshooting.
- If you have a large directory (millions of entries), use the target server's bulk import tools (e.g.,
ldif2db) for speed. - Keep a backup of the original LDIF and schema files.
- Document any custom schema changes you make so future migrations are easier.
Troubleshooting
- Import fails with "invalid attribute type". This means the target doesn't know the attribute. Add the missing schema definition and retry.
- Import fails with "duplicate entry". Check for duplicate DNs in the LDIF. Use
sort -uon the DN lines to spot them. - Import fails with "structural objectclass violation". Sun ONE may have entries with multiple structural classes. Simplify the entry structure or adjust schema.
- Authentication fails after migration. Password hashes may be incompatible (e.g., Sun ONE uses
{SSHA}which is standard, but some old hashes are not). Reset passwords or migrate them using a tool likepwdhash. - Search results differ. Check indexing on the target server. Rebuild indexes after import.
- Referrals not working. Ensure referral attributes are correctly mapped and the target server is configured to follow them.
Frequently Asked Questions
Can I migrate without downtime?
Yes, if you set up a replication agreement between Sun ONE and the target (if the target supports Sun ONE replication protocol) or use a cutover approach with a short maintenance window. For most cases, a brief outage is simpler.
What happens to passwords?
Sun ONE typically stores passwords as SSHA or SHA hashes, which are compatible with most modern LDAP servers. If you use CRYPT or MD5, you may need to reset them.
Will my ACLs transfer?
ACLs in Sun ONE are stored as aci attributes. They are part of the LDIF export, but the target server may interpret them differently. You'll likely need to rewrite them for the target's ACL syntax.
Can I migrate only a subtree?
Yes, just change the base DN in your ldapsearch command to the subtree you want. Ensure that parent entries are exported as well if needed.
What about schema for applications like Sun Java System Messaging Server?
You'll need to export the schema files from the Sun ONE server and manually convert them. Many Sun-specific schemas are available in open-source LDAP packages.
How long does migration take?
It depends on the size of your directory. A small directory (few thousand entries) can be done in hours; a large one (millions) may take days, mostly in testing and validation.