Skip to content

Commit

Permalink
Repeating root zone AXFR and Trust Anchor retrieval periodically
Browse files Browse the repository at this point in the history
  • Loading branch information
shadrick committed Jun 13, 2018
1 parent 867171d commit 80c3934
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions responder/recursive_dns_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,10 @@ func getRootTrustAnchors(rt *runtime.Runtime, l *logrus.Entry, provider string)
return RR_NAVIGATOR_NEXT
})

time.AfterFunc(24*time.Hour, func() {
getRootTrustAnchors(rt, l, provider)
})

return nil
}

Expand All @@ -1870,7 +1874,7 @@ func getZoneAXFR(rt *runtime.Runtime, l *logrus.Entry, provider, zone string) er
if e != nil {
return fmt.Errorf("cannot execute zone transfer [%s]", e.Error())
}

nextIteration := uint32(72 * time.Hour / time.Second)
for env := range r {
if env.Error != nil {
l.Infof("Zone transfer envelope error [%s]", env.Error.Error())
Expand All @@ -1879,11 +1883,18 @@ func getZoneAXFR(rt *runtime.Runtime, l *logrus.Entry, provider, zone string) er
for _, rr := range env.RR {
switch rr.(type) {
case *dns.A, *dns.AAAA, *dns.NS, *dns.DS, *dns.DNSKEY:
if (rr.Header().Rrtype == dns.TypeDS || rr.Header().Rrtype == dns.TypeDNSKEY) &&
rr.Header().Ttl > 0 && rr.Header().Ttl < nextIteration {
nextIteration = rr.Header().Ttl
}
rt.Cache.Insert(provider, rr.Header().Name, rr, EXTRA_EMPTY)
}
}

}
l.Infof("Scheduling next AXFR for zone [%s] in %d", zone, nextIteration)
time.AfterFunc(time.Duration(nextIteration)*time.Second, func() {
getZoneAXFR(rt, l, provider, zone)
})

return nil
}
Expand Down

0 comments on commit 80c3934

Please sign in to comment.