我正在尝试为在RHEL 7.5上运行的PostgreSQL 12实例上的用户设置LDAP身份验证。
我所做的:
- 将所有必要的内容放入
/etc/pki/ca-trust/source/anchors
中 证书从LDAP服务器之一开始到 内部根证书颁发机构(这是自签名证书颁发机构)-可能只需要根证书(更新:仅根ca证书就足够了) - 运行
update-ca-certs extract
命令将更改提交到系统 - 使用
openssl s_client -showcerts -connect myldapshost:636
结尾处返回的Verify return code: 0 (ok)
(ldaps)验证了信任链的正确性 -
为我要针对LDAP进行身份验证的用户配置了
pg_hba.conf
条目:host all myuser samenet ldap ldapscheme=ldaps ldaptls=0 ldapserver=myldapshost ldapport=636 ldapbasedn="mybasedn" ldapbinddn="<mybinddn>" ldapbindpasswd=secret
- 告诉服务器使用
pg_ctl reload
重新加载配置
- 告诉服务器使用
当我尝试使用myuser
身份验证为psql -h mypostgreshost mydb
时,出现此错误:
psql: error: could not connect to server: FATAL: LDAP authentication failed for user "myuser"
FATAL: LDAP authentication failed for user "myuser"
我看PostgreSQL日志:
LDAP diagnostics: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed (self signed certificate in certificate chain)
问题是:如何告诉PostgreSQL信任它找到的自签名证书? 谢谢