postgresql LDAPauthentication

我想给我的postgresql数据库LDAPauthentication。

这是我的pg_hba.confconfiguration文件

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" 

但是,当我试图连接我的一个LDAP用户称为testing,我得到以下错误:

 psql -U test Password for user test: psql: FATAL: password authentication failed for user "test" 

注意:我已经在postgresql中创build了testing用户。

我执行了下面的search,它正在工作

 ldapsearch -W -D "cn=test user,ou=users,dc=example,dc=hyd,dc=com" -b "dc=example,dc=hyd,dc=com" "uid=test" 

看来你正在testing的LDAP绑定与不同的dn比postgres的构造:

 cn=test user,ou=users,dc=example,dc=hyd,dc=com 

VS

 "cn=" + "test" + ", ou=users, dc=example, dc=hyd, dc=com" 

即“testing”不符合“testing用户”