checker-reverse-zone/checker/definition.go

83 lines
2.6 KiB
Go

package checker
import (
"time"
sdk "git.happydns.org/checker-sdk-go/checker"
)
var Version = "built-in"
// Definition returns the CheckerDefinition for the reverse-zone checker.
func (p *reverseZoneProvider) Definition() *sdk.CheckerDefinition {
def := &sdk.CheckerDefinition{
ID: "reverse-zone",
Name: "Reverse zone (PTR coverage)",
Version: Version,
Availability: sdk.CheckerAvailability{
ApplyToDomain: true,
ApplyToZone: true,
},
ObservationKeys: []sdk.ObservationKey{ObservationKey},
HasHTMLReport: true,
Options: sdk.CheckerOptionsDocumentation{
UserOpts: []sdk.CheckerOptionDocumentation{
{
Id: "requireForwardMatch",
Type: "bool",
Label: "Require forward-confirmed reverse DNS (FCrDNS)",
Description: "When enabled, a PTR whose target does not resolve back to the original IP is reported as critical (otherwise as warning). Mail and SSH servers require FCrDNS.",
Default: true,
},
{
Id: "allowMultiplePTR",
Type: "bool",
Label: "Allow multiple PTR records on the same IP",
Description: "When disabled, more than one PTR at the same owner is reported as warning (RFC 1912 §2.1 recommends a single PTR per IP).",
Default: false,
},
{
Id: "minTTL",
Type: "uint",
Label: "Minimum PTR TTL (seconds)",
Description: "PTR records with a TTL below this threshold are flagged as warning. Very short TTLs degrade resolver cache efficiency.",
Default: float64(300),
},
{
Id: "flagGenericPTR",
Type: "bool",
Label: "Flag generic-looking PTR hostnames",
Description: "When enabled, PTR targets that embed the dotted IP or match common ISP auto-generated patterns are reported as warning.",
Default: true,
},
{
Id: "maxPTRsToCheck",
Type: "uint",
Label: "Maximum PTRs to inspect",
Description: "Caps the number of PTR records inspected per run, protecting the checker against very large reverse zones.",
Default: float64(1024),
},
},
DomainOpts: []sdk.CheckerOptionDocumentation{
{
Id: "domain_name",
Label: "Reverse zone",
AutoFill: sdk.AutoFillDomainName,
},
{
Id: "zone",
Label: "Zone services",
AutoFill: sdk.AutoFillZone,
},
},
},
Rules: Rules(),
Interval: &sdk.CheckIntervalSpec{
Min: 5 * time.Minute,
Max: 24 * time.Hour,
Default: 1 * time.Hour,
},
}
def.BuildRulesInfo()
return def
}