elix
08-07-2005, 12:24 PM
I found this quite useful for blocking DoS attacks when you're being attacked heavily. You may want to tweak the settings around slightly, I have descriptions of the settings included below. Also note that this will break Frontpage extensions, if you use them.
Here are the commands in order:
wget http://dll.elix.us/mod_dosevasive_1.10.tar.gz
tar zxvf mod_dosevasive_1.10.tar.gz
cd mod_dosevasive
/usr/local/apache/bin/apxs -i -a -c mod_dosevasive.c
If you're using Apache 2, use this command instead of ^:
/usr/local/apache/bin/apxs -i -a -c mod_dosevasive20.c
Add the following to httpd.conf
<IfModule mod_dosevasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSEmailNotify you@email.com
DOSSystemCommand "su - user -c '/sbin/... %s ...'"
</IfModule>
Descriptions:
- DOSHashTableSize: the size of the table of URL and IP combined
- DOSPageCount: the number of same page requests from the same IP during an interval that will cause that IP to be added to the block lt.
- DOSSiteCount: the number of pages requested of a site by the same IP during an interval which will cause the IP to be added to the block lt.
- DOSPageInterval: the interval that the hash table for IPs and URLs erased (in seconds)
- DOSSiteInterval: the intervale that the hash table of IPs erased (in seconds)
- DOSBlockingPeriod: the time the IP blacked (in seconds)
- DOSEmailNotify: can be used to notify by sending an email everytime an IP blocked
- DOSSystemCommand: the command used to execute a command when an IP blocked. It can be used to add a block the user from a firewall or router.
- DOSWhiteLt: can be used to whitelt IPs such as 127.0.0.1
hth :)
Here are the commands in order:
wget http://dll.elix.us/mod_dosevasive_1.10.tar.gz
tar zxvf mod_dosevasive_1.10.tar.gz
cd mod_dosevasive
/usr/local/apache/bin/apxs -i -a -c mod_dosevasive.c
If you're using Apache 2, use this command instead of ^:
/usr/local/apache/bin/apxs -i -a -c mod_dosevasive20.c
Add the following to httpd.conf
<IfModule mod_dosevasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSEmailNotify you@email.com
DOSSystemCommand "su - user -c '/sbin/... %s ...'"
</IfModule>
Descriptions:
- DOSHashTableSize: the size of the table of URL and IP combined
- DOSPageCount: the number of same page requests from the same IP during an interval that will cause that IP to be added to the block lt.
- DOSSiteCount: the number of pages requested of a site by the same IP during an interval which will cause the IP to be added to the block lt.
- DOSPageInterval: the interval that the hash table for IPs and URLs erased (in seconds)
- DOSSiteInterval: the intervale that the hash table of IPs erased (in seconds)
- DOSBlockingPeriod: the time the IP blacked (in seconds)
- DOSEmailNotify: can be used to notify by sending an email everytime an IP blocked
- DOSSystemCommand: the command used to execute a command when an IP blocked. It can be used to add a block the user from a firewall or router.
- DOSWhiteLt: can be used to whitelt IPs such as 127.0.0.1
hth :)