Lu cat !

Pete Savage: Secure DAV SVN Non Production Server

Following on from the tutorial I wrote earlier on today. I’ve been messing around with dav svn too. I found that I didn’t have to do too much to get a working DAV SVN server working. Basically continuing on from the previous tutorial, ie certificates have been generated etc, this should enable svn access on the server.

First, we edit the ports.conf again as in the previous post, to add svn onto a different port. The file becomes;

Listen 80

<IfModule mod_ssl.c>
    Listen 443
    Listen 81
    Listen 82
</IfModule>

We need the svn apache module, available by running the following

sudo apt-get install libapache2-svn subversion

Now we need to create the svn directory and populate it with a repository

sudo mkdir -p /var/svn/trunk
sudo svnadmin create /var/svn/trunk
sudo chown -R root:www-data /var/svn/trunk
sudo chmod -R 770 /var/svn/trunk

Now we need to simply add the dav-svn site definition, by creating the following file in /etc/apache2/sites-available/svn

NameVirtualHost *:82
<VirtualHost *:82>
        ServerAdmin webmaster@localhost
        ServerName webdav.mydomain.com
        SSLEngine On
        SSLProxyEngine On
        SSLCertificateFile /etc/apache2/webdav.mydomain.com.crt
        SSLCertificateKeyFile /etc/apache2/webdav.mydomain.com.key
        #DocumentRoot /var/svn/
  #Alias /svn/ "/var/svn/"
  <Location /svn>
     DAV svn
     SVNParentPath /var/svn
     AuthType Basic
     AuthUserFile /etc/apache2/webdav/.htaccess
     AuthName "This is but a test"
     require valid-user
  </Location>
</VirtualHost>

Now we enable the site

sudo a2ensite svn

Next we restart apache, as demonstrated previously, and voila. Running something like this should get you a nicely checked out repository. Notice we’re using the username and passwords from the previous tutorial.

svn co --username read-only https://127.0.0.1:82/svn/trunk

Restricting access is left to the reader ;) Once again, any problems, just let me know :D

(via luKas’ shared items in Google Reader)

28 October 2007