Skip to content

build(shirudo): pin spinbox at 8c6782fe, with scoped signers and --key-fd - #917

Merged
aledbf merged 2 commits into
mainfrom
shirudo/pin-spinbox-scopes
Dec 4, 2026
Merged

aledbf merged 2 commits into
mainfrom
shirudo/pin-spinbox-scopes

Conversation

@aledbf

@aledbf aledbf commented Dec 4, 2026

Copy link
Copy Markdown
Member

Why

Each installation's control plane becomes its own upatch registry and holds its shirudo keys (spin-stack/spin#2043). spin needs two fork changes that merged into spinbox on 2026-12-01. spin-stack/shirudo#17 adds keys/trusted/<name>.scope, which scopes a signer (spin-stack/spin#2012). spin-stack/shirudo#19 adds --key-fd to shirudo-build and the gen tools (spin-stack/spin#2047). The pin, 412dc8f3, predates both, and so does v20261204.01. This is step 2 of spin-stack/spin#2047: pin a spinbox that holds both, so the next release ships them.

What changed

  • versions.yaml: shirudo moves from 412dc8f3 to 8c6782fe, the spinbox head. spin-machine-dev bump shirudo exited 0. Carried patches 0026-0031 match shirudo's by Subject, and the two declined ones are unchanged.
  • boot:shirudo now proves both features on the shipped tools:
    • The control-plane step of shirudo-operator.sh signs as spin's Signer will after spin-stack/spin#2047. Each key goes on descriptor 3 from a pipe, and the key directory holds cert.der alone. That covers keys vouch, shirudo-gen-image, shirudo-gen-runtime and shirudo-build <object>. The test fails when the release's shirudo-build takes no --key-fd.
    • The config image gains spin-stack/spin#2049's import key. The operator's key vouches for it, and import.scope gives it spin's scope (upatch *, upatch !spin-seal, upatch !spin-guard*). It signs af-alg-block, which loads. It also signs a spin-seal, which the guest refuses with "whose scope in the config image leaves out that name".

Scope

The shirudo range is 27 commits. Outside .github/spin/stack.sh, it changes 49 files, all from #17 and #19: 20 source files, the rest docs and tests. #18, #20 and #21 are stacking merges, and they touch only stack.sh, which #21 rewrites to stack the patch branches by area. Makefile.target-deps and testing/kernel/patches do not move. Makefile.shirudo changes only fuzz targets. tools/gen-image gains the --key-fd pass-through.

Tradeoffs

  • af-alg-block is now signed by the import key, not the operator's key. A CVE mitigation from shirudo's catalog is what spin-stack/spin#2049's import key re-signs. A separate in-scope upatch would need an unload directive or a second attach of the same hook.
  • --key-fd is used only when shirudo-build --help lists it. The lab still makes older releases' machines with this script. The Go test makes the check loud for the release under test.

Blast Radius

  • Every shirudo machine this script makes, lab trees included, has a third trusted certificate in its config image. That matches spin's config once spin-stack/spin#2049 lands. A shirudo from before go-tools f55da7c: mutate shares the machine and reports its costs #17 scans only *.der in keys/trusted/, so it ignores .scope (read in util/keys.c, not run).
  • Running boot:shirudo against v20261204.01 or earlier now fails. Those releases enforce no scope.

Verification

Evidence is in the first comment. task lint and task mutate passed locally, and so did task boot:shirudo-here on this host's build of 8c6782fe.

Part of spin-stack/spin#2043, spin-stack/spin#2047 and spin-stack/spin#2012.

🤖 Generated with Claude Code

aledbf and others added 2 commits December 4, 2026 08:15
spinbox now holds spin-stack/shirudo#17, a .scope file beside a trusted
certificate in the config image that limits what its key may sign, and
#19, shirudo-build and the gen tools taking the signing key on an
inherited descriptor (--key-fd). The rest of the range is #18, #20 and
#21, which stack the patch branches by area and change no file but
.github/spin/stack.sh. The bump finds the carried kernel patches
unchanged; Makefile.target-deps and testing/kernel/patches do not move.

Part of spin-stack/spin#2043

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

