aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / scripts / hive / DEPLOY-board.md
| 1 | # Hive edge board (proposed, not deployed) |
| 2 | |
| 3 | Part 2 of #104, edge renderer and browser morph client. The Spark publication format and SSH boundary do not change. |
| 4 | The edge receiver validates and canonicalizes JSON, atomically installs `live.json`, |
| 5 | then runs the static AArch64 Omega renderer. Only exit 0 plus nonempty output can |
| 6 | replace `board.html`; a renderer failure logs to stderr and retains the old board. |
| 7 | An advisory std file lock spans reread/compare/install/render across receiver |
| 8 | processes; it is released before waiting for more stdin. Keep `.publication-lock` |
| 9 | in place: unlinking a live lock file would create two independent lock domains. |
| 10 | Neither this document nor a successful scratch run authorizes deployment. |
| 11 | |
| 12 | ## Build and gates on an AArch64 Linux host |
| 13 | |
| 14 | Use the PR commit, not an unpinned checkout. The compiler is |
| 15 | `om/hive-page/omc`, SHA-256 |
| 16 | `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`. |
| 17 | Language authority: omega-mv `55f9b0af47de70a3d06357985cf99ae3e45c016f`, |
| 18 | `docs/one_layer/OMEGESE.md` sections 9.4, 9.5 and 10. No host runtime or |
| 19 | foreign renderer is linked. Shell coordinates compilation; Python is an independent |
| 20 | oracle/measurement tool only. Existing Rust receiver glue is unfinished migration |
| 21 | until Omega fork/dupfd/execprog/waitpid orchestration replaces it (PR #678 host words). |
| 22 | |
| 23 | ```sh |
| 24 | sh om/hive-render/check.sh |
| 25 | (cd om/hive-render && sha256sum -c render.om.sha256) |
| 26 | nice -n 19 cargo test -j2 -p hive-feed --bin hive-receive |
| 27 | nice -n 19 cargo build -j2 --release -p hive-feed --bin hive-receive |
| 28 | python3 om/hive-render/test-receive.py target/release/hive-receive om/hive-render/hive-render |
| 29 | python3 om/hive-render/measure.py om/hive-render/hive-render "$SNAPSHOT" /tmp/hive-board-measurement.json |
| 30 | ``` |
| 31 | |
| 32 | The measurement command reads the local snapshot, canonicalizes it exactly as the |
| 33 | receiver's sorted compact JSON, copies only the renderer into a unique `/tmp` |
| 34 | directory on `hub`, measures one execution there, compares full output hashes and |
| 35 | removes its scratch directory. It never writes a service, nginx config or web root. |
| 36 | `measurement.json` records an exercised real snapshot and single-run host timings, |
| 37 | not a latency distribution or a 1 Hz service qualification. |
| 38 | |
| 39 | The renderer is schema-specific: receiver-canonical sorted keys, no whitespace |
| 40 | except one optional final newline, canonical escapes, bounded strings/arrays, |
| 41 | UTF-8, identifier and timestamp checks, unique ids, existing parents and acyclic |
| 42 | trees. Unknown/duplicate keys, unknown escapes and disallowed controls trap before |
| 43 | stdout. Noncanonical JSON is deliberately refused; never feed the collector's |
| 44 | pretty-printed JSON directly. The receiver canonicalizes it first. |
| 45 | |
| 46 | Text is escaped with the same five replacements as Python `html.escape(quote=True)`. |
| 47 | `data-generated` is a rechecked timestamp; ids and id-derived links are rechecked |
| 48 | identifiers. `data-sequence` is `s-` followed by lowercase hex of the original |
| 49 | sequence's UTF-8 bytes, so even arbitrary receiver-accepted text becomes an |
| 50 | ident-shaped attribute; it has no authorization meaning. No payload text becomes |
| 51 | markup. All output is buffered before writing; two fixed output pools accommodate |
| 52 | the maximum input with worst-case escaping and repeated manifest text. |
| 53 | |
| 54 | Closed native `<details>` expose manifests without JavaScript. The morph client |
| 55 | keeps the manifest storage container hidden and moves the selected card into the |
| 56 | manifest panel, preserving native disclosure state and keyed row identity. |
| 57 | Elapsed time and observation lag use only the source's timestamps, never render time. |
| 58 | The no-script document explicitly discloses its inability to infer connection |
| 59 | freshness and refreshes every 15 seconds. A frozen source remains visibly timestamped. |
| 60 | Install and verify the edge board in the authorized window **before** merging or |
| 61 | deploying the browser cutover. Until `/hive/board/` exists, the new client correctly |
| 62 | reports telemetry unavailable; keeping this PR draft prevents an accidental gap. |
| 63 | |
| 64 | ## Install on hub only after current operator authorization |
| 65 | |
| 66 | Before starting, set `PR_COMMIT`, `RECEIVER_DIR`, `TLS_SITE` and `PUBLISH_USER` from |
| 67 | the existing installation. `RECEIVER_DIR` must be the already-configured receiver |
| 68 | directory, not a new path from an SSH request. Inspect `authorized_keys`'s existing |
| 69 | forced command and nginx's existing TLS site to obtain the values. Do not copy |
| 70 | private addresses or keys into this repository. |
| 71 | |
| 72 | 1. Pin the checked checkout to `PR_COMMIT`; run the gates above. Record |
| 73 | `sha256sum target/release/hive-receive om/hive-render/hive-render` and compare the |
| 74 | renderer digest with `om/hive-render/hive-render.sha256`. |
| 75 | 2. Copy both binaries and `scripts/hive/nginx-location.conf` to a unique hub scratch |
| 76 | directory. Back up `/usr/local/bin/hive-receive`, any existing |
| 77 | `/usr/local/bin/hive-render`, `$TLS_SITE`, the included location file and any |
| 78 | existing `$RECEIVER_DIR/board.html` to an operator-owned timestamped directory. |
| 79 | Record which files did not previously exist. |
| 80 | 3. Install each binary atomically: `sudo install -m755 NEW /usr/local/bin/NAME.next` |
| 81 | followed by `sudo mv /usr/local/bin/NAME.next /usr/local/bin/NAME`. The default |
| 82 | renderer path is `/usr/local/bin/hive-render`. If a different trusted executable |
| 83 | is necessary, set `HIVE_RENDER` in the operator-controlled receiver environment, |
| 84 | never in `SSH_ORIGINAL_COMMAND`. No shell arguments are accepted as a renderer path. |
| 85 | 4. Prime the board as the existing publish user (not root): |
| 86 | |
| 87 | ```sh |
| 88 | sudo -u "$PUBLISH_USER" sh -c ' |
| 89 | set -eu |
| 90 | d=$1 |
| 91 | /usr/local/bin/hive-render < "$d/live.json" > "$d/.board-prime" |
| 92 | test -s "$d/.board-prime" |
| 93 | mv "$d/.board-prime" "$d/board.html" |
| 94 | ' sh "$RECEIVER_DIR" |
| 95 | ``` |
| 96 | |
| 97 | This input must be the receiver's canonical file. On refusal remove only the |
| 98 | `.board-prime` you just created, investigate stderr and keep the previous board. |
| 99 | 5. Install the exact-route nginx include inside the existing www TLS server, |
| 100 | replacing the old live.json-only include. Its `alias` and `root` assume the existing |
| 101 | `/var/www/aienos-hive` directory; preserve the real installation's path if it |
| 102 | differs. The board route serves the one file with `try_files /board.html =404`: |
| 103 | a file `alias` on a URI ending in `/` returns 500. Do not create a prefix route or directory listing. The board route has |
| 104 | strict CSP, no JavaScript and no tracking; it bypasses static-site head enrichment |
| 105 | and must remain excluded from the consent pixel's global enrichment. |
| 106 | 6. `sudo nginx -t`; on failure restore the nginx backup and do not reload. On |
| 107 | success, and only within the authorized deployment, `sudo systemctl reload nginx`. |
| 108 | Receiver SSH processes are per connection: existing streams keep their old |
| 109 | executable until a newly authorized publisher reconnect. Do not restart a live |
| 110 | publisher merely to force this without authority. |
| 111 | 7. Verify from an external client: |
| 112 | |
| 113 | ```sh |
| 114 | curl -fsSI https://www.aienos.com/hive/board/ |
| 115 | curl -fsS https://www.aienos.com/hive/board/ -o /tmp/board.html |
| 116 | curl -fsS https://www.aienos.com/hive/live.json -o /tmp/live.json |
| 117 | ``` |
| 118 | |
| 119 | Require 200, `text/html`, no-store, nosniff, HSTS, no-referrer and the exact board |
| 120 | CSP in the template. Check `#hive-board` data-generated matches the JSON snapshot |
| 121 | (capture coherent files server-side when publication races a request). Read a |
| 122 | later observation to ensure both timestamps advance. Open the board with JS |
| 123 | disabled; expand a branch and a manifest, read messages, and check the source |
| 124 | timestamp and refresh disclosure. Verify partial/failing renderer retains the |
| 125 | old board in a disposable directory with `test-receive.py`, never by replacing |
| 126 | the live renderer with a fake. Check receiver stderr in the publisher journal |
| 127 | for `Hive board retained previous observation`. |
| 128 | |
| 129 | ## Proposed /hive/ CSP, separate from the board |
| 130 | |
| 131 | Raw production `/hive/` and generated `dist/hive/index.html` were inspected on |
| 132 | 2026-10-26. Both contain two external first-party executable scripts and one inline |
| 133 | `application/ld+json` data block. They do **not** have zero inline script elements; |
| 134 | they have zero inline executable scripts. Keep the distinction in deployment claims. |
| 135 | The page's decorative inline style and style attributes also remain; do not set |
| 136 | `default-src 'none'` on that page without a separate style migration. |
| 137 | |
| 138 | Without the separately proposed consent pixel, the proposed policy is: |
| 139 | |
| 140 | ```nginx |
| 141 | add_header Content-Security-Policy "script-src 'self' 'wasm-unsafe-eval'; object-src 'none'; base-uri 'none'" always; |
| 142 | ``` |
| 143 | |
| 144 | The concurrent X logbook change adds only external `/js/logbook.js` and, **after |
| 145 | consent**, `https://static.ads-twitter.com/uwt.js`. Coordination with its author |
| 146 | identified `analytics.x.com`, `analytics.twitter.com` and `https://t.co/` in the |
| 147 | fetched official pixel. If that change is installed, use this proposed policy |
| 148 | instead, after checking the exact installed script and browser requests again: |
| 149 | |
| 150 | ```nginx |
| 151 | add_header Content-Security-Policy "script-src 'self' 'wasm-unsafe-eval' https://static.ads-twitter.com; connect-src 'self' https://analytics.x.com https://analytics.twitter.com https://t.co; img-src 'self' data: https://analytics.x.com https://analytics.twitter.com https://t.co; object-src 'none'; base-uri 'none'" always; |
| 152 | ``` |
| 153 | The explicitly authorized `wasm-unsafe-eval` keyword permits WebAssembly |
| 154 | compilation for the seeded freshness unit; it does **not** permit JavaScript |
| 155 | `eval`, `Function` or string-based timers. Without it Chromium would deliberately |
| 156 | take the existing JavaScript fallback. Retain that fallback and the visible |
| 157 | `data-fresh-engine` observation even when the proposed policy enables WASM. |
| 158 | This remains tighter than the currently inspected main page's lack of CSP. |
| 159 | |
| 160 | CSP permits hosts statically; consent is enforced by the first-party consent code, |
| 161 | not by CSP. Check denial makes no third-party requests and consent enables only |
| 162 | these hosts. This policy is a proposal, not installed by the board include. Check |
| 163 | JSON-LD behavior and CSP console reports in the actual deployment before enforcing. |
| 164 | The board policy **never** gets pixel hosts or scripts. |
| 165 | |
| 166 | ## Rollback |
| 167 | |
| 168 | Restore both binaries atomically from the recorded backups (remove hive-render only |
| 169 | if the pre-install record says it did not exist), restore the prior nginx include |
| 170 | and TLS site, run `sudo nginx -t`, then reload only on success. Restore board.html |
| 171 | from its backup; if it did not exist, remove only this newly installed board.html |
| 172 | and remove the exact board route. Preserve live.json and the unchanged publication |
| 173 | key. New receiver connections use the restored binary. Confirm live.json continues |
| 174 | to advance, the old /hive/ works and no scratch file is publicly reachable. Do not |
| 175 | merge, deploy, restart live services or change authorization as part of a scratch run. |
| 176 | |
| 177 | ## Arithmetic oracle |
| 178 | |
| 179 | `WolframLanguageEvaluator: Integrate[x^2,{x,0,1}] -> 1/3` and |
| 180 | `WolframAlpha: sqrt(27)/2 -> (3 sqrt(3))/2` verified the mounted calculator. |
| 181 | The Gregorian formula used by `seconds` was checked with: |
| 182 | |
| 183 | ```wolfram |
| 184 | leap[y_]:=Mod[y,4]==0&&(Mod[y,100]!=0||Mod[y,400]==0); |
| 185 | months[y_]:={31,If[leap[y],29,28],31,30,31,30,31,31,30,31,30,31}; |
| 186 | ord[y_,m_,d_]:=365 (y-1)+Floor[(y-1)/4]-Floor[(y-1)/100]+Floor[(y-1)/400]+Total[Take[months[y],m-1]]+d; |
| 187 | sec[y_,m_,d_,h_,mi_,s_]:=((ord[y,m,d] 24+h) 60+mi) 60+s; |
| 188 | {Table[ord[y,3,1]-ord[y,2,28],{y,{1900,2000,2024,2026}}], |
| 189 | sec[2026,10,26,0,0,1]-sec[2026,10,25,23,59,59], |
| 190 | Floor[(1000 sec[2026,10,26,0,0,1]+100-(1000 sec[2026,10,25,23,59,59]+900))/1000]} |
| 191 | ``` |
| 192 | |
| 193 | Result: `{{1,2,2,1},2,1}` (calendar days, seconds, floored seconds respectively). |
| 194 | The implementation shifts years by one Gregorian 400-year cycle to keep year 0000 |
| 195 | unsigned; differences are unchanged. The Python date oracle checks independent |
| 196 | calendar boundaries; it is test-only, not a production dependency. |