How to connect Konvoy to an external LDAP directory
This guide shows how to configure your Konvoy cluster so that users can log in with the credentials stored in an external LDAP directory service.
Step 1: add LDAP connector
Each LDAP directory is set up in a specific manner so these steps are non-trivial. The following example does not cover all possible configurations. Refer to the Dex LDAP connector reference documentation, available here for more details.
In the following example, we are configuring the Konvoy cluster to connect to the Online LDAP Test Server.
Create a YAML file (ldap.yaml
) like the following:
Also note that for demoing purposes the configuration shown above uses insecureNoSSL: true
.
In production, the LDAP communication should be protected with properly configured transport layer security (TLS).
When using TLS, the admin can add insecureSkipVerify: true
to spec.ldap
to skip server certificate verification if needed.
Then, run the following command to deploy the LDAP connector.
Step 2: log in
Visit https://<YOUR-CLUSTER-HOST>/token
and initiate a login flow.
On the login page choose the Log in with <ldap-name>
button.
Enter the LDAP credentials, and log in.
Debugging help
It is likely that the Dex LDAP connector configuration is not quite right from the start. In that case you need to be able to debug the problem and iterate on it. The Dex log output contains helpful error messages as indicated by the following examples.
Errors upon Dex startup
If the Dex configuration fragment provided results in an invalid Dex config then Dex does not properly start up. In that case the Dex logs will provide error details:
One symptom of Dex not starting up is that https://<YOUR-CLUSTER-HOST>/token
throws a 5xx HTTP error response after timing out.
Errors upon login
Most problems with the Dex LDAP connector configuration will become apparent only upon a login attempt.
A login failing as of misconfiguration will result in an error page showing only Internal Server Error
and Login error
.
The root cause can then usually be found by reading the Dex log, as shown in the following example:
Here, the directory’s DNS name was misconfigured and it should be easy to address that problem.
A more difficult problem is when a login through Dex via LDAP fails because Dex was not able to unambiguously find the specified user in the directory. One reason for that can be an invalid LDAP user search configuration. Example error message in the Dex log:
Solving problems like this requires to carefully review the structure of the directory (which can be very different from directory setup to directory setup), and to then carefully assemble a user search configuration matching the directory structure.
Notably, with some directories it can be hard to generally distinguish the cases “properly configured, and user not found” (login fails in an expected way) and “not properly configured, and therefore user not found” (login fails in an unexpected way).
Example for successful login
For comparison, these are log lines emitted by Dex upon successful login: