Use the Mod_Security and Mod_evasive modules to protect Apache (1)
For people in the host hosting industry, or if you host your own server and expose the server to the Internet, protecting the system from attackers is a top priority.
Mod_security and mod_evasive are two important tools that can be used to protect Web servers from brute force attacks or distributed denial of service (DDoS) attacks. Mod_security is an open-source Intrusion Detection and Prevention engine for Web applications. It is seamlessly integrated with Web servers.
As the name suggests, mod_evasive provides the avoidance function. In addition, it can act as a protective umbrella when being attacked to protect Web servers from such threats.
Install Mod_Security and Mod_Evasive to protect Apache
In this article, we will discuss how to install and configure these two modules on RHEL/CentOS 6 and 7, and Fedora 21-15, and make them run together with Apache. In addition, we simulate attacks to verify that the server responds accordingly.
This document assumes that you have installed the LAMP server on the system. If no installation is available, please refer to this Article "Install LAMP architecture in RHEL/CentOS 7" Before proceeding to the next step: http://www.tecmint.com/install-lamp-in-centos-7 /.
If you are running RHEL/CentOS 7 or Fedora 21, you also need to set iptables to the default firewall front-end instead of setting firewalld to the default firewall front-end. We do this to use the same tool in RHEL/CentOS 7/6 and dora 21.
Step 1: Install Iptables firewall on RHEL/CentOS 7 and Fedora 21
To start, stop and disable firewalld:
# Systemctl stop firewalld
# Systemctl disable firewalld
Disable the Firewalld Service
Then, install the iptables-services package before enabling iptables:
# Yum update & yum install iptables-services
# Systemctl enable iptables
# Systemctl start iptables
# Systemctl status iptables
Install Iptables Firewall