Repository navigation
Description
systemd version the issue has been seen with
systemd 247 (247.3-5~bpo10+2)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid
(This is the third-most-recent release, but I hope you will forgive me because 249 was released only 8 days ago)
Used distribution
Debian 10 "Buster"
Linux kernel version used (uname -a)
Linux hostname 5.10.46-319 #319 Thu Jul 15 15:21:11 EDT 2021 armv7l GNU/Linux
CPU architecture issue was seen on
ARMv7 Cortex A7 i.MX6ULL
Expected behaviour you didn't see
systemd-resolved automatically retries without DNSSEC when DNSSEC=allow-downgrade is set and the initial query fails because of an expired signature.
Unexpected behaviour you saw
systemd-resolved fails to downgrade.
Steps to reproduce the problem
# timedatectl set-ntp no # Let us set the time manually
# timedatectl set-time 2021-01-01 # Travel back in time
# resolvectl query debian.org
debian.org: resolve call failed: DNSSEC validation failed: signature-expired
This behavior is fairly common when a system without an RTC is booting up for the first time in a while. Its clock is stuck in the past, but it can't synchronize because it can't resolve the NTP server's IP address (because the clock is stuck in the past).
Additional program output to the terminal or log subsystem illustrating the issue
The following is the output of systemd-resolved with SYSTEMD_LOG_LEVEL=debug while processing the above query:
Got message type=method_call sender=:1.27 destination=org.freedesktop.resolve1 path=/org/freedesktop/resolve1 interface=org.freedesktop.resolve1.Manager member=ResolveHostname cookie=2 reply_cookie=0 signature=isit error-name=n/a error-message=n/a
Looking up RR for debian.org IN A.
Looking up RR for debian.org IN AAAA.
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=AddMatch cookie=4 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetNameOwner cookie=5 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Got message type=method_return sender=org.freedesktop.DBus destination=:1.26 path=n/a interface=n/a member=n/a cookie=7 reply_cookie=5 signature=s error-name=n/a error-message=n/a
Switching to DNS server 172.27.1.5 for interface eth0.
Cache miss for debian.org IN A
Transaction 40254 for <debian.org IN A> scope dns on eth0/*.
Using feature level UDP+EDNS0+DO+LARGE for transaction 40254.
Using DNS server 172.27.1.5 for transaction 40254.
Sending query packet with id 40254.
Got message type=method_return sender=org.freedesktop.DBus destination=:1.26 path=n/a interface=n/a member=n/a cookie=6 reply_cookie=4 signature=n/a error-name=n/a error-message=n/a
Match type='signal',sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.27' successfully installed.
Processing incoming packet on transaction 40254 (rcode=SUCCESS).
Verified we get a response at feature level UDP+EDNS0+DO from DNS server 172.27.1.5.
Requesting DNSKEY to validate transaction 40254 (debian.org, RRSIG with key tag: 50574).
Cache miss for debian.org IN DNSKEY
Transaction 38361 for <debian.org IN DNSKEY> scope dns on eth0/*.
Using feature level UDP+EDNS0+DO+LARGE for transaction 38361.
Using DNS server 172.27.1.5 for transaction 38361.
Sending query packet with id 38361.
Processing incoming packet on transaction 38361 (rcode=SUCCESS).
Requesting DS to validate transaction 38361 (debian.org, DNSKEY with key tag: 50574).
Cache miss for debian.org IN DS
Transaction 31539 for <debian.org IN DS> scope dns on eth0/*.
Using feature level UDP+EDNS0+DO+LARGE for transaction 31539.
Using DNS server 172.27.1.5 for transaction 31539.
Sending query packet with id 31539.
Requesting DS to validate transaction 38361 (debian.org, DNSKEY with key tag: 8500).
Processing incoming packet on transaction 31539 (rcode=SUCCESS).
Requesting DNSKEY to validate transaction 31539 (debian.org, RRSIG with key tag: 5643).
Cache miss for org IN DNSKEY
Transaction 8673 for <org IN DNSKEY> scope dns on eth0/*.
Using feature level UDP+EDNS0+DO+LARGE for transaction 8673.
Using DNS server 172.27.1.5 for transaction 8673.
Sending query packet with id 8673.
Processing incoming packet on transaction 8673 (rcode=SUCCESS).
Requesting DS to validate transaction 8673 (org, DNSKEY with key tag: 63813).
Cache miss for org IN DS
Transaction 38116 for <org IN DS> scope dns on eth0/*.
Using feature level UDP+EDNS0+DO+LARGE for transaction 38116.
Using DNS server 172.27.1.5 for transaction 38116.
Sending query packet with id 38116.
Requesting DS to validate transaction 8673 (org, DNSKEY with key tag: 5643).
Requesting DS to validate transaction 8673 (org, DNSKEY with key tag: 26974).
Processing incoming packet on transaction 38116 (rcode=SUCCESS).
Requesting DNSKEY to validate transaction 38116 (org, RRSIG with key tag: 26838).
Cache miss for . IN DNSKEY
Transaction 49631 for <. IN DNSKEY> scope dns on eth0/*.
Using feature level UDP+EDNS0+DO+LARGE for transaction 49631.
Using DNS server 172.27.1.5 for transaction 49631.
Sending query packet with id 49631.
Processing incoming packet on transaction 49631 (rcode=SUCCESS).
Requesting DS to validate transaction 49631 (., DNSKEY with key tag: 20326).
Requesting DS to validate transaction 49631 (., DNSKEY with key tag: 26838).
Validating response from transaction 49631 (. IN DNSKEY).
Looking at . IN DNSKEY 257 3 RSASHA256 AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIb
zxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQ
lNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCm
r3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b5
8Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTI
dsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGX
ws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU=
-- Flags: SEP ZONE_KEY
-- Key tag: 20326: signature-expired
Looking at . IN DNSKEY 256 3 RSASHA256 AwEAAbDEyqdwu2fqAwinPCFwALUCWfYYaLrNhnOrMxDorLBYMip
EE1btlK1XnigTRMeb0YQ8/LCopb3CN73hYDhCHFsNk+GtukBB+g
WLcg+2FZXbhLXIheQm8x2VfOHy2yYQG+18wjx3HY9Mj/ZEhXbZN
rDMvpFKKVihWXa0/cHNg4ZcIHD9KkMlKzK+my1K/vz8fq5cFCFO
u7wgM+kKbOikdcRBm7Uf/wRXZItFg2uhUijUb56gEN8uCUgmuEw
6wQ5ZBuR7UT/FLyyAUeAH87oxF4im2DXK6J+JA7IAs2UHJ16uTq
vdserUU8NIosislaXIZCvz+NTDb3SJcxs6bvCikeU=
-- Flags: ZONE_KEY
-- Key tag: 26838: signature-expired
Looking at . IN DNSKEY 257 3 RSASHA256 AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIb
zxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQ
lNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCm
r3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b5
8Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTI
dsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGX
ws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU=
-- Flags: SEP ZONE_KEY
-- Key tag: 20326: signature-expired
Found verdict for lookup . IN DNSKEY: bogus
DNSSEC validation failed for question . IN DNSKEY: signature-expired
Transaction 49631 for <. IN DNSKEY> on scope dns on eth0/* now complete with <dnssec-failed> from network (unsigned).
Auxiliary DNSSEC RR query failed validation: signature-expired
DNSSEC validation failed for question org IN DS: signature-expired
Transaction 38116 for <org IN DS> on scope dns on eth0/* now complete with <dnssec-failed> from network (unsigned).
Auxiliary DNSSEC RR query failed validation: signature-expired
DNSSEC validation failed for question org IN DNSKEY: signature-expired
Transaction 8673 for <org IN DNSKEY> on scope dns on eth0/* now complete with <dnssec-failed> from network (unsigned).
Auxiliary DNSSEC RR query failed validation: signature-expired
DNSSEC validation failed for question debian.org IN DS: signature-expired
Transaction 31539 for <debian.org IN DS> on scope dns on eth0/* now complete with <dnssec-failed> from network (unsigned).
Auxiliary DNSSEC RR query failed validation: signature-expired
DNSSEC validation failed for question debian.org IN DNSKEY: signature-expired
Transaction 38361 for <debian.org IN DNSKEY> on scope dns on eth0/* now complete with <dnssec-failed> from network (unsigned).
Auxiliary DNSSEC RR query failed validation: signature-expired
DNSSEC validation failed for question debian.org IN A: signature-expired
Transaction 40254 for <debian.org IN A> on scope dns on eth0/* now complete with <dnssec-failed> from network (unsigned).
Sent message type=error sender=n/a destination=:1.27 path=n/a interface=n/a member=n/a cookie=6 reply_cookie=2 signature=s error-name=org.freedesktop.resolve1.DnssecFailed error-message=DNSSEC validation failed: signature-expired
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RemoveMatch cookie=7 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Activity
pemensik commentedon May 26, 2022
Since it is arm, are you sure you have time synchronization configured correctly? It seems to me this is fault of resolved, which might start validation before correct time is configured. It cannot pass with invalid time. If your machine is missing RTC it needs to delay validation to later point.
Can you extract those logs also with a system time, when they happened? Does time change during boot significantly?
sean-anderson-seco commentedon May 26, 2022
Not sure how that follows, but yes time synchronization works. The only difference from the configuration shipped by systemd is the addition of some servers to
NTP=. In fact, if time synchronization did not work, then this would not be an issue (since timesyncd would fail anyway).Not "might," "will." On platforms without an RTC, if the default time (either build time or from a filesystem timestamp) is too old, then the DNSSEC certs will be too new when the system boots. This will cause time synchronization to fail, since the servers in
NTP=(orFallbackNTP) are listed as domains, and not IP addresses. However,allow-downgradestill fails in this situation, preventing the machine from discovering the correct time.Then I would set
DNSSEC=yesto make it mandatory. In fact, this machine has no RTC, so no amount of waiting will get the correct timeSure, but I don't think it will be very interesting. They will all happen at around midnight on
2021-01-01.With
DNSSEC=allow-downgrade, no (because the time cannot be synchronized). WithDNSSEC=no, the time will be updated correctly, resulting in a jump forward. Note thatallow-downgradeis the default.pemensik commentedon May 26, 2022
I think there are two possibilities. Either time synchronization query would contain CD flag, which disables validation for that query. Those queries would then work even when validation is configured already. That should allow initial time synchronization to work.
The better way would be systemd target for time synchronization. It should start without validation on start, but can enable it after time is set correctly. That is why I think any DNS caching daemon should start only later, when time is already configured. Before it is not safe to store entries into cache and validation cannot work well. Without a cache there is not many reasons to start dns cache early. Not sure how smart it can be to configure this by default on affected devices.
Unfortunately
DNSSEC=nois default on Fedora and Ubuntu AFAIK.pemensik commentedon May 26, 2022
dnsmasq has a special knob for similar use case. Once time is configured, a signal is sent to it and it starts validation only after that time. With option
--dnssec-no-timecheckit ignores time during early validation. Once time is set, it can switch to full validation.yuwata commentedon May 26, 2022
C.f. nss-resolve supports
$SYSTEMD_NSS_RESOLVE_VALIDATEenvironment variable, and systemd-timesyncd.service uses it.See #18563.
pemensik commentedon May 26, 2022
Environment value seems like a nice hack. But that would work only for nss resolve plugin. If Ubuntu does not use resolve plugin, that would not help. If NTP software used DNS query directly with CD bit set, it would work also with other implementations. It seems to me AI_NOVERIFY should be added to getaddrinfo() flags to request CD bit set. There seems no generic way to skip validation from C API.
pemensik commentedon May 26, 2022
I think resolved could have also support for variant of dnsmasq's
--dnssec-timestamp=<path>. It could detect on resolved startup that time is set before file modified by resolved on shutdown. It might then disable DNSSEC validation until system time is set after timestamp of that file. It would make it wait for more recent time than a time last known. As soon as time advances, the cache can be flushed and full verification enabled.That system would not require any custom flags passed from NTP software.
pemensik commentedon May 26, 2022
Do I read it correctly that timesyncd NEVER uses DNSSEC validation? Even after it has correct time and is just maintaining it?
yuwata commentedon May 26, 2022
Yeah. We have discussed about that #18563 (comment). But there may exist some better ways.
pemensik commentedon May 26, 2022
I think there is simpler way. If time is not considered for verification during time configuration stage, just mark all entries checked with dnssec but without time with a special flag. Then once time is believed to be correct, walk over cache entries and verify each entry again. It should not require any further crypto operation, that were checked already. It needs just check for validity period of each entry and drop all records from cache, which do not pass validity check. Everything else were done before already. Then the cache is fully prepared and no separate cache is required.
[-]resolve call failed: DNSSEC validation failed: signature-expired[/-][+]resolve call failed: DNSSEC validation failed: signature-expired (system with no RTC)[/+]timesyncd: resolve NTP hostnames through resolved's varlink interface (…