Repository navigation
backport(v0.5.x): migrate the data disk and env across KMS key epochs - #1574
Conversation
A 0.6.4 KMS answers a GetAppKey without an epoch selector with the keys of
the current epochs. Once its root or app epoch is rotated, a 0.5.x guest
gets keys that open neither its data disk nor its encrypted env.
Backport the guest side of the 0.6.4 key epoch migration:
- GetAppKey takes optional root/app epochs and returns the served epochs
and the SealedEnv key. Historical requests pin the root CA this boot
established and do not extend RTMR3.
- Replace the luks2 crate header check with the 0.6.4 parser, which also
accepts the one dstack-kms token recording the epochs of the keyslot,
and re-key the data disk to the current epochs in crash-safe steps. An
epoch-0 disk stays untouched, so older images still open it.
- Open an env sealed with HPKE (SealedEnv) or, failing the current key, a
legacy env with the keys of older epochs, then re-seal it to the current
epochs and hand it to the VMM with UpdateSealedEnv, which also closes the
env update window before applications start. A VMM without the method
has no window; the 0.5.x VMM accepts and ignores the update.
The 0.6.4 initializing label and the application-facing historical GetKey
are not part of this backport.
Ported from v0.6.4: dstack-util/src/system_setup/{luks,sealed_env}.rs,
the env migration in system_setup.rs, crypto.rs sealed env functions,
host_api.rs update_sealed_env and the http-client StatusError.
Signed-off-by: Kevin Wang <wy721@qq.com>
|
Physical TDX end-to-end test on tdxlab (Linux 6.8.0-1028-intel, QEMU 8.2.2, user-mode networking). Topology: a private dstack-vmm v0.6.4, with two The candidate image was built from meta-dstack #85 with the
App |
|
Re-validated on the released image Environment:
Results:
Not covered on hardware: app-epoch rotation (dev auth cannot advance app epochs) and power loss in the middle of a migration (covered by the cryptsetup unit tests only). |
Backports the guest side of the 0.6.4 KMS key epoch migration to 0.5.x, so a 0.5.x guest keeps booting after a 0.6.4 KMS rotates its root or app epoch. Without it, the KMS hands the guest keys of the new epochs, which open neither the data disk nor the encrypted env.
GetAppKeytakes optional root/app epochs. Requests for older epochs pin the root CA this boot established and do not extend RTMR3.luks2crate check. It also accepts the singledstack-kmstoken recording the keyslot's epochs. The disk is re-keyed to the current epochs in crash-safe steps; an epoch-0 disk is left untouched.UpdateSealedEnv, which also closes the env update window before applications start.Not included: the 0.6.4 "initializing" disk label and historical keys for applications'
GetKey.The image must declare
"sealed_env": trueinmetadata.jsonfor a 0.6.4 VMM to store the migrated env (meta-dstack PR to follow); without it the guest re-migrates on every boot while the old epochs are still served.Tests: ported 0.6.4 unit tests, including LUKS migration and crash-resume against a real cryptsetup 2.7.0 (0.5.x images ship 2.7.2), env migration, and SDK SealedEnv fixtures.