How to Unban an IP properly with Fail2Ban
With Fail2Ban before v0.8.8:
fail2ban-client get YOURJAILNAMEHERE actionunban IPADDRESSHERE
With Fail2Ban v0.8.8 and later:
fail2ban-client set YOURJAILNAMEHERE unbanip IPADDRESSHERE
The hard part is finding the right jail:
- Use
iptables -L -n
to find the rule name... - ...then use
fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'
to get the actual jail names. The rule name and jail name may not be the same but it should be clear which one is related to which.
Since v0.8.8 there is the unbanip
option (actionunban
isn't for this purpose)
It can be triggered by the set
command, if you look at the list of options, you will see the syntax is.
So it will be (by heart, please check):
fail2ban-client set ssh-iptables unbanip IPADDRESSHERE
more generic:
fail2ban-client set JAILNAMEHERE unbanip IPADDRESSHERE
works for me