我在 CentOS 7 上设置了 Apache2 + PHP5
我的 Web 应用程序的一些 PHP,它们接受 UUID 作为 GET 参数,这违反了 ModSecurity URI 模式。
我想设置 ModSecurity 以绕过特定 URI 的安全检查。
我怎样才能做到这一点?
谢谢!
最佳答案
您可以像这样创建排除规则:
SecRule REQUEST_FILENAME "@endsWith /dir/script.php" \
"id:1000,\
phase:2,\
pass,\
t:none,\
nolog,\
ctl:ruleRemoveTargetById=932130;ARGS:get_or_post_parameter,\
ctl:ruleRemoveTargetById=941100;ARGS:get_or_post_parameter,\
ctl:ruleRemoveTargetById=932130;ARGS:get_or_post_parameter2"
在第一行设置您的 URI,并在规则的末尾,为规则 ID 和 GET/POST 参数名称对添加排除项(如上例所示)。最后,将规则放入文件 REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf 中。
关于php - 特定 uri 的 ModSecurity 白名单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70210442/