Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Fail2ban

Direct answer

Fail2ban parses configured log sources for repeated matching failures and invokes actions such as temporary firewall bans, reducing automated abuse from source addresses without replacing authentication hardening or application security.

When to use this

Use it when configuring, checking or troubleshooting Fail2ban in Linux Security.

First 30 seconds

1. Fail2ban bans IPs after repeated failures (SSH, web).

2. Reduces brute-force noise.

3. Not a replacement for key auth/MFA.

4. Whitelist admin IPs.

5. Uses nftables/iptables actions.

Operational verification

log failures → jail threshold → ban

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common traps

A ban shows matching log events crossed configured thresholds for a source, but it does not show the source is malicious or other addresses/accounts are safe.

Suspicious evidence: wrong log backend, filter no longer matches, proxy address banned, IPv6 gap, firewall action backend mismatch, allowlist too broad, distributed attack bypass or ban mistaken for account protection.

Platform / version applicability
Platform and workload security
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformPlatform and workload security
Scope / prerequisiteUse it when configuring, checking or troubleshooting Fail2ban in Linux Security.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

application authentication event → log/journal source → filter/failregex → counter/find time → ban action/firewall state → expiry/unban → service outcome

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Fail2ban ban ≠ attacker identity or account compromise prevented.
  • Service running ≠ jail reads the correct current log source and applies actions.
  • Configuration file present ≠ parsed, loaded and effective runtime state.
  • One allow/deny result ≠ complete DAC, privilege, LSM, firewall and application outcome.
Key checks
  • fail2ban-client status — jails
  • fail2ban-client status sshd — banned IPs
  • journalctl -u fail2ban --since -1h — actions
ReferenceImportant terms & boundaries2 sections · depth on demand

What this shows and what it does not

A ban shows matching log events crossed configured thresholds for a source, but it does not show the source is malicious or other addresses/accounts are safe.

In depth

Fail2ban scans logs for repeated authentication failures and temporarily bans offending IP addresses with firewall rules. It reduces brute-force noise against SSH, web logins and mail services.

# /etc/fail2ban/jail.local
[sshd]
enabled  = true
maxretry = 5
findtime = 10m
bantime  = 1h
ignoreip = 127.0.0.1/8 10.0.10.0/24
fail2ban-client status sshd
fail2ban-client set sshd unbanip 203.0.113.50

Fail2ban is a useful extra layer, not a primary control: key-only SSH authentication, MFA and restricting SSH to management networks matter more. Distributed attacks from many IPs are not stopped by per-IP bans.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Configuration

# /etc/fail2ban/jail.local
[sshd]
enabled  = true
maxretry = 5
findtime = 10m
bantime  = 1h
ignoreip = 127.0.0.1/8 10.99.0.0/24

Documented example, not captured output. fail2ban-client status sshd shows banned IPs; fail2ban-client set sshd unbanip <ip> unbans. It slows brute force from single IPs but not distributed attacks; key-only SSH and MFA matter more.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docPlatform and workload security current

Authoritative/upstream documentation reviewed for bounded claims in Linux Security → Fail2ban. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.kernel.org/security/ · confidence 94%
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
Fail2Banlog-based banningLinux brute-force ban
Embedded reference data

Quick lookup tables

Linux Security → Fail2ban proof map

Fast scope, effective-state, runtime-evidence and closure boundaries for Linux Security → Fail2ban.

BoundaryEstablishDoes not establish
ScopeExact host, role, build/kernel, identity, workload and expected controlDoes not prove policy receipt or effective runtime state
Effective stateResultant/loaded policy, precedence, mode, labels/rules/keys and active services/kernel controlsConfiguration presence does not prove enforcement
Runtime evidenceCorrelated events/audit, process/token/credential, packet/syscall and workload resultOne event, clean status or allow/deny does not prove complete security
ClosureOriginal allowed/denied workload works, unsafe state is removed and recovery/regression passCommit, restart, block or compliance result alone is not closure
Confirmation

Confirm action

Continue?