Skip to content

Add port configuration for SSH#139

Open
martialblog wants to merge 1 commit intomainfrom
feature/sshport
Open

Add port configuration for SSH#139
martialblog wants to merge 1 commit intomainfrom
feature/sshport

Conversation

@martialblog
Copy link
Copy Markdown
Member

No description provided.

@martialblog martialblog added this to the 1.0.0 milestone Apr 30, 2026
@martialblog martialblog self-assigned this Apr 30, 2026
Comment thread check.go
// 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{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we verfify that this value is a valid port number (0..2**16)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do that for the WinRM port and in any other repo, any reason we should start now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The weird error would just be a "connect: connection refused" error, just like it is now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants