Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker LDAP TLS certificate not found #656

Open
awen112 opened this issue Mar 24, 2023 · 3 comments
Open

Docker LDAP TLS certificate not found #656

awen112 opened this issue Mar 24, 2023 · 3 comments

Comments

@awen112
Copy link

awen112 commented Mar 24, 2023

Installed OpenLDAP using the command '
docker run -p 389:389 -p 636:636
--volume /Users/king:/container/service/slapd/assets/certs
--env LDAP_DOMAIN="ldap.com"
--env LDAP_ADMIN_PASSWORD="pasword"
--env LDAP_TLS_CRT_FILENAME=server. crt
--env LDAP_TLS_KEY_FILENAME=server. key
--env LDAP_TLS_CA_CRT_FILENAME=ca. crt
--detach osixia/openldap:1.5.0 --loglevel error'. When attempting to connect to it using Spring LDAP, received the error message 'TLS: can't accept: No certificate was found.. 641dd069 conn=1000 fd=12 closed (TLS negotiation failure),How can we resolve this?

@sanjeewa894
Copy link

run with --env LDAP_TLS_VERIFY_CLIENT=try. For self signed certificates, it fails to connect from the outside.

@ki9us
Copy link

ki9us commented Feb 27, 2025

Seeing this too, after modifying my Dockerfile to add

ADD certs /container/service/slapd/assets/certs

certs/ contains host.key, host.crt and ca.crt. I also put the required env vars in my docker-compose.yml. After re-building and rebooting the container, I can see that the env vars are set correctly (using

openldap  | ***  DEBUG  | 2025-02-27 09:47:55 | LDAP_TLS = true
openldap  | ***  DEBUG  | 2025-02-27 09:47:55 | LDAP_TLS_CA_CRT_FILENAME = ca.crt
openldap  | ***  DEBUG  | 2025-02-27 09:47:55 | LDAP_TLS_VREIFY_CLIENT = try
openldap  | ***  DEBUG  | 2025-02-27 09:47:55 | LDAP_TLS_KEY_FILENAME = host.key
openldap  | ***  DEBUG  | 2025-02-27 09:47:55 | LDAP_TLS_CRT_FILENAME = host.crt

And I can see the files in the container:

$ docker exec openldap ls -la /container/service/slapd/assets/certs
total 36
drwxrwxr-x 1 openldap openldap 4096 Feb 27 09:31 .
drwxrwxr-x 1 openldap openldap 4096 Feb 27 09:47 ..
-r--r----- 1 openldap openldap  964 Dec 30  2023 ca.crt
-rw------- 1 openldap openldap  424 Feb 19  2021 dhparam.pem
-rw-r--r-- 1 openldap openldap  928 Dec 30  2023 host.crt
-rw------- 1 openldap openldap  359 Dec 30  2023 host.key
-rw-rw-r-- 1 openldap openldap  173 Feb 19  2021 README.md

But negotiation fails and the logs show:

openldap  | TLS: can't accept: No certificate was found..

@ki9us
Copy link

ki9us commented Feb 27, 2025

openldap | *** DEBUG | 2025-02-27 09:47:55 | LDAP_TLS_VREIFY_CLIENT = try

Spelling VERIFY correctly fixed it for me. 🤦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants