Using your Mac OS X Server Open Directory Database to share e-mail addresses
22 January 2003
Now that we have an LDAP server included with Mac OS X 10.2 Server, it is incredibly easy to use this as an address book for your entire organization. To get this running you will need to have the LDAP server running, obviously. You were given this option when you first configured your machine. If you turned it off then you can turn it on by running the Open Directory Assistant application and re-enabling it. By default the LDAP server will only serve out your network NetInfo database and not your local.
This can be changed by editing your slapd.conf file. By default it will only share out your network database over LDAP. However if you change
datasource /var/db/netinfo/network.nidb
to
datasource /var/db/netinfo/local.nidb
it will then use your local database instead.
The next step is to populate your user’s entries in your NetInfo database with e-mail addresses and telephone numbers. This can be done using niutil from the command line or the NetInfo Manager.
To add an e-mail address you create a new property called “mail” with the user’s e-mail address as the value. Phone numbers can be added by creating a new property “telephonenumber” with the user’s phone number as the value.
You’re done with the server, so move on over to the clients. Open up the Address Book application. In the preferences select the LDAP tab and add a new LDAP server. Set the name to whatever you want. The Server property should be the IP address or fully qualified domain name of the server. You can leave the Search Base field empty for testing, but you’ll want to refine this later. Otherwise your searches will encompass every item in your NetInfo database and take a much longer time to complete.
To limit this to just the users use “cn=users,dc=domain,dc=topleveldomain” On our server at afp548.com this would be “cn=users,dc=afp548,dc=com". By default the last piece of this should be whatever your server’s IP address reverse maps to. You can check this by going into your NetInfo database and finding the entry for your server in the machines directory. Here you should find a “suffix” property that will look familiar.
Save the LDAP server that you added and go to Address Book’s main window. Select the Directories icon in the left-hand column. Do a search on a user’s full name or e-mail address in the Search box and the results will be listed on the right. You can drag any of the results into your address book to make entries if you want to. Otherwise Mail.app will automatically query the LDAP server that you have specified when you are composing new e-mails.
Entourage will also be able to get this contact information from your LDAP server.
If you are having trouble getting it to hook up your best off starting up slapd, the LDAP server daemon, in debug mode and looking for what it thinks is your search base. This was first suggested by Jon Gardner in our bbs. To do this make sure that slapd is not running.
sudo killall slapd
Next start it up in debug mode
sudo /usr/libexec/slapd -d 1
This will log all of slapd’s info to the command line. Now do a search using the Address Book application without a searchbase configured. This will cause a bunch of stuff to come across the screen. One entry will be a positive response back which will contain the full search base. Look for a line beginning with “send_search_entry” Following that will be a dn, or distinguished name of a record that was found. For example on our server you might get “dn="uid=mactroll,cn=users,dc=afp548,dc=com.” Yours may be significantly different than this. Don’t fret. Just use the all of the stuff after the user name. For example “cn=users,dc=afp548,dc=com” in our case.
Also another idea to consider is that you don’t have to keep all of this contact information in your /users directory in NetInfo. You are more than welcome to substitute a /contacts or a /people directory instead. Just create a new one in NetInfo Manager, or using the NetInfo command line tools. When entering in the searchbase into your e-mail application just switch “users” for whatever new directory that you set up.