check / check (push) Waiting to run
docs/settings.md is now the one settings reference; the spec keeps the conventions, the off list and each group's requirements and reasons, and links to it for the per-setting entries. The endpoint list, the ban notes, the state file contents, the rule file format and the alert object likewise live in docs/ and are linked from the spec. The package list from the README's Design section joins "Architecture". The nine docs files are byte-identical to those on the README branch. Package comments that named "Alert webhook schema", "Request log" and "Metrics endpoint" for their field lists now name the docs files. 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).