Lesson 8 of 9 · 28m
Integrating Linux, Applications, and Service Authentication
Connect SSSD, PAM, NSS, SSH, sudo, and applications to LDAP without turning every outage into a total login failure.
The worst LDAP design is the one where a directory hiccup means engineers cannot log into the servers needed to fix the directory. Authentication integration is a resilience exercise first and a convenience exercise second. Your job is to decide what must work during partial failure, what must fail closed, and which cached state is acceptable.
Linux identity resolution is layered
A typical Linux host uses SSSD to provide NSS identity and PAM authentication:
[sssd]
services = nss, pam
domains = sudosecurity
[domain/sudosecurity]
id_provider = ldap
auth_provider = ldap
ldap_uri = ldaps://ldap.sudosecurity.org
ldap_search_base = dc=sudosecurity,dc=org
ldap_user_search_base = ou=people,dc=sudosecurity,dc=org
ldap_group_search_base = ou=groups,dc=sudosecurity,dc=org
ldap_tls_reqcert = demand
ldap_default_bind_dn = uid=hostbind,ou=services,dc=sudosecurity,dc=org
ldap_default_authtok_type = password
ldap_default_authtok = vault-managed-secret
cache_credentials = true
enumerate = falseenumerate = false is deliberate at scale. Full enumeration turns every host into a bulk directory client and often creates load without improving user experience.
Test identity and authentication separately
getent passwd amorales
id amorales
sudo -l -U amorales
ldapwhoami -x -H ldaps://ldap.sudosecurity.org -D 'uid=amorales,ou=people,dc=sudosecurity,dc=org' -Wgetent proves NSS resolution. A successful bind proves password authentication. id proves group resolution. sudo -l proves sudo policy visibility. Conflating these checks sends operators debugging PAM when the actual failure is group schema.
SSH keys and sudo policy belong to controlled schema
Centralizing sshPublicKey in LDAP is useful when lifecycle automation controls it. Do not let arbitrary users write keys to their own entry unless that authority model is intentional; write access to SSH keys is write access to login paths.
Sudo integration can use sudoRole entries with sudoUser, sudoHost, sudoCommand, and sudoOption. It is powerful and easy to overcomplicate. If only a handful of host groups need sudo rules, configuration management may be clearer than LDAP sudo schema.
Applications should use narrow service accounts
An application usually needs one of three patterns:
simple bind service account -> search user -> attempt user bind
read-only directory sync -> cache identity and groups locally
Kerberos/GSSAPI or SAML/OIDC -> use LDAP as backing identity inventoryLDAP bind authentication is not SSO. Passing the same password to every application increases phishing and credential-stuffing blast radius. Where possible, put OIDC/SAML in front for user login and reserve LDAP for legacy systems, host identity, and controlled service lookups.
Failure behavior must be explicit
Decide in advance whether host login may use cached credentials when the directory is unavailable, how long caches live, whether administrative break-glass accounts exist locally, and which applications fail closed. Write those decisions into incident documentation. During a directory outage, improvisation tends to become either total lockout or unsafe bypass.
Field notes
- A host that cannot resolve groups may authenticate a user but deny authorization later; logs often make this look like a password failure.
- Certificate hostname mismatches are common after load balancer migration; verify SNI and subject alternative names.
- Connection reuse matters. A process opening a TLS connection per login can exhaust the directory before legitimate traffic does.
- Keep emergency local accounts scarce, audited, and password-managed; uncontrolled break-glass accounts become permanent backdoors.
Was this lesson helpful?