feat(edge): Anubis PoW gate behind stage.ymrtech.com (rung 2, NCFG#1990) #2979

Merged
hermes merged 1 commit from kb/NCFG-1990-anubis-pow-rung2 into main 2026-11-26 16:16:49 -06:00
Collaborator

Rung 2 of the edge ladder in nix-config#1984: put the challenge arm in front of one vhost, stage.ymrtech.com, and prove the exempt arm still gets the origin byte-identically before anything is widened.

Card: nix-config#1990 (parent nix-config#1984).

What lands

  • hosts/common/optional/anubis-challenge.nix (new) — fleet.edgeChallenge:
    • block is the Caddyfile fragment a challenge-classified vhost prepends: named matchers for the internal/external split plus one handle. A handle rather than a bare reverse_proxy because Caddy orders a bare proxy after every handle block, so a handle-routed vhost would serve those paths to a challenged client unproxied.
    • internalCidrs defers to fleet.edgeLimits.internalCidrs instead of copying it — "our own traffic" must mean one thing across limiting, CrowdSec whitelisting and challenging.
    • ACME http-01 is exempt from the challenge (a challenge page answered to a CA is a renewal failure; the edge limiter exempts the same path).
    • header_up X-Real-Ip {http.request.remote.host} — Anubis reads X-Real-Ip and does not fall back to X-Forwarded-For; with neither set it answers 500 to every request (measured), i.e. a missing header is the gate failing closed on real visitors.
    • REDIRECT_DOMAINS pinned to the vhost name — unset, Anubis honours any redir a client passes to pass-challenge.
    • The origin leg is the host's own vhost over loopback-by-IP, so a passed request re-enters the same vhost, matches the internal arm and is served by the routes that were already there. No second route table to drift.
  • hosts/public/default.nix — enables the option, names the origin (https://11.0.0.7:443, Host/SNI stage.ymrtech.com) and prefixes the stage.ymrtech.com vhost with the fragment.

Blast radius

The vhost keeps its WG0-only listen set (nix-config#1221): every source that can reach it today is in the exempt set, so the challenged arm is armed and unexercised and nothing a client can reach changes. What a deploy can regress is the exempt arm — hence the card's proof is that the mesh request is still byte-identical.

Verified before commit (local, real binaries)

Fleet's own aarch64 Caddy 2.11.4 + caddy-ratelimit and Anubis 1.27.0, one sandbox vhost carrying the generated fragment:

arm result
caddy adapt order external handle = subroute index 0, ahead of /preview/*, /account*, fallback
source 127.0.0.0/8 origin body byte-identical, no challenge
source outside the set Anubis PoW page, 200, Making sure you're not a bot!, main.mjs
external /account/login reaches Anubis, never the portal proxy
passed request comes back with the origin body (loopback leg)
external /.well-known/acme-challenge/* passes through
nix eval public toplevel drv evaluates; unit anubis-stage present with expected env

Live verification on the host after deploy is recorded on the card.

Rung 2 of the edge ladder in nix-config#1984: put the challenge arm in front of **one** vhost, `stage.ymrtech.com`, and prove the exempt arm still gets the origin byte-identically before anything is widened. Card: nix-config#1990 (parent nix-config#1984). ## What lands * `hosts/common/optional/anubis-challenge.nix` (new) — `fleet.edgeChallenge`: * `block` is the Caddyfile fragment a challenge-classified vhost prepends: named matchers for the internal/external split plus **one** `handle`. A `handle` rather than a bare `reverse_proxy` because Caddy orders a bare proxy *after* every handle block, so a handle-routed vhost would serve those paths to a challenged client unproxied. * `internalCidrs` **defers** to `fleet.edgeLimits.internalCidrs` instead of copying it — "our own traffic" must mean one thing across limiting, CrowdSec whitelisting and challenging. * ACME `http-01` is exempt from the challenge (a challenge page answered to a CA is a renewal failure; the edge limiter exempts the same path). * `header_up X-Real-Ip {http.request.remote.host}` — Anubis reads `X-Real-Ip` and does **not** fall back to `X-Forwarded-For`; with neither set it answers 500 to every request (measured), i.e. a missing header is the gate failing closed on real visitors. * `REDIRECT_DOMAINS` pinned to the vhost name — unset, Anubis honours any `redir` a client passes to `pass-challenge`. * The origin leg is the host's own vhost over loopback-by-IP, so a passed request re-enters the same vhost, matches the internal arm and is served by the routes that were already there. No second route table to drift. * `hosts/public/default.nix` — enables the option, names the origin (`https://11.0.0.7:443`, Host/SNI `stage.ymrtech.com`) and prefixes the `stage.ymrtech.com` vhost with the fragment. ## Blast radius The vhost keeps its WG0-only listen set (nix-config#1221): every source that can reach it today is in the exempt set, so the challenged arm is **armed and unexercised** and nothing a client can reach changes. What a deploy *can* regress is the exempt arm — hence the card's proof is that the mesh request is still byte-identical. ## Verified before commit (local, real binaries) Fleet's own aarch64 Caddy 2.11.4 + caddy-ratelimit and Anubis 1.27.0, one sandbox vhost carrying the generated fragment: | arm | result | |---|---| | `caddy adapt` order | external handle = subroute index **0**, ahead of `/preview/*`, `/account*`, fallback | | source `127.0.0.0/8` | origin body byte-identical, no challenge | | source outside the set | Anubis PoW page, **200**, `Making sure you're not a bot!`, `main.mjs` | | external `/account/login` | reaches Anubis, **never** the portal proxy | | passed request | comes back with the origin body (loopback leg) | | external `/.well-known/acme-challenge/*` | passes through | | `nix eval` public | toplevel drv evaluates; unit `anubis-stage` present with expected env | Live verification on the host after deploy is recorded on the card.
feat(edge): Anubis PoW gate behind stage.ymrtech.com (rung 2, NCFG#1990)
All checks were successful
Policy Gates / Worker-scope reaper worker signature (mutation-tested) (pull_request) Successful in 5s
PR base guard / Base drift / conflict check (pull_request) Successful in 7s
Policy Gates / Kanban pool capacity knob (runtime override + clamp, mutation-tested) (pull_request) Successful in 3s
Policy Gates / Sentinel pass budget contract (prompt forbids the full board walk, mutation-tested) (pull_request) Successful in 3s
Policy Gates / CI-scratch reaper class table (mutation-tested) (pull_request) Successful in 4s
Secret Scan / gitleaks scan (pull_request) Successful in 13s
Policy Gates / Fleet cache sweep class table (mutation-tested) (pull_request) Successful in 5s
Policy Gates / foremerge accept-order contract (real binary) (pull_request) Successful in 1m14s
Policy Gates / Scheduled foremerge reap command line (mutation-tested) (pull_request) Successful in 3s
NixOS Build Check / Scope changed deployable hosts (pull_request) Successful in 43s
NixOS Build Check / Flake input regression guard (pull_request) Successful in 4s
Policy Gates / .forgejo/tests python suites (hermetic) (pull_request) Successful in 1m1s
Policy Gates / Fleet control ledger (sealed profile fails the build, mutation-tested) (pull_request) Successful in 23s
foremerge intent (advisory) all 2 changed path(s) covered by a live foremerge intent
NixOS Build Check / Hermes runtime gates (one eval of vpn's runtime) (pull_request) Successful in 1m54s
Repo Gates / Repo gates (script-only battery) (pull_request) Successful in 5m34s
NixOS Build Check / Build changed host closures (per-host budget) (pull_request) Successful in 3m39s
NixOS Build Check / Gate summary (pull_request) Successful in 0s
0dc32d990a
Rung 2 of the edge ladder in nix-config#1984: prove the challenge arm before
anything is widened. One vhost is challenge-classified — stage.ymrtech.com —
and the module, not the vhost, owns every part of the gate, so a second vhost
cannot drift from the first.

`hosts/common/optional/anubis-challenge.nix` (new) exposes `fleet.edgeChallenge`:

  - `block` is the Caddyfile fragment a classified vhost prepends: named
    matchers for the internal/external split plus ONE `handle`. A `handle` and
    not a bare `reverse_proxy`, because Caddy orders a bare proxy AFTER every
    handle block — a vhost whose paths are handle-routed (this fleet's are)
    would then serve those paths to a challenged client unproxied. Handles are
    mutually exclusive and run in written order, so first means an external
    request reaches nothing else.
  - `internalCidrs` DEFERS to `fleet.edgeLimits.internalCidrs` rather than
    copying it: "our own traffic" must mean one thing across limiting,
    CrowdSec whitelisting and challenging.
  - ACME http-01 is exempt from the challenge. A challenge page answered to a
    CA is a certificate renewal failure.
  - The reverse_proxy sets `X-Real-Ip` from the client address. Anubis reads
    X-Real-Ip and does not fall back to X-Forwarded-For; with neither set it
    answers 500 to every request (measured), i.e. an unset header is the gate
    failing closed on real visitors.
  - `REDIRECT_DOMAINS` is pinned to the vhost name: unset, Anubis honours any
    `redir` a client passes to `pass-challenge`.

The origin leg is the host's own vhost over loopback-by-IP, so a passed
request re-enters the same vhost, matches the internal arm and is answered by
the routes that were already there — no second route table to drift.

`hosts/public/default.nix`: enables the option, names that origin
(https://11.0.0.7:443, Host/SNI stage.ymrtech.com) and prefixes the
stage.ymrtech.com vhost with the fragment.

Rung 2 changes nothing a client can reach: the vhost keeps its WG0-only listen
set (nix-config#1221), so every source that can reach it is in the exempt set
and the challenged arm is armed and unexercised. What a deploy can regress is
the exempt arm, which is why the card's proof is that the mesh request is still
byte-identical.

Verified locally before commit, with the fleet's own aarch64 Caddy 2.11.4 +
caddy-ratelimit and Anubis 1.27.0, both arms on one sandbox vhost:

  - caddy adapt: the external handle is subroute index 0, ahead of /preview/*,
    /account* and the fallback;
  - source in 127.0.0.0/8 -> origin body byte-identical, no challenge;
  - source outside the set -> Anubis PoW page (200, title "Making sure you're
    not a bot!", main.mjs), and /account/login from that source reaches Anubis,
    never the portal proxy;
  - a passed request comes back with the origin body (the loopback leg);
  - /.well-known/acme-challenge/* still passes through;
  - nix eval of nixosConfigurations.public: toplevel drv evaluates, unit
    anubis-stage present with the expected environment.
hermes force-pushed kb/NCFG-1990-anubis-pow-rung2 from 0dc32d990a
All checks were successful
Policy Gates / Worker-scope reaper worker signature (mutation-tested) (pull_request) Successful in 5s
PR base guard / Base drift / conflict check (pull_request) Successful in 7s
Policy Gates / Kanban pool capacity knob (runtime override + clamp, mutation-tested) (pull_request) Successful in 3s
Policy Gates / Sentinel pass budget contract (prompt forbids the full board walk, mutation-tested) (pull_request) Successful in 3s
Policy Gates / CI-scratch reaper class table (mutation-tested) (pull_request) Successful in 4s
Secret Scan / gitleaks scan (pull_request) Successful in 13s
Policy Gates / Fleet cache sweep class table (mutation-tested) (pull_request) Successful in 5s
Policy Gates / foremerge accept-order contract (real binary) (pull_request) Successful in 1m14s
Policy Gates / Scheduled foremerge reap command line (mutation-tested) (pull_request) Successful in 3s
NixOS Build Check / Scope changed deployable hosts (pull_request) Successful in 43s
NixOS Build Check / Flake input regression guard (pull_request) Successful in 4s
Policy Gates / .forgejo/tests python suites (hermetic) (pull_request) Successful in 1m1s
Policy Gates / Fleet control ledger (sealed profile fails the build, mutation-tested) (pull_request) Successful in 23s
foremerge intent (advisory) all 2 changed path(s) covered by a live foremerge intent
NixOS Build Check / Hermes runtime gates (one eval of vpn's runtime) (pull_request) Successful in 1m54s
Repo Gates / Repo gates (script-only battery) (pull_request) Successful in 5m34s
NixOS Build Check / Build changed host closures (per-host budget) (pull_request) Successful in 3m39s
NixOS Build Check / Gate summary (pull_request) Successful in 0s
to 92b4ef77cd
All checks were successful
foremerge intent (advisory) all 2 changed path(s) covered by a live foremerge intent
PR base guard / Base drift / conflict check (pull_request) Successful in 8s
Review / reviewbot check (pull_request) Successful in 24s
Secret Scan / gitleaks scan (pull_request) Successful in 13s
NixOS Build Check / Scope changed deployable hosts (pull_request) Successful in 49s
NixOS Build Check / Flake input regression guard (pull_request) Successful in 5s
Giga Build Check / Build giga target closure (pull_request) Successful in 56s
Policy Gates / Worker-scope reaper worker signature (mutation-tested) (pull_request) Successful in 6s
Policy Gates / Kanban pool capacity knob (runtime override + clamp, mutation-tested) (pull_request) Successful in 3s
Policy Gates / Sentinel pass budget contract (prompt forbids the full board walk, mutation-tested) (pull_request) Successful in 3s
Policy Gates / CI-scratch reaper class table (mutation-tested) (pull_request) Successful in 4s
Policy Gates / Fleet cache sweep class table (mutation-tested) (pull_request) Successful in 4s
NixOS Build Check / Hermes runtime gates (one eval of vpn's runtime) (pull_request) Successful in 1m41s
Policy Gates / foremerge accept-order contract (real binary) (pull_request) Successful in 1m15s
Policy Gates / Scheduled foremerge reap command line (mutation-tested) (pull_request) Successful in 4s
Policy Gates / .forgejo/tests python suites (hermetic) (pull_request) Successful in 1m0s
NixOS Build Check / Build changed host closures (per-host budget) (pull_request) Successful in 3m2s
NixOS Build Check / Gate summary (pull_request) Successful in 0s
Policy Gates / Fleet control ledger (sealed profile fails the build, mutation-tested) (pull_request) Successful in 22s
Repo Gates / Repo gates (script-only battery) (pull_request) Successful in 5m12s
2026-11-26 16:11:14 -06:00
Compare
hermes merged commit 37ddfa5be5 into main 2026-11-26 16:16:49 -06:00
hermes deleted branch kb/NCFG-1990-anubis-pow-rung2 2026-11-26 16:16:55 -06:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ymrtech/nix-config!2979
No description provided.