HUB
Sign inSign up
fail2ban logo

dgcosenza/fail2ban

By dgcosenza

•Updated about 3 hours ago

Hardened Fail2ban on Debian 13 (trixie-slim) with nftables/iptables, multi-arch, 0 fixable CVEs.

Image
0

739

dgcosenza/fail2ban repository overview

⁠Fail2ban — Hardened Debian 13 (trixie-slim) Intrusion Prevention

Daily CI OpenSSF Scorecard Workflow Gitleaks Secret Scan Public Content Check OpenSSF Scorecard OpenSSF Best Practices

Trivy + Grype: 0 Fixable CVEs Signed: Cosign OIDC SLSA Build L3 SBOM: SPDX + CycloneDX Base OS Architectures Healthcheck: CI Verified Renovate Enabled Dependabot Enabled Daily Rebuilds

Latest Release Release Date Last Commit Docker Pulls Docker Image Size Registries: Docker Hub + GHCR Packaging License: MIT Upstream License GitHub Issues FNX Labs Catalog

A hardened, multi-arch Fail2ban container built on Debian 13 (trixie-slim) from SHA-256-verified official fail2ban/fail2ban releases — maintained by Daniel G. Cosenza from FNX Labs.

⁠Overview

dgcosenza/fail2ban monitors host or container log files and enforces dynamic nftables or iptables ban rules on the host network namespace. It installs the official SHA-256-verified upstream Fail2ban package with Python 3.13 (python3-systemd, python3-pyinotify, and Fail2ban's built-in asyncore/asynchat compatibility), drops unused tools, runs under tini PID 1, and exposes a live fail2ban-client ping HEALTHCHECK.

⁠Current Versions

ComponentResolved Version
Fail2ban1.1.1
Base OSDebian 13.8 (trixie-slim)
Architectureslinux/amd64, linux/arm64
Uncompressed size (per arch)amd64: 51.6 MB, arm64: 171.8 MB
Last verified build (UTC)2026-11-28
Published multi-arch digestdgcosenza/fail2ban@sha256:900c8dc7a785896b65b179bb4058907306823d9c4c5fa573ce389aebc7604f57
GHCR mirrorghcr.io/dgcosenza/fail2ban@sha256:900c8dc7a785896b65b179bb4058907306823d9c4c5fa573ce389aebc7604f57
Supply chainCosign OIDC signed + SPDX & CycloneDX SBOM attestations + SLSA Build L3 provenance
Security gate (Trivy + Grype on SBOM)0 fixable findings of any severity (24 upstream-unfixed)

⁠Supported Tags

TagPolicyDescription
latestMovingLatest verified multi-arch build passing all CVE, Dive, and smoke gates.
<version> (e.g. 1.1.1)MovingLatest verified build for that upstream release.
<version>-<YYYYMMDD>ImmutableDate-stamped daily security rebuild.
sha-<short>ImmutableGit commit tag from this repository.

⁠Supported Architectures

ArchitectureStatusVerification
linux/amd64Published & natively testedLive daemon + jail smoke test, Dive >= 95%, Trivy + Grype 0 fixable CVEs, Cosign OIDC, SLSA L3.
linux/arm64Published & natively testedLive daemon + jail smoke test, Dive >= 95%, Trivy + Grype 0 fixable CVEs, Cosign OIDC, SLSA L3.

⁠Quick Start

Volume ownership note: docker-compose.example.yml defaults to a named Docker volume so non-root runtime permissions (1000:1000) are initialized automatically; if switching to a host bind mount, pre-create the directory owned by 1000:1000 (mkdir -p ./data && chown 1000:1000 ./data) before docker compose up -d.

docker run -d --name fail2ban --network host --restart unless-stopped \
  --cap-drop ALL --cap-add NET_ADMIN --cap-add NET_RAW \
  -v "$(pwd)/data:/data" -v /var/log:/var/log:ro \
  -e F2B_IPTABLES_MODE=nftables \
  dgcosenza/fail2ban:latest

⁠Compose Example

See docker-compose.example.yml⁠.

⁠Configuration

VariableDefaultDescription
F2B_LOG_LEVELINFOFail2ban log level (CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG).
F2B_LOG_TARGETSTDOUTLog destination (STDOUT, STDERR, SYSLOG, or file path).
F2B_DB_PURGE_AGE1dSQLite ban database purge age (/data/db/fail2ban.sqlite3).
F2B_MAX_RETRY5Default failures before ban.
F2B_FIND_TIME10mDefault failure observation window.
F2B_BAN_TIME10mDefault ban duration.
F2B_IPTABLES_CHAINDOCKER-USERDefault firewall chain.
F2B_IPTABLES_MODEnftablesDefault ban backend (nftables or iptables).
TZEtc/UTCContainer timezone.

Volumes: /data (jail.d/, filter.d/, action.d/, db/), plus read-only log mounts (/var/log:ro). Ports: None (runs on host network with NET_ADMIN/NET_RAW to manipulate host firewall rules). PID 1: tini.

⁠Healthcheck

HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
  CMD ["/usr/local/bin/fail2ban-healthcheck"]

Runs fail2ban-client -s /var/run/fail2ban/fail2ban.sock ping and verifies Server replied: pong. Verified on amd64 and arm64; do not disable in Compose.

⁠Upgrade / Migration from crazymax/fail2ban

  1. Mount your existing /data (jail.d/, filter.d/, action.d/, db/) and read-only log directories.
  2. Keep the same F2B_* environment variables and switch the image to dgcosenza/fail2ban@sha256:<digest>.

⁠Supply-Chain Verification

cosign verify \
  --certificate-identity-regexp="^https://github\.com/dgcosenza/fail2ban-docker/\.github/workflows/daily\.yml@refs/heads/main$" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
  ghcr.io/dgcosenza/fail2ban:latest

gh attestation verify oci://ghcr.io/dgcosenza/fail2ban:latest --owner dgcosenza

⁠Security

  • 0 fixable vulnerabilities of any severity: Hard-gated by Trivy (UNKNOWN–CRITICAL, --ignore-unfixed, exit 1) and Grype on Syft SPDX SBOM (--only-fixed --fail-on negligible) on both amd64 and arm64.
  • SHA-256 verified upstream release: Official fail2ban/fail2ban release package verified against exact GitHub release SHA-256 before installation.
  • Minimal capabilities: Drop all capabilities and add only NET_ADMIN + NET_RAW.
  • Report issues via SECURITY.md⁠.

⁠Build Locally

docker buildx build --platform linux/amd64 --load -t dgcosenza/fail2ban:local .
./tests/smoke.sh dgcosenza/fail2ban:local

⁠Update Policy

.github/workflows/daily.yml⁠ runs daily at 05:27 UTC with --no-cache: resolves latest fail2ban/fail2ban release + SHA-256 and debian:13.8-slim digest; runs live jail smoke + Dive + Trivy + Grype gates on amd64 and arm64; publishes identical Cosign-signed SLSA L3 digests to Docker Hub and GHCR (plus optional secondary OCI mirrors); syncs docs & Hub overview; and manages a single ci-failure issue.

⁠Design Decisions

  • Official upstream .deb on Debian 13: Guarantees full compatibility with Python 3.13 (python3-systemd, python3-pyinotify) and clean dpkg/Trivy visibility without unpinned pip installs.
  • nftables default with iptables fallback: Matches modern Debian 13 / Ubuntu 24.04–26.04 kernel netfilter stacks.

⁠License

⁠Credits

Maintained by Daniel G. Cosenza from FNX Labs. Upstream: fail2ban/fail2ban⁠.

Tag summary

Content type

Image

Digest

sha256:900c8dc7a…

Size

49.2 MB

Last updated

about 3 hours ago

docker pull dgcosenza/fail2ban