I am trying to give an LDAP authentication to my postgresql database.
Here is my pg_hba.conf config file
local all all md5
local all postgres md5
host all all 0.0.0.0/0 ldap ldapserver=myldap_serverip ldapprefix="cn=" ldapsuffix=", ou=users, dc=example, dc=hyd, dc=com"
But when i am trying to connect with one of my LDAP user called test, i am getting the following error:
psql -U test
Password for user test:
psql: FATAL: password authentication failed for user "test"
Note: I have created test user in postgresql.
I performed the below search and it is working
ldapsearch -W -D "cn=test user,ou=users,dc=example,dc=hyd,dc=com" -b "dc=example,dc=hyd,dc=com" "uid=test"
Best Answer
It seems you're testing the LDAP bind with a different dn than what postgres constructs:
vs
i.e. "test" doesn't match "test user"