从 Stretch 升级到 Buster 后,apache2.4 mod ldap 无法连接到 2012R2 LDAP

标签 apache ssl active-directory openssl mod-ldap

将 Stretch 升级到 Buster authnz-ldap/mod-ldap 后无法使用 ldaps 连接到 2012R2 AD。
这是我的配置:

#Must be set to a low value to permit failover from a server to the other.
LDAPConnectionTimeout 1
LDAPRetries 1
# SSL
LDAPVerifyServerCert on
LDAPTrustedMode SSL
LDAPTrustedGlobalCert CA_BASE64  /etc/apache2/ssl/ca_der.cer

#LDAP SERVERS DECLARATION START

<AuthnProviderAlias ldap MyLDAPS>
  AuthLDAPBindDN "CN=svc-otp,CN=Users,DC=otp,DC=local"
  AuthLDAPBindPassword REDACTED #checked and working
  # Search user
  AuthLDAPURL "ldaps://ad03.otp.local/CN=Users,DC=otp,DC=local?userPrincipalName?sub?(&(memberOf:1.2.840.113556.1.4.1941:=CN=Admins,OU=2FA,OU=PCI,DC=otp,DC=local)(objectClass=user))" 
</AuthnProviderAlias>

<LocationMatch /manage >
   # Using this to bind
   AuthType Basic
   AuthName "USE YOUR user@domain ACCOUNT"
   AuthBasicProvider MyLDAPS
   require valid-user
</LocationMatch>
我试过openssl s_client -connect ad03.otp.local:636 -state -nbio这导致
CONNECTED(00000003)
Turned on non blocking io
SSL_connect:before SSL initialization
SSL_connect:SSLv3/TLS write client hello
SSL_connect:error in SSLv3/TLS write client hello
write R BLOCK
SSL_connect:error in SSLv3/TLS write client hello
read:errno=104
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 306 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
然后我发现/etc/ssl/openssl.conf 添加了
[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=2
我评论了这两行,openssl s_client 就像在 Stretch 上一样工作。
但是 Apache 总是提示无法连接...
我用谷歌搜索了很多类似的问题和 Apache 文档,但没有找到提示或解决方案。

最佳答案

我还不明白为什么,但似乎 LDAPTrustedGlobalCert CA_BASE64 /etc/apache2/ssl/ca_der.cer未读。
我在 /etc/ssl/certs/ 中添加了来自 Active Directory 的 CA 证书并重新运行 update-ca-certificates和 ldapsearch 工作。
apache mod_ldap 也有效。
有用的命令:

  • 验证证书:openssl s_client -showcerts -connect ad03.otp.local:636
  • 检查连接:openssl s_client -connect ad03.otp.local:636 -state -nbio
  • 关于从 Stretch 升级到 Buster 后,apache2.4 mod ldap 无法连接到 2012R2 LDAP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65156089/

    相关文章:

    apache - htaccess 在子目录中不起作用

    ruby-on-rails - 我在哪里可以找到 Apache-Passenger 配置文件?

    security - 使用 Jetty 进行安全套接字编程的任何已知资源?

    c# - 查询 Active Directory 的任务并行库(使用 DirectoryServices)

    javascript - 通过HTML表单访问PHP文件

    SSL证书: public key or private key?

    c++ - 如何接受 boost::asio::ssl::stream<boost::asio::ip::tcp::socket> 作为 boost::asio::ip::tcp::socket 类型的参数

    javascript - 以下情况的有效正则表达式是什么

    c# - 为什么从 Web 服务器以外的计算机查询 Active Directory 时会出现 DirectoryServicesCOMException?

    linux - httpd url重写规则配置