如何在Ubuntu服务器12.04上设置postgresql 9.1以通过SSL对Windows AD服务器使用LDAP身份验证 .
客户端SSL已设置并在postgresql中工作 .
没有SSL的LDAP工作 .
在pg_hba.conf中我有这个:
hostssl ldaptest all 0.0.0.0/0 ldap ldapserver="myldapserver.local" ldapprefix="cn=" ldapsuffix=", ou=TestOU, dc=sub, dc=example, dc=local"
我可以使用psql连接,但密码是按预期未加密发送的 .
如果我将其设置为在普通端口上使用TLS(389):
hostssl ldaptest all 0.0.0.0/0 ldap ldapserver="myldapserver.local" ldapprefix="cn=" ldapsuffix=", ou=TestOU, dc=sub, dc=example, dc=local" ldaptls=1
我明白了:
could not start LDAP TLS session: error code -11
如果我将其设置为使用LDAPS端口(636)来使用SSL:
hostssl ldaptest all 0.0.0.0/0 ldap ldapserver="myldapserver.local" ldapprefix="cn=" ldapsuffix=", ou=TestOU, dc=sub, dc=example, dc=local" ldaptls=0 ldapport=636
我明白了:
LDAP login failed for user "cn=Teszt User,ou=TestOU,dc=sub,dc=example,dc=local" on server "ratotdc.okologia.mta.local": error code -1
如果我打开两个TLS并将端口设置为636我得到:
could not start LDAP TLS session: error code -11
我在ldap.conf中有服务器证书:
TLS_CACERT /root/certs/infolabtest_cert.cer
ldapsearch通过SSL工作并返回正确的结果:
ldapsearch -W -H ldaps://myldapserver:636/ -D "CN=Teszt User,OU=TestOU,DC=sub,DC=example,DC=local" -b "ou=testou,dc=sub,dc=example,dc=local" "CN"
欢迎任何想法 .
2 回答
这有点困难 . 我在这里找到了答案:http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol
Posgres不支持LDAPv2(e.i . ldpas://), but it does support LDAPv3 TLS
Postgres现在根据documentation从版本11开始支持 ldaps://
所以pg_hba.conf中的配置如下所示: