Repository navigation
feat(tools): add dstack-key-recovery for older KMS epochs - #1632
Merged
Merged
Conversation
h4x3rotab
force-pushed
the
check-kms-epoch0-migration-sdk-publish
branch
2 times, most recently
from
November 20, 2026 12:46
91489db to
953f412
Compare
h4x3rotab
enabled auto-merge
November 20, 2026 12:46
Signed-off-by: Hang Yin <h4x3rotab@gmail.com>
Signed-off-by: Hang Yin <h4x3rotab@gmail.com>
h4x3rotab
force-pushed
the
check-kms-epoch0-migration-sdk-publish
branch
from
November 20, 2026 12:53
953f412 to
4d1b060
Compare
h4x3rotab
disabled auto-merge
November 20, 2026 12:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
dstack-key-recovery, a small tool to recover an application key from an older KMS root epoch.Why
The guest agent only serves its boot (current) epoch. After a KMS root rotation,
getKeyreturns a key derived from the new root, and the old key is no longer reachable through the agent. The KMS still holds the old epoch, so the tool asks for that epoch's app root and re-applies the frozen derivation.What
getKey(path, purpose, algorithm)getKey(domain, algorithm)--api autopicks by guest version fromvm_config.image;--api v0|v1forces either..appkeys.json/.sys-config.json; no flags needed.key— one-shot derivation, human or--json.info— current root/app epochs, guest version, whether epoch 0 is still served.serve— HTTP on a Unix socket and/or localhost TCP:/health,/info,/key,/v0/key,/v1/key, GET and POST.(root_epoch, app_epoch).Container
Production CVMs have no SSH, so the tool is meant to run as a sidecar. Includes:
Dockerfile— pinned base image, clones atDSTACK_REV,cargo build --locked, static musl,scratchruntime.docker-compose.example.yaml— sidecar + app..github/workflows/key-recovery-release.yml— buildsghcr.io/dstack-tee/dstack-key-recoveryfrom the tag commit with provenance and SBOM.Passthroughs that turned out to be required (validated on a real 0.5.15 CVM):
/dstack/.host-shared,/run/log/dstack,/etc/tdx-attest.conf/dev/tdx_guest,/dev/vsock/sysplusDSTACK_CCEL_FILE(sysfs files cannot be bind-mounted into the container's/sys)security_opt: ["seccomp=unconfined"]forAF_VSOCKTesting
docs/guest-api-v1.md.getKey, both chain linksserveworks over Unix socket and TCP, GET and POSTNotes