check / check (push) Waiting to run
The old README opened with project history and one list of a hundred settings. The new one leads with what smallwebwaf is, what it protects against, how to build and deploy it, how it sits in front of the app, what happens to a request, the settings most deployments touch, how to check it works and how to develop it. The reference material, every setting, bans, rule files, the Core Rule Set, the admin endpoints, the request log, alerts, metrics, state files, lookups, reputation sources, the image and gitea, moves to files under docs/, each linked from the README. Every statement was checked against the code on next. Model: fable-5-1
2.1 KiB
2.1 KiB
Admin endpoints
smallwebwaf answers these requests itself, on the app's own address and
through traefik like any other request. Apart from the health check, each needs
a token, sent as Authorization: Bearer <token>, and goes through every check
any other request goes through. It is answered where another request would be
passed to the app: a banned client stays refused, and each request counts toward
rate limiting. A missing or wrong token is answered 401, in observe mode
too. Such a refusal counts toward the error burst, so a client guessing tokens
is soon banned. While a token is unset, its endpoints answer 404.
GET /_smallwebwaf/healthz:200andok, to anyone, before any check and without asking the app.GET /_smallwebwaf/metrics: the metrics, forSWWAF_METRICS_TOKEN(seemetrics.md).GET /_smallwebwaf/bans: every ban held, underbans, each asbans.jsonlists it. NeedsSWWAF_ADMIN_TOKEN, as do the three below.POST /_smallwebwaf/bans: bans a netblock. The body is a JSON object ofnetblock,durationand, if you like,reason.netblockis a netblock such as203.0.113.0/24, or a client's address. A client's address bans its IPv4 netblock (SWWAF_BAN_SCOPE_V4_PREFIX) or its IPv6 group.durationis a duration such as1hor7d, orpermanent. The ban starts at once, with the causeadmin. A bad body is answered400, saying what is wrong:- one that is not such an object, or has another field;
- one longer than 4 KiB;
- one that names an IPv4-mapped netblock, or an address with a zone.
DELETE /_smallwebwaf/bans/<client>: lifts every active ban covering the address<client>. It answers404when none is active.GET /_smallwebwaf/clients/<ip>: whatsmallwebwafknows of the client. Underclient, its counters and history asclients.jsonholds them, ornullwhen it has never been seen. Underbans, every ban covering the address, with its notes.
An admin whose own address is banned lifts that ban by editing bans.json (see
bans.md).