feat: AMD SEV-SNP app key provisioning (GetAppKeyAmd)#630
feat: AMD SEV-SNP app key provisioning (GetAppKeyAmd)#630DeDTihoN wants to merge 8 commits intoDstack-TEE:masterfrom
Conversation
|
Thanks for the PR. I still need to review the details, but one high‑level concern: it’s not clear how this integrates with the existing dstack-os images, and for SEV-SNP the way we build the OS image and launch the CVM is part of the security model. Could you provide the scripts of how the SEV-SNP OS image is built and the CVM is launched? Also, in what environment do you expect this CVM to run (e.g. GCP, bare metal)? |
|
Thanks for the review! Just to clarify the intent of this PR: the goal here is not to integrate AMD SEV-SNP support into dstack itself, but rather to allow VMs that are already running under AMD SEV-SNP (built and launched independently) to obtain keys from the dstack KMS, which itself runs as a TDX CVM. How dstack-os images for SEV-SNP would be built in the future — and how they would communicate with a dstack KMS host — is a separate concern that can be addressed later with dedicated approaches. Regarding your questions about image build and launch — for our SecretVM case specifically:
As for the environment — we expect these CVMs to run on bare metal. |
Thanks for the detailed writeup. There are two concerns with this approach. 1. A separate Every additional API endpoint is another code path to audit, keep in sync with policy changes, and reason about during security reviews. The asymmetry between the TDX and AMD paths (different transport, different root-of-trust verification, different response encryption) means bugs or policy updates would need to be applied and tested in two places independently. The preference is to converge on a single key provisioning model rather than fan out. 2. Without vTPM/SVSM, the host can manipulate the AMD CVM in ways the KMS cannot detect The current implementation relies on AMD SEV-SNP measured direct boot, where The right fix is to introduce a vTPM backed by Coconut-SVSM running at VMPL0. SVSM is hardware-isolated from the guest OS (via AMD's RMP/VMPL enforcement), measures ACPI tables and other boot components into vTPM PCRs before the guest OS runs, and can produce a TPM quote whose trust chain is anchored to the SNP attestation report ( Beyond fixing the security gap, vTPM/SVSM would also allow the AMD attestation model to converge with how dstack handles non-TDX environments. In dstack-cloud's GCP support, a unified This is significantly more work than the current PR — the suggestion would be to address the vTPM/SVSM integration before merging. Happy to discuss the design if that's useful. |
feat: AMD SEV-SNP app key provisioning (
GetAppKeyAmd)Adds AMD SEV-SNP support to the KMS. AMD-based confidential VMs can now obtain the same application keys (disk encryption, env secrets, k256 identity) as Intel TDX VMs.
How it differs from
GetAppKey(TDX)GetAppKey)GetAppKeyAmd)MEASUREMENTfixed at launch: OVMF + kernel + initrd + cmdlineMEASUREMENT; KMS recomputes expected value and rejects any mismatchos_image_hash+compose_hashos_image_hash+compose_hashreport_dataAMD SEV-SNP supports generating on-demand attestation reports with custom
report_data(via/dev/sev-guest), so RA-TLS over mTLS would be technically feasible. However, implementing it would require changes at multiple levels: AMD-specific X.509 extension format, a new code path inhandle_prpc_implto parse two different attestation types from client certs, and a new cert generation flow parallel to the existing TDX one. Instead, the current approach sends the SNP report in the request body and ECDH-encrypts the response to the VM's X25519 pubkey embedded inreport_data[0..32]. The VM places its pubkey there before requesting the report from the kernel, so AMD hardware attests it. This is simpler to implement and equivalent in security.Changes
kms/src/main_service.rsget_app_key_amd: verifies AMD cert chain (ARK → ASK → VCEK → SNP report), recomputes expectedMEASUREMENT, calls auth webhook, derives keys, ECDH-encrypts responsekms/rpc/proto/kms_rpc.protoGetAppKeyAmdRPC,GetAppKeyAmdRequest,AppKeyAmdResponsekms/src/config.rs,kms/kms.toml[core.sev_snp]section (ovmf_path,guest_features); if absent, measurement recomputation is skippeddstack-attest/DstackSevSnpattestation mode variant