Skip to content

feat(ssh): wire CertificateFile for certificate-based authentication#377

Merged
kke merged 3 commits into
mainfrom
ssh-config-certificate-file
Jun 6, 2026
Merged

feat(ssh): wire CertificateFile for certificate-based authentication#377
kke merged 3 commits into
mainfrom
ssh-config-certificate-file

Conversation

@kke

@kke kke commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

For each identity file, also load the implicit -cert.pub and any explicit CertificateFile entries from sshconfig. When a matching cert is found, a cert signer is offered before the plain key signer so certificate auth is tried first with the plain key as fallback.

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 adds support for SSH certificate-based authentication by detecting and loading user certificates associated with configured identity keys, ensuring certificates are attempted before falling back to the raw key signer. This aligns rig’s SSH behavior more closely with OpenSSH’s IdentityFile + implicit -cert.pub convention and CertificateFile directives.

Changes:

  • Added certSignerForSigner to discover and validate matching SSH user certificates (implicit <key>-cert.pub, then CertificateFile).
  • Updated key-signer loading to prepend a certificate-backed signer ahead of the plain key signer when a matching cert is found.
  • Added unit tests covering implicit/explicit cert discovery, mismatch handling, missing files, and signer ordering.

Reviewed changes

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

File Description
protocol/ssh/connection.go Adds certificate discovery + cert-signer creation and wires it into key signer ordering.
protocol/ssh/connection_test.go Adds tests for certificate matching behavior and priority ordering in loadKeySigners.

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

Comment thread protocol/ssh/connection.go Outdated
@kke kke force-pushed the ssh-config-certificate-file branch from f739b3a to 7816940 Compare June 6, 2026 11:39
@kke kke requested a review from Copilot June 6, 2026 11:39

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

Comment thread protocol/ssh/connection.go
Comment thread protocol/ssh/connection_test.go Outdated
@kke kke force-pushed the ssh-config-certificate-file branch from 7816940 to 1f53356 Compare June 6, 2026 15:25
@kke kke requested a review from Copilot June 6, 2026 15:25

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

Comment thread protocol/ssh/connection_test.go
@kke kke force-pushed the ssh-config-certificate-file branch from 1f53356 to 3a96068 Compare June 6, 2026 15:39
@kke kke requested a review from Copilot June 6, 2026 15:39

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

Comment thread protocol/ssh/connection.go
Comment thread protocol/ssh/connection.go Outdated
kke added 2 commits June 6, 2026 18:53
For each identity file, also load the implicit <path>-cert.pub and any
explicit CertificateFile entries from sshconfig. When a matching cert is
found, a cert signer is offered before the plain key signer so certificate
auth is tried first with the plain key as fallback.

Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
@kke kke force-pushed the ssh-config-certificate-file branch from 3a96068 to 1fa9638 Compare June 6, 2026 16:00
@kke kke requested a review from Copilot June 6, 2026 16:00

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

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

@kke kke marked this pull request as ready for review June 6, 2026 16:23
@kke kke merged commit 619b248 into main Jun 6, 2026
13 checks passed
@kke kke deleted the ssh-config-certificate-file branch June 6, 2026 16:23
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