自定义规则mod_security和单独的.conf文件中的白名单 – Apache 2.2,modsec 2.8
白名单规则:
SecRule REMOTE_ADDR "^10\.10\.10\.10" phase:1,nolog,allow,ctl:ruleEngine=Off,id:104008
如果一个请求被发送到包含例如/? /?abc=../../的服务器,则modsec只允许来自10.10.10.10的请求,否则它会拒绝第二阶段的请求,正如我预期的那样(由于我们安装的规则)
我有一位使用远程WorPresspipe理系统的客户(此处以10.10.10.10表示),但该系统发送某些包含Content-Length标题但缺lessContent-Type标题的POST请求。
即使请求来自10.10.10.10,也会导致:
--7ed45f75-H-- Message: Access denied with connection close (phase 1). Match of "rx ^0$" against "REQUEST_HEADERS:Content-Length" required. [file "/usr/local/apache/conf/modsec_rules/10_asl_rules.conf"] [line "93"] [id "392301"] [rev "7"] [msg "Atomicorp.com WAF Rules: Request Containing Content, but Missing Content-Type header"] [severity "NOTICE"] [tag "no_ar"] Apache-Error: [file "config.c"] [line 395] [level 3] Handler for (null) returned invalid result code 9, referer: https://redacted.com Action: Intercepted (phase 1)
我不知道是否ctl:ruleEngine=Off不能用于第一阶段SecRule,或者这是一个Mod Security 2.8的bug。 我可以确认没有任何规则可以使ctl:ruleEngine重新开启。
正如你已经在这里回答你的问题,你应该创build额外的configuration文件,并把它放在它,它会禁用Atomicorp规则,你只是提到这个用户/域(只为大家)。
文件:/ usr / local / apache / conf / userdata / std / 2 / username / example.com
<IfModule mod_security2.c> SecRuleRemoveById 392301 </IfModule>
编辑
对特定的IP /范围禁用特定的规则将会是这样的
SecRule REMOTE_HOST "@ipmatch 1.2.0.0/16" \ "id:12345,phase:2,t:none,pass,nolog,noauditlog,ctl:ruleRemovebyID=392301"
正如Atomicorp维基解释的那样