Apache server-status

To the uninitiated, the mod_status output can look like so much gobbledegook, but it’s really quite straightforward. Let’s take a look at some sample output. Apache Server Status for somedomain.com Server Version: Apache/1.3.9 (Unix) PHP/4.0b3 Server Built: Mar 4 2000 17:01:01 The first few lines identify and provide a brief description of your server. The server version information includes an incomplete list of some of the modules compiled into your server. Our example server is running on a Unix system and has been compiled with support for the PHP scripting language. (The level of detail provided by the server version line may be limited by the ServerTokens configuration directive.) Current Time: Thursday, 13-Apr-2000 17:22:36 PDT Restart Time: Thursday, 13-Apr-2000 17:15:26 PDT Parent Server Generation: 14 Server uptime: 7 minutes 10 seconds Total accesses: 42 – Total Traffic: 187 kB CPU… Leggi tuttoApache server-status

Protezione [base] contro DOS

mod_evasive è un altro modulo di Apache in grado di aumentare la sicurezza del sistema proteggendoci da attacchi DOS e D-DOS sulla porta 80. Gli attacchi di tipo DOS e D-DOS (Denial of Services e Distributed Denial of Services) sono attacchi atti a rendere inaccessibili i sistemi a causa di un intenso traffico dati. Grazie a questo modulo, però, riusciamo a prevenire questo tipo di attacco quando viene rivolto ad Apache in quanto il modulo tiene traccia del numero di connessioni provenienti da un determinato IP e, in caso di superamento della soglia, interviene bloccandole. Per installare il modulo su Debian/Ubuntu è sufficiente lanciare il comando: apt-get install libapache2-mod-evasive Quindi creiamo la directory per i log: mkdir -p /var/log/apache2/evasive chown -R www-data:root /var/log/apache2/evasive Ora creiamo un file di configurazione per il modulo: /etc/apache2/conf.d/modevasive.conf <IfModule mod_evasive20.c> DOSHashTableSize 3097 DOSPageCount 5 DOSSiteCount… Leggi tuttoProtezione [base] contro DOS

List tutti i vhost di apache

Ecco uno script perl/bash dove tiro fuori formattati bene tutti i vhost di apache : Modo più verboso : /usr/sbin/apache2ctl −S 2>&1 | perl −ne ‘m@.*port\s+([0−9]+)\s+\w+\s+(\S+)\s+\((.+):.*@ && do { print “$2:$1\n\t$3\n”; $root = qx{grep DocumentRoot $3}; $root =~ s/^\s+//; print “\t$root\n” };’ Modo meno verboso : #!/bin/bash apache2ctl −S 2>&1 | grep −v Syntax | perl −ne ‘m@.*port\s+([0−9]+)\s+\w+\s+(\S+)\s+\((.+):.*@ && do { print “$2:$1\n”;};’

Nascondi informazioni sulla versione Apache e sulla versione PHP

Di default Apache manda la propria versione di build ed informaizoni riguardanti i moduli installati (es: mod_php, mod_perl, mod_ssl) in ogni header http. In questo esempio si vede come con un semplice telnet ho scoperto che sistema operativo ho, quale versione del php installata e quale versione di Apache, e questo non è una buona cosa dal punto di vista della sicurezza. Cosa faccio per disabilitarlo ? Per disabiltiare l’invio di queste informazioni bisogna cambiare due direttive all’interno del file di configurazione di Apache : /etc/apache2/apache2.conf e procedere ad un reload di Apache. Occhio RELOAD… non RESTART. Dopo questo passaggio l’output sarà :