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{ lib, pkgs, ... }:
1{ config, lib, pkgs, ... }:
22let
33 adminKey = lib.fileContents ../config/admin.pub;
44 pool = "globe";
55 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 ];
68 encryptionRoots = {
79 apps = "apps";
810 clover = "clover";
......@@ -17,11 +19,24 @@ in
1719
1820 networking.hostName = "zenith";
1921 networking.hostId = "4fa19ccb";
20 networking.firewall.allowedTCPPorts = [ 80 443 ] ++ map (name: xmppNetwork.${name}) [ "c2s" "c2s_tls" "s2s" "turn" "turn_tls" ];
21 networking.firewall.allowedUDPPorts = [ xmppNetwork.turn xmppNetwork.turn_tls ];
22 networking.firewall.allowedTCPPorts = [ 80 443 ] ++ xmppTCPPorts;
23 networking.firewall.allowedUDPPorts = xmppUDPPorts;
2224 networking.firewall.allowedUDPPortRanges = [{ from = xmppNetwork.relay_first; to = xmppNetwork.relay_last; }];
2325 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
2540 boot.loader.systemd-boot.enable = true;
2641 boot.loader.efi.canTouchEfiVariables = true;
2742 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
2424provisions client, direct-TLS client, and federation SRV records pointing at
2525`xmpp.paperclover.net`; the website keeps its existing apex address. Router
2626forwarding 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
2932```sh
3033STUDIO_DEPLOY_HOST=root@10.0.0.1 STUDIO_DEPLOY_PORT=22 python3 tools/deploy.py prod
3134```
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
3354## Zenith preview, 2026-10-10
3455
3556Stage: `xmpp-preview-c035f9fb`
......@@ -37,13 +58,10 @@ Hostname: `xmpp-preview-c035f9fb.paperclover.net`
3758JID: `clover@xmpp-preview-c035f9fb.paperclover.net`
3859Dataset: `globe/staging/xmpp-preview-c035f9fb`
3960
40The generated password is in Nomad variables. Clover's Mac also has an
41owner-readable connection file at
42`~/.local/share/snowglobe/xmpp-preview.json`; credentials are not tracked here.
43Monal can use the preview JID and password with a manual server of `10.0.0.1`,
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`.
61The preview Nomad job and its transient firewall service were stopped for the
62production cutover. Its dataset, Nomad variables, and owner-readable Mac
63connection file at `~/.local/share/snowglobe/xmpp-preview.json` are retained.
64Preview account data was not copied into production.
4765
4866Delete the preview, including its accounts and history:
4967