Policy enum
ThePolicy enum determines which verifier to use and its configuration. Policies can be serialized/deserialized with serde, making them easy to load from JSON configuration files.
Definition
Methods
Usage examples
Default policy
Development policy
From JSON
DstackTdxPolicy
Policy configuration for dstack TDX verification.Definition
Fields
Expected bootchain measurements (MRTD, RTMR0-2). Required unless
disable_runtime_verification is true.Expected app compose configuration. Required unless
disable_runtime_verification is true.Expected OS image hash (SHA256, lowercase hex). Required unless
disable_runtime_verification is true.Allowed TCB status values. Valid values:
UpToDate, OutOfDate, ConfigurationNeeded, TDRelaunchAdvised, SWHardeningNeeded, Revoked.Grace period in seconds for
OutOfDate platforms. If set, requires allowed_tcb_status to include OutOfDate. Platform is allowed only if tcb_date + grace_period >= current_time.PCCS URL for collateral fetching.
Cache collateral to avoid repeated fetches.
Disable runtime verification (NOT RECOMMENDED for production). When false, all runtime fields (
expected_bootchain, app_compose, os_image_hash) must be provided. Set to true only for development/testing.Methods
Usage examples
Default production policy
Development policy
With grace period
From JSON
ExpectedBootchain
Expected bootchain measurements for verification. These measurements represent the known-good values for TDX bootchain components.Definition
Fields
MRTD - Initial TD memory contents (TDVF/firmware). Hash of the initial TD memory layout, including the firmware/TDVF that runs before the OS kernel. Must be lowercase hex string.
RTMR0 - Virtual hardware environment. Measures the virtual hardware configuration and TD configuration. Must be lowercase hex string.
RTMR1 - Linux kernel. Measures the Linux kernel loaded into the TD. Must be lowercase hex string.
RTMR2 - Kernel cmdline + initramfs. Measures the kernel command line parameters and initial ramdisk. Must be lowercase hex string.
Usage example
TCB status values
The following TCB status values are recognized:Status descriptions
- UpToDate: Platform TCB is up to date
- OutOfDate: Platform TCB is out of date and should be updated
- ConfigurationNeeded: Platform configuration needs to be updated
- TDRelaunchAdvised: TD should be relaunched to apply updates
- SWHardeningNeeded: Additional software hardening is needed
- Revoked: Platform TCB has been revoked
Production recommendations
For production environments:- Use
["UpToDate"]for strictest security - Consider
["UpToDate", "SWHardeningNeeded"]if you understand the security implications - Use
grace_periodwithOutOfDateto allow time for platform updates - Never allow
Revokedstatus
Validation rules
TheDstackTdxPolicy::validate() method checks:
- All
allowed_tcb_statusvalues are inTCB_STATUS_LIST os_image_hashis a valid lowercase hex string (if provided)- All
expected_bootchainfields are valid lowercase hex strings (if provided) grace_periodrequiresallowed_tcb_statusto includeOutOfDate- If
disable_runtime_verificationis false,expected_bootchain,app_compose, andos_image_hashmust be provided (enforced at verifier build time)
See also
- atls_connect - High-level connection API
- Verifier trait - Low-level verifier interface
- Error handling - Error types
- BOOTCHAIN-VERIFICATION.md - Expected measurement derivation