CIS OpenLDAP Benchmark

Security configuration benchmark for OpenLDAP directory service

v1.0.0 03-2025

Overview

▶

This benchmark provides prescriptive guidance for establishing a secure configuration posture for OpenLDAP. It covers TLS encryption, access control lists, anonymous bind prevention, password policy enforcement, audit logging, query limits, and backup procedures.

14Recommendations
7Sections
2Profile Levels
SectionAreaFocus
1Installation & PermissionsProcess user, database directory security
2TLS ConfigurationCertificate setup, encrypted connection enforcement
3Access ControlACL policies, anonymous bind prevention
4Password PolicyPassword overlay, hash algorithm strength
5Logging & AuditingAudit overlay, syslog log levels
6Performance & LimitsQuery limits, database indexing
7Maintenance & BackupsVersion management, LDIF backup automation

Profile Definitions

▶
ProfileDescriptionIntended Use
L1Level 1 — StandardEssential security for all OpenLDAP deployments; minimal performance impact.
L2Level 2 — HardenedAdvanced hardening for PCI-DSS, HIPAA, or high-security environments.

1 — Installation & Permissions

▶

1.1 Process & Data Security

▶
1.1.1 Ensure slapd runs as the ldap user (Automated)
L1 Auto
Description

This recommendation verifies that slapd runs as the ldap user on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Verify slapd runs as ldap user
ps -eo user,pid,comm | grep slapd
grep -E '^User|^Group' /etc/default/slapd
Remediation
# Ensure slapd runs as ldap user
usermod -s /usr/sbin/nologin ldap
chown -R ldap:ldap /var/lib/ldap /etc/ldap/slapd.d
# In /etc/default/slapd:
# SLAPD_USER="ldap"
# SLAPD_GROUP="ldap"
1.1.2 Ensure database directory permissions are restricted (Automated)
L1 Auto
Description

This setting ensures that database directory permissions are restricted on the OpenLDAP directory service. Restricting this capability limits potential abuse and enforces the principle of least privilege across the environment.

Rationale

Unrestricted access to this capability could allow unauthorized users or processes to perform actions beyond their intended scope. Applying least-privilege principles to the OpenLDAP directory service is essential for defense in depth.

