[repo] NixOS and docs: ianitor-caddy-guard with caddy-fallback, caddy-revert after every control stop, admin socket only for control, Caddy trial deadline in the engine-switch VM test, trusted proxies stay off beside Caddy

This commit is contained in:
2026-11-08 12:04:14 +01:00
parent 23a283ece9
commit 457aea86ca
6 changed files with 80 additions and 13 deletions
+18 -6
View File
@@ -316,15 +316,27 @@ Refusals: `engine.unmanaged` (no `[engine]` in control.toml), `engine.same`, `en
While Caddy serves (decisions Q3, Q4; Mark 2026-11-08):
- **changes keep working**: applies, Undo and Restore go through the same pipeline. Both outputs
are compiled; the trial is loaded into Caddy through its admin API (`POST /load` on the Unix
socket `[compile_caddy] caddy_admin_socket`, `/run/caddy-fallback/admin.sock` under NixOS), the
touched hosts are probed *through Caddy* for the watch window, and a revert loads the previous
`caddy.json` again. Without `caddy_admin_socket` an apply under Caddy fails with
`apply.failed.reload` and nothing changes;
socket `[compile_caddy] caddy_admin_socket`, `/run/caddy-fallback/admin.sock` under NixOS,
group `ianitor-caddy-admin`: control and Caddy, not edge), and a revert loads the previous
`caddy.json` again. Every load sends `Cache-Control: must-revalidate`, so Caddy reads its
certificate and device files again even when the config is unchanged. The watch judges health
as edge does: control probes the upstreams itself with edge's rules (health check: `GET <path>`,
Host = the upstream, 2xx; none: `GET /`, Host = the hostname, below 500), and a probe *through*
Caddy only asks that Caddy answers at all (any status, its sign-in redirect included). Each
round also checks that Caddy still runs the trial (`GET /config/`); if anything else reloaded it,
the change is undone as `apply.reverted.edge_lost`. Without `caddy_admin_socket` an apply under
Caddy fails with `apply.failed.reload` and nothing changes;
- **an unconfirmed trial never outlives control**, as with edge: control arms a deadline
(`caddy-trial.json` in its state directory: watch + margin) before loading the trial and claims
it before confirming. `ianitor-caddy-guard` (a unit that runs with caddy-fallback,
`ianitor-control caddy-guard`) reverts a trial past its deadline, which covers a hung control;
ianitor-control's `ExecStopPost=ianitor-control caddy-revert` reverts at once after any stop or
crash. Whoever renames the deadline file first wins, so a trial is either kept or reverted;
- device issues and revocations wait for a running apply, then reload Caddy and check that it
serves the certificate on disk for a Domi host (else `devices_problem`, retried);
- **share links are off**: minting is `409 share.engine_caddy`, and a visitor with a link gets the
normal sign-in (fails closed). Caddy cannot check a share token and control never serves
visitors; a validator Caddy calls through `forward_auth` is planned before v1.1;
- device issues and revocations reload Caddy through the same socket (Caddy reads the allow list
when a config is loaded).
A revocation is in force only once the serving engine has the new list. If the list cannot be
written or the engine does not take it, `DELETE /certs/devices/{id}` answers `503