简单的DoS保护与mod_security?

我在ubuntu 14.04 LTS服务器上安装mod security2 。 我看到下面的教程: http : //blog.cherouvim.com/simple-dos-protection-with-mod_security/

上面的遗憾不对我的apache错误工作:

* Restarting web server apache2 [fail] * The apache2 configtest failed. Output of config test was: AH00526: Syntax error on line 226 of /etc/modsecurity/modsecurity.conf: ModSecurity: No action id present within the rule Action 'configtest' failed. 

Apache错误日志可能有更多的信息。

你能推荐类似的东西吗?

https://launchpad.net/ubuntu/trusty/+source/modsecurity-apache

Ubuntu有ModSecurity 2.7+,它需要[1]

  • 新增规则必须有ID行为,并且必须是数字。

所以最好的做法是将ID添加到这些规则中,这样做就可以了。 例如规则

 SecRule ip:block "@eq 1" "phase:1,deny,log,logdata:'req/sec: %{ip.requests}, blocks: %{ip.blocks}',status:403" 

应该

 SecRule ip:block "@eq 1" "id:12345,phase:1,deny,log,logdata:'req/sec: %{ip.requests}, blocks: %{ip.blocks}',status:403" 

或者其他一些规则还没有使用的其他ID。

[1] https://github.com/SpiderLabs/ModSecurity/blob/master/CHANGES