Audit
# Check database directory permissions
stat -c '%a %U %G' /var/lib/ldap
find /var/lib/ldap -type f -exec stat -c '%a %n' {} \;
Remediation
# Restrict database permissions
chmod 700 /var/lib/ldap
chown ldap:ldap /var/lib/ldap
chmod 600 /var/lib/ldap/*.mdb

2 — TLS Configuration

▶

2.1 Transport Encryption

▶
2.1.1 Ensure TLS certificates are configured (Automated)
L1 Auto
Description

This recommendation verifies that TLS certificates are configured on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Verify TLS is configured
ldapsearch -x -H ldaps://localhost -b '' -s base 'namingContexts' 2>&1 | head -5
grep -r 'olcTLSCertificate' /etc/ldap/slapd.d/
Remediation
# Configure TLS for slapd
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: cn=config
changetype: modify
add: olcTLSCACertificateFile
olcTLSCACertificateFile: /etc/ldap/certs/ca.pem
-
add: olcTLSCertificateFile
olcTLSCertificateFile: /etc/ldap/certs/server.pem
-
add: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/ldap/certs/server-key.pem
EOF
2.1.2 Ensure encrypted connections are required (Automated)
L1 Auto
Description

This recommendation ensures that encrypted connections are required on the OpenLDAP directory service. Enforcing this requirement establishes a minimum security standard and prevents insecure configurations.

Rationale

Without this enforcement, the OpenLDAP directory service may accept insecure configurations that weaken overall security posture. Mandating this control ensures consistent protection against common attack vectors.

Audit
# Verify StartTLS or LDAPS is required
grep -r 'olcSecurity\|olcLocalSSF' /etc/ldap/slapd.d/
grep 'SLAPD_SERVICES' /etc/default/slapd
Remediation
# Require encrypted connections
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: cn=config
changetype: modify
add: olcSecurity
olcSecurity: ssf=128
EOF
# In /etc/default/slapd:
# SLAPD_SERVICES="ldap:/// ldaps:/// ldapi:///"

3 — Access Control

▶

3.1 ACLs & Authentication

▶
3.1.1 Ensure restrictive ACLs are configured (Automated)
L1 Auto
Description

This recommendation verifies that restrictive ACLs are configured on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check ACL configuration
ldapsearch -Y EXTERNAL -H ldapi:/// -b 'cn=config' 'olcAccess' 2>/dev/null | grep olcAccess
Remediation
# Configure restrictive ACLs
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword by self write by anonymous auth by * none
olcAccess: {1}to * by self read by users read by * none
EOF
3.1.2 Ensure anonymous bind is disabled (Automated)
L1 Auto
Description

This recommendation verifies that anonymous bind is disabled on the OpenLDAP directory service. Disabling or removing unnecessary components reduces the attack surface and limits potential vectors for exploitation.

Rationale

Running unnecessary components on the OpenLDAP directory service increases the attack surface and the risk of exploitation. Disabling or removing them follows the principle of least functionality and reduces exposure to known vulnerabilities.

Audit
# Verify anonymous bind is disabled
ldapsearch -x -H ldap://localhost -b '' -s base 'namingContexts' 2>&1
grep -r 'olcDisallows\|olcRequires' /etc/ldap/slapd.d/
Remediation
# Disable anonymous binds
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: cn=config
changetype: modify
add: olcDisallows
olcDisallows: bind_anon
-
add: olcRequires
olcRequires: authc
EOF

4 — Password Policy

▶

4.1 Password Enforcement

▶
4.1.1 Ensure password policy overlay is enabled (Automated)
L1 Auto
Description

This recommendation verifies that password policy overlay is enabled on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Verify password policy overlay is loaded
ldapsearch -Y EXTERNAL -H ldapi:/// -b 'cn=config' '(objectClass=olcPPolicyConfig)' 2>/dev/null
Remediation
# Enable password policy overlay
ldapadd -Y EXTERNAL -H ldapi:/// <<EOF
dn: cn=module{0},cn=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: ppolicy

dn: olcOverlay=ppolicy,olcDatabase={1}mdb,cn=config
objectClass: olcPPolicyConfig
olcOverlay: ppolicy
olcPPolicyDefault: cn=default,ou=policies,dc=example,dc=com
olcPPolicyHashCleartext: TRUE
olcPPolicyUseLockout: TRUE
EOF
4.1.2 Ensure strong password hashing is configured (Automated)
L1 Auto
Description

This recommendation verifies that strong password hashing is configured on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check password hash algorithm
ldapsearch -Y EXTERNAL -H ldapi:/// -b 'cn=config' 'olcPasswordHash' 2>/dev/null
Remediation
# Set strong password hashing
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: cn=config
changetype: modify
add: olcPasswordHash
olcPasswordHash: {SSHA}
EOF
# For even stronger hashing, use {ARGON2} with pw-argon2 module

5 — Logging & Auditing

▶

5.1 Audit & Log Configuration

▶
5.1.1 Ensure audit logging overlay is enabled (Automated)
L1 Auto
Description

This recommendation verifies that audit logging overlay is enabled on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Verify audit logging is enabled
grep -r 'olcAuditlog\|auditlog' /etc/ldap/slapd.d/
ls -la /var/log/ldap/
Remediation
# Enable audit logging overlay
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: cn=module{0},cn=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: auditlog

dn: olcOverlay=auditlog,olcDatabase={1}mdb,cn=config
objectClass: olcAuditlogConfig
olcOverlay: auditlog
olcAuditlogFile: /var/log/ldap/audit.ldif
EOF
5.1.2 Ensure appropriate log level is configured (Automated)
L1 Auto
Description

This recommendation verifies that appropriate log level is configured on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check slapd logging level
grep -r 'olcLogLevel' /etc/ldap/slapd.d/
Remediation
# Set appropriate log level
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: cn=config
changetype: modify
replace: olcLogLevel
olcLogLevel: stats acl
EOF
# Ensure syslog captures:
# /etc/rsyslog.d/slapd.conf:
# local4.* /var/log/ldap/slapd.log

6 — Performance & Limits

▶

6.1 Query Limits & Indexing

▶
6.1.1 Ensure query size and time limits are configured (Automated)
L1 Auto
Description

This recommendation verifies that query size and time limits are configured on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Verify size and time limits
grep -r 'olcSizeLimit\|olcTimeLimit' /etc/ldap/slapd.d/
Remediation
# Set query limits
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: cn=config
changetype: modify
add: olcSizeLimit
olcSizeLimit: 500
-
add: olcTimeLimit
olcTimeLimit: 60
EOF
6.1.2 Ensure proper database indexes are configured (Automated)
L1 Auto
Description

This recommendation verifies that proper database indexes are configured on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check index configuration for performance
ldapsearch -Y EXTERNAL -H ldapi:/// -b 'olcDatabase={1}mdb,cn=config' 'olcDbIndex' 2>/dev/null
Remediation
# Configure proper indexes
ldapmodify -Y EXTERNAL -H ldapi:/// <<EOF
dn: olcDatabase={1}mdb,cn=config
changetype: modify
add: olcDbIndex
olcDbIndex: uid eq
olcDbIndex: cn eq,sub
olcDbIndex: mail eq
olcDbIndex: objectClass eq
olcDbIndex: memberOf eq
olcDbIndex: entryCSN eq
olcDbIndex: entryUUID eq
EOF

7 — Maintenance & Backups

▶

7.1 Updates & Data Protection

▶
7.1.1 Ensure OpenLDAP is running the latest stable version (Manual)
L1 Manual
Description

This recommendation verifies that OpenLDAP is running the latest stable version on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check OpenLDAP version
slapd -V 2>&1
dpkg -l slapd 2>/dev/null || rpm -q openldap-servers 2>/dev/null
Remediation
# Update OpenLDAP to latest stable
apt-get update && apt-get install --only-upgrade slapd
# Or on RHEL:
yum update openldap-servers
7.1.2 Ensure automated LDIF backups are configured (Automated)
L1 Auto
Description

This recommendation verifies that automated LDIF backups are configured on the OpenLDAP directory service. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the OpenLDAP directory service vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Verify backup configuration
ls -la /var/backups/ldap/
crontab -l | grep slapcat
Remediation
# Configure automated LDIF backups
mkdir -p /var/backups/ldap
# Add cron:
# 0 2 * * * slapcat -n 1 > /var/backups/ldap/backup-$(date +\%Y\%m\%d).ldif 2>/dev/null
# 0 2 * * * slapcat -n 0 -b cn=config > /var/backups/ldap/config-$(date +\%Y\%m\%d).ldif 2>/dev/null