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
ldapon RHEL5, andslapdon RHEL6 e.g. you doservice ldap starton RHEL5, butservice slapd starton RHEL6On RHEL6, you want all of the following packages installed on your clients:
yum install openldap-clients pam_ldap nss-pam-ldapdThis 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" \ --updateBe 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.confuses 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_CACERTin/etc/openldap/ldap.confbecomestla_cacertfilein 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 allowto/etc/openldap/ldap.confon 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_CACERTin/etc/openldap/ldap.conf, andtla_cacertfilein/etc/ldap.conf.
RHEL6 uses a new-fangled
/etc/openldap/slapd.ddirectory for the old/etc/openldap/slapd.confconfig data, and the RHEL6 Migration Guide tells you to how to convert from one to the other. But if you simply rename the defaultslapd.ddirectory, slapd will use the old-styleslapd.conffile 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-serverspackage. 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