Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close connection on broken tunnel, private key is not mandatory #159

Merged
merged 18 commits into from
Sep 17, 2021
Merged
4 changes: 2 additions & 2 deletions tunnel/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ func NewServer(user, address, key, sshAgent, cfgPath string) (*Server, error) {

c, err := NewSSHConfigFile(cfgPath)
if err != nil {
if !errors.Is(err, os.ErrNotExist) {
if !(errors.Is(err, os.ErrNotExist) || errors.Is(err, os.ErrInvalid)){
davrodpin marked this conversation as resolved.
Show resolved Hide resolved
return nil, fmt.Errorf("error accessing %s: %v", host, err)
}
}

// If ssh config file doesnt exists, create an empty ssh config struct to avoid nil pointer deference
if errors.Is(err, os.ErrNotExist) {
if errors.Is(err, os.ErrNotExist) || errors.Is(err, os.ErrInvalid){
c = NewEmptySSHConfigStruct()
}

Expand Down