Web Application Firewall (WAF)¶
The WAF inspects requests to a website with ModSecurity + the OWASP Core Rule Set (CRS) and blocks known attack patterns (SQL injection, XSS, path traversal, remote code execution) at the Nginx layer, before they ever reach the application. It is opt-in per website — enabling it on one site has zero effect on any other site, even on the same server.
How it works¶
- An admin — or, with the right package permission, the customer — enables the WAF for a website.
- The agent makes sure ModSecurity + OWASP CRS are installed on the target server, then adds two includes to the site's Nginx vhost: the global, enconf-curated rule base, and a per-site config file for the paranoia level, rule exclusions, and detection-only mode.
- Every request to the website is evaluated against the CRS rules. A match returns
403and is logged to the audit log — unless detection-only mode is active, in which case it is only logged.
Our own, curated rule wiring
enconf does not rely on the Debian package's default wiring (owasp-crs.load) — it uses directives the Nginx ModSecurity module doesn't support, which can break nginx -t outright. Instead, the agent writes its own, verified inclusion of the CRS rules and explicitly forces SecRuleEngine On (the Debian package ships a log-only mode by default that never blocks anything).
Enabling the WAF for a website¶
As an administrator¶
- Go to Sites and open the website you want to protect
- Under Performance, toggle WAF (ModSecurity) on
- Save — the agent installs ModSecurity automatically if needed and re-renders the vhost
An Install ModSecurity button is also available on the Security → WAF page (admin only) to provision the packages on a server ahead of time, without enabling any site.
As a customer¶
Customers whose package grants the WAF permission see the toggle in the site-edit dialog and a WAF entry in the sidebar.
Permission
The WAF is gated per package by the WAF permission (perm_waf). The maximum selectable paranoia level is also capped per package (Max WAF paranoia level, default 1) — administrators are not subject to this cap.
Paranoia level¶
OWASP CRS defines four paranoia levels. A higher level catches more attack classes but also raises the risk of false positives on unusual-but-legitimate traffic:
| Level | Recommendation |
|---|---|
| 1 (default) | Suitable for most sites — lowest false-positive risk |
| 2–3 | For sites with higher protection needs, after a short test period in detection-only mode |
| 4 | Maximum detection, noticeably higher false-positive risk — only with careful monitoring |
Detection-only mode¶
Before switching to a higher paranoia level, or right after first enabling the WAF, detection-only mode is recommended: matches are logged but not blocked. This lets you check the log for legitimate traffic that would have been falsely blocked before actually enforcing.
Exclusions¶
The Exclusions tab of a website knows two kinds of exception:
- Rule exception — the rule ID is disabled for the entire website. The rule ID of a match is shown in the Rule ID column of the log.
- Path-scoped exception — the rule stays active but does not apply to one specific path. The path is the requested file path without the query string (e.g.
/wp-admin/admin-ajax.php), and the check is an exact match on that value. The agent writes a conditional ModSecurity rule for it (REQUEST_FILENAME @streq). This form is more precise and should be preferred over a rule exception.
Learning mode¶
The Learning mode section inside the Exclusions tab groups the matches from the log by rule ID and path. It evaluates the last 5,000 log entries of the website and shows the hit count and the last-seen time.
For each entry the system gives a rule-based recommendation:
| Recommendation | Meaning |
|---|---|
| Exclusion usually harmless | Protocol, header or user-agent rule that does not inspect request content |
| Blocking probably correct | Attack-signature rule (SQLi, XSS, RCE, LFI, RFI, among others) — exclude only after manual review |
| Review manually | No automatic assessment possible; the matched content has to be checked |
Except adds a match as a path-scoped exception; Except all adds all matches that are not excepted yet, including matches for the same request triggered by other rules. Added exceptions take effect only after Save. Learning mode does not set any exception by itself.
Prerequisite
Learning mode needs matches in the log. If Detection-only is not active, the WAF blocks new matches immediately. Detection-only is recommended so that legitimate visitors are not locked out while data is collected; blocked matches are also logged and evaluated by learning mode.
Attack log¶
The Log tab shows every event ModSecurity evaluated: timestamp, client IP, requested URI, rule ID, message text, and severity. Administrators can filter by site or domain; customers only ever see events for their own websites.
Limitations¶
- The WAF protects against known attack patterns at the request level. It does not replace application updates, strong passwords, or the malware scanner, which detects code already planted in the filesystem.
- A broken custom exclusion rule is validated with
nginx -tbefore being applied — if validation fails, the previous, working configuration stays active instead of taking the server down.