System information
Configuring OpenLDAP
While a discussion of the installation and configuration of an LDAP server is beyond
the scope of this chapter, it is certainly applicable to show you how we expanded our
initial LDAP schema to include the information required for Asterisk integration. Our
initial installation followed instructions from the Ubuntu documentation page located
at https://help.ubuntu.com/10.04/serverguide/C/openldap-server.html. We only needed
to follow the instructions up to and including the backend.example.com.ldif import; the
next step after importing the backend configuration is installing the Asterisk-related
schemas.
If you’re following along, with the backend imported, change into your Asterisk source
directory. Then copy the asterisk.ldap-schema file into the /etc/ldap/schema/ directory:
$ cd ~/src/asterisk-complete/asterisk/1.8/contrib/scripts/
$ sudo cp asterisk.ldap-schema /etc/ldap/schema/asterisk.schema
With the schema file copied in, restart the OpenLDAP server:
$ sudo /etc/init.d/slapd restart
Now we’re ready to import the contents of asterisk.ldif into our OpenLDAP server. The
asterisk.ldif file is located in the contrib/scripts/ folder of the Asterisk source directory:
$ sudo ldapadd -Y EXTERNAL -H ldapi:/// -f asterisk.ldif
We can now continue with the instructions at https://help.ubuntu.com/10.04/server
guide/C/openldap-server.html and import the frontend.example.com.ldif file. Within
that file is an initial user, which we can omit for now as we’re going to modify the user
import portion to include an objectClass for Asterisk (i.e., in the example file, the
section of text that starts with uid=john can be deleted).
We’re going to create a user and add the configuration values that will allow the user
to register his phone (which will likely be a softphone, since the hardphone on the user’s
desk will, in most cases, be configured from a central location) via SIP by using his
username and password, just as he would normally log in to check email and such.
The configuration file we’ll create next will get imported with the ldapadd command
and will be added into the people object unit within the shifteight.org space. Be sure to
change the values to match those of the user you wish to set up in LDAP and to sub-
stitute dc=shifteight,dc=org with your own location.
Before we create our file, though, we need to convert the password into an MD5 hash.
Asterisk will not authenticate phones using plain-text passwords when connecting via
LDAP. We can convert the password using the md5sum command:
$ echo "my_secret_password" | md5sum
a7be810a28ca1fc0668effb4ea982e58 -
LDAP Integration | 435