针对具有过期帐户的多个LDAP服务器验证Apache HTTPd


8

我们在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?

Answers:


4

AuthzLDAPAuthoritative off仅当用户无法与查询中的DN匹配时,该指令才会使身份验证进入下一个模块。当前,即使用户已过期,执行LDAP查询时似乎仍然会返回其帐户。

我对ActiveDirectory LDAP模式的了解不足,无法在此处给出明确的答案,但是,如果您可以向AuthLDAPURL指令中添加过滤器以过滤掉过期的帐户,则应该导致用户名与查询中的任何DN不匹配。这将导致身份验证进入下一个模块。


1
添加过滤器有效。IT人员非常友好,可以在从Alpha转到Beta的那些用户的描述字段中放置一个一致的字符串(这就是帐户过期的原因)。下面的URL正常工作:AuthLDAPURL ldap://dc01.alpha:3268 /?sAMAccountName?sub?(&(objectClass = user)(!(description = * moved-to-Beta *)))
Brian Bassett
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.