Securing Subversion (SVN) Under HTTPS with Apache

This configuration is used to set up a svn repository under https for apache.

Contents of vhost file

<VirtualHost *:443>
    ServerAdmin admin@example.com
    ServerName svn.example.com

    SSLEngine on
    SSLCertificateFile /websites/_certs/example.com.crt
    SSLCertificateKeyFile /websites/_certs/example.com.key

    <Location />
        SSLRequireSSL
        DAV svn
        #SVNPath /repositories/repo_name
        SVNParentPath /repositories

        AuthzSVNAccessFile /repositories/svn-access-policy

        AuthType Basic
        AuthName "Restricted Area"
        AuthUserFile /repositories/.htpasswd
        Require valid-user
    </Location>
</VirtualHost>

<VirtualHost *:80>
    ServerName svn.example.com
    RedirectMatch (.*) https://svn.example.com$1
</VirtualHost>

Contents of /repositories/svn-access-policy

[groups]
administrators = user1, user2

[repo_name:/]
@administrators = rw

Leave a Comment