davrodpin / mole

CLI application to create ssh tunnels focused on resiliency and user experience.
https://davrodpin.github.io/mole/
MIT License
1.69k stars 97 forks source link

Missing `config` attribute on `<alias>.toml` file causing application to fail #156

Open davrodpin opened 3 years ago

davrodpin commented 3 years ago

Affected Version

Master @ b6c4dc0

Expected Behavior

Application to use the default value $HOME/.ssh/config

Current Behavior

Application crashes with the following error stack:

panic: read .: is a directory

goroutine 20 [running]:
github.com/kevinburke/ssh_config.(*sshLexer).peek(0xc0000d6370, 0x0)
    /go/pkg/mod/github.com/kevinburke/ssh_config@v0.0.0-20190630040420-2e50c441276c/lexer.go:202 +0xf7
github.com/kevinburke/ssh_config.(*sshLexer).lexVoid(0xc0000d6370, 0x0)
    /go/pkg/mod/github.com/kevinburke/ssh_config@v0.0.0-20190630040420-2e50c441276c/lexer.go:141 +0x45
github.com/kevinburke/ssh_config.(*sshLexer).run(0xc0000d6370)
    /go/pkg/mod/github.com/kevinburke/ssh_config@v0.0.0-20190630040420-2e50c441276c/lexer.go:224 +0x4a
created by github.com/kevinburke/ssh_config.lexSSH
    /go/pkg/mod/github.com/kevinburke/ssh_config@v0.0.0-20190630040420-2e50c441276c/lexer.go:239 +0xd7

Steps to Reproduce

  1. Create the following alias
mole add alias remote test --verbose --insecure --source 192.168.33.11:9090 --destination 127.0.0.1:8080 --server mole@127.0.0.01:22122 --key test-env/ssh-server/keys/key --keep-alive-interval 2s
  1. Start mole with alias
$ ./bin/mole start alias test
davrodpin commented 3 years ago

159 should fix this.

davrodpin commented 3 years ago

159 made mole to work under the described scenario but with a different behavior. Now the missing config attribute causes mole to use an empty configuration.

I think this issue needs to be kept open since the expected behavior is to try to use $HOME/.ssh/ssh_config before falls back to an empty configuration.