2023年6月21日发(作者:)
借助sasl构建基于AD⽤户验证的SVN服务器SVN服务器的⽤户验证⽅式很多,以下列出⼀些我所了解的:1 最简单的,即使⽤SVN版本库⽬录之下的conf/passwd⽂件存储⽤户信息。然⽽,密码使⽤了明⽂存储,有安全隐患。2 SVN+sasl实现密码加密,我参考⽹上资料:进⾏了实验,该⽅式使⽤了另外的可⾃定义的sasldb⽂件来存储⽤户信息,然⽽,似乎没有实现加密的效果,初看之下,sasldb⽂件确实⼀堆乱码,但仔细看看,发现密码仍然是明⽂的,莫⾮我操作有偏差?更重要的是,这种⽅式使得⽤户管理极其⿇烦。4 SVN+sasl+AD,令⼈愉快的是,剔除Apache,借助saslauthd构建基于AD⽤户验证的SVN服务器仍然是可⾏的,使⽤SVN⾃⼰的svn://协议进⾏通信。
本⽂将讲述第4种⽅案的实现⽅法。
环境说明:SVN的安装、AD服务器的搭建、域帐号的添加等琐碎不在本⽂关⼼之列,以我所在环境为例,假设环境基础已经完备:1 AD服务器 操作系统:WindowsServer 2012 R2 Datacenter 域: IP:10.17.1.2 SVN域帐号:pub-svn+pw000000(密码应配置为不可更改,永不过期) SVN测试⽤户域帐号:test+pw111111
2SVN服务器 操作系统:CentOS7.1 x64 IP:10.17.1.10 版本库:/home/svn/project_art
Step by Step!
1 检查是否已经安装cryus-sasl:[root@localhostproject_art]# rpm -qa | grep 7.x86_7.x86_7.x86_7.x86_7.x86_7.x86_64
如果没有安装则安装之:[root@localhost project_art]#yum-y install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
2 查看sasl的⽤户验证⽅式:[root@localhostproject_art]# saslauthd -vsaslauthd 2.1.26authenticationmechanisms: getpwent kerberos5 pam rimap shadow ldap httpform我们要使⽤的AD验证⽅式便依靠ldap提供⽀持。
3 修改sasl的⽤户验证⽅式为ldap:[root@localhostproject_art]# vi /etc/sysconfig/saslauthd# Directory in which toplace saslauthd's listening socket, pid file, and so# on. This directory must already DIR=/run/saslauthd
# Mechanism to use whenchecking passwords. Run "saslauthd-v" to get a list# of which mechanismyour installation was compiled with the ablity to use.# MECH=pamMECH=ldap
# Additional flags topass to saslauthd on the command line. See saslauthd(8)# for the list ofaccepted =
4 修改sasl配置⽂件/etc/,如果配置⽂件不存在,touch之:[root@localhostproject_art]# vi /etc/#AD服务器地址,写域名或IP都⾏ldap_servers:ldap://#AD默认域名ldap_default_domain:#⽤户信息查找配置,组织与单位OU为GZY,要查找所有组织单位,则不填写OU#ldap_search_base: OU=GZY,DC=ad, DC=comldap_search_base: DC=ad,DC=com#SVN的域帐号#ldap_bind_dn:CN=pub-svn, OU=GZY, DC=ad, DC=comldap_bind_dn: adpub-svn#ldap_bind_pw:pw000000ldap_password: pw000000#其他设置ldap_deref: neverldap_restart: yesldap_scope: subldap_use_sasl: noldap_start_tls: noldap_version: 3ldap_auth_method: bindldap_mech: DIGEST-MD5ldap_filter:sAMAccountName=%uldap_password_attr:userPasswordldap_timeout: 10ldap_cache_ttl: 30ldap_cache_mem: 32786
5 重启sasl服务:[root@localhost project_art]#systemctl restart e重启后测试⼀下能否正常连接到AD域:[root@localhostproject_art]# testsaslauthd -u test -p 'pw111111'0: OK"Success."如果连接失败,检查配置,找⼀下问题所在吧。
6 修改SVN的sasl配置⽂件/etc/sasl/,同样,如果配置⽂件不存在,touch之:[root@localhostproject_art]# vi /etc/sasl2/#⽤户验证⽅法pwcheck_method:saslauthd#⽤户验证信息怎么传输mech_list: plain login由于依赖于,不需要配置过多内容,也可以按照进⾏配置,这时它的配置选项有更⾼的优先级。
7 修改SVN版本库的配置:[root@localhostproject_art]# vi /home/svn/project_art/conf/ [general]anon-access = noneauth-access = write#关闭passwd# password-db = passwd#如果要对版本库进⾏权限控制,开启authzauthz-db = authz [sasl]#开启sasl⽤户验证use-sasl = true
8 重启SVN:[root@localhostproject_art]# ps -ef | grep svnroot 17131 1 0 14:30 ? 00:00:00 svnserve -droot 18040 13803 0 15:57 pts/1 00:00:00 grep --color=auto svn[root@localhostproject_art]# kill 17131[root@localhostproject_art]# svnserve -d
有点暴⼒,SVN还有其他重启⽅式吗,Tell me!
9 到域⽤户客户端连接SVN服务器验证⼀下。
2023年6月21日发(作者:)
借助sasl构建基于AD⽤户验证的SVN服务器SVN服务器的⽤户验证⽅式很多,以下列出⼀些我所了解的:1 最简单的,即使⽤SVN版本库⽬录之下的conf/passwd⽂件存储⽤户信息。然⽽,密码使⽤了明⽂存储,有安全隐患。2 SVN+sasl实现密码加密,我参考⽹上资料:进⾏了实验,该⽅式使⽤了另外的可⾃定义的sasldb⽂件来存储⽤户信息,然⽽,似乎没有实现加密的效果,初看之下,sasldb⽂件确实⼀堆乱码,但仔细看看,发现密码仍然是明⽂的,莫⾮我操作有偏差?更重要的是,这种⽅式使得⽤户管理极其⿇烦。4 SVN+sasl+AD,令⼈愉快的是,剔除Apache,借助saslauthd构建基于AD⽤户验证的SVN服务器仍然是可⾏的,使⽤SVN⾃⼰的svn://协议进⾏通信。
本⽂将讲述第4种⽅案的实现⽅法。
环境说明:SVN的安装、AD服务器的搭建、域帐号的添加等琐碎不在本⽂关⼼之列,以我所在环境为例,假设环境基础已经完备:1 AD服务器 操作系统:WindowsServer 2012 R2 Datacenter 域: IP:10.17.1.2 SVN域帐号:pub-svn+pw000000(密码应配置为不可更改,永不过期) SVN测试⽤户域帐号:test+pw111111
2SVN服务器 操作系统:CentOS7.1 x64 IP:10.17.1.10 版本库:/home/svn/project_art
Step by Step!
1 检查是否已经安装cryus-sasl:[root@localhostproject_art]# rpm -qa | grep 7.x86_7.x86_7.x86_7.x86_7.x86_7.x86_64
如果没有安装则安装之:[root@localhost project_art]#yum-y install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
2 查看sasl的⽤户验证⽅式:[root@localhostproject_art]# saslauthd -vsaslauthd 2.1.26authenticationmechanisms: getpwent kerberos5 pam rimap shadow ldap httpform我们要使⽤的AD验证⽅式便依靠ldap提供⽀持。
3 修改sasl的⽤户验证⽅式为ldap:[root@localhostproject_art]# vi /etc/sysconfig/saslauthd# Directory in which toplace saslauthd's listening socket, pid file, and so# on. This directory must already DIR=/run/saslauthd
# Mechanism to use whenchecking passwords. Run "saslauthd-v" to get a list# of which mechanismyour installation was compiled with the ablity to use.# MECH=pamMECH=ldap
# Additional flags topass to saslauthd on the command line. See saslauthd(8)# for the list ofaccepted =
4 修改sasl配置⽂件/etc/,如果配置⽂件不存在,touch之:[root@localhostproject_art]# vi /etc/#AD服务器地址,写域名或IP都⾏ldap_servers:ldap://#AD默认域名ldap_default_domain:#⽤户信息查找配置,组织与单位OU为GZY,要查找所有组织单位,则不填写OU#ldap_search_base: OU=GZY,DC=ad, DC=comldap_search_base: DC=ad,DC=com#SVN的域帐号#ldap_bind_dn:CN=pub-svn, OU=GZY, DC=ad, DC=comldap_bind_dn: adpub-svn#ldap_bind_pw:pw000000ldap_password: pw000000#其他设置ldap_deref: neverldap_restart: yesldap_scope: subldap_use_sasl: noldap_start_tls: noldap_version: 3ldap_auth_method: bindldap_mech: DIGEST-MD5ldap_filter:sAMAccountName=%uldap_password_attr:userPasswordldap_timeout: 10ldap_cache_ttl: 30ldap_cache_mem: 32786
5 重启sasl服务:[root@localhost project_art]#systemctl restart e重启后测试⼀下能否正常连接到AD域:[root@localhostproject_art]# testsaslauthd -u test -p 'pw111111'0: OK"Success."如果连接失败,检查配置,找⼀下问题所在吧。
6 修改SVN的sasl配置⽂件/etc/sasl/,同样,如果配置⽂件不存在,touch之:[root@localhostproject_art]# vi /etc/sasl2/#⽤户验证⽅法pwcheck_method:saslauthd#⽤户验证信息怎么传输mech_list: plain login由于依赖于,不需要配置过多内容,也可以按照进⾏配置,这时它的配置选项有更⾼的优先级。
7 修改SVN版本库的配置:[root@localhostproject_art]# vi /home/svn/project_art/conf/ [general]anon-access = noneauth-access = write#关闭passwd# password-db = passwd#如果要对版本库进⾏权限控制,开启authzauthz-db = authz [sasl]#开启sasl⽤户验证use-sasl = true
8 重启SVN:[root@localhostproject_art]# ps -ef | grep svnroot 17131 1 0 14:30 ? 00:00:00 svnserve -droot 18040 13803 0 15:57 pts/1 00:00:00 grep --color=auto svn[root@localhostproject_art]# kill 17131[root@localhostproject_art]# svnserve -d
有点暴⼒,SVN还有其他重启⽅式吗,Tell me!
9 到域⽤户客户端连接SVN服务器验证⼀下。
发布评论