Mod安全规则打破了Apache configtest

问题描述 投票:0回答:1

我正在尝试添加一个mod安全规则,以便对由apache提供服务的Web应用程序上的某个uri实施速率限制。

尝试重新启动apache时出现以下错误:

ModSecurity: No action id present within the rule
Action 'configtest' failed.
The Apache error log may have more information

具体来说 - 这就是我想要实现的目标:https://johnleach.co.uk/words/2012/05/15/rate-limiting-with-apache-and-mod-security/

似乎该文章是为mod_security的先前版本编写的,其中不需要id。

但是我已将规则更改为包含一个id(如你所见,我添加了id:1234)。因此,我不确定为什么我仍然会收到错误。

<LocationMatch "^/login_check">
  SecAction initcol:ip=%{REMOTE_ADDR},pass,nolog
  SecAction "phase:5,deprecatevar:ip.somepathcounter=1/1,pass,nolog"
  SecRule IP:SOMEPATHCOUNTER "@gt 60" "phase:2,id:1234,pause:300,deny,status:509,setenv:RATELIMITED,skip:1,nolog"
  SecAction "phase:2,pass,setvar:ip.somepathcounter=+1,nolog"
  Header always set Retry-After "10" env=RATELIMITED
</LocationMatch>

不确定如何调试这个。欢迎任何投入。

apache apache2 vhosts mod-security2
1个回答
1
投票

SecAction指令还需要一个id:https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v2.x%29#id

注意:自v2.7.0起,所有SecRule / SecAction指令都需要id操作

为SecAction行添加一个唯一的ID,它应该可以工作。

© www.soinside.com 2019 - 2024. All rights reserved.