osixia / docker-openldap

OpenLDAP container image 🐳🌴
MIT License
4.03k stars 974 forks source link

ldapsearch ldap_bind: Invalid credentils (46) #576

Open farous opened 3 years ago

farous commented 3 years ago

Hi,

I'm trying to ldapsearch from host to a container but it's not working. I saw 2 issues like mine but none of the solutions worked for me.

I start with :

docker run --env LDAP_ORGANISATION="OpenLdap" --env LDAP_DOMAIN="example.org" --env LDAP_ADMIN_PASSWORD="admin" -p 389:389 -p 636:636 --name openldap --detach osixia/openldap:1.5.0

Then this works :

docker exec openldap ldapsearch -x -H ldap://localhost -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin

extended LDIF

#

LDAPv3

base with scope subtree

filter: (objectclass=*)

requesting: ALL

#

example.org

dn: dc=example,dc=org objectClass: top objectClass: dcObject objectClass: organization o: OpenLdap dc: example

search result

search: 2 result: 0 Success

numResponses: 2

numEntries: 1

but this doesn't when executed directly from the host : ldapsearch -x -H ldap://localhost -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin Result : ldap_bind: Invalid credentials (49)

thank you very much for your help

oschlueter commented 3 years ago

Have you tried it without -x? Like so:

ldapsearch -H ldap://localhost -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin