
Chapter 12. Cloning open source virtual servers 167
The PADL tools have a shared configuration file named migrate_common.ph. Make a backup
copy of this file and modify it. There are two lines to be changed which set the domain name
and suffix (or root) of LDAP tree. In this example, the suffix is itso.ibm.com:
# cd /usr/share/openldap/migration
# cp migrate_common.ph migrate_common.ph.orig
# vi migrate_common.ph
...
# Default DNS domain
$DEFAULT_MAIL_DOMAIN = "<itso.ibm.com>";
# Default base
$DEFAULT_BASE = "<dc=itso,dc=ibm,dc=com>";
...
The first tool conversion Perl script is migrate_base.pl. Redirect the output to a file named
accounts.ldif. This will be the file that you use to populate the LDAP server. After you run it,
take a look at the first few lines of the LDIF file using the head command to give you an idea of
the format:
# ./migrate_base.pl > accounts.ldif
# head -9 accounts.ldif
dn: dc=ibm,dc=com
dc: ibm
objectClass: top
objectClass: domain
dn: dc=itso,dc=ibm,dc=com
dc: itso
objectClass: top
objectClass: domain
The next two scripts migrate the /etc/passwd and /etc/group files. Append the output of both
of these to the accounts.ldif file using the >> redirection operator:
# ./migrate_passwd.pl /etc/passwd >> accounts.ldif
# ./migrate_group.pl /etc/group >> accounts.ldif
Search for the string ldapuser1 in the accounts.ldif file:
# grep ldapuser1 accounts.ldif
dn: uid=ldapuser1,ou=People,dc=itso,dc=ibm,dc=com
uid: ldapuser1
cn: ldapuser1
homeDirectory: /home/ldapuser1
dn: cn=ldapuser1,ou=Group,dc=itso,dc=ibm,dc=com
cn: ldapuser1
The output shows that the user was migrated to the LDIF file.
Important: There appears to be a bug in migrate_base.pl when the suffix has more than
two components. This will later result in an error when you try to import the LDIF file:
slapadd: line 5: database (dc=itso,dc=ibm,dc=com) not configured to hold
"dc=ibm,dc=com"
If your suffix (Base DN) has more than two components, you can work around the bug by
deleting the entry or entries in the LDIF file with fewer components than your suffix. In this
example, itso.ibm.com has three components, so the first entry (first four lines and one
blank line) in the LDIF file must be deleted. Then the slapadd command should succeed.
Comentarios a estos manuales