Last active
August 29, 2015 13:56
-
-
Save mklooss/8931300 to your computer and use it in GitHub Desktop.
nginx UserAgent Blacklist, so i found this UserAgent on different system.
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
for ip in $(grep -ri Baidu /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done | |
for ip in $(grep -ri 200please /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done | |
for ip in $(grep -ri majestic12 /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done | |
for ip in $(grep -ri opensiteexplorer /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done | |
for ip in $(grep -ri seokicks /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done |
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
if ($http_user_agent ~* (Firefox/0.10.1) ) { | |
return 403; | |
} | |
if ($http_user_agent ~* (BLEXBot|Baiduspider|AhrefsBot|Moreoverbot|infohelfer|FairShare|YandexBot|Ezooms|Spider|Illu|seokicks|MJ12bot|200please|MojeekBot|opensiteexplorer) ) { | |
return 403; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment