Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
59b2676
fix(os): omit built-in FUSE module package
kvinwang Jul 24, 2026
d89918f
fix(os): fail multi-flavor builds on first error
kvinwang Jul 24, 2026
26cc02c
fix(simulator): wait for GCP vTPM readiness
kvinwang Jul 24, 2026
dac6797
fix(os): install TPM device TCTI for simulator
kvinwang Jul 24, 2026
bba596f
fix(simulator): expose GCP TPM event log
kvinwang Jul 24, 2026
32cd940
fix(simulator): shadow securityfs for GCP event log
kvinwang Jul 24, 2026
d255482
test(simulator): log NitroTPM vendor commands
kvinwang Jul 24, 2026
3de12a0
fix(simulator): advertise NitroTPM vendor command
kvinwang Jul 24, 2026
36b223c
style(simulator): apply repository rustfmt
kvinwang Jul 24, 2026
3e3f3fe
fix(simulator): report live NitroTPM PCRs
kvinwang Jul 24, 2026
750a75e
chore(simulator): remove NitroTPM debug output
kvinwang Jul 24, 2026
5786cdc
fix(vmm): generate simulated SEV-SNP mr_config
kvinwang Jul 24, 2026
09b4171
fix(vmm): pass cloud image measurements to guests
kvinwang Jul 24, 2026
8b1a25b
style(vmm): apply repository rustfmt
kvinwang Jul 24, 2026
7c75a22
fix(simulator): retry interrupted vTPM reads
kvinwang Jul 24, 2026
9cbd3d9
Merge pull request #842 from Dstack-TEE/codex/fix-os-fuse-package
kvinwang Jul 31, 2026
c64370c
Merge pull request #843 from Dstack-TEE/codex/fix-os-multiflavor-failure
kvinwang Jul 31, 2026
f01de7e
fix(simulator): support current FUSE soname
kvinwang Jul 31, 2026
931a055
Merge pull request #844 from Dstack-TEE/codex/fix-simulator-fuse-soname
kvinwang Jul 31, 2026
c515440
Merge pull request #846 from Dstack-TEE/codex/fix-simulator-gcp-vtpm-…
kvinwang Jul 31, 2026
001ef21
Merge pull request #847 from Dstack-TEE/codex/fix-os-simulator-tpm-tcti
kvinwang Jul 31, 2026
edc8c71
refactor(simulator): use safe securityfs mount wrapper
kvinwang Jul 31, 2026
ba398bd
build(simulator): record safe mount dependency
kvinwang Jul 31, 2026
16ff3c6
refactor(simulator): use safe descriptor flag wrappers
kvinwang Jul 31, 2026
2d8aaa6
Merge pull request #848 from Dstack-TEE/codex/fix-simulator-gcp-event…
kvinwang Jul 31, 2026
40ec54b
refactor(tpm2): support stream transports
kvinwang Jul 31, 2026
e8e3c0e
feat(tpm2): edit command capability responses
kvinwang Jul 31, 2026
9af0419
refactor(simulator): use typed TPM APIs
kvinwang Jul 31, 2026
dfee379
fix(tpm2): preserve device response reads
kvinwang Jul 31, 2026
beee917
test(tpm2): cover stream response framing
kvinwang Jul 31, 2026
70cc370
fix(tpm2): satisfy strict CI checks
kvinwang Jul 31, 2026
8af2ac8
fix(simulator): report live NitroTPM PCR capabilities (#849)
kvinwang Jul 31, 2026
47dc2d2
refactor(vmm): select MR config version explicitly
kvinwang Jul 31, 2026
6a71d79
feat(attestation): allow unbound V3 app identity
kvinwang Aug 3, 2026
7bf644a
refactor(attestation): omit unset MR config fields
kvinwang Aug 3, 2026
992b525
Merge pull request #850 from Dstack-TEE/codex/fix-vmm-simulated-snp-m…
kvinwang Aug 3, 2026
c4ea811
feat(compose): support multiple init scripts
kvinwang Jul 31, 2026
eb908cb
Merge pull request #975 from Dstack-TEE/feat/init-script-array
kvinwang Aug 3, 2026
86631a4
Merge pull request #851 from Dstack-TEE/codex/fix-vmm-cloud-image-mea…
kvinwang Aug 3, 2026
adc7b07
Merge pull request #852 from Dstack-TEE/codex/fix-simulator-interrupt…
kvinwang Aug 3, 2026
2563c2f
fix(guest): disable the ZFS pool root mountpoint
kvinwang Jul 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion docs/attestation-tdx.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,19 @@ MRTD, RTMR0, RTMR1, and RTMR2 can be pre-calculated from the built image (given

RTMR3 differs as it contains runtime information like compose hash and instance id. Verify this by replaying the event log - if the calculated RTMR3 matches the quote's RTMR3, the event log information is valid. Then verify the compose hash, key provider, and other event log details match expectations.

For a GPU launch, `compose-hash` is followed by `gpu-policy-hash` and, after successful NVIDIA attestation and policy evaluation, `gpu-attestation`. The `gpu-policy-hash` payload is `SHA-256(JCS(requirements.gpu_policy))`, using `{}` when the field is omitted. The `gpu-attestation` payload is JSON containing the verified device count, CC/DevTools state, and `evidence_sha256`.
After `compose-hash`, each configured init script produces an ordered
`init-script-hash` event whose payload is the SHA-256 digest of the exact UTF-8
script bytes. The event order matches the script array order. These events let
an infrastructure provider contribute initialization code approved by
multiple parties and let each party verify its code independently without
reconstructing the complete compose document.

For a GPU launch, any `init-script-hash` events are followed by
`gpu-policy-hash` and, after successful NVIDIA attestation and policy
evaluation, `gpu-attestation`. The `gpu-policy-hash` payload is
`SHA-256(JCS(requirements.gpu_policy))`, using `{}` when the field is omitted.
The `gpu-attestation` payload is JSON containing the verified device count,
CC/DevTools state, and `evidence_sha256`.

The guest-agent `GpuInfo` API returns the complete `nvattest` JSON captured during boot. It is not trustworthy by itself. After verifying the TDX quote and replaying the event log to RTMR3, hash the exact UTF-8 bytes of `GpuInfo.attestation` and require the result to equal the `gpu-attestation` event's `evidence_sha256`. See [GPU Security for AI Workloads](./security/security-model.md#gpu-security-for-ai-workloads) for the event schema, ordering, Rego example, and platform differences.

Expand Down
2 changes: 1 addition & 1 deletion docs/aws-attested-instance-security-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NitroTPM path meets them today.
| P1 | Verifiable platform root of trust | TDX/SNP/Nitro quote verification against vendor root; debug rejected; TCB surfaced | NitroTPM Attestation Documents are verified against the AWS Nitro Attestation PKI, including document timestamp sanity. AWS exposes no TDX/SNP-style TCB advisory field, so a verified attestation is normalized to `tcbStatus = "UpToDate"` and passes the standard authorization gate unchanged. |
| P2 | Reproducible or independently computable base image measurement | meta-dstack rebuild plus `dstack-mr` computes `MRTD`/`RTMR0-2` | The unified `os/build.sh` flow emits the AWS image archive with `sha256sum.txt`, `digest.txt`, and `measurement.aws.cbor`; its output directory also contains the reference-PCR side-car `aws-pcrs.json`. `os_image_hash = sha256(sha256sum.txt)` is the same identity used on all platforms; the verifier recomputes it from the downloaded image directory (`dstack/verifier/src/verification.rs`). The hardening audit script `os/yocto/tools/aws/audit-aws-ec2-image-hardening.sh` checks the image for operator mutation channels. |
| P3 | Boot command line and root filesystem integrity are measured | `RTMR1/2`, rootfs hash, dm-verity, measured initrd/cmdline | The UKI commits kernel, initrd, and embedded cmdline into `PCR4`; the rootfs is dm-verity-protected. `VmConfig.aws_measurement` is required and must bind `boot_pcr_digest = sha256(PCR4||PCR7||PCR12)` to the attested PCRs, so `PCR12` (external cmdline) is always part of the bound digest — a missing-PCR12 bypass is not expressible. Enforced in guest quote generation (`dstack/dstack-attest/src/attestation.rs`), `verify_os_image_hash_for_aws_nitro_tpm` (`dstack/verifier/src/verification.rs`), and the KMS pipeline via the same verifier check. |
| P4 | Runtime application identity is cryptographically bound | RTMR3 `compose-hash`, `app-id`, `instance-id`, `key-provider`; event log replay | SHA384 `PCR14` event-log replay is the authoritative binding (RTMR3 analogue; non-resettable). Launch events: `system-preparing`, `app-id`, `compose-hash`, `instance-id`, `boot-mr-done`, `key-provider`, `storage-fs`, `system-ready` (`dstack/dstack-util/src/system_setup.rs`). `dstack-attest`, `dstack-verifier`, and KMS reject missing/mismatched PCR14 and bad replay. Optionally, the guest extends the raw `MrConfig` V2 `config_id` into `PCR8` once (`PCR8 = sha384(0^48 || config_id)`) so a lightweight third-party verifier can check compose hash + key provider without event-log replay; dstack's own verifier and KMS do not check PCR8. |
| P4 | Runtime application identity is cryptographically bound | RTMR3 `compose-hash`, `app-id`, `instance-id`, `key-provider`; event log replay | SHA384 `PCR14` event-log replay is the authoritative binding (RTMR3 analogue; non-resettable). Launch events: `system-preparing`, `app-id`, `compose-hash`, zero or more ordered `init-script-hash` events, `instance-id`, `boot-mr-done`, `key-provider`, `storage-fs`, `system-ready` (`dstack/dstack-util/src/system_setup.rs`). GPU launches also include `gpu-policy-hash` and `gpu-attestation` before `instance-id`. `dstack-attest`, `dstack-verifier`, and KMS reject missing/mismatched PCR14 and bad replay. Optionally, the guest extends the raw `MrConfig` V2 `config_id` into `PCR8` once (`PCR8 = sha384(0^48 || config_id)`) so a lightweight third-party verifier can check compose hash + key provider without event-log replay; dstack's own verifier and KMS do not check PCR8. |
| P5 | Challenge/liveness and caller key binding | `report_data` challenge or RA-TLS public key hash in quote | RA-TLS binds `report_data` to the TLS certificate public key. KMS key release is bound to the live RA-TLS handshake; external `/verify` callers supply and check their own `report_data` challenge. The low-level NitroTPM document verifier also rejects stale or far-future document timestamps. |
| P6 | Secret release only to attested code | dstack KMS verifies attestation, checks auth policy, derives per-app keys | dstack KMS verifies the NitroTPM attestation, runs the same `verify_os_image_hash_for_aws_nitro_tpm` binding check as the verifier, builds `BootInfo` from verified boot PCRs plus PCR14 launch events, and checks auth policy before deriving app keys (`dstack/kms/src/main_service.rs`). AWS NitroTPM key release is gated behind the opt-in `aws_nitro_tpm_key_release` flag (default false in `kms.toml`). |
| P7 | Key-release policy is not controlled by the untrusted account admin | KMS runs inside TEE; policy from auth API/contracts; KMS identity measured | Satisfied with dstack KMS or another verifiable secret authority outside the untrusted AWS account admin's control. A NitroTPM-backed dstack KMS keeps root material out of account-admin snapshots and clones. The policy backend (auth-simple in a trusted control plane, or on-chain `DstackKms`/`DstackApp`) must be outside the workload account admin's control. Same-account AWS KMS fails this property if the admin can change key policy, create grants, or call secret-bearing operations through a policy they control. |
Expand Down
4 changes: 3 additions & 1 deletion docs/security/cvm-boundaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ This is the main configuration file for the application in JSON format:
| no_instance_id | 0.4.2 | boolean | Disable instance ID generation |
| secure_time | 0.5.0 | boolean | Whether secure time is enabled |
| pre_launch_script | 0.4.0 | string | Prelaunch bash script that runs before execute `docker compose up` |
| init_script | 0.5.5 | string | Bash script that executed prior to dockerd startup |
| init_script | 0.5.5 (string), 0.6.0 (string[]) | string or string[] | Up to 5 Bash scripts executed in order prior to dockerd startup; a string is treated as a one-element array. Multiple scripts require string `manifest_version: "3"` so older guests fail closed. MrConfigV3 binds the hashes only for manifest v3. |
| storage_fs | 0.5.5 | string | Filesystem type for the data disk of the CVM. Supported values: "zfs", "ext4". default to "zfs". **ZFS:** Ensures filesystem integrity with built-in data protection features. **ext4:** Provides better performance for database applications with lower overhead and faster I/O operations, but no strong integrity protection. |
| swap_size | 0.5.5 | string/integer | The linux swap size. default to 0. Can be in byte or human-readable format (e.g., "1G", "256M"). |
| key_provider | 0.5.6 | string | Key provider type. Supported values: "none", "kms", "local", "tpm". GCP vTPM and AWS EC2 NitroTPM are part of their platform trust models. The Dstack platform can use VMM-managed swtpm for seal/unseal and restart persistence, but it offers no protection against the host and is intentionally not accepted by remote verifiers. |

The five-script limit bounds runtime-event-log and MrConfigV3 growth while
allowing several independently approved infrastructure initialization stages.

The hash of this file content is extended as the dstack `compose-hash` launch event. On TDX-family platforms the launch event is measured into RTMR3. On AWS NitroTPM it is measured into non-resettable SHA384 PCR14 before the `system-ready` launch boundary. Remote verifiers extract and replay this event during attestation.

Expand Down
11 changes: 11 additions & 0 deletions docs/security/security-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ The policy must define the boolean rule `data.policy.nv_match`. Its `input` is t

After measuring `compose-hash`, dstack enters the GPU setup gate and JCS-canonicalizes the original `requirements.gpu_policy` JSON value, then measures its SHA-256 digest in a `gpu-policy-hash` event. When the field is absent—including when `requirements` itself is absent—both parsing and measurement use the default empty object `{}`. Thus an omitted policy and an explicit `{}` have the same digest, while any explicitly present field, including an explicit default value, changes the digest. MrConfigV3 GPU launches also carry this digest as the optional `gpu_policy_hash` field; non-GPU launches omit it for compatibility. When the field is present, the guest compares it with the digest computed from app-compose; when it is absent, the guest skips this MrConfigV3 check. The MrConfigV3 document is bound by TDX `MR_CONFIG_ID` or SEV-SNP `HOST_DATA`, so the host cannot substitute a different GPU policy when this optional binding is present without changing the platform launch identity. The typed policy used for enforcement applies omitted-field defaults and rejects unknown fields. If GPU attestation is enabled and NVIDIA GPUs are present, dstack attests them and applies the basic settings and optional Rego policy before setting the GPU ready state. When no attestation claims are produced—because no GPU is attached or `gpu_policy.attest_gpu` is false—Rego is still evaluated with an empty array as `input` before any ready-state transition. This lets an application reject a launch whose attested GPU count is wrong. A false, undefined, malformed, or non-boolean Rego result stops boot before key provisioning.

Up to five init scripts may be configured. Their ordered SHA-256 digests are
measured as `init-script-hash` runtime events on platforms with a quoted
runtime register. MrConfigV3 also carries the ordered digest list; on SEV-SNP,
the signed report's `HOST_DATA` binds the exact canonical MrConfigV3 document.
An omitted `init_script_hashes` field disables this check,
while an explicit empty list requires app-compose to contain no init scripts.
When present, the guest compares the list with hashes computed from app-compose
before continuing boot. Current VMMs serialize the field explicitly for
manifest v3 launches, including `init_script_hashes: []` when the list is empty.

The policy digest is remotely verifiable on each supported platform, but through different carriers:

- **TDX:** `gpu-policy-hash` contains the raw 32-byte digest and is measured into RTMR3. Replay the event log and compare the result with the quote's RTMR3, then compare the event payload with the expected digest. When an MrConfigV3 document includes `gpu_policy_hash`, TDX `MR_CONFIG_ID` additionally binds that field.
Expand All @@ -114,6 +124,7 @@ For a successful TDX GPU launch, the GPU-relevant RTMR3 event order is:

```text
compose-hash
init-script-hash (zero or more, in configured order)
gpu-policy-hash
gpu-attestation
instance-id
Expand Down
6 changes: 4 additions & 2 deletions docs/tutorials/attestation-verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ These are the standard events you'll see in the log:
| `system-preparing` | System initialization marker | Always present |
| `app-id` | Application identifier | Should match your app name |
| `compose-hash` | SHA-256 of docker compose config | Should match `tcb_info.compose_hash` |
| `init-script-hash` | SHA-256 of one init script; repeated in configured order (maximum 5) | Should match the independently approved script bytes |
| `gpu-policy-hash` | SHA-256 of the JCS-canonicalized GPU policy (default `{}`) | Should match the expected `requirements.gpu_policy` digest |
| `gpu-attestation` | Verified GPU state and digest of the boot-time `nvattest` JSON | Required for an attested GPU launch; verify as described below |
| `instance-id` | Unique instance identifier | Should match `instance_id` from response |
Expand All @@ -531,8 +532,9 @@ These are the standard events you'll see in the log:
| `storage-fs` | Storage filesystem type | Storage configuration |
| `system-ready` | System ready marker | Always present at end |

For a successful GPU launch, the relevant order is `compose-hash`,
`gpu-policy-hash`, `gpu-attestation`, `instance-id`, and `boot-mr-done`.
For a successful GPU launch, the relevant order is `compose-hash`, any
`init-script-hash` events, `gpu-policy-hash`, `gpu-attestation`, `instance-id`,
and `boot-mr-done`.
After replaying the log to the quote's RTMR3, decode the JSON payload of
`gpu-attestation` and compare its `evidence_sha256` with the SHA-256 digest of
the exact UTF-8 `GpuInfo.attestation` string. `GpuInfo` reads the result saved
Expand Down
16 changes: 16 additions & 0 deletions dstack/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dstack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ scale = { version = "3.7.4", package = "parity-scale-codec", features = [
] }
serde = { version = "1.0.228", features = ["derive"], default-features = false }
serde-human-bytes = "0.1.2"
serde_with = "3.14.0"
semver = "1.0.28"
serde_jcs = "0.2.0"
rmp-serde = "1.3.1"
Expand Down
Loading
Loading