Pcornel
Identity

LDAP

Cheat sheet · https://pcornel.dk/topic.php?topic=6255

Back to the Topic

Answer

LDAP is the protocol clients use to read and change entries in a directory (Active Directory, OpenLDAP, 389 Directory Server): bind to authenticate, then search, compare or modify entries addressed by distinguished name.

Remember

Bind (who you are) and search (what you read) are separate steps. Base DN + scope + filter decide what is returned. Port 389 is cleartext unless StartTLS or signing protects it; 636 is LDAPS; AD Global Catalog is 3268/3269. Prefer TLS and SASL signing over simple binds on 389.

First checks

  • ldapsearch -H ldaps://<dc>:636 -D <bind-dn> -W -b <base-dn> "(sAMAccountName=<user>)" dn memberOf — bind works and the entry is found.
  • ldapsearch -H ldap://<dc> -x -s base -b "" supportedSASLMechanisms supportedControl — read the RootDSE anonymously.
  • openssl s_client -connect <dc>:636 -showcerts </dev/null — the certificate the LDAPS listener presents.
  • Windows: Directory Service event 2887/2889 — clients still using unsigned binds.

Commands

openssl s_client

Verify in this order

name resolution → TCP 389/636 → TLS (LDAPS or StartTLS) → bind (simple or SASL) → search (base DN, scope, filter, attributes) → result code and entries → application maps attributes/groups

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6255

Confirmation

Confirm action

Continue?