Skip to content

Commit 3d35952

Browse files
committed
test: add KMS E2E integration tests with TCB policy validation
Add end-to-end test suite that exercises the full KMS stack: Hardhat node → contract deployment → auth-eth server → KMS server. Tests cover auth-eth boot authorization (KMS/app allowed/denied), KMS unauthenticated APIs (GetMeta, GetAppEnvEncryptPubKey, GetTempCaCert), KMS authenticated APIs via RA-TLS (GetAppKey, SignCert), and TCB policy scenarios including Intel QAL rules for dynamic_platform, cached_keys, and TCB status validation.
1 parent df262e5 commit 3d35952

7 files changed

Lines changed: 986 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ members = [
5353
"no_std_check",
5454
"size-parser",
5555
"port-forward",
56+
"kms/e2e",
5657
]
5758
resolver = "2"
5859

dstack-attest/src/attestation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,8 @@ pub fn default_policy(now_secs: u64) -> SimplePolicy {
800800
.platform_grace_period(Duration::from_secs(30 * 24 * 3600))
801801
.qe_grace_period(Duration::from_secs(30 * 24 * 3600))
802802
.allow_smt(true)
803+
.allow_dynamic_platform(true)
804+
.allow_cached_keys(true)
803805
.reject_advisory("INTEL-SA-01397")
804806
.reject_advisory("INTEL-SA-01367")
805807
.reject_advisory("INTEL-SA-01314")

kms/e2e/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "kms-e2e-client"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
7+
[[bin]]
8+
name = "kms-e2e-client"
9+
path = "src/main.rs"
10+
11+
[dependencies]
12+
ra-tls = { workspace = true }
13+
ra-rpc = { workspace = true, features = ["client"] }
14+
dstack-kms-rpc = { workspace = true }
15+
dstack-guest-agent-rpc = { workspace = true }
16+
dstack-attest = { workspace = true }
17+
http-client = { workspace = true, features = ["prpc"] }
18+
anyhow = { workspace = true, features = ["std"] }
19+
serde_json = "1"
20+
serde = { workspace = true }
21+
hex = { workspace = true }
22+
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
23+
clap = { workspace = true, features = ["env"] }
24+
tracing = { workspace = true }
25+
tracing-subscriber = { workspace = true }
26+
scale = { workspace = true }

kms/e2e/kms-test.toml.template

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# KMS E2E test configuration template
2+
# Placeholders are replaced by run-e2e.sh at runtime
3+
4+
[default]
5+
workers = 2
6+
max_blocking = 8
7+
ident = "DStack KMS E2E"
8+
temp_dir = "/tmp"
9+
keep_alive = 10
10+
log_level = "info"
11+
12+
[rpc]
13+
address = "0.0.0.0"
14+
port = {{KMS_PORT}}
15+
16+
[rpc.tls]
17+
key = "{{CERT_DIR}}/rpc.key"
18+
certs = "{{CERT_DIR}}/rpc.crt"
19+
20+
[rpc.tls.mutual]
21+
ca_certs = "{{CERT_DIR}}/tmp-ca.crt"
22+
mandatory = false
23+
24+
[core]
25+
cert_dir = "{{CERT_DIR}}"
26+
subject_postfix = ".dstack-e2e"
27+
admin_token_hash = ""
28+
29+
[core.image]
30+
verify = false
31+
cache_dir = "{{IMAGE_CACHE_DIR}}"
32+
download_url = "http://localhost:8000/{OS_IMAGE_HASH}.tar.gz"
33+
download_timeout = "2m"
34+
35+
[core.auth_api]
36+
type = "webhook"
37+
38+
[core.auth_api.webhook]
39+
url = "http://127.0.0.1:{{AUTH_ETH_PORT}}"
40+
41+
[core.auth_api.dev]
42+
gateway_app_id = "any"
43+
44+
[core.onboard]
45+
enabled = true
46+
auto_bootstrap_domain = "e2e-test.local"
47+
quote_enabled = true
48+
address = "0.0.0.0"
49+
port = {{KMS_PORT}}

0 commit comments

Comments
 (0)