使用Spring框架的java LDAP over TLS
我们使用Spring开发了一个Java应用程序来集成LDAP用户。 当应用程序连接LDAP上的LDAP服务器时,它会工作(ldap://openldap:389). 我在通过TLS连接LDAP服务器时遇到问题(ldaps://openldap:636)
环境:
已安装交钥匙开放式Ldap服务器VM
将生成一个新的自签名证书。它用于java应用程序和LDAP服务器
例外情况:
Caused by: org.springframework.ldap.CommunicationException: simple bind failed: openldap:636; nested exception is javax.naming.CommunicationException: simple bind failed: openldap:636 [Root exception is javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching openldap found]
在java应用程序中使用捆绑在交钥匙开放Ldap VM中的内置证书时,会引发以下异常
org.springframework.ldap.CommunicationException: simple bind failed: openldap:636; nested exception is javax.naming.CommunicationException: simple bind failed: openldap:636 [Root exception is java.net.SocketException: Connection or outbound has closed]
# 1 楼答案
这是根证书问题。我把错误的CA证书导入了cacerts。 根本原因是我们在交钥匙开放式ldap中查找了错误的证书配置位置。 在/etc/ldap/tls中找到的证书,但我们错误地查看了/etc/ssl/private
将ca_cert.pem从/etc/ldap/tls导入客户端的cacerts后,它就可以工作了