Commit 184d5e52 authored by Keith Coleman's avatar Keith Coleman Committed by GitHub

check for two days of remaining validity (#4606)

Signed-off-by: default avatarKeith C <keith@fraudmarc.com>
parent 7b43d042
...@@ -31,7 +31,7 @@ func periodicClean(c *cache.Cache, stop <-chan struct{}) { ...@@ -31,7 +31,7 @@ func periodicClean(c *cache.Cache, stop <-chan struct{}) {
case <-tick.C: case <-tick.C:
// we sign for 8 days, check if a signature in the cache reached 75% of that (i.e. 6), if found delete // we sign for 8 days, check if a signature in the cache reached 75% of that (i.e. 6), if found delete
// the signature // the signature
is75 := time.Now().UTC().Add(sixDays) is75 := time.Now().UTC().Add(twoDays)
c.Walk(func(items map[uint64]interface{}, key uint64) bool { c.Walk(func(items map[uint64]interface{}, key uint64) bool {
for _, rr := range items[key].([]dns.RR) { for _, rr := range items[key].([]dns.RR) {
if !rr.(*dns.RRSIG).ValidityPeriod(is75) { if !rr.(*dns.RRSIG).ValidityPeriod(is75) {
......
...@@ -131,7 +131,7 @@ func (d Dnssec) set(key uint64, sigs []dns.RR) { d.cache.Add(key, sigs) } ...@@ -131,7 +131,7 @@ func (d Dnssec) set(key uint64, sigs []dns.RR) { d.cache.Add(key, sigs) }
func (d Dnssec) get(key uint64, server string) ([]dns.RR, bool) { func (d Dnssec) get(key uint64, server string) ([]dns.RR, bool) {
if s, ok := d.cache.Get(key); ok { if s, ok := d.cache.Get(key); ok {
// we sign for 8 days, check if a signature in the cache reached 3/4 of that // we sign for 8 days, check if a signature in the cache reached 3/4 of that
is75 := time.Now().UTC().Add(sixDays) is75 := time.Now().UTC().Add(twoDays)
for _, rr := range s.([]dns.RR) { for _, rr := range s.([]dns.RR) {
if !rr.(*dns.RRSIG).ValidityPeriod(is75) { if !rr.(*dns.RRSIG).ValidityPeriod(is75) {
cacheMisses.WithLabelValues(server).Inc() cacheMisses.WithLabelValues(server).Inc()
...@@ -154,6 +154,6 @@ func incepExpir(now time.Time) (uint32, uint32) { ...@@ -154,6 +154,6 @@ func incepExpir(now time.Time) (uint32, uint32) {
const ( const (
eightDays = 8 * 24 * time.Hour eightDays = 8 * 24 * time.Hour
sixDays = 6 * 24 * time.Hour twoDays = 2 * 24 * time.Hour
defaultCap = 10000 // default capacity of the cache. defaultCap = 10000 // default capacity of the cache.
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment