[deploy] Proxy socket (QC minors 2 and 3): its directory is sticky (3770) so the front proxy cannot unlink edge's socket, each engine clears a stale one as root before start and after stop, and proxySocket.services puts the group in the front proxy's unit so the switch restarts it; beside-caddy.md checks Caddy's groups and says X-Forwarded-Proto is always https
This commit is contained in:
@@ -32,6 +32,11 @@ visitor ── Caddy :443 (as today) ── unix:/run/ianitor-proxy/edge.sock
|
||||
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.
|
||||
Edge always tells the upstream `X-Forwarded-Proto: https` for requests on the socket, so the
|
||||
socket is for a front proxy that serves HTTPS only (Caddy redirects plain HTTP itself); a front
|
||||
proxy that forwarded plain-HTTP requests there would have them reported as HTTPS.
|
||||
The directory is sticky (3770), so Caddy, a member of the group, can connect but cannot unlink
|
||||
or replace edge's socket; each engine clears a stale socket as root when it starts and stops.
|
||||
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
|
||||
@@ -88,6 +93,18 @@ scripts/staging/Deploy-Staging.ps1 -Mode Test
|
||||
scripts/staging/Deploy-Staging.ps1 -Mode Switch
|
||||
```
|
||||
|
||||
After the first switch, make sure Caddy runs with its new group (QC phase 4): a reload, which is what NixOS's
|
||||
Caddy module does when only its config changes, keeps a process's old groups, and edge's socket then answers
|
||||
Caddy with EACCES (502 for the two hosts). The patch puts the group into Caddy's unit
|
||||
(`proxySocket.services = [ "caddy" ]`), which changes the unit, so the switch should restart Caddy; check it, and
|
||||
restart by hand if not:
|
||||
|
||||
```sh
|
||||
gid=$(getent group ianitor-proxy | cut -d: -f3)
|
||||
grep "^Groups:" /proc/$(systemctl show -p MainPID --value caddy)/status | grep -qw "$gid" \
|
||||
|| sudo systemctl restart caddy
|
||||
```
|
||||
|
||||
On the mirror, the first intermediate and the two hosts:
|
||||
|
||||
```sh
|
||||
|
||||
Reference in New Issue
Block a user