这是完整的故事,下面有详细信息,如果有任何建议,我将不胜感激。
我有一个 Web 服务器,我需要使用 ldap 对某些资源启用 apache 身份验证。我还有可以验证身份的 openldap 服务器。 openldap 启用了端口 389 和 636,并且在 openldap 上安装了一个自签名证书。 Web 服务器配置了 openldap 客户端并且可以识别用户。如果我使用以下字符串测试从 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)
提前致谢!
你需要使用
LDAPVerifyServerCert Off
在您的 Apache 配置中的全局级别。那是因为您的证书是自签名的。
我是一名优秀的程序员,十分优秀!