Difference between revisions of "Mod evasive"

From Atomicorp Wiki
Jump to: navigation, search
(Troubleshooting)
m (Overview)
 
(15 intermediate revisions by one user not shown)
Line 1: Line 1:
 
 
== Overview ==
 
== Overview ==
  
Mod_evasive is the Denial of Service module used in [ASL]. It is designed to throttle connections when they reach above a specified threshold.
+
Mod_evasive is the Web Denial of Service protection module used in [[ASL]]. It is designed to throttle http and https connections when they exceed specified thresholds.
  
 +
It can be triggered by malicious acticity, and it can also be triggered by very high volumes of non-malicious traffic. The system is pre-tuned for an “average” system, and faster or more powerful systems may trigger this protection sooner as they can deliver more traffic. On those systems, the limits need to be set higher, so we have put together this guide to assist you with the process of increasing the limits for your unique needs.
 +
 +
== Settings ==
 +
 +
=== MODEV_DOSPageCount ===
 +
 +
This is the threshhold for the number of requests for the '''same page''' (or URI) per page interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list.
 +
 +
=== MODEV_DOSSiteCount ===
 +
 +
This is the threshhold for the total number of requests '''for any object''' (unlike MODEV_DOSPageCount which is for the same page) by the same client on the same listener per site interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list.
 +
 +
=== MODEV_DOSPageInterval ===
 +
 +
The interval for the page count threshhold; defaults to 1 second intervals.
 +
 +
 +
=== MODEV_DOSSiteInterval ===
 +
 +
The interval for the site count threshhold; defaults to 1 second intervals.
 +
 +
 +
=== MODEV_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.
  
 
== Troubleshooting ==
 
== Troubleshooting ==
  
<nowiki>[file "mod_evasive20.c"] [line 246] [level 3] client denied by server configuration:</nowiki>
+
=== [file "mod_evasive20.c"] [line 246] [level 3] client denied by server configuration ===
 +
 
 +
hostname mod_evasive[12345]: Blacklisting address 1.2.3.4: possible DoS attack.
 +
 
 +
These messages indicate the threshold has been exceeded. There are two solutions, in order of most secure to least secure.
  
This message indicates the threshold has been exceeded. There are two solutions, in order of more secure to less secure.
+
==== Solution 1:  Increase the thresholds for mod_evasive to be less sensitive ====
  
