Repository navigation
Support in-place SSH key rotation for SSH fleets - #4458
Draft
peterschmidt85 wants to merge 3 commits into
Draft
peterschmidt85 wants to merge 3 commits into
peterschmidt85 wants to merge 3 commits into
Conversation
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.
Changing SSH-fleet keys currently requires re-creating the fleet, which cannot be done while it has active runs. Allow
dstack applyto replacessh_config.identity_fileandssh_config.proxy_jump.identity_filein place, including existing per-host overrides and changed key contents at the same path.Authorize the replacement public key first. Apply updates the fleet configuration and existing instance keys in one database transaction. Public keys on hosts remain managed externally. Running tasks and services continue without host provisioning, container restarts, or run resubmission. Established SSH sessions and healthy service tunnels remain open. Revoking a public key prevents future authentication; it does not terminate an authenticated SSH session.
The apply plan identifies changed key fields:
Per-host changes show
ssh_config.hosts[0].identity_fileorssh_config.hosts[0].proxy_jump.identity_file.ssh_config.hostsmeans the host list changed. Changinguser,port, or the head-node address still requires fleet recreation, which is refused while the fleet is in use. Mixed key and connection-setting changes do not apply keys separately.Head nodes below use
proxy_jump; dstack gateways usetype: gateway.proxy_jumpkey.~/.ssh/configor an SSH agent. For same-path replacement, a stale.pubfile is rejected; it must match the replacement private key.Keep the old public key authorized until gateways receive the replacement and SSH-proxy caches expire. Earlier revocation can prevent new connections or service-tunnel reconnects;
dstack applydoes not wait for either component.Closes #4450