Reputation: 308
I have an OpenLDAP Docker instance from Osixia and am trying to query it securely from the client using TLS. The query works without encryption using $ ldapwhoami -H ldap://localhost -x
and does not work when using the -ZZ
flag to start TLS operation $ ldapwhoami -H ldap://localhost -x -ZZ
- it returns ldap_start_tls: Can't contact LDAP server (-1)
. How can i make this work? Below are all the steps i took:
$ docker run -p 389:389 -p 636:636 --name ldap-service --hostname ldap-service \
--env LDAP_ADMIN_PASSWORD="password" --env LDAP_BASE_DN="dc=example,dc=org" --detach osixia/openldap:1.4.0
anonymous
$ ldapwhoami -H ldap://localhost -x
anonymous
/container/service/slapd/assets/certs/ca.crt
ca.crt
into CLIENT folder /usr/local/share/ca-certificates/ca.crt
, then run sudo update-ca-certificates
to add it. Confirm success of adding by checking that the CA is inside /etc/ssl/certs/ca-certificates.crt
/etc/ldap/ldap.conf
I added the line TLS_CACERT /etc/ssl/certs/ca-certificates.crt
-ZZ
flag to start TLS operation:$ ldapwhoami -H ldap://localhost -x -ZZ
ldap_start_tls: Can't contact LDAP server (-1)
additional info: The TLS connection was non-properly terminated.
Further logs from inside LDAP docker:
5ff42195 conn=1079 fd=12 ACCEPT from IP=172.17.0.1:39420 (IP=0.0.0.0:636)
TLS: can't accept: No certificate was found..
5ff42195 conn=1079 fd=12 closed (TLS negotiation failure)
ldaps://
$ ldapwhoami -H ldaps://localhost -x
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
Things i tried out:
I read through https://www.openldap.org/doc/admin24/tls.html and subsequently installed the Server CA on the client.
I read through this post: ldapsearch over ssl/tls doesn't work, I changed the settings in /etc/ldap/ldap.conf
to include the below items, but to no avail.
TLS_CACERT /etc/ssl/certs/ca-certificates.crt
TLS_REQCERT ALLOW
PORT 636
HOST localhost // i also tried 'ldap-service'
Upvotes: 2
Views: 7011
Reputation: 5828
For Googlers,
Presto does not supply client certificates (client certificate verification, two-way verification) when connecting to LDAP service, so you will need --env LDAP_TLS_VERIFY_CLIENT=try
or never
if you use osixia/openldap
, or, edit ldap.conf
and set TLS_REQCERT never
and restart the LDAP service.
Upvotes: 1
Reputation: 308
I found the solution:
Add --env LDAP_TLS_VERIFY_CLIENT=try
to the docker run
command. Source
Upvotes: 3