authoravatarclover caruso<git@paperclover.net>2026-10-10 19:03:47-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-21 02:52:29-07:00
loge026ca3b39513d4b8c9911a4cbe43d60fa13d3b1
tree8dc4bd0523db21ad488039fa5bd09145ac2f513f
parent5cfea3f1ff45315f1533925d70d966845fdc7cce
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Renew XMPP router mappings automatically

Refresh UPnP forwarding at boot and every five minutes, deriving all listeners and relay ports from the XMPP network definition. Record production protocol checks and preserve the stopped preview. Assisted-by: gpt-6

2 files changed, 44 insertions(+), 11 deletions(-)

nixos/zenith.nix+18-3
...@@ -1,8 +1,10 @@...@@ -1,8 +1,10 @@
1{ lib, pkgs, ... }:1{ config, lib, pkgs, ... }:
2let2let
3 adminKey = lib.fileContents ../config/admin.pub;3 adminKey = lib.fileContents ../config/admin.pub;
4 pool = "globe";4 pool = "globe";
5 xmppNetwork = builtins.fromJSON (builtins.readFile ../service/xmpp/network.json);5 xmppNetwork = builtins.fromJSON (builtins.readFile ../service/xmpp/network.json);
6 xmppTCPPorts = map (name: xmppNetwork.${name}) [ "c2s" "c2s_tls" "s2s" "turn" "turn_tls" ];
7 xmppUDPPorts = [ xmppNetwork.turn xmppNetwork.turn_tls ];
6 encryptionRoots = {8 encryptionRoots = {
7 apps = "apps";9 apps = "apps";
8 clover = "clover";10 clover = "clover";
...@@ -17,11 +19,24 @@ in...@@ -17,11 +19,24 @@ in
1719
18 networking.hostName = "zenith";20 networking.hostName = "zenith";
19 networking.hostId = "4fa19ccb";21 networking.hostId = "4fa19ccb";
20 networking.firewall.allowedTCPPorts = [ 80 443 ] ++ map (name: xmppNetwork.${name}) [ "c2s" "c2s_tls" "s2s" "turn" "turn_tls" ];22 networking.firewall.allowedTCPPorts = [ 80 443 ] ++ xmppTCPPorts;
21 networking.firewall.allowedUDPPorts = [ xmppNetwork.turn xmppNetwork.turn_tls ];23 networking.firewall.allowedUDPPorts = xmppUDPPorts;
22 networking.firewall.allowedUDPPortRanges = [{ from = xmppNetwork.relay_first; to = xmppNetwork.relay_last; }];24 networking.firewall.allowedUDPPortRanges = [{ from = xmppNetwork.relay_first; to = xmppNetwork.relay_last; }];
23 networking.firewall.interfaces.enp4s0.allowedTCPPorts = [ 445 ];25 networking.firewall.interfaces.enp4s0.allowedTCPPorts = [ 445 ];
2426
27 systemd.services.xmpp-nat = {
28 wantedBy = [ "multi-user.target" ];
29 wants = [ "network-online.target" ];
30 after = [ "network-online.target" ];
31 startAt = "*:0/5";
32 serviceConfig = { Type = "oneshot"; DynamicUser = true; };
33 script = ''
34 ${pkgs.miniupnpc}/bin/upnpc -u http://${config.networking.defaultGateway.address}:1900/whaoc/rootDesc.xml -e "Snow Globe XMPP" -r \
35 ${lib.concatMapStringsSep " " (port: "${toString port} TCP") xmppTCPPorts} \
36 ${lib.concatMapStringsSep " " (port: "${toString port} UDP") (xmppUDPPorts ++ lib.range xmppNetwork.relay_first xmppNetwork.relay_last)}
37 '';
38 };
39
25 boot.loader.systemd-boot.enable = true;40 boot.loader.systemd-boot.enable = true;
26 boot.loader.efi.canTouchEfiVariables = true;41 boot.loader.efi.canTouchEfiVariables = true;
27 boot.zfs.forceImportRoot = false;42 boot.zfs.forceImportRoot = false;
tools/xmpp.md+26-8
...@@ -24,12 +24,33 @@ Production firewall rules are declared in `nixos/zenith.nix`. The DNS provider...@@ -24,12 +24,33 @@ Production firewall rules are declared in `nixos/zenith.nix`. The DNS provider
24provisions client, direct-TLS client, and federation SRV records pointing at24provisions client, direct-TLS client, and federation SRV records pointing at
25`xmpp.paperclover.net`; the website keeps its existing apex address. Router25`xmpp.paperclover.net`; the website keeps its existing apex address. Router
26forwarding must send the TCP listeners, UDP TURN listeners, and UDP relay range26forwarding must send the TCP listeners, UDP TURN listeners, and UDP relay range
27to Zenith. Production activation uses the normal described-main deployment:27to Zenith. `xmpp-nat.service` refreshes UPnP mappings on startup and every five
28minutes, using the Archer AX3000's description URL at the configured gateway.
29The description is fetched directly; multicast SSDP discovery failed on this
30host. Production activation uses the normal described-main deployment:
2831
29```sh32```sh
30STUDIO_DEPLOY_HOST=root@10.0.0.1 STUDIO_DEPLOY_PORT=22 python3 tools/deploy.py prod33STUDIO_DEPLOY_HOST=root@10.0.0.1 STUDIO_DEPLOY_PORT=22 python3 tools/deploy.py prod
31```34```
3235
36## Zenith production, 2026-10-10
37
38The owner-readable connection file on Clover's Mac is
39`~/.local/share/snowglobe/xmpp.json`. Monal can use the production JID and its
40generated password; the explicit server is `xmpp.paperclover.net`, port `5223`,
41with direct TLS. Client and federation SRV records resolve to that server.
42
43Verified through the public address from the home LAN: TLS authentication, two
44resources, carbons, MAM retrieval, stream resumption, PEP publication/deletion,
45private group creation/history/destruction, PNG upload/download, WebSocket,
46authenticated UDP TURN allocation/deallocation, relay address/range, rejection
47of a private peer, STARTTLS, and TURN TLS certificate validation. All three tasks
48had zero restarts. The normal deployment took backup
49`20261011T015942Z-a7e251` and passed all service route checks. A transient systemd
50probe confirmed UPnP refresh works with `DynamicUser`. Off-LAN calls, iOS push
51delivery, federation with another server, and recovery after a router restart
52need client-side verification.
53
33## Zenith preview, 2026-10-1054## Zenith preview, 2026-10-10
3455
35Stage: `xmpp-preview-c035f9fb` 56Stage: `xmpp-preview-c035f9fb`
...@@ -37,13 +58,10 @@ Hostname: `xmpp-preview-c035f9fb.paperclover.net`...@@ -37,13 +58,10 @@ Hostname: `xmpp-preview-c035f9fb.paperclover.net`
37JID: `clover@xmpp-preview-c035f9fb.paperclover.net` 58JID: `clover@xmpp-preview-c035f9fb.paperclover.net`
38Dataset: `globe/staging/xmpp-preview-c035f9fb`59Dataset: `globe/staging/xmpp-preview-c035f9fb`
3960
40The generated password is in Nomad variables. Clover's Mac also has an61The preview Nomad job and its transient firewall service were stopped for the
41owner-readable connection file at62production cutover. Its dataset, Nomad variables, and owner-readable Mac
42`~/.local/share/snowglobe/xmpp-preview.json`; credentials are not tracked here.63connection file at `~/.local/share/snowglobe/xmpp-preview.json` are retained.
43Monal can use the preview JID and password with a manual server of `10.0.0.1`,64Preview account data was not copied into production.
44port `5223`, and direct TLS while on the home LAN. The public hostname serves
45HTTPS media and WebSocket; public native connections require router forwarding
46to Zenith for the listeners and UDP relay range in `network.json`.
4765
48Delete the preview, including its accounts and history:66Delete the preview, including its accounts and history:
4967