|
| 1 | +# mock-attestation |
| 2 | + |
| 3 | +Development-only, cryptographically valid attestation evidence for CI and the |
| 4 | +`dstack-tee-simulator` dev image. |
| 5 | + |
| 6 | +The crate derives a development PKI from a 32-byte seed and dynamically signs evidence for: |
| 7 | + |
| 8 | +- Intel TDX/DCAP, including TCB Info, QE Identity, PCK certificates and CRLs; |
| 9 | +- AMD SEV-SNP, including ARK, ASK, VCEK and reports; |
| 10 | +- TPM, including AK certificates, quotes, AIA and CRLs; |
| 11 | +- AWS NSM, including the certificate bundle and COSE Sign1 document. |
| 12 | + |
| 13 | +All evidence is verified in the test suite by the production QVLs. These keys |
| 14 | +are test credentials and must never be copied into a production image. |
| 15 | + |
| 16 | +## CLI |
| 17 | + |
| 18 | +Generate matching public roots and `sys-config-fragment.json`: |
| 19 | + |
| 20 | +```console |
| 21 | +dstack-mock-attestation generate \ |
| 22 | + --output ./mock-roots \ |
| 23 | + --collateral-base-url http://HOST_REACHABLE_FROM_VERIFIER:8088 |
| 24 | +``` |
| 25 | + |
| 26 | +Merge the generated fragment into the VM sys-config, then start the host-side |
| 27 | +Mock PCCS/KDS/AIA service from that same config: |
| 28 | + |
| 29 | +```console |
| 30 | +dstack-mock-attestation serve \ |
| 31 | + --listen 127.0.0.1:8088 \ |
| 32 | + --sys-config ./sys-config.json \ |
| 33 | + --output ./active-mock-roots |
| 34 | +``` |
| 35 | + |
| 36 | +The server exposes only production-shaped public collateral endpoints. Evidence |
| 37 | +is generated inside the development guest by `dstack-tee-simulator`; the HTTP |
| 38 | +service deliberately provides no unauthenticated signing endpoint. |
| 39 | + |
| 40 | +## Dev image |
| 41 | + |
| 42 | +Select the platform in `.sys-config.json`; omission defaults to TDX: |
| 43 | + |
| 44 | +```json |
| 45 | +{ |
| 46 | + "tee_simulator": { |
| 47 | + "platform": "dstack-amd-sev-snp", |
| 48 | + "mock_attestation_seed": "<64 hex characters>", |
| 49 | + "collateral_base_url": "http://HOST_REACHABLE_FROM_VERIFIER:8088" |
| 50 | + } |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +Valid values mirror the supported attestation modes: `dstack-tdx`, |
| 55 | +`dstack-gcp-tdx`, `dstack-amd-sev-snp`, `dstack-nitro-enclave`, and |
| 56 | +`dstack-aws-nitro-tpm`. The simulator exposes |
| 57 | +the production guest ABI for the selected platform (TSM configfs, vTPM, or an |
| 58 | +NSM CUSE character device); attester libraries contain no mock HTTP or |
| 59 | +environment-variable path. The guest only reads the |
| 60 | +seed from `.sys-config.json`; it never writes credentials or roots back into |
| 61 | +`/dstack/.host-shared`. CI retains the generated public roots and mounts them |
| 62 | +into verifier/KMS/gateway. The independently running host collateral service |
| 63 | +reconstructs the same hierarchy from the seed. Configure it under |
| 64 | +`[attestation.urls]`: TDX uses `pccs`, and SEV-SNP uses `amd_kds`. |
| 65 | + |
| 66 | +Every verifier process must also explicitly set |
| 67 | +`attestation.insecure_allow_external_trust_anchors = true`. Merely mounting and |
| 68 | +configuring a mock root is rejected at startup while this flag remains false. |
| 69 | + |
| 70 | +The seed adds only 64 hex bytes (the generated fragment is well below 1 KiB), |
| 71 | +so the existing 32 KiB sys-config copy limit does not need to be enlarged. |
| 72 | + |
| 73 | +## Required negative tests |
| 74 | + |
| 75 | +The crate tests ensure every platform rejects a different root and modified |
| 76 | +signed bytes. SEV-SNP additionally performs expected `report_data` comparison |
| 77 | +inside its QVL API. TDX/TPM/NSM expose their authenticated binding field for |
| 78 | +the caller; the production `dstack-attest` layer performs the final equality |
| 79 | +check. |
0 commit comments