linux:securingsubversion
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| linux:securingsubversion [2011/12/31 15:01] – rlunaro | linux:securingsubversion [2022/12/02 21:02] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Securing Subversion ====== | ||
| + | |||
| + | **Nota del autor:** Este documento es bastante antiguo (2003?) y supongo que algunas | ||
| + | de las directices que aquí se dan ya se han incorporado a las mayores distribuciones. | ||
| + | Por no decir que seguramente habrá guias mejores (incluso libros) editados al respecto. | ||
| + | |||
| + | Hecho este '' | ||
| + | |||
| + | Pasos para crear un repositorio seguro: | ||
| + | |||
| + | Por defecto, seremos paranoicos con los permisos y la seguridad: | ||
| + | |||
| + | - establecer un path seguro | ||
| + | - umask 022 | ||
| + | |||
| + | Crear un grupo " | ||
| + | |||
| + | < | ||
| + | groupadd svn | ||
| + | </ | ||
| + | |||
| + | Crear un usuario " | ||
| + | el propietario del repositorio: | ||
| + | |||
| + | < | ||
| + | useradd -c ' | ||
| + | </ | ||
| + | |||
| + | Los comandos de subversion, que se ejecuten únicamente por el | ||
| + | usuario svn y el grupo svn: | ||
| + | |||
| + | < | ||
| + | chupete:~# chgrp svn / | ||
| + | chupete:~# chmod 550 / | ||
| + | # el comando " | ||
| + | # a que todos los usuarios deberán tener acceso al mismo (por si quieren | ||
| + | # utilizar Subversion como cliente) | ||
| + | chupete:~# chmod 555 / | ||
| + | chupete:~# ls -la / | ||
| + | -r-xr-xr-x | ||
| + | -r-xr-x--- | ||
| + | -r-xr-x--- | ||
| + | -r-xr-x--- | ||
| + | -r-xr-x--- | ||
| + | -r-xr-x--- | ||
| + | </ | ||
| + | |||
| + | Aquí puede ser un buen momento para preguntar al usuario | ||
| + | qué cuentas del sistema podrán ejecutar los comandos de svn | ||
| + | y los añadiremos al grupo " | ||
| + | |||
| + | < | ||
| + | chupete:/ | ||
| + | chupete:/ | ||
| + | </ | ||
| + | |||
| + | Aquí crearemos el directorio donde se alojará el repositorio. | ||
| + | El directorio lo creará el usuario que ejecuta este script y luego | ||
| + | cambiará los permisos para el usuario svn: | ||
| + | |||
| + | Haremos '' | ||
| + | |||
| + | < | ||
| + | umask 002 | ||
| + | svnadmin create /var/svn | ||
| + | </ | ||
| + | |||
| + | Luego, pondremos los permisos de la siguiente forma (comprobar | ||
| + | si esto es realmente necesario): | ||
| + | |||
| + | < | ||
| + | chonw svn:svn /var/svn * -R | ||
| + | chmod 775 / | ||
| + | chmod 600 / | ||
| + | chmod 600 / | ||
| + | chmod 775 / | ||
| + | chmod 2775 /var/svn/db | ||
| + | chmod 2775 / | ||
| + | chmod 2775 / | ||
| + | chmod 664 / | ||
| + | chmod 2775 / | ||
| + | chmod 664 / | ||
| + | chmod 664 / | ||
| + | chmod 664 / | ||
| + | chmod 664 / | ||
| + | chmod 664 / | ||
| + | chmod 775 / | ||
| + | chmod 644 / | ||
| + | chmod 775 / | ||
| + | chmod 664 / | ||
| + | chmod 444 / | ||
| + | chmod 775 /var/svn/ | ||
| + | </ | ||
| + | |||
| + | **Configuración del acceso remoto al repositorio** | ||
| + | |||
| + | Para el caso de ejecutar svnserve desde el superdemonio de internet, | ||
| + | haremos: | ||
| + | |||
| + | < | ||
| + | chupete:~# joe / | ||
| + | [....] | ||
| + | mysql | ||
| + | mysql | ||
| + | svn | ||
| + | svn | ||
| + | rfe | ||
| + | rfe | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | chupete:/ | ||
| + | # Subversion | ||
| + | service svn | ||
| + | { | ||
| + | socket_type | ||
| + | protocol | ||
| + | wait = no | ||
| + | user = svn | ||
| + | group = svn | ||
| + | umask = 002 | ||
| + | server | ||
| + | server_args | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | chupete:/ | ||
| + | [general] | ||
| + | ### These options control access to the repository for unauthenticated | ||
| + | ### and authenticated users. | ||
| + | ### and " | ||
| + | anon-access = read | ||
| + | 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 conf directory. | ||
| + | ### Uncomment the line below to use the default password file. | ||
| + | # password-db = passwd | ||
| + | ### 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. | ||
| + | ### is repository' | ||
| + | realm = Project TAS repository | ||
| + | </ | ||
| + | |||
| + | También es necesario configurar adecuadamente el fichero '' | ||
| + | encuentra en el mismo directorio: | ||
| + | |||
| + | < | ||
| + | chupete:/ | ||
| + | ### The name and password for each user follow, one account per line. | ||
| + | |||
| + | [users] | ||
| + | rluna=pepinillo | ||
| + | </ | ||
| + | |||
| + | Finalmente, haremos las siguientes pruebas en el sistema para verificar | ||
| + | que el cambio de permisos ha funcionado: | ||
| + | |||
| + | - un usuario que no pertenezca al grupo " | ||
| + | - un usuario que sí pertenezca al grupo " | ||
| + | - con el repositorio que hemos creado anteriormente, | ||
| + | - a través del super-demonio de internet, haremos un checkout | ||
| + | |||
