aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / docs / TRUST-1-OPERATOR-STEPS.md
| 1 | # TRUST-1: the steps only the operator can do |
| 2 | |
| 3 | This is the hands-on companion to [TRUST-1-IMPLEMENTATION-PLAN.md](TRUST-1-IMPLEMENTATION-PLAN.md). |
| 4 | The plan says *what* each gate must prove. This page says *what you physically |
| 5 | do*, in order: what to type, where to type it, what it changes, and what you |
| 6 | should see. Agents have already built and tested every script used here. |
| 7 | |
| 8 | Ground rules for every step: |
| 9 | |
| 10 | - Nothing here changes firmware settings, Secure Boot keys, or the TPM. If a |
| 11 | step ever asks you to, stop: that belongs to Gate 6 or Gate 7 and gets its |
| 12 | own written approval first. |
| 13 | - "Terminal" means a terminal window on the Spark, logged in as yourself, |
| 14 | unless a step says otherwise. |
| 15 | - Every command that starts with `sudo` will ask for your Spark password. |
| 16 | - If anything prints `FAIL` or looks different from "What you should see", |
| 17 | stop and hand the output to the orchestrator. Do not retry or improvise. |
| 18 | |
| 19 | All commands below assume this folder (the Spark's copy of the AIENOS repository): |
| 20 | |
| 21 | ```bash |
| 22 | cd ~/workspace/aienos-recovery-gate |
| 23 | git pull --ff-only |
| 24 | ``` |
| 25 | |
| 26 | *What it does:* moves into the repository and downloads the latest scripts. |
| 27 | *Changes:* only the script files in that folder. *You should see:* a list of |
| 28 | updated files, or `Already up to date.` |
| 29 | |
| 30 | --- |
| 31 | |
| 32 | ## Step 1. Restart the Spark once, with a snapshot before and after (Gate 2, first baseline boot) |
| 33 | |
| 34 | Why: Gate 2 needs proof that the security measurements the Spark makes at |
| 35 | startup come out the same on every normal boot. This restart also rebuilds the |
| 36 | Spark's device list cleanly after the 2026-09-30 incident in which a test |
| 37 | script wiped and an agent rebuilt it by hand. |
| 38 | |
| 39 | 1. Take the "before" snapshot: |
| 40 | |
| 41 | ```bash |
| 42 | mkdir -p ~/trust1-evidence |
| 43 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/boot0-before baseline-before-restart |
| 44 | ``` |
| 45 | |
| 46 | *What it does:* reads the startup measurements, Secure Boot state and boot |
| 47 | menu entries, and saves them in a folder. *Changes:* nothing on the |
| 48 | machine; it only writes the new folder. *You should see:* a short summary |
| 49 | ending without any `FAIL`. |
| 50 | |
| 51 | 2. Restart: save your work, then type `sudo reboot`. Do not touch the |
| 52 | keyboard during startup. Ubuntu should come back as normal. |
| 53 | |
| 54 | 3. Take the "after" snapshot and compare: |
| 55 | |
| 56 | ```bash |
| 57 | cd ~/workspace/aienos-recovery-gate |
| 58 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/boot1-after baseline-after-restart |
| 59 | bash scripts/tpm_measurement_campaign.sh compare ~/trust1-evidence/boot0-before ~/trust1-evidence/boot1-after |
| 60 | ``` |
| 61 | |
| 62 | *Changes:* nothing on the machine. *You should see:* one `SAME` or `CHANGED` |
| 63 | line per item and a last line `compared=... changed=...`. `changed=0` means |
| 64 | identical. Either result is useful evidence; differences |
| 65 | are what Gate 2 exists to explain. Tell the orchestrator which you got. |
| 66 | |
| 67 | ## Step 2. Pause automatic firmware-update checks during the measurement campaign (recommended) |
| 68 | |
| 69 | Why: the plan forbids a firmware update while measurements are being |
| 70 | collected, because an update changes the measurements and would spoil the |
| 71 | comparison. |
| 72 | |
| 73 | ```bash |
| 74 | sudo systemctl disable --now fwupd-refresh.timer |
| 75 | ``` |
| 76 | |
| 77 | *What it does:* stops Ubuntu's background check for new firmware. *Changes:* |
| 78 | one Ubuntu setting; no firmware is touched. *You should see:* a line saying a |
| 79 | link was removed, or nothing. *To undo later (after Gate 2 ends):* |
| 80 | `sudo systemctl enable --now fwupd-refresh.timer`. |
| 81 | |
| 82 | ## Step 3. Create the harmless test file (Gate 1 round trip, part 1) |
| 83 | |
| 84 | Why: Gate 1 must prove the recovery stick can open the encrypted private |
| 85 | storage *without* Ubuntu, using the offline spare. This step proves it with a |
| 86 | throwaway file whose fingerprint is known, never with real data. |
| 87 | |
| 88 | ```bash |
| 89 | sudo -u atlas sh -c 'date -u > /home/atlas/atlas-runtime-setup-20260905/private-data/trust1-roundtrip-test.txt' |
| 90 | sudo -u atlas sha256sum /home/atlas/atlas-runtime-setup-20260905/private-data/trust1-roundtrip-test.txt |
| 91 | ``` |
| 92 | |
| 93 | The commands run as the `atlas` account because that account opened the |
| 94 | private storage, and only it may write there (even the administrator is |
| 95 | refused). *Changes:* adds one small text file to the private storage. *You should see:* |
| 96 | the date, then a long fingerprint (64 letters and digits). Write the |
| 97 | fingerprint down or paste it to the orchestrator; Step 6 checks it. |
| 98 | |
| 99 | ## Step 4. Rebuild the recovery stick with the authenticated image (needs your approval) |
| 100 | |
| 101 | The stick used for the 2026-09-25 read-only boot predates the signed-image |
| 102 | builder. A newly built recovery image must contain its initrd, kernel and menu |
| 103 | inside one signed standalone GRUB EFI binary. Secure Boot ON for Ubuntu shim |
| 104 | and the production kernel alone did not authenticate the old external initrd. |
| 105 | Do not enter the offline recovery identity or passphrase into the older stick |
| 106 | on the assumption that its initrd is authenticated. |
| 107 | |
| 108 | 1. Prepare an offline signing environment with the matching signed production |
| 109 | kernel, shim, matching kernel modules, recovery tools and `grub-mkstandalone`, |
| 110 | `sbsign`, `sbverify`. The owner signing key stays offline, outside the |
| 111 | repository; its certificate must be enrolled in shim trust and not revoked. |
| 112 | The builder refuses missing key/certificate inputs. See |
| 113 | [RECOVERY_MEDIA_MACHINE1.md](RECOVERY_MEDIA_MACHINE1.md#build-and-verify) |
| 114 | for the exact inputs and command. |
| 115 | 2. Plug in the dedicated `AIENOSRECOV` stick. Inspect `lsblk -f` to identify |
| 116 | its unmounted FAT partition (for example `/dev/sdX1`). Never use the |
| 117 | internal NVMe or the key-backup `ATLAS_RECOV` medium. Obtain operator |
| 118 | approval for the selected partition before running the builder; it |
| 119 | replaces recovery boot files on that partition but does not format it. |
| 120 | 3. Run the recovery security and tools checks, then the signing/build command |
| 121 | from the linked procedure on the offline environment. A host-only |
| 122 | `sbverify` result is not proof that the real shim trusts the certificate. |
| 123 | 4. Under an attended hardware window, boot the new USB with Secure Boot ON |
| 124 | and verify the signed standalone GRUB enters the RAM rescue environment; |
| 125 | do not use the offline unlock identity until that boot path is qualified. |
| 126 | Replacing a byte in the embedded initrd must cause signature refusal. |
| 127 | The offline throwaway-key test is not that physical qualification. |
| 128 | |
| 129 | If the offline signer, enrolled certificate or attended window is unavailable, |
| 130 | record Gate 1 as BLOCKED_OPERATOR. Do not fall back to the old unsigned-initrd |
| 131 | builder invocation or claim the 2026-09-25 boot receipt qualifies this image. |
| 132 | |
| 133 | ## Step 5. Decide where the recovery key lives (decision for you) |
| 134 | |
| 135 | **Where things stand.** After Step 4 builds and qualifies the signed recovery |
| 136 | image, it can open encrypted storage. It needs the *spare* (a locked copy of the storage |
| 137 | password, already kept on the Spark at |
| 138 | `~/.config/atlas/offline-spares/atlas-private-storage.passfile.age`) and the |
| 139 | *identity* (the private key that unlocks the spare). The identity is **not** |
| 140 | on the Spark, on purpose; it is kept on the MacBook. The orchestrator will |
| 141 | confirm which MacBook file opens this spare before you copy it. If that file |
| 142 | is itself passphrase-protected, the recovery prompt will ask for that |
| 143 | passphrase during Step 6. The spare is useless without the identity, so where |
| 144 | the identity sits during the test matters. |
| 145 | |
| 146 | **The decision.** Where should the identity be when the stick boots? |
| 147 | |
| 148 | - **Option A: on a second, separate small USB stick (recommended).** |
| 149 | You copy the identity file onto a spare USB stick, plug it in only for the |
| 150 | test, then put it away somewhere separate. |
| 151 | *Upside:* the recovery stick itself stays secret-free (it is rebuilt from a |
| 152 | public repository, and the builder forbids secrets on it); losing one stick |
| 153 | never exposes the storage. *Downside:* one more stick to keep track of. |
| 154 | *If you pick it:* about 5 extra minutes; fully reversible (wipe the stick). |
| 155 | - **Option B: on the recovery stick.** |
| 156 | *Upside:* one object to carry. *Downside:* anyone holding that stick plus |
| 157 | the Spark's drive can open the storage, and it breaks the stick's |
| 158 | "no secrets" rule; agents would have to change the builder. *If you pick |
| 159 | it:* not recommended; it would need a new rule decision first. |
| 160 | - **Option C: type it in by hand at the recovery prompt.** |
| 161 | *Upside:* nothing to carry. *Downside:* an identity is a long random string; |
| 162 | a typo means the test fails, and there is no screen copy-paste in the |
| 163 | recovery shell. *If you pick it:* expect several tries. |
| 164 | |
| 165 | **Recommendation:** Option A, because it keeps the stick and the key apart, |
| 166 | which is the whole point of an offline recovery path. |
| 167 | |
| 168 | *(Reminder, mentioned once: the identity and the spares should also have a |
| 169 | second copy somewhere physically separate from the Spark.)* |
| 170 | |
| 171 | **Question: Option A (second USB stick), or do you prefer B or C?** |
| 172 | |
| 173 | ## Step 6. Boot the recovery stick with Secure Boot ON and prove the unlock (Gate 1, attended) |
| 174 | |
| 175 | The recovery prompt is a small, separate system on the stick. It has only |
| 176 | the tools listed in |
| 177 | [RECOVERY_MEDIA_MACHINE1.md, "What ships"](RECOVERY_MEDIA_MACHINE1.md#what-ships). |
| 178 | `aien-proof` is not one of them, so type the commands below exactly as shown, |
| 179 | with nothing in front. |
| 180 | |
| 181 | 1. Both sticks plugged in (Option A). In the terminal: |
| 182 | |
| 183 | ```bash |
| 184 | efibootmgr |
| 185 | ``` |
| 186 | |
| 187 | Find the line for the USB stick (last time it was `Boot0004* UEFI: USB ...`) |
| 188 | and use its number below: |
| 189 | |
| 190 | ```bash |
| 191 | sudo efibootmgr --bootnext 0004 |
| 192 | sudo reboot |
| 193 | ``` |
| 194 | |
| 195 | *What it does:* tells the firmware to start from the stick **once only**. |
| 196 | *Changes:* a one-time setting that the firmware erases itself after use; |
| 197 | the normal boot order stays as it is. *You should see:* the AIENOS menu, |
| 198 | then the banner `AIENOS Standalone Hardware Recovery Core`. |
| 199 | |
| 200 | 2. At the recovery prompt, open the internal drive read-only and the key stick: |
| 201 | |
| 202 | ```sh |
| 203 | mkdir -p /mnt/root /mnt/esp /mnt/key |
| 204 | mount -o ro /dev/nvme0n1p2 /mnt/root |
| 205 | mount -o ro /dev/nvme0n1p1 /mnt/esp |
| 206 | lsblk -f |
| 207 | mount -o ro /dev/sdY1 /mnt/key |
| 208 | ``` |
| 209 | |
| 210 | Replace `sdY1` with the key stick's name from the `lsblk` list (the one |
| 211 | that is not `AIENOSRECOV`). *Changes:* nothing; everything is read-only. |
| 212 | |
| 213 | 3. Run the evidence collector with the unlock switched on. Replace |
| 214 | `IDENTITY-FILE` with the identity's file name on the key stick, `OWNER` |
| 215 | with the Spark owner's login name, and `FINGERPRINT` with the value from Step 3: |
| 216 | |
| 217 | ```sh |
| 218 | env AIENOS_ESP_MNT=/mnt/esp \ |
| 219 | AIENOS_UNLOCK_CIPHER=/mnt/root/home/atlas/atlas-runtime-setup-20260905/private-cipher \ |
| 220 | AIENOS_UNLOCK_SPARE=/mnt/root/home/OWNER/.config/atlas/offline-spares/atlas-private-storage.passfile.age \ |
| 221 | AIENOS_UNLOCK_IDENTITY=/mnt/key/IDENTITY-FILE \ |
| 222 | AIENOS_UNLOCK_EXPECT="trust1-roundtrip-test.txt FINGERPRINT" \ |
| 223 | /usr/local/sbin/collect_recovery_boot_evidence /mnt/root |
| 224 | ``` |
| 225 | |
| 226 | *What it does:* records Secure Boot state, the startup measurements, the |
| 227 | disks, the encrypted stores, every loader's fingerprint and signer; then |
| 228 | opens the private storage **read-only**, checks the test file, and closes |
| 229 | it. The unlocked password exists only in memory and is deleted straight |
| 230 | away. *Changes:* nothing on any disk. *You should see:* |
| 231 | `PASS recovery_unlock_readonly`, `PASS test_artifact_round_trip`, and |
| 232 | finally `RECOVERY_BOOT_GATE: PASS`. Photograph the screen or save the |
| 233 | output to the key stick if you can. |
| 234 | |
| 235 | 4. Return to Ubuntu: type `umount /mnt/key /mnt/esp /mnt/root`, remove both |
| 236 | sticks, then `reboot -f`. *You should see:* Ubuntu start normally. Then |
| 237 | in a terminal run `mokutil --sb-state` and expect `SecureBoot enabled`. |
| 238 | That is the "return to Linux" proof. |
| 239 | |
| 240 | ## Step 7. Two more normal restarts, fully powered off (Gate 2 baseline) |
| 241 | |
| 242 | Repeat Step 1 twice, but instead of `sudo reboot` use `sudo poweroff`, wait 30 |
| 243 | seconds, then press the power button. Use new folder names each time |
| 244 | (`boot2-before`/`boot2-after`, `boot3-before`/`boot3-after`). Hand the compare |
| 245 | results to the orchestrator. Agents then prepare the one-change-at-a-time |
| 246 | experiments (each with its own written steps and undo) and write the Gate 2 |
| 247 | report. |
| 248 | |
| 249 | ## Step 8. The offline key ceremony (Gate 3; after Steps 1-7) |
| 250 | |
| 251 | **Where things stand.** The tool that creates your owner keys |
| 252 | (`scripts/trust1_key_ceremony.sh`) is written and tested with throwaway keys. |
| 253 | It creates four keys: the Owner Root (the master key that never touches the |
| 254 | Spark), the Boot Signer (signs the small startup loader), the Release Signer |
| 255 | (signs each AIENOS release) and the Operator Approval key (signs your |
| 256 | approvals). Every private key is locked with a passphrase from the moment it |
| 257 | is created. Nothing is installed into the Spark's firmware at this gate. |
| 258 | |
| 259 | **The decision.** Which machine runs the ceremony? It must be disconnected |
| 260 | from every network while it runs; the tool refuses to start if it sees a |
| 261 | network connection. |
| 262 | |
| 263 | - **Option A: the MacBook, with Wi-Fi off (recommended for now).** |
| 264 | *Upside:* you already have it; nothing to buy. *Downside:* it is a daily, |
| 265 | internet-connected machine, so the keys are only as safe as the MacBook |
| 266 | was before the ceremony. It needs OpenSSL 3 installed first (one command |
| 267 | while still online: `brew install openssl@3`). |
| 268 | *If you pick it:* about 30 minutes; the keys can later be replaced through |
| 269 | the rotation steps. |
| 270 | - **Option B: a spare computer (or a fresh live USB system) used only for |
| 271 | this.** *Upside:* strongest protection for the master key. *Downside:* |
| 272 | needs a spare machine or a new stick and some setup time. |
| 273 | |
| 274 | **Recommendation:** Option A for generation 1, with the plan to rotate to a |
| 275 | dedicated machine later if one becomes available. The rotation path is |
| 276 | already built and tested. |
| 277 | |
| 278 | **Question: MacBook with Wi-Fi off, or a dedicated machine?** |
| 279 | |
| 280 | What you will do, once you choose (the orchestrator will walk you through it |
| 281 | live): |
| 282 | |
| 283 | 1. Copy `scripts/trust1_key_ceremony.sh` to the ceremony machine while it is |
| 284 | still online. Turn off Wi-Fi and unplug network cables. |
| 285 | 2. `bash trust1_key_ceremony.sh preflight` (add |
| 286 | `AIENOS_OPENSSL=/opt/homebrew/opt/openssl@3/bin/openssl ` in front on a |
| 287 | Mac). *You should see:* `OpenSSL 3...` and `network: offline`. |
| 288 | 3. `bash trust1_key_ceremony.sh generate ~/aienos-ceremony-gen1`. It asks |
| 289 | for a passphrase twice: choose a long one and write it on paper stored with |
| 290 | the backups. *Changes:* creates that folder only. *You should see:* four |
| 291 | `PASS ... matches manifest` lines and a `generated:` line. |
| 292 | 4. Plug in backup stick 1, then |
| 293 | `bash trust1_key_ceremony.sh backup ~/aienos-ceremony-gen1 /Volumes/STICK1 backup-A` |
| 294 | (use the stick's real name). *You should see:* four `PASS ... decrypts from |
| 295 | the backup copy`. Repeat with backup stick 2 as `backup-B`. Store the two |
| 296 | sticks in two different places. |
| 297 | 5. `bash trust1_key_ceremony.sh record ~/aienos-ceremony-gen1` writes the |
| 298 | ceremony record. Only the `public` folder (public keys, the signed |
| 299 | manifest, the record) goes back to the Spark. The `private` folder stays |
| 300 | on the ceremony machine and the two backups. |
| 301 | |
| 302 | ## Gate 2 attended run (written 2026-10-05, aienos main 9d41efc) |
| 303 | |
| 304 | Companion to `docs/TRUST-1-GATE2-EXPERIMENTS.md` (the why and the expected effects) and to |
| 305 | Steps 1, 2 and 7 above (the baseline, already done on 2026-10-03). This is the exact |
| 306 | runbook for the next three sittings: Experiment 1, Experiment 2 and Experiment 4, the three |
| 307 | that need no extra hardware. Experiments 3 (USB stick) and 5 (boot order) wait for their own |
| 308 | written steps and are not part of this run. |
| 309 | |
| 310 | **Where things stand.** On 2026-10-03 four boots were captured with Secure Boot OFF |
| 311 | (`evidence/trust1_gate2_baseline_2026-10-03/`). Two cold boots were identical on all 35 |
| 312 | items [OBSERVED]. One warm restart (`sudo reboot`) differed in PCR1 and PCR10 [OBSERVED]. |
| 313 | A "PCR" is one numbered logbook slot in the TPM chip that records what started up. |
| 314 | Nothing has been decided about which slots a security policy may use, and this page does not |
| 315 | decide it. |
| 316 | |
| 317 | What this run does and does not change: it never changes firmware settings, Secure Boot, |
| 318 | keys or the TPM. It only restarts the machine, reads measurements, and (Experiment 2) turns |
| 319 | one Ubuntu timer on and off. Experiment 4 opens the firmware setup screen and leaves |
| 320 | without saving. The Spark stays in its current Secure Boot OFF state for the whole run. |
| 321 | Results therefore describe Secure Boot OFF only (see "What would decide the TPM policy"). |
| 322 | |
| 323 | ### Before the first sitting (once, about 5 minutes) |
| 324 | |
| 325 | Type each command in a terminal window on the Spark, logged in as yourself. None of them |
| 326 | changes anything. |
| 327 | |
| 328 | 1. Go to the repository copy and look at it. Do NOT run `git pull` here: this copy sits on a |
| 329 | work branch, and a pull would move it. |
| 330 | |
| 331 | ```bash |
| 332 | cd ~/workspace/aienos-recovery-gate |
| 333 | sha256sum scripts/tpm_measurement_campaign.sh |
| 334 | ``` |
| 335 | |
| 336 | *You should see:* `aac103774858f2d4ff1c302883f7784f3948d50b640faa20e2b2c870c3824529` |
| 337 | followed by the file name. That is the same script as on `main`. A different number: |
| 338 | stop and tell the orchestrator. |
| 339 | |
| 340 | 2. Check the machine is in the state the baseline had: |
| 341 | |
| 342 | ```bash |
| 343 | mokutil --sb-state |
| 344 | systemctl is-enabled fwupd-refresh.timer |
| 345 | id -nG | tr ' ' '\n' | grep -x tss |
| 346 | command -v tpm2_pcrread tpm2_eventlog |
| 347 | ``` |
| 348 | |
| 349 | *You should see:* `SecureBoot disabled`, `disabled`, `tss`, then two tool paths. Anything |
| 350 | else (especially `SecureBoot enabled`): stop and tell the orchestrator; the campaign state |
| 351 | has changed. |
| 352 | |
| 353 | 3. Make sure the evidence folder exists and show what is already in it: |
| 354 | |
| 355 | ```bash |
| 356 | mkdir -p ~/trust1-evidence |
| 357 | ls ~/trust1-evidence |
| 358 | ``` |
| 359 | |
| 360 | *You should see:* the four baseline folders (`boot0-before` to `boot3-after`) and some |
| 361 | files. The capture tool refuses to overwrite a folder, so every folder name below is new |
| 362 | (they start with `g2-`). |
| 363 | |
| 364 | **Evidence destination:** `~/trust1-evidence/` on the Spark, one folder per capture. When a |
| 365 | sitting ends, tell the orchestrator the folder names and paste the `compare` lines. The |
| 366 | orchestrator copies the folders into the repository under |
| 367 | `evidence/trust1_gate2_experiments_<date>/` in a pull request. You do not commit anything. |
| 368 | |
| 369 | **Stop rules for every sitting.** Stop, do not retry, do not improvise, and send the |
| 370 | orchestrator the last command and everything it printed, if any of these happens: |
| 371 | |
| 372 | - a command prints `FAIL`, `Error`, or something other than "What you should see"; |
| 373 | - Ubuntu does not start normally after a restart, or the encrypted private storage or the |
| 374 | vault does not unlock afterwards (a plain power-off, a 30 second wait and the power |
| 375 | button once is allowed; nothing else); |
| 376 | - any PCR other than 1 and 10 changes where the sitting says only those may move, |
| 377 | and in particular **any change in PCR 7**: three Ubuntu credentials are sealed to PCR 7 |
| 378 | alone (`evidence/trust1_gate0_addendum_v1.json`), so a moved PCR 7 means they may refuse |
| 379 | to unseal; |
| 380 | - a firmware update appears to have been installed; |
| 381 | - a rollback `compare` still shows a PCR different from the "before" capture. That is the |
| 382 | plan's UnexpectedState case: no PCR policy is chosen and the orchestrator writes it up. |
| 383 | |
| 384 | `compare` ends with `compared=35 changed=N`. It exits with code 3 whenever something |
| 385 | differs. That is normal and is not an error. |
| 386 | |
| 387 | ### Sitting 1. Experiment 1: is the warm-restart value stable? |
| 388 | |
| 389 | Question: the warm restart changed PCR1 and PCR10 once. Is the warm value always the same? |
| 390 | This resolves the one [UNKNOWN] of the baseline. The one change to the machine: none. This |
| 391 | sitting restarts it warm twice and cold once. Four boots. |
| 392 | |
| 393 | 1. Start from a cold boot so the reference is cold by construction. Save your work, then: |
| 394 | |
| 395 | ```bash |
| 396 | sudo poweroff |
| 397 | ``` |
| 398 | |
| 399 | Wait 30 seconds, press the power button, wait for Ubuntu to start and log in. |
| 400 | |
| 401 | 2. Reference capture (a cold boot, nothing changed yet): |
| 402 | |
| 403 | ```bash |
| 404 | cd ~/workspace/aienos-recovery-gate |
| 405 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp1-before g2-exp1-before |
| 406 | ``` |
| 407 | |
| 408 | *You should see:* a short summary ending without `FAIL`. *Changes:* nothing on the |
| 409 | machine; it only writes the new folder. |
| 410 | |
| 411 | 3. First warm restart. Do not touch the keyboard during startup: |
| 412 | |
| 413 | ```bash |
| 414 | sudo reboot |
| 415 | ``` |
| 416 | |
| 417 | After Ubuntu is back: |
| 418 | |
| 419 | ```bash |
| 420 | cd ~/workspace/aienos-recovery-gate |
| 421 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp1-warmA g2-exp1-warmA |
| 422 | ``` |
| 423 | |
| 424 | 4. Second warm restart, same way: |
| 425 | |
| 426 | ```bash |
| 427 | sudo reboot |
| 428 | ``` |
| 429 | |
| 430 | ```bash |
| 431 | cd ~/workspace/aienos-recovery-gate |
| 432 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp1-warmB g2-exp1-warmB |
| 433 | ``` |
| 434 | |
| 435 | 5. Back to a cold boot (this is the rollback). `sudo poweroff`, wait 30 seconds, power |
| 436 | button, then: |
| 437 | |
| 438 | ```bash |
| 439 | cd ~/workspace/aienos-recovery-gate |
| 440 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp1-rollback g2-exp1-rollback |
| 441 | ``` |
| 442 | |
| 443 | 6. Compare (nothing here changes the machine): |
| 444 | |
| 445 | ```bash |
| 446 | cd ~/workspace/aienos-recovery-gate |
| 447 | bash scripts/tpm_measurement_campaign.sh compare ~/trust1-evidence/g2-exp1-warmA ~/trust1-evidence/g2-exp1-warmB |
| 448 | bash scripts/tpm_measurement_campaign.sh compare ~/trust1-evidence/g2-exp1-before ~/trust1-evidence/g2-exp1-warmA |
| 449 | bash scripts/tpm_measurement_campaign.sh compare ~/trust1-evidence/g2-exp1-before ~/trust1-evidence/g2-exp1-rollback |
| 450 | ``` |
| 451 | |
| 452 | *Expected observations (tags show how much is known):* |
| 453 | |
| 454 | - `before` vs `warmA`: PCR1, PCR10 and the event log differ, nothing else [OBSERVED once on |
| 455 | 2026-10-03, so a repeat is expected, not guaranteed]. |
| 456 | - `warmA` vs `warmB`: UNKNOWN, this is the question. Either answer is useful: `changed=0` |
| 457 | would mean the warm value is stable and PCR1 could get its own warm baseline; a difference |
| 458 | would mean PCR1 cannot be promised after a warm restart. |
| 459 | - `before` vs `rollback` (cold vs cold): all PCRs identical [OBSERVED on 2026-10-03, |
| 460 | `boot2` vs `boot3` changed=0]. The event log bytes may differ even when every PCR is the |
| 461 | same [OBSERVED once, `boot0` vs `boot3`]. |
| 462 | |
| 463 | *Stop conditions:* the common rules above; also any PCR other than 1 and 10 differing |
| 464 | between `before` and a warm capture. |
| 465 | *Rollback:* nothing was changed, so nothing to undo. Step 5 returns to a cold boot and its |
| 466 | `compare` against `g2-exp1-before` is the proof. |
| 467 | |
| 468 | ### Sitting 2. Experiment 2: turn the firmware-update checker back on |
| 469 | |
| 470 | Question: does Ubuntu's background check for new firmware change any measurement? The one |
| 471 | change: `sudo systemctl enable --now fwupd-refresh.timer`, the undo of Step 2. *Changes:* |
| 472 | one Ubuntu setting; no firmware is touched. Three boots. Risk: if a firmware update were |
| 473 | actually installed during this window it would spoil the campaign; step 6 checks. |
| 474 | |
| 475 | 1. Cold boot: `sudo poweroff`, wait 30 seconds, power button, log in. |
| 476 | 2. Before capture: |
| 477 | |
| 478 | ```bash |
| 479 | cd ~/workspace/aienos-recovery-gate |
| 480 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp2-before g2-exp2-before |
| 481 | ``` |
| 482 | |
| 483 | 3. The one change: |
| 484 | |
| 485 | ```bash |
| 486 | sudo systemctl enable --now fwupd-refresh.timer |
| 487 | ``` |
| 488 | |
| 489 | *You should see:* a line saying a link was created. |
| 490 | |
| 491 | 4. Cold boot again: `sudo poweroff`, wait 30 seconds, power button, log in. Then: |
| 492 | |
| 493 | ```bash |
| 494 | cd ~/workspace/aienos-recovery-gate |
| 495 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp2-after g2-exp2-after |
| 496 | bash scripts/tpm_measurement_campaign.sh compare ~/trust1-evidence/g2-exp2-before ~/trust1-evidence/g2-exp2-after |
| 497 | ``` |
| 498 | |
| 499 | 5. Undo and prove it: |
| 500 | |
| 501 | ```bash |
| 502 | sudo systemctl disable --now fwupd-refresh.timer |
| 503 | ``` |
| 504 | |
| 505 | Cold boot (`sudo poweroff`, 30 seconds, power button), log in, then: |
| 506 | |
| 507 | ```bash |
| 508 | cd ~/workspace/aienos-recovery-gate |
| 509 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp2-rollback g2-exp2-rollback |
| 510 | bash scripts/tpm_measurement_campaign.sh compare ~/trust1-evidence/g2-exp2-before ~/trust1-evidence/g2-exp2-rollback |
| 511 | ``` |
| 512 | |
| 513 | 6. Firmware-update check, if the tool is installed (UNVERIFIED that it is): |
| 514 | |
| 515 | ```bash |
| 516 | command -v fwupdmgr && fwupdmgr get-history |
| 517 | ``` |
| 518 | |
| 519 | *You should see:* no update recorded for the last few days. A recorded update: stop and |
| 520 | tell the orchestrator. |
| 521 | |
| 522 | *Expected observations:* `before` vs `after`: only the `fwupd_refresh_timer` item flips from |
| 523 | disabled to enabled; every PCR identical [expected from the `boot0` vs `boot3` result, where |
| 524 | that timer was the only non-event-log difference and all PCRs matched; OBSERVED]. `before` vs |
| 525 | `rollback`: `changed=0` on every PCR. |
| 526 | *Stop conditions:* any PCR differs; a firmware update shows in step 6. |
| 527 | *Rollback:* step 5 (`disable --now`), plus the proving capture. |
| 528 | |
| 529 | ### Sitting 3. Experiment 4: visit the firmware setup screen and leave without saving |
| 530 | |
| 531 | Question: does only entering the firmware setup screen change a measurement? The one |
| 532 | change: entering the setup screen at startup and exiting with "discard changes" or "exit |
| 533 | without saving". Three boots. **This is the only sitting where you touch the firmware |
| 534 | screen. Change nothing there. Do not open any Secure Boot, key or TPM menu.** |
| 535 | |
| 536 | 1. Cold boot, log in, then before capture: |
| 537 | |
| 538 | ```bash |
| 539 | cd ~/workspace/aienos-recovery-gate |
| 540 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp4-before g2-exp4-before |
| 541 | ``` |
| 542 | |
| 543 | 2. `sudo poweroff`, wait 30 seconds, press the power button, and press the setup key shown |
| 544 | on the startup screen (typically Delete or F2; UNVERIFIED for this machine, read what |
| 545 | the screen says). Look. Change NOTHING. Choose exit without saving. If you are unsure |
| 546 | whether you changed something, power the machine off, do not boot, and tell the |
| 547 | orchestrator. |
| 548 | 3. After Ubuntu starts and you log in: |
| 549 | |
| 550 | ```bash |
| 551 | cd ~/workspace/aienos-recovery-gate |
| 552 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp4-after g2-exp4-after |
| 553 | bash scripts/tpm_measurement_campaign.sh compare ~/trust1-evidence/g2-exp4-before ~/trust1-evidence/g2-exp4-after |
| 554 | ``` |
| 555 | |
| 556 | 4. Rollback proof (nothing was changed, so this only proves it): `sudo poweroff`, 30 |
| 557 | seconds, power button, log in, then: |
| 558 | |
| 559 | ```bash |
| 560 | cd ~/workspace/aienos-recovery-gate |
| 561 | bash scripts/tpm_measurement_campaign.sh capture ~/trust1-evidence/g2-exp4-rollback g2-exp4-rollback |
| 562 | bash scripts/tpm_measurement_campaign.sh compare ~/trust1-evidence/g2-exp4-before ~/trust1-evidence/g2-exp4-rollback |
| 563 | ``` |
| 564 | |
| 565 | *Expected observations:* UNKNOWN. Some firmware measures its configuration into PCR1 after a |
| 566 | setup visit, so PCR1 is the one to watch; no change is also a normal answer [guess, |
| 567 | confidence low, to be checked against the result]. `before` vs `rollback`: `changed=0` on |
| 568 | every PCR. |
| 569 | *Stop conditions:* the common rules; PCR 7 moves; the screen shows anything about |
| 570 | Secure Boot keys being modified. |
| 571 | *Rollback:* nothing was changed; Step 4 is the proof. If a setting was changed by mistake, |
| 572 | restore it by hand to what it was and tell the orchestrator before the next boot. |
| 573 | |
| 574 | ### What would decide the TPM policy (and why this run does not) |
| 575 | |
| 576 | This run does not choose, and must not be read as choosing, any PCR for a policy. Missing |
| 577 | experiment evidence, in the order it is needed: |
| 578 | |
| 579 | 1. **Secure Boot ON baseline.** Every capture so far is Secure Boot OFF. PCR 7 holds the |
| 580 | Secure Boot state, so its OFF value is not the value a Secure-Boot-ON policy would see. |
| 581 | The deciding experiment is at least three cold boots with Secure Boot ON and nothing else |
| 582 | changed (the plan's Gate 0 and Gate 2 precondition). Turning Secure Boot ON changes PCR 7 |
| 583 | and may stop three Ubuntu credentials from unsealing, so it is a firmware-policy change |
| 584 | that needs its own written approval, a tested fallback and the recovery stick first. It |
| 585 | is NOT part of this run and no agent may do it. |
| 586 | 2. **Warm-restart stability** (Experiment 1 above) decides whether PCR1 may be in a policy |
| 587 | at all. |
| 588 | 3. **One-variable experiments with Secure Boot ON** from the plan's Q15 list (kernel, init |
| 589 | image, boot order, db addition, owner certificate addition, loader version, loader |
| 590 | rehash, signer rotation, recovery boot, tampered image). A PCR becomes a candidate only if |
| 591 | it is identical across the cold boots, moves under a security-relevant change, and does |
| 592 | not move under harmless ones. This acceptance rule is PROPOSED here; the plan's own text |
| 593 | is "no PCR selected by convention" and gives no numeric line (see the |
| 594 | `docs/TRUST-1-GATE2-EXPERIMENTS.md` proposal). |
| 595 | |
| 596 | Facts that already bound the choice [OBSERVED in the baseline]: PCR 11 is all zero on this |
| 597 | machine, so the placeholder PCR 11 in the Gate 5 simulation has nothing to measure today; |
| 598 | PCR 0, 2, 3, 4, 5 and 7 were identical in all four boots; PCR 1 and PCR 10 moved on the one |
| 599 | warm restart. Which of these mean something for security is exactly what is not yet |
| 600 | explained. |
| 601 | |
| 602 | --- |
| 603 | |
| 604 | ## Known hardware risk: do not boot the C kernel on a disk that holds data |
| 605 | |
| 606 | **Do not boot the C kernel on a disk holding data until CK gate `DISK_LAYOUT` |
| 607 | is PASS on a forge receipt.** Today that gate is **NOT_RUN |
| 608 | (MISSING_IMPLEMENTATION, fix in progress)**. Nothing in this document's steps |
| 609 | boots the C kernel, and none of them may be extended to do so before the gate |
| 610 | passes. |
| 611 | |
| 612 | Why: the C kernel treats the whole NVMe disk as its own and knows nothing about |
| 613 | partitions. On a real GPT disk such as Machine 1's, that overlaps the disk's |
| 614 | own partition table: |
| 615 | |
| 616 | - It writes the last 4 KiB of the whole disk at every boot (a write, read-back |
| 617 | and restore probe), `native/kernel/dev/nvme_bind.c:93-127` (called at line |
| 618 | 224), sized by `native/kernel/dev/disk_layout.h:6-7`. The last sectors of a GPT |
| 619 | disk hold the backup partition table. A power cut during the probe leaves |
| 620 | that area with probe data. |
| 621 | - It uses the first 16 KiB (4 units) as the anti-rollback anchor, |
| 622 | `native/kernel/dev/disk_layout.h:3,12` and |
| 623 | `native/kernel/svc/store_boot.c:164-170` (`anchor_lba = 0`). Sector 0 is the |
| 624 | protective MBR and the next sectors hold the primary GPT. |
| 625 | - The Store region is everything between those two ends |
| 626 | (`native/kernel/dev/disk_layout.h:4`, `store_boot.c:169-170`), so a format |
| 627 | of the Store would cover every partition on the disk. |
| 628 | |
| 629 | Source: `~/handoffs/2026-10-01-review/track4-aienos-trust.md`, row R2. |
| 630 | This entry is documentation only. It was not tested, and no hardware result is |
| 631 | claimed. Host, QEMU and hardware status of the fix: all NOT_RUN. |
| 632 | |
| 633 | Update 2026-10-05: the CK gate `DISK_LAYOUT` is now PASS in a QEMU-only receipt |
| 634 | (`evidence/ck_gates_1ecf5bcd303bf88422dd0542f14851c931f5d52276838fa182c812f3c73f3c1b.json`, |
| 635 | commit 640522a, code identical to 9d41efc), so the "NOT_RUN" wording above is out of date for |
| 636 | QEMU. Nothing changes for hardware: it is still NOT_RUN on a real disk, and no step in this |
| 637 | document boots the C kernel on Machine 1. |
| 638 | |
| 639 | ## Later gates (no action from you yet) |
| 640 | |
| 641 | - **Gate 4** (agents): sign the loader with your Boot Signer in the emulator |
| 642 | and add the remaining emulator tests. |
| 643 | - **Gate 5** (agents): the TPM approval rules, tested in a software TPM only. |
| 644 | - **Gate 6** (you + agents): add a second way to unlock the storage next to |
| 645 | the current one. Gets its own written steps and approval. |
| 646 | - **Gate 7** (you): the single attended hardware boot with Secure Boot on. |
| 647 | Gets its own written checklist and approval; nothing above prepares it |
| 648 | silently. Before that checklist, an agent or you can run the pre-flight |
| 649 | check in a normal terminal: |
| 650 | |
| 651 | ```bash |
| 652 | bash scripts/trust1_gate7_preflight.sh |
| 653 | ``` |
| 654 | |
| 655 | *What it does:* checks the things that can be checked before any restart: |
| 656 | the TPM and Secure Boot state can be read, every tool the stick and the |
| 657 | snapshot steps need is present, the locked spare and the encrypted storage |
| 658 | folder are where this page says, no secret key sits next to the spare, and |
| 659 | the recovery image (on the stick if it is plugged in and open, otherwise a |
| 660 | private test copy) has every tool. *Changes:* nothing; it needs no |
| 661 | password and cleans up its own temporary folder. Takes about 5 seconds. |
| 662 | *You should see:* a list of `PASS` lines, a `NOT CHECKED` list (things only |
| 663 | your restarts or later gates can prove), and last |
| 664 | `GATE7_PREFLIGHT: PASS`. Any `FAIL` line: stop and hand the output to the |
| 665 | orchestrator. |
| 666 | - **Gates 8-9**: observation period, then retiring the old rules only with |
| 667 | your approval. |