I have been wanting a centralized address book/contacts solution for a long time, and was looking for something that used open standards, and saved stuff in plain text, or could export to plain text. If Thunderbird could also access it directly, that would be perfect, but what hope was there? I looked at Synckolab (http://www.gargan.org/extensions/synckolab.html) - which is an excellent idea, but not ready for primetime. I poked around for a long time, knowing at the back of my mind that LDAP was probably the best way to go, but I just didn’t want to go through the pain of installing and setting it all up, only to have to do it all again next time I upgrade my operating system (I’d just been through similar pain with my mail server setup, converting from OS X Panther to OS X Tiger - non-server versions). The whole reason I got a mac to use as my server (mac mini, 1.25GHz, 512MB RAM) was so I didn’t have to deal with Linux - life’s too short.
However, my research indicated that even the non-server version of Mac OS X ships with an LDAP server (but no UI tools for setup/admin). Furthermore, all the parts you need can also be downloaded, installed and updated via Fink (http://fink.sourceforge.net/). Having seen posts from people who had problems getting the mac-shipped version to work, I decided to go the Fink route.
So here it is - pretty straightforward, really…
First - download and install Fink (http://fink.sourceforge.net/) and then FinkCommander (http://finkcommander.sourceforge.net/), and do selfupdate and update-all (see the “source” menu)
1) in FinkCommander, install:
openssl097 0.9.7d-1 Secure Sockets Layer and general crypto library
openssl097-shlibs 0.9.7d-1 Secure Sockets Layer and general crypto library
openldap-ssl 2.1.22-25 LDAP directory services implementation
openldap-ssl-shlibs 2.1.22-25 Shared libraries for LDAP
cyrus-sasl2-shlibs 2.1.21-3 Cyrus Simple Auth. and Security Layer Library
cyrus-sasl2 2.1.21-3 Cyrus Simple Auth. and Security Layer Library
cyrus-sasl2-doc 2.1.21-3 Cyrus Simple Auth. and Security Layer Library
If you don’t see these, there’s a setting in the preferences, on the fink tab, that says: “use unstable packages” - mine’s checked, but I’m not sure if these fell into that category or or not)
2) in terminal, type:
sudo vim /sw/etc/openldap/slapd.conf
and scroll down to find this:
include /sw/etc/openldap/schema/core.schema
and beneath it, add:
# ADD THESE: ##
include /sw/etc/openldap/schema/cosine.schema
include /sw/etc/openldap/schema/inetorgperson.schema
include /sw/etc/openldap/schema/mozillaOrgPerson.schema
##############
(IMPORTANT: don’t forget to get a copy of mozillaOrgPerson.schema and put it in the above location. It can be downloaded via a google search. I used version 0.6.3)
Now scroll down to find this:
#######################################################################
# ldbm database definitions
#######################################################################
database bdb
suffix "dc=my-domain,dc=com"
rootdn "cn=Manager,dc=my-domain,dc=com"
Replace “my-domain” with your real domain name. (For other settings, if required, see “man slapd.conf”).
Save & exit.
To test whether the configuration file is correct or not, type:
sudo /sw/sbin/slapd -d 5 -t
which tests the config file (with level 5 debugging, to tell you why it’s failing, if it is)
3) AS ROOT, start ldap (slapd) with *lots* of console debugging:
/sw/sbin/slapd -d 255
Also see “man slapd”
4) AS ROOT, set up using these instructions:
http://www.onlamp.com/pub/a/onlamp/2003/03/27/ldap_ab.html
My install differed from this in the following ways (refer to the above-linked page to understand how these fit in):
Here’s my directory.ldif file:
dn: dc=my-domain,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
dc: my-domain
o: my-domain
dn: ou=addressbook,dc=my-domain,dc=com
objectClass: top
objectClass: organizationalUnit
ou: addressbook
***NOTE*** - MUST have the blank line between “o: my-domain” and “dn: ou=addressbook…etc”
Here’s the command line to add it to the directory:
ldapadd -D 'cn=Manager, dc=my-domain, dc=com' -x -f directory.ldif -W
(Had to add the -W -x -D ‘cn=…’ option to bind as that name, otherwise it tries to use SASL)
Command line to do initial search:
ldapsearch -W -x -D 'cn=Manager, dc=my-domain, dc=com' -b 'dc=my-domain, dc=com'
'objectclass=*'
(Had to add the -W -x -D ‘cn=…’ option to bind as that name, otherwise it tries to use SASL)
TO ADD AN ENTRY:
cn=Test User,cn=Test User,ou=addressbook,dc=my-domain,dc=com
givenName Test
sn User
cn Test User
street 123 Main St
o myCompany
l My Town
st CA
postalCode 50005
telephoneNumber 888 888 8888
mobile no mobile
facsimileTelephoneNumber 888 888 8888
mail me@my-domain.com
…next post - Importing Contacts from Thunderbird Addressbook into LDAP - will show how to export existing address book contacts from mozilla thunderbird and import them into your LDAP server…