Again, nerdy stuff follows. Click away now if you were looking for pics of naked chicks or something.
Like a lot of people buying new hardware these days, we’ve recently started to look into migrating from CentOS 5 to CentOS 6. New hardware really is the only reason we’re looking to migrate. The new hardware isn’t supported by CentOS 5 kickstart and rolling your own updates into a new kickstart image can be a PITA. So why not upgrade to the new stuff? How hard can it be?
Kickstart and build stuff aside, the biggest problem we had with building some new CentOS 6 test boxes had to do with LDAP. You see, RedHat (and CentOS as a result) now supports 2 different providers for LDAP authentication. That’s right, two. The bad thing is that it’s 2 *new* providers. It’s not the “new way” and the “old way.” It’s the “new way” and the “other new way.” Those looking for seamless upgrades, keep wishing. Those who want to figure out how to do this easily, read on.
Basically, the old PADL NSS stuff is dead. They realized what a steaming pile of shit it was (memory leaks and all) and decided to scrap it. So they took a lot of the same stuff, renamed it, and pushed it out the door. I’ll call this the “nslcd/openldap/legacy stuff.” This is the closest method to “the old way” of doing things. But here’s the catch, they fucked it all up. It’s broken, convoluted, and not well documented. Worst, there’s a lot of bad advice floating around the Internet in places like StackOverflow, ServerFault, ExpertsExchange, etc. Ignore it all. Just read this page. Ignore any piece of documentation that has you configuring nslcd.conf.
Fedora/RedHat realized how terrible PADL software is, so they wrote their own stuff; it’s called SSSD. It’s a terrible name, but overall it works pretty well. Use SSSD, don’t use nslcd or anything that has pam_ldap or ldapd in the name. Just use SSSD. Update: This is the page that I used to learn about/configure sssd.
Here’s the idiot’s guide, super easy configuration:
- yum install sssd
- authconfig –enablesssd –enablesssdauth –enablelocauthorize –update
- Edit /etc/sssd/sssd.conf to look similar to this (I’m not going through each item — RTFM instead):
config_file_version = 2
services = nss, pam
domains = default
filter_users = root,ldap,named,avahi,haldaemon,dbus,radiusd,news,nscd
ldap_tls_reqcert = never
auth_provider = ldap
ldap_schema = rfc2307bis
krb5_realm = EXAMPLE.COM
ldap_search_base = dc=domain,dc=com
ldap_group_member = uniquemember
id_provider = ldap
ldap_id_use_start_tls = False
chpass_provider = ldap
ldap_uri = ldaps://ldapserver1/,ldaps://ldapserver2/
ldap_chpass_uri = ldaps://your.ldapwrite.server/
krb5_kdcip = kerberos.example.com
cache_credentials = True
ldap_tls_cacertdir = /etc/openldap/cacerts
entry_cache_timeout = 600
ldap_network_timeout = 3
ldap_access_filter = (&(objectclass=shadowaccount)(objectclass=posixaccount))
- Change the passwd, shadow, and group sections of /etc/nsswitch.conf to be “files sss”. Do not use “files ldap”. If you choose “files ldap”, you’ll tell the system to use the shitty PADL nslcd crap. Don’t do that!
- service sssd restart
- After that, you should be able to type “id $user” and get something back from LDAP. You can make sure it’s using the right LDAP servers by checking netstat (netstat -anp | grep sssd_be).
- That’s it. Don’t mess with nslcd.conf. Don’t install any nss-pam-ldapd packages or ldapd or anything. Just don’t do it. Use the RedHat/Fedora stuff and tell PADL to kiss your ass.
Setting up autofs, sudo, etc to use LDAP is almost exactly like it was in CentOS 5. For example, you do want to add “ldap” to nsswitch.conf for autofs. My one recommendation would be to ditch the RH/CentOS sudo packages andinstall one of the RPMs from the sudo page. You’ll be on the mainline versions *and* you’ll avoid the stupid /etc/ldap.conf /etc/nslcd.conf crap that RedHat ran into in their version of sudo. In short, they updated the sudo package to look for configuration information in /etc/nslcd.conf, but the nslcd binary won’t start if it sees directives it doesn’t understand in its conf file. Basically, if you use the “old PADL LDAP nslcd” crappy way of LDAP auth, you can’t use sudo. So don’t use it. Stick with the basic SSSD stuff and get a sudo RPM from the sudo.ws page that looks for information in /etc/ldap.conf.
Oh and if you use nscd with sssd, be sure and set the passwd and group caches to “no”. It’s good to run nscd as a DNS host name cache, but its user and group caching conflicts with sssd’s (which does its own).