Skip to content

Instantly share code, notes, and snippets.

@mklooss
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mklooss/8931300 to your computer and use it in GitHub Desktop.
Save mklooss/8931300 to your computer and use it in GitHub Desktop.
nginx UserAgent Blacklist, so i found this UserAgent on different system.
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
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