I am trying to enable LDAP authentication for postgres access. Here is my LDAP server which is working fine in other application with node.js
var config = {
url: 'ldap://111.222.333.44:389/',
baseDN: 'DC=ad,DC=justcomp,DC=com',
username: "itljustcomp\" + username,
password: pswd
}
I have to use same LDAP for accessing postgres database. Added a new line in pg_hba.conf
host all all 0.0.0.0/0 ldap ldapserver=111.222.333.44 ldapport=389 ldaptls=1 ldapprefix=""
and trying to connect it from local machine
psql -h 10.11.222.333 -U [email protected] -d postgres
where 10.11.222.333 is database server IP. It prompts for the password Password for user [email protected]:
but when password is entered, it fails with message
psql: error: connection to server at "10.11.222.333", port 5432 failed: FATAL: password authentication failed for user "[email protected]"
I am able to connect to the same database from local pgadmin through database user and password. Also tried with creating user in database create role "[email protected]" with login
but that also did not work.
please suggest if something is missing here. What am I doing wrong? And is it necessary to create same user in database for every login id in LDAP ?