我正在使用CentOS 6.我发现了一篇很好的关于如何在CentOS 6上安装和configurationOpenLDAP的文章 ,并且我在这里find了一些关于如何configurationLDAP来处理Apache HTTPD的很好的文档(我正在使用2.2,CentOS 6)。 不幸的是,这两篇文章不一定要指出的是如何将两者连接在一起。 我提到的第二篇文章非常适合Apache的使用,假设您已经对LDAP语法有了很好的理解,而且我提到的第一篇文章是非常棒的,假设您已经想到了一种testing方法。 看来你必须成为专家才能完成设置。
所以我们假设我根据CentOS OpenLDAP的walk-through文章configuration了我的LDAP凭证。 我已经添加了以下人员:
acme.ldif
dn: dc=acme,dc=com objectClass: dcObject objectClass: organization dc: acme o : acme
users.ldif
dn: ou=Users,dc=acme,dc=com objectClass: organizationalUnit ou: Users
bob.ldif
dn: cn=Bob Jones,ou=Users,dc=acme,dc=com cn: Bob Jones sn: Jones objectClass: inetOrgPerson userPassword: p@ssw0rd uid: bjones
engineering.ldif
dn: cn=Engineering,ou=Users,dc=acme,dc=com cn: Engineering objectClass: groupOfNames member: cn=Bob Jones,ou=Users,dc=acme,dc=com
addUserToGroup.ldif
dn: cn=Engineering,ou=Users,dc=acme,dc=com changetype: modify add: member member: cn=Al Smith,ou=Users,dc=acme,dc=com
al.ldif
dn: cn=Al Smith,ou=Users,dc=acme,dc=com cn: Al Smith sn: Smith objectClass: inetOrgPerson userPassword: 12345 uid: asmith
我从SourceForge下载了LDAPExplorer工具2,并成功连接到这个LDAP目录并探索它,它看起来就像LDIF文件所示。
以下是来自Apache HTTPD的httpd.conf文件:
<Directory /var/www/html/authpage> AuthType Basic AuthName "Enter valid user name" AuthLDAPURL ldap://magneto.acme.com:389/???? require valid-user </Directory>
哪里???? 是我不知道如何使我的LDAP语法与我的LDAP目录。 我尝试了各种各样的。 会发生什么是导航到URL http://magneto.acme.com/authpage (磁铁是我的主机名为服务器在这种情况下,我至less知道这样的作品),我被提示input凭据。 没有我投入工作。 我已经尝试ou=和o=和dc= ,以及?uid作为查询参数。
当我检查我的Apache error_log ,我看到这一行:
[Wed Sep 10 11:00:51 2014] [error] [client 10.78.182.243] access to /authpage failed, reason: verification of user id 'bjones' not configured [Wed Sep 10 11:00:54 2014] [error] [client 10.78.182.243] access to /authpage failed, reason: verification of user id 'asmith' not configured
假设我的LDAP目录正常工作,并且Apache正确地尝试对其进行身份validation,1.如何编写正确的语法来向所有用户或只是特定的组进行身份validation? 2.是否有任何额外的configuration需要configurationvalidation的用户,根据什么error_log说?
ldap://host:port/basedn?attribute?scope?filter
在你的情况下:
AuthLDAPURL ldap://magneto.acme.com:389/ou=Users,dc=acme,dc=com?uid?sub?(objectClass=inetOrgPerson)
注意:如果您不允许在LDAP服务器上进行匿名search,则可能需要configurationAuthLDAPBindDN和AuthLDAPBindPassword
经过更多的search,我发现这篇文章给了更多的信息。 事实certificate,我只是从我的Apache HTTPD httpd.conf文件中错过了一些重要的行:
<Directory /var/www/html/authpage> Order deny,allow Deny from All AuthName "Enter valid user name" AuthType Basic AuthBasicProvider ldap AuthzLDAPAuthoritative off AuthLDAPUrl ldap://magneto.acme.com/ou=Users,dc=acme,dc=com?uid Require valid-user Satisfy any </Directory>
希望将来如果有将来有人在CentOS 6上使用OpenLDAP并通过Apache HTTPD设置LDAP身份validation,那么这个ServerFault文章中的链接将有所帮助。 这花了相当多的尝试,错误和search。