我正在运行Apache 2,我需要在一个<Location/>validation来自多个AD域的用户。 我尝试使用mod_authn_alias
ОС:最新更新的Debian GNU / Linux Squueze
阿帕奇/ 2.2.16
模块
/etc/apache2/apache.conf:
<AuthnProviderAlias ldap first-ldap> AuthLDAPURL "ldap://win2003server:389/DC=first,DC=domain?sAMAccountName?sub?(objectClass=*)" NONE AuthLDAPBindDN "cn=user1,cn=Users,dc=first,dc=domain" AuthLDAPBindPassword "user1" </AuthnProviderAlias> <AuthnProviderAlias ldap second-ldap> AuthLDAPURL "ldap://win2008server:3268/DC=second,DC=domain?sAMAccountName?sub?(objectClass=*)" NONE AuthLDAPBindDN "cn=user2,cn=Users,dc=second,dc=domain" AuthLDAPBindPassword "user2" </AuthnProviderAlias>
在/ etc / apache2的/网站启用/ 000default:
<Location /test> Order allow,deny Allow from all Authtype Basic AuthBasicProvider first-ldap second-ldap AuthName "TEST" AuthzLDAPAuthoritative off require valid-user </Location>
通过这种configuration,它可以从第一个域validation用户,而从第二个域的用户则可以发现一个错误:
[Fri Sep 16 20:54:39 2011] [info] [client 10.0.0.62] [25672] auth_ldap authenticate: user2 user2 authentication failed; URI /test/ [ldap_simple_bind_s() to check user2 credentials failed][Invalid credentials]
当我离开AuthBasicProvider second-ldap用户从第二个域可以authntificate成功,所以第二个域的LDAP是好的。
有没有人知道强制mod_authn_alias工作的解决scheme?
我不知道如何让Apache做你想做的事情。 但是,您可以使用ldap或meta后端将OpenLDAP设置为多个AD实例前面的代理,这将使您获得相同的行为。 您将Apache指向您的OpenLDAP代理,然后OpenLDAP与您的AD服务器通信。
这里是我使用meta后端的写作。 这比实际的解决scheme更重要。
我现在实际上使用OpenLDAP作为代理来对三个单独的目录进行身份validation – 一个AD域,一个远程LDAP服务器和一个本地LDAP目录。
我已经find了解决办法在这里: authentication-apache-httpd-against-multiple-ldap-servers-with-expired-accounts
我用来testing第二个域的用户帐户,这个帐户在第一个域中有同名的禁用帐户。 禁用帐户的删除有帮助,但在AD域中删除帐户是不好的做法:您可以接收具有未知安全描述符的对象。 我创build了LDAPfilter消除残疾用户,现在一切工作正常:)
/etc/apache2/apache2.conf中:
<AuthnProviderAlias ldap first-ldap> AuthLDAPURL "ldap://win2003server:389/DC=first,DC=domain?sAMAccountName?sub?(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))" NONE AuthLDAPBindDN "cn=user1,cn=Users,dc=first,dc=domain" AuthLDAPBindPassword "user1" </AuthnProviderAlias> <AuthnProviderAlias ldap second-ldap> AuthLDAPURL "ldap://win2008server:3268/DC=second,DC=domain?sAMAccountName?sub?(&(objectCategory=person)(objectClass=user))" NONE AuthLDAPBindDN "cn=user2,cn=Users,dc=second,dc=domain" AuthLDAPBindPassword "user2" </AuthnProviderAlias>
请注意,该filter适用于function级别为“windows 2000 native”的AD域,对于function级别为“windows server 2003”的AD域不起作用,我不知道为什么。