linux下svn客户端报错Cannot negotiate authentication mechanism的解决方法

svn客户端报错Cannot negotiate authentication mechanism的解决方法:

问题出现的原因之一:

因为SVN服务器配置了saslauthd服务用来实现与ldap的对接,因此认证的机制发生了变化,所以客户端需要安装组件才可以:

很简单对于RHEL/CentOS,客户端只需要yum安装相应的包即可:

yum -y install cyrus-sasl-plain

ubuntu系统尚未测试,请查找对应的包安装即可

问题出现的原因之二:可能与svn的版本或源码安装时选择的模块有关

可以通过svnserve --version

linux下svn客户端报错Cannot negotiate authentication mechanism的解决方法

查看是否支持相应的功能,如果不支持则需要升级软件版本,这里不再赘述

二、svn+saslauthd+openldap的配置方法

这里主要以saslauthd的配置为主,openLDAP配置请查看其它文档

1、首先开启saslauthd服务会有选择认证机制的参数‘MECH’

这个参数会从/etc/sysconfig/saslauthd文件中去获取以环境变量的方式加载

linux下svn客户端报错Cannot negotiate authentication mechanism的解决方法

2、需要配置LDAP服务器和认证的相关参数(/etc/saslauthd.conf没有须自己创建):

ldap_servers: ldap://<LDAP服务器IP地址>
ldap_default_domain:<你们公司的域名,例如example.com>
ldap_search_base:<LDAP基准搜索根分支点,例如ou=People,dc=example,dc=com>
ldap_bind_dn:<LDAP管理员账户,例如cn=administrator,dc==example,dc=com>
ldap_password:<LDAP管理员密码>
ldap_deref: never
ldap_restart: yes
ldap_scope: sub
ldap_use_sasl: no
ldap_start_tls: no
ldap_version: 3
ldap_auth_method: bind
ldap_mech: SSHA #(加密算法选取默认SSHA即可)
ldap_filter:uid=%u #(这里的含义是把LDAP相应分支下的记录中uid参数作为这里的用户名,%u是用户账户的含义)
ldap_password_attr:userPassword #(这里的含义是把LDAP相应分支下的记录中userPassword参数作为这里的验证密码)
ldap_timeout: 10
ldap_cache_ttl: 30
ldap_cache_mem: 32786

3、在/etc/sasl2/下新增一个svn.conf文件:

#用户验证方法
pwcheck_method:saslauthd
#用户验证信息怎么传输
mech_list: plain login

4、在SVN对应的库中conf目录下svnserve.conf文件修改认证方式允许sasl认证即可:

svnserve.conf:

[sasl]
use-sasl = true

 5、重启saslauthd、svn服务即可:

service saslauthd restart

chkconfig --level 3,5 on

(centos7的自己脑补:

还是我给写上吧...

systemctl restart saslauthd.service

systemctl enable saslauthd.service

)

svnserve -d -r /Your/SVN/RepoRootDir

6、验证是否能够验证成功:

testsaslauthd -u <%u还记得上面配置文件中的uid和%u吗...> -p <passwd>

linux下svn客户端报错Cannot negotiate authentication mechanism的解决方法

如果按老司机的套路走到这一步saslauthd已经言尽,能不能成功就看你LDAP配置了