|
1. yum install httpd subversion mod_dav_svn mod_authz_ldap
2. 添加用户:svn, 并创建/home/svn/repository目录。
3. 修改httpd.config
a. 修改
User svn
Group svn
b. 在LoadModule处添加:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
添加
<Location /svn/> # 注意这里是"/svn/"而不是"/svn"
DAV svn
SVNListParentPath on #打开根目录浏览功能
SVNParentPath /home/svn/repository
AuthName "Subversion repository"
Satisfy Any
AuthType Basic
Require valid-user
SVNParentPath /home/svn/repository
AuthUserFile /home/svn/repository/authfile
AuthzSVNAccessFILE /home/svn/repository/authz.conf
</Location>
4. 创建仓库:
svnadmin create openwrt
5. 添加svn(httpd)用户:
htpasswd -c /home/svn/repository/authfile liman (-c表示:创建用户文件authfile)
htpasswd /home/svn/repository/authfile test
6. 修改权限
# vim /home/svn/repository/authz.conf
[/]
*=r
[openwrt:/]
*=r
liman=rw
============================================================================
解决匿名访问问题:
这里使用的是Apache激活mod_authz_svn模块后的authz权限设置,在Apache的配置设置内容为:
引用
<Location /repos>
DAV svn
SVNParentPath /var/www/svn
Satisfy Any
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/svn/svnusers.conf
Require valid-user
AuthzSVNAccessFile /etc/svn/accesspolicy.conf
</Location>
这里的Apache配置文件中,不需要加入<Limit>或<LimitExcept>标签。但加入了Satisfy Any的设置,其表示在同时启用了Allow(允许)和Require的情况下,指定相关策略的,一共有两个备选值,All表示用户必须同时满足Allow和Require的条件,而Any则是满足其中之一即可。
这这里,Satisfy Any用于允许先用匿名方式尝试访问,并根据svnauthz对匿名用户的控制给予访问权限。若没有这句话,则无论svnauthz中是否加入了“*=r”的写法,匿名用户都是无法访问的。
摘自:http://lameck.blog.163.com/blog/static/3881137420116294242507/
|
|