Fail2ban Notes

2018-08-28

Damn, so how do I unban my IP address?

List jails

fail2ban-client status

Show status of sshd jail

fail2ban-client status sshd

Show status of all fail2ban jails at once

jails=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for jail in $jails
do
  fail2ban-client status $jail
done

Unban an IP

fail2ban-client unban sshd 127.0.0.1

Ban and unban

fail2ban-client ban 127.0.0.1
fail2ban-client unban 127.0.0.1

fail2ban-client set sshd banip 127.0.0.1
fail2ban-client set sshd unbanip 127.0.0.1

Retries

fail2ban-client get sshd maxretry
fail2ban-client set sshd maxretry 10

Ban time

fail2ban-client get sshd bantime # seconds
fail2ban-client set sshd bantime 3600

Start and stop jail

fail2ban-client start sshd
fail2ban-client stop sshd