I would like to add ".googlebot.com" to the ignore iplist for fail2ban since the ignoreip explanation mentions DNS host as an accepted input. Is this a proper format?
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
From looking at the Python script that uses the "ignoreip" value trying to do a wildcard match on a name like that will not work, it needs to be an IP/network or be a name that resolves to an IP.
If the 'googlebot.com' string is in the log perhaps using "ignoreregex" instead will do the job? Command and usage is listed here: http://www.fail2ban.org/wiki/index.php/Commands#JAIL_CONFIGURATION
My log file has only IP numbers (no domain names), so
ignoreregex
didn't work for me.I'll post here what I did, in the case it is useful for someone trying to do something similar. This was done on Ubuntu 18.04, with Fail2Ban v0.10.2.
ignorehost
.ignorecommand = %(ignorecommands_dir)s/ignorehost <ip>
In my case, I put that line in the ssh and sshd jails:
systemctl reload fail2ban.service
Better solution is to add ignoreregex line in your filter config file:
It will ignore Googlebot. Be sure to check
access.log
instead oferror.log
if you're using Apache.