Last active
April 27, 2018 16:16
-
-
Save pepoviola/41b4cb1f0dca0fd4d489 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# based on: http://knowledgevoid.com/blog/2012/01/13/logging-the-correct-ip-address-using-apache-2-2-x-and-amazons-elastic-load-balancer/ | |
# mod_evasive based on | |
# https://www.linode.com/docs/websites/apache-tips-and-tricks/modevasive-on-apache | |
# update cloudflare download link | |
# make sure you're root | |
sudo -i | |
wget https://raw.github.com/cloudflare/mod_cloudflare/master/mod_cloudflare.c | |
apt-get install apache2-prefork-dev # or apache2-threaded-dev | |
apxs2 -ci mod_cloudflare.c | |
tee /etc/apache2/mods-available/cloudflare.load <<EOF | |
LoadModule cloudflare_module /usr/lib/apache2/modules/mod_cloudflare.so | |
EOF | |
tee /etc/apache2/mods-available/cloudflare.conf <<EOF | |
CloudFlareRemoteIPHeader X-Forwarded-For | |
CloudFlareRemoteIPTrustedProxy 10.0.0.0/8 | |
EOF | |
a2enmod cloudflare | |
service apache2 reload | |
# mod_evasive | |
apt-get install apache2-utils | |
cd /usr/src | |
wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz | |
tar xzf mod_evasive_1.10.1.tar.gz | |
cd mod_evasive | |
apxs2 -cia mod_evasive20.c | |
# add config | |
<IfModule mod_evasive20.c> | |
DOSHashTableSize 3097 | |
DOSPageCount 2 | |
DOSSiteCount 50 | |
DOSPageInterval 1 | |
DOSSiteInterval 1 | |
DOSBlockingPeriod 60 | |
DOSEmailNotify <[email protected]> | |
</IfModule> | |
/etc/init.d/apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently this script will not work since mod_evasive is under CloudFlare giving you a 503
Do you know how to skip the 503 and avoid the manual download?
I try with this command but without luck: