[deploy] Sockets: services.ianitor.edge.proxySocket (Caddy beside Ianitor reaches edge on a 0660 socket of the ianitor-proxy group) and ui.socket (control's UI socket, the proof trusted only there); the Configuration_Server patch, beside-caddy.md and api.md follow; a VM test for both

This commit is contained in:
2026-11-10 21:09:24 +01:00
parent d249bcf9f2
commit 1358649550
5 changed files with 146 additions and 40 deletions
+15 -13
View File
@@ -24,22 +24,24 @@ cut-over. This is **prepared, not applied**: Mark runs every command below himse
## The shape
```text
visitor ── Caddy :443 (as today) ── https://127.0.0.1:18443 Ianitor edge ── the app
visitor ── Caddy :443 (as today) ── unix:/run/ianitor-proxy/edge.sock ── Ianitor edge ── the app
```
- Ianitor edge listens on **loopback only** (127.0.0.1:18080 and :18443), so D-21a holds:
nothing new is reachable from the LAN. Control is on 127.0.0.1:7878.
- Caddy keeps the public side for the two names and hands them to Ianitor over TLS; Ianitor
serves them with Domi certificates, which Caddy checks against the Domi root (a public file).
- Caddy reaches edge on edge's **proxy socket** (`services.ianitor.edge.proxySocket`, phase 4):
`/run/ianitor-proxy/edge.sock`, mode 0660, in a setgid directory of the group `ianitor-proxy`,
whose only members are edge, the Caddy fallback and Caddy (`proxySocket.users = [ "caddy" ]`).
Edge serves the HTTPS hosts there in plain HTTP (Caddy terminated TLS) and **believes the
X-Forwarded-For Caddy sends**, so the visit log and the share-link throttle see the visitor.
No other local user can connect, so none can claim an address; no loopback TCP port is
involved, and `trustedProxies` stays off. The Caddy fallback listens on the same socket
(compile option `proxy_socket`, a third Caddy server with `trusted_proxies_unix`), so an engine
switch keeps the two hosts reachable through Caddy.
- Edge's TCP listeners stay on **loopback only** (127.0.0.1:18080 and :18443), so D-21a holds:
nothing new is reachable from the LAN. Control is on 127.0.0.1:7878 (API tokens) and on its UI
socket `/run/ianitor-control/ui.sock` (the admin host, [../api.md](../api.md), "Sign-in").
- Every other host is untouched. Rollback: revert the patch and switch (below).
- Visitor addresses: Ianitor sees every visit coming from 127.0.0.1 (Caddy), so the share-link
throttle counts all visitors together and the visit log shows 127.0.0.0. The option
`services.ianitor.edge.trustedProxies = [ "127.0.0.1" ]` would make edge believe Caddy's
`X-Forwarded-For` instead, but edge listens on a TCP port on loopback that **any local user or
process can reach**, and any of them could then claim any address. It stays **off** for the
trial (the two hosts have no share links and no visit log); turn it on only on a machine where
every local account is trusted. (A Unix-socket listener for edge, which Caddy alone could reach,
is the proper fix; not built yet.)
- Until phase 4 this hop was TLS to 127.0.0.1:18443 with Domi certificates, and edge saw every
visitor as 127.0.0.1. The socket replaces it; the Domi root is no longer needed by Caddy.
## The patch