Skip to content

fix: fall back to another common SSH key type when the configured default is missing - #1043

Merged
cdalar merged 2 commits into
mainfrom
fix/ssh-key-fallback-default
Aug 19, 2026
Merged

cdalar merged 2 commits into
mainfrom
fix/ssh-key-fallback-default

Conversation

@cdalar

@cdalar cdalar commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • onctl.yaml defaults ssh.publicKey/ssh.privateKey to ~/.ssh/id_rsa(.pub), so onctl up fails outright (open .../id_rsa.pub: no such file or directory) on machines that only have an id_ed25519 key pair.
  • getSSHKeyFilePaths now falls back to another common key type (id_ed25519, id_ecdsa, id_rsa, in that priority order) in the same directory when the configured default doesn't exist on disk.
  • Explicit -k/filename values are untouched — this fallback only applies to the config-driven default, so explicit user intent still fails loud if the file is missing.
  • Documented the fallback in the shipped internal/files/init/onctl.yaml template.

Test plan

  • go build ./...
  • go test ./cmd/... -run TestGetSSHKeyFilePaths — new fallback test + existing explicit-filename tests pass
  • golangci-lint run ./cmd/... — 0 issues
  • Confirmed two unrelated pre-existing test failures (TestReadConfig_NoConfigDirectory, TestCreateFlagsBindToViper) also fail identically on main (environment/config-dependent, unrelated to this change)

…ault is missing

onctl.yaml defaults ssh.publicKey/privateKey to ~/.ssh/id_rsa(.pub), so
onctl up fails outright on machines that only have an id_ed25519 key
pair. getSSHKeyFilePaths now falls back to id_ed25519, id_ecdsa, or
id_rsa (in that order) in the same directory when the configured
default doesn't exist. Explicit -k/filename values are unaffected.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bad5767a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/common.go Resolved
… is missing

Previously only a missing public key triggered the fallback search, so a
stale public key alongside a missing private key (or vice versa) skipped
fallback and left ssh/deploy/create using an unreadable configured path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JfPLLLB6AfoUDuBVWMuN8F
@cdalar
cdalar merged commit e45dfab into main Aug 19, 2026
13 checks passed
@cdalar
cdalar deleted the fix/ssh-key-fallback-default branch August 19, 2026 13:53
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.

2 participants

⌂ 换网址