当前的svn是在CentOS 7 下 SVN、 Apache 对接 LDAP 服务实现用户账号管理和权限认证,本文模拟ldap数据丢失如何恢复svn,方法是临时将认证切换到本地认证
编辑subversion.conf文件
vi /etc/httpd/conf.d/subversion.conf
注释ldap-status
#<Location /ldap-status>
# SetHandler ldap-status
# Order deny,allow
# Deny from all
# Allow from localhost x.x.x.x
#</Location>
修改项目目录配置
<Location /svn/{project_id}>
DAV svn
#SVNParentPath /home/workspace/repos/{project_id}
SVNPath /home/workspace/repos/{project_id}/doc
SVNListParentPath On
AuthType Basic
AuthName "Repositories of {project_id}"
AuthzSVNAccessFile /home/workspace/repos/{project_id}/authz
AuthUserFile /home/workspace/repos/{project_id}/passwd
Satisfy all
Require valid-user
#AuthBasicProvider ldap
#AuthLDAPURL "ldap://{ldap-service-ip}:{ldap-service-port}/ou=user,ou=workspace,dc=xx,dc=com?uid?sub?(objectClass=aqua-user)"
</Location>
备注:
注释SVNParentPath
SVNParentPath /home/workspace/repos/{project_id}
添加SVNPath
SVNPath /home/workspace/repos/{project_id}/doc
注释ldap认证
#AuthBasicProvider ldap
#AuthLDAPURL "ldap://{ldap-service-ip}:{ldap-service-port}/ou=user,ou=workspace,dc=xx,dc=com?uid?sub?(objectClass=aqua-user)"
添加http本地认证passwd文件
AuthUserFile /home/workspace/repos/{project_id}/passwd
生成本地认证用户(首次生成)
htpasswd -c -m /home/workspace/repos/{project_id}/passwd username
增加用户
htpasswd -m /home/workspace/repos/{project_id}/passwd username2
配置完毕后,重启httpd服务
重启
# systemctl restart httpd
验证http方式
因为 Apache 代理时,直接代理仓库目录,直接输入项目编号即可
使用浏览器打开svn项目地址:
http://{ldap-service-ip}:{ldap-service-port}/svn/{project_id}/
测试svn方式
svn co svn://{ldap-service-ip}/repository/{project_id}--username xxx
标签:svn,repos,认证,project,workspace,ldap,home,id
From: https://blog.csdn.net/LG_15011399296/article/details/140448930