LDAPAddressBook

Posted by Benjamin Close on November 13, 2008 under OpenSource, Projects | Read the First Comment

LDAP is a great protocol. It allows multiple clients to obtain data about virtually anything that you can think of. The LDAPAddressBook project is a project to determine a LDAP Schema that works in the following clients:

  • Mozilla Thunderbird
  • Windows Address Book
  • OS X Address Book
  • Squirrel Mail

In fact any client that supports LDAP.

By determining this schema, ClearChain can finally have a ‘go anywhere’ addressbook.

Conceptual Layout

Stage 1

LDAPAB_stage_1

The idea is that everything is stored in a database. Databases are great for storing and manipulating information. Currently we use a MySQL database. Data is extracted from the database in xml format. This is actually ridiculously easy. MySQL (on the command line at least) supports output formats of xml. On the command line when connecting to the database you just throw in a –xml flag, for example:

mysql --xml -u frank -p

Then when you get any text back from any queries you run the results will be wrapped in xml. Even commands such as:

mysql> show databases;

will return results marked up with xml, for example:




  
        information_schema
  

  
        addressbook
  

  
        budget
  

  
        dinner
  

  
        mysql
  

  
        wiki_thesis
  

This is awesome because it means that we can easily convert the xml into any format that we want in particular an LDAP schema that Thunderbird understands, an LDAP schema that Outlook understands, but also just as easily HTML, XHTML, plain text… you name it the xml can be converted to it simply with an xml transformation.

In the case of an LDAP server once the XML has been converted to the appropriate format existing LDAP data is blown away and then replaced by the new schema.

NOTE: Through php the mysql calls do not support fetch results in xml format, except via an extension. For this reason I wrote a simple method that wraps the mysql like xml around the data set returned via the usual query call.

Stage 2

LDAPAB_stage_2

The second stage of this project is to provide the various email clients and addressbooks with the ability to add and modify contacts in the database. This is more of a pipe dream at the moment, but should be relatively straight forward with an email client such as Thunderbird.

LDAP Schema

This section details the various fields used by different applications for the address book. I’ve tried to map the fields to the official ldap schemas that exist. A full list that are supported by thunderbird is available at: http://www.mozilla.org/projects/thunderbird/specs/ldap.html

There is however a lot of undocumented mozilla/thunderbird specific attributes. http://www.pro-linux.de/t_office/mozilla_op20.schema

Documents a complete mozilla schema but is yet to be tested

LDAP Schema Field Thunderbird Outlook Express
inetOrgPersongivenNameFirstname
personsnLastname
inetOrgPersondisplayNameDisplay
mozillaAbPersonObsoletemozillaNicknameNickname
inetOrgPersonmailEmail
mozillaAbPersonObsoletemozillaSecondEmailAdditional Email
mozillaAbPersonObsoletemozillaUseHtmlMailPrefers to receive message formated as
Screen Name
2.5.4.20(M)telephoneNumberWork (Phone)
inetOrgPersonhomePhoneHome (Phone)
2.5.4.23faximileTelephoneNumberFax
inetOrgPersonpagerPager
inetOrgPersonmobileMobile
Address (Ln1 HM)
mozillaAbPersonObsoletemozillaHomePostalAddress2Address (Ln2 HM)
mozillaAbPersonObsoletemozillaHomeLocalityNameCity (HM)
mozillaAbPersonObsoletemozillaHomeStateState/Provice(HM)
mozillaAbPersonObsoletemozillaHomePostalCodeZip/Postal Code(HM)
mozillaAbPersonObsoletemozillaHomeCountryNameCountry(HM)
mozillaAbPersonObsoletemozillaHomeUrlWeb Page(HM)
organizationPersontitleTitle (Wk)
inetOrgPersondepartmentNumberDepartment (WK)
2.5.4.10oOrganization(Wk)
2.5.4.18postOfficeBoxAddress (Ln1 Wk)
mozillaAbPersonObsoletemozillaPostalAddress2Address (Ln2 Wk)
2.5.4.7lCity (Wk)
2.5.4.8stState/Provice(Wk)
2.5.4.17postalCodeZip/Postal Code(Wk)
Country (Wk)
mozillaAbPersonObsoletemozillaWorkUrlWeb Page (Wk)
mozillaAbPersonObsoletemozillaCustom1Custom 1
mozillaAbPersonObsoletemozillaCustom2Custom 2
mozillaAbPersonObsoletemozillaCustom3Custom 3
mozillaAbPersonObsoletemozillaCustom4Custom 4
Custom 5
2.5.4.13descriptionNotes

OpenLdap

In order to use create a schema for openldap that works for at least Thunderbird, download the schema linked above then make sure you have the following lines in your slapd.conf

include         /usr/local/etc/openldap/schema/core.schema

# Add additional schema
include                 /usr/local/etc/openldap/schema/cosine.schema
include                 /usr/local/etc/openldap/schema/inetorgperson.schema
include                 /usr/local/etc/openldap/schema/mozilla_op20.schema

Contributors

Aaron Stafford has written a substantial amount of code for this project, including:

  • HTML front end which communicates with the the database over PHP
  • XSL transformation that converts XML extracted from the database into the openldap ready text

Code Access

Access to the code is currently restricted, but hopefully this will become a public upon request. If you are interested in seeing this project become public please drop us a line.

git clone username@git.clearchain.com:/export/git/projects/ldapab

On the mac you have to specify where you want it checked out to so use:

git clone username@git.clearchain.com:/export/git/projects/ldapab ldapab

If you are on a mac. It might be the case that you need to do this on any platform. I haven’t tested it anywhere else though.

External Links

http://www.plaxo.com/ – Plaxo is an interesting application. It lets you sync a whole bunch of different address books and calendar information from different application and online accounts. I have not used this but it appears to be a near perfect solution if you are prepared to hand over your usernames and passwords to another company. ldapab is designed to be managed by the person looking after their own contacts, not having someone else manage it for you.



Donations keep this site alive

  • avatar

    Jan Høydahl said,

    How is this project going?
    I’m looking for a tool with which I can publish a MySql view of persons through LDAP.

    Anywhere I can download and test?

Add A Comment

*