• Stars
    star
    864
  • Rank 52,774 (Top 2 %)
  • Language
    Shell
  • Created over 10 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Block bad, possibly even malicious web crawlers (automated bots) using Nginx

Nginx Bad Bot Blocker

223 (and growing) Nginx rules to block bad bots.

Bad bots are defined as:

  • E-mail harvesters
  • Content scrapers
  • Spam bots
  • Vulnerability scanners
  • Aggressive bots that provide little value
  • Bots linked to viruses or malware
  • Government surveillance bots
  • Chinese search engine Baidu
  • Spamhaus IP list block

Installation

If you have a bizarre or complicated setup, be sure to look everything over before installing. However, for anyone with a fairly straightforward Nginx installation, this should work without any issues.

Step 1.) Clone the Nginx Bad Bot Blocker repository into your Nginx directory.

cd /etc/nginx
git clone https://github.com/mariusv/nginx-badbot-blocker.git

Step 2.) Edit /etc/nginx/nginx.conf and add the following at the end of the http block, before the closing }

##
# Nginx Bad Bot Blocker
##
include nginx-badbot-blocker/blacklist.conf;
include nginx-badbot-blocker/blockips.conf;

Step 3.) Run the following command to verify your Nginx configuration is valid. (Note: You may need to prepend sudo to this command.)

nginx -t

You should get an output that looks something like this:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Step 4.) Reload Nginx and you're all set!

sudo service nginx reload

Further information

Baidu

Unless your website is written in Chinese, you probably don't get any traffic from them. They mostly just waste bandwidth and consume resources.

Bots Are Liars

Bots try to make themselves look like other software by disguising their useragent. Their useragents may look harmless, perfectly legitimate even. For example, "^Java" but according to Project Honeypot, it's actually one of the most dangerous.

Spamhaus IP Block

Block Spamhaus Lasso Drop Spam IP Address. (I'll keep this list updated)

UPDATED 16/01/2018

More Repositories

1

Gray-Hacker-and-PenTesting

C
22
star
2

docker-leanote

Dockerfile for leanote https://github.com/leanote/leanote
Dockerfile
19
star
3

scripts

My daily sysadmin scripts
Perl
7
star
4

nginx-skeleton

Simply generates init scripts and nginx configs from a variety of skeletons.
Python
6
star
5

ansible-magento

Deploy Magento on two Rackspace Cloud servers (1 web + 1 DB)
6
star
6

Backup-script

just an bash script to backup all my files from the servers
4
star
7

Personal

personal stuff
Shell
3
star
8

jekyll-theme

A simple blog theme for jekyll
2
star
9

opentaxii-k8s

Kubernetes deployment for OpenTAXII
2
star
10

nginx-tools

2
star
11

gmail-notify

Watches a gmail account for new emails, displays a libnotify notification on new email (Tested only in Gnome)
Python
2
star
12

rackspace-schedule-images

A small script to schedule images for OpenStack(NextGen) servers on Rackspace
Shell
2
star
13

conky-google-now

Conky theme to look like Google Now
2
star
14

docker-ipvsadm

docker image to run ipvsadm commands on systems like CoreOS
1
star
15

FOSSAds

FOSSAds is a community project to promote free and open source software.
1
star
16

mariusv

My personal website on Jekyll.
JavaScript
1
star
17

ec2-ansible-jenkins

deploy a ec2 instance and provision Jenkins on it using ansible
1
star
18

blog

this is my wordpress template
PHP
1
star
19

dotfiles_old

Vim Script
1
star
20

via

kiosk website for VIA University
JavaScript
1
star
21

mariusv.com

This is the source code for mariusv.com; powered by Jekyll and hosted on Amazon EC2
HTML
1
star
22

php-ini-cleaner

A script that cleans up the php.ini file with security in mind
1
star
23

robofinder

A pathfinder robot that can travel through a maze using 5 different path search algorithms
1
star
24

ansible-solr

Deploy Solr + Jetty + Drupal conf
1
star