Move per-rule user options onto their owning rules
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing

Each of the seven user options was read by exactly one rule, so expose
them via CheckRuleWithOptions instead of the checker-wide UserOpts list.
This keeps each rule's configuration colocated with its evaluation
logic.
This commit is contained in:
nemunaire 2026-05-19 21:51:12 +08:00
commit 81ca1810f1
5 changed files with 76 additions and 48 deletions

View file

@ -139,6 +139,18 @@ func (rsaKeySizeRule) Name() string { return "dnssec_rsa_keysize" }
func (rsaKeySizeRule) Description() string {
return "Verifies RSA DNSKEYs reach a minimum modulus size (default 2048 bits)."
}
func (rsaKeySizeRule) Options() sdk.CheckerOptionsDocumentation {
return sdk.CheckerOptionsDocumentation{
UserOpts: []sdk.CheckerOptionDocumentation{
{
Id: "minRSAKeySize",
Type: "uint",
Label: "Minimum RSA modulus size (bits)",
Default: defaultMinRSAKeySize,
},
},
}
}
func (rsaKeySizeRule) Evaluate(ctx context.Context, obs sdk.ObservationGetter, opts sdk.CheckerOptions) []sdk.CheckState {
data, errState := loadDNSSEC(ctx, obs)
@ -194,6 +206,18 @@ func (kskPresentRule) Name() string { return "dnssec_ksk_present" }
func (kskPresentRule) Description() string {
return "Verifies at least one DNSKEY has the SEP bit (KSK)."
}
func (kskPresentRule) Options() sdk.CheckerOptionsDocumentation {
return sdk.CheckerOptionsDocumentation{
UserOpts: []sdk.CheckerOptionDocumentation{
{
Id: "requireSEP",
Type: "bool",
Label: "Require a KSK (DNSKEY with SEP bit)",
Default: defaultRequireSEP,
},
},
}
}
func (kskPresentRule) Evaluate(ctx context.Context, obs sdk.ObservationGetter, opts sdk.CheckerOptions) []sdk.CheckState {
data, errState := loadDNSSEC(ctx, obs)