Configuration SVN

De EjnTricks

Hand-icon.png Votre avis

Nobody voted on this yet

 You need to enable JavaScript to vote

Motpasse-utilisateur.png Utilisation mot de passe

La mise en place d'un mot de passe s'effectue par la configuration du fichier svnserve.conf, qui sera pris en compte que par le daemon svnserve:

#cd /var/opt/svn/study/conf
#sudo vi svnserve.conf

La section suivante doit être modifiée:

### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
# password-db = passwd

En:

### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd


User-group-icon.png Déclaration compte

Enfin, il faut configurer les utilisateurs accédant au serveur en indiquant leur login et mot de passe. Pour cela, il faut ouvrir le fichier passwd, sous le projet, en ajoutant les couple utilisateur / mot de passe:

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret

Dans cet exemple, nous ajoutons l'utilisateur etienne avec le mot de passe password

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret
etienne = password


Icon ACL.png Restriction d'accès

Il est possible de restreindre les accès aux repository de façon assez fine, en fonction du nom d'utilisation / groupe ou des alias. Ceci s'effectue en modifiant le fichier authz, disponible dans le répertoire conf du repository. Dans l'exemple suivant, les droits d'accès sont:

  • Utilisateur etienne, accès en lecture et écriture
  • Compte anonyme, utilisation de *, accès en lecture.
Fichier authz modifié pour donner droit d'accès à un compte.
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[/]
etienne = rw
* =

L'exemple présenté permet de fixer des permissions assez basique sur l'ensemble du dépôt. Il est cependant possible de combiner des instructions afin d'affiner les restrictions. L'exemple ci dessous permet de donner un accès:

  • En lecture à tout le monde sur l'ensemble du dépôt.
  • En écriture au compte etienne sur l'ensemble du dépôt.
  • Aucun sur le "sous répertoire" trunk/private à tout le monde.
  • En écriture sur le "sous répertoire" trunk/private à tout le monde.
Fichier authz modifié pour donner droit d'accès à un compte.
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[/]
etienne = rw
* = r

[/trunk/private]
etienne = rw
* =


Plugin-icon.png Extensions

SVN permet d'exécuter des scripts durant les différentes phases des actions, avant / après commit par exemple. Pour cela, il existe un répertoire hooks dans les dépôts, dont le contenu par défaut est le suivant.

-rw-rwSr-- 1 www-data subversion 2000 2010-09-17 21:59 post-commit.tmpl
-rw-rwSr-- 1 www-data subversion 1663 2010-09-17 21:59 post-lock.tmpl
-rw-rwSr-- 1 www-data subversion 2322 2010-09-17 21:59 post-revprop-change.tmpl
-rw-rwSr-- 1 www-data subversion 1592 2010-09-17 21:59 post-unlock.tmpl
-rw-rwSr-- 1 www-data subversion 3488 2010-09-17 21:59 pre-commit.tmpl
-rw-rwSr-- 1 www-data subversion 2410 2010-09-17 21:59 pre-lock.tmpl
-rw-rwSr-- 1 www-data subversion 2796 2010-09-17 21:59 pre-revprop-change.tmpl
-rw-rwSr-- 1 www-data subversion 2100 2010-09-17 21:59 pre-unlock.tmpl
-rw-rwSr-- 1 www-data subversion 2830 2010-09-17 21:59 start-commit.tmpl

Il existe donc un ensemble de modèle de script qu'il est possible d'activé.

Icon-Configuration-Settings.png externaliser les scripts

Start-icon.png Action pre commit

Icon Personnalisation.png Forcer commentaires au commit et filtre contenu

Start-icon.png Action post commit

Icon-database.png Enrichissement ViewVC

User-group-icon.png Gestion des utilisateurs

Motpasse-utilisateur.png SVN authentification LDAP

Dependencies.gif SVN synchronisation groupes LDAP