Difference between revisions of "Mod evasive"
m (→MODEV_DOSPageCount) |
m (→MODEV_DOSSiteCount) |
||
Line 11: | Line 11: | ||
=== MODEV_DOSSiteCount === | === MODEV_DOSSiteCount === | ||
− | 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. | + | 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 === | === MODEV_DOSPageInterval === |
Revision as of 15:14, 17 February 2012
Contents |
Overview
Mod_evasive is the Web Denial of Service module used in ASL. It is designed to throttle http and https connections when they reach above a specified threshold.
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
Example messages:
[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.
Solution 1: 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
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.*
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