无法在 Active Directory 中使用 Apache 和 authnz_mod_ldap 进行身份验证

tym*_*mik 7 active-directory ldap apache-2.2 debian-squeeze

我在使用Apache2身份验证时遇到问题,authnz_ldap_module以便对来自Active Directory. 我的 Apache 版本是2.2.16-6+squeeze10.

这是我在没有运气的情况下尝试使用的配置(准确地说是多种组合之一):

AuthzLDAPAuthoritative off
AuthBasicProvider ldap
AuthType Basic
AuthName "Active Directory"
AuthLDAPURL "ldap://server1.my.company.tld:3268 server2.my.company.tld:3268/dc=my,dc=company,dc=tld?sAMAccountName?sub"
AuthLDAPBindDN "uid=my_user,dc=my,dc=company,dc=tld"
AuthLDAPBindPassword "mypassword"
Require valid-user
Run Code Online (Sandbox Code Playgroud)

我在 Apache 中得到以下条目error.log

[debug] mod_authnz_ldap.c(379): [client some_ip_here] [12391] auth_ldap authenticate: using URL ldap://server1.my.company.tld:3268 server2.my.company.tld:3268/dc=my,dc=company,dc=tld?sAMAccountName?sub
[info] [client some_ip_here] [12391] auth_ldap authenticate: user my_user authentication failed; URI / [LDAP: ldap_simple_bind_s() failed][Invalid credentials]
[error] [client some_ip_here] user my_user: authentication failure for "/": Password Mismatch
Run Code Online (Sandbox Code Playgroud)

当然我每次都输入正确的密码,我已经在AD中被阻止了大约一百次,到目前为止没有发生过一次。

我无法验证我是否可以连接到我的 AD 控制器,因为当我尝试时:

ldapsearch -h server1.my.company.tld -p 3268 -D "dc=my,dc=company,dc=tld"
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

text: 000004DC: LdapErr: DSID-0C0906E8, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v1db1
Run Code Online (Sandbox Code Playgroud)

我完全不知道如何绑定,ldapsearch到目前为止手册对我没有帮助。

我在Apache2 配置上做错了什么,如何绑定ldapsearch

如果需要,我将提供其他信息。

tym*_*mik 9

最有问题的情况是 AuthLDAPBindDN,它必须采用“user@my.company.tld”的语法,而不是“domain\user”的语法,既不是简单的“user”也不是“uid=my_user,dc=my,dc=company” ,dc=tld”。以下是对我有用的正确配置,我在此提供作为案例的解决方案。

            AuthzLDAPAuthoritative off
            AuthBasicProvider ldap
            AuthType Basic
            AuthName "Active Directory"
            AuthLDAPURL "ldap://server1.my.company.tld:3268 server2.my.company.tld:3268/DC=ad,DC=upos,DC=pl?sAMAccountName?sub?(objectClass=*)"
            AuthLDAPBindDN "bind_user@my.company.tld"
            AuthLDAPBindPassword "some_random_password"
            Require valid-user
Run Code Online (Sandbox Code Playgroud)

我花了很长时间才提供答案,我对此感到抱歉。