mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-07-05 22:02:49 +08:00
[easyssh] Modify AuthMethod order (appleboy/easyssh-proxy#38)
* Modify AuthMethod order to be sure that user configuration is first in the list because ss.Dial only try the first method https://github.com/appleboy/drone-ssh/commit/2a8dbafca51
This commit is contained in:
parent
744da76e7c
commit
442ce52def
11
vendor/github.com/appleboy/easyssh-proxy/easyssh.go
generated
vendored
11
vendor/github.com/appleboy/easyssh-proxy/easyssh.go
generated
vendored
@ -74,12 +74,6 @@ func getSSHConfig(config DefaultConfig) *ssh.ClientConfig {
|
|||||||
if config.Password != "" {
|
if config.Password != "" {
|
||||||
auths = append(auths, ssh.Password(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 config.KeyPath != "" {
|
||||||
if pubkey, err := getKeyFile(config.KeyPath); err != nil {
|
if pubkey, err := getKeyFile(config.KeyPath); err != nil {
|
||||||
log.Printf("getKeyFile: %v\n", err)
|
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{
|
return &ssh.ClientConfig{
|
||||||
Timeout: config.Timeout,
|
Timeout: config.Timeout,
|
||||||
User: config.User,
|
User: config.User,
|
||||||
|
Loading…
Reference in New Issue
Block a user