# Note : Voici l'emplacement des fichiers de configuration # dav_svn.conf = /etc/apache2/mods-available/dav_svn.conf # authz = /var/svn/MON_DEPOT/conf/authz # svn.passwd = /var/svn/MON_DEPOT/conf/svn.passwd (! non fourni !) # svnserve = /etc/init.d/svnserve
Création d'un dépôt (ici TON_DEPOT)
svnadmin create /var/svn/TON_DEPOT
On édite sa configuration :
nano /var/svn/TON_DEPOT/conf/svnserve.conf
### This file controls the configuration of the svnserve daemon, if you ### use it to allow access to this repository. (If you only allow ### access through http: and/or file: URLs, then this file is ### irrelevant.) ### Visit http://subversion.tigris.org/ for more information. [general] ### These options control access to the repository for unauthenticated ### and authenticated users. Valid values are "write", "read", ### and "none". The sample settings below are the defaults. anon-access = none auth-access = write ### 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 = svn.passwd ### The authz-db option controls the location of the authorization ### rules for path-based access control. Unless you specify a path ### starting with a /, the file's location is relative to the the ### directory containing this file. If you don't specify an ### authz-db, no path-based access control is done. ### Uncomment the line below to use the default authorization file. authz-db = authz ### This option specifies the authentication realm of the repository. ### If two repositories have the same authentication realm, they should ### have the same password database, and vice versa. The default realm ### is repository's uuid. realm = TITRE_DE_TON_DEPOT [sasl] ### This option specifies whether you want to use the Cyrus SASL ### library for authentication. Default is false. ### This section will be ignored if svnserve is not built with Cyrus ### SASL support; to check, run 'svnserve --version' and look for a line ### reading 'Cyrus SASL authentication is available.' # use-sasl = true ### These options specify the desired strength of the security layer ### that you want SASL to provide. 0 means no encryption, 1 means ### integrity-checking only, values larger than 1 are correlated ### to the effective key length for encryption (e.g. 128 means 128-bit ### encryption). The values below are the defaults. # min-encryption = 0 # max-encryption = 256
On crée six utilisateurs pour faire des tests sur les permissions (pour le premier, on utilise l'option -cm (qui crée le fichier), les autres fois l'option -m est suffisante)
htpasswd -cm /var/svn/TON_DEPOT/conf/svn.passwd admin1 htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd admin2 htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd user1 htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd user2 htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd lecteur1 htpasswd -m /var/svn/TON_DEPOT/conf/svn.passwd lecteur2
On configure les permissions du dépôt :
nano /var/svn/TON_DEPOT/conf/authz
### 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 [/] admin1 = rw [/Projet1/code] visiteur1 = r admin2 = rw dev1 = rw [/VieUniversEtLeReste] utilisateur42 = rw
On configure le Path (chemin) du dépôt et on indique quels sont les fichiers authz et passwd grâce au fichier dav_svn.conf :
nano /etc/apache2/mods-available/dav_svn.conf
On ajoute :
<Location /svn_TON_DEPOT> DAV svn SVNPath /var/svn/TON_DEPOT AuthType Basic AuthName "TON_TITRE_DE_DEPOT" AuthUserFile /var/svn/TON_DEPOT/conf/svn.passwd AuthzSVNAccessFile /var/svn/TON_DEPOT/conf/authz Require valid-user </Location>
On donne récursivement accès a tout les dépôts svn pour l'utilisateur svn.
chown -R svn: /var/svn
On donne les droits à apache sur le répertoire pour pouvoir publier le dépôt et accéder aux fichiers de configuration
chown -R www-data:www-data /var/svn/
Le tout en une seule commande :
chown -R svn: /var/svn && chown -R www-data:www-data /var/svn/
On redémarre apache et svn pour qu'ils rechargent leurs configuration et prennent en compte nos changements
/etc/init.d/svnserve restart && /etc/init.d/apache2 restart
Le dépôt est accessibles sur : http://TONDOMAINE/svn_TONDEPOT
Pour se servir de SVN sur windows avec TortoiseSVN : tuto_svn_utilisation_tortoisesvn.pdf