This guide will show you how to integrate Active Directory/LDAP into the SquirrelMail addressbook. In this article, you will learn how to configure SquirrelMail to activate the Javascript addressbook and to include your Active Directory or LDAP server into the addressbook lookup list.

JXplorer Active DirectoryThis is what a typical Active Directory layout looks like.
JXplorer LDAPAnd here’s a sample OpenLDAP layout. See OpenLDAP Setup Howto for a guide in setting up OpenLDAP.

NoteI used JXplorer to browse the LDAP servers, you’ll need the Java Runtime Environment to use it.

SquirrelMail will be using the following attributes

  • cn – Common Name
  • mail – Email Address

Configure the SquirrelMail Addressbook

We will be using the Perl based SquirrelMail configuration utility to configure the addressbook.

Terminal1. Launch the Terminal application.
SquirrelMail Configuration2. In the Terminal window, type in /usr/share/squirrelmail/config/ and press Enter. This will launch the SquirrelMail Configuration utility.

NoteIf your Terminal window has a white background, make sure that the colors are off by looking for the command Turn color on. If the command is Turn color off, type in C and press Enter to turn the colors off. This will ensure that you will be able to read all of the text.

SquirrelMail Configuration3. Type in 6 and press Enter to list the Address Books submenu.
SquirrelMail Configuration4. Select the Javascript address book as the default by typing in 2 and press Enter then type in y and press Enter.
SquirrelMail Configuration5. Add your Active Directory/LDAP server by typing in 1 and press Enter then type in + and press Enter. You will now be asked a series of questions regarding your Active Directory/LDAP server configuration, see the sample session below.
First, we need to have the hostname or the IP address where
this LDAP server resides.  Example:
hostname: server

Next, we need the server root (base dn).  For this, an empty
string is allowed.
Example: ou=member_directory,
base: dc=acme,dc=local

This is the TCP/IP port number for the LDAP server.  Default
port is 389.  This is optional.  Press ENTER for default.

This is the charset for the server.  Default is utf-8.  This
is also optional.  Press ENTER for default.

This is the name for the server, used to tag the results of
the search.  Default it "LDAP: hostname".  Press ENTER for default

You can specify the maximum number of rows in the search result.
Default is unlimited.  Press ENTER for default.

If your LDAP server does not like anonymous logins, you can specify...
Default is none, anonymous bind.  Press ENTER for default.
binddn: cn=mailuser,dc=acme,dc=local

If you are connecting to an Active Directory server, binddn can also be in the form of acme\mailuser or mailuser@acme.local

Now, please specify password for that DN.
bindpw: password

You can specify bind protocol version here.
Default protocol version depends on your php ldap settings.
Press ENTER for default.
protocol: 3

[ldap] command (?=help) > d

You should now be back at the Address Books sub menu, type in q and press Enter to quit and type in y and press Enter to save your changes.

Test the SquirrelMail Addressbook

SquirrelMail1. Login to SquirrelMail and compose a new mail.
SquirrelMail2. Click the Addresses button (not the Addresses link). This will launch the SquirrelMail Addressbook window. Click the List all button, you should now see your Active Directory/LDAP email addresses.

NoteIf you are querying a Windows 2003 Server and you are encountering an Operations error message, try enabling the Windows 2003 Active Directory anonymous ldap operations.

Visit the forum to ask for help or to give a comment.

Posted on 12/12/2007 and last updated on 11/7/2009
Filed under Active Directory , LDAP , SquirrelMail