Skip to content

Commit

Permalink
try agents first (seems to be how SSH does it)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikew committed Oct 21, 2024
1 parent dc44d0e commit d53bc1c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ func getSshClientForServer(endpoint *SshEndpoint) (*ssh.Client, error) {
authMethods = append(authMethods, ssh.PublicKeysCallback(func() ([]ssh.Signer, error) {
allSigners := []ssh.Signer{}

if identitySigner, _ := getSignerForIdentityFile(endpoint.Host); identitySigner != nil {
allSigners = append(allSigners, identitySigner)
if agentSigners, _ := getSignersForIdentityAgent(endpoint.GivenHost); agentSigners != nil {
allSigners = append(allSigners, agentSigners...)
}

if agentSigners, _ := getSignersForIdentityAgent(endpoint.Host); agentSigners != nil {
allSigners = append(allSigners, agentSigners...)
if identitySigner, _ := getSignerForIdentityFile(endpoint.GivenHost); identitySigner != nil {
allSigners = append(allSigners, identitySigner)
}

return allSigners, nil
Expand Down

0 comments on commit d53bc1c

Please sign in to comment.