【发布时间】:2013-08-16 02:21:05
【问题描述】:
我在 Mod Security 方面遇到了很多问题。我正忙于为工作中的项目编写 CMS,并且在开发页面以编辑某个数据库记录时,我不断收到 403 错误。在我的头撞在桌子上几个小时后,调整了一些代码,我终于只是更改了我的表单发布到的脚本,以包含一个简单的echo "test";。即使提交到这个简单的页面也会引发 403 错误。我搞砸了我的表单,我最终发现,如果我减少了提交表单的数据量(特别是我减少了 textarea 中的文本量)。
检查日志后(是的,这不是我做的第一件事 - 叹息)我注意到我从 ModSecurity 收到了许多错误,例如:
[Mon Aug 12 16:34:45 2013] [error] [client XX.XXX.XXX.XXX] ModSecurity: Failed to access DBM file "/etc/httpd/logs//global": Permission denied [hostname "XXXXXXX.XXX"] [uri "/admin/index.php"] [unique_id "UgkAlW1shFcAAHTMK80AAAAF"]
[Mon Aug 12 16:34:45 2013] [error] [client XX.XXX.XXX.XXX] ModSecurity: Failed to access DBM file "/etc/httpd/logs//ip": Permission denied [hostname "XXXXXXX.XXX"] [uri "/admin/index.php"] [unique_id "UgkAlW1shFcAAHTMK80AAAAF"]
[Mon Aug 12 17:11:33 2013] [error] [client XX.XXX.XXX.XXX] ModSecurity: Rule execution error - PCRE limits exceeded (-8): (null). [hostname "XXXXXXX.XXX"] [uri "/admin/index.php"] [unique_id "UgkJNW1shFcAAHXUMHkAAAAH"]
[Mon Aug 12 17:11:33 2013] [error] [client XX.XXX.XXX.XXX] ModSecurity: Access denied with code 403 (phase 2). Match of "streq 0" against "TX:MSC_PCRE_LIMITS_EXCEEDED" required. [file "/etc/httpd/conf.d/mod_security.conf"] [line "93"] [msg "ModSecurity internal error flagged: TX:MSC_PCRE_LIMITS_EXCEEDED"] [hostname "XXXXXXX.XXX"] [uri "/admin/index.php"] [unique_id "UgkJNW1shFcAAHXUMHkAAAAH"]
我几天来一直在胡闹,谷歌搜索和更改规则无济于事。我似乎唯一能做的就是关闭这个虚拟主机的 ModSecurity。在我开发 CMS 时这对我来说很好,但在生产中这并不是我真正想做的事情。有没有人对导致此问题的原因以及如何对其进行排序有任何想法?日志似乎指向某种与正则表达式限制有关的规则,但是自从将我的帖子接收脚本更改为只打印出单词 test 我没有对它们做任何事情(尽管我已经尝试通过 SecPcreMatchLimit 提高限制和SecPcreMatchLimitRecursion)。我发送的数据量似乎有问题。
【问题讨论】:
-
我遇到了同样的问题,就像现在我有 2 个 Apache 进程以 100% 的 CPU 运行......在 8 核上,它在某种程度上还不错,但这也意味着一些用户没有得到服务!
标签: php apache security post mod-security