Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/types/gotypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ declare global {
"ssh:hostname"?: string;
"ssh:port"?: string;
"ssh:identityfile"?: string[];
"ssh:identitiesonly"?: boolean;
"ssh:batchmode"?: boolean;
"ssh:pubkeyauthentication"?: boolean;
"ssh:passwordauthentication"?: boolean;
Expand Down
26 changes: 20 additions & 6 deletions pkg/remote/sshclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,17 @@ func createClientConfig(connCtx context.Context, sshKeywords *wshrpc.ConnKeyword

var authSockSigners []ssh.Signer
var agentClient agent.ExtendedAgent
conn, err := net.Dial("unix", utilfn.SafeDeref(sshKeywords.SshIdentityAgent))
if err != nil {
log.Printf("Failed to open Identity Agent Socket: %v", err)
} else {
agentClient = agent.NewClient(conn)
authSockSigners, _ = agentClient.Signers()

// IdentitiesOnly indicates that only the keys listed in IdentityFile should be used, even if there are matches in the SSH Agent, PKCS11Provider, or SecurityKeyProvider. See https://man.openbsd.org/ssh_config#IdentitiesOnly
// TODO: Update if we decide to support PKCS11Provider and SecurityKeyProvider
if !utilfn.SafeDeref(sshKeywords.SshIdentitiesOnly) {
conn, err := net.Dial("unix", utilfn.SafeDeref(sshKeywords.SshIdentityAgent))
if err != nil {
log.Printf("Failed to open Identity Agent Socket: %v", err)
} else {
agentClient = agent.NewClient(conn)
authSockSigners, _ = agentClient.Signers()
}
}

publicKeyCallback := ssh.PublicKeysCallback(createPublicKeyCallback(connCtx, sshKeywords, authSockSigners, agentClient, debugInfo))
Expand Down Expand Up @@ -830,6 +835,12 @@ func findSshConfigKeywords(hostPattern string) (connKeywords *wshrpc.ConnKeyword
}
sshKeywords.SshAddKeysToAgent = utilfn.Ptr(strings.ToLower(trimquotes.TryTrimQuotes(addKeysToAgentRaw)) == "yes")

identitiesOnly, err := WaveSshConfigUserSettings().GetStrict(hostPattern, "IdentitiesOnly")
if err != nil {
return nil, err
}
sshKeywords.SshIdentitiesOnly = utilfn.Ptr(strings.ToLower(trimquotes.TryTrimQuotes(identitiesOnly)) == "yes")

identityAgentRaw, err := WaveSshConfigUserSettings().GetStrict(hostPattern, "IdentityAgent")
if err != nil {
return nil, err
Expand Down Expand Up @@ -933,6 +944,9 @@ func mergeKeywords(oldKeywords *wshrpc.ConnKeywords, newKeywords *wshrpc.ConnKey
if newKeywords.SshIdentityAgent != nil {
outKeywords.SshIdentityAgent = newKeywords.SshIdentityAgent
}
if newKeywords.SshIdentitiesOnly != nil {
outKeywords.SshIdentitiesOnly = newKeywords.SshIdentitiesOnly
}
if newKeywords.SshProxyJump != nil {
outKeywords.SshProxyJump = newKeywords.SshProxyJump
}
Expand Down
1 change: 1 addition & 0 deletions pkg/wshrpc/wshrpctypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ type ConnKeywords struct {
SshHostName *string `json:"ssh:hostname,omitempty"`
SshPort *string `json:"ssh:port,omitempty"`
SshIdentityFile []string `json:"ssh:identityfile,omitempty"`
SshIdentitiesOnly *bool `json:"ssh:identitiesonly,omitempty"`
SshBatchMode *bool `json:"ssh:batchmode,omitempty"`
SshPubkeyAuthentication *bool `json:"ssh:pubkeyauthentication,omitempty"`
SshPasswordAuthentication *bool `json:"ssh:passwordauthentication,omitempty"`
Expand Down
Loading