Open source · Apache-2.0 · Use at own risk

See who fail2ban is keeping out.

A lightweight web dashboard for fail2ban that asks fail2ban itself, straight through its control socket, instead of parsing log files. You get your jails and banned addresses at a glance, plus Prometheus metrics if you want them. One binary, no database, no fuss.

Build status Latest release
fail2ban-dashboard mascot: a gopher with a magnifying glass and a clipboard of banned IPs

Straight from the source, not from the logs

fail2ban-dashboard connects to the same Unix socket that fail2ban-client uses and asks the fail2ban server directly.

Log parsing

  • Needs read access to log files and knowledge of where they live
  • Breaks when log formats, rotation or verbosity change
  • Reconstructs state from history and can drift from reality
  • Misses unbans and manual changes made with fail2ban-client

Socket (fail2ban-dashboard)

  • Asks fail2ban for its live state: jails, current and total bans and failures
  • Independent of log paths, formats and rotation
  • Speaks the fail2ban protocol natively in Go, so no Python and no fail2ban-client binary are needed
  • Only needs the socket, which mounts read-only into Docker

What it does

Everything you need to keep an eye on fail2ban, nothing you don't.

Live jail overview

Every jail with current and total banned and failed counts, read live from fail2ban and refreshed automatically.

GeoIP lookup

See where banned addresses come from. GeoIP data is downloaded and cached locally.

Prometheus metrics

Optional /metrics endpoint with per-jail gauges, ready for Grafana.

Authentication

Protect the dashboard with basic auth or log in through any OAuth2 / OIDC provider.

Single binary & Docker

Static Go binary for amd64 and arm64, or a distroless container image on GHCR.

Light & dark

A clean interface that follows your system theme, behind a reverse proxy or not.

Screenshots

Dashboard overview listing jails with banned and failed counts
Overview of all jails
Jail detail view listing banned addresses with country information
Jail detail with banned addresses

Quick start

Docker

The quickest way to run the dashboard. The fail2ban socket is mounted read-only into the container:

docker run --user=root \
  -v /var/run/fail2ban/fail2ban.sock:/var/run/fail2ban/fail2ban.sock:ro \
  -p 3000:3000 \
  ghcr.io/webishdev/fail2ban-dashboard:latest

The root user is necessary because the fail2ban socket is only accessible to root by default. Instead of latest you can pin a version such as v0.11.2.

Standalone binary

Download a release for your platform from the releases page, then run:

sudo ./fail2ban-dashboard

Open http://127.0.0.1:3000/ in your browser.

Compatibility

Tested with these fail2ban versions:

0.11.10.11.21.0.11.0.21.1.01.1.1

For any other version, start with --skip-version-check, otherwise the application refuses to start.

But there is no guarantee, that an unsupported version will work.

Command line

Usage:
  fail2ban-dashboard [flags]
  fail2ban-dashboard [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  serve       Start the fail2ban dashboard server (default)
  version     Print the version number and git hash

Options

Every option can be set as a command line flag, an environment variable or a config file entry.

FlagEnvironment variableDescriptionDefault
-a, --addressF2BD_ADDRESSAddress to serve the dashboard on127.0.0.1:3000
--base-pathF2BD_BASE_PATHBase path of the application/
-c, --cache-dirF2BD_CACHE_DIRDirectory to cache GeoIP dataworking directory
--log-levelF2BD_LOG_LEVELtrace, debug, info, warn, errorinfo
-m, --metricsF2BD_METRICSEnable the Prometheus metrics endpointfalse
--metrics-addressF2BD_METRICS_ADDRESSAddress to serve metrics on127.0.0.1:9100
--refresh-secondsF2BD_REFRESH_SECONDSfail2ban data refresh interval (10–600)30
--scheduled-geoip-downloadF2BD_SCHEDULED_GEOIP_DOWNLOADKeep the GeoIP cache updated even when the dashboard is not accessedtrue
--skip-version-checkF2BD_SKIP_VERSION_CHECKSkip the fail2ban version checkfalse
-s, --socketF2BD_SOCKETPath of the fail2ban socket/var/run/fail2ban/fail2ban.sock
--trust-proxy-headersF2BD_TRUST_PROXY_HEADERSTrust proxy headers like X-Forwarded-Forfalse

Basic authentication

Enable basic auth with --auth-user and/or --auth-password.

  • Only --auth-user given: a password is generated and printed to the logs.
  • Only --auth-password given: the user is named admin.
FlagEnvironment variableDescription
--auth-userF2BD_AUTH_USERUsername for basic auth
--auth-passwordF2BD_AUTH_PASSWORDPassword for basic auth

OAuth2

Log in through any OAuth2 / OpenID Connect provider such as Keycloak. All options without a default are required.

FlagEnvironment variableDescriptionDefault
--oauth2-client-idF2BD_OAUTH2_CLIENT_IDClient identifier–
--oauth2-auth-urlF2BD_OAUTH2_AUTH_URLAuthorization URL–
--oauth2-token-urlF2BD_OAUTH2_TOKEN_URLToken URL–
--oauth2-redirect-urlF2BD_OAUTH2_REDIRECT_URLPublic URL of the dashboard–
--oauth2-timeout-minutesF2BD_OAUTH2_TIMEOUT_MINUTESSession timeout in minutes30

The redirect URL is the address users reach the dashboard on: usually http://127.0.0.1:3000, or e.g. https://fail2ban.example.com behind a reverse proxy.

Example with a local Keycloak at http://localhost:8080 and a demo realm:

./fail2ban-dashboard serve \
  --oauth2-client-id mysecretclient \
  --oauth2-auth-url http://localhost:8080/realms/demo/protocol/openid-connect/auth \
  --oauth2-token-url http://localhost:8080/realms/demo/protocol/openid-connect/token \
  --oauth2-redirect-url http://localhost:3000
OAuth2 login screen of fail2ban-dashboard

Config file

Any format supported by viper works (TOML, YAML, JSON, …). The file is looked up in:

  • the current working directory
  • ~/.config/fail2ban-dashboard/
  • /etc/fail2ban-dashboard/

Keys match the flag names. For example /etc/fail2ban-dashboard/config.toml:

address   = "127.0.0.1:4000"
socket    = "/var/run/fail2ban/fail2ban.sock"
log-level = "info"
metrics   = true

Metrics

Start with -m and metrics are served at http://127.0.0.1:9100/metrics. Change the address with --metrics-address.

MetricLabelsDescription
f2b_banned_total–Total number of banned addresses
f2b_jail_count–Number of jails
f2b_jail_banned_currentjailCurrently banned IPs per jail
f2b_jail_banned_totaljailTotal banned IPs per jail
f2b_jail_failed_currentjailCurrently failed IPs per jail
f2b_jail_failed_totaljailTotal failed IPs per jail
fail2ban_dashboard_infoversion, fail2ban_versionBuild information
# HELP f2b_jail_banned_current Amount of banned IPs currently in jail
# TYPE f2b_jail_banned_current gauge
f2b_jail_banned_current{jail="postfix"} 13
f2b_jail_banned_current{jail="sshd"} 33

Building from source

Requires the Go version from go.mod and make.

make build-all                      # Linux amd64 + arm64
make build-intel VERSION=v1.0.0     # Linux amd64 with version
make build GOOS=darwin GOARCH=arm64 # any GOOS/GOARCH
make help                           # list all targets