Introduction to OpenLDAP

The OpenLDAP package provides an open source implementation of the Lightweight Directory Access Protocol.

This package is known to build and work properly using an LFS-7.4 platform.

Package Information

Additional Downloads

OpenLDAP Dependencies


Berkeley DB-6.0.20



ICU-51.2, MySQL-5.6.13 or PostgreSQL-9.3.0, OpenSLP, Pth-2.0.7 and unixODBC-2.3.1

User Notes:

Installation of OpenLDAP



Without the following patch, the Evolution Exchange addressbook integration uses simple binds with cleartext passwords. If you are going to build Evolution Data Server with OpenLDAP support, apply the following patch:

patch -Np1 -i ../openldap-2.4.36-ntlm-1.patch


If you only need to install the client side ldap* binaries, corresponding man pages, libraries and header files (referred to as a “client-only” install), issue the following configure command instead of the other one, and then proceed with the remaining commands (no test suite available):

patch -Np1 -i ../openldap-2.4.36-blfs_paths-1.patch &&
patch -Np1 -i ../openldap-2.4.36-symbol_versions-1.patch &&
autoconf &&
./configure --prefix=/usr     \
            --sysconfdir=/etc \
            --enable-dynamic  \
            --disable-debug   \
            --disable-slapd &&
make depend &&

There should be a dedicated user and group to take control of the slapd daemon after it is started. Issue the following commands as the root user:

groupadd -g 83 ldap &&
useradd -c "OpenLDAP Daemon Owner" -d /var/lib/openldap -u 83 \
        -g ldap -s /bin/false ldap

Install OpenLDAP by running the following commands:

patch -Np1 -i ../openldap-2.4.36-blfs_paths-1.patch &&
patch -Np1 -i ../openldap-2.4.36-symbol_versions-1.patch &&
autoconf &&
./configure --prefix=/usr         \
            --sysconfdir=/etc     \
            --localstatedir=/var  \
            --libexecdir=/usr/lib \
            --disable-static      \
            --disable-debug       \
            --enable-dynamic      \
            --enable-crypt        \
            --enable-spasswd      \
            --enable-modules      \
            --enable-rlookups     \
            --enable-backends=mod \
            --enable-overlays=mod \
            --disable-ndb         \
            --disable-sql &&
make depend &&

To test the results, issue: make test.

Now, as the root user:

make install &&

chown -R ldap:ldap /var/lib/openldap &&

install -v -dm755  /usr/share/doc/openldap-2.4.36 &&
cp -vfr doc/drafts /usr/share/doc/openldap-2.4.36 &&
cp -vfr doc/rfc    /usr/share/doc/openldap-2.4.36 &&
cp -vfr doc/guide  /usr/share/doc/openldap-2.4.36

Command Explanations

--disable-static: This switch prevents installation of static versions of the libraries.

--disable-debug: This switch disables the debugging code in OpenLDAP.

--enable-dynamic: This switch forces the OpenLDAP libraries to be dynamically linked to the executable programs.

--enable-crypt: This switch enables using of crypt(3) passwords.

--enable-spasswd: This switch enables SASL password verification.

--enable-modules: This switch enables dynamic module support.

--enable-rlookups: This switch enables reverse lookups of client hostnames.

--enable-backends: This switch enables all available backends.

--enable-overlays: This switch enables all available overlays.

--disable-ndb: This switch disables MySQL NDB Cluster backend which causes configure to fail if MySQL is present.

--disable-sql: This switch explicitly disables the SQL backend. Omit this switch if a SQL server is installed and you are going to use a SQL backend.

--enable-slp: This switch enables SLPv2 support. Use it if you have installed OpenSLP.



You can run ./configure --help to see if there are other switch you can pass to the configure command to enable other options or dependency packages.

Configuring OpenLDAP

Config Files


Configuration Information

Configuring the slapd servers can be complex. Securing the LDAP directory, especially if you are storing non-public data such as password databases, can also be a challenging task. You'll need to modify the /etc/openldap/slapd.conf and /etc/openldap/ldap.conf files to set up OpenLDAP for your particular needs.

Resources to assist you with topics such as choosing a directory configuration, backend and database definitions, access control settings, running as a user other than root and setting a chroot environment include:

Mozilla Address Directory

By default, LDAPv2 support is disabled in the slapd.conf file. Once the database is properly set up and Mozilla is configured to use the directory, you must add allow bind_v2 to the slapd.conf file.

Boot Script

To automate the startup of the LDAP server at system bootup, install the /etc/rc.d/init.d/slapd init script included in the blfs-bootscripts-20130908 package using the following command:

make install-slapd


The init script starts the daemon without any parameters. You'll need to modify the /etc/sysconfig/slapd to include the parameters needed for your specific configuration. See the slapd man page for parameter information.

Testing the Configuration

Start the LDAP server using the init script:

/etc/rc.d/init.d/slapd start

Verify access to the LDAP server with the following command:

ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts

The expected result is:

# extended LDIF
# LDAPv3
# base <> with scope base
# filter: (objectclass=*)
# requesting: namingContexts

namingContexts: dc=my-domain,dc=com

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1


Installed Programs: ldapadd, ldapcompare, ldapdelete, ldapexop, ldapmodify, ldapmodrdn, ldappasswd, ldapsearch, ldapurl, ldapwhoami, slapacl, slapadd, slapauth, slapcat, slapd, slapdn, slapindex, slappasswd, slapschema and slaptest
Installed Libraries:, and
Installed Directories: /etc/openldap, /usr/lib/openldap and /var/lib/openldap

Short Descriptions


opens a connection to an LDAP server, binds and adds entries.


opens a connection to an LDAP server, binds and performs a compare using specified parameters.


opens a connection to an LDAP server, binds and deletes one or more entries.


issues the LDAP extended operation specified by oid or one of the special keywords whoami, cancel, or refresh.


opens a connection to an LDAP server, binds and modifies entries.


opens a connection to an LDAP server, binds and modifies the RDN of entries.


is a tool used to set the password of an LDAP user.


opens a connection to an LDAP server, binds and performs a search using specified parameters.


is a command that allows to either compose or decompose LDAP URIs.


opens a connection to an LDAP server, binds and displays whoami information.


is used to check the behavior of slapd by verifying access to directory data according to the access control list directives defined in its configuration.


is used to add entries specified in LDAP Directory Interchange Format (LDIF) to an LDAP database.


is used to check the behavior of the slapd in mapping identities for authentication and authorization purposes, as specified in slapd.conf.


is used to generate an LDAP LDIF output based upon the contents of a slapd database.


is the standalone LDAP server.


checks a list of string-represented DNs based on schema syntax.


is used to regenerate slapd indexes based upon the current contents of a database.


is an OpenLDAP password utility.


is used to check schema compliance of the contents of a slapd database.


checks the sanity of the slapd.conf file.

is a set of Lightweight Basic Encoding Rules routines. These routines are used by the LDAP library routines to encode and decode LDAP protocol elements using the (slightly simplified) Basic Encoding Rules defined by LDAP. They are not normally used directly by an LDAP application program except in the handling of controls and extended operations.

supports the LDAP programs and provide functionality for other programs interacting with LDAP.

contains the functions required by the LDAP programs to produce the results from LDAP requests.

Last updated on 2013-08-26 10:26:25 -0700