waveterm icon indicating copy to clipboard operation
waveterm copied to clipboard

fix(ssh): SSH agent IdentitiesOnly logic and public key parsing

Open andya1lan opened this issue 1 month ago • 2 comments

Summary

This PR fixes a critical issue where enabling IdentitiesOnly would prevent the SSH agent from being used entirely. It also corrects the default SSH agent path on Windows and fixes a type mismatch in wshrpc.

Problem

IdentitiesOnly Conflict: The previous implementation checked !sshKeywords.SshIdentitiesOnly before connecting to the agent. https://github.com/wavetermdev/waveterm/blob/f622c658b07881499b470c133c68cdf10f73aa6c/pkg/remote/sshclient.go#L617-L625 If IdentitiesOnly was set to yes (to restrict key usage), Wave would skip the agent entirely, leading to authentication failures.

Changes

  1. Removed the IdentitiesOnly check from the agent connection logic.
  2. Smart Filtering: Implemented logic in createPublicKeyCallback. If IdentitiesOnly is true, Wave will fetch the agent's keys but filter them to only use keys that fingerprint-match the locally configured.
  3. Minor fixes:
    • IdentityFile Enhanced Parsing: Updated key parsing to try ssh.ParseAuthorizedKey first (for .pub files), then raw, then private keys.
    • Windows Defaults: Updated findSshDefaults to support Windows as well.

Out of Scope

SSH Config Match Keyword: The underlying SSH configuration parser library used by Wave does not currently support the Match keyword. Consequently, settings (like IdentityFile or IdentitiesOnly) must be explicitly defined within Host blocks. Match blocks will be ignored and are not addressed by this PR.

Conflicts

This branch is based on https://github.com/wavetermdev/waveterm/pull/2748

andya1lan avatar Jan 04 '26 09:01 andya1lan