Skip to content

workspace: harness sync, selftest, release governance, deploy tooling, pcr-replay + GCP golden measurements - #5

Merged
HarryR merged 15 commits into
mainfrom
harness-sync-stage2
Nov 14, 2026
Merged

HarryR merged 15 commits into
mainfrom
harness-sync-stage2

Conversation

@HarryR

@HarryR HarryR commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • stage2/Dockerfile.build is a byte-identical copy of stage0's canonical file. But stage2 was not in HARNESS_REPOS, because it has no build.mk, so make sync-harness never updated it and make check-harness never detected drift.
  • Adds HARNESS_DOCKERFILE_REPOS := stage2 for repos that vendor only Dockerfile.build. Both targets now iterate over an explicit HARNESS_PATHS list of repo/file paths instead of the HARNESS_REPOS x HARNESS_FILES product.
  • Checked against the virt-firmware removal in stage0: before syncing, check-harness reported drift for stage1, vaportpm and stage2; after sync-harness, it reported OK for all five paths.

Related: stage0 #12 (canonical change), stage1 #21, stage2 #2, vaportpm #11 (synced copies) -- the one open PR per repo for this changeset.

Also: AGENTS.md gains the convention one PR per repo per changeset. Follow-ups are commits on the open PR's branch, and a cross-repo changeset is tested together on both arches before any of it merges.

Self-test

make selftest runs vaportpm ci, then for each arch: build stage0 + stage1, then each repo's selftest-<arch> in chain order, with a PASS/FAIL summary. make selftest-<arch> does a single arch. It tests whatever branch each sibling is checked out on, so a cross-repo changeset is tested together. Passed on x86_64 (KVM) and aarch64 (TCG) with all consolidated branches.

Release governance (tools/rulesets.sh)

On the repos that cut releases (stage0, stage1, stage2, vaportpm; release tags are plain v* everywhere):

  • lockboot-release-tags tag ruleset: creation, update, deletion and non-fast-forward are restricted, with repo admins as bypass. Only an admin can cut a release tag, and none can be moved or deleted. Other tags are unrestricted.
  • Immutable releases: published assets and tag are locked, and GitHub signs a release attestation (gh release verify / verify-asset). Title, notes and the prerelease/latest flags stay editable. A bad release is deprecated, or deleted (its tag name can never be reused), not changed. This applies to releases published after it is enabled.
  • sync / check: sync applies both; check reports a missing or drifted tag ruleset, or immutability off. The drift projection now also compares ruleset target and ref include patterns.
  • Verified: check against the live org reports exactly these two gaps on the four release repos, and ok for every branch ruleset (no false drift from the new fields).
  • Applied: make check-rulesets reports ok on all six governed repos; the tag ruleset and immutable releases are live on stage0, stage1, stage2 and vaportpm.

Deploy tooling (lockboot:deploy)

  • tools/deploy/ (cf3ac7d): an image with the aws CLI, coldsnap, gcloud and gh, all sha256-pinned. make deploy-shell LOGIN=aws|gcp|both signs in by browser/passkey to only the clouds asked for, keeps every token in the container's tmpfs $HOME, and signs out / revokes on exit; make deploy-exec CMD=... runs inside the open shell. No volumes, no credentials under /src.
  • 201b614: default GCP zone asia-southeast1-b (t2a is not offered in -a); /cloudtest/ and .copilot ignored.
  • AWS (91902d6): sign-in is as IAM user lockboot (passkey MFA), which can only assume role lockboot-deploy. tools/deploy/aws-iam.sh (idempotent, run by root with DEPLOY_AWS_ROLE=) converges the user, the role (EC2/EBS-direct actions the publish scripts use; Start/Stop/Reboot only on Project=lockboot instances; tagging only on images/snapshots or at launch; objects in listed S3 buckets) and the Spot service-linked role. Verified: the role is assumed after passkey login, EC2/S3 calls work, IAM calls are denied, coldsnap upload + register succeed. Launches untested -- the account is still blocked by AWS.

PCR replay: tools/pcr-replay (replaces tools/predict-pcrs.py)

