3

对于带有 WordPress 网站的服务器,是否有任何标准 (?!) mod_security2 规则?我想明确表示我不想禁用mod_security2(它的存在是有充分理由的)。在使用 WordPress 安装时,我只是想让我的生活更轻松一些。

我已阅读此http://wpsecure.net/2012/01/using-mod_security-2-with-wordpress/但很高兴听到已经在使用mod_security2WordPress的人的更多意见。

因为我不是这方面的专家,是否有任何文档可以阅读以下内容...

<LocationMatch "/wp-admin/post.php">
  SecRuleRemoveById 300015 300016 300017 950907 950005 950006 960008 960011 960904 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

<LocationMatch "/wp-admin/admin-ajax.php">
  SecRuleRemoveById 300015 300016 300017 950907 950005 950006 960008 960011 960904 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

<LocationMatch "/wp-admin/page.php">
  SecRuleRemoveById 300015 300016 300017 950907 950005 950006 960008 960011 960904
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

<LocationMatch "/wp-admin/options.php">
  SecRuleRemoveById 300015 300016 300017 950907 950005 950006 960008 960011 960904 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

<LocationMatch "/wp-admin/theme-editor.php">
  SecRuleRemoveById 300015 300016 300017 950907 950005 950006 960008 960011 960904 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

<LocationMatch "/wp-content/plugins/">
  SecRuleRemoveById 300015 340151 1234234 340153 1234234 300016 300017 950907 950005 950006 960008 960011 960904 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

<LocationMatch "/wp-includes/">
  SecRuleRemoveById 960010 960012 950006 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

<LocationMatch "/wp-content/themes/">
  SecRuleRemoveById 340151 340153 1234234 950006 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

<LocationMatch "/wp-cron.php">
  SecRuleRemoveById 960015
</LocationMatch>

<LocationMatch "/feed">
  SecRuleRemoveById 960015
</LocationMatch>

<LocationMatch "/category/feed">
  SecRuleRemoveById 960015
</LocationMatch>

谢谢你。

4

1 回答 1

1

据我所知,没有可用的公共/免费规则集,其中包含 Wordpress 的特殊规则集。AtomicorpTrustwave提供了 wordpress 的商业规则集,但实际上我没有使用/测试它们。

如果您不想全局包含配置,您发布的配置旨在包含在 Apache2 网络服务器的配置或每个虚拟主机的配置中。

LocationMatch是来自 Apache2 网络服务器的指令 - 请参阅:http ://httpd.apache.org/docs/2.2/en/mod/core.html#locationmatch

SecRuleRemoveById是来自 mod_security2 https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#wiki-SecRuleRemoveById的指令,它通过其 ID 禁用一个或多个规则

将两者结合在一起,配置的第一行确实删除了带有给定 ID 的 mod_security2 规则,用于匹配“/wp-admin/post.php”(这是负责管理 Wordpress 后端中的博客文章的脚本)的所有 URL。

所以总而言之,该配置为几个 Wordpress 脚本禁用了许多 mod_security2 / OWASP 规则。

我对当前版本的 mod_security2 和 Wordpress 的体验如下:

有一个月以来,我的处境和你现在一样。我已经有一个使用 mod_security2 和 OWASP 核心规则集运行 Apache2 的网络服务器。网络服务器只托管了一些小型 Wordpress 站点,我很高兴,因为 mod_security2 阻止了针对 Wordpress 的几次自动攻击。

然后我不得不将 mod_security2 更新到最新版本,这还需要将 OWASP 核心规则集更新到最新版本。新版本的 OWASP 核心规则集导致 Wordpress 出现许多 mod_security2 误报,所以我来到了您在问题中提到的同一篇文章。经过数小时的调试,我得出的结论是,这篇文章(从 2012 年开始)似乎已经过时,并且 mod_security2 和 Wordpress 的开发已经到了这么远,文章中显示的排除规则不适合新的mod_security2/OWASP 核心规则集和 Wordpress 的版本。

我试图创建自己的规则集,但实际上在工作了数小时后放弃了,因为我不得不禁用 OWASP 核心规则集附带的太多规则(例如,由于误报而禁用许多 SQL 注入检查),实际上删除了mod_security2 和 OWASP 核心规则集的许多安全优势。

于 2014-02-03T14:13:53.047 回答