Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does LDAP requires a two step "login" (connect and then bind)

Tags:

ldap

There's this thing I don't understand concerning LDAP (conceptually speaking, and - at least so I think - not tied to a particular implementation).

I noticed that a typical LDAP client library(for example apache DS) does a connect() first (for which some servers might require username/password), and then executes a bind() operation (which also requires username and password).

Questions:

  • What is the point of this two step operation in LDAP?
  • Does it add extra security?
  • Why not just a single step ?
  • What is the conceptual signification of these two steps ?
like image 940
Andrei Avatar asked Sep 04 '13 12:09

Andrei


People also ask

How does LDAP bind work?

Binding is the step where the LDAP server authenticates the client and, if the client is successfully authenticated, allows the client access to the LDAP server based on that client's privileges.

What is a signed LDAP bind?

LDAP channel binding and LDAP signing provide ways to increase the security for communications between LDAP clients and Active Directory domain controllers.

What is LDAP simple bind authentication?

Simple bind authentication is the most common way to authenticate LDAP clients. In a simple bind, the client either binds anonymously, that is, with an empty bind DN, or by providing a DN and a password. Directory Proxy Server binds to a data source to validate the credentials and to authenticate the client.

What is LDAP bind password?

Bind Password – Password used to connect to the LDAP service on the specified LDAP Server. Base DN – Base DN for your directory. This is the starting search point in the LDAP tree. The default value looks up the defaultNamingContext top-level attribute and use it as the search base.


Video Answer


2 Answers

When an LDAP client connects to an LDAP server, that connection is unauthenticated. Clients use the BIND operation to authenticate the connection. The server then processes requests on the connection using the authorization state of the connection with the privileges and access control thereto.

Some (if not most) LDAP APIs offer a single-step connection and BIND, for which one must provide the credentials of the user, or a pre-constructed BIND request (there are different types of BIND requests, simple and SASL). In the case you describe, the API is most likely establishing a connection to the server and then issuing the BIND request to the server. If this is successful, then the connection's authorization state is set. This would be a "convenience" method for clients.

Separating the connection from the BIND (the two steps you mention), is done so that the same connection can be used with different authorization states. Each BIND resets the authorization state of the connection. The LDAP client can connect, then BIND using one user and credentials, perform some operations as that user, then send another BIND request on the same connection to change the authorization state to that of a different user. This enables the client and server to be more efficient since the connection need not be made more than once. This is supported by LDAPv3.

The UNBIND request's name is a relic of LDAPv2, which did not allow multiple authorization states per connection. UNBIND is not the opposite of BIND, and it does disconnect as you discovered. LDAP clients using LDAPv3 can transmit a BIND request to change the authorization state of the connection. The misnamed UNBIND request does not "un-authorize" a state, it merely disconnects the LDAP client from the LDAP server.

see also:

  • LDAP: Programming Practices
  • LDAP: Authentication Best Practices
like image 150
Terry Gardner Avatar answered Sep 26 '22 18:09

Terry Gardner


Actually, there is a difference!

Connect() refers to the connection to a LDAP server on a specified hostname and port, as the bind () binds to the LDAP directory with specified RDN and password.

Hope this is helpful!

like image 37
MPrazz Avatar answered Sep 25 '22 18:09

MPrazz