Fail2ban fakegooglebot jail bug
Fail2ban fakegooglebot jail bug

When I have checked my fail2ban server logs (by default the fail2ban log file is /var/log/fail2ban.log ), I have found the following error:

fail2ban.action         [10241]: ERROR   /etc/fail2ban/filter.d/ignorecommands/apache-fakegooglebot -- returned 1 
fail2ban.filter         [10241]: INFO    [apache-fakegooglebot] Found                                                                                                                              
fail2ban.action         [10241]: ERROR   /etc/fail2ban/filter.d/ignorecommands/apache-fakegooglebot -- stdout: b''                                                                                  
fail2ban.action         [10241]: ERROR   /etc/fail2ban/filter.d/ignorecommands/apache-fakegooglebot -- stderr: b'Traceback 
(most recent call last):\n  File "/etc/fail2ban/filter.d/ignorecommands/apache-fakegooglebot", line 32, in <module>\n    
is_googlebot(process_args(sys.argv))\n  File "/etc/fail2ban/filter.d/ignorecommands/apache-fakegooglebot", line 17, in process_args\n    
from fail2ban.server.filter import DNSUtils\nImportError: No module named fail2ban.server.filter\n' 

This error is related on the default python version. Run this command to get your current and default python version:

# python -V
Python 2.7.10

If you get an output, as shown above, that indicates a version 2.x, the solution is quite simple. Edit the file /etc/fail2ban/filter.d/ignorecommands/apache-fakegooglebot and replace the first line : #!/usr/bin/python by this line #!/usr/bin/python3

Restart your fail2ban and the error will not occur anymore:
systemctl restart fail2ban




My Powershell script categories

Fail2ban fakegooglebot jail bug

Leave a Reply

Your email address will not be published. Required fields are marked *