Actions

Installation security hints/nl: Difference between revisions

From LimeSurvey Manual

No edit summary
(Updating to match new version of source page)
Line 4: Line 4:
==Algemeen==
==Algemeen==


LimeSurvey vertrouwt op zijn eigen beveiliging, dat standaard geactiveerd is. Echter, de auteurs van de software accepteren geen verantwoordelijkheid voor, en maken geen claims over de veiligheid of geschiktheid van de software. Dat gezegd hebbende zijn we uiteraard zeer benieuwd naar veiligheidslekken. Kom je zoiets tegen, mail ons dan [mailto:info@limesurvey.org info@limesurvey.org] , of open een foutrapport op onze [http://bugs.limesurvey.org bug tracker] (zet deze dan wel graag op privé).
LimeSurvey relies on its own security, which is activated by default. The authors of this software take no responsibility and makes no claims regarding the appropriateness or security level of this software. However, we take security issues very seriously and react quickly. Therefore, if you know of any security problems within LimeSurvey, please let us know either by sending us an email to [mailto:info@limesurvey.org info@limesurvey.org] or by opening a bug report in our [http://bugs.limesurvey.org bug tracker] (please mark it as private).


==Linux bestandsrechten==
==Linux bestandsrechten==


Als je een Linux server gebruikt, bepalen de bestandsrechten mede de veiligheid van de LimeSurvey installatie.
If you are using a Linux server, setting file permissions accordingly is required to secure your LimeSurey installation.


===Linux/*nix bestandsrechten===
===Linux/*nix bestandsrechten===
Line 14: Line 14:
Een Linux/*nix systeem is multiuser. Dat betekent dat er behalve jouw account mogelijk ook andere "gebruikers" actief zijn op het systeem. Deze "gebruikers" moeten de juiste rechten hebben.
Een Linux/*nix systeem is multiuser. Dat betekent dat er behalve jouw account mogelijk ook andere "gebruikers" actief zijn op het systeem. Deze "gebruikers" moeten de juiste rechten hebben.


<div class="simplebox">[[File:help.png]] '''Hint:''' Het instellen van bestandsrechten is bijzonder belangrijk bij configuratiebestanden, omdat hier gevoelige informatie, zoals wachtwoorden instaat.</div>
<div class="simplebox">[[File:help.png]] '''Hint:''' setting file permissions is especially important in order to secure configuration files holding critical data such as passwords.</div>


'''Het 'root'-account geeft altijd toegang tot alle bestanden (ongeacht de toegekende rechten), omdat het de super-admin is,'''
'''Het 'root'-account geeft altijd toegang tot alle bestanden (ongeacht de toegekende rechten), omdat het de super-admin is,'''


De webserver (waar LimeSurvey op draait) is ook zo'n gebruiker. Op Linux is dit waarschijnlijk de 'www','www-data' (op Debian/Ubuntu), 'apache' of 'nobody'-gebruiker. Ook kan de webhost er voor kiezen om systemen zoals 'suexec' te gebruiken om LimeSurvey-scripts uit te voeren onder jouw account. De webserver moet uiteraard de LimeSurvey-bestanden kunnen lezen. Maar slechts een klein gedeelte van de mappen moet ook schrijfbaar zijn.
The web server (which runs LimeSurvey) is also running under a given identity (user). On Linux, this is usually the 'www', 'www-data' (on Debian/Ubuntu), 'apache' or 'nobody' user. However, some hosting companies use systems (such as suexec) that make it possible to run LimeSurvey scripts with your personal user. Of course, the web server user must have the right to read LimeSurvey files. However, only a small subset of LimeSurvey sub-directories must be writable by the web server user.


<div class="simplebox">[[File:help.png]] '''Hint''':  
<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>
Het is zeer nuttig om de schrijfrechten voor de webservergebruiker in te trekken op bepaalde mappen. Mocht er dan een beveiligingslek in de software ontdekt worden, dan worden de bestanden nog steeds beschermd door de bestandsrechten van het systeem.</div>


===Instellen van bestandsrechten op een Linuxsysteem in eigen beheer===
===Instellen van bestandsrechten op een Linuxsysteem in eigen beheer===


Als je zelf de webserver beheert (omdat je ofwel de hardware bezit of omdat je een (virtuele) server huurt met root-toegang), volg dan deze aanbevelingen:
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.


Je kunt eerst de owner en group van de LimeSurvey-bestanden bepalen om te kunnen beginnen met het instellen van de rechten. Je kunt bijvoorbeeld je eigen gebruikersnaam owner maken en de webservergroep als group gebruiken. Normaal bevat deze webservergroep alleen het webserver-account (en mogelijk nog een account van een beheerder). Bijvoorbeeld: als je gebruikersnaam 'myaccount' is en de webservergebruiker is 'apache' in de 'apache' groep, dan kun je in een shell het volgende commando gebruiken: <code>$ chown -R myaccount:apache limesurvey/</code>. Zet daarna de rechten op de bestanden en mappen.
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: <code>$ chown -R myaccount:apache limesurvey/</code>. Subsequently, set the file and sub-directories permissions.


Om het script te laten werken heeft het schrijfrechten op de volgende mappen nodig:
For the script to work properly, the write access to some directories is needed:
* De /limesurvey/application/config directory heeft ''Read & Write'' nodig voor het opslaan van de applicatie configuratie.
*The /limesurvey/application/config directory requires ''Read & Write'' for saving the application configuration settings
* De ''/limesurvey/tmp'' directory en alle subdirectories er onder voor het importeren en uploaden
*The /limesurvey/tmp directory and its sub-directories are used for imports/uploads and should be set to ''Read & Write'' for your web server
* de ''upload/'' directory en alle subdirectories om media te uploaden
*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''


Voor alle andere directories en bestanden volstaan leesrechten.
<div class="simplebox">[[File:help.png]] '''Hint:''' supposing you've followed the recommendations above on owner/group, these settings can be applied by the following commands:
 
<div class="simplebox">[[File:help.png]] '''Hint:''' Als je het bovenstaand advies over het aanmaken van de eigenaar en groep hebt opgevolgd, stel dan met de volgende commando's de rechten in:


<code>$ chmod -R o-r-w-x limesurvey/</code>
<code>$ chmod -R o-r-w-x limesurvey/</code>
Line 54: Line 52:
Het is lastig om een standaardprocedure te geven voor een webapplicatie op een host, de inrichting kan veel verschillen.
Het is lastig om een standaardprocedure te geven voor een webapplicatie op een host, de inrichting kan veel verschillen.


Zoals bij het systeem in eigen beheer moet het script om te werken schrijfrechten hebben op de volgende mappen:
In the managed server case, the server needs write access to some directories in order for the script to work properly:
* De ''/limesurvey/tmp'' directory en alle subdirectories er onder voor het importeren en uploaden
*The /limesurvey/tmp directory is used for imports/uploads and should be set to ''Read & Write'' for your web server
* de ''upload/'' directory en alle subdirectories om media te uploaden
*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''
Alle andere directories en bestanden kunnen af met alleen leesrechten.


<div class="simplebox">[[File:help.png]] '''Hint:'''
<div class="simplebox">[[File:help.png]] '''Hint:'''
* Afhankelijk van de configuratie van de webserver moet je de rechten met chmod wijzigen naar 755 of 777 om ze beschrijfbaar te maken voor de webserver. Probeer eerst 755: mocht dat niet werken zet ze dan op 777
* 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
* Trek de leesrechten van anderen in door config.php te wijzigen met chmod naar 750. Werkt dat niet, zet dan de waarde op 755</div>
* 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</div>


==Windows bestandsrechten==
==Windows bestandsrechten==
Line 70: Line 67:
==Andere beveiligingszaken==
==Andere beveiligingszaken==


De volgende tips zijn adviezen: LimeSurvey zelf is in het algemeen best veilig zonder deze aanvullende maatregelen. Mocht je een enquête met zeer vertrouwelijke data hebben, dan kan deze aanvulling je helpen:
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 gebruik===
===SSL gebruik===
Line 83: Line 80:
De /application/config/config.php bevat een naam en wachtwoord voor de database server. Dit kan een beveiligingsprobleem zijn, zeker als je een login gebruikt die (te)veel in de database "mag". Mocht deze dus op straat komen te liggen, dan ben je heel misschien meer data kwijt dan alleen de enquêtes. Daarom kun je beter een specifiek account gebruiken dat alleen op de LimeSurvey database rechten heeft.
De /application/config/config.php bevat een naam en wachtwoord voor de database server. Dit kan een beveiligingsprobleem zijn, zeker als je een login gebruikt die (te)veel in de database "mag". Mocht deze dus op straat komen te liggen, dan ben je heel misschien meer data kwijt dan alleen de enquêtes. Daarom kun je beter een specifiek account gebruiken dat alleen op de LimeSurvey database rechten heeft.


Een andere manier om config.php te beveiligen is deze te verplaatsen naar een locatie buiten de webroot, bijvoorbeeld (in het geval van Apache) in de directory boven /htdocs ( de map public_html of de map www). Je gebruikt dan config.php, maar plaatst één verwijzing erin naar het echte bestand. Een voorbeeld is <?php return include("/home/hostfolder/safedata/configreal.php"); ?>. Zet vervolgens in dat bestand de gehele configuratie uit config.php. Dit bestand moet dan niet in een web-map staan. Dan bevat  /application/config/config.php geen database passwords, enz., alleen de bestandsnaam van het bestand met die gegevens.  
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: <code><?php return include("/home/hostfolder/safedata/configreal.php"); ?></code>). 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.  


Hiermee wordt voorkomen dat alle andere bestanden die include /application/config/config.php bevatten gewijzigd moeten worden, omdat config.php ' ze doorstuurt' naar een configuratie-bestand dat op een niet-webmap staat. Je moet wel configreal.php wijzigen door de volgende  parameters te wijzigen in absolute paden:
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:


<syntaxhighlight lang="php" enclose="div">
<syntaxhighlight lang="php" enclose="div">
Line 114: Line 111:
</syntaxhighlight>
</syntaxhighlight>


Gebruik ook niet de naam "admin" als de standaardgebruiker. Ga naar de MySQL database (of diegene waar je LimeSurvey op hebt draaien) en wijzig de naam naar iets als "admin_xyz". Nu wordt het voor vreemden lastiger om te raden welke naam de beheerder heeft. Bedenk dat dit slechts één van de twee waarden is die iemand nodig heeft om binnen te komen: de andere is het wachtwoord. Kies deze dus ook met zorgvuldigheid.
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.

Revision as of 13:30, 19 October 2017

Algemeen

LimeSurvey relies on its own security, which is activated by default. The authors of this software take no responsibility and makes no claims regarding the appropriateness or security level of this software. However, we take security issues very seriously and react quickly. Therefore, if you know of any security problems within LimeSurvey, please let us know either by sending us an email to info@limesurvey.org or by opening a bug report in our bug tracker (please mark it as private).

Linux bestandsrechten

If you are using a Linux server, setting file permissions accordingly is required to secure your LimeSurey installation.

Linux/*nix bestandsrechten

Een Linux/*nix systeem is multiuser. Dat betekent dat er behalve jouw account mogelijk ook andere "gebruikers" actief zijn op het systeem. Deze "gebruikers" moeten de juiste rechten hebben.

Hint: setting file permissions is especially important in order to secure configuration files holding critical data such as passwords.

Het 'root'-account geeft altijd toegang tot alle bestanden (ongeacht de toegekende rechten), omdat het de super-admin is,

The web server (which runs LimeSurvey) is also running under a given identity (user). On Linux, this is usually the 'www', 'www-data' (on Debian/Ubuntu), 'apache' or 'nobody' user. However, some hosting companies use systems (such as suexec) that make it possible to run LimeSurvey scripts with your personal user. Of course, the web server user must have the right to read LimeSurvey files. However, only a small subset of LimeSurvey sub-directories must be writable by the web server user.

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.

Instellen van bestandsrechten op een Linuxsysteem in eigen beheer

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

</syntaxhighlight>

Instellen van bestandsrechten op een beheerde webserver

Het is lastig om een standaardprocedure te geven voor een webapplicatie op een host, de inrichting kan veel verschillen.

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 bestandsrechten

Als je een server op basis van Windows gebruikt, verzeker je er dan van dat alleen de eigenaar van het webserver-proces bestanden in de admin-directory kan schrijven. Op alle andere bestanden volstaan de lees- en uitvoerrechten.

Andere beveiligingszaken

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 gebruik

Voor het gebruik van gevoelige gegevens bevelen we het gebruik van SSL aan. U kunt SSL meestal inschakelen door uw webserver goed in te stellen en een SSQL certificaat te gebruiken. Indien uw SSL heeft ingeschakeld dient u het gebruik van SSL af dwingen in de algemene instellingen van LimeSurvey. U kunt dan ook instellen dat alleen 'secure' cookies gebruikt worden, dit gaat met de respective option in config.php.

Toegang tot het bestand config.php

  U moet het bestand application/config/config.php pas na de eerste werkende installatie aanpassen.


De /application/config/config.php bevat een naam en wachtwoord voor de database server. Dit kan een beveiligingsprobleem zijn, zeker als je een login gebruikt die (te)veel in de database "mag". Mocht deze dus op straat komen te liggen, dan ben je heel misschien meer data kwijt dan alleen de enquêtes. Daarom kun je beter een specifiek account gebruiken dat alleen op de LimeSurvey database rechten heeft.

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'),
   [...]
);

Voorbeeld:

'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.