aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / om / agora / deploy / DEPLOY.md
| 1 | # Registration-only deployment |
| 2 | |
| 3 | Operator authorization is required. This deployment exposes only the Aienet signup |
| 4 | flow: GET `/agora/api/challenge`, POST `/agora/api/hello`, and GET |
| 5 | `/agora/api/agent/<16 lowercase hex digits>`. It does not activate posts, |
| 6 | federation, MCP/A2A, Aien replies, device enrollment, jobs or settlement. |
| 7 | |
| 8 | ## Build and identity |
| 9 | |
| 10 | Use the source revision approved for release. The compiler SHA256 is |
| 11 | `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. |
| 12 | Run `OMEGA_OMC=<pinned executable> sh om/agora/check.sh`, the page generator |
| 13 | check, `node scripts/test-aienet.cjs`, `cargo test --workspace`, and the release |
| 14 | site build. Require the final integrity verdict to pass. Preserve source and |
| 15 | binary hashes separately from deployment evidence. |
| 16 | |
| 17 | Build the server from `om2`, `sha256.om`, `http.om`, then `agora.om`, in that |
| 18 | order. A layout after a function is compiler error 29. A failed compilation |
| 19 | must not leave an executable that can be installed as a successful build. |
| 20 | |
| 21 | ## Backend account, state and network |
| 22 | |
| 23 | The service uses the dedicated `aien-agora` system account and group. Check whether |
| 24 | they exist before installation. If absent, create a locked system account with |
| 25 | home `/var/lib/aien-agora`, no login shell and no additional groups. Do not reuse |
| 26 | an interactive human account. Install the verified executable root-owned at |
| 27 | `/opt/aien/bin/agora` with mode 0755. `StateDirectory=aien-agora` creates persistent |
| 28 | state with mode 0750; `UMask=0077` keeps new state private. Preserve this directory |
| 29 | on rollback and upgrades. |
| 30 | |
| 31 | The committed unit defaults to loopback and permits only loopback IP traffic. |
| 32 | For a separate trusted proxy host, installation additionally requires: |
| 33 | |
| 34 | - Root-owned `/etc/aien-agora/runtime.env`, mode 0600, containing |
| 35 | `AGORA_LISTEN=<the approved private backend address>`. |
| 36 | - A root-owned systemd drop-in that clears `IPAddressAllow=` and then allows |
| 37 | only `127.0.0.1/32` and the exact approved proxy address with its host prefix. |
| 38 | Retain `IPAddressDeny=any`. Never substitute a whole private network. |
| 39 | - Inspection of the effective unit, drop-ins and ancestor slices. Allow lists |
| 40 | accumulate; an unrelated broad allowance is not overridden by a narrow one. |
| 41 | |
| 42 | Keep host addresses in local configuration, not public source. Install only |
| 43 | `aien-agora.service`; do not install the drainer, federation puller or JSON edge. |
| 44 | Before public routing, prove that the actual service has ingress/egress cgroup |
| 45 | BPF filters attached, the trusted proxy can reach it, and a demonstrably |
| 46 | reachable disallowed source cannot. Unsupported filtering is a deployment |
| 47 | refusal, not permission to expose the listener. Check that there is no alternate |
| 48 | wildcard, IPv6 or socket-activated listener. Enable startup only after these |
| 49 | checks pass. This boundary trusts the proxy host and permitted local tools; |
| 50 | it is not authentication of individual processes on those hosts. |
| 51 | |
| 52 | ### Exact effective policy observations |
| 53 | |
| 54 | Read machine properties by name, not their display order. `IPAddressAllow` and |
| 55 | `IPAddressDeny` are sets of prefixes: require exact equality with the approved |
| 56 | allow set and with `{::/0, 0.0.0.0/0}` respectively. Reordered prefixes and |
| 57 | whitespace do not change a policy; a missing deny prefix or an extra allowance |
| 58 | does. Never use a substring or a contains-only comparison. |
| 59 | |
| 60 | The native `policy.om` comparator takes the observed allow and deny values plus |
| 61 | the expected proxy and loopback prefixes as runtime inputs. Keep actual host |
| 62 | addresses in the root-owned local configuration, not public fixture source. |
| 63 | The standalone `policy-check.om` CLI accepts `ALLOW DENY EXPECTED_PROXY |
| 64 | EXPECTED_LOCAL` and exits 0 for exact sets, 1 for refusal, or 90 for malformed |
| 65 | invocation. Its no-argument fixtures cover both display orders and negative |
| 66 | controls for missing deny prefixes and extra allowances. |
| 67 | |
| 68 | Before a live retry, replay the retained real observer output offline and |
| 69 | record an explicit pass/fail table. Exercise each guarded field unchanged, |
| 70 | changed and removed. A pre-exec observation is pending, not proof that a |
| 71 | listening backend runs with those credentials; late journal metadata is not |
| 72 | an atomic substitute for the bracketed executable, credentials and listener |
| 73 | observation. An observer failure still stops activation and requires rollback. |
| 74 | |
| 75 | Compose `om2`, `json.om`, `policy.om` and `observer-check.om` for the native |
| 76 | raw-output oracle. Its modes are `unit`, `state`, `exec`, `snapshot`, `ps`, |
| 77 | `journal` and `ancestors`. Pass the original captured output and the explicit |
| 78 | expected identities as separate arguments; fields must be shorter than 4095 |
| 79 | bytes. The oracle exits 0 for its predicate passing, 1 for refusal, 2 for a |
| 80 | pending observation, or 90 for an invalid or oversized invocation. These are |
| 81 | not the startup policy CLI's exit codes. A journal predicate proves only that |
| 82 | historical message's provenance, never current socket readiness. |
| 83 | |
| 84 | Keep ExecStart's displayed `${AGORA_LISTEN}` separate from the resolved |
| 85 | process command line. Do not compare displayed timestamps, queue sizes, |
| 86 | descriptor numbers, process-column padding or decimal leading zeroes as |
| 87 | identity facts. Continue to require the exact executable, credentials, |
| 88 | endpoint, PID, property names and prefix sets. |
| 89 | |
| 90 | Collect ancestor properties with options before the end-of-options marker: |
| 91 | `systemctl show -p IPAddressAllow -p IPAddressDeny -- -.slice`, then the same |
| 92 | command for `system.slice`. Require both properties to be present and empty |
| 93 | in each selected unit's output. `observer ancestors RAW EXPECTED_RECORDS` |
| 94 | accepts one record or two blank-delimited records; it rejects missing, |
| 95 | duplicated, unknown or nonempty properties. A noisy query that accidentally |
| 96 | selects `-p.service` is not policy evidence. |
| 97 | |
| 98 | ## Nginx scopes and exact routes |
| 99 | |
| 100 | Install `nginx-agora-http.conf` at HTTP scope, for example under |
| 101 | `/etc/nginx/conf.d/`. Its `limit_req_zone` directive is invalid inside a server. |
| 102 | Install `nginx-agora.conf` as a snippet included inside the existing website TLS |
| 103 | server. Create the root-owned local `/etc/nginx/snippets/agora-upstream.conf` |
| 104 | from `agora-upstream.conf.example`, replacing its loopback server with the exact |
| 105 | approved private backend address when the hosts differ. |
| 106 | |
| 107 | Preserve the existing SNI router and loopback-only PROXY-protocol TLS listener. |
| 108 | Both limiting and forwarded `X-Real-IP` use `$proxy_protocol_addr`, never a |
| 109 | visitor-supplied HTTP header. Empty PROXY identity refuses all allowed API routes. |
| 110 | `X-Forwarded-For` is stripped. The non-PROXY TLS listener must therefore refuse |
| 111 | API calls. The configuration deliberately refuses HEAD, rather than relying on |
| 112 | `limit_except GET`, which also permits HEAD. |
| 113 | |
| 114 | Only the three registration routes proxy. The prefix fallback returns 404 |
| 115 | locally, including post, import, note, peer and stream requests. Request bodies |
| 116 | are capped and buffered at 16k. API access logging, API error/debug logging and |
| 117 | proxy caching are off; responses carry no-store and nosniff. The API-specific |
| 118 | `error_log /dev/null crit` suppresses API body debug logs. Header processing |
| 119 | precedes location selection: require no effective server/connection debug logging, |
| 120 | including `debug_connection` overrides, before activation. Inspect the complete |
| 121 | configuration and body-temporary-file settings; no recovery keys belong in receipts. |
| 122 | |
| 123 | Back up the affected configuration with root-only permissions. Validate the |
| 124 | complete candidate configuration with `nginx -t` before reloading. Do not restart |
| 125 | nginx or touch unrelated model routes. If any prerequisite fails, leave routing |
| 126 | disabled rather than broadening the allow list or trusting arbitrary headers. |
| 127 | |
| 128 | ### Verified configuration transfer |
| 129 | |
| 130 | Transfer each candidate, including the existing website server file, through a |
| 131 | root-only regular temporary file on the destination host. Do not use |
| 132 | `install /dev/stdin DEST`: the hub's uutils coreutils 0.8.0 installer refuses that |
| 133 | source when `DEST` already exists, although installing a new destination works. |
| 134 | Installing from a regular file works for both cases. |
| 135 | |
| 136 | For each already reviewed candidate, record its expected SHA256 before transfer. |
| 137 | On the destination host, create a root-owned temporary file using |
| 138 | `sudo mktemp /root/aien-agora-config.XXXXXX`; require mode 0600. Transfer the |
| 139 | candidate bytes into that file with `sudo tee "$tmp" >/dev/null`, not `install`. |
| 140 | Require `sudo sha256sum "$tmp"` to equal the expected digest before installation. |
| 141 | After backing up the destination with root-only permissions (or recording that |
| 142 | it was absent), run: |
| 143 | |
| 144 | ```sh |
| 145 | sudo install -o root -g root -m 0644 "$tmp" "$dest" |
| 146 | actual=$(sudo sha256sum "$dest") |
| 147 | actual=${actual%% *} |
| 148 | test "$actual" = "$expected" || exit 1 |
| 149 | sudo rm -- "$tmp" |
| 150 | ``` |
| 151 | |
| 152 | A transfer or installed-file digest mismatch is FAIL: stop and roll back, never |
| 153 | reload an unverified candidate. Remove the root-only temporary file on failure |
| 154 | as well. Check every installed file, not only the new snippet files. This |
| 155 | procedure changes the transfer mechanism, not the approved configuration, |
| 156 | network boundary, reload barrier or deployment acceptance gates. |
| 157 | |
| 158 | ### Firewall preflight |
| 159 | |
| 160 | The tcp/18132 accept rule is not yet approved or applied. Run this preflight |
| 161 | before starting the unit. Do not add the rule. On the Spark, nftables table |
| 162 | `inet atlas_ingress` handles input before the unit's systemd IP filter. Its |
| 163 | input chain policy is drop, and port 18132 is not accepted there. Adding the |
| 164 | rule needs Drake's explicit approval. This preflight does not insert it, does |
| 165 | not authorize a temporary rule, and does not write `/etc/nftables.conf`. |
| 166 | |
| 167 | Back up only table `inet atlas_ingress`, once, before any 18132 rule exists. |
| 168 | The path is `/root/aien-agora-atlas-ingress.nft`. If that file is already |
| 169 | present, leave it. Do not overwrite it, and do not delete it in order to take |
| 170 | a new snapshot after the 18132 rule exists. A snapshot taken then would put |
| 171 | the rule back in the live table on restore, while `/etc/nftables.conf` says |
| 172 | the port is closed. The file is one atomic restore: the line |
| 173 | `table inet atlas_ingress`, then `delete table inet atlas_ingress`, then the |
| 174 | saved table from `nft list table inet atlas_ingress`. It is root-owned, mode |
| 175 | 0600, and it must contain no port 18132 rule. |
| 176 | |
| 177 | ```sh |
| 178 | backup=/root/aien-agora-atlas-ingress.nft |
| 179 | portre='dport[[:space:]]+18132([^0-9]|$)|dport[[:space:]]*\{[[:space:]]*18132([^0-9]|$)|dport[[:space:]]*\{[^}]*[^0-9]18132([^0-9]|$)' |
| 180 | if sudo test -e "$backup"; then |
| 181 | sudo test "$(sudo stat -c '%u %g %a' "$backup")" = '0 0 600' || exit 1 |
| 182 | sudo awk 'NR==1 && $0!="table inet atlas_ingress" { exit 2 } |
| 183 | NR==2 && $0!="delete table inet atlas_ingress" { exit 2 } |
| 184 | NR==3 && $0!="table inet atlas_ingress {" { exit 2 } |
| 185 | END { if (NR<3) exit 2 }' "$backup" || exit 1 |
| 186 | test "$(sudo grep -E -c "$portre" "$backup" || true)" = 0 || exit 1 |
| 187 | else |
| 188 | list=$(sudo nft -a list chain inet atlas_ingress input) || exit 1 |
| 189 | test "$(printf '%s\n' "$list" | grep -E -c "$portre" || true)" = 0 || exit 1 |
| 190 | sudo sh -c 'printf "%s\n" "table inet atlas_ingress" "delete table inet atlas_ingress" > "$1"' sh "$backup" |
| 191 | sudo nft list table inet atlas_ingress | sudo tee -a "$backup" >/dev/null |
| 192 | sudo chown root:root "$backup" |
| 193 | sudo chmod 0600 "$backup" |
| 194 | if test "$(sudo grep -E -c "$portre" "$backup" || true)" != 0; then |
| 195 | sudo rm -f -- "$backup" |
| 196 | exit 1 |
| 197 | fi |
| 198 | sudo awk 'NR==1 && $0!="table inet atlas_ingress" { exit 2 } |
| 199 | NR==2 && $0!="delete table inet atlas_ingress" { exit 2 } |
| 200 | NR==3 && $0!="table inet atlas_ingress {" { exit 2 } |
| 201 | END { if (NR<3) exit 2 }' "$backup" || exit 1 |
| 202 | fi |
| 203 | sudo stat -c '%u %g %a %F %s %n' "$backup" |
| 204 | ``` |
| 205 | |
| 206 | `portre` matches `dport 18132` and a set such as `dport { 18110, 18132 }`. |
| 207 | It does not match a longer number such as 181320. |
| 208 | PASS: the file exists, this run did not overwrite an existing file, uid 0, |
| 209 | gid 0, mode 600, type `regular file`, size greater than 0, the three opening |
| 210 | lines are `table inet atlas_ingress`, `delete table inet atlas_ingress`, and |
| 211 | `table inet atlas_ingress {`, and the file's port 18132 count is 0. |
| 212 | FAIL: the file is missing its header, has the wrong owner or mode, or names |
| 213 | port 18132. Stop. Do not replace it. If the file was absent and the live |
| 214 | chain already names port 18132, do not create it. |
| 215 | |
| 216 | List the input chain. `nft` must exit 0. The first printed number is the |
| 217 | input chain header: the line must start with optional whitespace, then |
| 218 | `type filter hook input`, and end with `policy drop;`. A comment that only |
| 219 | contains `policy drop;` does not match. The second number is how many lines |
| 220 | name port 18132, either as `dport 18132` or inside a set such as |
| 221 | `dport { 18110, 18132 }`. The third is how many lines contain the exact rule. |
| 222 | A trailing `# handle N` may follow the rule on the listed line. |
| 223 | |
| 224 | ```sh |
| 225 | list=$(sudo nft -a list chain inet atlas_ingress input) || exit 1 |
| 226 | printf '%s\n' "$list" |
| 227 | printf '%s\n' "$list" | grep -E -c '^[[:space:]]*type filter hook input .*policy drop;[[:space:]]*$' || true |
| 228 | portre='dport[[:space:]]+18132([^0-9]|$)|dport[[:space:]]*\{[[:space:]]*18132([^0-9]|$)|dport[[:space:]]*\{[^}]*[^0-9]18132([^0-9]|$)' |
| 229 | rule='iifname "tailscale0" ip saddr 100.64.0.3 tcp dport 18132 accept comment "aien-agora, hub nginx only"' |
| 230 | printf '%s\n' "$list" | grep -E -c "$portre" || true |
| 231 | printf '%s\n' "$list" | grep -F -c -- "$rule" || true |
| 232 | ``` |
| 233 | |
| 234 | The expression is the listed form of the 18110 rule in |
| 235 | `scripts/allen/README.md`: table `inet atlas_ingress`, chain `input`, |
| 236 | `iifname "tailscale0"`, source `100.64.0.3`, then `tcp dport` and `accept`. |
| 237 | That README records the 18110 rule with shell quoting `iifname '"tailscale0"'`, |
| 238 | which `nft` lists as `iifname "tailscale0"`. The 18110 line has no comment. |
| 239 | The 18132 line is that same listed form with this port and comment. The 18110 |
| 240 | rule lives in `/etc/nftables.conf`. |
| 241 | |
| 242 | PASS, once Drake has approved and the rule is applied: the header count is 1, |
| 243 | exactly one line names port 18132, and the exact rule count is 1. |
| 244 | A port count of 0 and an exact count of 0, with the header count at 1, is the |
| 245 | current host. The rule is not yet approved or applied. That is a failed |
| 246 | preflight for starting the listener on `100.64.0.2:18132`. Leave the chain |
| 247 | unchanged. |
| 248 | FAIL: `nft` does not exit 0, the chain is missing, the header count is not 1, |
| 249 | the port count is greater than 1, the exact count is greater than 1, or the |
| 250 | port count is 1 while the exact count is not 1. A broader |
| 251 | `tcp dport 18132 accept`, or a set such as `dport { 18110, 18132 }`, is that |
| 252 | last failure. Stop. |
| 253 | Do not start the unit for hub ingress while either rule count is 0. A drop in |
| 254 | this chain never reaches the systemd IP filter, so unit IP accounting stays 0. |
| 255 | |
| 256 | ### Persist the rule in nftables.conf |
| 257 | |
| 258 | The tcp/18132 accept rule is not yet approved or applied. Do not run this |
| 259 | step before Drake's explicit approval. It is the file change for after that |
| 260 | approval, matching the 18110 rule's home in `/etc/nftables.conf` |
| 261 | (`scripts/allen/README.md`). `nft -c -f` checks the file and does not load |
| 262 | it. This guide does not apply the rule. |
| 263 | |
| 264 | A stock Debian `/etc/nftables.conf` usually begins with `flush ruleset`, so a |
| 265 | full reload wipes every table. During this deploy, check that file only with |
| 266 | `nft -c -f`. Do not reload it: do not run `nft -f /etc/nftables.conf`, and do |
| 267 | not restart the nftables service. |
| 268 | |
| 269 | Back up `/etc/nftables.conf` to a `.bak` copy, insert the exact rule once |
| 270 | after the first real `tcp dport 18110 accept` line, and validate the |
| 271 | installed file. The insert copies every other line unchanged, including the |
| 272 | output chain. A commented-out `tcp dport 18110 accept` line is not that |
| 273 | anchor: a `#` outside quotes ends the code on that line. Refuse the edit when |
| 274 | any port 18132 line is already present, including a set such as |
| 275 | `dport { 18110, 18132 }`, or when no real 18110 line exists. |
| 276 | |
| 277 | ```sh |
| 278 | portre='dport[[:space:]]+18132([^0-9]|$)|dport[[:space:]]*\{[[:space:]]*18132([^0-9]|$)|dport[[:space:]]*\{[^}]*[^0-9]18132([^0-9]|$)' |
| 279 | if sudo grep -E -q "$portre" /etc/nftables.conf; then |
| 280 | exit 1 |
| 281 | fi |
| 282 | stamp=$(date -u +%Y%m%dT%H%M%SZ) |
| 283 | confbak="/etc/nftables.conf.bak-aien-agora-$stamp" |
| 284 | sudo cp -a -- /etc/nftables.conf "$confbak" |
| 285 | rule='iifname "tailscale0" ip saddr 100.64.0.3 tcp dport 18132 accept comment "aien-agora, hub nginx only"' |
| 286 | tmp=$(sudo mktemp /root/aien-agora-nftables.XXXXXX) |
| 287 | sudo awk -v rule="$rule" ' |
| 288 | function code(s, i, c, q, out) { |
| 289 | q = 0 |
| 290 | out = "" |
| 291 | for (i = 1; i <= length(s); i++) { |
| 292 | c = substr(s, i, 1) |
| 293 | if (c == "\"") q = !q |
| 294 | else if (c == "#" && !q) break |
| 295 | out = out c |
| 296 | } |
| 297 | return out |
| 298 | } |
| 299 | { |
| 300 | |
| 301 | if (!seen && index(code($0), "tcp dport 18110 accept")) { |
| 302 | print "\t\t" rule |
| 303 | seen = 1 |
| 304 | } |
| 305 | } |
| 306 | END { if (!seen) exit 2 } |
| 307 | ' /etc/nftables.conf | sudo tee "$tmp" >/dev/null |
| 308 | sudo test "$(sudo grep -F -c -- "$rule" "$tmp")" = 1 || exit 1 |
| 309 | sudo test "$(sudo grep -E -c "$portre" "$tmp" || true)" = 1 || exit 1 |
| 310 | sudo test "$(sudo grep -F -c 'tcp dport 18110 accept' "$tmp")" -ge 1 || exit 1 |
| 311 | sudo nft -c -f "$tmp" || exit 1 |
| 312 | mode=$(sudo stat -c '%a' /etc/nftables.conf) |
| 313 | sudo install -o root -g root -m "$mode" "$tmp" /etc/nftables.conf |
| 314 | sudo nft -c -f /etc/nftables.conf || exit 1 |
| 315 | sudo rm -- "$tmp" |
| 316 | ``` |
| 317 | |
| 318 | PASS: `$confbak` exists, `nft -c -f /etc/nftables.conf` exits 0, the file |
| 319 | contains the exact rule once, and it still contains `tcp dport 18110 accept`. |
| 320 | FAIL: any test exits non-zero. Leave `/etc/nftables.conf` as it was, using |
| 321 | `$confbak` if the install already happened, and stop. |
| 322 | |
| 323 | ### Backend startup identity barrier |
| 324 | |
| 325 | `Type=simple` reports a successful start before the child has necessarily |
| 326 | changed credentials or completed `exec`. An immediate root-owned pre-exec |
| 327 | snapshot is not evidence that the listening backend runs as root. |
| 328 | |
| 329 | After start, capture a nonzero `MainPID`. Poll for at most 10 seconds against |
| 330 | one absolute monotonic deadline. For the approved Spark account, require |
| 331 | `/proc/PID/exe` to resolve to `/opt/aien/bin/agora`, effective UID/GID 976/964, |
| 332 | and root `ss -ltnp` to show that **that same PID** owns the 18132 listener at |
| 333 | the approved bind address. Record the actual observations. Require the unit's |
| 334 | `MainPID` to remain the captured PID. Never accept command completion, |
| 335 | a matching process name, a journal line or a listener owned by another PID. |
| 336 | |
| 337 | Capture executable/credentials before and after the listener observation; |
| 338 | a changing snapshot is pending, not readiness. Root pre-exec snapshots |
| 339 | without a listener are pending within the deadline, as are the expected |
| 340 | post-exec credentials before bind. A completed executable with wrong |
| 341 | credentials, an unexpected stable identity, process/read failure or timeout |
| 342 | is FAIL and triggers rollback. Do not extend the deadline, rerun start, |
| 343 | change the service identity or activate routing to make this check pass. |
| 344 | |
| 345 | A recognized `/usr/lib/systemd/systemd-executor` to exact expected executable |
| 346 | transition may coincide with a single valid ownerless LISTEN row. With stable |
| 347 | MainPID, permitted pre-exec credentials, exact final credentials and time |
| 348 | remaining, that narrow case is PENDING only. Reacquire the entire bracket. |
| 349 | A stable ownerless listener, an explicit different owner, wrong endpoint, |
| 350 | malformed or multiple rows, changed MainPID or deadline expiry still refuses. |
| 351 | Only a fresh stable bracket with explicit same-PID ownership can become READY. |
| 352 | |
| 353 | The native `om/agora/startup-check.om` unit is the startup policy authority. |
| 354 | Its CLI takes `deadline_ns executable_match effective_uid effective_gid |
| 355 | same_pid_listener` and exits 0 for pending, 1 for ready, 2 for refusal, or 90 |
| 356 | for malformed syntax. Checked-integer overflow also fails closed. The observer |
| 357 | must interpret those policy statuses, not treat exit 0 as readiness. It must |
| 358 | retain the same deadline throughout polling and reject any late result. |
| 359 | |
| 360 | With no arguments, the native unit replays synthetic credential snapshots |
| 361 | against the real monotonic clock: pre-exec root stays pending, the expected |
| 362 | executable/credentials/listener become ready, and a root snapshot that |
| 363 | persists through the full deadline is refused. This is a policy trace |
| 364 | fixture, not a claim that a privileged fixture process was launched. |
| 365 | The conductor requires preexec-root-fail, deadline-off and identity-off |
| 366 | mutants to fail with exits 40, 48 and 44 respectively. Actual production |
| 367 | `/proc` and listener ownership remain mandatory independent observations. |
| 368 | |
| 369 | ### Hub path gate |
| 370 | |
| 371 | Run this only after the startup identity barrier shows the same PID listening |
| 372 | on `100.64.0.2:18132`, and only when the firewall preflight found the exact |
| 373 | rule once. That rule is not yet approved or applied, so this gate cannot pass |
| 374 | on the current host. Do not add the rule to make it pass. No temporary |
| 375 | firewall rule is authorized. |
| 376 | |
| 377 | A SYN from the hub to `100.64.0.2:18132` must be answered by a SYN-ACK. A |
| 378 | denied source must still get none. Record unit IP accounting immediately |
| 379 | before and after each probe. One probe per source. Do not retry a failed |
| 380 | probe as a pass. |
| 381 | |
| 382 | On the Spark, start the capture first and leave it running until the probe |
| 383 | finishes. tcpdump exit 0 or 124 ends a complete capture. Any other exit is |
| 384 | FAIL. Read the counters before the probe: |
| 385 | |
| 386 | ```sh |
| 387 | systemctl show -p IPIngressPackets -p IPIngressBytes -p IPEgressPackets -p IPEgressBytes aien-agora.service |
| 388 | sudo timeout 20 tcpdump -ni tailscale0 -nn -tt -S -l \ |
| 389 | 'tcp port 18132 and host 100.64.0.3 and (tcp[tcpflags] & tcp-syn != 0)' |
| 390 | ``` |
| 391 | |
| 392 | On the hub, whose tailnet address is `100.64.0.3`: |
| 393 | |
| 394 | ```sh |
| 395 | curl --silent --show-error --max-time 5 --interface 100.64.0.3 \ |
| 396 | --output /dev/null --write-out '%{http_code}\n' \ |
| 397 | http://100.64.0.2:18132/agora/api/challenge |
| 398 | ``` |
| 399 | |
| 400 | After the hub probe, read the counters again: |
| 401 | |
| 402 | ```sh |
| 403 | systemctl show -p IPIngressPackets -p IPIngressBytes -p IPEgressPackets -p IPEgressBytes aien-agora.service |
| 404 | ``` |
| 405 | |
| 406 | tcpdump prints `Flags [S]` for a SYN and `Flags [S.]` for a SYN-ACK. Extra |
| 407 | flag letters may appear beside those. A SYN-ACK is a packet whose flags |
| 408 | contain both `S` and `.`. A SYN counted below must contain `S` and must not |
| 409 | contain `.`. |
| 410 | |
| 411 | PASS: the capture has at least one SYN from `100.64.0.3` to |
| 412 | `100.64.0.2.18132`, and at least one reply from `100.64.0.2.18132` to |
| 413 | `100.64.0.3` that is a SYN-ACK. The after reading shows `IPIngressPackets` |
| 414 | greater than the before reading. The firewall verdict is the SYN-ACK. Record |
| 415 | the HTTP code beside it. |
| 416 | FAIL: a hub SYN and no SYN-ACK to `100.64.0.3`. FAIL: the after reading shows |
| 417 | `IPIngressPackets` unchanged after a hub SYN. The 2026-10-30 capture was 5 |
| 418 | SYNs, 0 SYN-ACKs, and unit IP accounting at 0. FAIL: no hub SYN in the |
| 419 | capture. The probe did not arrive, so the gate did not run. |
| 420 | |
| 421 | Denied source. Set `DENIED` to an address other than `100.64.0.3` and other |
| 422 | than `100.64.0.2` that can already place a packet on `tailscale0` toward |
| 423 | `100.64.0.2`. Do not add a firewall rule, a route, or a systemd address |
| 424 | allowance to create that path. Start a new capture on the Spark, then run |
| 425 | one curl on the denied host. |
| 426 | |
| 427 | Read the counters before this probe: |
| 428 | |
| 429 | ```sh |
| 430 | systemctl show -p IPIngressPackets -p IPIngressBytes -p IPEgressPackets -p IPEgressBytes aien-agora.service |
| 431 | sudo timeout 20 tcpdump -ni tailscale0 -nn -tt -S -l \ |
| 432 | "tcp port 18132 and host ${DENIED} and (tcp[tcpflags] & tcp-syn != 0)" |
| 433 | ``` |
| 434 | |
| 435 | ```sh |
| 436 | curl --silent --show-error --max-time 5 --interface "$DENIED" \ |
| 437 | --output /dev/null --write-out '%{http_code}\n' \ |
| 438 | http://100.64.0.2:18132/agora/api/challenge |
| 439 | ``` |
| 440 | |
| 441 | After the denied probe, read the counters again: |
| 442 | |
| 443 | ```sh |
| 444 | systemctl show -p IPIngressPackets -p IPIngressBytes -p IPEgressPackets -p IPEgressBytes aien-agora.service |
| 445 | ``` |
| 446 | |
| 447 | PASS: at least one SYN from `DENIED` to `100.64.0.2.18132`, and no SYN-ACK |
| 448 | from `100.64.0.2.18132` to `DENIED`. The deciding test is that the denied |
| 449 | source gets no SYN-ACK. Other traffic can move `IPIngressPackets`, so the |
| 450 | after reading is a record, not the verdict. |
| 451 | FAIL: any SYN-ACK to `DENIED`. FAIL: no SYN from `DENIED`. Denial was not |
| 452 | observed. |
| 453 | A failed gate stops activation. It does not approve a firewall change. |
| 454 | |
| 455 | ### Firewall rollback |
| 456 | |
| 457 | Deleting the live rule by its handle is the normal path. List the chain: |
| 458 | |
| 459 | ```sh |
| 460 | sudo nft -a list chain inet atlas_ingress input |
| 461 | ``` |
| 462 | |
| 463 | Find the one line that contains this exact expression: |
| 464 | |
| 465 | ``` |
| 466 | iifname "tailscale0" ip saddr 100.64.0.3 tcp dport 18132 accept comment "aien-agora, hub nginx only" |
| 467 | ``` |
| 468 | |
| 469 | Read `N` from the `# handle N` at the end of that line. Do not use the handle |
| 470 | on the 18110 line (`tcp dport 18110 accept`). If the expression occurs zero |
| 471 | times, there is nothing to delete in the live chain. If it occurs more than |
| 472 | once, do not pick a handle. Use the table file below instead. |
| 473 | |
| 474 | ```sh |
| 475 | sudo nft delete rule inet atlas_ingress input handle N |
| 476 | sudo nft -a list chain inet atlas_ingress input |
| 477 | ``` |
| 478 | |
| 479 | PASS: the 18132 expression is gone, the input chain header still ends with |
| 480 | `policy drop;`, and this 18110 line is still present: |
| 481 | `iifname "tailscale0" ip saddr 100.64.0.3 tcp dport 18110 accept`. |
| 482 | FAIL: the 18132 expression remains, or the 18110 line is missing. Stop and |
| 483 | use the table file below. |
| 484 | |
| 485 | Also remove the same rule from `/etc/nftables.conf`. The 18110 rule lives in |
| 486 | that file, and a later reload would load a 18132 line left behind. Do not |
| 487 | reload `/etc/nftables.conf` during this rollback. A stock Debian copy usually |
| 488 | begins with `flush ruleset`, and reloading it wipes every table. The rule is |
| 489 | not yet approved or applied. If the exact line is already absent, record that |
| 490 | and leave the file in place. |
| 491 | |
| 492 | ```sh |
| 493 | rule='iifname "tailscale0" ip saddr 100.64.0.3 tcp dport 18132 accept comment "aien-agora, hub nginx only"' |
| 494 | portre='dport[[:space:]]+18132([^0-9]|$)|dport[[:space:]]*\{[[:space:]]*18132([^0-9]|$)|dport[[:space:]]*\{[^}]*[^0-9]18132([^0-9]|$)' |
| 495 | if sudo grep -F -q -- "$rule" /etc/nftables.conf; then |
| 496 | stamp=$(date -u +%Y%m%dT%H%M%SZ) |
| 497 | confbak="/etc/nftables.conf.bak-aien-agora-$stamp" |
| 498 | sudo cp -a -- /etc/nftables.conf "$confbak" |
| 499 | tmp=$(sudo mktemp /root/aien-agora-nftables.XXXXXX) |
| 500 | sudo grep -F -v -- "$rule" /etc/nftables.conf | sudo tee "$tmp" >/dev/null |
| 501 | sudo nft -c -f "$tmp" || exit 1 |
| 502 | mode=$(sudo stat -c '%a' /etc/nftables.conf) |
| 503 | sudo install -o root -g root -m "$mode" "$tmp" /etc/nftables.conf |
| 504 | sudo nft -c -f /etc/nftables.conf || exit 1 |
| 505 | sudo rm -- "$tmp" |
| 506 | fi |
| 507 | sudo grep -F -c -- "$rule" /etc/nftables.conf || true |
| 508 | sudo grep -E -c "$portre" /etc/nftables.conf || true |
| 509 | sudo grep -F -n 'tcp dport 18110 accept' /etc/nftables.conf |
| 510 | live=$(sudo nft -a list chain inet atlas_ingress input) || exit 1 |
| 511 | printf '%s\n' "$live" | grep -E -c "$portre" || true |
| 512 | ``` |
| 513 | |
| 514 | PASS: the exact rule count in the file is 0, the file's port 18132 count is |
| 515 | 0, and the live input chain's `dport 18132` count is 0, including a set such |
| 516 | as `dport { 18110, 18132 }`. `tcp dport 18110 accept` is still present. |
| 517 | FAIL: any of those counts is not 0, the 18110 line is missing, or `nft -c -f` |
| 518 | fails. Copy `$confbak` back over `/etc/nftables.conf` when that backup was |
| 519 | taken, and stop. Do not reload the file. |
| 520 | |
| 521 | The other path is the write-once file `/root/aien-agora-atlas-ingress.nft`, |
| 522 | and only when the handle cannot be used. It saves and restores only |
| 523 | `inet atlas_ingress`: `table inet atlas_ingress`, then |
| 524 | `delete table inet atlas_ingress`, then the saved table. Do not load it when |
| 525 | it names port 18132. Check it with `nft -c -f` before `nft -f`. One `nft -f` |
| 526 | is one transaction. This keeps the relay mailer's output chain and the 18110 |
| 527 | rule as they were in that snapshot. `scripts/allen/relay/start` describes that |
| 528 | output chain: it lets the allen-relay user reach only DNS on loopback and TCP |
| 529 | 465. No other table is in the file, so those tables stay as they are. A |
| 530 | snapshot restore undoes any later `atlas_ingress` changes, because the whole |
| 531 | table is replaced by the saved copy. The saved copy has no 18132 rule, so the |
| 532 | restore cannot put that rule back. |
| 533 | |
| 534 | ```sh |
| 535 | backup=/root/aien-agora-atlas-ingress.nft |
| 536 | portre='dport[[:space:]]+18132([^0-9]|$)|dport[[:space:]]*\{[[:space:]]*18132([^0-9]|$)|dport[[:space:]]*\{[^}]*[^0-9]18132([^0-9]|$)' |
| 537 | sudo test "$(sudo stat -c '%u %g %a' "$backup")" = '0 0 600' || exit 1 |
| 538 | test "$(sudo grep -E -c "$portre" "$backup" || true)" = 0 || exit 1 |
| 539 | sudo nft -c -f "$backup" || exit 1 |
| 540 | sudo nft -f "$backup" |
| 541 | live=$(sudo nft -a list chain inet atlas_ingress input) || exit 1 |
| 542 | printf '%s\n' "$live" |
| 543 | test "$(printf '%s\n' "$live" | grep -E -c "$portre" || true)" = 0 || exit 1 |
| 544 | ``` |
| 545 | |
| 546 | If the mode test, the port count, or `nft -c -f` fails, do not load the file. |
| 547 | After any restore, the live input chain must show a `dport 18132` count of 0. |
| 548 | FAIL when that count is not 0. The input chain must also still contain the |
| 549 | 18110 accept rule, and the output chain must still be the saved one. Then |
| 550 | remove the 18132 line from `/etc/nftables.conf` with the commands above, so a |
| 551 | later reload cannot bring it back. Leave the 18110 rule in place. It is |
| 552 | documented in `scripts/allen/README.md` and is not part of this registration |
| 553 | unit. |
| 554 | |
| 555 | ### Reload adoption barrier |
| 556 | |
| 557 | `nginx -t`, `nginx -T`, and a successful reload command do not prove that the |
| 558 | running master has adopted the candidate. Reload sends a signal asynchronously. |
| 559 | A fresh TLS connection can still reach an old worker and fall through to Pages. |
| 560 | Do not change the location hierarchy or add a fixed sleep to mask that race. |
| 561 | |
| 562 | Before reload, record the actual master PID, executable, command line and every |
| 563 | worker PID **with its process title**, using the equivalent of |
| 564 | `ps -C nginx -o pid=,ppid=,args=`. Separate active workers from workers already |
| 565 | reported as `worker process is shutting down`. Record the latter and verify |
| 566 | their lack of listening sockets with root `ss -ltnp`; an existing draining |
| 567 | process need not exit. Confirm the service uses the executable/configuration |
| 568 | that passed `nginx -t`; account for any alternate `-c` or `-p`. |
| 569 | |
| 570 | After reload, use a bounded 30-second observation loop. Require at least one |
| 571 | new active worker PID. Every worker that was **active at capture** must have |
| 572 | either exited, or entered the shutting down state **and** no longer own any |
| 573 | listening socket. Observe process titles and root `ss -ltnp` together; a new |
| 574 | worker alone is insufficient, and a draining title alone is insufficient. |
| 575 | Record initial active/draining sets, new workers and listener ownership. |
| 576 | Pre-existing draining workers without listeners cannot accept a fresh request |
| 577 | and do not block adoption, even when an earlier connection keeps them alive. |
| 578 | Do not kill or signal a production worker to satisfy this barrier. Signal |
| 579 | command completion alone is not readiness. A timeout is FAIL and requires |
| 580 | rollback, not a longer deadline. |
| 581 | |
| 582 | Only after worker handover, send one non-mutating GET challenge through the |
| 583 | actual public TLS/SNI path. Require HTTP 200, `Cache-Control: no-store`, and |
| 584 | exactly one independently observed backend request. Configure that observation |
| 585 | before the request without logging bodies, keys or visitor identities. No |
| 586 | temporary firewall rules are authorized by this guide; use an explicitly |
| 587 | approved observation mechanism. A missing observation or unexpected response |
| 588 | is FAIL. Only then begin the remaining identity, route, privacy and browser |
| 589 | gates. Never retry a failed acceptance request as though it had passed. |
| 590 | |
| 591 | The native `om/agora/reload-check.om` oracle holds a real response open across |
| 592 | an initial reload, proving that a pre-existing draining worker can stay alive |
| 593 | without a listener. It checks missing reload, an old active worker still owning |
| 594 | a listener, and a post-barrier challenge with exact upstream count. A bounded |
| 595 | predicate fixture supplies a draining classification for the proven owned |
| 596 | listener and must still refuse it, independently exercising the listener guard. |
| 597 | It launches only isolated loopback nginx workers through Omega's process |
| 598 | facilities, observes Linux `/proc`, uses monotonic deadlines and performs its |
| 599 | own HTTP request. Its socket inode checks stream both kernel TCP tables through |
| 600 | EOF in a small buffer, retaining split token/row state and failing closed on |
| 601 | read errors, incomplete final rows or exhaustion of the bounded read loop. |
| 602 | Its one-worker and explicit 128-descriptor fixture limits are not production |
| 603 | worker enumeration limits. Production uses the full root `ss -ltnp` observation. |
| 604 | Run `OMEGA_OMC=/path/to/pinned/omc NGINX_BIN=/path/to/nginx sh om/agora/check.sh`; |
| 605 | the existing conductor compiles the Omega unit and requires barrier-off, |
| 606 | active-listener-off, draining-worker-refused and listener-check-off mutants |
| 607 | to fail with exits 11, 14, 23 and 30 respectively. Current source/binary pins |
| 608 | and observations are in `reload-draining.evidence.json`; the earlier |
| 609 | `reload.evidence.json` remains the historical stricter-barrier receipt. |
| 610 | Local oracle nginx version: 1.24.0; it is an unchanged verification oracle, |
| 611 | not an implementation substituted for Omega. When |
| 612 | diagnosing a host-specific failure, also replay the complete `nginx -T` |
| 613 | configuration in isolation, including its SNI/PROXY topology and sibling |
| 614 | locations; replace only host paths, ports, certificates and external upstreams |
| 615 | with local fixtures. Do not publish private captured configuration. |
| 616 | |
| 617 | |
| 618 | ## Full isolated activation rehearsal |
| 619 | |
| 620 | Before another live retry, execute the file-backed activation observers end to |
| 621 | end with `scripts/test-agora-activation.py` as root. Supply a new private |
| 622 | `--root`, the approved `--backend`, oracle `--nginx`, compiled native |
| 623 | `--native` observer and `--startup` policy, and the exact published `--page` |
| 624 | and `--client`. Do not substitute a mock API or replace the browser client. |
| 625 | The host needs `ip`, `tcpdump`, `bpftool`, systemd and the existing dedicated |
| 626 | account. The verification tools are not production dependencies. |
| 627 | |
| 628 | The conductor creates a uniquely named network namespace, isolated systemd |
| 629 | backend and stub nginx. Its executables live in its own `/opt/aien-agora-oracle-*` |
| 630 | directory because Spark mounts `/run` noexec. Units and temporary boot links |
| 631 | are runtime-only; no production firewall rule, unit, hub file or state changes. |
| 632 | Fixed loopback tunnels carry raw TLS through the fixture SNI router and its |
| 633 | PROXY listener. The backend socket is created inside its network namespace. |
| 634 | The exact two-prefix policy is tested after a separately labelled third-source |
| 635 | reachability control. Passive SYN and SYN-ACK observations prove allowed and |
| 636 | denied paths without adding firewall rules. |
| 637 | |
| 638 | Use the root-only `control.sock` with `--control PATH --action pre-browser`. |
| 639 | Then run `runBrowser` from `scripts/agora_activation_browser.mjs` against the |
| 640 | returned `browser_url` in a new, CPU-only browser profile. Resolve only |
| 641 | `www.aienos.com` to the returned loopback address, refuse other domains and |
| 642 | permit the fixture certificate only in that owned browser. Recovery callbacks |
| 643 | must pass secrets through stdin to the root-only `save-key` control; never put |
| 644 | them in arguments, screenshots, HAR, console output or receipts. The |
| 645 | `restart-backend` and `read-profile` controls operate only on the fixture. |
| 646 | |
| 647 | Pass the browser verdict to `after-browser`, which rejects any missing or |
| 648 | failed prerequisite. It exercises real TLS quota exhaustion with forged |
| 649 | identity headers, checks effective access/error/temp sinks directly and |
| 650 | enables only the isolated runtime unit after all gates pass. Finally `finish` |
| 651 | injects an acceptance failure and verifies rollback: API closed, ordinary |
| 652 | site healthy, unit stopped and disabled, profiles unchanged. Private recovery |
| 653 | files and a root-only retained-state copy remain beneath the scratch root. |
| 654 | The receipt is explicitly `ISOLATED_NAMESPACE_ONLY_NOT_DEPLOYED`. |
| 655 | |
| 656 | The conductor treats SIGHUP, SIGINT and SIGTERM as failed acceptance: it records |
| 657 | FAIL, rolls back and cleans up its own units and namespace while retaining |
| 658 | private state. A killed process cannot execute cleanup. If recovering an older |
| 659 | interrupted run, first prove the namespace, runtime units and paths belong to |
| 660 | that fixture, preserve their files privately, and stop only those resources. |
| 661 | Never label an interrupted run PASS or loosen directory permissions to read it; |
| 662 | use the operator's existing permitted root read path. |
| 663 | |
| 664 | Privacy includes a negative control: place a public sentinel in an effective |
| 665 | fixture temporary-body sink, require the actual scanner to refuse it, and |
| 666 | remove only that control file. This demonstrates scanner sensitivity, not the |
| 667 | absence of transient production body spills or historical logging causality. |
| 668 | The privacy pass also scans current-invocation journals for the backend and |
| 669 | every fixture routing unit. Raw journal bodies are private, including the |
| 670 | startup warning observation; receipts retain only the scanner verdict and |
| 671 | non-secret unit names. Empty control responses fail without an acceptance |
| 672 | verdict rather than being treated as success. |
| 673 | |
| 674 | Run `python3 -m py_compile` and `pyflakes` on all three Python observer files, |
| 675 | and `node --check scripts/agora_activation_browser.mjs`. Record the complete |
| 676 | rehearsal receipt and static-check output on the source PR before any live |
| 677 | retry. A fixture failure is not permission to continue live. |
| 678 | |
| 679 | `activation-rehearsal.evidence.json` records the completed 2026-10-28 isolated |
| 680 | sequence at source `9caa5598159a8589f8dfd0c4c36b5b568b84786e`: all 17 |
| 681 | conductor gates and seven real-browser gates passed, including durable readback, |
| 682 | lost-acknowledgement refusal and injected rollback. The earlier interrupted |
| 683 | rehearsals remain failed or incomplete. This receipt is not a production retry, |
| 684 | deployment authorization, or evidence that production routing is enabled. |
| 685 | |
| 686 | ## Required deployment checks |
| 687 | |
| 688 | Record observed outputs, not just the commands: |
| 689 | |
| 690 | - Actual service account, executable digest/ownership, state permissions, |
| 691 | effective IP policy, attached filters and the sole listening address. |
| 692 | - Allowed proxy request and denied request from a source whose path to the |
| 693 | same listener has been independently established. |
| 694 | - Real TLS/SNI requests with forged `X-Real-IP` and `X-Forwarded-For`; they must |
| 695 | retain the same client identity and quota bucket. |
| 696 | - Non-PROXY listener refusal; wrong methods, malformed profile IDs, trailing |
| 697 | segments and oversized bodies. Blocked routes must create no upstream traffic. |
| 698 | - No-store/nosniff and absence of API access/body/key logs on success and failure. |
| 699 | - The published page and JavaScript match the approved artifacts. In a real |
| 700 | browser, missing consent sends no registration request, success requires |
| 701 | acknowledgement plus matching profile readback, and an uncertain write does |
| 702 | not repeat automatically. Use explicitly public synthetic acceptance data, |
| 703 | clearly identified as verification rather than a network participant. |
| 704 | - Successful profile readback after a controlled backend restart, preserving |
| 705 | persistent state. Protect the returned recovery key; never publish it. |
| 706 | - Run `NGINX_BIN=/path/to/nginx python3 scripts/test-agora-deploy.py` locally. |
| 707 | This isolated oracle starts loopback nginx/upstream listeners and checks |
| 708 | route/method refusal, upstream counts, spoofing, rate buckets, accepted body |
| 709 | fidelity, access-log exclusion and no retained body files. It requires a |
| 710 | debug-capable nginx with an active control. Synthetic request-body sentinels |
| 711 | were absent from its observed debug log, but suppression causality is not |
| 712 | established: the override-removal mutant survived. Transient body spill, |
| 713 | secret-bearing response logging, early header logging, live TLS/SNI identity |
| 714 | and actual systemd BPF enforcement require separate live inspection/evidence. |
| 715 | |
| 716 | Ownership and API consent remain self-attested. Browser consent does not become |
| 717 | a cryptographic ownership proof. Browser-local recovery keys are accessible to |
| 718 | scripts executing on the same origin, including third-party scripts permitted |
| 719 | by the site's separate analytics consent. Signup must not trigger analytics or |
| 720 | forward form fields or keys to it. |
| 721 | |
| 722 | ## Rollback |
| 723 | |
| 724 | Remove the registration snippet include and its HTTP-scope configuration, |
| 725 | validate nginx, and reload to close public routing. Stop/disable only the new |
| 726 | registration unit if necessary. Preserve private state, recovery material and |
| 727 | backups. Never delete accepted profiles as part of rollback. Restore unrelated |
| 728 | configuration only from its exact pre-change backup, and recheck the normal |
| 729 | website response. No rollback command should affect model services. |
| 730 | |
| 731 | The tcp/18132 accept rule is not yet approved or applied. The normal live |
| 732 | rollback is delete-by-handle, under [Firewall rollback](#firewall-rollback). |
| 733 | Do not delete the 18110 accept rule in `inet atlas_ingress` input. That rule |
| 734 | is documented in `scripts/allen/README.md` and lives in `/etc/nftables.conf`. |
| 735 | |
| 736 | Also remove the exact 18132 line from `/etc/nftables.conf`, or a later reload |
| 737 | brings it back. Do not reload that file here. If the line is already absent, |
| 738 | record that and leave the file in place. |
| 739 | |
| 740 | ```sh |
| 741 | rule='iifname "tailscale0" ip saddr 100.64.0.3 tcp dport 18132 accept comment "aien-agora, hub nginx only"' |
| 742 | portre='dport[[:space:]]+18132([^0-9]|$)|dport[[:space:]]*\{[[:space:]]*18132([^0-9]|$)|dport[[:space:]]*\{[^}]*[^0-9]18132([^0-9]|$)' |
| 743 | if sudo grep -F -q -- "$rule" /etc/nftables.conf; then |
| 744 | stamp=$(date -u +%Y%m%dT%H%M%SZ) |
| 745 | confbak="/etc/nftables.conf.bak-aien-agora-$stamp" |
| 746 | sudo cp -a -- /etc/nftables.conf "$confbak" |
| 747 | tmp=$(sudo mktemp /root/aien-agora-nftables.XXXXXX) |
| 748 | sudo grep -F -v -- "$rule" /etc/nftables.conf | sudo tee "$tmp" >/dev/null |
| 749 | sudo nft -c -f "$tmp" || exit 1 |
| 750 | mode=$(sudo stat -c '%a' /etc/nftables.conf) |
| 751 | sudo install -o root -g root -m "$mode" "$tmp" /etc/nftables.conf |
| 752 | sudo nft -c -f /etc/nftables.conf || exit 1 |
| 753 | sudo rm -- "$tmp" |
| 754 | fi |
| 755 | sudo grep -F -c -- "$rule" /etc/nftables.conf || true |
| 756 | sudo grep -E -c "$portre" /etc/nftables.conf || true |
| 757 | sudo grep -F -n 'tcp dport 18110 accept' /etc/nftables.conf |
| 758 | live=$(sudo nft -a list chain inet atlas_ingress input) || exit 1 |
| 759 | printf '%s\n' "$live" | grep -E -c "$portre" || true |
| 760 | ``` |
| 761 | |
| 762 | PASS: the exact rule count in the file is 0, the file's port 18132 count is |
| 763 | 0, and the live input chain's `dport 18132` count is 0, including a set such |
| 764 | as `dport { 18110, 18132 }`. `tcp dport 18110 accept` is still present. |
| 765 | FAIL: any of those counts is not 0, the 18110 line is missing, or `nft -c -f` |
| 766 | fails. Copy `$confbak` back over `/etc/nftables.conf` when that backup was |
| 767 | taken, and stop. Do not reload the file. |
| 768 | |
| 769 | ## History |
| 770 | |
| 771 | ### 2026-10-28 rollback record |
| 772 | |
| 773 | The 2026-10-28 activation was rolled back after an immediate post-reload public |
| 774 | challenge returned the Pages 404. Replaying the complete captured hub |
| 775 | configuration returned 200 through both the PROXY listener and the SNI router. |
| 776 | Reloading from the preceding configuration reproduced an immediate old-worker |
| 777 | Pages 404 followed by 200 after handover. This establishes the reload race |
| 778 | mechanism, not a retrospective proof of the production cause: historical |
| 779 | worker lifecycle and per-request upstream counts were not captured. No |
| 780 | registration location change follows from that observation. |
| 781 | |
| 782 | ### 2026-10-30 |
| 783 | |
| 784 | The 2026-10-30 hello-door activation was rolled back at 09:00 CT. The Spark |
| 785 | nftables table `inet atlas_ingress` has its input chain on policy drop, and |
| 786 | port 18132 is not accepted. Hub SYNs were dropped before they reached the |
| 787 | systemd IP filter: 5 SYNs, 0 SYN-ACKs, and unit IP accounting at 0. The |
| 788 | accept rule for tcp/18132 is not yet approved or applied. Adding it needs |
| 789 | Drake's explicit approval. The earlier public-routing rollback is the |
| 790 | [2026-10-28 rollback record](#2026-10-28-rollback-record). |
| 791 | |
| 792 | ## Remaining boundary |
| 793 | |
| 794 | Per-client JSON-edge quotas remain unimplemented at this compiler pin. The |
| 795 | registration flow uses the text API directly and does not activate that edge. |
| 796 | A transport peer-name primitive alone would not authenticate original client |
| 797 | headers behind a proxy. Broader Agora deployment requires its own review and |
| 798 | authorization. |