{"id":46889,"date":"2017-11-09T13:00:00","date_gmt":"2017-11-09T19:00:00","guid":{"rendered":"https:\/\/blog.cpanel.com\/?p=46889"},"modified":"2017-11-09T13:00:00","modified_gmt":"2017-11-09T19:00:00","slug":"blocking-attacks-with-easyapache-4s-mod_evasive","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/products\/blocking-attacks-with-easyapache-4s-mod_evasive\/","title":{"rendered":"Blocking attacks with EasyApache 4’s mod_evasive"},"content":{"rendered":"
With the release of EasyApache 4 on Nov 7th, 2017, we now provide the\u00a0 The This module works well for single-server attacks, distributed attacks, and brute-force attacks. If you integrate it with your firewall or IP filters, it can withstand even large attacks.\u00a0For the best protection, you should integrate it with your firewalls and routers.<\/span><\/p>\n If your infrastructure cannot fend off other types of DoS attacks, this module will\u00a0only<\/strong>\u00a0help to the limits of your total bandwidth or server capacity for returning 403 errors.<\/p>\n The\u00a0 The module creates an instance for each listener, ensuring a built-in cleanup mechanism and good scaling. Because of this, it will rarely catch a legitimate request, even if a user repeatedly clicks on reload.<\/p>\n So what do you do if you are the target of an DoS attack? In a DoS attack, an attacker may request a URL from your server as many times as they can in an attempt to cause you trouble. Because of the quantity of requests, your webserver may become unresponsive.<\/p>\n To stop the attack, first install mod_evasive on your server with the following command:<\/p>\n The default configuration provided by cPanel & WHM will block most attacks without any extra configuration changes. The server’s response to those attackers will change to\u00a0 You will now see the following message in your Apache\u00a0 You will also see a message in\u00a0 The\u00a0 If you would like to install mod_evasive, you can either install it in the\u00a0Apache Modules<\/em>\u00a0section of WHM’s\u00a0EasyApache 4<\/a><\/em>\u00a0interface (WHM<\/em>\u00a0>>\u00a0Home<\/em>\u00a0>>\u00a0Software<\/em>\u00a0>>\u00a0EasyApache 4<\/em>), or you can install it on the command line with the\u00a0mod_evasive<\/code>\u00a0Apache module. You can install it either in the EasyApache 4 interface, or with\u00a0
yum install ea-apache24-mod_evasive<\/code>\u00a0on the command line.<\/p>\n
What is mod_evasive?<\/h2>\n
mod_evasive<\/code> Apache module helps to protect your server against\u00a0DoS, DDoS, and brute force attacks. It also acts a detection tool, and you can configure it to communicate with iptables, firewalls, and routers, among other things.<\/p>\n
What does the module do?<\/h3>\n
mod_evasive<\/code>\u00a0Apache module creates an internal, dynamic hash table of IP addresses and URIs, and denies any single IP address that does the following:<\/p>\n
\n
How do I stop an attack?<\/h2>\n
\n\n
\n \n yum\u00a0<\/code>
install<\/code>\u00a0
ea-apache24-mod_evasive<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n
403 Forbidden<\/code>. This means that\u00a0
mod_evasive<\/code>\u00a0detected and blocked the attack before your system processed the request.<\/p>\n
error_log<\/code>\u00a0file:<\/p>\n
\n\n
\n \n Client denied by server configuration<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n
\/var\/log\/messages<\/code>\u00a0that resembles the following example:<\/p>\n
\n\n
\n \n localhost mod_evasive[2635]: Blacklisting address X.X.X.X: possible DoS attack.<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n
mod_evasive<\/code>\u00a0module does\u00a0not<\/strong>\u00a0blacklist clients forever,\u00a0as you can configure the block time<\/span>, but it will block them long enough to put a stop to the attack. Adjust the DOSBlockingPeriod directive in the\u00a0
mod_evasive<\/code>\u00a0configuration file to adjust how long to block those attacks.<\/p>\n
What next?<\/h2>\n
yum install ea-apache24-mod_evasive<\/code>\u00a0command.<\/p>\n