Skip to content

fix: enable pubkey login on dstack 0.6 guests - #4

Merged
Leechael merged 4 commits into
mainfrom
fix/sshd-strictmodes-world-writable-root
Sep 8, 2026
Merged

fix: enable pubkey login on dstack 0.6 guests#4
Leechael merged 4 commits into
mainfrom
fix/sshd-strictmodes-world-writable-root

Conversation

@Leechael

@Leechael Leechael commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Set StrictModes no in the generated sshd_config so 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).
  • Accept a comma-separated SSH_GITHUB_USER list (alice,bob) and import keys from each account.
  • Add a GHCR workflow: PRs build only; pushes to main, v* tags, and workflow_dispatch push linux/amd64 to ghcr.io/<owner>/<repo> (latest on default branch, main, sha-<short>, semver from v* tags; dispatch also stamps a UTC timestamp).
  • Fix the image static-link check so alpine file accepts static-pie linked and the GHCR build can finish.

Test Results

No test framework in this repo. bash -n scripts/install-openssh.sh passed.

Test Plan

  • Install on a dstack 0.6 guest with SSH_PUBKEY and confirm key login succeeds (no Permission denied / no bad ownership or modes for directory /).
  • Install with SSH_GITHUB_USER=alice,bob and confirm both users' keys land in the managed authorized_keys block.
  • Confirm a missing/invalid name in the list is logged and does not drop keys from the other names.
  • After merge to main, confirm GHCR published latest / main / sha-*.

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.
@Leechael
Leechael merged commit 783856f into main Sep 8, 2026
1 check passed
@Leechael
Leechael deleted the fix/sshd-strictmodes-world-writable-root branch September 8, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Key auth always refused on dstack 0.6 guests: / is 0777 and sshd StrictModes rejects it

1 participant