Fail2ban: Difference between revisions

From My Mnemonic Rhyme
Jump to navigation Jump to search
(Created page with "stolen from: https://serverfault.com/questions/841183/how-to-show-all-banned-ip-with-fail2ban <code># fail2ban-client</code> has some useful commands. <code>fail2ban-client start # Starts the Fail2ban server and jails. fail2ban-client reload # Reloads Fail2ban’s configuration files. fail2ban-client reload JAIL # Replaces JAIL with the name of a Fail2ban jail; this will reload the jail. fail2ban-client stop # Terminates the server. fail2ban-clien...")
 
No edit summary
 
Line 2: Line 2:


<code># fail2ban-client</code> has some useful commands.
<code># fail2ban-client</code> has some useful commands.
  <code>fail2ban-client start      # Starts the Fail2ban server and jails.
  <fail2ban-client start      # Starts the Fail2ban server and jails.
  fail2ban-client reload      # Reloads Fail2ban’s configuration files.
  fail2ban-client reload      # Reloads Fail2ban’s configuration files.
  fail2ban-client reload JAIL # Replaces JAIL with the name of a Fail2ban jail; this will reload the jail.
  fail2ban-client reload JAIL # Replaces JAIL with the name of a Fail2ban jail; this will reload the jail.
Line 11: Line 11:


Somebody clever posted this (I don't remember where, not mine) to list all jails in one go:
Somebody clever posted this (I don't remember where, not mine) to list all jails in one go:
  <code>fail2ban-client status | sed -n 's/,//g;s/.*Jail list://p' | xargs -n1 fail2ban-client status</code>
  <code>sudo fail2ban-client status | sed -n 's/,//g;s/.*Jail list://p' | xargs -n1 sudo fail2ban-client status</code>

Latest revision as of 20:38, 25 November 2023

stolen from: https://serverfault.com/questions/841183/how-to-show-all-banned-ip-with-fail2ban

# fail2ban-client has some useful commands.

<fail2ban-client start       # Starts the Fail2ban server and jails.
fail2ban-client reload      # Reloads Fail2ban’s configuration files.
fail2ban-client reload JAIL # Replaces JAIL with the name of a Fail2ban jail; this will reload the jail.
fail2ban-client stop        # Terminates the server.
fail2ban-client status      # Will show the status of the server, and enable jails.
fail2ban-client status JAIL # Will show the status of the jail, including any currently-banned IPs.

See them all at https://www.fail2ban.org/wiki/index.php/Commands

Somebody clever posted this (I don't remember where, not mine) to list all jails in one go:

sudo fail2ban-client status | sed -n 's/,//g;s/.*Jail list://p' | xargs -n1 sudo fail2ban-client status