Understand, Learn and Implement.. LINUX / UNIX DEVOPS CONTAINERS OPENSHIFT KUBERNETES DEVOPS TOOLS VIRTUALIZATION STORAGE BACKUP SCRIPTS MONITORING MIDDLEWARE

Tuesday, September 23, 2014

Apache's mod_evasive Installation and configuration CentOS,Debian,Ubuntu

Installation on Debian / Ubuntu

The installation of mod_evasive in a Debian / Ubuntu is identical. Before we go any steps further with the installation, make sure you have an up-to date system by issuing:
# apt-get update 
# apt-get upgrade --show-upgraded
Next, install Apache’s module mod_evasive by executing:
# apt-get install libapache2-mod-evasive -y
Once the installation is finished, execute the following commands to configure Apache to use mod_evasive module:
# cat >> /etc/httpd/conf.d/mod_evasive.conf <
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify your@email.com
DOSLogDir /var/log/apache2/evasive

EOF
# chown www-data: -R /var/log/apache2/
# /etc/init.d/apache2 restart

=> Installation on CentOS 5

First, make sure your CentOS 5  is fully up to date by executing:
# yum update -y
then proceed with adding the EPEL repository to your CentOS 5 so you can install mod_evasive through yum:
# rpm -Uvh ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
Once it is added, protect the base packages from EPEL:
# yum install yum-protectbase.noarch -y
Refresh the repositories using:
# yum update -y
and finally install mod_evasive by executing:
# yum install mod_evasive -y
Then, proceed with configuring Apache to use the mod_evasive module:
# echo -e "### LOAD EVASIVE ###\nLoadModule evasive20_module \
 modules/mod_evasive20.so\n###\n" > /etc/httpd/conf.d/mod_evasive.conf
# cat >> /etc/httpd/conf.d/mod_evasive.conf <
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify your@email.com
DOSLogDir /var/log/httpd/evasive

EOF
# chown apache: -R /var/log/httpd
# /etc/init.d/httpd restart

=> Installation on CentOS 6

Before installing mod_evasive on your CentOS 6 , make sure your operating system is fully up-to date by running:
# yum update -y
then proceed with adding the EPEL repository to your CentOS 6 so you can install mod_evasive through yum:
# rpm -Uvh ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
Once it is added, protect the base packages from EPEL:
# yum install yum-plugin-protectbase.noarch -y
Refresh the repositories using:
# yum update -y
and finally install mod_evasive by executing:
# yum install mod_evasive -y
Then, proceed with configuring Apache to use the mod_evasive module:
# echo -e "### LOAD EVASIVE ###\nLoadModule evasive20_module \
 modules/mod_evasive20.so\n###\n" > /etc/httpd/conf.d/mod_evasive.conf
# cat >> /etc/httpd/conf.d/mod_evasive.conf <
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify your@email.com
DOSLogDir /var/log/httpd/evasive

EOF
# chown apache: -R /var/log/httpd
# /etc/init.d/httpd restart

0 comments:

Post a Comment