Repository navigation
feat(kms): serve the read-only RPCs on an optional listener - #1580
Merged
Merged
Conversation
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>
This was referenced Nov 15, 2026
Signed-off-by: Kevin Wang <wy721@qq.com>
This was referenced Nov 15, 2026
Signed-off-by: Kevin Wang <wy721@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 onlyGetMeta,GetAppEnvEncryptPubKeyandGetSealedEnvPubKeyat the same/prpc/<Method>paths, plus/health. Existing clients such asvmm-cli.pycan 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 withpublic_key_handoveron and off, and with the read-only listener disabled. Which listener serves which request:GetMetaGetAppEnvEncryptPubKeyGetSealedEnvPubKeyGetTempCaCertGetAppKeySignCertGetKmsKeypublic_key_handover = trueClearImageCache/health/metricsThe 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-featurespasses (95 tests), as do clippy with the CI flags andcargo 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 withsend-proxy-v2fronted the guest listeners of the KMS and the gateway.GetMeta,GetAppEnvEncryptPubKeyandGetSealedEnvPubKey(also tovmm-cli deploy --kms-encrypt-url, whose KMS signature check passed), returned 404 forGetAppKey,SignCert,GetTempCaCertandGetKmsKey, and sentX-App-Version.