如果ssl打开,Apache mod auth_ldap将无法工作

时间:2016-03-16 18:03:02

标签: apache authentication ssl openldap

以下是详细信息,详情如下,我很感激任何建议。

我有一个Web服务器,我需要使用ldap启用apache auth到某些资源。我也有openldap服务器,我可以通过身份验证。 openldap启用了端口389和636,并且在openldap上安装了自签名证书。 Web服务器配置了openldap客户端,可以识别ID用户。如果我使用此字符串测试从web服务器到openldap的连接:

openssl s_client -connect openldapserverIP:636 -showcerts

我收到所有正确信息的回复。

在网络服务器配置中,我添加了这个:

<Directory /www/protect>
Order deny,allow
Deny from All
AuthName "identity"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPBindAuthoritative off
AuthLDAPUrl ldap://openldapIP/ou=People,dc=mydomain,dc=org?uid
AuthLDAPBindDN "cn=ldapreadonlyuser,dc=mydomain,dc=org"
AuthLDAPBindPassword "somethinghere"
AuthLDAPGroupAttribute memberUid
Require ldap-attribute  myAttribute=800
Require ldap-attribute myAttribute=820
Satisfy any
LogLevel debug
</Directory>

它有效。

然后,如果我启用安全连接,请将连接字符串更改为:

AuthLDAPUrl ldaps://openldapIP/ou=People,dc=mydomain,dc=org?uid TLS

AuthLDAPUrl ldap://openldapIP:636/ou=People,dc=mydomain,dc=org?uid TLS

它不起作用。

以下是错误日志:

auth_ldap authenticate: user x authentication failed; URI / [LDAP: ldap_simple_bind() failed][Can't contact LDAP server] (not authoritative)

提前致谢!

2 个答案:

答案 0 :(得分:1)

您需要使用

LDAPVerifyServerCert Off

在Apache配置的全局级别。这是因为您的证书是自签名的。

答案 1 :(得分:0)

将您的CA证书和ldap服务器证书放入/etc/pki/mycerts/certs-bundle.pem并将参数LDAPTrustedGlobalCert CA_BASE64 /etc/pki/mycerts/certs-bundle.pem添加到httpd.conf