104 lines
3.3 KiB
Go
104 lines
3.3 KiB
Go
// This file is part of the happyDomain (R) project.
|
|
// Copyright (c) 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.
|
|
var Version = "built-in"
|
|
|
|
// Definition returns the CheckerDefinition for the delegation checker.
|
|
func Definition() *sdk.CheckerDefinition {
|
|
return &sdk.CheckerDefinition{
|
|
ID: "delegation",
|
|
Name: "DNS delegation",
|
|
Version: Version,
|
|
Availability: sdk.CheckerAvailability{
|
|
ApplyToService: true,
|
|
LimitToServices: []string{"abstract.Delegation"},
|
|
},
|
|
ObservationKeys: []sdk.ObservationKey{ObservationKeyDelegation},
|
|
Options: sdk.CheckerOptionsDocumentation{
|
|
UserOpts: []sdk.CheckerOptionDocumentation{
|
|
{
|
|
Id: "requireDS",
|
|
Type: "bool",
|
|
Label: "Require DS at parent",
|
|
Description: "When enabled, missing DS records at the parent are treated as a critical issue (otherwise informational).",
|
|
Default: false,
|
|
},
|
|
{
|
|
Id: "requireTCP",
|
|
Type: "bool",
|
|
Label: "Require DNS over TCP",
|
|
Description: "When enabled, name servers that fail to answer over TCP are reported as critical (otherwise as warning).",
|
|
Default: true,
|
|
},
|
|
{
|
|
Id: "minNameServers",
|
|
Type: "uint",
|
|
Label: "Minimum number of name servers",
|
|
Description: "Below this count, the delegation is reported as a warning (RFC 1034 recommends at least 2).",
|
|
Default: float64(2),
|
|
},
|
|
{
|
|
Id: "allowGlueMismatch",
|
|
Type: "bool",
|
|
Label: "Allow glue mismatches",
|
|
Description: "When disabled, glue/address mismatches between parent and child are reported as critical.",
|
|
Default: false,
|
|
},
|
|
},
|
|
DomainOpts: []sdk.CheckerOptionDocumentation{
|
|
{
|
|
Id: "domain_name",
|
|
Label: "Parent domain name",
|
|
AutoFill: sdk.AutoFillDomainName,
|
|
},
|
|
{
|
|
Id: "subdomain",
|
|
Label: "Subdomain",
|
|
AutoFill: sdk.AutoFillSubdomain,
|
|
},
|
|
},
|
|
ServiceOpts: []sdk.CheckerOptionDocumentation{
|
|
{
|
|
Id: "service",
|
|
Label: "Service",
|
|
AutoFill: sdk.AutoFillService,
|
|
},
|
|
},
|
|
},
|
|
Rules: []sdk.CheckRule{
|
|
Rule(),
|
|
},
|
|
Interval: &sdk.CheckIntervalSpec{
|
|
Min: 5 * time.Minute,
|
|
Max: 24 * time.Hour,
|
|
Default: 1 * time.Hour,
|
|
},
|
|
}
|
|
}
|