我们在Apache 2.2.9(如Debian 5.0、2.2.9-10 + lenny7中提供)中使用mod_authnz_ldap和mod_authn_alias对多个Active Directory域进行身份验证以托管Subversion存储库。我们当前的配置是:
# Turn up logging
LogLevel debug
# Define authentication providers
<AuthnProviderAlias ldap alpha>
AuthLDAPBindDN "CN=Subversion,OU=Service Accounts,O=Alpha"
AuthLDAPBindPassword [[REDACTED]]
AuthLDAPURL ldap://dc01.alpha:3268/?sAMAccountName?sub?
</AuthnProviderAlias>
<AuthnProviderAlias ldap beta>
AuthLDAPBindDN "CN=LDAPAuth,OU=Service Accounts,O=Beta"
AuthLDAPBindPassword [[REDACTED]]
AuthLDAPURL ldap://ldap.beta:3268/?sAMAccountName?sub?
</AuthnProviderAlias>
# Subversion Repository
<Location /svn>
DAV svn
SVNPath /opt/svn/repo
AuthName "Subversion"
AuthType Basic
AuthBasicProvider alpha beta
AuthzLDAPAuthoritative off
AuthzSVNAccessFile /opt/svn/authz
require valid-user
</Location>
我们同时拥有Alpha和Beta帐户的用户遇到问题,尤其是当他们在Alpha中的帐户过期时(但仍然存在;公司政策是该帐户的有效期至少为1年)。例如,当用户x(在Alpha中具有已过期的帐户,在Beta中具有有效的帐户)时,Apache错误日志报告以下内容:
[Tue May 11 13:42:07 2010] [debug] mod_authnz_ldap.c(377): [client 10.1.1.104] [14817] auth_ldap authenticate: using URL ldap://dc01.alpha:3268/?sAMAccountName?sub?
[Tue May 11 13:42:08 2010] [warn] [client 10.1.1.104] [14817] auth_ldap authenticate: user x authentication failed; URI /svn/ [ldap_simple_bind_s() to check user credentials failed][Invalid credentials]
[Tue May 11 13:42:08 2010] [error] [client 10.1.1.104] user x: authentication failure for "/svn/": Password Mismatch
[Tue May 11 13:42:08 2010] [debug] mod_deflate.c(615): [client 10.1.1.104] Zlib: Compressed 527 to 359 : URL /svn/
尝试以不存在的用户身份进行认证(nobodycool)会导致查询两个LDAP服务器的正确行为:
[Tue May 11 13:42:40 2010] [debug] mod_authnz_ldap.c(377): [client 10.1.1.104] [14815] auth_ldap authenticate: using URL ldap://dc01.alpha:3268/?sAMAccountName?sub?
[Tue May 11 13:42:40 2010] [warn] [client 10.1.1.104] [14815] auth_ldap authenticate: user nobodycool authentication failed; URI /svn/ [User not found][No such object]
[Tue May 11 13:42:40 2010] [debug] mod_authnz_ldap.c(377): [client 10.1.1.104] [14815] auth_ldap authenticate: using URL ldap://ldap.beta:3268/?sAMAccountName?sub?
[Tue May 11 13:42:44 2010] [warn] [client 10.1.1.104] [14815] auth_ldap authenticate: user nobodycool authentication failed; URI /svn/ [User not found][No such object]
[Tue May 11 13:42:44 2010] [error] [client 10.1.1.104] user nobodycool not found: /svn/
[Tue May 11 13:42:44 2010] [debug] mod_deflate.c(615): [client 10.1.1.104] Zlib: Compressed 527 to 359 : URL /svn/
如果Apache在Alpha中遇到过期的帐户,如何配置Apache以正确查询Beta?