Repository navigation
Conversation
The script appended user_config.ssh_authorized_keys to root's authorized_keys. The host supplies user_config: it is not measured, not authenticated and not filtered by allowed_envs. On any image with sshd, which means every dstack 0.5.x dev image, whoever ran the host could therefore log in as root. v0.0.22 ignores that key and logs that it did. The key count and fingerprint log now cover whatever the encrypted env installed, so the boot log still lists every authorized key. The README documents the remaining channel, DSTACK_AUTHORIZED_KEYS, DSTACK_ROOT_PUBLIC_KEY and DSTACK_ROOT_PASSWORD from the encrypted env. Anyone can produce a valid encrypted env, because it is sealed to a public key, so these are for dev images on trusted hosts only. The README also covers migration for apps that used user_config keys. 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.
Problem
prelaunch.shappendsuser_config.ssh_authorized_keysto root'sauthorized_keys. The host suppliesuser_config. It is not measured, not authenticated and not filtered byallowed_envs. On any image that shipssshd, which means every dstack 0.5.x dev image, whoever runs the host can give itself root SSH.This combines with an integer
manifest_versionand with a KMS that admits dev images. A host can then start an extra instance of the app that the owner does not know about, log in as root, and read the app keys.DSTACK_AUTHORIZED_KEYS/DSTACK_ROOT_PUBLIC_KEY/DSTACK_ROOT_PASSWORDfrom the encrypted env have the same problem in a weaker form. Encrypted env is HPKE base mode sealed to a public key, so anyone can forge it. This PR leaves those variables in place and documents the risk.Fix
user_config.ssh_authorized_keysbranch no longer writes anything. It logsIgnoring ssh_authorized_keys from user_config (host-supplied, unauthenticated).APP_LAUNCH_TOKEN, KMS launch tickets), and explains migration.Why remove the branch instead of limiting it to dev images: only dev images ship
sshd, so a dev-only rule would keep the hole exactly where it exists. The script also has no reliable signal for the image flavour. Build flavour is not written to/etc/os-release, anduser_configand host-shared files are host-controlled.Migration
user_config) need to put those keys in theDSTACK_AUTHORIZED_KEYSencrypted env, with the risk documented in the README.app-compose.json. Switching to v0.0.22 changes the compose hash, so for apps governed on chain the new hash must be whitelisted first./homeis a tmpfs overlay in the guest. Keys that an older version installed fromuser_configare gone after the first boot with v0.0.22.Verification
bash -npasses.shellcheck: same 5 warnings before and after, all pre-existing (SC2034comment, SC2155export). Nothing new.user_configkey:user_configkey, v0.0.22 creates noauthorized_keys.c5b4e3b9b5f30fed24118fbe37545c6dabfd09586d74baf08a9d4ae60abba601. It is not in the official hash list yet.Not done: no boot test on a real CVM.
Open questions
user_configSSH delivery? If it does, the dashboard needs a different way to deliver workspace keys, and v0.0.22 needs an entry in the official script hash list.dev-box/entrypoint.sh(dstack 0.6) readsuser_config.ssh_authorized_keysitself, and its README states that trust boundary. This PR does not change it. It needs the same decision.default_gateway_domainis still read fromuser_config, ahead ofapp-compose.json. That is host-controlled, but it only setsDSTACK_GATEWAY_DOMAIN/DSTACK_APP_DOMAIN, so this PR leaves it unchanged.