BLACK BURN HACKER. Powered by Blogger.

Real Money Instantly

 

Monday, July 16, 2012

Protect your Apache web server with mod_evasive

0 comments

Mod_evasive is an Apache module that is designed to limit the impact of different types of attacks (likeDDoS, scripted or brute force) on your web site/server. When integrated with iptables, mod_evasive can stand up to even larger attacks.The module detects attacks by creating an internal hash of IP Addresses and URIs, and denying any single IP address from performing any of the following actions:
  • request a page more than the allowed times per second
  • make more than 50 concurrent requests per second on the same child process
  • make a single request while blacklisted
On Debian or Ubuntu systems the installation is as easy as typing:
$ sudo apt-get install libapache2-mod-evasive
Once you do that, the module is already enabled and is protecting your web server. If you need to change the default thresholds, you need to insert the following lines in httpd.conf:
Select AllCode:
<IfModule mod_evasive20.c>
 DOSHashTableSize 3097
 DOSPageCount 2
 DOSSiteCount 50
 DOSPageInterval 1
 DOSSiteInterval 1
 DOSBlockingPeriod 300
 </IfModule>
This following options can tweak the behavior of the module:
  • DOSHashTableSize – The hash table size defines the number of top-level nodes for each child’s hash table. Increasing this number will provide faster performance by decreasing the number of iterations required to get to the record, but consume more memory for table space. You should increase this if you have a busy web server. The value you specify will automatically be tiered up to the next prime number in the primes list (see mod_evasive.c for a list of primes used).
  • DOSPageCount – This is the threshold for the number of requests for the same page (or URI) per page interval. Once the threshold for that interval has been exceeded, the IP address of the client will be added to the blocking list.
  • DOSSiteCount – This is the threshold for the total number of requests for any object by the same client on the same listener per site interval. Once the threshold for that interval has been exceeded, the IP address of the client will be added to the blocking list.
  • DOSPageInterval – The interval for the page count threshold; defaults to 1 second intervals.
  • DOSSiteInterval – The interval for the site count threshhold; defaults to 1 second intervals.
  • DOSBlockingPeriod – The blocking period is the amount of time (in seconds) that a client will be blocked for if they are added to the blocking list. During this time, all subsequent requests from the client will result in a 403 (Forbidden) and the timer being reset (e.g. another 10 seconds). Since the timer is reset for every subsequent request, it is not necessary to have a long blocking period; in the event of a DoS attack, this timer will keep getting reset.
  • DOSEmailNotify – If this value is set, an email will be sent to the address specified whenever an IP address becomes blacklisted. A locking mechanism using /tmp prevents continuous emails from being sent.
  • DOSSystemCommand – If this value is set, the system command specified will be executed whenever an IP address becomes blacklisted. This is designed to enable system calls to ip filter or other tools. A locking mechanism using /tmp prevents continuous system calls. Use %s to denote the IP address of the blacklisted IP.
The last option is one of the most interesting, as it allows you to call iptables and filter the attacker’s IP address. Have fun experimenting with this great Apache module!

©2012, copyright BLACK BURN

0 comments:

Post a Comment

 

7 Years Earning Experience

The Earning Source You Can Trust