[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:
@@ -27,29 +27,26 @@ diff --git a/hyperv-infra/modules/caddy.nix b/hyperv-infra/modules/caddy.nix
|
||||
index e79f6b2..6fb5a49 100644
|
||||
--- a/hyperv-infra/modules/caddy.nix
|
||||
+++ b/hyperv-infra/modules/caddy.nix
|
||||
@@ -225,6 +225,21 @@ in
|
||||
@@ -225,6 +225,18 @@ in
|
||||
Referrer-Policy "strict-origin-when-cross-origin"
|
||||
}
|
||||
'';
|
||||
+ # The Ianitor trial (modules/ianitor.nix): Caddy keeps the public side and hands the request
|
||||
+ # to Ianitor edge on loopback, over TLS with a Domi certificate it checks against the Domi
|
||||
+ # root. Host and SNI are the visitor's name.
|
||||
+ # to Ianitor edge on its proxy socket, /run/ianitor-proxy/edge.sock (0660, group
|
||||
+ # ianitor-proxy, which Caddy joins and no other local user is in). Edge believes the
|
||||
+ # X-Forwarded-For Caddy sends there, so the visit log and the share-link throttle see the
|
||||
+ # visitor; no loopback TCP port is involved. Host is the visitor's name.
|
||||
+ viaIanitor = host: {
|
||||
+ extraConfig = ''
|
||||
+ tls internal
|
||||
+ ${secureHeaders "SAMEORIGIN"}
|
||||
+ reverse_proxy https://127.0.0.1:18443 {
|
||||
+ transport http {
|
||||
+ tls_server_name ${host}
|
||||
+ tls_trusted_ca_certs ${../ianitor/domi-root.crt}
|
||||
+ }
|
||||
+ }
|
||||
+ reverse_proxy unix//run/ianitor-proxy/edge.sock
|
||||
+ '';
|
||||
+ };
|
||||
simple = { frame ? "SAMEORIGIN", upstream }: {
|
||||
extraConfig = ''
|
||||
tls internal
|
||||
@@ -252,7 +267,11 @@ in
|
||||
@@ -252,7 +264,11 @@ in
|
||||
# flowers - was `localhost:8085`, which is PRODUCTION's port. On the mirror the app is
|
||||
# published on 127.0.0.1:8092 and fronted by nginx on 8091, matching production's topology
|
||||
# (nginx in front, not Caddy straight to the container). Proxying to 8085 reached nothing.
|
||||
@@ -67,7 +64,7 @@ new file mode 100644
|
||||
index 0000000..cd23016
|
||||
--- /dev/null
|
||||
+++ b/hyperv-infra/modules/ianitor.nix
|
||||
@@ -0,0 +1,49 @@
|
||||
@@ -0,0 +1,52 @@
|
||||
+{ config, lib, inputs, ... }:
|
||||
+
|
||||
+# Ianitor beside Caddy (Ianitor ROADMAP §1.12, Phase 3): two low-risk hosts, flowers and esp32,
|
||||
@@ -76,11 +73,12 @@ index 0000000..cd23016
|
||||
+# Shape, chosen to keep decision D-21a ("Caddy is the only thing on 80/443 and the only service
|
||||
+# exposed beyond loopback"):
|
||||
+#
|
||||
+# visitor -> Caddy :443 (tls as today) -> https://127.0.0.1:18443 Ianitor edge -> the app
|
||||
+# visitor -> Caddy :443 (tls as today) -> unix socket /run/ianitor-proxy/edge.sock -> Ianitor edge -> the app
|
||||
+#
|
||||
+# Ianitor edge listens on loopback only (18080/18443) and terminates TLS with a Domi certificate;
|
||||
+# Caddy trusts the Domi root (a public certificate, ianitor/domi-root.crt) for that hop. Control
|
||||
+# listens on 127.0.0.1:7878. Nothing new is reachable from the LAN.
|
||||
+# Ianitor edge serves Caddy on its proxy socket (group ianitor-proxy: Caddy is the only member),
|
||||
+# and believes the X-Forwarded-For Caddy sends there. Its TCP listeners stay on loopback only
|
||||
+# (18080/18443, Domi certificates). Control listens on 127.0.0.1:7878 for API tokens and on its
|
||||
+# UI socket for the admin host. Nothing new is reachable from the LAN.
|
||||
+#
|
||||
+# Secrets come from sops-nix (paths under /run/secrets, never the store); the module asserts it.
|
||||
+# Rollback: remove this import and the two `viaIanitor` lines in caddy.nix, nixos-rebuild switch.
|
||||
@@ -100,6 +98,8 @@ index 0000000..cd23016
|
||||
+ httpListen = "127.0.0.1:18080";
|
||||
+ httpsListen = "127.0.0.1:18443";
|
||||
+ openFirewall = false;
|
||||
+ # Caddy reaches edge here; only Caddy joins the socket's group.
|
||||
+ proxySocket = { enable = true; users = [ "caddy" ]; };
|
||||
+ };
|
||||
+ control.listen = "127.0.0.1:7878";
|
||||
+ shareLinkKeyFile = config.sops.secrets."ianitor/share-link-key".path;
|
||||
|
||||
Reference in New Issue
Block a user