OpenLDAP: The Reference LDAP Directory Server

OpenLDAP: The Reference LDAP Directory Server

OpenLDAP is the directory server that most other things in this category are either built on or compared against.

What a directory actually is

A hierarchical database optimised for reads, storing entries with attributes under a tree rooted at a base distinguished name such as dc=example,dc=com. Users, groups, hosts, printers, and anything else with a stable identity.

The important property is that it is read-optimised and replicated, which is what makes it suitable as the authority many services query on every login. It is a poor choice for data that changes constantly.

Where it sits

OpenLDAP provides the protocol and the storage. It does not provide Kerberos, a certificate authority, DNS, or a management interface, which is the difference between it and FreeIPA: FreeIPA bundles a directory with everything around it, OpenLDAP is the directory alone.

That makes OpenLDAP the right choice when you want a directory and nothing else, and the wrong one when you wanted the bundle and did not realise how much of it you would be assembling.

The configuration learning curve

Modern OpenLDAP is configured through cn=config, a directory tree rather than the older slapd.conf file, which means you change the server’s configuration by writing LDIF against the running server. That is powerful, auditable and genuinely unintuitive the first time.

Schema definitions, overlays such as memberof and ppolicy, and access control lists expressed as olcAccess rules are where most of the real work lives.

Clients

On Linux, SSSD is the sensible client rather than talking to LDAP directly, because it caches credentials so a laptop works offline. Our nsswitch and SSSD guide covers the configuration and the ldap_tls_reqcert setting that must not be left permissive.

ldapsearch -x -H ldaps://ldap.example.com -b 'dc=example,dc=com'
getent passwd alice

Operational caution

Always use LDAPS or StartTLS. An unencrypted directory connection carries credentials and is the authority deciding who is root on your machines.

Back up with slapcat to LDIF rather than copying the database files, and test the restore.

License

OpenLDAP is released under the OpenLDAP Public License, a permissive BSD-style licence.