Skip to content

Release 1.26.14: TC-3554 restore the node on its epoch-0 KMS root - #668

Merged
samgbafa merged 9 commits into
mainfrom
feat/tc-3554-restore-build
Nov 20, 2026
Merged

samgbafa merged 9 commits into
mainfrom
feat/tc-3554-restore-build

Conversation

@samgbafa

@samgbafa samgbafa commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

TC-3554 restore, release 1.26.14. Phala moved node CVM app 350d124c… to KMS dstack-pha-prod2 at 04:42Z. This release keeps the node's root and identity (did:key:z6MkjHi79SMX4doJyo2w7jDTM6Fa7iX6EVZWXNbJ6RzBm3Wi), with no rotation and no re-key (Sam, 14:27Z).

Commits

  • f835b52f, 027cdfc4, c59c10cb: K1 epoch fetch, backup refusal, and sidecar transport + verifier. These are DO NOT MERGE: TC-3554 K1 epoch-0 KMS fetch + expected node DID pin #667's 1b810ade, 12885dc4 and 1c143311, already PASSed by Bobbie, cherry-picked unchanged onto main a5fec402.
  • f2aa15ac: production compose. TINYCLOUD_KEYS__TYPE: DstackKmsEpoch is pinned with literals: root epoch 0, KMS root 0334c76e… (Bobbie-approved), app_id, and the legacy and node DID pins. Also:
    • the key-recovery sidecar (digest 26803eb7…, unix socket only, logging: none, seccomp unconfined for AF_VSOCK);
    • N0 template hash 70c71aa0… (raw 8e602959…);
    • PHALA_OS_IMAGE set to dstack-0.5.15/4597735f…;
    • dstack-dev-0.5.15 432b8a1e… on the dev allowlist (the node CVM runs it; download.dstack.org HEAD 200);
    • the deploy drops --image/--no-dev-os (Naomi, 14:35Z: no dev→prod request);
    • docs/releasing.md updated.
  • f1ab627e: Release 1.26.14 (Cargo.toml, Cargo.lock, test/m1-realdata-e2e/Cargo.lock, CHANGELOG with upgrade notes).
  • ed03ea5c: scripts/ci/fixtures/tc959-n0-compose.yaml, a byte-identical copy of the compose.

Process exception (Naomi, outage): docs/releasing.md normally lands the compose change first and the release PR after it. Here they are one PR, so v1.26.14 descends from the compose change. The version is still chosen by hand, as the doc requires. release-plz creates the v1.26.14 tag when this merges.

Before deploy: Sam's read-back shows renewal_identity = original renewer z6MkgWpi… (14:44Z) and the live leases carry the row's epoch; then the restore boot writes nothing. The pinned reset is only a fallback (Bobbie, 14:46Z). No migration. There is no rollback below 1.26.14 on this compose: older binaries reject DstackKmsEpoch and fail closed.

Local verification (head c59c10cb plus the config commits):

  • cargo test -p tinycloud-node --features dstack --lib: 1135 ok.
  • kms_epoch_identity: 14 ok. link: 7 ok. tunnel: 14 ok.
  • no-dstack build ok. fmt ok.
  • --validate-config with the compose's exact key env: valid.
  • test-deploy-recovery.py: 30 OK.
  • tc959-check.mjs passed. tc959 node tests: 24 pass.
  • Local clippy -D warnings (1.97) flags items_after_test_module in routes/encryption.rs. That file is untouched here and the lint is the same on main.
  • test-phala-os-guard.sh: 10 "left a temp dir" failures locally, identical on unmodified main (sandbox TMPDIR). CI decides.

test-ruling: TC-3554

Details: TC-3554

- keys.type = DstackKmsEpoch (dstack builds): RA-TLS client cert signed by the KMS temp CA
  (legacy quote/event-log extensions), GetAppKey for the pinned root epoch over TLS pinned to
  the KMS CA (leaf issued directly by it, special usage kms:rpc). Fail-closed checks before the
  database connects: root_epoch == pin and app_epoch == 0 (both required), low-S k256_signature
  by the pinned epoch root over keccak256("dstack-kms-issued:" || app_id || app_pub), derived
  node DID == keys.legacy.expected_did. No fallback to GetKey or another epoch.
- keys.expected_node_did (any key source): startup refuses another DID before the DB opens;
  resolve_identity_state refuses it for every caller, the control plane included.
- docs/tc-3554-kms-epoch-fetch.md: the protocol OpenKey mirrors (openkey #640).
- tests/kms_epoch_identity.rs: fake guest agent + fake KMS (epochs 0/1) against the real binary.
- backup_identity bails for keys.type = DstackKmsEpoch before resolving (no KMS fetch):
  the epoch-0 root is a migration bridge on an exposed KMS root, re-key instead of exporting.
- Covers the control-plane backup route (service.rs) through backup_identity.
…ecar

- keys.legacy.key_recovery_socket selects Phala's key-recovery sidecar (unix socket GET /v0/key, root_epoch pin, app_epoch=0); kms_url+kms_ca_cert keep the direct RA-TLS transport. Exactly one transport, no runtime fallback.
- Verifier on the sidecar answer: api v0, epochs present and pinned, public_key == pub(key), app_pub recovered from signature_chain[0], signature_chain[1] checked as the KMS issuance signature under the pinned epoch root, DID pin. The chain does not prove path->key; the DID pin does.
- Direct KMS GetAppKey now sends app_epoch 0 explicitly.
- Spec: transport A section, new vectors; fake-sidecar harness cases.
… pins; dev-0.5.15 OS

- Compose: tinycloud TINYCLOUD_KEYS__TYPE DstackKmsEpoch, epoch-0 KMS root 0334c76e…, app_id 350d124c…, expected DID z6MkjHi7… (legacy and node pins) as literals; key-recovery sidecar (digest 26803eb7…, unix socket only, logging none) on a shared volume.
- docker.yml: N0 template hash 70c71aa0… (raw 8e602959…); PHALA_OS_IMAGE dstack-0.5.15/4597735f…; deploy drops --image/--no-dev-os so the dev CVM keeps its class.
- Dev OS allowlist: dstack-dev-0.5.15 432b8a1e… (the node CVM's OS since Phala's move; download.dstack.org HEAD 200).
- docs/releasing.md: OS pins, N0 hash, no rollback below 1.26.14 on this compose.

Details: TC-3554
- TC-3554 restore: DstackKmsEpoch key fetch, sidecar compose, OS pins. Upgrade notes in CHANGELOG.

Details: TC-3554
- Byte-identical copy (docs/releasing.md: compose, fixture and template hash move together); test-deploy-recovery.py 30 OK.

Details: TC-3554
- Sam's 14:44Z read: renewal_identity still holds the original renewer DID, so the 04:42Z boots never wrote it. The note is now a precondition with the reset as the fallback, not a claim that the row was bumped.

Details: TC-3554
…volume

- compose_mounts asserted the node's exact volume list; the restore compose adds key-recovery:/run/key-recovery. The sidecar is not projected (like ssh-gateway).

Details: TC-3554
… guard

- did_resolution_single_entry flags any verify_signature call; ensure_kms_rpc_cert's is the X.509 KMS TLS leaf under the pinned CA, not a DID.
- Hoist it out of ensure! (no behaviour change) and allow that one exact expression (ruling: TC-3554 comment eea21b45).

Details: TC-3554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant