在集成方法上可以使用两种方式,第一种是用Apache,需要让你的SVN和Apache绑定起来,让SVN版本库能够走HTTP协议访问,除此之外需要开启Apache的认证机制,并且这个认证的数据源需要配置LDAP,如此一来就实现了SVN+Apache+LDAP的集成方式,SVN与Apache的连通比较好做,但是用户的连接方式需改成http://访问,改变了用户的原始访问习惯。第二种是用SASL,SASL可以通过身份验证和加密功能添加到任何网络协议中,SVN的配置文件中有“#use-sasl=ture”这条被注释的参数,由此一来我们就可以通过SVN的用户走SASL,并从SASL获取用户和密码信息,对于SVN来说,后续需要变动的地方并不多,只需要修改配置即可。
SASL的验证方式
下面为SASL的几种验证方式及适用场景
Password Verification Mechanisms – 接收远程的口令,传递给SASL胶合层,由口令验证器验证,这种机制的例子有 PLAIN ;
Shared Secret Mechanisms – 不是直接传递口令明文,而是服务方发起一个认证,客户证明自己知道这个口令,这需要服务方和客户方都保存有口令.这种机制的例子有 CRAM-MD5,DIGEST-MD5以及SRP ;
Kerberos Mechanisms – 使用信任的第三方来验证客户。
saslauthd – 呼叫saslauthd服务进程,验证用户。saslauthd支持很多识别方式,比如PAM,LDAP,Kerberos数据库等 。
通过LDAP+SASL+SVN 实现SVN与AD域的集成方式
1.安装SASL相关组件
yum install -y cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
2.查看SASL版本和提供的验证模块
saslauthd -v #saslauthd 2.1.26 #authentication mechanisms: getpwent kerberos5 pam rimap shadow ldap httpform
3.修改SASL的用户验证方式为LDAP
cp /etc/sysconfig/saslauthd /etc/sysconfig/saslauthd.save sed -i ’s/MECH=pam/MECH=ldap/‘ /etc/sysconfig/saslauthd
4.修改SASL配置文件(无此文件需手动创建)
[root@svn ~]# vi /etc/saslauthd.conf ldap_servers: ldap://IP地址 ldap_default_domain: nuanfeng.com ldap_bind_dn: CN=admin,CN=Users,DC=nuanfeng,DC=com ldap_password: XXXXXXX ldap_search_base: DC=nuanfeng,DC=com 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: DIGEST-MD5 ldap_filter:sAMAccountName=%u ldap_password_attr:userPassword ldap_timeout: 10 ldap_cache_ttl: 30 dap_cache_mem: 32786
5.启动SASL服务,测试是否通过。
systemctl start saslauthd testsaslauthd -u 用户 -p 密码
6.修改配置文件svn.conf(无此文件需手动创建)
#vi /etc/sasl2/svn.conf pwcheck_method:saslauthd mech_list:plain login
7.安装SVN
yum install -y subversion #yum安装subversion svnadmin create /data/svntest #创建版本库 vim /data/svntest/conf/svnserve.con #修改svn服务配置文件 调整配置 anon-access = none auth-access = write authz-db = authz use-sasl = true vim /data/svntest/conf/authz (具体详细配置可查看SVN相关文档) [aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average [groups] admin = feng.nuan [svntest:/] @admin = rw
8.启动SVN服务器
svnserve -d --listen-port 3690 -r /date
9.最后通过TortoiszSVN客户端测试。
转载请注明:暖风 » 基于CentOS的SVN搭建+AD集成