Christophe CasalegnoAutoimmune warrior, Entrepreneur & Bio/Hacker

brain@127.0.0.1:~$ cat post.html

UnOrBlacklist: blacklisting IPs and networks on Linux with Bash

Archive · Replaced toolUnOrBlacklist has been replaced by SxWall. The scripts and their historical presentation remain available here.

unorblacklist

UnOrBlacklist is a set of two bash shell scripts for use as a "firewall", based on iptables and ip6tables to quickly block / unblock an IP address or an IPv4 or IPv6 network.

It keeps a raw log file with each blacklisted ip so that it can easily be replayed if needed. Although this security mechanism can be bypassed: it also includes a whitelist to keep the user from blacklisting just anything (but it remains possible, however, to blacklist a network that itself contains a whitelisted ip, which poses no problem when it is the admin who uses it).

The corresponding "livecoding" video is available here:

Watch the video on YouTube

I am very likely to make improvements to the file soon, such as the automatic handling of the different IPv4 and IPv6 addresses behind the same hostname, or the addition of whitelist rules in the near future in order to allow delegation directly to clients in my use case.

The regexes I use are probably "crap" and need some optimization (I took them from a script I had just written, perhaps not the best), I will patch them later.

You can download the scripts by clicking the following link: unorblacklist.tar.gz

Enjoy the rest of your weekend, and keep well!
 
—
Christophe Casalegno
You can follow me on: Telegram | Facebook | LinkedIn | X | YouTube | Twitch

Leave a comment

Add a comment
Christophe Casalegno Brain 0verride

Keep it simple
and direct!