checker: make port 22 probe optional

Port 22 is now the default when no ports are configured, rather than
being unconditionally appended. Users can now probe non-standard ports
without also probing port 22.
This commit is contained in:
nemunaire 2026-05-15 17:18:49 +08:00
commit bf28f6a8b2
3 changed files with 6 additions and 7 deletions

View file

@ -57,9 +57,8 @@ func (p *sshProvider) Collect(ctx context.Context, opts sdk.CheckerOptions) (any
includeAuthProbe := sdk.GetBoolOption(opts, OptionIncludeAuthProbe, true)
ports := parsePorts(optString(opts, OptionPorts, ""))
// Port 22 is always probed.
if !containsUint16(ports, DefaultSSHPort) {
ports = append([]uint16{DefaultSSHPort}, ports...)
if len(ports) == 0 {
ports = []uint16{DefaultSSHPort}
}
// Origin is the FQDN where the service is mounted: svc.Domain holds the

View file

@ -48,9 +48,9 @@ func (p *sshProvider) Definition() *sdk.CheckerDefinition {
{
Id: OptionPorts,
Type: "string",
Label: "Additional ports",
Label: "Ports",
Placeholder: "22, 2222",
Description: "Comma-separated list of additional TCP ports to probe. Port 22 is always probed.",
Description: "Comma-separated list of TCP ports to probe. Defaults to port 22 when empty.",
Default: "",
},
{

View file

@ -55,9 +55,9 @@ func (p *sshProvider) RenderForm() []sdk.CheckerOptionField {
{
Id: OptionPorts,
Type: "string",
Label: "Additional ports",
Label: "Ports",
Placeholder: "22, 2222",
Description: "Comma-separated list of additional TCP ports to probe. Port 22 is always probed.",
Description: "Comma-separated list of TCP ports to probe. Defaults to port 22 when empty.",
},
{
Id: OptionProbeTimeoutMs,