On this pageWhat travels over an LDAP connection
LDAP is how applications ask a directory who a user is and which groups they belong to. Active Directory speaks it, OpenLDAP speaks it, and a long list of software uses it to check passwords: Git forges, wikis, VPN gateways, NAS boxes and single sign-on platforms. Plain LDAP sends those passwords in readable form. This guide compares the two ways to protect it, explains what recent Windows Server releases changed by default, and shows how to turn on TLS and prove it works in Active Directory and OpenLDAP.
What travels over an LDAP connection
A client connects, authenticates with a bind, then searches or modifies entries. Two kinds of bind matter:
- Simple bind: the client sends a name and the password itself. Without TLS, anyone on the network path can read it.
- SASL bind: Kerberos or NTLM in Active Directory. The password itself never crosses the wire, but without signing or TLS the session can be tampered with, and NTLM can be relayed.
Most applications bind with a service account to search for the user, then bind again as that user to check the password. One unprotected application therefore leaks two sets of credentials.
Three ways to connect
| Method | Port | How TLS starts | Notes |
|---|---|---|---|
| Plain LDAP | 389 | Never | Unsafe for anything that carries credentials |
| LDAP with StartTLS | 389 | The client asks to upgrade, then negotiates TLS on the same connection | The method the LDAPv3 standards define |
| LDAPS | 636 | TLS from the first byte | Never part of the LDAPv3 standards, yet supported almost everywhere |
| Active Directory global catalog | 3268, 3269 | 3269 uses TLS from the first byte | Forest-wide searches |
Both protected methods are sound. StartTLS has one trap: a client set to "try" TLS may carry on in plain text when the upgrade fails. OpenLDAP's tools make the difference explicit: -Z tries StartTLS and continues without it, while -ZZ stops if TLS cannot start. LDAPS has no such ambiguity, which makes it the safer choice for applications that offer a single "use SSL" checkbox.
Active Directory: what changed recently
Microsoft has tightened LDAP in steps over several years, and Windows Server 2025 changed the defaults for new domains:
- Signing is required by default for new Active Directory deployments on Windows Server 2025. An upgrade keeps an existing signing policy; where no policy was set, signing becomes required. On Windows Server 2022 and earlier, signing stays optional unless you enforce it.
- Signing does not protect simple binds. A domain controller that enforces signing rejects simple binds over unencrypted connections. Applications that do a simple bind on port 389 stop working until they move to LDAPS or StartTLS.
- Channel binding ties a SASL bind to the TLS session it runs in, which stops NTLM credentials relayed through another TLS session. The policy Domain controller: LDAP server channel binding token requirements accepts Never, When supported or Always. New Windows Server 2025 deployments default to When supported; earlier versions default to Never.
- TLS 1.3 is supported for LDAP over TLS on Windows Server 2025.
Before you enforce anything, find the clients that would break. Event 2887 in the Directory Service log is a 24-hour count of unsigned and clear-text binds. Event 2889 names each client's address and account, once diagnostic logging is raised:
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics' -Name '16 LDAP Interface Events' -Value 2 -Type DWord
Get-WinEvent -FilterHashtable @{ LogName = 'Directory Service'; Id = 2889 } -MaxEvents 20
Set the value back to 0 once you have your list, because detailed logging costs performance. Events 3074 and 3075 report clients that would fail channel binding. The usual offenders are appliances and older software: printers looking up address books, NAS boxes, VPN gateways and scripts that perform simple binds on port 389. Each one needs a TLS setting, an update or a replacement before enforcement.
Turn on LDAPS in Active Directory
There is no switch to flip. A domain controller starts accepting LDAPS on ports 636 and 3269 as soon as it finds a suitable certificate. Microsoft's requirements:
- The certificate sits in the Local Computer Personal store, or in the NTDS service's own store, which takes precedence when it holds a certificate.
- Its private key is present and associated with it.
- Its Enhanced Key Usage includes Server Authentication (
1.3.6.1.5.5.7.3.1). - The domain controller's fully qualified name appears in the subject or in a DNS entry of the Subject Alternative Name.
- Both the domain controller and the clients trust the issuing certification authority.
With an enterprise certification authority from Active Directory Certificate Services, domain controllers usually enroll a suitable certificate on their own, which is why LDAPS sometimes works before anyone set it up. Active Directory picks up a new certificate placed in the NTDS store without a restart. Check the result from a Linux machine that will be a client:
openssl s_client -connect dc01.corp.example.com:636 -servername dc01.corp.example.com </dev/null 2>/dev/null | grep -E 'subject=|Verify return code'
Verify return code: 0 (ok) means the chain is trusted by that machine. On Windows, ldp.exe connects to port 636 with SSL ticked and prints the RootDSE on success.
Turn on TLS in OpenLDAP
On Debian and Ubuntu, slapd is configured through cn=config. Copy the certificate and key to /etc/ldap/, give the key to the openldap group with mode 0640, then load the paths with an LDIF file:
dn: cn=config
add: olcTLSCACertificateFile
olcTLSCACertificateFile: /etc/ssl/certs/example-ca.pem
-
add: olcTLSCertificateFile
olcTLSCertificateFile: /etc/ldap/ldap01_cert.pem
-
add: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/ldap/ldap01_key.pem
sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f tls.ldif
ldapwhoami -x -ZZ -H ldap://ldap01.example.com # StartTLS, works without a restart
To refuse old protocol versions, also add olcTLSProtocolMin: 3.3, which means TLS 1.2 in OpenLDAP's numbering. For LDAPS, add ldaps:/// to SLAPD_SERVICES in /etc/default/slapd, restart slapd and test with ldapwhoami -x -H ldaps://ldap01.example.com. Both commands should answer anonymous. Once every client uses LDAPS, SLAPD_SERVICES="ldapi:/// ldaps:///" stops slapd listening on port 389 at all, while local administration keeps working over the ldapi socket.
On clients, point TLS_CACERT in /etc/ldap/ldap.conf at the issuing authority's certificate. Leave TLS_REQCERT at its client default, demand, which refuses servers whose certificate cannot be verified.
Configure applications without weakening TLS
- Use
ldaps://and port 636, or StartTLS set to required rather than optional. - Connect by the DNS name in the certificate, not by IP address.
- Give the application the authority's certificate. Never tick "skip certificate verification" outside a lab.
- Use a read-only service account limited to the parts of the directory the application needs.
- Allow LDAP ports only from the application servers. If the directory runs on a CloudSat server, a cloud firewall rule admitting TCP 636 only from those addresses keeps it off the internet.
Test from the application server with the same account the application will use:
ldapsearch -H ldaps://dc01.corp.example.com -x -D 'svc-wiki@corp.example.com' -W \
-b 'dc=corp,dc=example,dc=com' '(sAMAccountName=jdoe)' cn memberOf
FAQ
Is LDAPS deprecated?
No. It remains the most widely supported way to protect LDAP, and Windows Server 2025 added TLS 1.3 support for it. StartTLS is the standards-based alternative, not a replacement that retires it.
Does LDAP signing replace LDAPS?
No. Signing protects the integrity of SASL sessions that do not use TLS, but it does not encrypt them and does not protect simple binds at all. TLS covers both.
Can I use a self-signed certificate?
It works if every client trusts that exact certificate, and it becomes painful at renewal time. An internal certification authority, trusted once by every client, scales better.
Should LDAP ever be reachable from the internet?
No. Keep the directory on private networks and let internet-facing logins go through a single sign-on service in front of it, as compared in self-hosted SSO options.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




