Skip to content

feat(ssh): add SSHConfigOptions to set sshconfig options - #375

Merged
kke merged 13 commits into
mainfrom
ssh-settings
Jun 5, 2026
Merged

kke merged 13 commits into
mainfrom
ssh-settings

Conversation

@kke

@kke kke commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Allows setting the more "exotic" ssh options through the rig config like ServerAliveInterval via ssh.options.ServerAliveInterval instead of modifying the ~/.ssh/config.

Moves OptionArguments from protocol/openssh to sshconfig so both the pure-Go SSH and OpenSSH protocol implementations share the same type. Add ApplyTo(*Setter) to feed options into the sshconfig setter with bool→yes/no conversion.

Breaking API is not an issue as rig v2 is not released yet.

kke added 3 commits June 4, 2026 22:17
Move OptionArguments from protocol/openssh to sshconfig so both the
pure-Go SSH and OpenSSH protocol implementations share the same type.
Add ApplyTo(*Setter) to feed options into the sshconfig setter with
bool→yes/no conversion.

Add SSHConfigOptions sshconfig.OptionArguments to ssh.Config. Options
are applied before ConfigParser.Apply so they take priority over
~/.ssh/config. Unknown key names are rejected at connection creation
time. The openssh Options field retains a deprecated type alias for
backwards compatibility.

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

This PR centralizes SSH -o/ssh_config option handling by moving the shared OptionArguments type into the sshconfig package, so both the OpenSSH-based and pure-Go SSH protocol implementations use the same representation and conversion logic.

Changes:

  • Added sshconfig.OptionArguments with helpers for copy/set and conversions to OpenSSH -o Key=Value args.
  • Added OptionArguments.ApplyTo(*sshconfig.Setter) to apply options directly to an sshconfig.Config for the pure-Go SSH path.
  • Updated OpenSSH and pure-Go SSH protocol configs/connections to use sshconfig.OptionArguments and added tests for the new type.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sshconfig/option_arguments.go Introduces shared OptionArguments type plus ToArgs and ApplyTo helpers.
sshconfig/option_arguments_test.go Adds unit tests covering copy/set semantics, arg rendering, and applying to a setter.
protocol/ssh/connection.go Applies SSHConfigOptions to sshconfig.Config via a setter before parsing user ssh config.
protocol/ssh/config.go Adds SSHConfigOptions field to pure-Go SSH config.
protocol/openssh/connection.go Switches default and connection option maps to sshconfig.OptionArguments.
protocol/openssh/config.go Replaces OpenSSH-specific OptionArguments with sshconfig.OptionArguments and removes duplicated implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sshconfig/option_arguments.go Resolved
Comment thread sshconfig/option_arguments.go Resolved
Comment thread sshconfig/option_arguments.go Resolved
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread sshconfig/option_arguments.go Resolved
Comment thread sshconfig/option_arguments.go Resolved
Comment thread sshconfig/option_arguments_test.go Resolved
Comment thread sshconfig/option_arguments_test.go Resolved
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Comment thread sshconfig/option_arguments.go Resolved
Comment thread sshconfig/option_arguments.go Resolved
Comment thread sshconfig/option_arguments_test.go Resolved
Comment thread sshconfig/option_arguments_test.go Resolved
Comment thread protocol/ssh/connection.go Resolved
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread sshconfig/option_arguments.go Resolved
Comment thread protocol/ssh/config.go Resolved
kke added 2 commits June 5, 2026 09:37
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread sshconfig/option_arguments.go Resolved
Comment thread docs/ssh-config-precedence.md Resolved
Comment thread docs/ssh-config-precedence.md Resolved
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread protocol/ssh/connection.go Resolved
Comment thread protocol/ssh/connection.go Resolved
Comment thread protocol/openssh/connection.go Resolved
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread protocol/ssh/connection.go Resolved
Comment thread sshconfig/option_arguments.go Resolved
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread protocol/ssh/connection.go Resolved
Comment thread sshconfig/option_arguments.go Resolved
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread sshconfig/option_arguments.go Resolved
Comment thread sshconfig/option_arguments.go Resolved
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@kke
kke marked this pull request as ready for review June 5, 2026 10:19
@kke
kke merged commit 7b7fb47 into main Jun 5, 2026
13 checks passed
@kke
kke deleted the ssh-settings branch June 5, 2026 10:19
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