Compare commits
2 commits
16aa0253a3
...
655ab5bb26
| Author | SHA1 | Date | |
|---|---|---|---|
| 655ab5bb26 | |||
| e75c97b52b |
4 changed files with 15 additions and 22 deletions
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
sdk "git.happydns.org/checker-sdk-go/checker"
|
sdk "git.happydns.org/checker-sdk-go/checker"
|
||||||
tlscontract "git.happydns.org/checker-tls/contract"
|
tlscontract "git.happydns.org/checker-tls/contract"
|
||||||
|
|
@ -192,9 +191,8 @@ func (p *daneProvider) Collect(ctx context.Context, opts sdk.CheckerOptions) (an
|
||||||
}
|
}
|
||||||
|
|
||||||
data := &DANEData{
|
data := &DANEData{
|
||||||
Targets: targets,
|
Targets: targets,
|
||||||
Invalid: invalid,
|
Invalid: invalid,
|
||||||
CollectedAt: time.Now().UTC(),
|
|
||||||
}
|
}
|
||||||
if v, ok := opts[OptionDNSSECValidated]; ok {
|
if v, ok := opts[OptionDNSSECValidated]; ok {
|
||||||
if b, ok := v.(bool); ok {
|
if b, ok := v.(bool); ok {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ func (p *daneProvider) GetHTMLReport(ctx sdk.ReportContext) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
view := reportView{
|
view := reportView{
|
||||||
CollectedAt: data.CollectedAt.Format("2006-01-02 15:04 MST"),
|
|
||||||
TargetCount: len(data.Targets),
|
TargetCount: len(data.Targets),
|
||||||
Diagnoses: diagnose(data, probes),
|
Diagnoses: diagnose(data, probes),
|
||||||
Rows: rows,
|
Rows: rows,
|
||||||
|
|
@ -65,7 +64,6 @@ func (p *daneProvider) GetHTMLReport(ctx sdk.ReportContext) (string, error) {
|
||||||
// the per-row status label/class and leaf string keeps the template free of
|
// the per-row status label/class and leaf string keeps the template free of
|
||||||
// branching beyond simple range/if.
|
// branching beyond simple range/if.
|
||||||
type reportView struct {
|
type reportView struct {
|
||||||
CollectedAt string
|
|
||||||
TargetCount int
|
TargetCount int
|
||||||
Diagnoses []diagnosis
|
Diagnoses []diagnosis
|
||||||
Rows []reportRow
|
Rows []reportRow
|
||||||
|
|
@ -166,17 +164,6 @@ func sevRank(s string) int {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hasPKIXUsage reports whether any TLSA record at this target demands PKIX
|
|
||||||
// validation (usage 0 or 1).
|
|
||||||
func hasPKIXUsage(t TargetResult) bool {
|
|
||||||
for _, r := range t.Records {
|
|
||||||
if r.Usage == UsagePKIXTA || r.Usage == UsagePKIXEE {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// proposedTLSA renders a ready-to-paste replacement RR computed from the
|
// proposedTLSA renders a ready-to-paste replacement RR computed from the
|
||||||
// live chain. The (usage, selector, matching) triplet is taken from the
|
// live chain. The (usage, selector, matching) triplet is taken from the
|
||||||
// user's first existing record so the suggestion stays consistent with
|
// user's first existing record so the suggestion stays consistent with
|
||||||
|
|
@ -246,7 +233,7 @@ var reportTemplate = template.Must(template.New("dane").Parse(`<!DOCTYPE html>
|
||||||
</head>
|
</head>
|
||||||
<body><main>
|
<body><main>
|
||||||
<h1>DANE / TLSA</h1>
|
<h1>DANE / TLSA</h1>
|
||||||
<p class="meta">Collected {{.CollectedAt}} · {{.TargetCount}} endpoint(s).</p>
|
<p class="meta">{{.TargetCount}} endpoint(s).</p>
|
||||||
{{with .Diagnoses}}<section class="diagnosis">
|
{{with .Diagnoses}}<section class="diagnosis">
|
||||||
<h2>Action required</h2>
|
<h2>Action required</h2>
|
||||||
{{range .}}<article class="finding sev-{{.Severity}}">
|
{{range .}}<article class="finding sev-{{.Severity}}">
|
||||||
|
|
|
||||||
|
|
@ -269,6 +269,17 @@ func indexProbes(related []sdk.RelatedObservation) map[string]*tls.TLSProbe {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hasPKIXUsage reports whether any TLSA record at this target demands PKIX
|
||||||
|
// validation (usage 0 or 1).
|
||||||
|
func hasPKIXUsage(t TargetResult) bool {
|
||||||
|
for _, r := range t.Records {
|
||||||
|
if r.Usage == UsagePKIXTA || r.Usage == UsagePKIXEE {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func truncHex(s string) string {
|
func truncHex(s string) string {
|
||||||
if len(s) > 12 {
|
if len(s) > 12 {
|
||||||
return s[:12] + "…"
|
return s[:12] + "…"
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
// SHA-512) are matched against the chain slot implied by the usage.
|
// SHA-512) are matched against the chain slot implied by the usage.
|
||||||
package checker
|
package checker
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
// ObservationKeyDANE is the observation key this checker writes.
|
// ObservationKeyDANE is the observation key this checker writes.
|
||||||
const ObservationKeyDANE = "dane_checks"
|
const ObservationKeyDANE = "dane_checks"
|
||||||
|
|
||||||
|
|
@ -89,8 +87,7 @@ type DANEData struct {
|
||||||
// records set the AD bit. Only populated by the standalone interactive
|
// records set the AD bit. Only populated by the standalone interactive
|
||||||
// flow (lookupTLSA); nil in managed mode where records come from the
|
// flow (lookupTLSA); nil in managed mode where records come from the
|
||||||
// user's zone config and DNSSEC posture is checked elsewhere.
|
// user's zone config and DNSSEC posture is checked elsewhere.
|
||||||
DNSSECValidated *bool `json:"dnssec_validated,omitempty"`
|
DNSSECValidated *bool `json:"dnssec_validated,omitempty"`
|
||||||
CollectedAt time.Time `json:"collected_at"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// InvalidRecord describes a TLSA record dropped during Collect.
|
// InvalidRecord describes a TLSA record dropped during Collect.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue