fix: add ssh conn time outs
This commit is contained in:
parent
9a513a0700
commit
aec11bda28
@ -2,6 +2,7 @@ package ssh
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os/user"
|
"os/user"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/AlecAivazis/survey/v2"
|
"github.com/AlecAivazis/survey/v2"
|
||||||
"github.com/kevinburke/ssh_config"
|
"github.com/kevinburke/ssh_config"
|
||||||
@ -71,7 +72,7 @@ func New(domainName, sshAuth, username, port string) (*simplessh.Client, error)
|
|||||||
|
|
||||||
if sshAuth == "identity-file" {
|
if sshAuth == "identity-file" {
|
||||||
var err error
|
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 {
|
if err != nil {
|
||||||
return client, err
|
return client, err
|
||||||
}
|
}
|
||||||
@ -85,7 +86,7 @@ func New(domainName, sshAuth, username, port string) (*simplessh.Client, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var err 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 {
|
if err != nil {
|
||||||
return client, err
|
return client, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user