Skip to main content
RunBook Academy

LinuxXXVII · Authentication and Enterprise IdentitySSSD

SSSD architecture - the system security services daemon

Advanced⏱ ~12 minsssctlsssd

What you'll learn

  • Describe SSSD's role in central identity
  • Configure sssd.conf for LDAP or AD
  • Secure the LDAP transport with StartTLS or LDAPS and certificate validation
  • Use sssctl and sss_cache for diagnosis
  • Tune SSSD caching and offline behaviour

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

SSSD (System Security Services Daemon) is the modern way to integrate Linux with LDAP, Active Directory, and FreeIPA. It provides NSS for user/group lookups, PAM for authentication, and offline support via local caching.

What SSSD does

application (login, ssh, sudo, ...)
       |
       v
   NSS / PAM
       |
       v
   SSSD (sssd_nss, sssd_pam)
       |
       v
   LDAP / Kerberos / AD

SSSD:

  • Connects to LDAP, AD, or FreeIPA.
  • Caches identity information locally.
  • Provides offline auth (cached credentials work when the central server is unreachable).
  • Handles Kerberos ticket management.

Configuration

/etc/sssd/sssd.conf:

[sssd]
domains = example.com
config_file_version = 2
services = nss, pam

[domain/example.com]
id_provider = ad
access_provider = ad
ad_server = dc1.example.com, dc2.example.com
ad_domain = example.com
krb5_realm = EXAMPLE.COM
krb5_server = dc1.example.com, dc2.example.com

# Caching
cache_credentials = true
entry_cache_timeout = 600
offline_credentials_expiration = 30

The file must be mode 600 owned by root, or SSSD refuses to start.

For AD integration

# Install
sudo apt install sssd-ad sssd-tools realmd adcli krb5-user

# Discover
sudo realm discover example.com

# Join (one-time, requires AD admin credentials)
sudo realm join example.com --user=Administrator

realm join configures SSSD, Kerberos, and NSS/PAM automatically.

For OpenLDAP

sudo apt install sssd-ldap
# /etc/sssd/sssd.conf
[domain/ldap]
id_provider = ldap
auth_provider = krb5

# Encrypted transport. Either LDAPS on 636...
ldap_uri = ldaps://ldap.example.com:636
# ...or plain LDAP on 389 upgraded with StartTLS:
# ldap_uri = ldap://ldap.example.com
# ldap_id_use_start_tls = True

# Validate the server certificate. Without this, encryption
# without authentication is just a slower cleartext channel.
ldap_tls_reqcert = demand
ldap_tls_cacert = /etc/pki/tls/certs/ca-bundle.crt

ldap_search_base = dc=example,dc=com
krb5_server = kdc.example.com
krb5_realm = EXAMPLE.COM

On Debian and Ubuntu the CA bundle is /etc/ssl/certs/ca-certificates.crt; the path above is the RHEL location.

Diagnose

# SSSD status
sudo systemctl status sssd
sssctl domain-status example.com
sssctl user-show alice@EXAMPLE.COM

# Logs
sudo journalctl -u sssd -f

# Cache
sss_cache -E     # invalidate everything
sss_cache -u alice@EXAMPLE.COM    # specific user

# Test a lookup
getent passwd alice@EXAMPLE.COM

sssctl shows domain status, online/offline state, and cached entries.

Offline behaviour

When the central server is unreachable:

  • cache_credentials = true allows login with cached credentials (passwords, not Kerberos TGTs).
  • The host’s sssd switches to offline mode automatically.
  • After offline_credentials_expiration days, cached credentials expire and login fails.

Offline auth is critical for laptops and for hosts that may lose network connectivity.

Performance tuning

[domain/example.com]
# Cache longer to reduce LDAP load
entry_cache_timeout = 3600

# Cache user credentials longer for offline
cache_credentials = true
offline_credentials_expiration = 30

# Use a single server (less negotiation)
ad_server = dc1.example.com

# Reduce lookup timeouts
ldap_opt_timeout = 5

Common failure modes

  • SSSD refuses to start: sssd.conf permissions are not 600 or have wrong ownership.
  • Lookup fails: id_provider misconfigured, base DN wrong.
  • Auth fails but lookup succeeds: auth_provider and id_provider disagree.
  • Offline mode stuck: sss_cache -E or restart SSSD.
  • DNS issues: SSSD relies on DNS to find AD servers.
  • Plaintext LDAP: ldap:// with no StartTLS sends the whole directory - and, with auth_provider = ldap, user passwords - in the clear, and lets anyone answering on port 389 forge UID and GID mappings. Always set ldap_id_use_start_tls = True and ldap_tls_reqcert = demand, and verify with ldapsearch -ZZ.
  • TLS misconfigured: SSSD logs Could not start TLS or a certificate verification error and the domain never comes online. Check the CA path in ldap_tls_cacert and that the certificate’s subject matches the hostname in ldap_uri - an IP address in the URI will not match a name in the certificate.

Knowledge check

Knowledge check · 5 questions

  1. Q1. What is the role of SSSD?

  2. Q2. SSSD refuses to start if /etc/sssd/sssd.conf is not owned by root with mode 0600.

  3. Q3. Which of the following are valid SSSD id_provider values? Select all that apply.

  4. Q4. A host is configured with ldap_uri = ldap://ldap.example.com and nothing else about TLS. Beyond the directory being readable on the wire, what is the worst realistic consequence?

  5. Q5. ldapsearch -H ldap://server -x -b dc=example,dc=com proves that SSSD will use an encrypted connection.

Passing score: 75%. Answers are checked in this browser.