Installation of mod_evasive on cPanel/WHM

This article is about installing of apache’s mod_evasive on cpanel/whm, to help against DOS and DDOS attack.

Get the latest source of mod_evasive
$ wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz
$ tar zxvf mod_evasive_1.10.1.tar.gz
$ cd mod_evasive

Load mod_evasive into apache
$ /usr/local/apache/bin/apxs -i -a -c mod_evasive20.c

Next, distill the module to apache
$ /usr/local/cpanel/bin/apache_conf_distiller –update

Last, edit apache config file
$ vim /usr/local/apache/conf/httpd.conf

and Add this directive

<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 3600
DOSEmailNotify admin@domain.tld
DOSSystemCommand “sudo /sbin/iptables -A INPUT -s %s -j DROP”
DOSLogDir “/var/log/evasive/”
</IfModule>

Installation of mod_evasive on cPanel/WHM

One thought on “Installation of mod_evasive on cPanel/WHM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s