每个文件夹的apache ldap auth

apache ldap auth per folder

我已经在 redhat 6 上配置了一个 apache 服务器。 我还实施并测试了 ldap 身份验证,并且有效。 我遇到的问题是当我想向用户授予特定文件夹路径的权限时...例如:

<Directory "/var/www/html/x">
    AuthType Basic
    AuthName "Enter Your AD Username/Password"
    AuthBasicProvider ldap
    AuthzLDAPAuthoritative on
    AuthLDAPBindDN ....
    AuthLDAPBindPassword ....
    AuthLDAPURL ....
    require user user1 user2
</Directory>

和 user3 只能访问

<Directory "/var/www/html/x/y">
 AuthType Basic
 AuthName "Enter Your AD Username/Password"
 AuthBasicProvider ldap
 AuthzLDAPAuthoritative on
 AuthLDAPBindDN ....
 AuthLDAPBindPassword ....
 AuthLDAPURL ....
 require user user3
</Directory>

我做了上面写的但是没有用。

在 httpd 中使用位置,而不是目录。

如果 authzldapauthoritative 开启,LDAPS 可能无法连接。 这给了我 10 次中的 9 次错误,当它关闭时它工作得很好。

<Location "/var/www/html/x/y">
  AuthType Basic
  AuthName "Enter Your AD Username/Password"
  AuthBasicProvider "ldap"
  AuthLDAPURL "..."
  AuthLDAPBindDN "..."
  AuthLDAPBindPassword "..."
  authzldapauthoritative Off
  require valid-user
</Location>

或者在每个文件夹中使用 .htacces。

AuthLDAPBindDN "..."
AuthLDAPBindPassword "..."
AuthLDAPURL "..."

AuthType Basic
AuthName "Enter Your AD Username/Password"
AuthBasicProvider ldap

require valid-user