Skip to content

Self-contained SSH key management via ssh_key_name#18

Merged
jfding merged 5 commits intomasterfrom
feature/ssh-key-name-managed-keys
Mar 26, 2026
Merged

Self-contained SSH key management via ssh_key_name#18
jfding merged 5 commits intomasterfrom
feature/ssh-key-name-managed-keys

Conversation

@jfding
Copy link
Copy Markdown
Owner

@jfding jfding commented Mar 26, 2026

Summary

  • Add ssh_key_name config field to Host — a bare filename resolved from managed key directories (~/.config/git-supervisor/keys/~/.ssh/ fallback)
  • New keys module handles resolution with Unix permission validation (must be 0600/0400)
  • ssh_key_name takes precedence over ssh_identity_file when both are set; full backward compatibility
  • CLI now also looks up deployments.yaml from ~/.config/git-supervisor/ when not found in CWD
  • 5 new unit tests for key resolution, 1 new config parsing test

Closes #17

Test plan

  • All 33 existing tests pass
  • New keys::tests cover: priority search order, fallback, missing key error, permission rejection, 0400 acceptance
  • New config::tests::ssh_key_name_parsed covers YAML parsing with/without the field
  • Manual: place a key in ~/.config/git-supervisor/keys/, reference via ssh_key_name, run supervisor check

🤖 Generated with Claude Code

jfding and others added 5 commits March 26, 2026 10:13
Add an optional `ssh_key_name` field to the Host configuration. This
bare filename will be resolved against managed key directories at
runtime. When both `ssh_key_name` and `ssh_identity_file` are set,
`ssh_key_name` takes precedence.

Closes #17 (partial)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New `keys::resolve(name)` searches `~/.config/git-supervisor/keys/`
then falls back to `~/.ssh/`. Validates Unix permissions (must be
0600 or 0400). Includes unit tests using tempfile for isolation.

Closes #17 (partial)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ssh_run and ssh_run_with_stdin now call keys::resolve() when
ssh_key_name is set, with precedence over ssh_identity_file.
The resolved path is passed to ssh -i as before.

Closes #17 (partial)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show the new managed key approach alongside the existing
ssh_identity_file option in deployments.sample.yaml.

Closes #17

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the config file is not found in the current directory and the
path is a bare filename (e.g. the default deployments.yaml), fall
back to ~/.config/git-supervisor/<filename>.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jfding jfding merged commit 7b4e07e into master Mar 26, 2026
@jfding jfding deleted the feature/ssh-key-name-managed-keys branch March 26, 2026 02:56
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.

Self-contained SSH key management: ssh_key_name config field with managed key directory

1 participant