blog advertising is good for you


blog advertising is good for you
User login

Shared Address Book via LDAP

For some time I have been working on a solution for sharing contacts. With LDAP being already supported by most client applications (including Mail, Thunderbird and Outlook) it seems to make perfect sense to store contact information in an LDAP directory. A common problem is getting contact information into an LDAP directory. There are some good web and installed applications which allow the maintenance of an ldap directory. In practice this is a nice solution, although not very practical. Usually one tend to keep contact in ones local Address Book. Many application have the ability to add contact directly to a local Address book, and offering tighter integration, so this is the place where contacts usually end up. The problem is getting them into an ldap directory and keeping them updated.

This is where Address Book X LDAP comes in. At first this project started out as AddressBook2LDAP and transfered the entire AddressBook to an LDAP directory. It’s successor, AddressBook4LDAP, allowed the transfer of individuals as well as groups. A year after AddressBook4LDAP, with the advent of Tiger, AddressBook X LDAP came along. In it’s current form it transfers contacts from the local Address Book to an LDAP directory in the background. Once the connection is configured in System Preferences the rest takes care of itself. There is a companion tool, Address Book 4 LDAP (v2) which is a LDAP viewer, and can be used to search and browse a LDAP directory.

To get started one needs to configure a LDAP directory on your servers. Fortunately our friends in Cupertino have already included the necessary software with OS X. You don’t even need OS X Server, but it can be used as well. To get it up and running on OS X, you need to modify the /etc/openldap/slapd.conf file which contains the directory configuration. Here is a basic example :

include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/nis.schema include /etc/openldap/schema/inetorgperson.schema include /etc/openldap/schema/misc.schema include /etc/openldap/schema/samba.schema include /etc/openldap/schema/apple.schema include /etc/openldap/schema/netinfo.schema include /etc/openldap/schema/abxldap.schema pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args database bdb suffix "o=j2anywhere,c=gb" rootdn "cn=ldapadmin,o=j2anywhere,c=gb" rootpw {SSHA}flz7UHHB0I+iRVcfm21qaehcokcUj03m directory /var/db/openldap/openldap-data/ index objectClass eq

Of particular importance are the rootdn, rootpw and suffixparameters. The rootpw can be generated using the slapdpasswd command. Also don’t forget to include the abxldap.schema extention as shown in the example. This file is included with the tool. Once you have made the configuration changes to match your situation (domain, user password etc) you can add the launchd configuration file, which is also included with the application package.

sudo launchctl load /Library/LaunchDaemons/org.openldap.slapd.xml

At this point you should have the LDAP directory up and running and are now ready to construct the basic structure required to store your shared address book. To do this you need an LDIF file, which is a basic text file in a format which can be imported into the LDAP directory. It it important to at least construct the suffix specified in the slapd.conf file earlier.

# j2anywhere, gb dn: o=j2anywhere,c=gb objectClass: organization o: j2anywhere # people, j2anywhere, gb dn: ou=people,o=j2anywhere,c=gb objectClass: organizationalUnit ou: people

Optionally you can also construct your first shared contact by including the next example in the LDIF file as well

# Alexander Hartner, people, j2anywhere, gb dn: cn=Alexander Hartner,ou=people,o=j2anywhere,c=gb objectClass: top objectClass: person objectClass: inetOrgPerson objectClass: abxldapPerson displayName: Alexander Hartner cn: Alexander Hartner givenName: Alexander sn: Hartner mail: alex@j2anywhere.com initials: A o: j2anywhere.com

Again make the necessary changes to suit your requirements. Be careful not to leave spaces at the end of each line as this will cause errors during the import. The next example shows you how to import the LDIF file into the directory. Note how the rootdn and rootpw from the slapd.conf file are used during this task.

ldapadd -c -D "cn=ldapadmin,o=j2anywhere,c=gb" -w [secret password] -x -f InitialImport.ldif If everything goes well you should see something like this in response ... 
 adding new entry "o=j2anywhere,c=gb"
 adding new entry "ou=people,o=j2anywhere,c=gb"
 adding new entry "cn=Alexander Hartner,ou=people,o=j2anywhere,c=gb"
...


At this point you can search the directory using the ldapsearch command as follows:

