OpenLDAP Tips and Tricks
Having spent too much of this week debugging problems around migrating ldap servers from RHEL5 to RHEL6, here are some miscellaneous notes to self:
The service is named
ldap
on RHEL5, andslapd
on RHEL6 e.g. you doservice ldap start
on RHEL5, butservice slapd start
on RHEL6On RHEL6, you want all of the following packages installed on your clients:
yum install openldap-clients pam_ldap nss-pam-ldapd
This seems to be the magic incantation that works for me (with real SSL certificates, though):
authconfig --enableldap --enableldapauth \ --ldapserver ldap.example.com \ --ldapbasedn="dc=example,dc=com" \ --update
Be aware that there are multiple ldap configuration files involved now. All of the following end up with ldap config entries in them and need to be checked:
- /etc/openldap/ldap.conf
- /etc/pam_ldap.conf
- /etc/nslcd.conf
- /etc/sssd/sssd.conf
Note too that
/etc/openldap/ldap.conf
uses uppercased directives (e.g.URI
) that get lowercased in the other files (URI
->uri
). Additionally, some directives are confusingly renamed as well - e.g.TLA_CACERT
in/etc/openldap/ldap.conf
becomestla_cacertfile
in most of the others. :-(If you want to do SSL or TLS, you should know that the default behaviour is for ldap clients to verify certificates, and give misleading bind errors if they can't validate them. This means:
if you're using self-signed certificates, add
TLS_REQCERT allow
to/etc/openldap/ldap.conf
on your clients, which means allow certificates the clients can't validateif you're using CA-signed certificates, and want to verify them, add your CA PEM certificate to a directory of your choice (e.g.
/etc/openldap/certs
, or/etc/pki/tls/certs
, for instance), and point to it usingTLA_CACERT
in/etc/openldap/ldap.conf
, andtla_cacertfile
in/etc/ldap.conf
.
RHEL6 uses a new-fangled
/etc/openldap/slapd.d
directory for the old/etc/openldap/slapd.conf
config data, and the RHEL6 Migration Guide tells you to how to convert from one to the other. But if you simply rename the defaultslapd.d
directory, slapd will use the old-styleslapd.conf
file quite happily, which is much easier to read/modify/debug, at least while you're getting things working.If you run into problems on the server, there are lots of helpful utilities included with the
openldap-servers
package. Check out the manpages forslaptest(8)
,slapcat(8)
,slapacl(8)
,slapadd(8)
, etc.
Further reading:
- RHEL6 Migration Planning Guide
- http://people.redhat.com/alikins/ldap/ldap.html
- http://islandlinux.org/howto/installing-secure-ldap-openldap-ssl-ubuntu-using-self-signed-certificate