Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

abuseipdb-php-nginx-blacklist-create

Build

Creates a blacklist file for use in your Nginx configuration. Please see www.abuseipdb.com for API request limits. The "Free" account allows five requests/day.

**All of the commands listed below require sudo or root privileges.**

NOTES:

Installation

  1. Sign up for an AbuseIPDB account to get your API key: www.abuseipdb.com. The API key used for this script is the "APIv2" key.

  2. Clone or download this repository into your Nginx directory. You must be the root user. On Ubuntu, for example, clone into /etc/nginx/.

  3. cd into abuseipdb-php-nginx-blacklist-create/ directory.

  4. Copy config.dist.php to config.php and insert your key into the define('ABUSE_IP_DB_KEY', ''); block. Set the define('ABUSE_CONFIDENCE_SCORE', 80); to your liking. AbuseIPDB recommends somewhere between 75-100%.

  5. Run the script using sudo or change to the root user and run the script, "php abuseipdb-blacklist-create.php"

  6. At this point you should have a file named "nginx-abuseipdb-blacklist.conf" in the directory. It should contain a list of IP addresses on each line. For example, "deny ##.##.##.##;"

  7. Add the following line near the top of the http section in your nginx.conf file:

    http {
            .....

            ## Block spammers and other unwanted visitors  ##
            include abuseipdb-php-nginx-blacklist-create/nginx-abuseipdb-blacklist.conf;

            ......
  1. Test the Nginx configuration, "sudo nginx -t"

  2. If all is well, reload Nginx. On Ubuntu, "sudo service nginx reload"

Adding Your Own Blacklist IPs

  1. Copy local-blacklist.conf.dist to local-blacklist.conf.

  2. Add your deny lines to local-blacklist.conf. For example, "deny 00.00.00.00;"

  3. Run the abuseipdb-blacklist-create.php file. "php abuseipdb-blacklist-create.php"

Updating the Blacklist

  1. Run the script using sudo or change to the root user and run the script, "php abuseipdb-blacklist-create.php"

  2. Test the Nginx configuration, "sudo nginx -t"

  3. If all is well, reload Nginx. On Ubuntu, "sudo service nginx reload"

Contributing

Please see the CONTRIBUTING.md for more about contributing to this package.

About

Uses PHP to generate an AbuseIpDB blacklist file for use in your Nginx configuration.

Resources

License

Packages

No packages published

Languages