使用LDAP对某些OU进行LDAP身份验证的访问权限?

时间:2012-02-06 15:29:56

标签: apache .htaccess ldap authorization

我想通过htaccess创建一个web目录,并且某些OU中的LDAP用户可以访问它。
我整天用Google搜索,我无法实现。我在Ubuntu Server 10.04 LTS上使用Apache 2.2。这是我的htaccess:

AuthType Basic
AuthName "LOGIN"
AuthUserFile /dev/null
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPURL "ldap://SERVER_IP/ou=users,dc=domain,dc=TLD,dc=ccTLD?uid?sub?(objectClass=*)"
AuthLDAPBindDN "cn=user,dc=domain,dc=TLD,dc=ccTLD"
AuthLDAPBindPassword passwd

#I've tried all of below:


#Require valid-user # This works just fine. But i don't want everyone can login.

#Require ldap-group ou=couldLogIn,ou=users,dc=domain,dc=TLD,dc=ccTLD # Tried this one and failed.

Require ldap-filter (ou=couldLogIn,ou=users,dc=domain,dc=TLD,dc=ccTLD)  # tried this one and also failed.

非常感谢。

1 个答案:

答案 0 :(得分:3)

我发现了问题。您不应该在ldap-filter属性周围使用括号。

此:

Require ldap-filter (ou=couldLogIn,ou=users,dc=domain,dc=TLD,dc=ccTLD)

应该是这样的:

Require ldap-filter ou=couldLogIn,ou=users,dc=domain,dc=TLD,dc=ccTLD