modsecurity:setting_up_rules
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
modsecurity:setting_up_rules [2016/10/14 14:03] – created peter | modsecurity:setting_up_rules [2019/11/30 14:19] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== ModSecurity - Setting Up Rules ====== | ||
- | |||
- | To make your life easier, there are a lot of rules which are already installed along with mod_security. | ||
- | |||
- | <code bash> | ||
- | ls -l / | ||
- | </ | ||
- | |||
- | Returns | ||
- | |||
- | <code bash> | ||
- | total 40 | ||
- | drwxr-xr-x 2 root root 4096 Oct 20 09:45 activated_rules | ||
- | drwxr-xr-x 2 root root 4096 Oct 20 09:45 base_rules | ||
- | drwxr-xr-x 2 root root 4096 Oct 20 09:45 experimental_rules | ||
- | drwxr-xr-x 2 root root 4096 Oct 20 09:45 lua | ||
- | -rw-r--r-- 1 root root 13544 Jul 2 2012 modsecurity_crs_10_setup.conf | ||
- | drwxr-xr-x 2 root root 4096 Oct 20 09:45 optional_rules | ||
- | drwxr-xr-x 3 root root 4096 Oct 20 09:45 util | ||
- | </ | ||
- | |||
- | The documentation is available at | ||
- | |||
- | <code bash> | ||
- | ls -l / | ||
- | </ | ||
- | |||
- | Returns | ||
- | |||
- | <code bash> | ||
- | total 40 | ||
- | -rw-r--r-- 1 root root 469 Jul 2 2012 changelog.Debian.gz | ||
- | -rw-r--r-- 1 root root 12387 Jun 18 2012 changelog.gz | ||
- | -rw-r--r-- 1 root root 1297 Jul 2 2012 copyright | ||
- | drwxr-xr-x 3 root root 4096 Oct 20 09:45 examples | ||
- | -rw-r--r-- 1 root root 1138 Mar 16 2012 README.Debian | ||
- | -rw-r--r-- 1 root root 6495 Mar 16 2012 README.gz | ||
- | </ | ||
- | |||
- | To load these rules, we need to tell Apache to look into these directories. | ||
- | |||
- | <code bash> | ||
- | vi / | ||
- | </ | ||
- | |||
- | Add the following directives inside **< | ||
- | |||
- | <file bash / | ||
- | Include "/ | ||
- | Include "/ | ||
- | </ | ||
- | |||
- | The **activated_rules** directory is similar to Apache' | ||
- | |||
- | <code bash> | ||
- | / | ||
- | / | ||
- | / | ||
- | < | ||
- | |||
- | Symlinks must be created inside the **activated_rules** directory to activate these. | ||
- | |||
- | <code bash> | ||
- | cd / | ||
- | ln -s / | ||
- | </ | ||
- | |||
- | Apache has to be reloaded for the rules to take effect. | ||
- | |||
- | <code bash> | ||
- | service apache2 reload | ||
- | </ | ||
- | |||
- | Now open the login page we created earlier and try using the SQL injection query on the username field. If you had changed the **SecRuleEngine** directive to **On**, you'll see a **403 Forbidden error**. | ||
- | |||
modsecurity/setting_up_rules.1476453838.txt.gz · Last modified: 2020/07/15 09:30 (external edit)