Skip to content

WAF

The web application firewall is Coraza with the OWASP Core Rule Set. Turn it on globally in WAF → Settings, then override per proxy host where a particular application needs something different.

The WAF card on a proxy hostToggle it off to see what the host inherits, or open Rule presets to pick another.Nothing you change here is saved
Web application firewallInspect and block malicious requests via Coraza / OWASP CRS
Covers SQLi, XSS, LFI, RCE and hundreds of other attack patterns
Request body limitsCoraza buffers request bodies for inspection and rejects anything larger than its limit, which is 12.5 MiB with the OWASP CRS loaded. Raise it for hosts that receive large uploads. Leave blank to inherit.
MiB
MiB
Over-limit actionUses the action set on the WAF settings page.
Rule exclusionsRule exclusions for this host, scoped to a path or a variable if you like, are managed on the WAF page.
Manage WAF exclusions
Still excluded from an older version, until the next restart moves them to the WAF page:
942100
Added to the presets the global WAF settings select.
Added to the plugins the global WAF settings select. Plugins load only with the OWASP CRS.
ModSecurity SecLang syntax. Appended after OWASP CRS if enabled.
Tab indents; press Escape then Tab to leave the fieldSecLang
Quick templates
The WAF event logFilter it, then pick a row - the rule that fired opens beside the list.Nothing you change here is saved
7Total events
5Blocked
3Critical
3Unique hosts
6Rule IDs triggered
FirewallEnabled
5Blocked
7Total events
3Critical
3Unique hosts
6Rule IDs triggered
Row statusTimeActionSeverityHostClient IPRequestRule IDActions
BlockedCriticalapp.example.com
45.147.230.14Netherlands
POST/login
942100
BlockedCriticalapp.example.com
45.147.230.14Netherlands
GET/search?q=%3Cscript%3E
941100
BlockedWarninggrafana.example.com
2001:db8:3f1a::77Germany
GET/.env
930120
BlockedWarninggrafana.example.com
2001:db8:3f1a::77Germany
GET/wp-admin/setup-config.php
930130
DetectedNoticewiki.example.com
10.0.4.18
POST/api/pages/42
941160
BlockedCriticalapp.example.com
2001:db8:85a3:4c1e:9d2f:3b7a:61e4:c802Singapore
POST/api/import
932130
DetectedNoticewiki.example.com
10.0.4.18
POST/api/pages/17
941160

WAF → Settings → Mode is one of three:

  • Off - no WAF, unless a host turns one on for itself.
  • Detection only - rules run and log what they match, but every request goes through.
  • Blocking - a request that reaches the anomaly threshold, or matches a rule that denies on its own, gets 403.

The usual order is to detect first, which shows what the rules would do to your traffic before they start doing it. A host’s WAF card sets its own mode or leaves it on Global default, and the Hosts tab lists every proxy host with its mode, where that mode comes from (the global setting, the host’s own, turned off on the host, or a host overriding the global WAF) and its WAF events in the last 7 days.

While the global WAF only detects, Needs attention says so, since a WAF in detection only looks protected while it blocks nothing.

With the Core Rule Set loaded, the settings also take:

  • Paranoia level, 1 to 4. Each level adds stricter rules, which catch more and misfire more. Level 1 suits most sites.
  • Also log the next level without blocking - runs the next level’s rules in detection only, so the event log shows what raising the level would block before you raise it.
  • Inbound and outbound anomaly thresholds, 1 to 10000, 5 and 4 by default. Each matched rule adds points by its severity (5 for critical, 4 for error, 3 for warning, 2 for notice); the request or response is blocked once the total reaches the threshold.

These apply to every host’s WAF, including hosts that override the global settings, and are left out of the config entirely while they are at their defaults.

OWASP CRS covers SQL injection, cross-site scripting, local file inclusion, remote code execution and more. It is enabled by default when the WAF is on.

A WebSocket upgrade is inspected like any other request, so claiming to be one does not get a request past the rules. Once the connection is upgraded, the messages on it are not inspected.

Real applications trip generic rules. An exclusion switches one rule off, as narrowly as you like:

  • Applies to every host, or one. A host that overrides the global WAF takes only its own.
  • Path, optional - only requests to this path. End it with * for everything below it. The path is decoded and its ., .. and repeated slashes resolved before it is stored, and the request path is normalised the same way before it is compared, so /api/../admin is never taken for /api/.
  • Variable, optional - such as ARGS:content or REQUEST_COOKIES:session. The rule keeps checking everything else in the request and only skips this one.
  • Reason - why it misfires there. The author and time are recorded with it.

WAF → Exclusions lists them, with an Add button. The quicker way is from an event: False positive fills the form with the narrowest exclusion that would have let it through - that rule, on that host, for that path and the variable it matched in.

Rules 949110, 949111, 959100 and 959101 cannot be excluded: they are where the CRS compares the anomaly score with the threshold, and excluding one would switch its blocking off altogether.

The scope can be the CPM dashboard, which has no host row of its own. Its list always starts with rule 920420, marked Built in: the dashboard’s own POST requests carry content types that rule refuses, so it is excluded there whatever else is configured and cannot be removed.

