你可以在这里做很多事情。
By default a regex is used to match in ModSecurity,所以你可以写一个规则来涵盖URI和块,如果不匹配:
SecRule REQUEST_URI "!\/(configuration|update)\/" "phase:1,id:700003,block
你可以使用@pm做同样的:
SecRule REQUEST_URI "[email protected] \/configuration\/ \/update\/" "phase:1,id:700003,block
另外,您可以使用skipAfter,这将允许您按不同的规则列出URL,然后有一个阻止规则,如果上述任何规则匹配,则会跳过该规则:
SecMarker BEGIN_VALID_URL_CHECK
SecRule REQUEST_URI "[email protected] /configuration" \ "id:700003, phase:1,log,skipAfter:END_VALID_URL_CHECK,msg:'Different URL Accessed'"
SecRule REQUEST_URI "@beginsWith /update" \ "id:700004, phase:1,log,skipAfter:END_VALID_URL_CHECK,msg:'Update URI accessed'"
SecRule REQUEST_URI "." \ "id:700005, phase:1,log,block,msg:'Another URI accessed - blocking'"
SecMarker END_VALID_URL_CHECK
或者你可以allow匹配那些在ModSecurity中停止处理这个请求的模式的规则(这可能是一个不好的选择,因为它会跳过配置稍后在你的配置中定义的任何其他ModSecurity规则,但为了完整性清酒):
SecRule REQUEST_URI "[email protected] /configuration" \ "id:700003, phase:1,log,allow,msg:'Different URL Accessed'"
SecRule REQUEST_URI "@beginsWith /update" \ "id:700004, phase:1,log,allow, msg:'Update URI accessed'"
SecRule REQUEST_URI "." \ "id:700005, phase:1,log,block, msg:'Another URI accessed - blocking'"
我不明白你的问题。 –
我想允许上面的URL唯一的休息我希望该modsecurity将阻止。 – user2670674