Change domain filter regex

Change domain filter regex since there are other Google crawlers.
See "Google crawlers"
<https://support.google.com/webmasters/answer/1061943?hl=en>
pull/1226/head
Pablo Rodriguez Fernandez 2015-10-20 10:37:07 +02:00
parent 74fcb219ab
commit 2c576c64f8
2 changed files with 4 additions and 1 deletions

View File

@ -21,6 +21,7 @@ ver. 0.9.4 (2015/XX/XXX) - wanna-be-released
* Treat failed and killed execution of commands identically (only
different log messages), which addresses different behavior on different
exit codes of dash and bash (gh-1155)
* Fix jail.conf.5 man's section (gh-1226)
- New Features:
@ -34,6 +35,8 @@ ver. 0.9.4 (2015/XX/XXX) - wanna-be-released
(Thanks M. Maraun)
* Added check against atacker's Googlebot PTR fake records
(Thanks Pablo Rodriguez Fernandez)
* Enhance filter against atacker's Googlebot PTR fake records
(gh-1226)
ver. 0.9.3 (2015/08/01) - lets-all-stay-friends
----------

View File

@ -26,7 +26,7 @@ def is_googlebot(ip):
from fail2ban.server.filter import DNSUtils
host = DNSUtils.ipToName(ip)
if not host or not re.match('crawl-.*\.googlebot\.com$', host):
if not host or not re.match('.*\.google(bot)?\.com$', host):
sys.exit(1)
host_ips = DNSUtils.dnsToIp(host)
sys.exit(0 if ip in host_ips else 1)