Actions

Installation security hints/ro: Difference between revisions

From LimeSurvey Manual

(Created page with "Serverul web (care rulează LimeSurvey) rulează și sub o anumită identitate (utilizator). Pe Linux, acesta este de obicei utilizatorul „www”, „www-data” (pe Debian/...")
(Created page with "<div class="simplebox">File:help.png '''Sugestie''': este foarte valoros să revocați permisiunea de scriere pentru utilizatorul serverului web în aceste subdirectoare L...")
Line 32: Line 32:
Serverul web (care rulează LimeSurvey) rulează și sub o anumită identitate (utilizator). Pe Linux, acesta este de obicei utilizatorul „www”, „www-data” (pe Debian/Ubuntu), „apache” sau „nimeni”. Cu toate acestea, unele companii de găzduire folosesc sisteme (cum ar fi suexec) care fac posibilă rularea scripturilor LimeSurvey cu utilizatorul personal. Desigur, utilizatorul serverului web trebuie să aibă dreptul de a citi fișierele LimeSurvey. Cu toate acestea, doar un mic subset de subdirectoare LimeSurvey trebuie să poată fi scris de către utilizatorul serverului web.
Serverul web (care rulează LimeSurvey) rulează și sub o anumită identitate (utilizator). Pe Linux, acesta este de obicei utilizatorul „www”, „www-data” (pe Debian/Ubuntu), „apache” sau „nimeni”. Cu toate acestea, unele companii de găzduire folosesc sisteme (cum ar fi suexec) care fac posibilă rularea scripturilor LimeSurvey cu utilizatorul personal. Desigur, utilizatorul serverului web trebuie să aibă dreptul de a citi fișierele LimeSurvey. Cu toate acestea, doar un mic subset de subdirectoare LimeSurvey trebuie să poată fi scris de către utilizatorul serverului web.


<div class="simplebox">[[File:help.png]] '''Hint''': it is very valuable to revoke write permission for the web server user to these LimeSurvey sub-directories that do not require it. Indeed, even if a LimeSurvey vulnerability might be discovered, the main files will still be protected from an illicit modification thanks to the file system permissions.</div>
<div class="simplebox">[[File:help.png]] '''Sugestie''': este foarte valoros să revocați permisiunea de scriere pentru utilizatorul serverului web în aceste subdirectoare LimeSurvey care nu o necesită. Într-adevăr, chiar dacă ar putea fi descoperită o vulnerabilitate LimeSurvey, fișierele principale vor fi totuși protejate de o modificare ilegală datorită permisiunilor sistemului de fișiere.</div>


===Setting file permissions on a self-managed Linux system===
===Setarea permisiunilor de fișiere pe un sistem Linux autogestionat===


If you're managing your web server and operating system configuration (you are the owner of the physical server or are renting a virtual server on which you have root access), you may consider the following recommendations from below.
If you're managing your web server and operating system configuration (you are the owner of the physical server or are renting a virtual server on which you have root access), you may consider the following recommendations from below.

Revision as of 08:58, 3 November 2023

General

LimeSurvey se bazează pe propria sa securitate, care este activată implicit. Autorii acestui software nu își asumă nicio responsabilitate și nu fac pretenții cu privire la caracterul adecvat sau nivelul de securitate al acestui software. Cu toate acestea, luăm problemele de securitate foarte în serios și reacționăm rapid. Prin urmare, dacă cunoașteți probleme de securitate în cadrul LimeSurvey, vă rugăm să ne anunțați fie trimițându-ne un e-mail la info@limesurvey.org, fie deschizând un raport de eroare în [http:// bugs.limesurvey.org bug tracker] (vă rugăm să îl marcați ca privat).

Restricție server web

Dacă utilizați apache, LimeSurvey include fișiere htaccess diferite pentru restricții. verificați că ați inclus htaccess cu AllowOverride .

Cu alt server web sau dacă doriți să utilizați AllowOverride None : trebuie

  • (opțiune) dezactivați accesul la toate fișierele din aplicație, protejate, cadru și teme/*/views
  • dezactivați accesul la fișierele încărcate de către utilizator /upload/surveys/.*/fu_[a-z0-9]
  • (opțiune) dezactivează accesul la fișierul executabil din directorul de încărcare

Puteți găsi o mostră pentru nginx pe General FAQ

Permisiunile fișierelor Linux

Dacă utilizați un server Linux, setarea permisiunilor de fișiere în consecință este necesară pentru a vă securiza instalarea LimeSurey.

Informații de bază despre permisiunile pentru fișierele Linux/*nix

Un sistem de operare Linux/*nix este multi-utilizator. Aceasta înseamnă că, în afară de contul personal, pot exista și alte conturi de utilizator în sistem și ar trebui să aveți grijă de ce permisiuni le acordați altor utilizatori.

Sugestie: setarea permisiunilor fișierelor este deosebit de importantă pentru a securiza fișierele de configurare care conțin date critice, cum ar fi parolele.

Rețineți că contul „rădăcină” va primi întotdeauna permisiunea de a vă accesa fișierele (indiferent de permisiunile de fișiere pe care le setați), deoarece este utilizatorul super-administrator.

Serverul web (care rulează LimeSurvey) rulează și sub o anumită identitate (utilizator). Pe Linux, acesta este de obicei utilizatorul „www”, „www-data” (pe Debian/Ubuntu), „apache” sau „nimeni”. Cu toate acestea, unele companii de găzduire folosesc sisteme (cum ar fi suexec) care fac posibilă rularea scripturilor LimeSurvey cu utilizatorul personal. Desigur, utilizatorul serverului web trebuie să aibă dreptul de a citi fișierele LimeSurvey. Cu toate acestea, doar un mic subset de subdirectoare LimeSurvey trebuie să poată fi scris de către utilizatorul serverului web.

Sugestie: este foarte valoros să revocați permisiunea de scriere pentru utilizatorul serverului web în aceste subdirectoare LimeSurvey care nu o necesită. Într-adevăr, chiar dacă ar putea fi descoperită o vulnerabilitate LimeSurvey, fișierele principale vor fi totuși protejate de o modificare ilegală datorită permisiunilor sistemului de fișiere.

Setarea permisiunilor de fișiere pe un sistem Linux autogestionat

If you're managing your web server and operating system configuration (you are the owner of the physical server or are renting a virtual server on which you have root access), you may consider the following recommendations from below.

You can first set the owner and group of your LimeSurvey files so that it will ease the file permissions setup. A possible strategy is to set the owner of the LimeSurvey files to your personal username, and the group of the LimeSurvey files to the web server group. Usually, this web server group only contains the web server account (and possibly another webmaster account). For instance, if your username is 'myaccount' and the webserver user is 'apache' in the 'apache' group, then, from a shell access, you can use the following command: $ chown -R myaccount:apache limesurvey/. Subsequently, set the file and sub-directories permissions.

For the script to work properly, the write access to some directories is needed:

  • The /limesurvey/application/config directory requires Read & Write for saving the application configuration settings
  • The /limesurvey/tmp directory and its sub-directories are 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 set Read & Write permissions in order to enable pictures and media files upload
  • All other directories and files can be set to Read Only
Hint: supposing you've followed the recommendations above on owner/group, these settings can be applied by the following commands:

$ 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

Setting file permissions on a hosted web server

Giving the difficulty of a standard procedure to secure a web application on a hosted environment, it is rather difficult because hosted environments differ in many ways.

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
Hint:
  • 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

  You must update application/config/config.php only after the first installation is done and it works.


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>