首页 > 解决方案 > LDAP over TLS 与 Spring 框架

问题描述

我们开发了一个 Java 应用程序来使用 Spring 集成 LDAP 用户。它在应用程序连接 LDAP 上的 LDAP 服务器时起作用(ldap://openldap:389)。通过 TLS(ldaps://openldap:636)连接 LDAP 服务器时遇到问题。

环境:

已安装 TurnKey Open 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 应用程序中使用 Turnkey Open 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]

标签: javasslopenldapspring-ldap

解决方案


这是根证书问题。我将错误的 CA 证书导入 cacerts。根本原因是我们在 TurnKey open ldap 中查看了错误的证书配置位置。在/etc/ldap/tls中找到的证书,但我们看错了 /etc/ssl/private

它在将 ca_cert.pem 从 /etc/ldap/tls 导入客户端的 cacerts 后工作。


推荐阅读