Skip to content

feat(kms): serve the read-only RPCs on an optional listener - #1580

Merged
kvinwang merged 3 commits into
nextfrom
feat/kms-public-listener
Nov 15, 2026
Merged

kvinwang merged 3 commits into
nextfrom
feat/kms-public-listener

Conversation

@kvinwang

@kvinwang kvinwang commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

The KMS RPC listener serves the key-releasing RPCs (GetAppKey, SignCert, GetTempCaCert, GetKmsKey) next to the read-only ones, so an operator cannot restrict access to the former (e.g. by source IP in a proxy) without also cutting off deployers and verifiers.

This adds an optional [core.readonly] listener, off by default, serving only GetMeta, GetAppEnvEncryptPubKey and GetSealedEnvPubKey at the same /prpc/<Method> paths, plus /health. Existing clients such as vmm-cli.py can point at it unchanged. The RPC listener is unchanged.

Testing

A local dev KMS (auth_api = "dev", enforce_self_authorization = false, attest_rpc_cert = false, auto-bootstrapped) with the RPC (18700), admin (18701, insecure_no_auth = true) and read-only (18702) listeners, run with public_key_handover on and off, and with the read-only listener disabled. Which listener serves which request:

Request RPC Admin Read-only
GetMeta ✅ ❌ ✅
GetAppEnvEncryptPubKey ✅ ❌ ✅
GetSealedEnvPubKey ✅ ❌ ✅
GetTempCaCert ✅ ❌ ❌
GetAppKey ✅ ❌ ❌
SignCert ✅ ❌ ❌
GetKmsKey only with public_key_handover = true ✅ ❌
ClearImageCache ❌ ✅ ❌
/health ✅ ❌ ✅
/metrics ✅ ❌ ❌

The read-only listener returns the same keys as the RPC listener. Unserved RPCs return 404 Service not found. With [core.readonly] enabled = false (the default) port 18702 refuses connections, and the other two listeners behave as before.

cargo test -p dstack-kms --all-features passes (95 tests), as do clippy with the CI flags and cargo fmt --check. Not yet tested on TDX hardware.

Verified on TDX

Run on the tdxlab TDX host with real TDX CVMs (guest OS dstack 0.6.0), from one local build of #1580, #1582, #1585 and #1587 merged with #1583 and #1588: the official 0.6.3 KMS and gateway images with these binaries (and the gateway's new entrypoint.sh). The KMS ran in a CVM with a local key provider and a webhook auth backend (allow all but one app; this KMS's root epoch 0 registered); haproxy with send-proxy-v2 fronted the guest listeners of the KMS and the gateway.

  • The public listener served GetMeta, GetAppEnvEncryptPubKey and GetSealedEnvPubKey (also to vmm-cli deploy --kms-encrypt-url, whose KMS signature check passed), returned 404 for GetAppKey, SignCert, GetTempCaCert and GetKmsKey, and sent X-App-Version.
  • App CVMs got their keys from the main listener as before.

The RPC listener serves GetAppKey, SignCert, GetTempCaCert and GetKmsKey
next to the read-only RPCs, so an operator cannot restrict the
key-releasing endpoints without also cutting off deployers and verifiers.

Add an optional [core.readonly] listener serving only GetMeta,
GetAppEnvEncryptPubKey and GetSealedEnvPubKey at the same /prpc paths,
plus /health. The RPC listener is unchanged.

Signed-off-by: Kevin Wang <wy721@qq.com>
Signed-off-by: Kevin Wang <wy721@qq.com>
@kvinwang
kvinwang merged commit cf1df82 into next Nov 15, 2026
20 checks passed
@kvinwang
kvinwang deleted the feat/kms-public-listener branch November 15, 2026 16:40
kvinwang added a commit that referenced this pull request Nov 16, 2026
Adds the KMS ReadOnly service (#1580) and the launch_ticket fields
(#1577), and the request and response fields added since the last
refresh. Methods no case covers yet are left out.

Signed-off-by: Kevin Wang <wy721@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant