我正在尝试configuration在Centos 6.5上运行的SASL,以允许对企业活动目录服务器进行身份validation。 最终目标是validation在这个服务器上运行的一些subversion repos的访问权限,但是在这个阶段,我只是想让saslauthd进行身份validation,然后使用testsaslauthd进行testing。
每次在日志中使用以下命令validation都会失败:
saslauthd[20843] :do_auth : auth failure: [user=MYUSER] [service=svn] [realm=MYREALM] [mech=ldap] [reason=Unknown] saslauthd[20843] :do_request : response: NO
这是我的/etc/saslauthd.conf:
ldap_auth_method: bind ldap_servers: ldaps://ldap.ad.mycompany.com:3269/ ldap_bind_dn: MYBINDDN ldap_password: xxxxxxxxxx ldap_search_base: DC=mycompany,DC=xx ldap_filter: (&(cn=%u)(objectClass=person)) ldap_referrals: yes log_level: 10
请注意,我知道ldap服务器的URI,绑定的DN,密码,search的基础和filter是正确的,因为我有一个Perl脚本,使用这些来执行Web站点的身份validation,它工作正常。 perl脚本使用Net :: LDAP,绑定到AD,使用search基础search用户并筛选,然后尝试使用用户的DN和密码进行绑定。 据我所知,这正是SASL应该按照我configuration的方式进行的尝试。
我的第一个观察是,尽pipe设置了log_level为10,但我只有一行告诉我它失败,原因不明。 我使用-d(debugging)选项从shell启动saslauthd。 还有什么可以获得更多的debugging输出?
有什么办法可以loggingLDAP交互吗?
最后,任何人都可以看到我的configuration有什么问题吗? 也许一些AD怪癖需要SASLconfiguration中的特殊设置?
最后,我不能得到saslauthd输出任何更好的debugging信息,但在这里帮助其他人是我遵循的过程来解决我的问题。
首先,我用strace开始saslauthd,像这样:
# strace -f saslauthd -d -a ldap
然后我可以看到所有由saslauthd进行的系统调用。 在与AD服务器的初始交换期间,看起来好像是失败的,可能在TLS协商期间。
我决定查看是否可以使用openldap提供的命令行ldapsearch工具重现相似的行为。 我给了这样一个命令:
$ ldapsearch -d 9 -H ldaps://ldap.ad.mycompany.com:3269/ -D MYBINDDN -w xxxxxx \ -b DC=mycompany,DC=xx '(&(cn=myuser)(objectClass=person))'
-d 9终于给了我一些有用的debugging输出:
TLS: certificate [CN=VeriSign Class 3 Public Primary Certification Authority - G5,OU="(c) 2006 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US] is not valid - error -8179:Peer's Certificate issuer is not recognized..
阅读ldap.conf的手册页,我发现我应该设置TLS_CACERT和/或TLS_CACERTDIR指向证书包和文件。 我正在使用Centos 6,它有/ etc / pki / tls / certs /,所以我设置了以下内容:
TLS_CACERT /etc/pki/tls/certs/ca-bundle.crt TLS_CACERTDIR /etc/pki/tls/certs/
之后,ldapsearch工作,重新启动saslauthd后,对AD服务器的authentication成功。