fix: enable pubkey login on dstack 0.6 guests - #4
Merged
Conversation
dstack 0.6 guest rootfs has / as 0777. sshd StrictModes walks every component of AuthorizedKeysFile and refuses the key with "bad ownership or modes for directory /", so pubkey login always fails even when the key file itself is 0600. The generated sshd_config now sets StrictModes no. The check does not buy anything here: rootfs modes are an image property the installer cannot fix, and the filesystem already sits inside the CVM trust boundary. Fixes #3
Previously only a single GitHub username was fetched. Operators with several accounts had to pre-merge github.com/<user>.keys into SSH_PUBKEY. SSH_GITHUB_USER now splits on commas, trims whitespace, and imports keys from each account into the managed authorized_keys block. A failed fetch for one user is logged and skipped so other accounts still land.
Publish linux/amd64 images to ghcr.io/<owner>/<repo> from Actions so builds do not depend on Docker Hub credentials. PRs build only. Pushes to main, v* tags, and workflow_dispatch log in with GITHUB_TOKEN and push. Tags include latest on the default branch, semver from v* tags, branch names, and short SHA. workflow_dispatch also stamps a UTC timestamp tag.
The builder image did not install file(1), and alpine:latest now reports a -static -pie sshd as "static-pie linked" rather than "statically linked". The verify step failed grep and aborted the GHCR build. Install file and match both strings so the static-link check still holds.
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.
Summary
StrictModes noin the generatedsshd_configso key auth is not refused when the dstack 0.6 guest rootfs has/as mode 0777 (Fixes Key auth always refused on dstack 0.6 guests: / is 0777 and sshd StrictModes rejects it #3).SSH_GITHUB_USERlist (alice,bob) and import keys from each account.main,v*tags, andworkflow_dispatchpushlinux/amd64toghcr.io/<owner>/<repo>(lateston default branch,main,sha-<short>, semver fromv*tags; dispatch also stamps a UTC timestamp).fileacceptsstatic-pie linkedand the GHCR build can finish.Test Results
No test framework in this repo.
bash -n scripts/install-openssh.shpassed.Test Plan
SSH_PUBKEYand confirm key login succeeds (no Permission denied / no bad ownership or modes for directory /).SSH_GITHUB_USER=alice,boband confirm both users' keys land in the managed authorized_keys block.main, confirm GHCR publishedlatest/main/sha-*.