'''Solution 1:  Increase the thresholds for mod_evasive to be less sensitive to connections.'''
+
Increase the thresholds for mod_evasive to be less sensitive and to allow more connections from a single source over a period of time.'''
  
 
Step 1) Log into the ASL GUI and Select Configure ASL, or edit /etc/asl/config
 
Step 1) Log into the ASL GUI and Select Configure ASL, or edit /etc/asl/config
Line 66: Line 94:
 
   asl -s -f
 
   asl -s -f
  
 +
==== Solution 2:  Whitelist the IPs  ====
  
'''Solution 2:  Disable mod_evasive entirely:'''
+
You can exclude IPs from the DOS protection.  To do that, simply edit /etc/httpd/conf.d/mod_evasive.conf and add the directive DOSWhitelist with the IPs or ranges you want to exclude.  Wildcards can be used on up to the last 3 octets if necessary.  Multiple DOSWhitelist commands may be used in the configuration.  For example:
 +
 
 +
  DOSWhitelist  127.0.0.1
 +
  DOSWhitelist  192.168.0.*
 +
 
 +
 
 +
==== Solution 3:  Disable mod_evasive entirely ====
  
  
Line 85: Line 120:
  
 
   asl -s -f
 
   asl -s -f
 +
 +
= FAQ =
 +
 +
== Is this a rule? ==
 +
 +
No.  This is not a rule.  mod_evasive is an apache module, it sets global limits based on your configuration for the server to protect the server from DOS attacks.
 +
 +
== Can I disable it for a domain or vhost? ==
 +
 +
No.  mod_evasive is an apache module, it sets global limits based on your configuration for the server to protect the server from DOS attacks.  Disabling it for a domain or vhost would make it possible, via a DOS attack, to bring the whole server down.  This modules job is protect your server.
 +
 +
If your server can handle more traffic that the default settings, simply increase the limits as described above.

Latest revision as of 10:53, 11 September 2013

Contents

[edit] Overview

Mod_evasive is the Web Denial of Service protection module used in ASL. It is designed to throttle http and https connections when they exceed specified thresholds.

It can be triggered by malicious acticity, and it can also be triggered by very high volumes of non-malicious traffic. The system is pre-tuned for an “average” system, and faster or more powerful systems may trigger this protection sooner as they can deliver more traffic. On those systems, the limits need to be set higher, so we have put together this guide to assist you with the process of increasing the limits for your unique needs.

[edit] Settings

[edit] MODEV_DOSPageCount

This is the threshhold for the number of requests for the same page (or URI) per page interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list.

[edit] MODEV_DOSSiteCount

This is the threshhold for the total number of requests for any object (unlike MODEV_DOSPageCount which is for the same page) by the same client on the same listener per site interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list.

[edit] MODEV_DOSPageInterval

The interval for the page count threshhold; defaults to 1 second intervals.


[edit] MODEV_DOSSiteInterval

The interval for the site count threshhold; defaults to 1 second intervals.


[edit] MODEV_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.

[edit] Troubleshooting

[edit] [file "mod_evasive20.c"] [line 246] [level 3] client denied by server configuration

hostname mod_evasive[12345]: Blacklisting address 1.2.3.4: possible DoS attack.

These messages indicate the threshold has been exceeded. There are two solutions, in order of most secure to least secure.

[edit] Solution 1: Increase the thresholds for mod_evasive to be less sensitive

Increase the thresholds for mod_evasive to be less sensitive and to allow more connections from a single source over a period of time.

Step 1) Log into the ASL GUI and Select Configure ASL, or edit /etc/asl/config

 vim /etc/asl/config

Step 2) Increase the thresholds in the following fields

 MODEV_DOSPageCount="12"
 MODEV_DOSSiteCount="400"
 MODEV_DOSPageInterval="2"
 MODEV_DOSSiteInterval="2"

NOTE: These vary depending on the environment, we start by doubling the values, and then backing them off.


MODEV_DOSPageCount="12"

This is the threshhold for the number of requests for the same page (or URI) per page interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list.


MODEV_DOSSiteCount="400"

This is the threshhold for the total number of requests for any object by the same client on the same listener per site interval. Once the threshhold for that interval has been exceeded, the IP address of the client will be added to the blocking list.


MODEV_DOSPageInterval="2"

The interval for the page count threshhold; defaults to 1 second intervals.


MODEV_DOSSiteInterval="2"

The interval for the site count threshhold; defaults to 1 second intervals.


MODEV_DOSBlockingPeriod="20"

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.


Step 3) Update the security policy by running the following command as root:

 asl -s -f

[edit] Solution 2: Whitelist the IPs

You can exclude IPs from the DOS protection. To do that, simply edit /etc/httpd/conf.d/mod_evasive.conf and add the directive DOSWhitelist with the IPs or ranges you want to exclude. Wildcards can be used on up to the last 3 octets if necessary. Multiple DOSWhitelist commands may be used in the configuration. For example:

 DOSWhitelist   127.0.0.1
 DOSWhitelist   192.168.0.*


[edit] Solution 3: Disable mod_evasive entirely

Step 1) To disable mod_dosevasive just change this setting in the GUI:

From:

MODEV_ENABLED="yes"

To:

MODEV_ENABLED="no"

Or edit /etc/asl/config.

Step 2) Update the security policy by running the following command as root:

 asl -s -f

[edit] FAQ

[edit] Is this a rule?

No. This is not a rule. mod_evasive is an apache module, it sets global limits based on your configuration for the server to protect the server from DOS attacks.

[edit] Can I disable it for a domain or vhost?

No. mod_evasive is an apache module, it sets global limits based on your configuration for the server to protect the server from DOS attacks. Disabling it for a domain or vhost would make it possible, via a DOS attack, to bring the whole server down. This modules job is protect your server.

If your server can handle more traffic that the default settings, simply increase the limits as described above.

Personal tools