I'm using Fail2Ban on a server and I'm wondering how to unban an IP properly.

I know I can work with IPTables directly: iptables -D fail2ban-ssh <number>

But is there not a way to do it with the fail2ban-client?

In the manuals it states something like: fail2ban-client get ssh actionunban <IP>. But that doesn't work.

Also, I don't want to /etc/init.d/fail2ban restart as that would lose all the bans in the list.

link|improve this question

78% accept rate
feedback

2 Answers

up vote 4 down vote accepted

The command fail2ban-client get jail actionunban ipaddress will do the job. The hard part is finding the right jail.

Use iptables -L -n to find the rule name then use fail2ban-client status 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.

link|improve this answer
feedback

the answer from ukoda is wrong:

call fail2ban-client without parameters and you see a list of possible commands:

get JAIL actionunban ACT
gets the unban command for the action ACT for JAIL

look into the action parameter of the jail you defined, you probably have an iptables action and maybe some more like sendmail-whois or whatever. so in case your action was iptables it will look like this:

fail2ban-client get JAIL actionunban iptables

and the answer will be: iptables -D fail2ban-NAME -s IP -j DROP

it will only show you what you would have to write for an unban. there is no unban command.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.