Subversion : Access to Repositories via HTTP2024/09/13 |
Access to Repositories via HTTP, without running [svnserve]. |
|
[1] | |
[2] |
Configure SSL/TLS to Apache httpd, refer to here. (Optional) |
[3] | Install required packages. |
root@dlp:~ # pkg install -y mod_dav_svn
|
[4] | Configure Apache httpd. For example, Set HTTP access to [/home/svn/repos/project] repository. |
root@www:~ #
vi /usr/local/etc/apache24/httpd.conf # line 160 : uncomment LoadModule dav_module libexec/apache24/mod_dav.so # line 171,172 : uncomment LoadModule dav_fs_module libexec/apache24/mod_dav_fs.so LoadModule dav_lock_module libexec/apache24/mod_dav_lock.so
root@dlp:~ #
vi /usr/local/etc/apache24/Includes/subversion.conf # create new LoadModule dav_svn_module libexec/apache24/mod_dav_svn.so LoadModule authz_svn_module libexec/apache24/mod_authz_svn.so LoadModule dontdothat_module libexec/apache24/mod_dontdothat.so <Location /project> DAV svn AuthType Basic AuthName "DAV SVN" AuthUserFile /home/svn/.svnpasswd Require valid-user SVNPath /home/svn/repos/project </Location>
root@dlp:~ #
chown -R www /home/svn/repos/project root@dlp:~ # service apache24 restart # add users root@dlp:~ # htpasswd -c /home/svn/.svnpasswd freebsd New password: Re-type new password: Adding password for user freebsd |
[5] | If you like to set access permission, Configure like follow. |
root@dlp:~ #
vi /home/svn/repos/project/conf/authzsvn.conf # create new # set group [groups] developer = freebsd,netbsd operator = openbsd # everyone can [Read] access on root directory [/] * = r # only [developer] group can [Read/Write] under the [trunk] directory [project:/trunk] @developer = rw # only [operator] group can [Read/Write] under the [branches] directory [project:/branches] @operator = rw # only [operator] group can [Read/Write] under the [tags] directory [project:/tags] @operator = rw
root@dlp:~ #
vi /usr/local/etc/apache24/Includes/subversion.conf <Location /project> DAV svn AuthType Basic AuthName "DAV SVN" AuthUserFile /var/svn/.svnpasswd Require valid-user SVNPath /var/svn/repos/project # add the line AuthzSVNAccessFile /home/svn/repos/project/conf/authzsvn.conf </Location>root@dlp:~ # service apache24 reload |
[6] | Verify settings to access via HTTP/HTTPS from any Hosts. |
serverworld@node01:~ $ svn --username freebsd list https://dlp.srv.world/project Authentication realm: <https://dlp.srv.world:443> DAV SVN Password for 'freebsd': ******** branches/ tags/ trunk/
serverworld@node01:~ $
serverworld@node01:~/work $ echo 'store-plaintext-passwords = no' >> ~/.subversion/servers serverworld@node01:~ $ mkdir work serverworld@node01:~ $ cd work
svn --username freebsd co https://dlp.srv.world/project Authentication realm: <https://dlp.srv.world:443> DAV SVN Password for 'freebsd': ******** A project/branches A project/tags A project/trunk A project/trunk/index.html Checked out revision 4.
serverworld@node01:~/work $
cd project/trunk
# after creating or editing any files under the repository, # try to [commit] with [openbsd] user serverworld@node01:~/work/project/trunk $ echo index.html >> index.html serverworld@node01:~/work/project/trunk $ svn --username openbsd ci index.html -m "update by openbsd"
Authentication realm: <https://dlp.srv.world:443> DAV SVN
Password for 'openbsd': ********
Sending index.html
Transmitting file data .svn: E195023: Commit failed (details follow):
svn: E195023: Changing file '/home/serverworld/work/project/trunk/index.html' is forbidden by the server
svn: E175013: While preparing '/home/serverworld/work/project/trunk/index.html' for commit
svn: E175013: Access to '/project/!svn/txr/4-4/trunk/index.html' forbidden
# denied normally as settings
# [commit] with [netbsd] user serverworld@node01:~/work/project/trunk $ svn --username netbsd ci index.html -m "update by netbsd"
Authentication realm: <https://dlp.srv.world:443> DAV SVN
Password for 'netbsd': ********
Sending index.html
Transmitting file data .done
Committing transaction...
Committed revision 5.
# done normally as settings
|
[7] | It's also possible to access on Web browser (read only). |
Sponsored Link |
|