APPENDIX C |
Populating the Directory Examples
|
|
|
|
|
Populating the Directory with User Aliases Data and Distribution Lists --Sample Session
|
| |
Alpha Corporation is setting up a pilot test of the directory with two users on a lab machine called testserver. The test machine uses NIS+, and has the following users defined:
jdoe:fWFuXyZ1S..Vk:1001:10:John Doe:/export/home/jdoe:/bin/shgevert:fWFuXyZ1S..Vk:1002:10:Gail Evert:/export/home/gevert:/bin/sh
To create directory entries for these users, complete the following steps:
1. | Log in as root.
|
2. | Use the getent command to save the user entries in a file:
|
3. | Use the niscat command to extract user information from the mail aliases file, and use the sed command to format the data:
|
4. | Change directories to the location shown and edit the imldifsync.conf file.
|
5. | Change the mail-server, passwd-file and aliases-file values, and uncomment the mode = users line as shown:
|
In the above example, your mail-server can be testserver.eng.alpha.com., where testserver is the host name of the SIMS mail server. In /etc/opt/SUNWmail/dir_svc there will be two files: |
imldifsync.users.conf imldifsync.groups.conf |
6. | Change directories to the location shown and convert the user data to LDIF format. |
Use the imldifsync command to generate formatted user data files (LDIF files).
|
You will see the following results on the screen:
|
Note - By default, the mail folder will be set to the Sun Message Store.
The file users.ldif contains the following
7. | Change directories to the location shown and populate the directory with the user LDIF formatted data. |
Use the ldapmodify command to add the new entries to the directory:
|
You will see the following output on the screen:
|
8. | Verify that the entries are present in the directory, using the ldapsearch command.
|
|
# ldapsearch -L -b "o=Alpha,c=us" "cn=*" cn
|
dn: CN=John Doe (jdoe),OU=People,O=Alpha,C=US
|
cn: John Doe (jdoe)
|
cn: John Doe
|
dn: CN=Gail Evert (gevert),OU=People,O=Alpha,C=US
|
cn: Gail Evert (gevert)
|
cn: Gail Evert
|
The following example is a continuation from the user data population example shown in "Populating the Directory with User Data--Sample Session" on page 321. It also assumes that you have extracted the user mail-aliases information from NIS+ and are now attempting to populate the directory with user aliases data for Alpha Corporation, Inc. as shown below. The user mail-alias being created is called testsubject and it will have two people as its members, John Doe and Gail Evert. The owner of the alias is designated as admin. The distribution list mail-alias is called testsubject-list, and it has owner owner-testsubject-list and automated request alias testsubject-list-request. The owner is user jdoe and the distribution list has two members, gevert and jdoe.
testsubject: gevert,jdoeowner-testsubject: admintestsubject-list: jdoe,geverttestsubject-list-request: jdoeowner-testsubject-list: jdoe
To create directory entries for these user aliases, complete the following steps:
1. | Log in as root.
|
Note - Since you have to populate the directory with user data before you populate it with user aliases data, and since the process of extracting user, user aliases, and distribution list data is the same, you have already completed Step 3 to Step 5 as part of Populating the Directory with User Data--Sample Session." This section does not repeat these steps.
2. | Copy the imldifsync.conf file to groups.conf to keep the user population data distinct from the user aliases population data:
|
3. | Change directories to the location shown and convert the user aliases list data to LDIF format. |
Use the imldifsync command to generate formatted user aliases data files (LDIF files).
|
You will see the following results on the screen:
|
Note - By default, the mail folder will be set to the Sun Message Store.
The file user_aliases.ldif contains the following:
CODE EXAMPLE C-3 Contents of the user_aliases.ldif File for User Aliases dn: cn="testsubject",ou=Groups,o=Alpha,c=US changetype: add cn: testsubject mail: testsubject@Alpha.com rfc822MailMember: gevert@testserver.Alpha.COM rfc822MailMember: jdoe@testserver.Alpha.COM inetMailGroupVersion: 1.0inetMailGroupStatus: activemailDeliveryOption: mailbox mailHost: mail.alpha.com ownerDeliveryOption: mailbox dataSource: imldifsync 1.0 objectClass: top objectClass: inetMailGroup objectClass: inetMailRouting
objectClass: groupOfUniqueNames dn: cn="testsubject-list",ou=Groups,o=Alpha,c=US changetype: add cn: testsubject-list mail: testsubject-list@Alpha.com rfc822MailMember: gevert@testserver.Alpha.COM rfc822MailMember: jdoe@testserver.Alpha.COM inetMailGroupVersion: 1.0inetMailGroupStatus: activemailDeliveryOption: mailbox mailHost: mail.alpha.com ownerDeliveryOption: mailbox dataSource: imldifsync 1.0 objectClass: top objectClass: inetMailGroup objectClass: inetMailRouting
objectClass: groupOfUniqueNames
4. | Change directories to the location shown and populate the directory with the user aliases LDIF formatted data. |
Use the ldapmodify command to add the new entries to the directory:
|
You will see the following results on the screen:
|
5. | Verify that the entries are present in the directory, using the ldapsearch command.
|
|
# ldapsearch -L -b "o=Alpha,c=us" "cn=*" cn
|
dn: CN=testsubject,OU=Groups,O=Alpha,C=US
|
cn: testsubject
|
# ldapsearch -L -b "o=Alpha,c=us" "cn=*" cn
|
dn: CN=testsubject-list,OU=Groups,O=Alpha,C=US
|
cn: testsubject-list
|
The imimportmbox utility migrates /var/mail files into the message store. You need to determine which /var/mail files to transfer, since these files might be in a variety of places depending on the organization of the previous system. For a complete description on mailbox migration procedures, refer to Appendix B, "Migrating Mailboxes from /var/mail to SIMS."
The imexportmbox utility can be used to copy email back out from the message store to disk in /var/mail format. But an export may not be the same byte for byte as an import, since imimportmbox parses /var/mail into the message store format and imexportmbox recreates a valid /var/mail file, which are not exactly the same.
For more information on imimportmbox or imexportmbox, see the man pages.