The control plane will pass each shirudo key to the release's signing
subset on a pipe at descriptor 3, with a key directory holding cert.der
alone (spin-stack/spin#2047). The operator's control-plane step now signs
that way wherever the release's shirudo-build takes --key-fd: keys vouch,
shirudo-gen-image, shirudo-gen-runtime and shirudo-build on an object.
The test fails a release whose shirudo-build takes none.

The config image also gains the import key of spin-stack/spin#2049. The
operator's key vouches for it, and import.scope gives it spin's scope
(spin-stack/spin#2012): any upatch but spin-seal and spin-guard*. It
signs af-alg-block, which loads, and a spin-seal, which the guest refuses
for its scope.

Part of spin-stack/spin#2043

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

aledbf commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Local task boot:shirudo-here, 2026-12-04

Host: a workstation with /dev/kvm, not the KVM fleet. Built with spin-machine-dev build shirudo --cache-registry --cache-export=false at 8c6782fe, on the tree task boot:here made from v20261204.01. The tree under test was 4737540's.

The shipped gen tools take --key-fd (_output/shirudo/libexec/gen-image):

       [--key-fd <n>] [--size <MiB>] [--builder <shirudo-build>]
       [--key <private.pem> | --key-fd <n>] [--cert <cert.der>]
       [--key-fd <n>] [--builder <shirudo-build>]

The operator's control-plane step, as signer with the subset's tools, each key on descriptor 3 from a pipe:

[    9.944856] sh[601]: signing as signer (uid 988), with /run/op/spin-stack/shirudo/libexec/shirudo-build, no clang or ldd
[    9.984706] sh[601]: signing with each key on descriptor 3, from a pipe
[   10.035498] sh[619]: keys vouch: bcf6c975291f10a8499639f9c441a1032c938cbfa9e91ede43a246c4ebd607bb vouched for by c6bbacdc1a74923464ec3b6f7463e10fa5d9c387048576a601de123b599a2e64, written to /run/op/work/config-root/keys/trusted/spin-seal
[   10.042897] sh[624]: keys vouch: 6e24f087b9949f9d70b1367c3c5fa9df8756eeb29ddf531b136b1c7c7e278aa4 vouched for by c6bbacdc1a74923464ec3b6f7463e10fa5d9c387048576a601de123b599a2e64, written to /run/op/work/config-root/keys/trusted/import.vo
[   10.344356] sh[742]: wrote /run/op/work/af-alg-block.upatch (insns=992 sig=4853 data=2472 sections=2 maps=0 progs=1 decoders=0 name=af-alg-block)
[   10.363280] sh[750]: wrote /run/op/work/seal-stranger.upatch (insns=6216 sig=4853 data=61216 sections=2 maps=2 progs=8 decoders=0 name=spin-seal)
[   10.371895] sh[754]: wrote /run/op/work/seal-import.upatch (insns=6216 sig=4853 data=61216 sections=2 maps=2 progs=8 decoders=0 name=spin-seal)
[   18.283849] sh[173]: SHIRUDO_OPERATOR_OK

The guest, booted with --lockdown shirudo from what it made:

[    3.424976] sh[224]: AF_ALG before the upatch: Address family not supported by protocol
[    3.438619] sh[224]: AF_ALG with the upatch: Operation not permitted
[   11.735622] sh[914]: Trusted set (3 members, 0 revoked, 0 unvouched):
[   11.847683] sh[892]: refused: the seal signed by a stranger's key (upatch: no trusted certificate verifies the signature of spin-seal)
[   11.894111] sh[892]: refused: the seal signed by the import key (upatch: spin-seal is signed by 6e24f087b9949f9d70b1367c3c5fa9df8756eeb29ddf531b136b1c7c7e278aa4, whose scope in the config image leaves out that name)
[   74.692440] sh[892]: SEAL_CHECK_OK
[   74.694519] sh[224]: SHIRUDO_CHECK_OK
--- PASS: TestTheShippedShirudoRunsOnTheRelease (114.72s)
--- PASS: TestTheShippedShirudoRunsOnTheRelease/a_checkpoint_of_it_resumes_sealed,_and_a_login_follows (12.83s)
ok  	github.com/spin-stack/machine/boot	114.730s

With a .scope in the trust set, the stranger's seal is now refused in userspace (signer_scope: "no trusted certificate verifies the signature") instead of by the kernel (-126, run 46554807211 on #903). The check accepts either.

The fingerprint in the scope refusal, 6e24f087…, is the import key's from its vouch above. af-alg-block.upatch, which loaded and blocked AF_ALG, is signed by that same key.

task lint exited 0. task mutate exited 0, with nothing it can break in the changed Go: the edited function is held by this lane. task test cannot run on this host because its tar is busybox's (no --mode) and it has no patch. Every failure there was one of those two, in packages this change does not touch. CI's ci.yml runs it.

@aledbf

aledbf commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

CI: compat's shirudo job, KVM fleet

Job 145012870360 built shirudo 8c6782fe from source and ran task boot:shirudo-here. Its log has the same evidence as the local run. In the operator guest, each key went on descriptor 3. In the check guest, the import key 545a556c… is a trusted member, its af-alg-block blocks AF_ALG, and its spin-seal is refused for its scope:

[�[33mboot:shirudo-here�[0m]         [   20.675617] sh[599]: signing with each key on descriptor 3, from a pipe
[�[33mboot:shirudo-here�[0m]         [   20.800572] sh[622]: keys vouch: 545a556c35c1b1e7e38d19ddaa10d8bf40b72eed76addf0229b9b0d2f8c0358c vouched for by 40abb9232ea143bd714cabe7e23223e9fde19da10a84c38d4b820b5b3f068682, written to /run/op/work/config-
[�[33mboot:shirudo-here�[0m]         [    3.529557] sh[217]: AF_ALG with the upatch: Operation not permitted
[�[33mboot:shirudo-here�[0m]         [   13.263924] sh[909]: Trusted set (3 members, 0 revoked, 0 unvouched):
[�[33mboot:shirudo-here�[0m]         [   13.389422] sh[887]: refused: the seal signed by a stranger's key (upatch: no trusted certificate verifies the signature of spin-seal)
[�[33mboot:shirudo-here�[0m]         [   13.440720] sh[887]: refused: the seal signed by the import key (upatch: spin-seal is signed by 545a556c35c1b1e7e38d19ddaa10d8bf40b72eed76addf0229b9b0d2f8c0358c, whose scope in the config image leaves out that 
[�[33mboot:shirudo-here�[0m]         [   76.524224] sh[217]: SHIRUDO_CHECK_OK
[�[33mboot:shirudo-here�[0m] --- PASS: TestTheShippedShirudoRunsOnTheRelease (128.52s)
[�[33mboot:shirudo-here�[0m]     --- PASS: TestTheShippedShirudoRunsOnTheRelease/a_checkpoint_of_it_resumes_sealed,_and_a_login_follows (13.34s)

@aledbf
aledbf merged commit 8fda238 into main Dec 4, 2026
16 checks passed
@aledbf
aledbf deleted the shirudo/pin-spinbox-scopes branch December 4, 2026 11:35
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