e63e440, 2a708f5, a56e303, 454744c: a generic, human-readable PCR replay format and its verifier.

  • Format (pcr-replay/v1): one file per boot stage or platform: the events it extends, in order, each with a derivation of the measured bytes from public artifacts (strings, PE sections, GPT, EFI variables and signature lists, cpio, inputs) and the digests its producer computed. Explicitly pinned events are marked as such. Stages: stage0 #12, stage1 #21, stage2 docs: REPRODUCIBLE-BUILDS.md + refresh stale README/toolchain notes #2 ship their files in each release.
  • pcr-replay.py (Python >= 3.11, stdlib only): replays a chain of files, re-derives every digest it can from the supplied artifacts and checks it against the embedded one, binds each stage's next-entry input automatically, and compares the result with a vaportpm attestation or a console PCR dump. It reports what the result rests on (verified / derived / pinned / unchecked). A quote value that is not the bank's digest length is a malformed input (exit 2), not a mismatch.
  • route rules (a56e303): a platform file can declare that its firmware logs an event type into a different PCR ({type, from, to}); matching events of every later file are replayed there, each move reported. No platform detection: the caller picks the platform file, and a wrong one fails closed.
  • GCP golden measurements (platforms/gcp/): PCR0-2 for n2d Shielded / SEV / SEV-SNP and c3 Shielded / TDX, generated by from-capture.py from raw probe captures kept alongside as evidence. Everything is re-derived except 3 ACPI-table digests per platform. GCE's PCR0 does not measure the firmware binary (it is a version string + the confidential-technology byte). TDX logs the GPT (PCR5) and stage0's Authenticode (PCR4) into PCR2; from-capture.py writes the TDX file's two route rules from the capture, which needs stage0's log-ordered replay file (stage0 #12, 8322629).
  • Open, GPT after the first boot (454744c): stage2 rewrites the GPT, so the replay (GPT from boot.disk) reproduces PCR5, and PCR2 on TDX, on first boots only. TDX PCR2 must stay pinned (it carries stage0's Authenticode). Planned: the attestation carries the GPT event digest as auxiliary data (Attestation: carry the GPT event digest as auxiliary data (pin PCR2/PCR5 on TDX and non-TDX) vaportpm#12, with a matching vaportpm-zk change), pinning PCR2 and PCR5 on every boot; how a replay event takes its digest from it is noted as open in the README.
  • EC2: EC2-NOTES.md parks the EC2 platform work until the AWS account is unblocked.

Verified: QEMU x86_64 and aarch64 full chains; GCP n2d SEV, SEV-SNP and c3 TDX full chains (CHAIN VERIFIES, only the ACPI events taken on trust; TDX with both routed events reported); c3 Shielded stage0 probe; negative tests (tampered digest or derivation -> exit 2, wrong input -> mismatch, wrong platform file or a PCR-grouped stage0 file on TDX -> mismatch).

Cloud test conventions (AGENTS.md)

"Cloud test runs": one VM at a time, asked for first; spot with a 3-minute cap; create and follow in one command; serial-port logging (read back by instance id) for guests that power off quickly; Confidential VMs for full GCP chains; delete each VM as soon as it stops.

🤖 Generated with Claude Code

HarryR and others added 2 commits November 4, 2026 08:36
stage2 vendors a byte-identical Dockerfile.build but was not in
HARNESS_REPOS (it has no build.mk), so sync-harness never updated it and
check-harness never saw it drift. Add HARNESS_DOCKERFILE_REPOS for repos
that vendor only Dockerfile.build, and iterate over explicit repo/file
paths instead of the repos x files product.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-ups go on the open PR's branch, not a sibling PR; a cross-repo
changeset is one branch per repo, tested together on both arches before
any of it merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HarryR HarryR changed the title workspace: bring stage2's Dockerfile.build under sync/check-harness workspace: stage2 under sync/check-harness; one-PR-per-changeset convention Nov 4, 2026
HarryR and others added 2 commits November 4, 2026 15:34
Tests a cross-repo changeset together: whatever branch each sibling is
on. `selftest` runs vaportpm `make ci` once, then per arch (x86_64 under
KVM, aarch64 TCG-emulated): build stage0 + stage1, then stage0, stage1
and stage2 `selftest-<arch>` in chain order, with a PASS/FAIL summary
and a non-zero exit on any failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/rulesets.sh now also governs releases on the repos that cut them
(stage0 stage0-v*, stage1 uki-v*, stage2 stage2-v*, vaportpm v*):

- lockboot-release-tags: a tag ruleset on the release-tag pattern with
  creation, update, deletion and non_fast_forward restricted; repo admins
  bypass. Only an admin can cut a release tag; none can be moved or
  deleted. Other tags are unrestricted.
- immutable releases (PUT /repos/{o}/{r}/immutable-releases): published
  assets and tag are locked and GitHub signs a release attestation.

sync applies both; check reports a missing/drifted tag ruleset or
immutability off. The drift projection also compares ruleset target and
ref include patterns. .github and workspace cut no releases and get
neither. AGENTS.md and the make help text describe the policy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HarryR HarryR changed the title workspace: stage2 under sync/check-harness; one-PR-per-changeset convention workspace: harness sync for stage2, selftest, release governance, PR convention Nov 4, 2026
HarryR and others added 5 commits November 4, 2026 16:37
Matches the stage0/stage1/stage2 workflows, which now trigger on v*
(vaportpm already did). release_tag_pattern collapses to one case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cloud publish/launch tooling for stage0/tools/publish, in a local-only image
(tools/deploy/): aws CLI 2.39.4, coldsnap 0.12.0 (built from crates.io,
--locked), gcloud 592.0.0, gh 2.103.3, jq/curl/unzip -- every download
sha256-pinned (aws zips GPG-verified, gh checksums + attestation verified,
gcloud TOFU over HTTPS).

- make deploy-shell LOGIN=aws|gcp|both: browser sign-in (aws login --remote,
  gcloud auth login --no-launch-browser) to only the named clouds at start;
  aws logout / gcloud auth revoke on exit. Tokens live only in a tmpfs $HOME
  -- never on disk, never under /src (readable by every lockboot:build
  container). No login without LOGIN.
- AWS profile `default` wraps the login via credential_process, so aws,
  coldsnap and the publish scripts need no AWS_PROFILE.
- Fixed container name lockboot-deploy (--rm; one session at a time);
  make deploy-exec CMD='...' runs inside the open shell with its login.
- Defaults: AWS ap-southeast-1, GCP project lockboot, asia-southeast1-a
  (DEPLOY_* overrides). Lives in the workspace Makefile so using it never
  touches a stage0 target (which would re-mint the Secure Boot keys).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…copilot

- DEPLOY_GCP_ZONE defaults to asia-southeast1-b: t2a (aarch64) is not offered
  in asia-southeast1-a; n2d SEV-SNP and c3 TDX are available in -b.
- .gitignore: /cloudtest/ (per-run bundles, manifests, console logs) and
  .copilot (state written into $HOME=/src by VS Code's bundled Copilot agent).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oy role

tools/deploy/aws-iam.sh: idempotent setup of the AWS side, run by an
account admin (root) from `make deploy-shell LOGIN=aws DEPLOY_AWS_ROLE=`.
Converges:
- IAM user `lockboot`: SignInLocalDevelopmentAccess (for `aws login`) and
  sts:AssumeRole on the deploy role, nothing else. Console password and
  passkey MFA are set by hand; the script warns if either is missing.
- role `lockboot-deploy`: trusted only by that user with MFA present.
  EC2/EBS-direct actions the stage0 publish scripts use (any region);
  Start/Stop/Reboot only on instances tagged Project=lockboot; CreateTags
  only on images/snapshots or on instances at launch, so the role cannot
  tag its way onto an instance it did not launch; objects in the listed
  S3 buckets.
- the EC2 Spot service-linked role.
All names/account/buckets/tag are flags or LOCKBOOT_AWS_* env vars.

entry.sh / Makefile: DEPLOY_AWS_ROLE (default the lockboot-deploy ARN)
makes `default` that role, assumed from the `aws login` session; empty
uses the signed-in identity directly (root cannot assume roles).

Verified: passkey login as lockboot assumes the role; EC2/S3 calls work,
IAM calls are denied; coldsnap upload + tag + register-image succeed.
Launches are untested: the account is still blocked by AWS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebuilds a deployment's expected PCRs from release artifacts and hashes
only -- never the user-data or stage2 config:
stage0 pcrs.json, the stage1 sha256 stage0 ran, our stage1's
measurements.json, the stage2 sha256 stage1 ran, our stage2's config
digest, and per-instance-type golden readings for PCR0-2. Each step only
appends its stage's events, so a deployment with its own stage1 or
stage2 stops at that handoff. PCRs nothing touched are emitted at their
reset values; PCR10 is left out once Linux has run (IMA). --check takes
a serial log or any JSON with a vaportpm "pcrs" object.

Verified against QEMU boots at all three stopping points (stage0,
stage1, full chain on x86_64 and aarch64).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HarryR HarryR changed the title workspace: harness sync for stage2, selftest, release governance, PR convention workspace: harness sync, selftest, release governance, deploy tooling, PCR reconstruction Nov 6, 2026
HarryR and others added 2 commits November 9, 2026 16:27
… test conventions

tools/pcr-replay replaces tools/predict-pcrs.py. pcr-replay.py (Python >= 3.11, stdlib
only) replays a chain of pcr-replay/v1 files, one per boot stage or platform, re-derives
every event digest it can from the supplied artifacts, checks it against the digest the
producer embedded, and compares the result with a quote (vaportpm attestation JSON or
"PCR <bank> <nn> <hex>" console lines). A quote value that is not the bank's digest length
of hex is a malformed input (exit 2), not a PCR mismatch. Format and semantics: README.md.

platforms/gcp: golden PCR0-2 for four GCE configurations (n2d-standard-2 Shielded / SEV /
SEV-SNP, c3-standard-4 Shielded), generated by from-capture.py from the raw serial console
of one stage0 test-payload boot each (kept under captures/, with the failed t2a boot).
Everything is re-derived from the logged bytes except the three ACPI DATA events per file,
which are pinned. GCE's PCR0 does not measure the firmware binary.

Verified on GCP: stage0 -> UKI -> stage2 pcr-dump on n2d-standard-2 SEV and SEV-SNP
reproduce every PCR except IMA's PCR10, in sha256 and sha384, taking only the ACPI events
on trust; each platform file reproduces its capture's PCR0-2 in every bank.

EC2-NOTES.md parks the EC2 platform work until the AWS account is unblocked.

AGENTS.md: "Cloud test runs" -- one VM at a time, 5 min cap, create and follow in one
command, serial-port logging for fast-exiting guests, Confidential VMs for full chains,
delete each VM as soon as it stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p 3 min

platforms/gcp: the first c3-standard-4 TDX boot that reached a payload (stage0 with the LAPIC tick
and direct gVNIC doorbells), kept as evidence. Same firmware binary as c3 Shielded, but under TDX
it logs the GPT event and stage0's BOOTX64.EFI Authenticode measurement into PCR2 instead of PCR5
/ PCR4 (consistent with logging by CC measurement register: PCR2-6 all map to RTMR1), and the
NonHostInfo technology byte is 3. README records the layout as a verifier work item:
stage0.replay.json does not compose with a TDX platform file until the format can express the
remap, and from-capture.py deliberately refuses the capture.

AGENTS.md: cloud test VMs default to a 3 minute cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HarryR HarryR changed the title workspace: harness sync, selftest, release governance, deploy tooling, PCR reconstruction workspace: harness sync, selftest, release governance, deploy tooling, pcr-replay + GCP golden measurements Nov 10, 2026
HarryR and others added 4 commits November 10, 2026 08:11
…; GCE TDX golden file

A platform file's "route" ([{type, from, to}]) replays matching events of every later file
into another PCR, each move reported. GCE TDX logs EV_EFI_GPT_EVENT (PCR5) and
EV_EFI_BOOT_SERVICES_APPLICATION (PCR4) into PCR2; from-capture.py writes the rules when a
capture shows a boot-chain event type after a PCR0-2 separator and never in its usual PCR.
No platform detection: the caller picks the platform file, a wrong one fails closed.

gcp-c3-standard-4-tdx.replay.json verifies the 2026-11-10 TDX full-chain boot (sha256,
sha384, every PCR but IMA's PCR10) with stage0's log-ordered replay file; SNP and c3
Shielded unchanged; a PCR-grouped stage0 file or the wrong platform file mismatches.
README: on TDX the GPT's free variable is PCR2, which also carries stage0's Authenticode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m#12)

stage0's GPT event derives from boot.disk, which holds only on a first boot: stage2 rewrites
the GPT. The attestation will carry the GPT event digest as auxiliary data, pinning PCR5
(non-TDX) and PCR2 (TDX) on every boot; how a replay event takes its digest from it is open.
Corrects the previous commit's GCP README, which treated TDX PCR2 as a free variable: it
must stay pinned, it carries stage0's Authenticode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le notes

- Makefile REPOS and .gitignore: add DudeFS as a sibling clone.
- WIP-RELEASE-TODO.md: the release tracker (status and open items as of
  2026-11-10).
- PLAN-GPT-MEASUREMENT.md: the parked plan for the GPT measurement and the
  TDX data key (grow, then reboot before deriving the key; vaportpm#12 for
  the verifier side).
- CONSOLE-OUTPUT.md: where each stage's console output lands, per platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/rulesets.sh now also sets and drift-checks each repo's merge settings,
the same everywhere: merge commits on, squash off, rebase on, head branch
deleted on merge. vaportpm had merge commits disabled and squash on, and
vaportpm, .github and workspace kept merged branches; `check` passed anyway
because it only looked at the rulesets.

DudeFS joins the governed repos: the lockboot-main ruleset with its CI job
`build` as the required check, no release-tag ruleset (it cuts no releases).

Applied with `make sync-rulesets`; `make check-rulesets` is clean on all
seven repos. AGENTS.md updated to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HarryR
HarryR marked this pull request as ready for review November 14, 2026 06:02
@HarryR
HarryR merged commit 7028885 into main Nov 14, 2026
@HarryR
HarryR deleted the harness-sync-stage2 branch November 14, 2026 06:02
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