When managing multiple Linux servers, the authentication dilemma boils down to three key requirements:
- Centralized user management (create/disable accounts once)
- Secure credential transmission (no plaintext passwords)
- Support for modern authentication protocols (SSO capabilities)
OpenLDAP remains the most common solution for centralized authentication. Here's a basic slapd.conf configuration snippet:
include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema database bdb suffix "dc=example,dc=com" rootdn "cn=admin,dc=example,dc=com" rootpw {SSHA}hashed_password_here
Pros: Mature technology, flexible schema, wide client support
Cons: Requires careful TLS configuration, no native ticket-based auth
A sample krb5.conf configuration for MIT Kerberos:
[libdefaults] default_realm = EXAMPLE.COM dns_lookup_realm = false dns_lookup_kdc = true [realms] EXAMPLE.COM = { kdc = kerberos.example.com admin_server = kerberos.example.com }
Key advantages include:
- Ticket-based authentication eliminates password transmission
- Supports mutual authentication
- Enables true Single Sign-On (SSO)
GSSAPI provides a standardized way for applications to use security services. Example SSH configuration:
# /etc/ssh/sshd_config GSSAPIAuthentication yes GSSAPICleanupCredentials yes UsePAM yes
This enables Kerberos authentication through SSH without password prompts when tickets are present.
Regardless of which protocol you choose:
- Always enforce TLS 1.2+ for LDAP (ldap:// vs ldaps://)
- Configure proper certificate validation (don't disable cert checks)
- Set up monitoring for authentication failures
- Implement proper firewall rules for authentication ports
The most robust enterprise solution combines both:
# /etc/sssd/sssd.conf [domain/example.com] id_provider = ldap auth_provider = krb5 krb5_server = kerberos.example.com ldap_uri = ldaps://ldap.example.com
This gives you centralized account management through LDAP while leveraging Kerberos for secure authentication.
When managing multiple Linux servers, centralized authentication becomes critical for security and maintainability. The three primary protocols we'll examine are:
- LDAP (Lightweight Directory Access Protocol)
- Kerberos
- GSSAPI (Generic Security Services Application Program Interface)
LDAP remains the most common solution for centralized authentication. With TLS/SSL encryption, it provides a good balance between security and complexity.
# Example: Configuring pam_ldap on Ubuntu
sudo apt install libpam-ldap ldap-utils
sudo pam-auth-update
# Select LDAP authentication when prompted
Pros of LDAP:
- Mature technology with extensive documentation
- Supports hierarchical organizational structures
- Relatively easy to implement with TLS
Cons:
- Password hashes traverse the network (mitigated with TLS)
- Limited support for single sign-on
Kerberos introduces a ticket-granting system that eliminates password transmission:
# Sample krb5.conf configuration
[libdefaults]
default_realm = EXAMPLE.COM
dns_lookup_realm = false
dns_lookup_kdc = true
[realms]
EXAMPLE.COM = {
kdc = kerberos.example.com
admin_server = kerberos.example.com
}
Key advantages:
- No password transmission after initial authentication
- Supports true single sign-on
- Mutual authentication prevents MITM attacks
GSSAPI works alongside Kerberos to provide a standardized interface for secure authentication:
// Example GSSAPI client code snippet
OM_uint32 maj_stat, min_stat;
gss_cred_id_t client_creds = GSS_C_NO_CREDENTIAL;
gss_name_t target_name;
gss_buffer_desc input_token, output_token = GSS_C_EMPTY_BUFFER;
Use cases where GSSAPI shines:
- Applications needing pluggable authentication modules
- Cross-platform authentication requirements
- Systems requiring delegation of credentials
For most small-to-medium Linux server environments:
- Start with OpenLDAP + TLS for core authentication
- Add Kerberos for services requiring SSO
- Use GSSAPI for custom applications
Remember to configure proper logging for all authentication systems:
# rsyslog configuration for LDAP/Kerberos
auth.* /var/log/auth.log
authpriv.* /var/log/auth.log
daemon.* /var/log/daemon.log