How to free my IP if it was mistakenly blocked by SSHguard?

I use Ubuntu 16.04 server xenial. I use SSHguard in default conf (I didn't add any conf whatsoever).

How to free my IP if it was mistakenly blocked by SSHguard?

Say there was some kind of bug in SSHguard (as happened to me in the past with CSF-LFD) and my IP was blocked, how could I free it in SSHguard after logging in from either a VPN/adjacent computer/hosting provider's console ?


The Ubuntu Xenial sshguard package creates a sshguard firewall chain for both iptables and ip6tables (see file /usr/lib/sshguard/firewall if interested by details). So if you look into them you should find a rule banning your IP: use iptables -L -n -v sshguard. (I suppose from now on you are speaking about an IPv4 address, if it is IPv6 please replace iptables by ip6tables everywhere).

Then you either flush the chain completely, which would remove the ban for all IPs, yours and others, with iptables -F sshguard.

Or if you want to remove just your IP, you need first to redo the previous command with --line-numbers to find which number is the rule related to your IP and then you can do iptables -D sshguard NUM replacing NUM by the rule number as observed above.

That should then restore ssh access from the IP. No need to restart anything, firewall rules should be applied in real time, so your flush or deletion will be effective immediately.

Also you have an /etc/sshguard/whitelist file where you could add your IP, if it is a fixed one, to avoid the same problem in the future.