DokuWiki è un'applicazione web ed è spesso usata su server pubblici, raggiungibili da Internet. Questo significa un maggior rischio di essere attaccato da gente malintenzionata rispetto, per esempio, ad una applicazione locale sul proprio computer.
DokuWiki è sviluppato avendo in mente la sicurezza. Noi cerchiamo di trovare un equilibrio tra semplicità d'uso e sicurezza, ma favoriamo la sicurezza quando un compromesso soddisfacente non può essere trovato.
Questa pagina fornisce una descrizione su quali aspetti si devono tenere d'occhio per assicurarsi che il proprio wiki è sicuro.
Se si scopre un problema di sicurezza in DokuWiki, siete pregati di notificarcelo. I modi privilegiati per farlo sono:
I primi due metodi dovrebbero essere preferiti ad eccezione che per buchi molto seri, in questo caso rendere i buchi pubblici prima che un aggiustamento sia disponibile potrebbe mettere in pericolo le installazioni di DokuWiki a livello mondiale.
Tutti i precedenti problemi di sicurezza possono essere visti su bugtracking system.
A seconda della gravità del problema scoperto questo sarà risolto in una versione futura (per problemi minimi) o sarà realizzata una versione che aggiusta il buco. In quest'ultimo caso gli utenti saranno informati tramite il meccanismo controllo aggiornamenti.
Si dovrebbe eseguire sempre la più recente versione di DokuWiki dato che non ci sono aggiustamenti di sicurezza rilasciati per le versioni precedenti.
DokuWiki memorizza dati di configurazione e pagine in file. Questi file non devono mai essere accessibili direttamente dal web. Il pacchetto di distribuzione contiene un insieme di file .htaccess che dicono al server web Apache di negare l'accesso a certe cartelle.
Se non si usa il server web Apache o se Apache non usa i file .htaccess è necessario impostare manualmente la sicurezza della propria installazione
Le seguenti cartelle non devono essere accessibili dal web:
dataconfbininc (non è pericolosa quando accessibile, anche se)
Per controllare la necessità di sistemare i permessi si provi ad accedere a http://yourserver.com/dokuwiki/data/pages/wiki/dokuwiki.txt. Non si dovrebbe avere accesso a quel file in questo modo.
Se le proprie cartelle non sono propriamente sicure, si leggano le seguenti sottosezioni sul da farsi.
The simplest way is to enable .htaccess support in your Apache configuration. Please see the Apache .htaccess Tutorial.
DokuWiki already comes with correctly configured .htaccess files. The contents of a .htaccess file to block all access to the directory it is in should be as follows:
order allow,deny deny from all
The other way is to use LocationMatch directive inside VirtualHost definition - it's a little bit more efficient than .htaccess. Just below Directory directive add:
<LocationMatch "/(data|conf|bin|inc)/">
Order allow,deny
Deny from all
Satisfy All
</LocationMatch>
Access to the mentioned directories can be disabled in IIS' configuration settings.
Securing the data directory is most important. If you can not move directories out of the webserver (see below) or can't configure your webserver to deny access (see above), then you should at least make it harder to guess the name of your data directory.
To do so, rename your data directory to something cryptic (eg. a long row of letters and numbers) and reconfigure your savedir option in your conf/local.php file.
The most secure way to avoid any access to the mentioned directories is to move them outside the so called “Document Root” of your Webserver.
WARNING: If you are planning to use the installer, you need to install your wiki executing the install.php script first before you can do this step. If the Move Directories operation is done before, the installer execution will fail.
data directory (and all its contents) out of the document rootdata directory.
For example, if the data directory is moved to /home/yourname/data, add the following line to conf/local.php:
$conf['savedir'] = '/home/yourname/data/';
conf directory (and all its contents) out of the document rootinc directory and set the DOKU_CONF define to the new location of the conf directory.
For example, if the conf directory is moved to /home/yourname/conf, create the following inc/preload.php:
<?php define('DOKU_CONF','/home/yourname/conf/');
The bin directory contains CLI tools. If you don't have shell access on your server anyway you can simply delete the directory and its contents. Otherwise just move it out of the document root. No further configuration needed.
There is currently no easy way to move this directory out of the document root. But since it doesn't contain any sensitive data it isn't worth the effort to try anyway.
DokuWiki contains several configuration settings that have an impact on various security aspect of the installation. Please refer to the documentation of each setting to learn what they do and what suggested settings are.
DokuWiki has lots of community contributed plugins. Plugins add new functionality to DokuWiki by adding new code. This means the code has practically any access to your server. Additionally plugins are distributed separately from DokuWiki in an entirely ad-hoc manner. They are not subject to the same degree of attention and review that the core DokuWiki code base gets. So security precautions are necessary before installing a plugin.
Here are some tips to help you with choosing the plugins you install.
lib directory, which is directly accessible from the outside. Review what a plugin contains and lock down access with .htaccess files as appropriate.See also: How to report security issues in plugins
Here are a few more internal and external pages related to security.