【问题标题】:how to set rules in mod_security module in Apache如何在 Apache 的 mod_security 模块中设置规则
【发布时间】:2019-02-04 04:50:43
【问题描述】:

有人可以帮我设置规则,以便我只获取使用 POST 发布的数据。我有一个表格,我在其中提交姓名和电子邮件 ID。我只想保存要保存在日志文件中的那部分。在我的场景中,我只想在我的日志文件中包含以下数据:-

--29000000-C--
name1=ssn&email1=ssn%40gmail.com
--29000000-F--
HTTP/1.1 200 OK
X-Powered-By: PHP/7.2.4
Content-Length: 16
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

我现在的 mod_security 看起来像:-

<IfModule security2_module>
#Enable the module.
SecRuleEngine On
SecAuditEngine on

#Setup logging in a dedicated file.
SecAuditLog C:/wamp64/bin/apache/apache2.4.33/logs/website-audit.log

#Allow it to access requests body.
SecRequestBodyAccess on
SecAuditLogParts ABIFHZ

#Setup default action.
SecDefaultAction "nolog,noauditlog,allow,phase:2"

#Define the rule that will log the content of POST requests.
SecRule REQUEST_METHOD "^POST$" "chain,allow,phase:2,id:123"
SecRule REQUEST_URI ".*" "auditlog"

</ifmodule>

【问题讨论】:

    标签: apache logging httpd.conf rules apache-modules


    【解决方案1】:

    我找到了解决问题的方法。我们可以根据我们的要求设置以下字段:-

    SecAuditLogParts ABIFHZ

    在我的情况下,我将字段设置为:- SecAuditLogParts C

    但是它会显示为:-

    --84670000-A--
    [29/Aug/2018:14:49:58 +0200] W4aWdqHJuCcOQzTIgCiEqAAAAD8 127.0.0.1 60735 127.0.0.1 80
    --84670000-C--
    name1=red&email1=red%40yahoo.com
    --84670000-Z--

    【讨论】:

      猜你喜欢
      • 2017-05-20
      • 2020-11-05
      • 2013-05-09
      • 2012-11-05
      • 2019-08-12
      • 1970-01-01
      • 1970-01-01
      • 2012-01-11
      • 1970-01-01
      相关资源
      最近更新 更多