Actions

Beveiligingstips

From LimeSurvey Manual

Revision as of 19:44, 6 September 2017 by Han (talk | contribs)

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 info@limesurvey.org , of open een foutrapport op onze bug tracker (zet deze dan wel graag op privé).

Linux bestandsrechten

Als je een Linux server gebruikt, bepalen de bestandsrechten mede de veiligheid van de LimeSurvey installatie.

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: Het instellen van bestandsrechten is bijzonder belangrijk bij configuratiebestanden, omdat hier gevoelige informatie, zoals wachtwoorden instaat.

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.

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

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:

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/. Then set the file and sub-directories permissions.

Om het script te laten werken heeft het schrijfrechten op de volgende mappen nodig:

  • De /limesurvey/application/config directory requires Read & Write voor opslaan van de applicatie configuratie.
  • De /limesurvey/tmp directory en alle subdirectories er onder voor het importeren en uploaden
  • de upload/ directory en alle subdirectories om media te uploaden

Voor alle andere directories en bestanden volstaan leesrechten.

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:

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

Zoals bij het systeem in eigen beheer moet het script om te werken schrijfrechten hebben op de volgende mappen:

  • De /limesurvey/tmp directory en alle subdirectories er onder voor het importeren en uploaden
  • de upload/ directory en alle subdirectories om media te uploaden

Alle andere directories en bestanden kunnen af met alleen leesrechten.

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
  • Trek de leesrechten van anderen in door config.php te wijzigen met chmod naar 750. Werkt dat niet, zet dan de waarde op 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

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:

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.

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 (please note, that 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 certain 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 that 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 on different database) and change default user name "admin" to whatever you prefer (e.g. "admin_xyz"). It will be now much harder to guess 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 care.