我怎样才能用假的Google机器人阻止DDOS攻击?
我在网上find了两个解决scheme。 但两者似乎也阻止了正确的谷歌机器人。
# Block fake google when it's not coming from their IP range's (A fake googlebot) [F] => Failure RewriteCond %{HTTP:X-FORWARDED-FOR} !^66\.249\.(6[4-9]|[78][0-9]|9[0-5])\. RewriteCond %{HTTP_USER_AGENT} ^Mozilla/5\.0\ \(compatible;\Googlebot/2\.[01];\ \+http://www\.google\.com/bot\.html\)$ [NC] RewriteRule .* - [F,L] # End if match
这是第二个:
# Validate Googlebots RewriteCond %{HTTP_USER_AGENT} ^Mozilla/5\.0\ \(compatible;\ Googlebot/2\.[01];\ \+http://www\.google\.com/bot\.html\)$ RewriteCond %{HTTP:Accept} ^\*/\*$ RewriteCond %{HTTP:Accept-Encoding} ="gzip,deflate" RewriteCond %{HTTP:Accept-Language} ="" RewriteCond %{HTTP:Accept-Charset} ="" RewriteCond %{HTTP:From} ="googlebot(at)googlebot.com" RewriteCond %{REMOTE_ADDR} ^66\.249\.(6[4-9]|7[0-9]|8[0-46-9]|9[0-5])\. [OR] RewriteCond %{REMOTE_ADDR} ^216\.239\.(3[2-9]|[45][0-9]|6[0-3])\.0 # Optional reverse-DNS-lookup replacement for IP-address check lines above # RewriteCond %{REMOTE_HOST} ^crawl(-([1-9][0-9]?|1[0-9]{2}|2[0-4][0-9]|25[0-5])){4}\.googlebot\.com$ RewriteRule ^ - [S=1] ## Block invalid Googlebots RewriteCond %{HTTP_USER_AGENT} Googlebot [NC] RewriteRule ^ - [F] # END sending now 403 to fake Googebots
有人可以build议一个解决scheme,以阻止与虚假的googlebots的DDOS攻击?
您提供的两种方法似乎允许基于已知的IP范围。 您需要validation正则expression式匹配是否是最新的,并且您检查的范围是Google实际使用的范围。 如果您实际上处于“DDoS”状态,则不build议在.htaccess文件中使用反向DNS查找选项。
另外,build议您可以使用某种“Web应用程序防火墙”。 Sucuri和CloudFlare都提供了一种服务来过滤这种types的stream量(和其他恶意的东西),并可以大大减less您所服务的“不良机器人”请求的数量。
– CloudFlare: https : //www.cloudflare.com/waf/
– Sucuri: https ://sucuri.net/website-firewall/
这是一个防火墙的地方。防火墙有特殊的内置目的,其中一些是为了这个目的。
我会研究ASA或Dell SonicWall防火墙。 默认情况下,它会阻止这样的事情。