Skip to content

fail2ban

Common parts of every card (states, backoff, Unit and ExecReload, Test config, manual commands) are described in Monitor window.

Detected by systemd units fail2ban or binaries fail2ban-client, fail2ban-server
Read every 5 minutes while the Monitor window shows the tab
Active probe yes, off by default
Test config on demand
Manual commands 1

fail2ban: jails from the configuration (closed list of keys, filtered on the host), the server process and its socket, and with the active probe the jails’ ban counts from fail2ban-client.

The client is run only when the trust check accepts it, and always with an explicit -s <socket> that passed a check of its own (a socket owned by root, or by the session’s account when the server runs as it, every directory and link on the way owned by root or the session’s account and not writable by group or others): the client unpickles the server’s answer, so a socket planted by another account would run its code.

Banned addresses are personal data: the host sends at most 20 per jail (and up to 20 CIDR ranges), the card shows counts until expanded, nothing is kept outside the view.

At the top, in red, when the active probe finds it: ⚠ Banned: the address this SSH session comes from (SSH_CLIENT on the host) is on the ban list of (the address, an equivalent form or a range holding it). Behind NAT or a bastion the address is shared, so the match may not be you.

  • Server: green running with pid and account, orange not running (no fail2ban-server process), or unknown; the version.
  • Socket: path and where it came from; green writable for this account, or orange not writable for this account (uid N; usually root only), does not exist, exists but is not a socket; owner and mode. A socket that fails the check is noted as Not used by the active probe: ….

Jails (server), with the active probe only (otherwise Ban counts need the active probe.): the number of running jails, the method (fail2ban-client banned or status <jail>), and notes for versions older than 0.11.2, unusual jail names, more than 64 jails, an unknown own address.

Column Content
Jail Name; red (your address) when this session’s address is banned there.
Banned now Current bans; orange when above 0.
Banned total Bans since the server started (status <jail> only).
Failed now / total Failures (status <jail> only).
Port, maxretry / findtime / bantime From the configuration of that jail.

Show banned addresses (N of M) under a jail lists up to 20 addresses (plus CIDR ranges). ? = unknown. Not asked (limit of 8 calls): … lists jails left out with the status <jail> method; Partial answer: … in orange when the probe was cut short or an answer went over 4 MiB; Client errors (known messages only; run the command in the terminal for the rest).

Jails (configuration): enabled jails with Port, maxretry, findtime, bantime and Enabled in (the file that enables it), the defaults, orange *No jail is enabled in

*, *Partial: …* and *Not readable by this account: …*; **Show disabled jails (N)** and **Show files read (N)**. Values are shown as written; `?` = a value with other characters, kept on the host.

Runs: fail2ban-client -s <socket> status (jail names) and, on fail2ban 0.11.2 or newer, fail2ban-client -s <socket> banned (banned addresses per jail), each under timeout 10 s, every 5 minutes; older versions (or an answer the filter does not understand): fail2ban-client -s <socket> status <jail> for up to 8 jails, 5 s each. The socket is named explicitly and used only when it is a socket owned by root (or by this account when the server runs as it) with every directory on the way owned by root or this account and not writable by others. Only counts, at most 20 addresses (plus 20 CIDR ranges) per jail and the address this session comes from (SSH_CLIENT) leave the host.

Traces on the host: each call starts a Python process (about 0.2-0.5 s of CPU); the server writes client commands to its log only at loglevel = DEBUG; no access to the socket (usually root only) fails in the client, without an entry on the server, and stops the probe until Retry.

What it does, as the card says: reads the whole configuration directory (fail2ban., jail., filter.d, action.d) and compiles every filter like a start does, then prints whether it is valid; it does not contact the running server, change bans or touch firewall rules (values of action, destemail, token, ignoreip, logpath and similar keys are masked in the output; error lines of the configuration parser without such a key may still quote file content in ‘…’: the full, unmasked output only by running the command in the terminal).

KryoDesk shows these with Copy / Paste to terminal and never runs them.

Label Command What it does
Jails as root sudo fail2ban-client status asks the fail2ban server over its socket (usually root only); KryoDesk never runs sudo

Scroll or pinch to zoom · drag to move · double-click to zoom · Esc or click outside to close