bind9/bin/named
Tony Finch 31005d61ae Fix re-signing when sig-validity-interval has two arguments
Since October 2019 I have had complaints from `dnssec-cds` reporting
that the signatures on some of my test zones had expired. These were
zones signed by BIND 9.15 or 9.17, with a DNSKEY TTL of 24h and
`sig-validity-interval 10 8`.

This is the same setup we have used for our production zones since
2015, which is intended to re-sign the zones every 2 days, keeping
at least 8 days signature validity. The SOA expire interval is 7
days, so even in the presence of zone transfer problems, no-one
should ever see expired signatures. (These timers are a bit too
tight to be completely correct, because I should have increased
the expiry timers when I increased the DNSKEY TTLs from 1h to 24h.
But that should only matter when zone transfers are broken, which
was not the case for the error reports that led to this patch.)

For example, this morning my test zone contained:

        dev.dns.cam.ac.uk. 86400 IN RRSIG DNSKEY 13 5 86400 (
                                20200701221418 20200621213022 ...)

But one of my resolvers had cached:

        dev.dns.cam.ac.uk. 21424 IN RRSIG DNSKEY 13 5 86400 (
                                20200622063022 20200612061136 ...)

This TTL was captured at 20200622105807 so the resolver cached the
RRset 64976 seconds previously (18h02m56s), at 20200621165511
only about 12h before expiry.

The other symptom of this error was incorrect `resign` times in
the output from `rndc zonestatus`.

For example, I have configured a test zone

        zone fast.dotat.at {
                file "../u/z/fast.dotat.at";
                type primary;
                auto-dnssec maintain;
                sig-validity-interval 500 499;
        };

The zone is reset to a minimal zone containing only SOA and NS
records, and when `named` starts it loads and signs the zone. After
that, `rndc zonestatus` reports:

        next resign node: fast.dotat.at/NS
        next resign time: Fri, 28 May 2021 12:48:47 GMT

The resign time should be within the next 24h, but instead it is
near the signature expiry time, which the RRSIG(NS) says is
20210618074847. (Note 499 hours is a bit more than 20 days.)
May/June 2021 is less than 500 days from now because expiry time
jitter is applied to the NS records.

Using this test I bisected this bug to 09990672d which contained a
mistake leading to the resigning interval always being calculated in
hours, when days are expected.

This bug only occurs for configurations that use the two-argument form
of `sig-validity-interval`.

(cherry picked from commit 030674b2a3)
2020-07-14 12:11:42 +10:00
..
include Implement dummy 'rndc dnssec -status' command 2020-07-01 09:57:44 +02:00
unix Resize unamebuf[] to avoid warnings about snprintf() not having 2020-06-25 09:26:22 +10:00
win32 Resize unamebuf[] to avoid warnings about snprintf() not having 2020-06-25 09:26:22 +10:00
.gitignore [master] add libns and remove liblwres 2017-09-08 13:47:34 -07:00
bind9.xsl Add the zone timers to the XSL 2020-05-12 14:12:03 +02:00
bind9.xsl.h Add the zone timers to the XSL 2020-05-12 14:12:03 +02:00
builtin.c Merge branch '46-enforce-clang-format-rules' into 'master' 2020-02-14 08:45:59 +00:00
config.c Reduce the default value for max-stale-ttl from 1 week to 12 hours 2020-06-03 10:45:09 +00:00
control.c Implement dummy 'rndc dnssec -status' command 2020-07-01 09:57:44 +02:00
controlconf.c Remove redundant check for listener being non-NULL 2020-07-13 10:28:34 +10:00
convertxsl.pl Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
fuzz.c Use the new sorting rules to regroup #include headers 2020-03-11 08:55:12 +00:00
geoip.c Merge branch 'each-style-tweak' into 'master' 2020-02-14 05:35:29 +00:00
log.c Refactor the isc_log API so it cannot fail on memory failures 2020-03-18 11:44:18 +01:00
logconf.c Refactor the isc_log API so it cannot fail on memory failures 2020-03-18 11:44:18 +01:00
main.c Fix "array subscript is of type 'char'" 2020-06-04 16:27:43 +02:00
Makefile.in add support for building sphinx documentation 2020-06-01 09:54:46 +02:00
named.conf.rst generate grammar text correctly in RST format 2020-06-01 09:58:29 +02:00
named.rst Convert the documentation to Sphinx documentation format 2020-06-01 09:54:45 +02:00
server.c make sure new_zone_lock is locked before unlocking it 2020-07-13 23:53:14 +00:00
statschannel.c Export zone timers via stats channels 2020-05-12 14:12:03 +02:00
tkeyconf.c Use the new sorting rules to regroup #include headers 2020-03-11 08:55:12 +00:00
tsigconf.c Merge branch 'each-style-tweak' into 'master' 2020-02-14 05:35:29 +00:00
zoneconf.c Fix re-signing when sig-validity-interval has two arguments 2020-07-14 12:11:42 +10:00