Skip to content

fail2ban shorthand wrapper for the usual actions one would take, written in bash

License

Notifications You must be signed in to change notification settings

ivuorinen/f2b

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ivuorinen/f2b

A fail2ban wrapper for easier management and listing of banned IP's in your jails.

Requires fail2ban to be installed and running. Should work on most Linux distributions. Developed against fail2ban version 0.11.2 on Ubuntu 22.04.4 LTS using nvim.

MIT License GitHub file size in bytes

Installation

curl https://raw.githubusercontent.com/ivuorinen/f2b/main/f2b > f2b
chmod +x f2b
./f2b version

Requiements: fail2ban (duh), and few other default tools. awk, cat, date, grep, ls, sed, sort, tail, tr, wc, and zcat should be installed. Those are usually installed by default on most Linux distributions. The script will tell you if something is missing.

If running commands straight from the internet scares you (as it should) you can open the f2b script in your favourite editor (or here in GitHub) and view the source.

I promise I'm not doing anything weird in the script.

Usage

It uses several fail2ban commands to get the information it needs, so it needs to be run as root.

Usage: f2b [command] [options]
 list-jails             List all jails
 status all             Show status of all jails
 status [jail]          Show status of a specific jail
 banned                 Show all banned IP addresses with ban time left
 banned [jail]          Show all banned IP addresses with ban time left in a jail
 ban [ip]               Ban IP address in all jails
 ban [ip] [jail]        Ban IP address in a specific jail
 unban [ip]             Unban IP address in all jails
 unban [ip] [jail]      Unban IP address in a specific jail
 test [ip]              Test if IP address is banned
 logs                   Show fail2ban logs
 logs all [ip]          Show logs for a specific IP address in all jails
 logs [jail]            Show logs for a specific jail
 logs [jail] [ip]       Show logs for a specific jail and IP address
 logs-watch             Watch fail2ban logs
 logs-watch all [ip]    Watch logs for a specific IP address
 logs-watch [jail]      Watch logs for a specific jail
 logs-watch [jail] [ip] Watch logs for a specific jail and IP address
 test-filter [filter]   Test a fail2ban filter
 service start          Start fail2ban
 service stop           Stop fail2ban
 service restart        Restart fail2ban
 help                   Show help
 version                Show version

Authors

License

MIT

About

fail2ban shorthand wrapper for the usual actions one would take, written in bash

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages