Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fail2ban: how unban ip (using fail2ban-client) [closed]

Tags:

linux

I using fail2ban v.0.8.2 but I can't unban an IP:

with fail2ban-client I see IP:

fail2ban-client status fail2ban

Status for the jail: fail2ban
|- filter
|  |- File list:    /var/log/fail2ban.log 
|  |- Currently failed: 1
|  `- Total failed: 8
`- action
   |- Currently banned: 2
   |  `- IP list:   151.10.65.197 151.10.72.169 
   `- Total banned: 2

from man page should be sufficiently do:

fail2ban-client get fail2ban actionunban 151.10.65.197

output of command does not return error but:

iptables -L -nv |grep -b2 -a1 151

16262- pkts bytes target     prot opt in     out     source               destination         
16351:    0     0 DROP       all  --  *      *       151.10.72.169        0.0.0.0/0           
16440:    0     0 DROP       all  --  *      *       151.10.65.197        0.0.0.0/0           
16529- 181K   48M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0

and the output of

fail2ban-client status fail2ban 

is same of above, hence command does not run.

like image 870
Pol Hallen Avatar asked Jun 21 '14 17:06

Pol Hallen


People also ask

Where does fail2ban store banned IP?

Find the banned IP address in the file /var/log/fail2ban. log to identify which jail has banned it.


1 Answers

You need to use fail2ban-client get jail-name actionunban ipaddress That will allow you to unban an IP address. Use iptables -L -n to find the status of the correct jail-name to use?. The command you are giving: fail2ban-client get fail2ban actionunban xxx.xxx.xxx.xxx is correct given your output. Check status again to make sure it has not already been unblocked by the timeout. That would explain why the command fails.

Here is a good page Fail2ban Manual Unban Single Host (for iptables) There have been changes to the unban procedure syntax (get/set) depending on version.

like image 66
David C. Rankin Avatar answered Oct 02 '22 02:10

David C. Rankin