capsule trust: a signed kernel refuses an unsigned capsule; the intermediate is the anchor (#139)

capsule_sig_refused(), the one decision at v4's boot and v3's three
births: INVALID always; MISSING and NO_ROOT_KEY on a signed build
(CAPSULE_SIGNED_BUILD, set exactly when the Makefiles sign). A
developer build warns and boots. test_capsule_sig, built both ways,
did not build without it; 4 checks each way now. nightly.sh
capsule-trust, a nightly step: signed, v4:centre.4th left unsigned
(test only), amd64 must refuse it -- CI's, as ruled, since only CI has
the key. No root check, as ruled; the step-4 trust model (blobs signed
by their authors, MANIFEST.md hashes, contributors' intermediates,
snakeoil) recorded as given. FABRIC-3 XLIX. Gates pass, POST 992/992.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-20 22:37:25 +00:00
parent 5425d52cb1
commit 9db364f7c7
20 changed files with 1750 additions and 11 deletions
+36
View File
@@ -6847,3 +6847,39 @@ What the record asks beyond POST, each gap put to Captain Bob one at a time:
tag"): PR #197 merges once its Acceptance passes, and a tag on `master` marks the line. New work starts
after it.
## XLIX. Capsule trust: the intermediate is the anchor, and a signed kernel refuses an unsigned capsule (#139, 2026-11-20)
### 1. Found
XLVI left two things open (2026-11-07). The kernel does not check the image's signing certificate against
the StarshipOS Root CA. And an unsigned capsule (`CAPSULE_SIG_MISSING`) is only a warning, as ruled on
2026-08-26, when CI had no key. Since XLVI, CI signs every build, and the gate into master and a release
refuse an unsigned one (#174).
### 2. Ruled (Captain Bob, 2026-11-20; `docs/v4.0.0/plans/2026-11-20-capsule-trust.md`)
1. **"Intermediate is the anchor; no root check."** The "StarshipOS Capsule Signing" certificate in the
image (XLVI) is what capsules are trusted by. No root key goes in the kernel or in CI. First ruled
"verify at boot"; withdrawn when asked where CI would take the root's certificate from: "Actually we
decided to include an intermediate certificate in the kernel". On the way it was found that the root's
private key is on the CI server beside its certificate, in `/var/lib/starshipos-ca/root/` (mode 700),
so mounting that directory into CI jobs, one way to reach the certificate, would have exposed it.
2. **"Refuse on signed builds."** A kernel built with the signing key refuses an unsigned capsule. A
developer build, without the key, warns and boots.
3. **"NO_ROOT_KEY, by build."** A signing certificate missing from the image, or one that cannot be read,
is refused on a signed build and warned of on a developer build.
4. **"Left to CI."** The boot of a signed kernel with an unsigned capsule is CI's to show, since only CI
has the key.
### 3. Built
- `capsule_sig_refused()` (`kernel/src/capsule/capsule_sig.c`): the one decision. INVALID always;
MISSING and NO_ROOT_KEY on a signed build (`CAPSULE_SIGNED_BUILD`, set by `kernel/Makefile` and
`v4/Makefile` exactly when they sign). v4's boot and v3's three births ask it.
- `kernel/tests/test_capsule_sig.c`, built twice, unsigned and signed: written first, it did not build
without the function. It now passes 4 checks each way.
- `scripts/nightly.sh capsule-trust`, a step of `nightly.yml`: a signed build with `v4:centre.4th` left
unsigned (`CAPSULE_TEST_UNSIGN`, `scripts/capsule_unsign.py`, for the test only), booted on amd64. It
must say `missing (unsigned)` and stop with `POST: FAILED`, and give no prompt. It is not a protocol
stage, since a developer has no key. It is first seen in the nightly after this merges.
+41 -1
View File
@@ -1,6 +1,6 @@
# Capsule trust: no unsigned capsule on a signed build (#139) -- design, for ruling
Written 2026-11-20. **Nothing here is built.**
Written 2026-11-20. **Built 2026-11-20** (section "Built", below; FABRIC-3 XLIX).
## The rulings (Captain Bob, 2026-11-20, one at a time)
@@ -52,3 +52,43 @@ Written 2026-11-20. **Nothing here is built.**
capsule's signature, and expects the boot refused at that capsule. This container has no key, so that
boot is CI's, and the host test and the boots here cover the rest. Asked: that, or a throwaway CA made
here, its intermediate standing in for the real one in a test build.
## Built (2026-11-20)
As the design, with one difference in step 4: the refused-capsule boot is CI's (ruling 4).
`scripts/nightly.sh capsule-trust`, in `nightly.yml`, builds signed with `CAPSULE_TEST_UNSIGN=v4:centre.4th`
(`scripts/capsule_unsign.py` takes that one signature out after mkcapsule), and boots amd64 in the session's
`unsigned_capsule` mode. It expects the capsule's "missing (unsigned)" line, `POST: FAILED` and no prompt.
- **Checked here:** the mode refuses to run without `SIGN_KEY`. The script unsigns only the capsule named,
and refuses one that is not signed and one that is not there.
- **To see in CI:** the boot itself, in the first nightly after the merge.
`kernel/tests/test_capsule_sig.c` (and `_signed.c`) was written first and did not build without
`capsule_sig_refused`. It now passes 4 checks on each build (`logs/20261120-capsule-trust/`).
## Given for ADR step 4, when capsules carry trains (Captain Bob, 2026-11-20)
Recorded as given, to design from at step 4 ("Integrity, provenance, and reproducibility checks" and the
carrying of artifacts in capsules). Nothing of it is built.
- **The capsule is a train:** "we are evolving to capsules with the v4 runtime engine towing rolling stock
named blobs". The engine is the train's `.f18a`, and the cars are its named blobs (ABI.md, "one train
per capsule").
- **Each blob is signed by its author and hashed:** "Each blob in the capsule is signed by the author and
hashed. The MANIFEST.md inside the capsule will hold each named blobs hash."
- **The authors:** "Bonafide contributors will have their own intermediate certificate and 'casual' users
get a snakeoil cert." StarshipOS's own trains are signed with the StarshipOS Capsule Signing certificate,
as today.
- **How they are told apart:** "It can tell the intermediate cert from a snakeoil because it has an
intermediate chained to the CA." So at step 4 the kernel checks an author's intermediate against the
StarshipOS Root CA's public key, anchored in the kernel. The public certificate is in the tree
(`ci/pki/starshipos-root-ca.pem`, with its published hash); the root's private key stays on the server.
This is the chain check ruling 1 leaves out for now, for the one system certificate. It comes in with
contributors' trains.
**For step 4's design, to be asked one at a time then:**
- whether `MANIFEST.md` is itself a signed blob, so its hashes are trusted;
- what placement does with a blob whose hash differs from its manifest's;
- what each tier is allowed: StarshipOS, a contributor, a snakeoil user. `contrib_capsule_refused()`
(`capsule_birth.c`, FABRIC-2 I.5) is where tiers began.