0

How can i block all access to a php file using mod_sec?

The file name has the form: sm6#.php, being # a random digit.

4

3 回答 3

1

您可以使用简单的单一规则来做到这一点,例如:

SecRule REQUEST_LINE "@rx sm6[0-9]{1,}\.php" \
    "phase:2,block,severity:2,msg:'Blocking access to sm6#.php files.'"

在这种情况下,{1,} 表示文件名中至少有 1 个数字(在数字 6 之后)。如果您愿意,您可以将其更改为 2、3、4 甚至 100。或者使用 {2,6} 将其限制为最少 2 位和最多 6 位。它使用 PCRE 模式匹配,所以这取决于你!

于 2012-03-31T04:29:35.607 回答
0
SecRule REQUEST_FILENAME "sm6\d+\.php" "phase:1,block,severity:2,msg:'Blocking access to sm6#.php files.'"
于 2012-04-13T06:51:48.243 回答
0

你不认为 mod_sec 对此过于强大吗?

只需使用.htaccess.

于 2013-06-21T12:25:43.360 回答