Order deny,allow
Deny from All
AuthName "Welcometo shuyun ldap . Use your info to pass in !"
AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPUrlldap://ldap.shuyun.com/ou=People,dc=shuyun,dc=com?uid
Require valid-user
Satisfy any
AuthBasicProvider ldap 是必须滴,以便让Apache种地查询的是其他地址的LDAP服务器,而不是本地的。 AuthzLDAPAuthoritative off 必须在此处配置出来,因为这玩意儿默认是“开”。如果你要求验证的用户必须为LDAP用户,就设置此项为“ON”。例如:Require ldap-user, 需要设置为 "on." 设置为 off 则可以使用混合用户验证。 Satisfy any (off时,2套验证机制)这个指令不在此处使用。
用户列表(认证用户)
Require ldap-user 这个指令作用是:ldap-user列表中的用户可以通过此认证
Order deny,allow
Deny from All
AuthName " Welcometo shuyun ldap . Use your info to pass in !"
AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPUrlldap://ldap.shuyun.com/ou=People,dc=shuyun,dc=com?uid
Require ldap-user yanzong.chen
Satisfy any
AuthzLDAPAuthoritative on 默认为”ON”,这里写出来是为了更清晰。
注意: AuthLDAPUrl 没有更改,和前边例子一样,他在目录中搜索匹配到的UID
Order deny,allow
Deny from All
AuthName " Welcometo shuyun ldap . Use your info to pass in !"
AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPUrlldap://ldap.shuyun.com/ou=People,dc=shuyun,dc=com?uid
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDN off
Require ldap-group cn=SysOps,ou=Group,dc=company,dc=com
Require ldap-attribute gidNumber=10001
Satisfy any
AuthzLDAPAuthoritative on 默认为”ON”,这里写出来是为了更清晰。 AuthLDAPGroupAttribute memberUid 表示LDAP组记录有哪些属性,以配合UID。在这种情况下,一个memberUid 包含其组中每一个成员。 AuthLDAPGroupAttributeIsDN off 告诉Apache验证用户时,使用客户端的distinguished name(标示名比如:cn=yanzong.chen,ou=SysOps,dc=shuyun,dc=com)。否则,用户名会被使用。在我的LDAP目录中,用户名来自NIS,所以需要关闭(默认为ON)。LDAP目录中可以存储整个转有名称,因此你可以根据你的需求更改此选项。
Require ldap-group 授予获得”SysOps”的组成员,对于多个组,添加一个额外的命令”each(也可能是for each)”。 Require ldap-attribute gidNumber=10001 处理(ID:10001)、”SysOps”组,如果没有此选项,用户访问将被拒绝。对于多个组,添加额外命令“each”。 Satisfy any 这个指令是必须的。因为我们正在测试多个条件,并希望任何条件授予访问权限都能成功。 用户和组的结合
例子如下,各种选项你都能看懂的应该是,所以你看看吧然后测试测试。
Order deny,allow
Deny from All
AuthName " Welcometo shuyun ldap . Use your info to pass in !"
AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPUrl ldap://ldap.shuyun.com/ou=People,dc=shuyun,dc=com?uid
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDN off
Require ldap-group cn=SysOps,ou=Group,dc=company,dc=com
Require ldap-attribute gidNumber=10001
Require ldap-user yanzong.chen
Satisfy any
调试和部署
Testing LDAP authentication from a Web browser can be frustrating, becausethe only thing you know is whether access was granted or not. You don't get anykind of feedback on why something did not work. For verbose information on eachstep in the process, set theLogLeveldebug option inApache. With debugging active, Apache will record the connection status to theLDAP server, what attributes and values were requested, what was returned, andwhy conditions were met or not met. This information can be invaluable infine-tuning LDAP access controls.
我保留了这段话,因为这段话我虽然看懂了,但是实话是不知道咋操作。因为我的LDAP目前为止除了终端启动模式,我并不知道如何输出日志到文件(我系统的原因貌似。)我猜想可能是要将apache日志的loglevel调整下,然后观察Apache的日志吧。这个大家可以试一下。也可以留言给我。
PS:源英文地址:http://www.opendigest.org/article.php/490 下面文档已做适当修改