Skip to content

feat(ssh): skip pubkey auth if PubkeyAuthentication "no" in config#369

Merged
kke merged 2 commits into
mainfrom
ssh-config-pubkey-password-auth
Jun 4, 2026
Merged

feat(ssh): skip pubkey auth if PubkeyAuthentication "no" in config#369
kke merged 2 commits into
mainfrom
ssh-config-pubkey-password-auth

Conversation

@kke

@kke kke commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

wires the SSH config PubkeyAuthentication key to ssh connection initialization

API breaking is not an issue as rig v2 hasn't been released yet.

@kke kke changed the title feat(ssh): skip pubkey auth methods when PubkeyAuthentication is disa… feat(ssh): skip pubkey auth if PubkeyAuthentication is disabled in config Jun 3, 2026
@kke kke changed the title feat(ssh): skip pubkey auth if PubkeyAuthentication is disabled in config feat(ssh): skip pubkey auth if PubkeyAuthentication "no" in config Jun 3, 2026
@kke kke requested a review from Copilot June 3, 2026 20:44

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 wires the PubkeyAuthentication SSH config option into rig’s SSH client configuration so that public-key based authentication can be skipped when the config explicitly disables it.

Changes:

  • Add Connection.loadAgentSigners helper to encapsulate ssh-agent signer discovery and logging.
  • Honor ssh_config PubkeyAuthentication no by skipping ssh-agent and IdentityFile-based key authentication.
  • Add a unit test asserting clientConfig returns a non-retryable error when pubkey auth is disabled and no other auth methods are available.

Reviewed changes

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

File Description
protocol/ssh/connection.go Skip agent/identity-file public key auth when PubkeyAuthentication is disabled; refactor agent signer loading into a helper.
protocol/ssh/connection_test.go Add coverage for the “PubkeyAuthentication no” behavior returning a non-retryable error when no other auth is configured.

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

Comment thread protocol/ssh/connection.go Outdated
Comment thread protocol/ssh/connection.go Outdated

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 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread protocol/ssh/connection.go

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 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread protocol/ssh/connection.go Outdated
Comment thread protocol/ssh/connection.go Outdated
…bled

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
@kke kke force-pushed the ssh-config-pubkey-password-auth branch from 6de7037 to bb503c5 Compare June 4, 2026 06:53
@kke kke requested a review from Copilot June 4, 2026 06:53

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 4 out of 4 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

protocol/ssh/connection.go:409

  • On homedir.Expand error, keyPath is overwritten with the (empty) return value, so the trace log can lose the original path that failed to expand. Keep the original value for logging to make diagnostics accurate.
		keyPath, err := homedir.Expand(keyPath)
		if err != nil {
			log.Trace(ctx, "expand keypath", log.FileAttr(keyPath), log.ErrorAttr(err))
			continue
		}

Comment thread protocol/ssh/agent/agent.go
Comment thread protocol/ssh/agent/agent_windows.go
Comment thread protocol/ssh/connection.go
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 4 out of 4 changed files in this pull request and generated no new comments.

@kke kke marked this pull request as ready for review June 4, 2026 08:36
@kke kke merged commit 88e1e8d into main Jun 4, 2026
13 checks passed
@kke kke deleted the ssh-config-pubkey-password-auth branch June 4, 2026 08:36
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