Indice
Sicurezza
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.
Rapporti e notifiche
Se si scopre un problema di sicurezza in DokuWiki, siete pregati di notificarcelo. I modi privilegiati per farlo sono:
- Inviare un bug report
- Spedire una email alla mailinglist
- Spedire una email privata a andi [at] splitbrain [dot] org
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.
Sicurezza Accesso Web
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:
data
conf
bin
inc
(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.
Deny Directory Access in Apache
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>
Deny Directory Access in IIS
Access to the mentioned directories can be disabled in IIS' configuration settings.
- Open the configuration tool: Start → Settings → Control Panel → Administrative Tools → Internet Information Services
- Navigate to the directory you want to protect: Local Computer → Web Sites → Default Web Site → path to directory
- Right-Click the folder and chose Properties → Directory Security → IP address and domain name restrictions → Edit…
- Choose “By default, all computers will be: Denied access”
Rename data Directory
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.
Move Directories out of DocRoot
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
- Move the
data
directory (and all its contents) out of the document root - Edit the savedir setting to point to the new location of the
data
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
- Move the
conf
directory (and all its contents) out of the document root - Create a file named preload.php inside the
inc
directory and set theDOKU_CONF
define to the new location of theconf
directory.
For example, if the conf
directory is moved to /home/yourname/conf
, create the following inc/preload.php
:
- inc/preload.php
<?php define('DOKU_CONF','/home/yourname/conf/');
bin Directory
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.
inc Directory
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 Configuration Settings
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.
- allowdebug – disabling debugging output to avoid system information leakage
- fmode, dmode – set the file permissions of DokuWiki created files, also read info on setting up permissions
- fetchsize – configure caching of external data
- fullpath – showing full path names for pages
- usewordblock – prevent spam through a blacklist
- mailguard – avoid mail address harvesting robots
- iexssprotect – protect against a XSS problem within Internet Explorer
- htmlok – enable HTML
- phpok – enable PHP
- hidepages – hide certain pages from indexes and search
- safemodehack – work around safe mode restrictions
Plugin Security
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.
- If you can, review the plugin source code yourself, before installing it.
- If in doubt, ask on the mailing list.
- Plugins are installed under the DokuWiki
lib
directory, which is directly accessible from the outside. Review what a plugin contains and lock down access with .htaccess files as appropriate. - Plugins are authored by developers not directly related to the DokuWiki project - they may be inexperienced, have malicious intent or may host the plugin source code on a server that has been compromised. Be careful whom you trust!
- Review the plugin page for mentioned security warnings and upgrade the plugin when new releases become available.
See also: How to report security issues in plugins
Additional Reading
Here are a few more internal and external pages related to security.