I bumped into the following cryptic Fail2ban error:
fail2ban.actions.action: ERROR iptables -n -L INPUT | grep -q ‘fail2ban-NoScript[ \t]’ returned 100
fail2ban.actions.action: ERROR Invariant check failed. Trying to restore a sane environment
Cause: a race condition in fail2ban-client.
Solution: add a small amount of sleep.
Open /usr/bin/fail2ban-client and around line 144 add the line “time.sleep(0.1)” right before “beautifier.setInputCmd(c)”. Make sure you use tabs and not spaces! Here is what it should look like:
def __processCmd(self, cmd, showRet = True):
beautifier = Beautifier()
for c in cmd:
Enjoy all those bans automagically handed out to the bad guys.