An exclusion is checked like any other WAF change (see Before anything is saved) and saved only if Coraza compiles it. If Caddy still refuses the configuration it produces, the change is undone and the previous configuration loaded again, and the save reports it.

The lists of suppressed rule ids from older versions - global and per host - are moved into exclusions when the controller starts, with the same effect, and shown as moved from an older version. excluded_rule_ids is still accepted by the REST API and applied, and moved on the next start; use the GraphQL exclusion mutations instead.

Setting up a new app behind the rule set usually means a round of blocked requests, each one an event to read and an exclusion to write. Override mode does the round for you. On a host’s page, WAF override mode → Start switches that host’s WAF to detection for your own address - the one the controller sees this request from - for five minutes, or until you press Finish. Requests from that address are logged, not blocked; everyone else is still protected, since the host gets a second copy of its WAF that only your address is routed to. The event log keeps every request a rule matched, whatever the response status.

Once the session ends, the page lists the rules you tripped: id, message, severity, how many requests tripped it, the variable and data each matched and the paths it was seen on. Choose which to exclude - all of them to begin with - give the preset a name, and Apply. The chosen rules go into a new preset, which the host then selects beside whatever it already had; the host’s own directives are never touched, so the result is one named thing to review under WAF → Presets, reuse on another host or delete. A change-approval policy that covers WAF presets holds this like any other preset.

Override mode needs the host’s WAF on and blocking, and analytics on, since the result is read from the event log. A loopback address - 127.0.0.1, ::1, or either mapped into IPv6 - is refused: it is the proxy’s or the machine’s own, so letting it through would exempt the host itself rather than you. Where the address the controller sees is loopback, the card asks for yours instead. The anomaly decision rules never appear in the list. A session that was never applied can be discarded, and a new one started.

An application that trips the CRS usually needs the same handful of exclusions everywhere it runs. A preset is that set of rules, written once under a name in WAF → Presets and then selected wherever it applies:

  • Globally, in WAF → Settings, for every host with the WAF on.
  • Per host, in the host’s WAF card. In merge mode the host’s presets are added to the global ones; in override mode only the host’s apply.

Presets load after the CRS setup and before the CRS rules - where a CRS plugin’s exclusions go - so a runtime exclusion such as ctl:ruleRemoveById takes effect before the rule it removes runs.

Editing a preset applies the change to every host that selects it. A preset cannot be deleted while anything still selects it; the error names what does.

The CRS plugin registry lists plugins for the Core Rule Set: rule exclusions for WordPress, Nextcloud, Drupal, phpMyAdmin and other applications, and extra detections. WAF → Plugins lists the registry with whether each plugin is official or third party, how far it has been tested and its license, and installs one with a click.

Installing fetches the plugin’s latest release from its GitHub repository - or the newest commit, for a plugin that has never tagged one - and stores its files, so what runs is exactly what was installed until you update it. A newer release shows beside the plugin’s version once the registries have been checked, or straight away with Check for updates.

Once installed, a plugin is selected like a preset: globally in WAF → Settings, or per host in the host’s WAF card, merged or overridden the same way. Plugins tune the CRS rules, so they load only where the CRS does, in the order CRS itself uses: every plugin’s configuration, then its -before rules, the CRS rules, then its -after rules.

Click an installed plugin to open it: its files are listed in that order, and the -config file - the one that turns parts of a plugin off or sets its variables - can be edited there. The edit is kept when the plugin updates; restoring the upstream text goes back to the plugin’s own. The other files are shown as the release shipped them.

The gear on the Plugin registry card lists the registries plugins come from. The OWASP one is there to start with; add your own - any https:// URL serving a registry.json in the same format - or remove it. Plugins from every registry share one table, with a column naming the registry each came from.

Each registry is re-read on the interval set there (daily by default, 0 for only when you click Check), and every plugin’s latest release is checked the way an install would check it. One that cannot run here is greyed out and marked Unsupported, with the reason on hover. A release is checked once: later checks only look for a newer one.

Some plugins cannot run here, and are refused by the check and at install:

  • A rule that reads a file - a Lua script (@inspectFile), a data file (@pmFromFile, @ipMatchFromFile) or a GeoIP database (@geoLookup). Caddy runs on your agents and only has the rule set compiled into it.
  • A rule Coraza cannot compile: one that keeps per-client state in ModSecurity’s persistent collections (IP, SESSION and the like), or one with unbalanced quotes. Caddy would refuse the whole config, for every host.
  • A rule id outside the range the registry gave the plugin. That range is what keeps a plugin from redefining a CRS rule, which would stop Caddy loading its config.
  • A rule id range that overlaps a plugin already installed - checked at install, since registries allocate ranges independently and two of them can clash.
  • A directive other than SecRule, SecAction, SecMarker and the SecRuleRemoveById, SecRuleRemoveByTag and SecRuleUpdateTargetBy* exclusions, or ctl:ruleEngine.

