This is my site for sharing back with the IT world.
by This Guy
what am I forgetting about LDAP?
Here’s some random stuff, like definitions and links and the like so that I don’t forget it. Some of this is my wording, and some is copy and paste from rando sources.
What is LDAP? LDAP is an industry standard Protocol that systems use to connect to a directory, such as Active Directory. It facilitates programmatic access to that directory for tasks such as looking up contact info, usernames or other data stored in the directory database. LDAP is defined in RFC4511. It is a client-server model. The client asks a question and the server replies with an answer.
LDAP Version History
LDAP Firewall Info LDAP connections are made over TCP and UDP on port 389, TCP 636 (LDAP over SSL), and TCP 3268 or 3269 (GC over SSL) for Global Catalog connections. Your internal network communications will probably be allowed to connect to Active Directory using any of these ports where allowed and appropriate. LDAP connections coming from external, such as SaaS applications, should be limited to TCP 636 for LDAPS communication and only allowed from approve IP addresses.
LDAP Authentication LDAP Authentication refers to the LDAP BIND mechanism in the protocol and in the context of your Corporate Active Directory. There may be better or more appropriate alternative ways to authenticate with Corporate Active Directory, such as ADFS.
LDAP generally supports Bind types: Anonymous (no user/pass), Unauthenticated (user but no pass), User/Pass authenticated (user and pass supplied). Anonymous and Unauthenticated methods allow clear text passwords being sent and should be disallowed.
The last Authentication mechanism is SASL. SASL is a framework as defined in RFC4422 allows secured authentication between client and server. Both parties can negotiate which mechanism to use. Mechanisms are GSSAPI, GSS-SPENGO, External, and Digest-MD5. It is recommended to use Simple Binds using username and password only after starting a secured session (TLS or StartTLS), or SASL using GSSAPI with either Kerberos or NTLMv2. All transmission of the username/password should be secured. Transmitting passwords should be treated with strictest security in mind. The following Bind methods are listed from strongest to least strong. Please choose appropriately when connecting to Corporate Active Directory.
LDAP Encryption Any info on encrypting the connection to ensure data integrity. This would include session-level encryption, in other words StartTLS or LDAPS. The first way, StartTLS encrypts the data after the connection has been made. A LDAP connection is made and then after connection a command is sent to start TLS and after that the data will be encrypted. All this happens over TCP 389. The second way is to connect to TCP 636 which only supports full session encryption. This is LDAPS.
To use either LDAPS or StartTLS, you will need for your application or server a certificate from a PKI infrastructure. The alternative to LDAPS or StartTLS if your application doesn’t support it would be to use IPSEC to encrypt your traffic. This is outside the scope of this post, but a good one for future writing.
TLS/SSL Review TLS/SSL communications are meant to provide Identification, Privacy, and Integrity. Identification is crucial to validate who you will be communicating with. Generally for connections to LDAP using LDAPS or StartTLS, you’ll be proving our identity with Certificates from a trusted internal Certificate Authority. Privacy will provide encryption to the data sent between the parties. Integrity provides mechanisms to make sure that the data between client and server was not tampered with before it reaches the other side. TLS/SSL connections begin with an exchange between the client and server to negotiate how they will encrypt and decrypt their communications. It’s the SSL handshake. On Windows, Schannel completes this handshake. The handshake is comprised of the Protocol, Key Exchanges, Ciphers, and Hashing Algorithms.
Plain text passwords Setting up the authentication for the LDAP connection, a ‘Simple BIND’ and ‘SASL PLAIN’ can send the user’s username and password in plaintext. This is obviously not ideal. Active Directory does not prevent these types of connections, but may at a future date. So the connections utilizing either Simple or SASL PLAIN should be encrypted using TLS, either by using LDAPS or StartTLS.
Definitions
References https://tools.ietf.org/html/rfc4511 https://technet.microsoft.com/en-us/library/cc961766.aspx https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol
tags: