modernleft-docs/Applications/fail2ban-manager
2025-01-15 21:00:12 -05:00
..
plugins refactor 2025-01-15 20:58:22 -05:00
fail2ban-manager.md refactor 2025-01-15 20:58:22 -05:00
README.md migrated changes 2025-01-15 21:00:12 -05:00

fail2ban-manager

An extensible CLI tool for managing fail2ban.

Introduction

Source Code hosted on my Forgejo instance. Registration is enabled for the public with GitHub via Authentik.

Any issues and feature requests can be submitted here on GitHub.

This tool is designed to make managing fail2ban easier without the need to edit configuration files. It is designed to be extensible via plugins, and easy to use.

Working with Jails

Plugins

Cloudflare

Ban an IP address using IP Rules in Cloudflare WAF. Jails are configured create rules in a specific DNS zone. Bans are cached in a database for fail2ban's check action to use.

Notes
Typer generated docs Link
Provided via Officicial SDK

Variable Purpose
CLOUDFLARE_EMAIL Email address for Cloudflare account
CLOUDFLARE_API_TOKEN Token with permissions to manage IP Rules
  1. Enable the Cloudflare plugin
f2bm plugin enable cloudflare
  1. Create an API Token
  2. Get the Zone ID from Cloudflare and create a zone in the database
f2bm cloudflare create-zone 11111111111111111111111111111111 example.com

Plugin: Hetzner

Whitelist ip addresses in the Hetzner cloud firewall, and bulk whitelist Cloudflare IP addresses.

Notes
Typer generated docs Link
Provided via Officicial SDK

  1. Enable the Hetzner plugin
f2bm plugin enable hetzner
  1. Create an API Token

Plugin: Telegram

Send a message to a Telegram chat. Custom messages per-jail are supported as well as seperate groups for each jail.

Notes
Typer generated docs Link
Provided via Rest API

Credits

  • Typer, build great CLIs. Easy to code. Based on Python type hints.

  • Rich is a Python library for rich text and beautiful formatting in the terminal.

  • envoyer Stupid simple notifications library. (My Project)