APPENDIX C

Populating the Directory Examples

Chapter 9, Populating SIMS with Users and Groups  

189  

Populating the Directory with User Data--Sample Session  

321  

Populating the Directory with User Aliases Data and Distribution Lists --Sample Session  

325  





Populating the Directory with User Data--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/sh
gevert: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.

$ su
Password: <Enter your root password>
#

  2. Use the getent command to save the user entries in a file:

# getent passwd > /tmp/passwd

  3. Use the niscat command to extract user information from the mail aliases file, and use the sed command to format the data:

# niscat mail.aliases > /tmp/aliases.tmp
# sed 's/ /: /' /tmp/aliases.tmp > /tmp/aliases

  4. Change directories to the location shown and edit the imldifsync.conf file.

# cd /etc/opt/SUNWmail/dir_svc
# vi imldifsync.conf

  5. Change the mail-server, passwd-file and aliases-file values, and uncomment the mode = users line as shown:

mail-server = "<mailserverhostname>.<fully qualified domain name>"
passwd-file = "/tmp/passwd"
aliases-file = "/tmp/aliases"
mode = users

  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).

# /opt/SUNWmail/sbin/imldifsync -c imldifsync.users.conf > /tmp/ users.ldif

  You will see the following results on the screen:

==================Statistics========================
Added DNs: 2
Modified DNs: 0
Delete DNs: 0
====================================================


Note - By default, the mail folder will be set to the Sun Message Store.

The file users.ldif contains the following



CODE  EXAMPLE  C-1 Contents of the users.ldif File (1 of 2)
dn: cn="John Doe (jdoe)",ou=People,o=Alpha,c=US
changetype: add
cn: John Doe (jdoe)
cn: John Doe
sn: Doe
initials: JD
givenName: John
rfc822MailAlias: john.doe@testserver.Alpha.COM
rfc822MailAlias: jdoe@testserver.Alpha.com
mail: jdoe@testserver.Alpha.COM
mailDeliveryOption: mailbox
mailHost: testserver.Alpha.com
userPassword: {crypt}fWFuXyZ1S..Vk
uid: jdoe
dataSource: imldifsync 1.0
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
mailQuota: -1
mailFolderMap: SUN-MS
dn: cn="Gail Evert (gevert)",ou=People,o=Alpha,c=US
changetype: add
cn: Gail Evert (gevert)
cn: Gail Evert
sn: Evert
initials: GE
givenName: Gail
Rfc822MailAlias: gail.evert@Engineering
Mail: gail.evert@testserver.Alpha.COM
mailDeliveryOption: mailbox
userPassword: {crypt}fWFuXyZ1S..Vk
uid: gevert
dataSource: imldifsync 1.0
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
mailQuota: -1
mailFolderMap: SUN-MS

  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:

# cd /opt/SUNWconn/bin
# ldapmodify -D "cn=admin,o=Alpha,c=us" -w secret -f /tmp/users.ldif

  You will see the following output on the screen:

adding new entry cn="John Doe (jdoe)",ou=People,o=Alpha,c=US
adding new entry cn="Gail Evert (gevert)",ou=People,o=Alpha,c=US

  8. Verify that the entries are present in the directory, using the ldapsearch command.

CODE  EXAMPLE  C-2 Results of the ldapsearch Command for User Data
# 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


Populating the Directory with User Aliases Data and Distribution Lists --Sample Session

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,jdoe
owner-testsubject: admin
testsubject-list: jdoe,gevert
testsubject-list-request: jdoe
owner-testsubject-list: jdoe

To create directory entries for these user aliases, complete the following steps:

  1. Log in as root.

$ su
Password: <Enter your root password>
#


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:

# cp imldifsync.conf imldifsync.groups.conf

  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).

# /opt/SUNWmail/sbin/imldifsync -c imldifsync.groups.conf > /tmp/ user_aliases.ldif

  You will see the following results on the screen:

==================Statistics========================
Added DNs: 2
Modified DNs: 0
Delete DNs: 0
====================================================


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.0
inetMailGroupStatus: active
mailDeliveryOption: 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.0
inetMailGroupStatus: active
mailDeliveryOption: 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:

# cd /opt/SUNWconn/bin
# ldapmodify -D "cn=admin,o=Alpha,c=us" -w secret -f /tmp/user_aliases.ldif

  You will see the following results on the screen:

adding new entry cn="testsubject",ou=Groups,o=Alpha,c=US
adding new entry cn="testsubject-list",ou=Groups,o=Alpha,c=US

  5. Verify that the entries are present in the directory, using the ldapsearch command.

CODE  EXAMPLE  C-4 Results of the ldapsearch Command for User Aliases Data
# 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


Migrating /var/mail Mailboxes

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.




Copyright© 1999 Sun Microsystems, Inc. All Rights Reserved.