Default the netblock and AS number anomaly thresholds (closes #410)
check / check (push) Successful in 6m7s

The alert-only thresholds per netblock and per AS number now have
defaults that alert on obvious abuse alone: per netblock 1200 and
15000 requests a minute and an hour, 5G and 50G a minute and an hour;
per AS number five times those. The AS number ones default to off
while SWW_WAF_LOOKUP_SOURCE is off. The other scopes stay off. The
README says to tune them to the site's traffic.

Model: opus-5-5
This commit was merged in pull request #484.
This commit is contained in:
clawbot committed 2026-11-20 06:42:25 +01:00
1 parent 8219664ad1
commit 23eaa869dd
8 files changed
+152 -33

No files matched your search

+21 -2
View File
@@ -378,8 +378,9 @@ Crossing a threshold sends one `anomaly` alert to the destinations under
Each scope has four thresholds: the most requests and the most body bytes
counted in a minute and in an hour. The bytes are those `SWW_WAF_BYTES_COUNTED`
names. Requests are counts, bytes are sizes. Each is `off` by default. The four
thresholds per client are:
names. Requests are counts, bytes are sizes. Each is `off` by default, except
those per netblock and per AS number listed below. The four thresholds per
client are:
- `SWW_WAF_ANOMALY_CLIENT_REQUESTS_PER_MINUTE`;
- `SWW_WAF_ANOMALY_CLIENT_REQUESTS_PER_HOUR`;
@@ -403,6 +404,24 @@ as `REQUESTS_PER_MINUTE`:
`office=203.0.113.0/24,scraper-x=198.51.100.0/22`. An item without `=` or a
name, or with a bad netblock, is refused. So is a name used twice.
The thresholds per netblock and per AS number have defaults set high enough to
alert only on obvious abuse:
- per netblock:
- `REQUESTS_PER_MINUTE` `1200` and `REQUESTS_PER_HOUR` `15000`, ten clients
at the default rate limits;
- `BYTES_PER_HOUR` `50G`, one client at the default byte limit per hour;
- `BYTES_PER_MINUTE` `5G`, a tenth of that.
- per AS number, five times those: `REQUESTS_PER_MINUTE` `6000`,
`REQUESTS_PER_HOUR` `75000`, `BYTES_PER_HOUR` `250G` and `BYTES_PER_MINUTE`
`25G`.
While `SWW_WAF_LOOKUP_SOURCE` is `off`, no request has an AS number, so the
thresholds per AS number are `off` by default. Setting one then stops the start.
These defaults are a starting point. Tune them to your own site's traffic, which
the metrics show.
## Settings given as files
To give a token as a file, as "Tokens" under "Deployment" in