Skip to content

A small script to import and ban IPs from a list (like from blocklist.de)

License

Notifications You must be signed in to change notification settings

5nafu/fail2ban-blocklist-importer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fail2ban-blocklist-importer

A small script to import and ban IPs from a list (like from blocklist.de). The list has to be formatted one IP per line, with no additional text.

After fetching the list, the script will add each IP to fail2bans blocklist jail and trigger the actual banning by touching the appropiate log file.

Tested on Debian Wheezy with fail2ban 0.8.6

Configuration

In the script, edit the configuration dict:

  • socket: The socket used by fail2ban
  • url: The URL of the list.
  • logfile: Full path of the Logfile used in the Jail configuration. This file will be crated if it does not exist.
  • loglevel: How much should be logged. Currently used values are: logging.DEBUG, logging.INFO, logging.ERROR

If your fail2ban modules are not in /usr/share/fail2ban, you need to change the import on line 11 according to your needs.

TODO

  • Get Socket and Logfile Configuration from fail2ban
  • handle unblocking of IPs

Credit

This script was inspired by Kapsonfile

About

A small script to import and ban IPs from a list (like from blocklist.de)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages