LDAP身份validation将以500或401失败,具体取决于Apache2的绑定

我正在RHEL 5系统上为通过Apache托pipe的Subversion存储库设置LDAP身份validation。 当我尝试使用Active Directory进行身份validation时,遇到两个不同的问题。

<Location /svn/> Dav svn SvnParentPath /srv/subversion SVNListParentPath On AuthType Basic AuthName "Subversion Repository" AuthBasicProvider ldap AuthLDAPBindDN "cn=userfoo,ou=Service Accounts,ou=User Accounts,dc=my,dc=example,dc=com" AuthLDAPBindPassword "mypass" AuthLDAPUrl "ldap://my.example.com:389/ou=User Accounts,dc=my,dc=example,dc=com?sAMAccountName?sub?(objectClass=user)" NONE Require valid-user </Location> 

如果我使用上面的configuration,它会不断地提示我提供基本提示,最后我必须selectCancel,它将返回401(需要授权)。 如果我注释掉绑定部分,它返回500(内部服务器错误),抱怨authentication失败:

 [Mon Nov 02 12:00:00 2009] [warn] [client xxxx] [10744] auth_ldap authenticate: user myuser authentication failed; URI /svn [ldap_search_ext_s() for user failed][Operations error] 

当我使用ldapsearch执行绑定并为一个简单属性过滤时,它会正确返回:

 ldapsearch -h my.example.com -p 389 -D "cn=userfoo,ou=Service Accounts,ou=User Accounts,dc=my,dc=example,dc=com" -b "ou=User Accounts,dc=my,dc=example,dc=com" -w - "&(objectClass=user)(cn=myuser)" sAMAccountName 

不幸的是我没有控制或洞察系统的AD部分,只有RHEL服务器。 有谁知道这里挂断了什么?

我有同样的问题。 在Ubuntu上testing的相同configuration在RHEL5上不起作用。 看完这个之后我终于从389端口改成了3268端口,并且解决了我的问题。

在Apache 2.2.3上比较你的configuration与Active Directory的工作configuration,我看到的唯一区别是:

  • 我为我的AuthLDAPBindDN使用“DOMAIN \ sAMAccountName”风格的用户名
  • 我的AuthLDAPURL后没有NONE

除了这些build议,我build议在Apache和Active Directory之间的对话上运行tcpdump ,以查看可能在那里发生的事情。

我不知道LDAP,因为我已经使用SSPI身份validation为我的设置。 但是,我发现这些页面上的LDAPconfiguration很好的细节。 (以防万一你还没有得到他们):

http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html

http://www.novell.com/communities/node/5679/installing-and-configuring-subversion-server-and-apache2-ldap-authentication-against-edire

Apache版本似乎有所不同的语法。

也是加载LDAP模块的顺序。

你的LDAPUrl使得apache创build查询: &(objectClass=user)(sAMAccountName=myuser)

而你的命令行查询是: &(objectClass=user)(cn=myuser)

哪一个是正确的? 如果你说你的命令行testing工作正常,那么你可能需要:

AuthLDAPUrl "ldap://my.example.com:389/ou=User Accounts,dc=my,dc=example,dc=com?cn?sub?(objectClass=user)" NONE

原来我快到了。 我只是错过了特定于我的实例的AuthzLDAPAuthoritative off指令。

作为进一步的说明,我们也希望将回购限制为只能识别的用户,所以我们还使用文件链接了身份validation。 示例如下:

 RedirectMatch ^(/repos)$ $1/ LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /repos/> DAV svn SVNParentPath /var/svn/repos SVNListParentPath On SVNAutoversioning On AuthType Basic AuthName "Subversion Repository" AuthBasicProvider file ldap AuthzLDAPAuthoritative off AuthLDAPBindDN "OU=Service Accounts,OU=User Accounts,DC=example,DC=com" AuthLDAPBindPassword xXxXxXx AuthLDAPUrl "ldap://ldap.example.com:389/OU=User Accounts,DC=example,DC=com?sAMAccountName?sub?(objectClass=user)" AuthzSVNAccessFile /etc/svn-authn SVNIndexXSLT "/styles/svnindexICore.xsl" AuthUserFile /etc/svn-auth-file #AuthBasicProvider file ldap Require valid-user </Location>