diff --git a/vendor/github.com/appleboy/easyssh-proxy/easyssh.go b/vendor/github.com/appleboy/easyssh-proxy/easyssh.go index f351ccf..b6e60ec 100644 --- a/vendor/github.com/appleboy/easyssh-proxy/easyssh.go +++ b/vendor/github.com/appleboy/easyssh-proxy/easyssh.go @@ -74,12 +74,6 @@ func getSSHConfig(config DefaultConfig) *ssh.ClientConfig { if config.Password != "" { auths = append(auths, ssh.Password(config.Password)) } - - if sshAgent, err := net.Dial("unix", os.Getenv("SSH_AUTH_SOCK")); err == nil { - auths = append(auths, ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers)) - defer sshAgent.Close() - } - if config.KeyPath != "" { if pubkey, err := getKeyFile(config.KeyPath); err != nil { log.Printf("getKeyFile: %v\n", err) @@ -96,6 +90,11 @@ func getSSHConfig(config DefaultConfig) *ssh.ClientConfig { } } + if sshAgent, err := net.Dial("unix", os.Getenv("SSH_AUTH_SOCK")); err == nil { + auths = append(auths, ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers)) + defer sshAgent.Close() + } + return &ssh.ClientConfig{ Timeout: config.Timeout, User: config.User,