Installation security hints/es: Difference between revisions
From LimeSurvey Manual
Maren.fritz (talk | contribs) Created page with "===Configurar permisos de archivos en un servidor web alojado===" |
Maren.fritz (talk | contribs) Created page with "Dada la dificultad de un procedimiento estándar para proteger una aplicación web en un entorno alojado, es bastante difícil porque los entornos alojados difieren en muchos..." |
||
Line 60: | Line 60: | ||
===Configurar permisos de archivos en un servidor web alojado=== | ===Configurar permisos de archivos en un servidor web alojado=== | ||
Dada la dificultad de un procedimiento estándar para proteger una aplicación web en un entorno alojado, es bastante difícil porque los entornos alojados difieren en muchos aspectos. | |||
In the managed server case, the server needs write access to some directories in order for the script to work properly: | In the managed server case, the server needs write access to some directories in order for the script to work properly: |
Revision as of 10:26, 5 September 2023
Generales
LimeSurvey cuenta con su propia seguridad, que está activada de forma predeterminada. Los autores de este software no asumen ninguna responsabilidad y no hacen ningún reclamo con respecto a la idoneidad o el nivel de seguridad de este software. Sin embargo, nos tomamos muy en serio los problemas de seguridad y reaccionamos rápidamente. Por lo tanto, si conoce algún problema de seguridad dentro de LimeSurvey, háganoslo saber enviándonos un correo electrónico a info@limesurvey.org o abriendo un informe de error en nuestro [http:// rastreador de errores bugs.limesurvey.org] (márquelo como privado).
Restricción del servidor web
Si usa Apache, LimeSurvey incluye un archivo htaccess diferente para restringirlo. verifique que permita incluir htaccess con AllowOverride
.
Con otro servidor web o si desea utilizar AllowOverride None
: debe
- (opción) deshabilitar el acceso a todos los archivos en la aplicación, protegidos, marco y temas/*/views
- deshabilitar el acceso a la carga de archivos por parte del usuario /upload/surveys/.*/fu_[a-z0-9]!N !* (opción) deshabilita el acceso al archivo ejecutable en el directorio de carga
Puede encontrar una muestra de nginx en nuestras Preguntas frecuentes generales
Permisos de archivos de Linux
Si está utilizando un servidor Linux, es necesario configurar los permisos de archivos correspondientes para proteger su instalación de LimeSurey.
Datos básicos sobre los permisos de archivos de Linux/*nix
Un sistema operativo Linux/*nix es multiusuario. Esto significa que, además de su cuenta personal, pueden existir otras cuentas de usuario en el sistema y usted debe tener cuidado con los permisos que otorga a otros usuarios.

Tenga en cuenta que a la cuenta 'root' siempre se le otorgará permiso para acceder a sus archivos (sin importar qué permisos de archivo establezca), ya que es el usuario superadministrador.
El servidor web (que ejecuta LimeSurvey) también se ejecuta bajo una identidad determinada (usuario). En Linux, suele ser el usuario 'www', 'www-data' (en Debian/Ubuntu), 'apache' o 'nadie'. Sin embargo, algunas empresas de alojamiento utilizan sistemas (como suexec) que permiten ejecutar scripts de LimeSurvey con su usuario personal. Por supuesto, el usuario del servidor web debe tener derecho a leer los archivos de LimeSurvey. Sin embargo, el usuario del servidor web sólo debe poder escribir en un pequeño subconjunto de subdirectorios de LimeSurvey.
Configurar permisos de archivos en un sistema Linux autoadministrado
Si está administrando su servidor web y la configuración del sistema operativo (es el propietario del servidor físico o está alquilando un servidor virtual en el que tiene acceso raíz), puede considerar las siguientes recomendaciones.
Primero puede configurar el propietario y el grupo de sus archivos de LimeSurvey para facilitar la configuración de los permisos de los archivos. Una posible estrategia es configurar el propietario de los archivos LimeSurvey con su nombre de usuario personal y el grupo de archivos LimeSurvey con el grupo del servidor web. Normalmente, este grupo de servidores web sólo contiene la cuenta del servidor web (y posiblemente otra cuenta de webmaster). Por ejemplo, si su nombre de usuario es 'micuenta' y el usuario del servidor web es 'apache' en el grupo 'apache', entonces, desde un acceso de shell, puede usar el siguiente comando: $ chown -R myaccount:apache limesurvey/
. Posteriormente, configure los permisos de archivos y subdirectorios.
Para que el script funcione correctamente, se necesita acceso de escritura a algunos directorios:
- El directorio /limesurvey/application/config requiere Leer y escribir para guardar los ajustes de configuración de la aplicación
- El /limesurvey/ ¡El directorio tmp y sus subdirectorios se utilizan para importaciones/cargas y deben configurarse en Leer y escribir para su servidor web
- El directorio/cargar y todos sus subdirectorios también deben tener configurado Leer & Permisos de escritura para permitir la carga de imágenes y archivos multimedia. ¡N!* Todos los demás directorios y archivos se pueden configurar en Solo lectura.
$ chmod -R o-r-w-x limesurvey/
$ chmod -R -w limesurvey/
$ chmod -R 770 limesurvey/application/config
$ chmod -R 770 limesurvey/tmp
$ chmod -R 770 limesurvey/upload
Configurar permisos de archivos en un servidor web alojado
Dada la dificultad de un procedimiento estándar para proteger una aplicación web en un entorno alojado, es bastante difícil porque los entornos alojados difieren en muchos aspectos.
In the managed server case, the server needs write access to some directories in order for the script to work properly:
- The /limesurvey/tmp directory is used for imports/uploads and should be set to Read & Write for your web server
- The upload/directory and all its sub-directories must also have Read & Write for your web server in order to enable pictures and media files upload
- The other directories and files should be set to Read Only

- Depending on your web server configuration, you will have to chmod the rights on the writable folders to 755 or 777 to make it writable for the web server. Try 755 first, if it does not work, 'upgrade' to 777
- You can also try to remove other users' read access to config.php by setting this file's permissions to 750 - if it does not work, 'upgrade' to 755
Windows file permissions
If you are using a Windows server, your should ensure that the admin folder allows the owner of the web server process to write files to this directory, The rest of the files can be set to read-only and execute.
Other security issues
The following are recommendations only. LimeSurvey in general is very safe without these additional measures. If you however collect extremely sensitive data, a little additional security can help:
SSL usage
We generally recommend the usage of SSL for sensitive survey data. You usually enable SSL by configuring your web server correctly and using a SSQL certificate. If you have enabled SSL, you should enforce SSL all the time from the global settings of LimeSurvey. Additionally, you could only set to use 'secure' cookies by editing the respective option in config.php.
The access to the config.php file

The /application/config/config.php file contains a user name and password for your database server. This poses certain security issues, particularly if you are using a login that has high level administrative access to your database. In the event of some error returning the content of this PHP file to a user's browser, your database password and other details could be compromised (however, this is a very unlikely scenario). The best way to minimize risk is to set up a specific login that has specific rights only to your LimeSurvey database.
Another way to secure this information can be to put the information from the /application/config/config.php file in a non-web directory, i.e. for Apache users this is the directory above the htdocs (also known as public_html or www) folder. Basically, you will use config.php, but have one line in it - a line that includes the file with ACTUAL configuration information (ex: <?php return include("/home/hostfolder/safedata/configreal.php"); ?>
). Remove all actual configuration information from /application/config/config.php and paste it into the other file (configreal.php) that is mentioned in the /application/config/config.php file. This other file should be located in a non-web directory. Then, /application/config/config.php will not contain database passwords etc. - just the name of the file that DOES contain the database info.
This avoids having to change all the other files that include /application/config/config.php, since config.php 're-directs them' towards the configuration file that is located in a non-web directory which includes all the real configuration information. However, you will need to edit configreal.php and change the follow parameters to use absolute directory paths to work properly:
'basePath' => dirname(dirname('''FILE''')),
'runtimePath' => dirname(dirname(dirname('''FILE'''))).DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'runtime',
[...]
'urlManager' => array(
[...]
'rules' => require('routes.php'),
[...]
);
Example:
'basePath' => '/var/www/htdocs/limesurvey',
'runtimePath' => '/var/www/htdocs/limesurvey/tmp/runtime',
[...]
'urlManager' => array(
[...]
'rules' => require('/var/www/htdocs/limesurvey/config/routes.php'),
[...]
);
Also, don't use "admin" as the default user. Go to your MySQL database (or the one in which you installed LimeSurvey) and change default user name "admin" to whatever you prefer (e.g. "admin_xyz"). It will now be much harder to guess the administrator's new user name. Remember, this is one of the two variables intruders can use to gain access. The admin password is the other variable. So choose both of them with extreme caution.
Content Security Policy (CSP)
DISCLAIMER - The CSP provided here is an example only and is not meant to used verbatim. It is meant as a starting point and you MUST adapt it to your needs and test it thoroughly.
<IfModule mod_headers.c> Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'self'; frame-ancestors 'self'; upgrade-insecure-requests" "expr=%{CONTENT_TYPE} =~ m#text\/(html|javascript)|application\/pdf|xml#i" </IfModule>