Conversation
Add support for referencing SSH config Host aliases in bssh's jump_host configuration. This allows users to leverage existing SSH config entries with all their settings (HostName, User, Port, IdentityFile). New formats supported: - Simple string with @ prefix: `jump_host: "@Bastion"` - Structured format: `jump_host: { ssh_config_host: "bastion" }` When an SSH config reference is used, bssh resolves the alias from ~/.ssh/config and extracts: - HostName (or uses alias as hostname if not specified) - User - Port - IdentityFile (first one, used as SSH key for the jump host) Changes: - Add SshConfigHostRef variant to JumpHostConfig enum - Add is_ssh_config_ref() and ssh_config_host() methods to JumpHostConfig - Add resolve_jump_host() and resolve_jump_host_connection() to SshConfig - Add get_jump_host_with_key_and_ssh_config() for full SSH config resolution - Update example-config.yaml with SSH config reference examples - Add 15 new tests for SSH config reference functionality Closes #170
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
Following up on #167, this PR adds support for referencing SSH config Host aliases in bssh's
jump_hostconfiguration. This allows users to leverage existing~/.ssh/configentries with all their settings.New Formats Supported
Simple string with @ prefix:
Structured format:
How It Works
When an SSH config reference is used, bssh resolves the alias from
~/.ssh/configand extracts:HostName(or uses alias as hostname if not specified)UserPortIdentityFile(first one, used as SSH key for the jump host)Example
~/.ssh/config:
bssh config.yaml:
This is equivalent to:
Changes
SshConfigHostRefvariant toJumpHostConfigenumis_ssh_config_ref()andssh_config_host()methods toJumpHostConfigresolve_jump_host()andresolve_jump_host_connection()toSshConfigget_jump_host_with_key_and_ssh_config()for full SSH config resolutionexample-config.yamlwith SSH config reference examplesTest Plan
Closes #170