我试图通过sasl+ldap对颠覆用户进行身份验证。有关此问题的其他问题似乎与较早版本的subversion或sasldb身份验证有关。
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.1 (jessie)
Release: 8.1
Codename: jessie
svnserve --version
svnserve, version 1.8.10 (r1615264)
Cyrus SASL authentication is available.
saslauthd -v
saslauthd 2.1.26
authentication mechanisms: sasldb getpwent kerberos5 pam rimap shadow ldap
sasl+LDAP部件似乎配置正确:
testsaslauthd -u user -p password -r realm
0: OK "Success."
使用错误的凭据测试它会出现错误:
testsaslauthd -u wronguser -p wrongpassword -r wrongrealm
0: NO "authentication failed"
它显示了auth.log中的一个错误:
Sep 10 22:23:53 xxx saslauthd[30948]: Entry not found ((&(objectClass=posixAccount)(uid=wronguser))).
Sep 10 22:23:53 xxx saslauthd[30948]: Authentication failed for wronguser/wrongrealm: User not found (-6)
Sep 10 22:23:53 xxx saslauthd[30948]: do_auth : auth failure: [user=wronguser] [service=imap] [realm=wrongrealm] [mech=ldap] [reason=Unknown]
因此,我假设SASL可以很好地与LDAP服务器联系并获取数据。
我将subversion配置为:
/etc/sasl2/svn.conf:
pwcheck_method: saslauthd
mech_list: DIGEST-MD5
使用strace -e open检查svnserve显示它打开了这个文件,而不是/usr/lib/sasl2 2或类似的文件。
当我尝试从svn客户端连接时,我得到
Sep 10 22:31:38 xxx svnserve: DIGEST-MD5 common mech free
在auth.log中的每一次尝试,但没有信息或错误来自saslauthd。
如果我将用户帐户添加到sasldb2中:
saslpasswd2 user -u realm
Password: password
我可以从svn客户端正确连接。所以看起来sasl使用sasldb2,尽管svn和saslauthd的配置配置了LDAP。
发布于 2015-09-27 09:24:23
解决方案:我附加了一个调试器并逐步完成了身份验证。结果发现,我有两个问题:/var/log/saslauthd的权限:
drwx--x--- 2 root sasl 140 Sep 27 09:44 saslauthd
意味着"subversion“服务器用户需要成为组sasl的一部分。
第二个更复杂:摘要-MD5依赖纯文本密码来计算服务器端的哈希。我的LDAP目录存储SSHA加密密码,因此服务器永远不能将来自客户机的MD5与本地计算的MD5进行比较。我想目录可以存储MD5(用户名:领域:密码),但我不确定在sasl中是否支持这一点,以及如果您有几个领域,您将如何管理它。
我真的不想存储纯文本密码,所以目前的解决方案是只使用未加密的身份验证:
# cat /etc/sasl2/svn.conf
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
这不是一个完美的解决方案,但目前看来是可行的。我想我会为外部访问执行ssh+svn,也许我会花一些时间在对svnserve的TLS支持上。
(如果有更多的诊断选项和更好的文档,这将大大减少时间。)
https://serverfault.com/questions/721602
复制相似问题