Jon*_*hon 8 php apache security post mod-security
我一直有很多与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"]
Run Code Online (Sandbox Code Playgroud)
我一直在搞乱,谷歌搜索和改变规则几天无济于事.我似乎唯一能做的就是关闭这个虚拟主机的ModSecurity.我正在开发CMS时,这很好,但在生产中,这不是我想要做的事情.有没有人对导致此问题的原因以及如何排序有任何想法?日志似乎在某种规则,以点带正则表达式的限制做的,但由于改变了我的后接收脚本只是打印出来的字测试我没有做与他们任何东西(虽然我已经试图通过加大了限制SecPcreMatchLimit和SecPcreMatchLimitRecursion).似乎我发送的数据量有问题.
小智 2
几周前我在 PCRE 模块上遇到了类似的问题,它与 backtrack_limits 有关。
我假设SecPcreMatchLimit和SecPcreMatchLimitRecursion与 mod_security 有关,但是您是否尝试在 php.ini 文件中或在 PHP 执行期间提高 pcre 模块的值?
pcre.backtrack_limit和pcre.recursion_limit
您还可以使用以下函数确认问题是否与 PCRE 限制有关preg_last_error()
您可以在这里查看更多信息:http ://php.net/manual/en/function.preg-last-error.php
在这里: http: //www.php.net/manual/en/pcre.constants.php
我希望这有帮助。
| 归档时间: |
|
| 查看次数: |
7936 次 |
| 最近记录: |