OpenLDAP / AD Integration - Centralized User Management

OpenLDAP / AD Integration - Centralized User Management

February 5, 2025
6 min read
Table of Contents
index

Introduction

In hybrid IT environments, where Linux and Windows servers coexist, managing user authentication can be tricky. A centralized auth system ensures simplicity, security, and efficiency by synchronizing user accounts and credentials between systems.

This project integrated a CentOS Linux server running OpenLDAP with a Windows Server 2019 Active Directory (AD) domain, so that AD accounts can authenticate on the Linux side while the local OpenLDAP directory shares the same naming base.

Key elements include configuring DNS for inter-server communication, setting up Kerberos authentication for secure interaction, and using Samba services to join the Linux server to the AD domain.

Important

This is not a step by step guide, but an oversimplified explanation of the project workings.

System architecture

Windows and Linux Server Infrastructure

I used VMware Workstation Pro with two virtual machines:

ServerIPDNSServices
adserver.adserver.local192.168.1.10127.0.0.1Active Directory Domain Services, DNS Server
openldap.adserver.local192.168.1.20192.168.1.10OpenLDAP 2.4, Samba 4.12, SSSD, Kerberos 5

The network configuration uses bridge mode for direct L2 communication between virtual nodes, ensuring low latency and seamless SMB/CIFS protocol operation.

DNS Hierarchy and Zone Delegation

The Windows DNS server is configured as authoritative for the adserver.local zone, with an explicit A record for the Linux server (openldap.adserver.local → 192.168.1.20).

The reverse zone for 192.168.1.0/24 enables PTR queries for reverse lookup functionality.

PowerShell commands for creating zones:

powershell
Add-DnsServerPrimaryZone -NetworkID "192.168.1.0/24" -ReplicationScope "Forest"
Add-DnsServerResourceRecordA -Name "openldap" -IPv4Address "192.168.1.20"

This eliminates dependence on external DNS resolvers and enables dynamic registration of clients through Samba.

Note

A .local domain is fine for an isolated lab, but in production the AD domain should be a subdomain of a registered domain (e.g. ad.example.com), since .local is reserved for mDNS and causes resolution conflicts.

Two

Configuring Windows Active Directory

Initial Procedure for Promotion to DC

After the basic installation of Windows Server I promoted the server to a Domain Controller with the new forest, adserver.local.

The functionality of AD can be verified through the Active Directory Users and Computers console, where test users (e.g., “Marko,” “Darko”) were created.

WindowsADPing

Linux OpenLDAP and Samba Integration

Basic OpenLDAP Installation Procedure

Terminal window
yum install -y openldap-servers openldap-clients sssd samba samba-client
  1. slapd.conf:
database mdb
suffix "dc=adserver,dc=local"
rootdn "cn=admin,dc=adserver,dc=local"
rootpw {SSHA}...

The slappasswd tool was used to generate the hashed administrator password.

Slapd
  1. LDAP Schema Import:
Terminal window
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
  1. Basic Organizational Unit:
dn: ou=People,dc=adserver,dc=local
objectClass: organizationalUnit
ou: People

Kerberos authentication was configured through /etc/krb5.conf, directing KDC requests to the Windows Server.

getent

Samba as AD Domain Member

Samba configuration in /etc/samba/smb.conf focused on the LDAP backend and AD integration:

[global]
workgroup = ADSERVER
security = ads
realm = ADSERVER.LOCAL
idmap config * : backend = tdb
idmap config * : range = 3000-7999
winbind use default domain = yes

The domain joining process was performed with the command:

Terminal window
net ads join -U Administrator

Validation of successful joining was verified through wbinfo -u, which displays users from AD.

samba

Verifying Users from Both Directories

AD users are visible on the Linux server through winbind (wbinfo -u, getent passwd), while users created in the local OpenLDAP directory are queried with ldapsearch:

Terminal window
ldapsearch -x -H ldap://localhost -b "ou=People,dc=adserver,dc=local"
dn: uid=marko,ou=People,dc=adserver,dc=local
objectClass: inetOrgPerson
uid: marko
sn: Markovic
givenName: Marko
mail: marko@adserver.local
userPassword: {SSHA}...

Winbind maps AD SIDs to UNIX UID/GID values from the idmap range configured in smb.conf. With the tdb backend these mappings are allocated locally, so they can differ between Linux hosts; for several domain members the rid or ad backend gives consistent IDs everywhere.

Note that this setup does not synchronize accounts between the two directories: AD remains the source for domain users, and OpenLDAP holds its own entries. True synchronization would need a dedicated tool or a trust-based design (see FreeIPA below).

Security Aspects and Authentication Protocols

Kerberos Authentication Test

Kerberos auth testing:

Terminal window
kinit administrator@ADSERVER.LOCAL
klist

The output shows a successfully obtained TGT (Ticket Granting Ticket)

SASL/GSSAPI Integration

OpenLDAP was configured to support the GSSAPI mechanism through olcSaslSecProps parameters in the cn=config DIT:

olcSaslSecProps: noanonymous,minssf=112

This enables encrypted LDAP communication using Kerberos tickets.

Alternative Approaches and Problems

FreeIPA Integration Attempts

The experiment with FreeIPA showed the possibility of LDAP synchronization through the ipa-replica-manage tool, but the configuration complexity and manual management of ldif files were identified as major drawbacks compared to the Samba solution.

Errors in DNS Configuration

Initial problems with reverse zones were resolved by adding explicit PTR records and checking the nslookup tool. Example fix:

Terminal window
Add-DnsServerResourceRecordPtr -Name "20" -PtrDomainName "openldap.adserver.local"

Conclusion

The Linux server was joined to the AD domain through Samba/winbind, AD users can obtain Kerberos tickets and resolve on the Linux side, and OpenLDAP was configured with SASL/GSSAPI on the same naming base. The main lessons were that DNS (including reverse zones) has to be correct before anything Kerberos-related works, and that “integration” and “synchronization” are different goals that call for different tools.