fix: add ssh conn time outs
This commit is contained in:
parent
9a513a0700
commit
aec11bda28
|
@ -2,6 +2,7 @@ package ssh
|
|||
|
||||
import (
|
||||
"os/user"
|
||||
"time"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/kevinburke/ssh_config"
|
||||
|
@ -71,7 +72,7 @@ func New(domainName, sshAuth, username, port string) (*simplessh.Client, error)
|
|||
|
||||
if sshAuth == "identity-file" {
|
||||
var err error
|
||||
client, err = simplessh.ConnectWithAgent(hostConfig.Host, hostConfig.User)
|
||||
client, err = simplessh.ConnectWithAgentTimeout(hostConfig.Host, hostConfig.User, 5*time.Second)
|
||||
if err != nil {
|
||||
return client, err
|
||||
}
|
||||
|
@ -85,7 +86,7 @@ func New(domainName, sshAuth, username, port string) (*simplessh.Client, error)
|
|||
}
|
||||
|
||||
var err error
|
||||
client, err = simplessh.ConnectWithPassword(hostConfig.Host, hostConfig.User, password)
|
||||
client, err = simplessh.ConnectWithPasswordTimeout(hostConfig.Host, hostConfig.User, password, 5*time.Second)
|
||||
if err != nil {
|
||||
return client, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue