View on GitHub

Let me secure that for you!

How to use Virtual Patching to protect your site

Laying out your SecRules

A SecRule is the most common configuration item you’ll create for ModSecurity. The SecRule has the following syntax:

SecRule VARIABLES OPERATOR [ACTIONS]

Even though there are 3 arguments to the rule, this is a side-effect of the Apache configuration syntax - actually you create multiple arguments within these.

A simple example is this rule for blocking access to a url:

SecRule  REQUEST_FILENAME "@rx /order/details/" \
  "id:11101,phase:1,deny,log,\
  t:none,t:lowercase,t:normalisePath,\
  msg:'Blocking access to %{MATCHED_VAR}'"

We recommend following the below stylistic conventions: