[repo] NixOS and docs: Caddy admin socket for changes under Caddy, polkit start/stop only, edge never stops restarting, openssl in the VM tests, beside-Caddy without secrets in argv, pinned Ianitor rev, X-Served-By trial marker

This commit is contained in:
2026-11-08 10:49:42 +01:00
parent e84eb1ba74
commit bc336d1188
7 changed files with 86 additions and 38 deletions
+20 -6
View File
@@ -305,18 +305,32 @@ curl -s -H "$H" -H 'Content-Type: application/json' -X POST "$API/engine" -d '{"
```
Control writes `/var/lib/ianitor/engine` first, stops the serving unit, starts the other one (polkit
allows exactly `ianitor-edge.service` and `caddy-fallback.service`, verbs start/stop/restart) and
allows exactly `ianitor-edge.service` and `caddy-fallback.service`, verbs start and stop) and
waits until it serves; if it does not within 20 s, it starts the old one again and reports
`engine.switch_failed`. The switch waits for a running apply (same lock). Refusals:
`engine.unmanaged` (no `[engine]` in control.toml), `engine.same`, `engine.switching`,
`engine.switch_failed`. The switch waits for a running apply (same lock, first come first
served: a queued switch runs right after the apply in progress, before any apply queued after
it). Back on Pingora, edge is reloaded so it serves what was applied while Caddy served.
Refusals: `engine.unmanaged` (no `[engine]` in control.toml), `engine.same`, `engine.switching`,
`engine.not_ready` (Caddy's settings cannot be built from the current routes).
While Caddy serves (decisions Q3, Q4):
- changes are paused: `overview.paused_reason = "engine.caddy"`, writes get `409 control.paused`;
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;
- **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 revocations restart caddy-fallback (Caddy reads the allow list when it starts).
- 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
pki.devices_unwritten` (the revocation itself is recorded), `GET /certs` carries
`devices_problem` until it is fixed, and control retries every 2 s; repeating the DELETE is
safe and nudges the engine again. Edge also re-reads the device files by itself every 5 s.
## All calls