Skip to content

fix(vmm): use host kms_url for single-node SEV-SNP app epoch and env encryption - #1708

Open
PierreLeGuen wants to merge 3 commits into
Dstack-TEE:nextfrom
nearai:fix/single-node-host-kms-url
Open

PierreLeGuen wants to merge 3 commits into
Dstack-TEE:nextfrom
nearai:fix/single-node-host-kms-url

Conversation

@PierreLeGuen

Copy link
Copy Markdown
Contributor

Summary

On single-node VMM hosts using QEMU user-mode networking (as configured by dstackup), cvm.kms_urls holds the guest-only 10.0.2.2 alias, which is not routable from the host. Host-side VMM RPCs (resolving the current app epoch for app_epoch_pin: true SEV-SNP launches on 0.6.7+ images) and vmm-cli.py env encryption need the host-reachable KMS URL without overriding guest cvm.kms_urls.

Changes

  • fix(vmm): prefer host kms_url when querying SEV-SNP app epoch (dstack/vmm/src/app/mr_config.rs): when manifest.kms_urls is unset, try top-level host kms_url first and fall back to cvm.kms_urls (deduplicated).
  • fix(dstackup): set host kms_url in vmm.toml (dstack/crates/dstack-cli-core/src/config.rs, dstack/crates/dstackup/src/install.rs): set top-level kms_url = "https://127.0.0.1:<port>" alongside guest cvm.kms_urls when KMS is enabled.
  • fix(vmm-cli): allow --env-file with --kms-encrypt-url alone (dstack/vmm/src/vmm-cli.py, dstack/vmm/src/tests/test_vmm_cli.py): match update_vm so create_vm accepts --env-file with --kms-encrypt-url without requiring --kms-url.

Verification

  • cargo test --locked -p dstack-vmm mr_config (7 passed) and cargo test --locked -p dstack-cli-core -p dstackup (18 + 31 passed).
  • cargo clippy --locked -p dstack-vmm -p dstack-cli-core -p dstackup -- -D warnings --allow unused_variables and cargo fmt --all -- --check: pass.
  • python -m unittest tests/test_vmm_cli.py -v: 23/23 passed.

Split out from #1703.

On SEV-SNP launches with a 0.6.7+ guest image (app_epoch_pin: true), the VMM
queries the KMS from the host to resolve the current app epoch before starting
QEMU. Under single-node user-mode networking (as configured by dstackup),
cvm.kms_urls holds the guest-only 10.0.2.2 alias, which is not routable from
the host.

When the VM manifest does not override kms_urls, try the host-side top-level
kms_url first and fall back to cvm.kms_urls (deduplicated).

Signed-off-by: Pierre LE GUEN <26087574+PierreLeGuen@users.noreply.github.com>
dstackup install writes cvm.kms_urls with the QEMU user-mode guest alias
(https://10.0.2.2:<port>), which is not routable from the host, and left
the top-level host kms_url empty. Set kms_url = https://127.0.0.1:<port>
when KMS is enabled so host-side VMM RPCs (app-epoch resolution on 0.6.7
SEV-SNP launches and env-key lookups) can reach the local KMS.

Signed-off-by: Pierre LE GUEN <26087574+PierreLeGuen@users.noreply.github.com>
create_vm rejected --env-file when --kms-url was omitted even if
--kms-encrypt-url was given (unlike update_vm, which already allowed it).
Allowing --kms-encrypt-url without --kms-url lets single-node hosts encrypt
envs against the host-side KMS without overriding cvm.kms_urls on the VM.

Signed-off-by: Pierre LE GUEN <26087574+PierreLeGuen@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T13:25:36.283756Z 2ad3c4f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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