Repository navigation
refactor(kms)!: group listener settings under [listeners.*] - #1585
Merged
Merged
Conversation
kvinwang
force-pushed
the
refactor/kms-listeners-config
branch
2 times, most recently
from
November 15, 2026 04:49
a9f59b1 to
1bc019f
Compare
This was referenced Nov 15, 2026
The four KMS listeners were configured in [rpc], [core.admin], [core.readonly] and [core.onboard], the last three mixed with admin auth and onboarding behavior. Move their bind settings (enabled, address, port, tls, proxy_protocol) to [listeners.rpc], [listeners.admin], [listeners.readonly] and [listeners.onboard]; admin auth stays in [core.admin] and onboarding behavior in [core.onboard]. The legacy keys are still read and take precedence: kms.toml, loaded first as the defaults, uses only the new names, so a legacy key comes from the operator. Generators that target older KMS images (dstack-cli-core, the dstack-app composes, dev-stack) keep the legacy names. Signed-off-by: Kevin Wang <wy721@qq.com>
Rename the listeners rpc -> guest and readonly -> public, after who connects to them, and add [listeners.default], which each listener inherits unless its own section overrides it: tls, proxy_protocol and Rocket settings. The onboard listener, which runs before the KMS has certificates, does not inherit the default tls. Drop the top-level [default] section: the config is loaded un-nested, so Rocket never read it, and the KMS ran with Rocket's own defaults. Its values are not carried over, which would have changed them. Signed-off-by: Kevin Wang <wy721@qq.com>
…[listeners.admin] Drop the compatibility with the old locations: a config that sets [rpc], [core.admin], [core.onboard] address/port/tls or the top-level [default] is refused at startup, naming where each moved. kms.toml, loaded first as the defaults, has none of them, so one present was set by the operator. [core.admin] goes entirely: its credentials (auth_token, auth_token_hash, htpasswd_file, insecure_no_auth) move to [listeners.admin] with the rest of the admin listener. Update the generators that run the KMS built from this repo: dev-stack, the dstack-app entrypoint, the KMS tutorials, and the full-stack test, which keeps the old sections for its KMS 0.5.8 stage. dstackup and the dstack-app composes deploy pinned older KMS images and keep them. Signed-off-by: Kevin Wang <wy721@qq.com>
The dropped [default] section set ident = "DStack KMS" but was never read, so responses said Server: Rocket. Set it in [listeners.default]; the other values there stay unset, keeping Rocket's defaults. Signed-off-by: Kevin Wang <wy721@qq.com>
The old guest and onboard listeners read Rocket settings, such as log_level or limits, from the top level of the config file; the new listeners read them only from [listeners.*], so those would be silently ignored. Refuse a top-level key set by a config file, and the unreleased [core.readonly]. Signed-off-by: Kevin Wang <wy721@qq.com>
Signed-off-by: Kevin Wang <wy721@qq.com>
Also name listeners.default.tls in the security best practices, which still referred to rpc.tls. Signed-off-by: Kevin Wang <wy721@qq.com>
kvinwang
force-pushed
the
refactor/kms-listeners-config
branch
from
November 15, 2026 17:01
2d21f6a to
8a14e0f
Compare
kvinwang
added a commit
that referenced
this pull request
Nov 16, 2026
#1585 and #1587 moved the listener settings of the KMS and the gateway under [listeners.*] and refuse the old locations at startup, so every fixture that rendered [rpc], [core.admin], [core.onboard] address/port, the gateway's top-level address and [tls], [core.admin] or [core.debug] would fail to start. Render the new sections for the candidate binaries; the upgrade matrix keeps the old ones for released KMS images. Also update the configuration inventory. Signed-off-by: Kevin Wang <wy721@qq.com>
kvinwang
added a commit
that referenced
this pull request
Nov 16, 2026
Runs the product tests added for launch tickets (#1577), the dstack-mr lite check and dstack-verifier-wasm (#1555), the SEV-SNP key provider (#1526), the PROXY header reader (#1582) and the refusal of old listener settings (#1585, #1587). A row matching no test fails. 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.
Stacked on #1582.
Breaking: the KMS refuses a config that uses the old listener sections; update
kms.tomltogether with the KMS image.The KMS listeners were configured in
[rpc],[core.admin],[core.readonly]and[core.onboard]: one at the top level, three under[core]mixed with admin auth and onboarding behavior, each repeating its TLS paths. This groups them under[listeners.*], named after who connects, with a shared default:[listeners.default]tls,proxy_protocol, Rocket settings (workers, ...)[listeners.guest]address,port[rpc][listeners.admin]enabled,address,port,auth_token,auth_token_hash,htpasswd_file,insecure_no_auth[core.admin][listeners.public]enabled,address,port[core.readonly](unreleased)[listeners.onboard]address,port[core.onboard](enabledand onboarding options stay there)The onboard listener serves plain HTTP: it runs before the KMS has certificates, so it does not inherit the default
tls, and it does not supportproxy_protocol.The top-level
[default]section is dropped. The config is loaded un-nested, so Rocket never read it: the KMS ran with Rocket's own defaults (workers= CPU count,keep_alive= 5,ident=Rocket), not the values written there. Onlyident = "DStack KMS"moves to[listeners.default], so responses now carryServer: DStack KMSinstead ofServer: Rocket; the others stay unset, keeping the effective values.Old locations are refused. A config that sets
[rpc],[core.admin],[core.onboard]address/port/tls,[default], or a Rocket setting at the top level of a config file (such aslog_levelorlimits, which the old guest and onboard listeners read from there) fails at startup with e.g.the config sets listener settings at their old locations; move them: rpc -> listeners.guest, core.admin -> listeners.admin.kms.toml, loaded first as the defaults, has none of them, so one present was set by the operator; a top-level key counts only if a config file set it, since Rocket's own defaults are always present there.Generators. Updated where they run the KMS built from this repo:
tools/dev-stack.sh,dstack-app/entrypoint.sh, the KMS tutorials, and the full-stack test (which renders the old sections only for its KMS 0.5.8 stage, via--legacy-config).dstackup(dstack-cli-core, default KMS 0.5.11) and thedstack-appcomposes with their deploy scripts deploy pinned older KMS images and keep the old sections; they must switch when those images are bumped.kms.toml, the KMS README (new "Listeners" section),docs/deployment.md, the RC runbook and the security best practices use the new names.Testing
cargo test -p dstack-kms --all-featurespasses (96 tests), as do clippy with the CI flags andcargo fmt --check. New test: each old location is refused, naming its new one; the default config and[core.onboard]options pass.--legacy-config.auth_api = "dev",enforce_self_authorization = false,attest_rpc_cert = false):[listeners.default]withtlsandproxy_protocol = true; admin overridesproxy_protocol = false; public enabledauth_tokenin[listeners.admin]Admin.ClearImageCache: 401 without a token or with a wrong one, 200 with itadmin API is enabled but no credential is configured; set listeners.admin.auth_token, ...[listeners.admin] enabled = false[listeners.admin] enabled = true[rpc]and[core.admin] portrpc -> listeners.guest, core.admin -> listeners.admin[core.admin] auth_tokencore.admin -> listeners.admin[default] workers = 8default -> listeners.defaultlog_leveland[limits]limits -> listeners.default.limits, log_level -> listeners.default.log_levelidentServer: DStack KMSon guest and admin;workers,keep_alive,max_blockingunchanged (64, 5, 512 on this host)[listeners.onboard]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.kms.tomlin the new layout ([listeners.default.tls],[listeners.guest]withproxy_protocol,[listeners.admin]withauth_token_hash,[listeners.public]): all three listeners came up,Server: DStack KMS; the admin listener returned 401 without or with a wrong token and 200 with it.