LDAP Certificate Rotation Breaks SSSD and Local sudo
A RHEL 9 fleet authenticates SSH users through SSSD against an OpenLDAP directory, with PAM requiring a TOTP token via pam_google_authenticator after the password. nsswitch.conf has passwd: files sss and sudoers: files sss. During a directory migration the LDAP servers were moved behind a new load balancer whose TLS certificate does not match the hostname in sssd.conf, and the old VIP was decommissioned. Within minutes, SSH logins for directory users hang for about 25 seconds and then fail with 'Permission denied'. Local accounts also become slow to resolve, and sudo starts timing out for everyone. The on-call engineer has a console session as root and wants to set enumerate = true and restart sssd to 'refresh the cache'. The fleet has 400 hosts, and the change window is 30 minutes.
1. Explain why a directory TLS failure degrades local account lookups and sudo, given that nsswitch lists files before sss.
Read the worked answer
passwd: files sss means glibc asks files first, then SSSD. A local user present in /etc/passwd should resolve from files without contacting SSSD. But the ordering does not protect against a slow second source for other lookups. group: files sss is consulted for supplementary groups via initgroups, and sudoers: files sss forces sudo to query the SSSD sudo responder. If SSSD's LDAP provider is stuck connecting to the new load balancer, the NSS, PAM, and sudo responders can block waiting on that provider, so even local lookups and sudo feel slow.
The 25-second hang is consistent with LDAP connection timeouts plus retries under a TLS handshake that either never completes or fails certificate validation. SSH also calls PAM (pam_sss, pam_systemd), and pam_sss waits on the same responder. Directory users fail because SSSD has no valid provider and, if cache_credentials is false or the cache is cold, cannot authenticate offline. The engineer's console root session works because it came from the local console and files, not because the system is healthy.
2. Evaluate the proposed `enumerate = true` plus sssd restart. Give a safer sequence to restore access and validate certificate trust within the 30-minute window.
Read the worked answer
Reject the proposal as stated. enumerate = true makes SSSD download the entire directory on every refresh, which is expensive for 400 hosts and an LDAP service already behind a broken TLS endpoint, and it does not address trust. Restarting SSSD before the certificate is fixed also clears the cache, removing any cached credentials that could carry users through the outage while the provider still cannot connect.
Safer sequence:
- Keep the console root session. Confirm break-glass access: a local account in
/etc/passwdwith a password and a rule in/etc/sudoers.d/that does not depend onsss. - Diagnose without restarting:
sssctl domain-status <domain> -o,journalctl -u sssd -n 200 --no-pager, andopenssl s_client -connect newlb.example.com:636 -servername ldap.example.com -CAfile /etc/openldap/certs/ca.crt. A hostname mismatch or untrusted chain will be explicit. - Fix the trust: point
ldap_uriat the name in the certificate, install the issuing CA atldap_tls_cacert, and keepldap_tls_reqcert = demand. Do not setnever. If service must be restored before a new certificate is issued,allowstill validates the chain and only skips hostname checking; time-box it and open a ticket. - Run
sssctl config-checkbefore restarting. Restart SSSD on one canary host, then testgetent passwd <user>,id <user>,sudo -l -U <user>, and a real SSH login. - Roll out through configuration management in waves. Do not run
sss_cache -Euntil the provider is healthy; clearing the cache during an outage removes offline authentication.
3. What caching, timeout, and monitoring settings would you standardize to prevent a repeat?
Read the worked answer
Settings:
cache_credentials = truewithentry_cache_timeout = 600, so identity lookups survive a provider outage.- Bounded network timeouts:
ldap_network_timeout = 3,ldap_opt_timeout = 5,dns_resolver_timeout = 5. A broken VIP should fail in seconds, not 25. ldap_tls_reqcert = demandwith a managed CA bundle, plus certificate-expiry alerts for the load balancer.- Keep
filesbeforesssin every nsswitch database. If sudo rules do not truly need to be central, manage them in/etc/sudoers.d/; if they do, keep the bounded timeouts and test the sudo responder explicitly. - Verify PAM ordering for
pam_mkhomedir,pam_sss, and the TOTP module with a canary account.
Monitoring:
- Export
sssctl domain-status <domain>online/offline state from the monitoring agent. - Time
getent passwd <directory-user>andid <user>every minute; alert above 2 seconds. - Alert on journal messages containing
TLS,certificate,Cannot contact, orOffline. - Synthetic LDAP StartTLS check from each site, plus certificate expiry monitoring.
- An hourly canary SSH login with a dedicated directory account that does not require TOTP, exercising NSS and PAM end to end.