LDAPAddressBook
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
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:
<?xml version="1.0"?> <resultset statement="show databases;"> <row> <field name="Database">information_schema</field> </row> <row> <field name="Database">addressbook</field> </row> <row> <field name="Database">budget</field> </row> <row> <field name="Database">dinner</field> </row> <row> <field name="Database">mysql</field> </row> <row> <field name="Database">wiki_thesis</field> </row> </resultset>
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
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 |
---|---|---|---|
inetOrgPerson | givenName | Firstname | |
person | sn | Lastname | |
inetOrgPerson | displayName | Display | |
mozillaAbPersonObsolete | mozillaNickname | Nickname | |
inetOrgPerson | |||
mozillaAbPersonObsolete | mozillaSecondEmail | Additional Email | |
mozillaAbPersonObsolete | mozillaUseHtmlMail | Prefers to receive message formated as | |
– | Screen Name | ||
2.5.4.20(M) | telephoneNumber | Work (Phone) | |
inetOrgPerson | homePhone | Home (Phone) | |
2.5.4.23 | faximileTelephoneNumber | Fax | |
inetOrgPerson | pager | Pager | |
inetOrgPerson | mobile | Mobile | |
– | Address (Ln1 HM) | ||
mozillaAbPersonObsolete | mozillaHomePostalAddress2 | Address (Ln2 HM) | |
mozillaAbPersonObsolete | mozillaHomeLocalityName | City (HM) | |
mozillaAbPersonObsolete | mozillaHomeState | State/Provice(HM) | |
mozillaAbPersonObsolete | mozillaHomePostalCode | Zip/Postal Code(HM) | |
mozillaAbPersonObsolete | mozillaHomeCountryName | Country(HM) | |
mozillaAbPersonObsolete | mozillaHomeUrl | Web Page(HM) | |
organizationPerson | title | Title (Wk) | |
inetOrgPerson | departmentNumber | Department (WK) | |
2.5.4.10 | o | Organization(Wk) | |
2.5.4.18 | postOfficeBox | Address (Ln1 Wk) | |
mozillaAbPersonObsolete | mozillaPostalAddress2 | Address (Ln2 Wk) | |
2.5.4.7 | l | City (Wk) | |
2.5.4.8 | st | State/Provice(Wk) | |
2.5.4.17 | postalCode | Zip/Postal Code(Wk) | |
– | Country (Wk) | ||
mozillaAbPersonObsolete | mozillaWorkUrl | Web Page (Wk) | |
mozillaAbPersonObsolete | mozillaCustom1 | Custom 1 | |
mozillaAbPersonObsolete | mozillaCustom2 | Custom 2 | |
mozillaAbPersonObsolete | mozillaCustom3 | Custom 3 | |
mozillaAbPersonObsolete | mozillaCustom4 | Custom 4 | |
– | Custom 5 | ||
2.5.4.13 | description | Notes |
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 [email protected]:/export/git/projects/ldapab
On the mac you have to specify where you want it checked out to so use:
git clone [email protected]:/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.
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