Out of the box, an Active Directory domain controller answers LDAP on port 389 but has no certificate for LDAP over SSL (LDAPS) on port 636. Any application that binds to AD over plain LDAP sends directory traffic in clear text, and some operations, such as an application changing or resetting a user’s password, are refused unless the connection is encrypted. This tutorial shows how to enable LDAPS on a Windows Server 2008 R2 domain controller by installing Active Directory Certificate Services (AD CS) as an Enterprise Root CA, how to test it with ldp.exe and from Linux, how to read the errors you will hit, and what changes on Windows Server 2016 through 2025.
Why Enable LDAPS
- Encryption: simple binds over port 389 send the bind password unencrypted unless signing or StartTLS is used. LDAPS wraps the whole session in TLS.
- Secure application binds: VDI brokers, firewalls, VPN concentrators, wikis and Linux hosts that use AD as a directory can connect with
ldaps://instead ofldap://. - Password changes: AD only accepts writes to the
unicodePwdattribute over an encrypted connection, so an application that lets users change an expired or first-logon password through LDAP needs LDAPS (or StartTLS).
| Port | Protocol | Use |
|---|---|---|
| 389 | TCP/UDP | LDAP (UDP is used for CLDAP domain controller locator pings) |
| 636 | TCP | LDAPS, available only once the DC has a suitable certificate |
| 3268 | TCP | Global Catalog over LDAP |
| 3269 | TCP | Global Catalog over LDAPS |
The Symptom: ldap:// Works, ldaps:// Fails
A typical way to discover the problem is in an application’s directory settings. With a URL such as ldap://example.local, a UPN-format service account (svc-ldap@example.local) and its password, the connection tests green. Change the URL to ldaps://example.local (most applications tick a Use SSL box automatically when they see the ldaps prefix) and the same test fails, because nothing on the DC is listening with a certificate on 636.
Prerequisites
- A Windows Server 2008 R2 domain controller and a Domain Admins and Enterprise Admins account (installing an Enterprise CA writes to the configuration partition).
- Correct DNS for the domain and DC names. LDAPS clients must connect with a name that appears in the certificate.
- A decision about where the CA lives. Installing AD CS directly on a DC is quick and is what this lab does, but for production Microsoft recommends a separate member server for the CA (or a certificate from an existing internal PKI or public CA).
- Windows Server 2008 R2 is long out of support. Use this on legacy domains you are maintaining or migrating, and see the modern section for current versions.
Step 1: Add the Active Directory Certificate Services Role
- Log in to the domain controller, open Server Manager and select Roles.
- Click Add Roles and then Next on Before You Begin.
- Tick Active Directory Certificate Services and click Next twice.
- On Role Services keep Certification Authority selected.
- Setup Type: choose Enterprise. Only an Enterprise CA is integrated with AD and publishes the templates that domain controllers auto-enroll from. A Standalone CA will not give the DC a certificate on its own.
- CA Type: choose Root CA for a new PKI, or Subordinate CA if you already have a root.
- Private Key: choose Create a new private key. If you are rebuilding a CA and have its key, choose Use existing private key and browse to it.
- Cryptography: 2008 R2 defaults to SHA1. Select SHA256 and a 2048-bit or 4096-bit key; SHA1 certificates are rejected by many current clients.
- CA Name: review the common name and distinguished name the wizard builds (for example
example-DC01-CA,DC=example,DC=local). Change the common name if you want it to reflect the domain. - Validity Period: the default for a root is 5 years; set what fits your environment.
- Certificate Database: accept the default
C:\Windows\system32\CertLoglocation unless you have a reason to move it. - Confirm and click Install, then Close when it reports success.
Back in Server Manager, expand Roles > Active Directory Certificate Services and confirm the Active Directory Certificate Services service (CertSvc) is running.
Step 2: Let the Domain Controller Enroll Its Certificate
Once an Enterprise CA exists, domain controllers automatically request a certificate from the Domain Controller template (or the newer Kerberos Authentication / Domain Controller Authentication templates). When a certificate with the Server Authentication purpose and the DC’s FQDN lands in the computer’s Personal store, the LDAP service starts using it on 636 without a restart. To hurry it along:
gpupdate /force
certutil -pulse
certutil -pulse triggers autoenrollment on Windows Server 2012 and later; on 2008 R2, gpupdate /force or simply waiting a few minutes usually does it. If a test still fails and the environment allows it, a reboot of the DC is the blunt fix. Check the certificate in certlm.msc (or the Certificates snap-in for the Local Computer) under Personal > Certificates: the subject or Subject Alternative Name must contain the DC’s FQDN, and Intended Purposes must include Server Authentication.
Step 3: Test LDAPS with ldp.exe
- On the DC (or any machine with the AD DS tools), press Start, type
ldp.exeand press Enter. - Choose Connection > Connect.
- In Server, enter the domain name or the DC’s fully qualified name, for example
dc01.example.local. Do not use an IP address. - Change Port from
389to636and make sure SSL is ticked. - Click OK.
A working connection prints the RootDSE attributes, starting with something like:
ld = ldap_sslinit("dc01.example.local", 636, 1);
Error 0 = ldap_set_option(hLdap, LDAP_OPT_PROTOCOL_VERSION, 3);
Error 0 = ldap_connect(hLdap, NULL);
Error 0 = ldap_get_option(hLdap,LDAP_OPT_SSL,(void*)&lv);
Host supports SSL, SSL cipher strength = 256 bits
Established connection to dc01.example.local.
Retrieving base DSA information...
Repeat with port 3269 and SSL to confirm the secure Global Catalog.
Step 4: Point the Application at ldaps://
Set the application’s directory URL to ldaps://dc01.example.local (or the domain name, if every DC has a certificate) with Use SSL enabled, and re-run its connection test. Then browse the directory from the application to make sure the OU tree appears. Two common gotchas:
- Connected but no tree: the bind account lacks rights, or the base DN is wrong. Use a dedicated service account with read access, in UPN format.
- Users from other domains in the forest are missing: point the application at the Global Catalog (
ldaps://example.local:3269), which holds a partial copy of every object in the forest. A GC query is often faster for user lookups in multi-DC environments too.
Testing from Linux (RHEL, AlmaLinux, Rocky, Oracle Linux 8 to 10)
Export the root CA certificate (in certlm.msc, or with certutil -ca.cert C:\root-ca.cer on the CA), copy it to the Linux host and trust it:
sudo cp example-root-ca.cer /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust
openssl s_client -connect dc01.example.local:636 -showcerts </dev/null | grep -E 'subject=|issuer=|Verify return code'
sudo dnf install -y openldap-clients
ldapsearch -H ldaps://dc01.example.local -x -D 'svc-ldap@example.local' -W \
-b 'DC=example,DC=local' '(sAMAccountName=jdoe)' cn mail memberOf
update-ca-trust accepts both PEM and DER files in the anchors directory. Verify return code: 0 (ok) means the chain is trusted. For SSSD clients, see Windows and Linux Integration Series 2: DNS, Time Sync, Hostnames and Firewall Ports; for the OpenLDAP side of TLS, Configure OpenLDAP TLS and LDAPS on AlmaLinux 10 covers the same ideas on a Linux directory server.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
ldp.exe: Error 0x51 (Server Down) or cannot open connection | No certificate yet, the certificate has not reached every DC, or the name in the Server box does not match the certificate (including using an IP address). |
| System log: Schannel event 36884 | The certificate the client received does not contain the name it connected to. Connect with the FQDN, or add the name to the certificate’s SAN. |
| System log: Schannel event 36888 | A fatal TLS alert was generated. Often paired with 36884, or caused by a missing or expired certificate or a protocol/cipher mismatch. |
| System log: Schannel event 36886 | No suitable default server credential exists: the DC has no certificate it can use for LDAPS. |
| Works on one DC, fails on another | Autoenrollment has not run everywhere. Run gpupdate /force (and certutil -pulse on 2012+) on each DC and check certlm.msc. |
| Linux: certificate verify failed | The client does not trust the root CA. Add it to /etc/pki/ca-trust/source/anchors and run update-ca-trust. |
| Firewall | Allow TCP 636 and 3269 from the application hosts to the DCs. |
Modern Notes: Windows Server 2016, 2019, 2022 and 2025
- The role is added from Server Manager > Add Roles and Features, and the CA is configured afterwards from the notification flag. PowerShell does both in two lines:
Install-WindowsFeature ADCS-Cert-Authority -IncludeManagementTools
Install-AdcsCertificationAuthority -CAType EnterpriseRootCA -CryptoProviderName "RSA#Microsoft Software Key Storage Provider" `
-KeyLength 4096 -HashAlgorithmName SHA256 -ValidityPeriod Years -ValidityPeriodUnits 10
- For production, keep the CA off the domain controllers (ideally an offline root and an enterprise issuing CA), and back up the CA key and database.
- Instead of an internal CA, you can import a certificate from another CA into the DC’s Personal store, or into the NTDS service store (
Services > Active Directory Domain Services > Personal) to pick a specific certificate for LDAPS. It needs the Server Authentication EKU, the DC’s FQDN in the subject or SAN, and its private key. - Microsoft has been tightening LDAP defaults: LDAP signing and LDAP channel binding should be required on DCs (Group Policy: Domain controller: LDAP server signing requirements and LDAP server channel binding token requirements), and Windows Server 2025 turns on stricter LDAP signing defaults for new deployments. Applications still using plain, unsigned simple binds on 389 are exactly the ones to move to LDAPS.
- Disable TLS 1.0 and 1.1 on DCs once clients support TLS 1.2 or 1.3; Windows Server 2022 and 2025 support TLS 1.3.
- Watch certificate expiry. Autoenrolled DC certificates renew on their own; manually imported ones do not.
Based on a recorded walkthrough of enabling LDAPS on a Windows Server 2008 R2 domain controller and testing a VDI controller’s directory connection, expanded with Linux testing and current Windows Server guidance.
