You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: attestation.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# TEE Attestation Guide for DStack Applications
1
+
# TEE Attestation Guide for dstack Applications
2
2
3
-
This document outlines the process of verifying the authenticity and integrity of data produced by DStack Applications running within Intel TDX environments.
3
+
This document outlines the process of verifying the authenticity and integrity of data produced by dstack Applications running within Intel TDX environments.
4
4
5
5
## 1. Review code safety
6
6
@@ -11,28 +11,28 @@ This document outlines the process of verifying the authenticity and integrity o
11
11
## 2. Validate data origin authenticity
12
12
### 2.1 Understanding tdx quote measurements
13
13
14
-
Applications generate a tdx quote using Dstack's API given the data they want to prove.
14
+
Applications generate a tdx quote using dstack's API given the data they want to prove.
15
15
16
16
The quote signature can be verified using dcap-qvl to confirm its generation by a legitimate TDX CVM and environment trustworthiness.
17
17
Following signature verification, examine MRTD and RTMRs to confirm the CVM is executing the verified code.
18
18
19
19
The MR register values indicate the following:
20
20
21
-
- MRTD: Contains the virtual firmware measurement, taken by TDX-module in SEAM mode. Virtual firmware (OVMF in Dstack's case) is the first code executed post-CVM startup, serving as the App code's trust anchor. Intel signs and guarantees TDX-module integrity.
21
+
- MRTD: Contains the virtual firmware measurement, taken by TDX-module in SEAM mode. Virtual firmware (OVMF in dstack's case) is the first code executed post-CVM startup, serving as the App code's trust anchor. Intel signs and guarantees TDX-module integrity.
22
22
23
-
- RTMR: Measurements recorded by code executing within the CVM. In Dstack OS, these measurements are defined as:
23
+
- RTMR: Measurements recorded by code executing within the CVM. In dstack OS, these measurements are defined as:
24
24
25
-
- RTMR0: OVMF records CVM's virtual hardware setup, including CPU count, memory size, and device configuration. While Dstack uses fixed devices, CPU and memory specifications can vary. RTMR0 can be computed from these specifications.
25
+
- RTMR0: OVMF records CVM's virtual hardware setup, including CPU count, memory size, and device configuration. While dstack uses fixed devices, CPU and memory specifications can vary. RTMR0 can be computed from these specifications.
26
26
- RTMR1: OVMF records the Linux kernel measurement.
27
27
- RTMR2: Linux kernel records kernel cmdline (including rootfs hash) and initrd measurements.
28
-
- RTMR3: initrd records Dstack App details, including compose hash, instance id, app id, rootfs hash, and key provider.
28
+
- RTMR3: initrd records dstack App details, including compose hash, instance id, app id, rootfs hash, and key provider.
29
29
30
30
MRTD, RTMR0, RTMR1, and RTMR2 can be pre-calculated from the built image (given CPU+RAM specifications). Compare these with the verified quote's MRs to confirm correct base image code execution.
31
31
32
32
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.
33
33
34
34
### 2.2. Determining expected MRs
35
-
MRTD, RTMR0, RTMR1, and RTMR2 correspond to the image. Dstack OS builds all related software from source.
35
+
MRTD, RTMR0, RTMR1, and RTMR2 correspond to the image. dstack OS builds all related software from source.
# Bootnode URL. If you want to deploy a multi-node dstack-gateway cluster, set the bootnode URL to the URL of another node already deployed or planed to be deployed later.
# Set defaults for variables that might not be in .env
@@ -296,10 +296,10 @@ After the dstack-vmm is ready, you can deploy an app on it following the steps b
296
296
297
297
The on-chain registration process includes two steps:
298
298
299
-
1. Deploy an App's control contract DstackApp. Developers can develop their own or choose the reference contract from the Dstack repository. Custom contracts need to implement the IAppAuth interface.
299
+
1. Deploy an App's control contract DstackApp. Developers can develop their own or choose the reference contract from the dstack repository. Custom contracts need to implement the IAppAuth interface.
300
300
2. Call DstackKms.registerApp(appContractAddress) to register the contract.
301
301
302
-
The Dstack repository provides scripts to complete these two steps:
302
+
The dstack repository provides scripts to complete these two steps:
303
303
304
304
**Option 1: Traditional deployment (2 transactions)**
Copy file name to clipboardExpand all lines: docs/design-and-hardening-decisions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ The meta-dstack layer is designed to create a minimally secure image for booting
10
10
11
11
**Decision**: We use `linux-yocto-dev` (development recipes) instead of `linux-yocto` (stable recipes).
12
12
13
-
**Rationale**: We use Scarthgap version of Yocto, which is the latest version when we started the Dstack project. The stable `linux-yocto` recipe in Scarthgap is based on kernel 6.6 which does not support RTMR[1-2]. So we switch to `linux-yocto-dev` to get the kernel 6.9 support. The latest released Yocto (Walnascar) updated kernel to 6.12 which meets our requirements. We plan to upgrade the Yocto version later, but this is not trivial as all downstream Yocto recipes need to be updated to adapt to the major Yocto version change.
13
+
**Rationale**: We use Scarthgap version of Yocto, which is the latest version when we started the dstack project. The stable `linux-yocto` recipe in Scarthgap is based on kernel 6.6 which does not support RTMR[1-2]. So we switch to `linux-yocto-dev` to get the kernel 6.9 support. The latest released Yocto (Walnascar) updated kernel to 6.12 which meets our requirements. We plan to upgrade the Yocto version later, but this is not trivial as all downstream Yocto recipes need to be updated to adapt to the major Yocto version change.
14
14
15
15
### 2. TDVF vs td-shim Boot Firmware
16
16
@@ -49,7 +49,7 @@ See [here](https://intel.github.io/ccc-linux-guest-hardening-docs/security-spec.
49
49
50
50
### 5. Secure System Time
51
51
52
-
**Implementation**: Dstack OS enforces the guest kernel uses TSC as the only timer source by appending `tsc=reliable no-kvmclock` to the kernel cmdline. It also enforces the use of NTS with built-in [trusted servers](https://github.com/Dstack-TEE/meta-dstack/blob/bef2dfa850f4116ae4ece96d8c0948965c5874b3/meta-dstack/recipes-core/chrony/files/chrony.conf#L13-L20) to synchronize system time.
52
+
**Implementation**: dstack OS enforces the guest kernel uses TSC as the only timer source by appending `tsc=reliable no-kvmclock` to the kernel cmdline. It also enforces the use of NTS with built-in [trusted servers](https://github.com/Dstack-TEE/meta-dstack/blob/bef2dfa850f4116ae4ece96d8c0948965c5874b3/meta-dstack/recipes-core/chrony/files/chrony.conf#L13-L20) to synchronize system time.
53
53
54
54
**Behavior**: When `secure_time` is enabled in the app-compose.json configuration, the system ensures time synchronization is completed before requesting application keys. If `secure_time` is disabled, time synchronization is not enforced before application launch.
Copy file name to clipboardExpand all lines: docs/security-guide/cvm-boundaries.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
-
This document describes the Dstack defined information exchange channels between CVM and the outside world.
1
+
This document describes the dstack defined information exchange channels between CVM and the outside world.
2
2
3
3
## Network layer
4
4
5
5
### Virtual Native Network
6
-
Dstack currently uses QEMU's user-mode network stack to create a virtual network for the CVM. In this setup, QEMU (running on the host) simulates the gateway, DNS, and DHCP services. The CVM should treat these network components as untrusted.
6
+
dstack currently uses QEMU's user-mode network stack to create a virtual network for the CVM. In this setup, QEMU (running on the host) simulates the gateway, DNS, and DHCP services. The CVM should treat these network components as untrusted.
7
7
8
8
### Wireguard Network
9
9
When dstack-gateway is enabled, it establishes a secure Wireguard network connection between the workload CVM and dstack-gateway CVM.
10
10
External clients connect to the workload CVM through dstack-gateway using the CVM's ZT-HTTPS domain. For clients, ZT-HTTPS ensures no man-in-the-middle attacks can occur between them and the workload CVM. However, workload developers should note that incoming traffic might come from either dstack-gateway or the QEMU native network.
11
11
12
12
## Host Shared Folder
13
-
Dstack OS requires a host shared folder to be attached to the CVM. It copies the following files from the host shared folder to the CVM:
13
+
dstack OS requires a host shared folder to be attached to the CVM. It copies the following files from the host shared folder to the CVM:
14
14
15
15
| File | Purpose |
16
16
|------|--------|
@@ -82,7 +82,7 @@ The hash of this file is not extended to any RTMR because each field has its own
82
82
It does not make sense to measure the entire sys-config.json, because it is not deterministic and measuring it would make the verification process troublesome.
83
83
84
84
### .encrypted-env
85
-
Dstack uses encrypted environment variables to allow app developers to securely load sensitive configuration values into the CVM. Since these variables are temporarily stored on the host server before being loaded into the CVM, encryption ensures host servers cannot access the confidential data.
85
+
dstack uses encrypted environment variables to allow app developers to securely load sensitive configuration values into the CVM. Since these variables are temporarily stored on the host server before being loaded into the CVM, encryption ensures host servers cannot access the confidential data.
86
86
87
87
#### Encryption Workflow:
88
88
@@ -116,13 +116,13 @@ Dstack uses encrypted environment variables to allow app developers to securely
116
116
This file is not measured to RTMRs. But it is highly recommended to add application-specific integrity checks on encrypted environment variables at the application layer. See [security-guide.md](security-guide.md) for more details.
117
117
118
118
### .user-config
119
-
This is an optional application-specific configuration file that applications inside the CVM can access. Dstack OS simply stores it at /dstack/user-config without any measurement or additional processing.
119
+
This is an optional application-specific configuration file that applications inside the CVM can access. dstack OS simply stores it at /dstack/user-config without any measurement or additional processing.
120
120
121
121
Application developers should perform integrity checks on user_config at the application layer if necessary.
122
122
123
123
## APIs
124
124
125
-
Dstack provides several API services for communication between components. These APIs define the boundaries and information exchange channels between the CVM and external systems.
125
+
dstack provides several API services for communication between components. These APIs define the boundaries and information exchange channels between the CVM and external systems.
Copy file name to clipboardExpand all lines: docs/security-guide/security-guide.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Dstack Production Security Best Practices
1
+
# dstack Production Security Best Practices
2
2
3
3
This document describes security considerations for deploying dstack apps in production.
4
4
@@ -30,11 +30,11 @@ services:
30
30
31
31
## Reproducibility
32
32
33
-
If your App is intended for end users who need to verify what code your App is running, then the verifiability of Docker images is crucial. Dstack anchors the code running inside the CVM through the hash of app-compose.json. However, at the same time, the App needs to provide users with a reproducible build method. There are multiple ways to achieve reproducible image builds, and dstack provides a reference example: [dstack-ingress](https://github.com/Dstack-TEE/dstack-examples/tree/main/custom-domain/dstack-ingress)
33
+
If your App is intended for end users who need to verify what code your App is running, then the verifiability of Docker images is crucial. dstack anchors the code running inside the CVM through the hash of app-compose.json. However, at the same time, the App needs to provide users with a reproducible build method. There are multiple ways to achieve reproducible image builds, and dstack provides a reference example: [dstack-ingress](https://github.com/Dstack-TEE/dstack-examples/tree/main/custom-domain/dstack-ingress)
34
34
35
35
## Authenticated envs and user_config
36
36
37
-
Dstack provides encrypted environment variable functionality. Although the CVM physical machine controller cannot view encrypted environment variables, they may forge encrypted environment variables because the CVM encryption public key is known to everyone. Therefore, Apps need to perform auth checks on encrypted environment variables at the application layer. LAUNCH_TOKEN pattern is one method to prevent unauthorized envs replacement. For details, refer to the deployment script of [dstack-gateway](https://github.com/Dstack-TEE/dstack/blob/1b8a4516826b02f9d7f747eddac244dcd68fc325/gateway/dstack-app/deploy-to-vmm.sh#L150-L165).
37
+
dstack provides encrypted environment variable functionality. Although the CVM physical machine controller cannot view encrypted environment variables, they may forge encrypted environment variables because the CVM encryption public key is known to everyone. Therefore, Apps need to perform auth checks on encrypted environment variables at the application layer. LAUNCH_TOKEN pattern is one method to prevent unauthorized envs replacement. For details, refer to the deployment script of [dstack-gateway](https://github.com/Dstack-TEE/dstack/blob/1b8a4516826b02f9d7f747eddac244dcd68fc325/gateway/dstack-app/deploy-to-vmm.sh#L150-L165).
38
38
39
39
If you use dstack-vmm's built-in UI, the prelaunch script has already been automatically filled in for you:
40
40
@@ -79,7 +79,7 @@ Example app-compose.json:
79
79
80
80
## Don't expose unexpected ports
81
81
82
-
In Dstack CVM, dstack-guest-agent listens on port 8090, allowing public access to basic CVM information.
82
+
In dstack CVM, dstack-guest-agent listens on port 8090, allowing public access to basic CVM information.
83
83
84
84
In docker-compose.yaml, all declared ports will be exposed to the public internet. Do not expose unnecessary ports.
0 commit comments