aws_wafv2 — AWS WAFv2 IP sets

Blocks at AWS WAF by managing WAFv2 IP sets through the aws CLI — one set per address family, rendered wholesale from the kur's ban book using WAF's get-then-update optimistic locking. The IP sets and the WebACL rule blocking on them are yours to create.

[kur.web]
backend = "aws_wafv2"

[kur.web.options]
scope  = "REGIONAL"
region = "us-east-2"
name4  = "kur-web-v4"
id4    = "a1b2c3d4-..."
name6  = "kur-web-v6"
id6    = "e5f6a7b8-..."

AWS-side setup — required first

Requirements

Settings

Options

| option | default | what | |-----------|--------------|----------------------------------------------| | scope | REGIONAL | REGIONAL or CLOUDFRONT | | region | (unset) | adds --region <region> when set | | name4 | (unset) | IPv4 IP set name | | id4 | (unset) | IPv4 IP set ID | | name6 | (unset) | IPv6 IP set name | | id6 | (unset) | IPv6 IP set ID | | aws_cmd | aws | the aws CLI binary |

What each operation runs

Every mutation is get-then-update per touched family — get-ip-set supplies the lock token WAF's optimistic locking requires:

| operation | commands | |------------|--------------------------------------------------------------------------| | init | aws wafv2 get-ip-set --scope <scope> --name <name> --id <id> per configured family | | ban | get-ip-set for the IP's family, then aws wafv2 update-ip-set ... --addresses <ip1>/32 <ip2>/32 ... --lock-token <token> — the family's full book | | unban | the same, minus the IP | | list | no command — the kur's own ban book | | check | a get-ip-set per configured family | | flush | update-ip-set with an empty address list per family | | re_init | teardown (best effort), init, update with the full book per family | | teardown | update with empty addresses per family (ban book kept) |

Single IPv4 addresses render as /32, IPv6 as /128; banned CIDR ranges render as themselves.

self_heal

check verifies the CLI can fetch each configured set — not their contents or the WebACL. But as with the other wholesale-render backends, hand-edits are overwritten at the next mutation.

Gotchas