Authentication for a directory and separate authentication for sub-directories
Added by jervine over 13 years ago
I'm using lighttpd (1.4.26) on openSUSE 11.4 and have set up LDAP authentication. I am able to set up access to a directory, e.g. /parent based upon group membership. I would also like to set up access to /parent/child based upon membership of a different LDAP group. However, every time I try to access http://server/parent/child I'm being prompted to authenticate to the realm for /parent (which the user who wants to access /parent/child) doesn't necessarily have access to. Access to http://server/parent works fine, it's just adding some granular access to sub-directories I'm struggling with here...
I've set up my authentication to use multiple authentication sources (although they are the same LDAP directory, the LDAP filter is different based on group membership). Is this likely to work, or am I wasting my time?
My authentication configuration is:
$HTTP["url"] =~ "^/parent/child/" {
auth.backend = "ldap"
auth.backend.ldap.hostname = "ldap-server"
auth.backend.ldap.base-dn = "dc=home"
auth.backend.ldap.filter = "(&(uid=$)(memberOf=cn=child,ou=group,dc=home))"
auth.backend.ldap.starttls = "enable"
auth.backend.ldap.ca-file = "/etc/ssl/certs/myCert.pem"
auth.backend.ldap.allow-empty-pw = "disable"
auth.require = ( "/parent/child/" => (
"method" => "basic",
"realm" => "Child",
"require" => "valid-user"
))
}
$HTTP["url"] =~ "^/parent/*" {
auth.backend = "ldap"
auth.debug = 2
auth.backend.ldap.hostname = "ldap-server"
auth.backend.ldap.base-dn = "dc=home"
auth.backend.ldap.filter = "(&(uid=$)(memberOf=cn=parent,ou=group,dc=home))"
auth.backend.ldap.starttls = "enable"
auth.backend.ldap.ca-file = "/etc/ssl/certs/myCert.pem"
auth.backend.ldap.allow-empty-pw = "disable"
auth.require = ( "/parent/" => (
"method" => "basic",
"realm" => "Parent",
"require" => "valid-user"
))
}
Thanks in advance,
Jon