-
Notifications
You must be signed in to change notification settings - Fork 1
/
ds.go
30 lines (28 loc) · 815 Bytes
/
ds.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import (
"github.com/apex/log"
"github.com/miekg/dns"
)
func checkDS(cache Cache, origin string) (r Result) {
for label := range cache {
if _, ok := cache[label]["DS"]; !ok {
continue
}
for _, rr := range cache[label]["DS"] {
ds := rr.(*dns.DS)
if !okDigestType(ds.DigestType) {
log.Errorf("Label %s has DS record with forbidden digest type %s (%d)", ds.Header().Name, hash2string(ds.DigestType), ds.DigestType)
r.errors += 1
}
if !okAlgorithm(ds.Algorithm) {
log.Errorf("Label %s has DS record with forbidden algorithm %s (%d)", ds.Header().Name, algorithm2string(ds.Algorithm), ds.Algorithm)
r.errors += 1
}
}
if _, ok := cache[label]["NS"]; !ok {
log.Errorf("Label %s has DS record but is not delegated.", label)
r.errors += 1
}
}
return
}