【问题标题】:mod_security 960015 blocks Google and other good botsmod_security 960015 阻止谷歌和其他好的机器人
【发布时间】:2014-03-07 22:58:19
【问题描述】:

mod_security 规则 960015 不断捕获 Google 和其他优秀的机器人。 我在虚拟主机中有以下内容,以防止好的机器人被抓到:

SecRule REQUEST_HEADERS:User-Agent "Mail.ru" log,allow
SecRule HTTP_USER_AGENT "Mail.RU_Bot" log,allow

Google 和 Yandex 也是如此。

它在 99% 的情况下都能正常工作,但在其他时候会因为一些非常奇怪的原因而失败,这是 Mail.ru 机器人的日志示例:

成功:

217.69.134.79 - - [07/Mar/2014:10:17:13 +0400] "GET / HTTP/1.1" 200 189934 "-"
"Mozilla/5.0 (compatible; Linux x86_64; Mail.RU_Bot/Fast/2.0; 
+http://go.mail.ru/help/robots)"

[Fri Mar 07 10:17:13 2014] [error] [client 217.69.134.79] ModSecurity: Access 
allowed (phase 2). Pattern match "Mail" at REQUEST_HEADERS:User-Agent. 
[file "/etc/apache2/sites-enabled/xxx"] [line "28"] [hostname "xxx"] 
[uri "/"] [unique_id "UxlkaQp-d4EAABU9BSIAAAAV"]

下一分钟它失败了:

217.69.134.79 - - [08/Mar/2014:02:14:19 +0400] "GET / HTTP/1.1" 403 389 "-" "
Mozilla/5.0 (compatible; Linux x86_64; Mail.RU_Bot/2.0; +http://go.mail.ru/
help/robots)"

[Sat Mar 08 02:14:19 2014] [error] [client 217.69.134.79] ModSecurity: Access 
denied with code 403 (phase 2). Operator EQ matched 0 at REQUEST_HEADERS. 
[file "/usr/share/modsecurity-crs/activated_rules/
modsecurity_crs_21_protocol_anomalies.conf"] [line "47"] [id "960015"] 
[rev "2.2.5"] [msg "Request Missing an Accept Header"] [severity "CRITICAL"] 
[tag "PROTOCOL_VIOLATION/MISSING_HEADER_ACCEPT"] [tag "WASCTC/WASC-21"] 
[tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"] [hostname "xxx"] [uri "/"] 
[unique_id "UxpEuwp-d4EAAEMnBFQAAAAE"]

我知道正确的方法是进行反向查找,但是它们会减慢网站的速度,我希望至少有一些安全性,但目前无法使用 960015,因为它会阻止 Google 和其他人。同时,它是一个非常有用的规则,可以捕获 100 多个不良机器人。

如果有人知道如何使用反向查找来设置它,这将真正起作用并允许 Google 和其他优秀的机器人进行索引 - 欢迎您在这里发帖。但是,我也在寻找一种快速而肮脏的解决方案来使其立即工作,因为一些安全性比没有安全性要好。

【问题讨论】:

标签: apache security bots mod-security


【解决方案1】:

这是我使用的解决方案,运行了 48 小时,Google 运行良好,而 100 多个坏人被阻止,将其放入 vhost 文件中:

SecRule REQUEST_HEADERS:User-Agent "Google|Mail|Yandex" "phase:1,t:none,allow,nolog,ctl:ruleRemoveById=960015"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-11
    • 2018-06-27
    • 1970-01-01
    • 2021-10-12
    • 1970-01-01
    相关资源
    最近更新 更多