An install, an update and a configuration edit also go through the checks in Before anything is saved, Caddy’s own included. A plugin that gets past all of them can still, rarely, be one Coraza refuses - one seeded from a backup, say, or checked while no agent could run Caddy - and Coraza building the WAF is part of Caddy loading its config, so one such plugin would stop every host’s config from loading. When that happens, CPM finds the plugin and switches it off, and the config loads without it: hosts that select it keep the rest of their WAF. The plugin is marked Disabled in its row, the audit log records it, and opening the plugin shows what happened with a Retry button. Updating it or editing its configuration tries it again too.

The controller needs outbound HTTPS to api.github.com, raw.githubusercontent.com and any registry you add. GitHub allows 60 unauthenticated API requests an hour: an install takes two or three, and a first check of the OWASP registry most of them. A GitHub token in the registry settings - one with no scopes - raises that to 5,000. It is stored encrypted and sent only to api.github.com.

Each host and the global settings also take directives of their own, loaded after the CRS rules. Presets and custom directives accept the same SecLang: SecRule, SecAction, SecMarker and SecDefaultAction, plus the request body limit directives. A rule can span several lines with a trailing backslash:

SecRule REQUEST_FILENAME "@rx \A/api/(?:[^.]|\.[^.])*\.?\z" \
"id:9001,phase:1,pass,nolog,ctl:ruleRemoveById=942100"

Match a path on REQUEST_FILENAME, the decoded path, and refuse .. in it: the raw REQUEST_URI of /api/../admin starts with /api/, and an upstream that resolves dot-segments serves /admin. The quick templates do both.

Anything that would switch the engine off or rewrite rules - SecRuleEngine, ctl:ruleEngine, SecRuleRemoveById and the other SecRule* mutations, or Include - is refused when you save, with the offending lines named, and so are setenv and the operators that read the container’s files or run a program (@inspectFile, @pmFromFile, @ipMatchFromFile, @validateSchema). The exception is a data file of the embedded CRS, such as @pmFromFile @owasp_crs/unix-shell.data, while the CRS is loaded. To stop a rule from firing, add an exclusion instead.

A stored line that a newer release refuses does not block saving anything else, but it is left out of the config, and the WAF page lists it until you rewrite or remove it.

Coraza compiles every WAF while Caddy loads its config, so one rule it refuses would stop every host’s config from loading, not just the one it was written for. Directives are checked twice before they are stored - custom directives, presets and a CRS plugin’s files alike.

  • As you type. The editor reads the text the way Coraza does and marks each line it would refuse: an unknown variable, operator, action or transformation, an action missing its value or given one it does not take, a malformed rule, a repeated rule id, a disruptive action on a chained rule, or a regular expression using lookaround, backreferences or anything else Go’s RE2 engine does not support. An error blocks the save. A warning - a rule with no id, or one in the range the CRS reserves - does not.
  • On save. The agent has its own Caddy validate the WAFs the change produces - the edited one, and every host that merges or selects it - without loading them. This catches what the editor cannot: a rule id the CRS already uses, rules from the global settings and a host colliding once merged, or a pattern Go refuses to compile. The error says which WAF was refused and quotes Coraza.

The second check runs in a short-lived container from the Caddy image, with no network, and takes a second or two. It needs a paired agent whose Caddy container exists; without one the save goes ahead on the first check alone.

Every blocked and detected request is recorded with its rule, severity and classification. Type to search the host, client IP, URI and rule message, or filter exactly on Host, Client IP, Rule ID, Action or Severity - the filters combine with each other and with the time range. The security events page shows the same events beside everything else that stopped a request.

Opening an event explains it: every rule it matched, the points each added, the variable it matched in and the data it matched, the total score against the threshold with the rule that made the decision, and the agent that reported it. Then:

  • Working as intended marks the event reviewed.
  • False positive opens the narrowest exclusion for it, and marks the event a false positive once saved.
  • Block adds the client’s address to the blocked sources.
  • Copy as curl copies the request as a curl command, to reproduce it. It is quoted for a POSIX shell such as bash or zsh, not for PowerShell or cmd, and a method that is not a plain verb is replaced with GET, since the method is whatever the client sent.
  • Raw JSON shows the audit record as stored.

Before an event is stored, the agent replaces these with [redacted], and the controller does so again on ingest and once more when an event is shown, so an event recorded by an older version is covered too:

  • the Authorization, Proxy-Authorization, Cookie and Set-Cookie headers, and any header whose name contains token, secret, api-key, apikey, sessid or sessionid;
  • query parameters and form fields named like password, passwd, token, secret, api_key, apikey or authentication, in the request line, the body, and the URLs in the Referer, Origin and Location headers;
  • a request body too long to read through, which is replaced whole;
  • the matched value a rule reports, when it is one of those.

The curl command keeps the placeholders, so a credential you need to replay has to be filled in.

An agent only reports on the hosts it serves. An event for a host pinned to other agents is dropped when it arrives, so a compromised agent cannot fill another host’s history; events for a name no host claims, such as a scanner’s request to a bare address, are kept.