Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/infra/spark/README-edge.md # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / infra / spark / README-edge.md` 156 lines · 10962 bytes Raw Blame History Rendered 1 # Spark front door (2026-11-08) 2 3 Drake, 2026-11-08: "I still want you to setup the front door". The Spark (LAN 192.168.1.108) 4 serves www.aienos.com, aienos.com, interplane.io and the forge in place of the hub Pi, whose root 5 filesystem is a USB flash stick (sdb, "USB 3.2.1 FD") with IO pressure at 92% (full avg10, measured 2026-11-08). 6 7 ## Shape 8 9 - nginx 1.24.0-2ubuntu7.19 (Ubuntu apt, plus libnginx-mod-stream) on the Spark. It is a host 10 dependency in the production path: TLS, HTTP and the SNI router. A future Omega replacement is 11 forged growing a TLS front end built on vetted crypto, not hand-rolled math. Until then, nginx stays. 12 - The config is the hub Pi's of the same day (`nginx -T` evidence), copied whole. Differences: 13 - The SNI router listens on `192.168.1.108:443` only. The tailnet :443 belongs to vaultwarden and `*:80` to apache. 14 - `hs.aienos.com` passes raw to the Pi (`192.168.1.192:443`), so Headscale keeps its own TLS and ACME. 15 Headscale now sees the Spark as the client address. 16 - `http2 on;` became `listen ... http2`, because nginx 1.24 predates `http2 on`. The Pi runs 1.28.3. 17 - Copies of the edited files are in `spark/nginx/`. Certificates are not in git. 18 - Upstreams are unchanged and already local to the Spark: 19 - forged at 127.0.0.1:18480 20 - the allen gateway at 100.64.0.2:18110 21 - agora at 100.64.0.2:18132 22 - `/rad/` git clone uses the Pi's radicle-httpd, reached at 127.0.0.1:8780 through the user unit 23 `edge-rad-tunnel.service` (`ssh -N -L 8780:127.0.0.1:8780 hub`). 24 - Site folders `/var/www/{aienos.com,aienos-code,aienos-hive,aienos-stats,interplane.io,replicate,si}` are pulled from the Pi. 25 - `edge-mirror.sh` runs every 5 minutes from `edge-mirror.timer`. 26 - The publishers still write to the Pi. 27 - Certificates renew on the Pi (acme.sh with Gandi DNS, so renewal works wherever :443 points). 28 `edge-certs.sh` copies them daily from `edge-certs.timer` and reloads nginx only on a change. 29 - Firewall: one rule in `/etc/atlas/ingress.nft` and live: 30 `iifname "enP7s7" ip daddr 192.168.1.108 tcp dport 443 accept`. 31 The backup is `ingress.nft.bak-edge-20261108T114750Z`. 32 - Stats: `~/handoffs/forge/stats/collect.sh` also reads the Spark's `/var/log/nginx/aienos-dl.log*`. 33 34 ## Verified before the router change (2026-11-08, from the LAN with curl --resolve) 35 36 - 32 paths answered the same on the Spark and the Pi: status, body sha256 and security headers. 37 - main site, .md files, install, si, replicate, agent-prompt 38 - hive live.json and board 39 - stats, code page, code zip, code git refs, Radicle git refs 40 - forge, allen presence and infer-info, agora hello 41 - interplane.io pages, www.interplane.io, the apex redirect 42 - hs.aienos.com /health answered 200. 43 - An unknown name was refused (TLS reset, as on the Pi). 44 - `git clone` of a Radicle repo through the Spark gave the same head as through the Pi. 45 46 ## Switch (Drake, on the Calix router at https://192.168.1.1) 47 48 1. Reserve 192.168.1.108 for the Spark (MAC 4c:bb:47:2b:b8:7b). Its address comes from DHCP today. 49 2. Change the port-forward rule for TCP 443 from 192.168.1.192 to 192.168.1.108. Leave every other rule alone. 50 51 ## Undo 52 53 1. On the router, point TCP 443 back to 192.168.1.192. This alone restores the old front door. 54 2. Optional, on the Spark: 55 - `sudo systemctl disable --now nginx` 56 - `systemctl --user disable --now edge-mirror.timer edge-certs.timer edge-rad-tunnel.service` 57 - Restore `/etc/atlas/ingress.nft` from the backup above, then reload the firewall: 58 `sudo systemctl restart atlas-ingress`. Check that service's ExecStart first. 59 - The Spark's original nginx config is in `/etc/nginx.dist-20261108T114650Z`. 60 61 ## Plain http (port 80), 2026-11-09 (forge-iplreach, L1008 QW1) 62 63 Found: `http://interplane.io/` (and every other name on plain http) timed out for outside visitors. 64 https answered. Evidence, 2026-11-09 00:0xZ to 00:33Z: 65 66 - check-host.net: http 0 of 48 node answers for the four names, https 47 of 48. 67 Control sites (example.com, wikipedia.org) lose 1 to 2 of 20 nodes on https, so the https misses are checker noise. 68 - An outside fetch tool got no content for `http://interplane.io/` and the full page for `https://`. 69 This is how "interplane.io timed out" can come from a tool while curl to https gives 200. 70 - Packet captures on the Spark's and the Pi's LAN ports during an outside http check: 0 SYNs for port 80 on either. 71 The router does not forward TCP 80 at all. 72 - From inside the house, `http:///` is answered by the router's own web server 73 (`Server: micro_httpd`, a script redirect to https). That is why it looked fine from the LAN. 74 75 Fix, in two parts: 76 77 1. **Spark (this repo, reviewed before deploy).** 78 - `spark/nginx/sites-http-redirect` answers 301 to `https://` for the four names. 79 It closes the connection (444) for any other name, as :443 refuses unknown TLS names. 80 - It listens on `192.168.1.108:4480`. A prerouting rule in the atlas firewall (chain `http80_redirect`) 81 moves public TCP 80 there. 82 - apache2 keeps `*:80` (Ubuntu default page). The firewall keeps that apache unreachable from the 83 network, and no process I did not start is restarted. 84 - Apply: `sudo bash infra/spark/edge-http-apply.sh infra` (backs up `/etc/atlas/ingress.nft`, then 85 checks from the Pi). If the nginx reload itself fails, apply rolls back. If that rollback's reload 86 also fails, it says so instead of claiming nginx was reloaded. Undo: `sudo bash infra/spark/edge-http-rollback.sh`, 87 which uses the newest `/etc/nginx/forge-backups/http80-*`. 88 - Checks: `bash infra/spark/edge-http-checks.sh`. Rehearsal: `sudo bash infra/test/http80-netns.sh `, 89 which runs in throwaway network and mount namespaces. 90 2. **Router (Drake, Calix at https://192.168.1.1).** Add a port-forward rule: TCP 80 to 192.168.1.108, 91 the same machine as the TCP 443 rule. Leave every other rule alone. Undo: delete that rule. 92 93 `bash infra/smoke.sh reach` checks the whole path for each name and exits 3 if any part fails: 94 95 - DNS from 1.1.1.1 and 8.8.8.8; 96 - https and certificate days, from the Pi; 97 - http to https, from the Pi; 98 - outside nodes on check-host.net. 99 - A name that is not a DNS name, or a REACH_ADDR that is not four dotted octets 0..255, is refused 100 before dig, ssh or curl run. The certificate check passes the address and name as arguments. 101 102 check-host.net is a read-only outside checker (verification oracle). Nothing depends on it in production. 103 104 Smoke from the Spark itself: its requests to its own public address lose packets at the router. 105 Measured: 4 of 40 timed out at 15 s, and TLS stalled up to 10 s. Requests from the Mac and the Pi 106 lost 0 of 40 and 0 of 20. Real outside connections retransmit 0.12% of bytes, against 3.7% on the 107 Spark's own turnaround connections. So `smoke.sh reach` runs its curls on the Pi. 108 109 ## Dead ssh sessions hold forwarded ports (aien-floor-edge restarts), 2026-11-09 110 111 The hub stalled at about 13:48 CST on 2026-11-08 ("Timeout, server hub not responding" at 13:49:06). 112 After that, `aien-floor-edge` (`ssh -R 127.0.0.1:4748:… hub`) failed 1296 times with "remote port 113 forwarding failed for listen port 4748", from 13:52:49 to 15:59:43. It held again at 15:59:48. 114 115 The hub's sshd runs with `ClientAliveInterval 0`. A session whose client vanished therefore keeps its 116 forwarded port until TCP keepalive gives up: 7200 s + 9 × 75 s = 7875 s. The observed hold was 7842 s 117 from the client's own timeout, inside the 7830 to 7875 s window. 118 119 forged-tunnel (18480) and rad-hub-tunnel (18776) use the same `-R` shape and the same hub sshd. 120 121 Fix: `hub/sshd-forward-keepalive.conf` sets `ClientAliveInterval 15` and `ClientAliveCountMax 4`, so a 122 dead session is dropped after about 75 s (sshd drops it at the 5th unanswered ask; measured 75 s on 2026-11-09T03:35Z). 123 124 - Apply on the hub: `sudo bash /hub/sshd-keepalive-apply.sh ` 125 (`sshd -t`, reload, `sshd -T` must be 15/4). A failed reload removes the drop-in. If `sshd -T` 126 is not 15/4 after the reload, the drop-in is removed and ssh is reloaded back. 127 - Undo: `hub/sshd-keepalive-rollback.sh`. 128 - Rehearsal: `sudo bash infra/test/sshd-keepalive.sh `. 129 130 With the front door on the Spark, `www.aienos.com/now/` is served from the Spark's own 131 127.0.0.1:4748. The tunnel only matters if the router goes back to the Pi. The unit belongs to the 132 factory floor lane (`~/workspace/aien-factory/edge/`); its file is not changed here. 133 134 ### Evidence (forge-iplreach, 2026-11-09) 135 136 | check | label | result | 137 |---|---|---| 138 | `test/http80-netns.sh` (copy of the live firewall in a throwaway netns) | HOST_TESTED | 21 passed, 0 failed (2026-11-09T03:31Z). N1: http times out (rc 28). Apply: 8 of 8 checks. M1 mutant caught. N2 re-apply refused. Rollback: firewall file byte-identical, :80 times out again. N3: a reload command that always fails rolls back and does not claim success. N4: a reload that fails once rolls back, and that rollback's reload succeeds | 139 | `test/netns-refuse.sh` | HOST_TESTED | 10 passed, 0 failed. A second run refuses and leaves the first run's namespaces and sleep processes alone. A missing scratch directory exits 2 before any trap | 140 | `test/sshd-keepalive.sh` (Spark OpenSSH in a netns; dead client = black-holed flow + SIGKILL) | HOST_TESTED | 6 passed, 0 failed. A (no drop-in): 4748 still held after 100 s. B (drop-in): 4748 freed 75 s after the client died, client 2 gets the forward | 141 | `test/sshd-keepalive-scripts.sh` (ubuntu:26.04, OpenSSH_10.2p1 Ubuntu-2ubuntu3.8) | HOST_TESTED | 11 passed, 0 failed: apply 0/3 to 15/4, re-apply refused, rollback restores 0/3 and 10 files byte-identical, broken drop-in removed, failed reload removes the drop-in, a drop-in sshd does not read is removed and ssh is reloaded back | 142 | `test/reach-reject.sh` | EXERCISED | 10 passed, 0 failed. A quote, a space, a short address, octet 999 and a five-part address are refused before dig, ssh or curl. A quoted name does not create a file. A real IPv4 is passed as an argument | 143 | `smoke.sh reach interplane-dead.invalid` with REACH_OUTSIDE=0 | EXERCISED | rc 3, 0 passed, 4 failed (empty DNS, no address) | 144 | check-host.net for interplane.io, 2026-11-09T03:28Z | EXERCISED | http: 0 of 12 nodes answered (11 timed out, 1 did not report). https: 11 nodes HTTP 200, 1 did not report | 145 | live apply on the Spark and the hub, router TCP 80 rule | NOT_RUN | waits for a bay MERGE on this head, then Drake's router rule | 146 147 ## Next (not done) 148 149 - Point the publishers at the Spark directly, then retire `edge-mirror`: 150 - aienos.com deploy 151 - interplane.io `sync-to-hub.sh` (HUB/WEBDIR) 152 - codepage `publish.sh` 153 - `hive-publish` (`HIVE_EDGE_HOST`) 154 - stats `collect.sh` (STATS_HUB/STATS_DEST) 155 - Run radicle-httpd, or my own equivalent, on the Spark so `/rad/` stops depending on the Pi. 156 - Headscale stays on the Pi. If the Spark is down, hs.aienos.com is unreachable from outside too.