Objectivo
Por vezes é mais prático aceder a um repositório svn através do protocolo https, podendo assim ser utilizado um simples browser com cliente svn.
- NOTA:
- A configuração do servidor svn via https depende da instalação prévia de um servidor http com suporte para ligações seguras, como o Apache2 + Ssl.
Instalação
A instalação do pacote libapache2-svn fornece o módulo dav_svn para que o apache posa funcionar com servidor svn via https:
server:~# aptitude install libapache2-svn
Configuração
A configuração deverá ser indicada a URL do repositório, a localização dos repositórios no sistema, e o tipo de acesso permitido.
A configuração é mantida no ficheiro/etc/apache2/mods-available/dav_svn.conf.
# <Location URL> ... </Location>
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
# Note, a literal /svn should NOT exist in your document root.
<Location /svn>
# Uncomment this to enable the repository
DAV svn
# Set this to the path to your repository
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
SVNParentPath /var/lib/svn/repos
# [...]
# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
# [...]
# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
#</LimitExcept>
</Location>
Esta configuração restringe os os acessos apenas a utilizadores autenticados. Opcionalmente, pode-se permitir o acesso anónimo em consulta, abrindo excepções para a operações GET PROPFIND OPTIONS REPORT:
# [...]
# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
# [...]
Em seguida deverão ser definidos os utilizadores e respectivas palavras-passe, que serão guardadas no ficheiro /etc/apache2/dav_svn.passwd. Ao criar o primeiro utilizador, deverá ser criado o ficheiro, o que é conseguido com a opção -c:
server:~# htpasswd -c /etc/apache2/dav_svn.passwd fribeiro
New password:
Re-type new password:
Adding password for user fribeiro
Para adicionar os utilizadores seguintes:
server:~# htpasswd /etc/apache2/dav_svn.passwd user2
New password:
Re-type new password:
Adding password for user user2
Verificação
Num browser inserir a URL de um repositório:
O repositório estará também acessível a partir de um cliente svn que suporte o protocolo https, como por exemplo o TortoiseSVN.
Referências:
- Subversion (http://subversion.tigris.org/)
- Version Control with Subversion: httpd, the Apache HTTP Server (http://svnbook.red-bean.com/en/1.5/svn.serverconfig.httpd.html)
- TortoiseSVN (http://tortoisesvn.tigris.org/)




















