Ubuntu - Fail2Ban - Check the fail2ban status of a specific service

For example, to check the fail2ban status of the sshd service:

sudo fail2ban-client status sshd

returns:

Status for the jail: sshd
|- Filter
|  |- Currently failed:	0
|  |- Total failed:	0
|  `- Journal matches:	_SYSTEMD_UNIT=sshd.service + _COMM=sshd
`- Actions
   |- Currently banned:	0
   |- Total banned:	0
   `- Banned IP list:	

NOTE: Once actual banning starts, the totals and the Banned IP list will get updated.

The actual ban action is controlled by nftables.

  • Check the nft status with:
    sudo nft list ruleset