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: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,7 +117,7 @@ Now you can open 3 terminals to start the components:
117
117
3. Run `./dstack-vmm -c vmm.toml`
118
118
119
119
⚠️ *Warning: this is for local development, and the kms is not secure, so you should not use it in production.*
120
-
For production, you should follow the [deployment guide](./docs/deployment.md).
120
+
For production, you should follow the [deployment guide](./docs/deployment.md) and read the [security guide](./docs/security-guide/security-guide.md).
121
121
122
122
## Deploy an App
123
123
Open the dstack-vmm webpage [http://localhost:9080](http://localhost:9080)(change the port according to your configuration) on your local machine to deploy a `docker-compose.yaml` file:
Copy file name to clipboardExpand all lines: docs/security-guide/security-guide.md
+23-4Lines changed: 23 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,21 @@ This document describes security considerations for deploying dstack apps in pro
7
7
When deploying applications in a TEE environment, it's critical to ensure the integrity and immutability of your container images. Using image digests (SHA256 hashes) instead of tags cryptographically ensures that the exact same image is always pulled, preventing supply chain attacks. This proves to users that your App is anchored to a specific code version.
8
8
9
9
❌ Bad example:
10
+
10
11
```yaml
11
12
services:
12
13
nginx:
13
-
image: nginx
14
+
image: nginx:latest
15
+
```
16
+
17
+
```yaml
18
+
services:
19
+
nginx:
20
+
image: nginx:1.27.5
14
21
```
15
22
16
23
✅ Good example:
24
+
17
25
```yaml
18
26
services:
19
27
nginx:
@@ -25,6 +33,7 @@ services:
25
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)
26
34
27
35
## Authenticated envs and user_config
36
+
28
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).
29
38
30
39
If you use dstack-vmm's built-in UI, the prelaunch script has already been automatically filled in for you:
@@ -37,9 +46,14 @@ You only need to add the `APP_LAUNCH_TOKEN` environment variable to enable LAUNC
37
46
38
47
user_config is not encrypted, and similarly requires integrity checks at the application layer. For example, you can store a USER_CONFIG_HASH in encrypted environment variables and verify it in the prelaunch script.
39
48
40
-
## app-compose.json is public by default
41
-
CVM needs to ensure verifiability, so app-compose.json is public by default, containing the prelaunch script and docker-compose.yaml. You can disable exposing app-compose.json by setting public_tcbinfo=false in app-compose.json.
49
+
## Don't put secrets in docker-compose.yaml
50
+
51
+
CVM needs to ensure verifiability, so app-compose.json is public by default, containing the prelaunch script and docker-compose.yaml.
52
+
You should not put secrets in docker-compose.yaml for best security practice. Use encrypted environment variables instead.
53
+
54
+
In case by any chance you really do not want to expose your compose file, you can disable exposing app-compose.json by setting public_tcbinfo=false in app-compose.json.
42
55
Example app-compose.json:
56
+
43
57
```json
44
58
{
45
59
...
@@ -48,9 +62,13 @@ Example app-compose.json:
48
62
}
49
63
```
50
64
65
+
**But keep in mind, even if you disable exposing app-compose.json, it is just hidden from the public API, the physical machine controller can still access it on the file system.**
66
+
51
67
## docker logs is public available by default
68
+
52
69
Similarly, to facilitate App observability, docker logs are public by default. You can disable exposing docker logs by setting public_logs=false.
53
70
Example app-compose.json:
71
+
54
72
```json
55
73
{
56
74
...
@@ -66,6 +84,7 @@ In Dstack CVM, dstack-guest-agent listens on port 8090, allowing public access t
66
84
In docker-compose.yaml, all declared ports will be exposed to the public internet. Do not expose unnecessary ports.
67
85
68
86
For example:
87
+
69
88
```yaml
70
89
# This will expose port 80 to the public
71
90
services:
@@ -92,11 +111,11 @@ services:
92
111
```
93
112
94
113
Note that when setting network_mode: host, all ports listened to within the container will be exposed to the public internet.
0 commit comments