88 lines
3 KiB
Go
88 lines
3 KiB
Go
// This file is part of the happyDomain (R) project.
|
|
// Copyright (c) 2020-2026 happyDomain
|
|
// Authors: Pierre-Olivier Mercier, et al.
|
|
//
|
|
// This program is offered under a commercial and under the AGPL license.
|
|
// For commercial licensing, contact us at <contact@happydomain.org>.
|
|
//
|
|
// For AGPL licensing:
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
package checker
|
|
|
|
import (
|
|
"time"
|
|
|
|
sdk "git.happydns.org/checker-sdk-go/checker"
|
|
)
|
|
|
|
// Version is the checker version reported in CheckerDefinition.Version.
|
|
// Defaults to "built-in"; standalone binaries and plugin builds override
|
|
// it via -ldflags "-X .../checker.Version=...".
|
|
var Version = "built-in"
|
|
|
|
// Definition returns the CheckerDefinition for the SSH checker.
|
|
func (p *sshProvider) Definition() *sdk.CheckerDefinition {
|
|
return &sdk.CheckerDefinition{
|
|
ID: "ssh",
|
|
Name: "SSH",
|
|
Version: Version,
|
|
Availability: sdk.CheckerAvailability{
|
|
ApplyToService: true,
|
|
LimitToServices: []string{"abstract.Server"},
|
|
},
|
|
ObservationKeys: []sdk.ObservationKey{ObservationKeySSH},
|
|
Options: sdk.CheckerOptionsDocumentation{
|
|
UserOpts: []sdk.CheckerOptionDocumentation{
|
|
{
|
|
Id: OptionPorts,
|
|
Type: "string",
|
|
Label: "Additional ports",
|
|
Placeholder: "22, 2222",
|
|
Description: "Comma-separated list of additional TCP ports to probe. Port 22 is always probed.",
|
|
Default: "",
|
|
},
|
|
{
|
|
Id: OptionProbeTimeoutMs,
|
|
Type: "number",
|
|
Label: "Per-endpoint probe timeout (ms)",
|
|
Description: "Maximum time allowed for dial + banner + KEXINIT + handshake on a single endpoint.",
|
|
Default: float64(DefaultProbeTimeoutMs),
|
|
},
|
|
{
|
|
Id: OptionIncludeAuthProbe,
|
|
Type: "bool",
|
|
Label: "Enumerate authentication methods",
|
|
Description: "Perform a second connection with a dummy user to discover which auth methods the server advertises. Harmless but adds a connection attempt per endpoint.",
|
|
Default: true,
|
|
},
|
|
},
|
|
ServiceOpts: []sdk.CheckerOptionDocumentation{
|
|
{
|
|
Id: OptionService,
|
|
Label: "Service",
|
|
AutoFill: sdk.AutoFillService,
|
|
Hide: true,
|
|
},
|
|
},
|
|
},
|
|
Rules: Rules(),
|
|
Interval: &sdk.CheckIntervalSpec{
|
|
Min: 6 * time.Hour,
|
|
Max: 7 * 24 * time.Hour,
|
|
Default: 24 * time.Hour,
|
|
},
|
|
HasHTMLReport: true,
|
|
}
|
|
}
|