ldapsearch -D "cn=ldapadmin,o=j2anywhere,c=gb" -w [secret password] -x -b "cn=people, o=j2anywhere, c=gb"

This concludes the server installation and it is time to install and configure the clients. Download Address Book X LDAP form j2anywhere.com and install the package on each client. Configure the LDAP connection in ABxLDAP Prefs (System Preferences) as well as the Address Book’s Preferences under the LDAP tab.

  • Server:The name or IP address of the server running the LDAP directory
  • User / BindDN :This is the username and should match the rootdn from the slapd.conf file (eg : cn=ldapadmin,o=j2anywhere,c=gb)
  • Password:Matching password. Same as used in rootpw / slapdpasswd
  • Context / Search Base:The path / folder / directory / context in which you stored your contacts details. Usually the ou=people is preferred for this

All that is left is to select either the entire Address Book, or individual groups and hit the sync button. The application also comes with detailed instructions, which include some more information which is not included here as well as a demo slideshow.

Project details Docs in PDA Demo Slideshow

Average rating
(1 vote)
About lostinspace2011

Thanks for the great info!

Your readers may also be interested in these LDAP/OS X related articles:

Getting an LDAP server up and running on OS X (non-server edition):
http://www.wickedlush.com/blog/2005/10/06/setting-up-ldap-slapd-on-mac-os-x-non-server-edition/

Importing Contacts from Thunderbird Addressbook into LDAP
http://www.wickedlush.com/blog/2005/10/06/importing-contacts-from-thunderbird-addressbook-into-ldap/

Thanks for the links wickedlush.

There is also Address Book Server which is a companion to Address Book X LDAP and has some useful complimentary features, such as relational data model, bonjour discovery, bi-directional sync support.

Take a look at www.addressbookserver.com

I followed the instructions more or less, though I am using a dc=mydomain, dc=org naming convention. When I try syncing I get a crash with the ABxLDAP pane:

Thread 0 Crashed:
0 libobjc.A.dylib 0×90a5764d class_initialize + 100
1 libobjc.A.dylib 0×90a57664 class_initialize + 123
2 libobjc.A.dylib 0×90a57446 _class_lookupMethodAndLoadCache + 86
3 libobjc.A.dylib 0×90a573c6 objc_msgSend + 86
4 com.apple.AppKit 0×9336ad88 -[NSApplication sendAction:to:from:] + 107
5 com.apple.AppKit 0×9336ace1 -[NSControl sendAction:to:] + 101
6 com.apple.AppKit 0×9336ce91 -[NSCell _sendActionFrom:] + 168
7 com.apple.AppKit 0×9337f671 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 1271
8 com.apple.AppKit 0×9339d25d -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 848
9 com.apple.AppKit 0×9339cb0d -[NSControl mouseDown:] + 757
10 com.apple.AppKit 0×9335a3af -[NSWindow sendEvent:] + 5279
11 com.apple.AppKit 0×9334c350 -[NSApplication sendEvent:] + 5023
12 com.apple.systempreferences 0×00007b53 0×1000 + 27475
13 com.apple.AppKit 0×93276dfe -[NSApplication run] + 547
14 com.apple.AppKit 0×9326ad2f NSApplicationMain + 573
15 com.apple.systempreferences 0×0000e426 0×1000 + 54310
16 com.apple.systempreferences 0×0000e34d 0×1000 + 54093

Also when I trying synching from within AddressBook4LDAP I get told ‘invalid DN syntax’. Any ideas?

Please contact j2anywhere support either via email or via our website directly with any problems using the products. The “invalid syntax” problem is usually caused by a configuration problem on the LDAP server. The Application crash requires a little bit more information. Again if you could please contact support directly we will try to address those issues.

Kind regards
ABxLDAP Support

Ok, that’s a great info.

I use LDAP in my organization unit since 2005, but I was ONE problem.
I can’t get ‘description’ attribut of inetOrgPerson when I request LDAP server with wab or Address Book.

If I use ldapsearch it works fine !!

Any ideas ?!

Thanks
JM Marino
mailto: jm DOT marino AT stga.fr

Generally a Group (Address Book) contains many emailIDs. How can I have all those email contacts under one group just by a click? I use postfix in linux and client is MS Outlook 2007. Thanks

Post new comment
The content of this field is kept private and will not be shown publicly.
3 + 10 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.