Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

LDAPS on port 636 not working: how a domain controller picks its certificate

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

An application that reads Active Directory over a secure connection (a VPN appliance, vCenter, a line-of-business app, a Linux server) stops connecting, or never connected. Or a certificate was renewed, and clients still see the old one.

There is no setting that turns on LDAPS. A domain controller listens on port 636 (and 3269 for the global catalog) as soon as it has a suitable certificate (Microsoft Learn, KB 321051). So the checks below centre on which certificate the domain controller found, and whether clients trust it.

What you see

  • LDP connecting to the domain controller on port 636 with SSL ticked fails, where RootDSE information should appear.
  • An application reports a TLS or certificate error, a name mismatch, or an untrusted issuer when connecting to port 636 or 3269.
  • After a certificate renewal, clients still receive the old or expired certificate.
  • One domain controller works and another does not.

Why it happens

Microsoft lists five requirements for an LDAPS certificate (Microsoft Learn, Configure certificates for LDAPS):

  1. Enhanced Key Usage includes Server Authentication (1.3.6.1.5.5.7.3.1).
  2. The domain controller's Active Directory FQDN (for example dc01.contoso.com) is the Common Name in the Subject, or a DNS entry in the Subject Alternative Name.
  3. The private key is in the Local Computer store, correctly associated with the certificate, and does not have strong private key protection turned on.
  4. The key was generated with the Schannel cryptographic provider.
  5. It was issued by a CA that both the domain controller and the clients trust, through the root CA the issuing CA chains to.

A certificate that misses any of these is not used. Beyond that, the domain controller has to pick one certificate, and Microsoft documents how it chooses:

  • The NTDS store is checked first. If a certificate is in the NT Directory Services service's own Personal store, the domain controller uses it instead of anything in the Local Computer's Personal store.
  • Several valid certificates in the Local Computer store make the choice unpredictable. Microsoft says Schannel picks the first valid certificate it finds and "may not select the correct certificate", and that domain controllers from Windows Server 2008 onward choose randomly when several are in the store.
  • A replaced certificate in the Local Computer store is not picked up until the domain controller restarts (Microsoft Learn, KB 321051).
  • Firewall: inbound TCP 636 (and 3269 for the global catalog) must be allowed.

How to prove the cause

1. Test with LDP on the domain controller or a domain-joined computer: run ldp.exe, Connection > Connect, type the domain controller's name, port 636, tick SSL, OK. RootDSE information means LDAPS works on that domain controller; the fault is then on the client side (trust, name used, network path).

2. Look at the certificates. On the domain controller run certlm.msc and open Personal > Certificates. For each certificate, check:

  • Intended purposes include Server Authentication.
  • Issued To or the Subject Alternative Name has the domain controller's FQDN, the same name clients use.
  • It has a private key and is in date.
  • The issuing chain leads to a root the clients trust.

3. Count the candidates. More than one valid Server Authentication certificate in that store means the domain controller may be presenting a different one from the one you expect.

4. Check the NTDS service's Personal store. If a certificate there is wrong or expired, it is still preferred over a good one in the Local Computer store.

5. Check the network path from the client. One way to test the port (built from standard PowerShell, not from Microsoft's LDAPS pages):

Test-NetConnection <DC FQDN> -Port 636

6. Read the Directory Service log on the domain controller for event 1220. Microsoft's event reference, written for Windows Server 2008 and 2008 R2, gives its message as "LDAP over Secure Sockets Layer (SSL) will be unavailable at this time because the server was unable to obtain a certificate", logged when clients try LDAPS and the domain controller has no certificate to use (Microsoft Learn, Event ID 1220 - LDAP over SSL). KB 321051 links this page itself. The page is older than the Windows Server versions this article covers, so treat the event as a pointer and confirm with the certificate checks above.

The fix

  • Use a certificate that meets all five requirements. With a Microsoft Enterprise CA, Microsoft's route is certlm.msc > Personal > Certificates > All Tasks > Request New Certificate > Active Directory Enrollment Policy > Domain Controller template > Enroll. Microsoft says this template already has Server Authentication, the FQDN in the Subject Alternative Name and automatic renewal. Restart the domain controller afterwards.

  • With a third-party CA, create the request with certreq and an .inf file that uses the Schannel provider and the Server Authentication OID, as in Microsoft's example (key length 2048 or more in the current page), then:

    certreq -new request.inf request.req
    certreq -accept certnew.cer
    

    The issued certificate must be base64-encoded. Restart the domain controller.

  • Make the choice predictable. Remove expired or unsuitable Server Authentication certificates from the store, or put the one you want in the NTDS service's Personal store. Microsoft notes three advantages: it is checked first, new certificates dropped there are picked up without a restart, and a refresh can be triggered with the renewServerCertificate rootDSE operation.

  • Fix trust on the clients: install the root (and any intermediate) CA certificate where the client application reads its trusted CAs.

  • Open TCP 636 and 3269 inbound to the domain controllers if a firewall blocks them.

How to confirm the fix

  • LDP on port 636 with SSL shows RootDSE information, on each domain controller clients may use.
  • The client application connects and shows the expected certificate (issuer, expiry and name).
  • After the next renewal, the new certificate is presented without a restart if it is in the NTDS store; a renewed certificate in the Local Computer store needs a planned restart, even when the template renews it automatically.

What to watch afterwards

  • Expiry dates of each domain controller's LDAPS certificate, and the root and intermediate certificates clients rely on.
  • New certificates installed on domain controllers for other purposes. A second valid Server Authentication certificate can change what LDAPS presents.
  • New domain controllers. Each needs its own certificate; LDAPS working on one says nothing about the next.
  • Applications pinned to one certificate or one domain controller name; plan their change with each renewal.

Risks and limits

  • Restarting a domain controller to pick up a certificate interrupts the services it runs; schedule it, and do one domain controller at a time.
  • Deleting a certificate from the domain controller's store can break another service that used it (for example remote desktop or a web service on that server). Check its purpose first.
  • Microsoft's older KB still shows a 1024-bit key in its example; the current Microsoft page starts at 2048.
  • This article covers the domain controller's certificate. Whether LDAP must be signed or use channel binding is a separate setting.

Sources

Next step

With LDAPS, the useful question is which certificate each domain controller holds and which one it presents. NetLeverage has looked after business servers since 2002. If an application cannot connect to Active Directory securely, talk to us through managed support with the LDP result and the certificate list from each domain controller.