Add port configuration for SSH#139
Conversation
| // TODO: port configuration? | ||
| var sshClient *ssh.Client | ||
| sshClient, err = ssh.Dial("tcp", c.SSHHost+":22", &ssh.ClientConfig{ | ||
| sshClient, err = ssh.Dial("tcp", fmt.Sprintf("%s:%d", c.SSHHost, c.SSHPort), &ssh.ClientConfig{ |
There was a problem hiding this comment.
should we verfify that this value is a valid port number (0..2**16)?
There was a problem hiding this comment.
We don't do that for the WinRM port and in any other repo, any reason we should start now?
There was a problem hiding this comment.
I tend to verify all input as harsh as possible as early as possible to provide proper feedback and not throw weird error message later in the process.
And yes, consequence would me that this should be added for the other ports too.
There was a problem hiding this comment.
The weird error would just be a "connect: connection refused" error, just like it is now
There was a problem hiding this comment.
./check_by_powershell -H localhost -p 324234234234234 --cmd 'echo foo' --user foo --password bla
[UNKNOWN] - execution failed: execution of remote cmd failed: unknown error Post "https://localhost:324234234234234/wsman": dial tcp: address 324234234234234: invalid port
the invalid port is probably the main message here and that could be the only message :-)
No description provided.