Skip to content

Speed up DNSSEC #31826

Closed
Closed

Description

@rpigott

Component

systemd-resolved

Is your feature request related to a problem? Please describe

So, dnssec isn't exactly speedy under the best of conditions, but in sd-resolved the dnssec performance is especially poor.

Consider the following query, and know that on my lan the caching resolver at 10.3.0.254 is dnsmasq, speaking to 1.1.1.1 with ~30ms round trip network delay. This query validates correctly as insecure after typically 10~20 seconds (!) of validation. There are 67 participating dns transactions, and more round trips considering truncation of DNSKEYs. The upstream recursive resolver presumably also has all of the necessary data for validation in its cache or aggressive nsec cache, if it is really validating as it claims.

(This log contains debug output for only one query. It was deliberately chosen as a prospective worst case based on observation of sd-resolved. This query is issued by e.g. ping -6 google.com)

resolvectl query -p dns 2607:f8b0:4007:809::200e # google.com AAAA, complete in 17 seconds
[removed] (apparently 197774 is "too many characters" for a GH issue)

list of sd-resolved's network transactions on master:

tshark -nli enp7s0 port domain # resolvectl query 2607:f8b0:4007:809::200e, complete in 12 seconds
    1 0.000000000    10.3.0.99 → 10.3.0.254   DNS 166 Standard query 0x94d1 PTR e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
    2 0.105381741   10.3.0.254 → 10.3.0.99    DNS 221 Standard query response 0x94d1 PTR e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa PTR lax17s51-in-x0e.1e100.net PTR lax02s21-in-x0e.1e100.net OPT
    3 0.106910826    10.3.0.99 → 10.3.0.254   DNS 166 Standard query 0xa9e1 SOA e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
    4 0.267506661   10.3.0.254 → 10.3.0.99    DNS 213 Standard query response 0xa9e1 SOA e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
    5 0.268204421    10.3.0.99 → 10.3.0.254   DNS 120 Standard query 0x0bf3 DS 4.0.b.8.f.7.0.6.2.ip6.arpa OPT
    6 0.268893119    10.3.0.99 → 10.3.0.254   DNS 166 Standard query 0xde3d DS e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
    7 0.575173548   10.3.0.254 → 10.3.0.99    DNS 97 Standard query response 0x0bf3 DS 4.0.b.8.f.7.0.6.2.ip6.arpa OPT
    8 0.575174520   10.3.0.254 → 10.3.0.99    DNS 213 Standard query response 0xde3d DS e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
    9 0.575825129    10.3.0.99 → 10.3.0.254   DNS 118 Standard query 0x219c SOA 0.b.8.f.7.0.6.2.ip6.arpa OPT
   10 0.576642175    10.3.0.99 → 10.3.0.254   DNS 164 Standard query 0xb737 SOA 0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   11 0.736675813   10.3.0.254 → 10.3.0.99    DNS 155 Standard query response 0x219c SOA 0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   12 0.737084506   10.3.0.254 → 10.3.0.99    DNS 211 Standard query response 0xb737 SOA 0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   13 0.737406725    10.3.0.99 → 10.3.0.254   DNS 118 Standard query 0xb90c DS 0.b.8.f.7.0.6.2.ip6.arpa OPT
   14 0.738307505    10.3.0.99 → 10.3.0.254   DNS 164 Standard query 0xf509 DS 0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   15 0.947966243   10.3.0.254 → 10.3.0.99    DNS 543 Standard query response 0xb90c DS 0.b.8.f.7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 8.b.8.f.7.0.6.2.ip6.arpa RRSIG OPT
   16 0.947967311   10.3.0.254 → 10.3.0.99    DNS 211 Standard query response 0xf509 DS 0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   17 0.948588376    10.3.0.99 → 10.3.0.254   DNS 108 Standard query 0x5c3e DNSKEY 0.6.2.ip6.arpa OPT
   18 0.948891573    10.3.0.99 → 10.3.0.254   DNS 116 Standard query 0x5d70 SOA b.8.f.7.0.6.2.ip6.arpa OPT
   19 0.949671478    10.3.0.99 → 10.3.0.254   DNS 162 Standard query 0x57ad SOA 0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   20 0.980626952   10.3.0.254 → 10.3.0.99    DNS 85 Standard query response 0x5c3e DNSKEY 0.6.2.ip6.arpa OPT
   21 0.981081937    10.3.0.99 → 10.3.0.254   TCP 78 54138 → 53 [SYN] Seq=0 Win=32120 Len=0 MSS=1460 SACK_PERM TSval=2065473993 TSecr=0 WS=128 TFO=R
   22 0.981322569   10.3.0.254 → 10.3.0.99    TCP 74 53 → 54138 [SYN, ACK] Seq=0 Ack=1 Win=65160 Len=0 MSS=1460 SACK_PERM TSval=863691496 TSecr=2065473993 WS=64
   23 0.981385910    10.3.0.99 → 10.3.0.254   TCP 66 54138 → 53 [ACK] Seq=1 Ack=1 Win=32128 Len=0 TSval=2065473993 TSecr=863691496
   24 0.981506589    10.3.0.99 → 10.3.0.254   DNS 134 Standard query 0x5c3e DNSKEY 0.6.2.ip6.arpa OPT
   25 0.981683828   10.3.0.254 → 10.3.0.99    TCP 66 53 → 54138 [ACK] Seq=1 Ack=69 Win=65152 Len=0 TSval=863691497 TSecr=2065473993
   26 1.014933281   10.3.0.254 → 10.3.0.99    DNS 1435 Standard query response 0x5c3e DNSKEY 0.6.2.ip6.arpa DNSKEY DNSKEY DNSKEY DNSKEY RRSIG RRSIG OPT
   27 1.014997871    10.3.0.99 → 10.3.0.254   TCP 66 54138 → 53 [ACK] Seq=69 Ack=1370 Win=31872 Len=0 TSval=2065474026 TSecr=863691530
   28 1.015663050    10.3.0.99 → 10.3.0.254   DNS 108 Standard query 0xf2c5 DS 0.6.2.ip6.arpa OPT
   29 1.053013270   10.3.0.254 → 10.3.0.99    DNS 545 Standard query response 0x5d70 SOA b.8.f.7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 0.b.8.f.7.0.6.2.ip6.arpa RRSIG OPT
   30 1.053983646    10.3.0.99 → 10.3.0.254   DNS 116 Standard query 0x5a8b DS b.8.f.7.0.6.2.ip6.arpa OPT
   31 1.242739381   10.3.0.254 → 10.3.0.99    DNS 209 Standard query response 0x57ad SOA 0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   32 1.242899294   10.3.0.254 → 10.3.0.99    DNS 545 Standard query response 0x5a8b DS b.8.f.7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 0.b.8.f.7.0.6.2.ip6.arpa RRSIG OPT
   33 1.243833353    10.3.0.99 → 10.3.0.254   DNS 162 Standard query 0xa85d DS 0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   34 1.244326494    10.3.0.99 → 10.3.0.254   DNS 114 Standard query 0x389c SOA 8.f.7.0.6.2.ip6.arpa OPT
   35 1.326987239   10.3.0.254 → 10.3.0.99    DNS 301 Standard query response 0xf2c5 DS 0.6.2.ip6.arpa DS RRSIG OPT
   36 1.327545711    10.3.0.99 → 10.3.0.254   DNS 102 Standard query 0xb761 DNSKEY ip6.arpa OPT
   37 1.356992225   10.3.0.254 → 10.3.0.99    DNS 545 Standard query response 0x389c SOA 8.f.7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 0.0.8.f.7.0.6.2.ip6.arpa RRSIG OPT
   38 1.357097212   10.3.0.254 → 10.3.0.99    DNS 209 Standard query response 0xa85d DS 0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   39 1.357880114    10.3.0.99 → 10.3.0.254   DNS 114 Standard query 0x87f5 DS 8.f.7.0.6.2.ip6.arpa OPT
   40 1.358851151   10.3.0.254 → 10.3.0.99    DNS 79 Standard query response 0xb761 DNSKEY ip6.arpa OPT
   41 1.358891401    10.3.0.99 → 10.3.0.254   DNS 160 Standard query 0xd356 SOA 2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   42 1.359062932    10.3.0.99 → 10.3.0.254   DNS 128 Standard query 0xb761 DNSKEY ip6.arpa OPT
   43 1.391190436   10.3.0.254 → 10.3.0.99    DNS 1397 Standard query response 0xb761 DNSKEY ip6.arpa DNSKEY DNSKEY DNSKEY RRSIG RRSIG OPT
   44 1.391254404    10.3.0.99 → 10.3.0.254   TCP 66 54138 → 53 [ACK] Seq=131 Ack=2701 Win=31872 Len=0 TSval=2065474403 TSecr=863691906
   45 1.391861683    10.3.0.99 → 10.3.0.254   DNS 102 Standard query 0xd709 DS ip6.arpa OPT
   46 1.424378263   10.3.0.254 → 10.3.0.99    DNS 515 Standard query response 0xd709 DS ip6.arpa DS DS DS RRSIG OPT
   47 1.424947237    10.3.0.99 → 10.3.0.254   DNS 98 Standard query 0xa7f4 DNSKEY arpa OPT
   48 1.457039058   10.3.0.254 → 10.3.0.99    DNS 919 Standard query response 0xa7f4 DNSKEY arpa DNSKEY DNSKEY RRSIG OPT
   49 1.457422957    10.3.0.99 → 10.3.0.254   DNS 98 Standard query 0x2c30 DS arpa OPT
   50 1.489215011   10.3.0.254 → 10.3.0.99    DNS 410 Standard query response 0x2c30 DS arpa DS RRSIG OPT
   51 1.489583796    10.3.0.99 → 10.3.0.254   DNS 93 Standard query 0x5a03 DNSKEY <Root> OPT
   52 1.521854366   10.3.0.254 → 10.3.0.99    DNS 906 Standard query response 0x5a03 DNSKEY <Root> DNSKEY DNSKEY RRSIG OPT
   53 1.649325787   10.3.0.254 → 10.3.0.99    DNS 207 Standard query response 0xd356 SOA 2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   54 1.649401229   10.3.0.254 → 10.3.0.99    DNS 545 Standard query response 0x87f5 DS 8.f.7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 0.0.8.f.7.0.6.2.ip6.arpa RRSIG OPT
   55 1.650513707    10.3.0.99 → 10.3.0.254   DNS 160 Standard query 0x9bf9 DS 2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   56 1.650980986    10.3.0.99 → 10.3.0.254   DNS 112 Standard query 0x40ce SOA f.7.0.6.2.ip6.arpa OPT
   57 1.928462255   10.3.0.254 → 10.3.0.99    DNS 207 Standard query response 0x9bf9 DS 2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   58 1.928463281   10.3.0.254 → 10.3.0.99    DNS 545 Standard query response 0x40ce SOA f.7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 0.0.0.f.7.0.6.2.ip6.arpa RRSIG OPT
   59 1.929556223    10.3.0.99 → 10.3.0.254   DNS 158 Standard query 0x888f SOA 0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   60 1.929965680    10.3.0.99 → 10.3.0.254   DNS 112 Standard query 0xc207 DS f.7.0.6.2.ip6.arpa OPT
   61 2.049376728   10.3.0.254 → 10.3.0.99    DNS 545 Standard query response 0xc207 DS f.7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 0.0.0.f.7.0.6.2.ip6.arpa RRSIG OPT
   62 2.050174609    10.3.0.99 → 10.3.0.254   DNS 110 Standard query 0xae98 SOA 7.0.6.2.ip6.arpa OPT
   63 2.257715988   10.3.0.254 → 10.3.0.99    DNS 205 Standard query response 0x888f SOA 0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   64 2.257906191   10.3.0.254 → 10.3.0.99    DNS 545 Standard query response 0xae98 SOA 7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 0.0.0.0.7.0.6.2.ip6.arpa RRSIG OPT
   65 2.259157096    10.3.0.99 → 10.3.0.254   DNS 158 Standard query 0x9440 DS 0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   66 2.259662328    10.3.0.99 → 10.3.0.254   DNS 110 Standard query 0x40c5 DS 7.0.6.2.ip6.arpa OPT
   67 2.484164051   10.3.0.254 → 10.3.0.99    DNS 205 Standard query response 0x9440 DS 0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   68 2.484498990   10.3.0.254 → 10.3.0.99    DNS 545 Standard query response 0x40c5 DS 7.0.6.2.ip6.arpa SOA z.arin.net RRSIG NSEC 0.0.0.0.7.0.6.2.ip6.arpa RRSIG OPT
   69 2.485290507    10.3.0.99 → 10.3.0.254   DNS 156 Standard query 0x3edc SOA 0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   70 2.485710536    10.3.0.99 → 10.3.0.254   DNS 108 Standard query 0xa434 SOA 0.6.2.ip6.arpa OPT
   71 2.635656180   10.3.0.254 → 10.3.0.99    DNS 203 Standard query response 0x3edc SOA 0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   72 2.636838025    10.3.0.99 → 10.3.0.254   DNS 156 Standard query 0x603f DS 0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   73 2.645667929   10.3.0.254 → 10.3.0.99    DNS 313 Standard query response 0xa434 SOA 0.6.2.ip6.arpa SOA z.arin.net RRSIG OPT
   74 2.957536364   10.3.0.254 → 10.3.0.99    DNS 203 Standard query response 0x603f DS 0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   75 2.958933126    10.3.0.99 → 10.3.0.254   DNS 154 Standard query 0x14be SOA 0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   76 3.311178447   10.3.0.254 → 10.3.0.99    DNS 201 Standard query response 0x14be SOA 0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   77 3.312286990    10.3.0.99 → 10.3.0.254   DNS 154 Standard query 0x7565 DS 0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   78 3.521747885   10.3.0.254 → 10.3.0.99    DNS 201 Standard query response 0x7565 DS 0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   79 3.522768676    10.3.0.99 → 10.3.0.254   DNS 152 Standard query 0xec78 SOA 0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   80 3.757137753   10.3.0.254 → 10.3.0.99    DNS 199 Standard query response 0xec78 SOA 0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   81 3.758201556    10.3.0.99 → 10.3.0.254   DNS 152 Standard query 0x9c35 DS 0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   82 4.108593431   10.3.0.254 → 10.3.0.99    DNS 199 Standard query response 0x9c35 DS 0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   83 4.109753557    10.3.0.99 → 10.3.0.254   DNS 150 Standard query 0xee3a SOA 0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   84 4.341191048   10.3.0.254 → 10.3.0.99    DNS 197 Standard query response 0xee3a SOA 0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   85 4.342253467    10.3.0.99 → 10.3.0.254   DNS 150 Standard query 0x6ea4 DS 0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   86 4.522618953   10.3.0.254 → 10.3.0.99    DNS 197 Standard query response 0x6ea4 DS 0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   87 4.523724327    10.3.0.99 → 10.3.0.254   DNS 148 Standard query 0x7da1 SOA 0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   88 4.678862526   10.3.0.254 → 10.3.0.99    DNS 195 Standard query response 0x7da1 SOA 0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   89 4.679976715    10.3.0.99 → 10.3.0.254   DNS 148 Standard query 0x8864 DS 0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   90 4.842744316   10.3.0.254 → 10.3.0.99    DNS 195 Standard query response 0x8864 DS 0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   91 4.843839756    10.3.0.99 → 10.3.0.254   DNS 146 Standard query 0x1b14 SOA 0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   92 5.290090011   10.3.0.254 → 10.3.0.99    DNS 193 Standard query response 0x1b14 SOA 0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   93 5.291176923    10.3.0.99 → 10.3.0.254   DNS 146 Standard query 0xd20b DS 0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   94 5.573479202   10.3.0.254 → 10.3.0.99    DNS 193 Standard query response 0xd20b DS 0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   95 5.574445031    10.3.0.99 → 10.3.0.254   DNS 144 Standard query 0x55df SOA 0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   96 5.755368762   10.3.0.254 → 10.3.0.99    DNS 191 Standard query response 0x55df SOA 0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   97 5.756813238    10.3.0.99 → 10.3.0.254   DNS 144 Standard query 0x7c27 DS 0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
   98 5.942337278   10.3.0.254 → 10.3.0.99    DNS 191 Standard query response 0x7c27 DS 0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
   99 5.943460912    10.3.0.99 → 10.3.0.254   DNS 142 Standard query 0xff92 SOA 0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  100 6.357165682   10.3.0.254 → 10.3.0.99    DNS 189 Standard query response 0xff92 SOA 0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  101 6.358139959    10.3.0.99 → 10.3.0.254   DNS 142 Standard query 0xd673 DS 0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  102 6.562738680   10.3.0.254 → 10.3.0.99    DNS 189 Standard query response 0xd673 DS 0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  103 6.563842267    10.3.0.99 → 10.3.0.254   DNS 140 Standard query 0xab9d SOA 0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  104 6.780670501   10.3.0.254 → 10.3.0.99    DNS 187 Standard query response 0xab9d SOA 0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  105 6.781813668    10.3.0.99 → 10.3.0.254   DNS 140 Standard query 0xc362 DS 0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  106 7.088355578   10.3.0.254 → 10.3.0.99    DNS 187 Standard query response 0xc362 DS 0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  107 7.089300270    10.3.0.99 → 10.3.0.254   DNS 138 Standard query 0x02a4 SOA 0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  108 7.238358413   10.3.0.254 → 10.3.0.99    DNS 175 Standard query response 0x02a4 SOA 0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  109 7.238847061    10.3.0.99 → 10.3.0.254   DNS 138 Standard query 0x52b7 DS 0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  110 7.443776464   10.3.0.254 → 10.3.0.99    DNS 175 Standard query response 0x52b7 DS 0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  111 7.444484354    10.3.0.99 → 10.3.0.254   DNS 136 Standard query 0x1d13 SOA 0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  112 7.751442870   10.3.0.254 → 10.3.0.99    DNS 173 Standard query response 0x1d13 SOA 0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  113 7.752487983    10.3.0.99 → 10.3.0.254   DNS 136 Standard query 0xf6c4 DS 0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  114 7.957031429   10.3.0.254 → 10.3.0.99    DNS 173 Standard query response 0xf6c4 DS 0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  115 7.958028622    10.3.0.99 → 10.3.0.254   DNS 134 Standard query 0xdcb5 SOA 9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  116 8.118922569   10.3.0.254 → 10.3.0.99    DNS 171 Standard query response 0xdcb5 SOA 9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  117 8.119917573    10.3.0.99 → 10.3.0.254   DNS 134 Standard query 0x7283 DS 9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  118 8.428266223   10.3.0.254 → 10.3.0.99    DNS 171 Standard query response 0x7283 DS 9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  119 8.429176889    10.3.0.99 → 10.3.0.254   DNS 132 Standard query 0x2350 SOA 0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  120 8.762627352   10.3.0.254 → 10.3.0.99    DNS 169 Standard query response 0x2350 SOA 0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  121 8.763653985    10.3.0.99 → 10.3.0.254   DNS 132 Standard query 0x1614 DS 0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  122 9.032564036   10.3.0.254 → 10.3.0.99    DNS 169 Standard query response 0x1614 DS 0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  123 9.033459875    10.3.0.99 → 10.3.0.254   DNS 130 Standard query 0x116a SOA 8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  124 9.364757902   10.3.0.254 → 10.3.0.99    DNS 167 Standard query response 0x116a SOA 8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  125 9.365714036    10.3.0.99 → 10.3.0.254   DNS 130 Standard query 0x87ed DS 8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  126 9.682428867   10.3.0.254 → 10.3.0.99    DNS 167 Standard query response 0x87ed DS 8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  127 9.683391707    10.3.0.99 → 10.3.0.254   DNS 128 Standard query 0x4410 SOA 0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  128 10.065008857   10.3.0.254 → 10.3.0.99    DNS 165 Standard query response 0x4410 SOA 0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  129 10.066024663    10.3.0.99 → 10.3.0.254   DNS 128 Standard query 0x10a6 DS 0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  130 10.406989313   10.3.0.254 → 10.3.0.99    DNS 165 Standard query response 0x10a6 DS 0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  131 10.407880657    10.3.0.99 → 10.3.0.254   DNS 126 Standard query 0x7a58 SOA 7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  132 10.674435199   10.3.0.254 → 10.3.0.99    DNS 163 Standard query response 0x7a58 SOA 7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  133 10.675241411    10.3.0.99 → 10.3.0.254   DNS 126 Standard query 0x86b4 DS 7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  134 11.039114993   10.3.0.254 → 10.3.0.99    DNS 163 Standard query response 0x86b4 DS 7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  135 11.039953999    10.3.0.99 → 10.3.0.254   DNS 124 Standard query 0xb8f9 SOA 0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  136 11.292067196   10.3.0.254 → 10.3.0.99    DNS 161 Standard query response 0xb8f9 SOA 0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  137 11.293072760    10.3.0.99 → 10.3.0.254   DNS 124 Standard query 0xa6a8 DS 0.0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  138 11.502783941   10.3.0.254 → 10.3.0.99    DNS 161 Standard query response 0xa6a8 DS 0.0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  139 11.503700921    10.3.0.99 → 10.3.0.254   DNS 122 Standard query 0x132e SOA 0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  140 11.503807029    10.3.0.99 → 10.3.0.254   TCP 66 54138 → 53 [FIN, ACK] Seq=131 Ack=2701 Win=31872 Len=0 TSval=2065484515 TSecr=863691906
  141 11.504863726   10.3.0.254 → 10.3.0.99    TCP 66 53 → 54138 [FIN, ACK] Seq=2701 Ack=132 Win=65152 Len=0 TSval=863702020 TSecr=2065484515
  142 11.504937337    10.3.0.99 → 10.3.0.254   TCP 66 54138 → 53 [ACK] Seq=132 Ack=2702 Win=31872 Len=0 TSval=2065484516 TSecr=863702020
  143 11.733760598   10.3.0.254 → 10.3.0.99    DNS 159 Standard query response 0x132e SOA 0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  144 11.734731300    10.3.0.99 → 10.3.0.254   DNS 122 Standard query 0xaee3 DS 0.4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  145 11.881650875   10.3.0.254 → 10.3.0.99    DNS 159 Standard query response 0xaee3 DS 0.4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT
  146 11.882549337    10.3.0.99 → 10.3.0.254   DNS 120 Standard query 0x66e9 SOA 4.0.b.8.f.7.0.6.2.ip6.arpa OPT
  147 12.206816081   10.3.0.254 → 10.3.0.99    DNS 157 Standard query response 0x66e9 SOA 4.0.b.8.f.7.0.6.2.ip6.arpa SOA ns1.google.com OPT

and delv output, which validates in 15 transactions:

delv @1.1.1.1 +rtrace -x 2607:f8b0:4007:809::200e
$ delv @1.1.1.1 +rtrace -x 2607:f8b0:4007:809::200e # complete in 2.2 seconds
;; fetch: e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa/PTR
;; fetch: arpa/DS
;; fetch: ./DNSKEY
;; fetch: ip6.arpa/DS
;; fetch: arpa/DNSKEY
;; fetch: 2.ip6.arpa/DS
;; fetch: ip6.arpa/DNSKEY
;; fetch: 6.2.ip6.arpa/DS
;; fetch: 0.6.2.ip6.arpa/DS
;; fetch: 7.0.6.2.ip6.arpa/DS
;; fetch: 0.6.2.ip6.arpa/DNSKEY
;; fetch: f.7.0.6.2.ip6.arpa/DS
;; fetch: 8.f.7.0.6.2.ip6.arpa/DS
;; fetch: b.8.f.7.0.6.2.ip6.arpa/DS
;; fetch: 0.b.8.f.7.0.6.2.ip6.arpa/DS
; unsigned answer
e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa. 78798	IN PTR lax02s21-in-x0e.1e100.net.
e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa. 78798	IN PTR lax17s51-in-x0e.1e100.net.

and, iiuc, the 11 transactions that are actually necessary to validate in this case:

manual dnssec
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth PTR e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa.
e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa. 80489	IN PTR lax02s21-in-x0e.1e100.net.
e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa. 80489	IN PTR lax17s51-in-x0e.1e100.net.
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DS e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.9.0.8.0.7.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa.    
4.0.b.8.f.7.0.6.2.ip6.arpa. 60	IN	SOA	ns1.google.com. dns-admin.google.com. 616378362 900 900 1800 60
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DS 4.0.b.8.f.7.0.6.2.ip6.arpa.                                              
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DS   0.b.8.f.7.0.6.2.ip6.arpa.   
0.6.2.ip6.arpa.		10800	IN	SOA	z.arin.net. dns-ops.arin.net. 2017037604 1800 900 691200 10800
0.6.2.ip6.arpa.		10800	IN	RRSIG	SOA 8 5 86400 20240330232958 20240316222958 30078 0.6.2.ip6.arpa. [omitted]
0.b.8.f.7.0.6.2.ip6.arpa. 10800	IN	NSEC	8.b.8.f.7.0.6.2.ip6.arpa. NS RRSIG NSEC
0.b.8.f.7.0.6.2.ip6.arpa. 10800	IN	RRSIG	NSEC 8 10 10800 20240330232958 20240316222958 30078 0.6.2.ip6.arpa. [omitted]
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DNSKEY 0.6.2.ip6.arpa.          
0.6.2.ip6.arpa.		9748	IN	DNSKEY	256 3 8 [key id = 11295]
0.6.2.ip6.arpa.		9748	IN	DNSKEY	256 3 8 [key id = 30078]
0.6.2.ip6.arpa.		9748	IN	DNSKEY	257 3 8 [key id = 26506]
0.6.2.ip6.arpa.		9748	IN	DNSKEY	257 3 8 [key id = 33046]
0.6.2.ip6.arpa.		9748	IN	RRSIG	DNSKEY 8 5 86400 20240330043405 20240316033405 30078 0.6.2.ip6.arpa. [omitted]
0.6.2.ip6.arpa.		9748	IN	RRSIG	DNSKEY 8 5 86400 20240330043405 20240316033405 33046 0.6.2.ip6.arpa. [omitted]
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DS 0.6.2.ip6.arpa.       
0.6.2.ip6.arpa.		86400	IN	DS	33046 8 2 [omitted]
0.6.2.ip6.arpa.		86400	IN	RRSIG	DS 8 5 86400 20240331113531 20240310071015 18271 ip6.arpa. [omitted]
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DNSKEY ip6.arpa.      
ip6.arpa.		447	IN	DNSKEY	256 3 8 [key id = 18271]
ip6.arpa.		447	IN	DNSKEY	257 3 8 [key id = 21619]
ip6.arpa.		447	IN	DNSKEY	257 3 8 [key id = 64060]
ip6.arpa.		447	IN	RRSIG	DNSKEY 8 2 3600 20240402033925 20240312071715 21619 ip6.arpa. [omitted]
ip6.arpa.		447	IN	RRSIG	DNSKEY 8 2 3600 20240402033925 20240312071715 64060 ip6.arpa. [omitted]
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DS ip6.arpa.       
ip6.arpa.		86400	IN	DS	13880 8 2 [omitted]
ip6.arpa.		86400	IN	DS	45094 8 2 [omitted]
ip6.arpa.		86400	IN	DS	64060 8 2 [omitted]
ip6.arpa.		86400	IN	RRSIG	DS 8 2 86400 20240329180000 20240316170000 586 arpa. [omitted]
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DNSKEY arpa.
arpa.			6474	IN	DNSKEY	256 3 8 [key id = 586]
arpa.			6474	IN	DNSKEY	257 3 8 [key id = 42581]
arpa.			6474	IN	RRSIG	DNSKEY 8 1 172800 20240401000000 20240311000000 42581 arpa. [omitted]
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DS arpa.    
arpa.			77177	IN	DS	42581 8 2 [omitted]
arpa.			77177	IN	RRSIG	DS 8 1 86400 20240329170000 20240316160000 30903 . [omitted]
$ dig @1.1.1.1 +noall +do +nocrypto +ans +auth DNSKEY .    
.			1871	IN	DNSKEY	256 3 8 [key id = 30903]
.			1871	IN	DNSKEY	257 3 8 [key id = 20326]
.			1871	IN	RRSIG	DNSKEY 8 0 172800 20240401000000 20240311000000 20326 . [omitted]

I might be missing something, but it seems like we could be 10x faster here by just requesting what we actually need, when we can deduce that we need it. In particular it seems like most of the delay is from superfluous DS/SOA questions issued for each dns label, when we really only need the DS in each zone. Also in some cases we wait to submit DS queries after we could have deduced that we need them.

Insecure delegation is by far the most common case, and it is our worst performing case. Only a tiny fraction of a fraction of internet domains are actually signed. Superfluous transactions are a particularly awful performance killer, since beyond an additional round-trip delay, the recursive resolver is less likely to have the answers available in its cache if it did not need them for validation.

Describe the solution you'd like

Speed up dnssec validation in sd-resolved, probably by avoiding superfluous transactions.

Describe alternatives you've considered

Not exactly an alternative, but perhaps we should also consider changing the default from dnssec=allow-downgrade to dnssec=no.

I understand that allow-downgrade is supposed to provide validation with the greatest amount of compatibility to make it acceptable as a default, but, conversely, I don't think there is much point in doing expensive validations without any corresponding practical security benefit, and in that light it doesn't really seem to be a suitable default behavior.

This would follow the decisions of downstream distributions Fedora and Arch, which are normally hesitant to differ from upstream, but nevertheless have previously disabled dnssec in sd-resolved by default.

The systemd version you checked that didn't have the feature you are asking for

255

Activity

  1. added
    RFE 🎁
    on Mar 17, 2024
  2. rpigott commented on Mar 17, 2024

    @rpigott
    ContributorAuthor

    The log that didn't fit: resolved.log

  3. pemensik commented on Mar 26, 2024

    @pemensik
    Contributor

    @rpigott Thank you for making dnssec validation usable.

    dnssec=allow-downgrade were needed for dnssec transactions on the host pass thru. needed for example by delv or unbound-host -D. Since PR #31621 in v256 it can pass those records through, so that is less needed. allow-downgrade would have still the advantage, that it can cache DNSSEC records. If validating clients are used more often, it may still make sense. Otherwise it needs to fetch all keys for every validating client. If delv example.org is called 3 times, it will fetch 3 times all DNSKEY and DS from parent domains too. With validation algorithm fixed, it should stop causing weird issues in default configuration.

    But dnssec=no were proposed by systemd maintainers on Fedora, that was not something the distribution itself wanted. At least on Fedora: https://fedoraproject.org/wiki/Changes/systemd-resolved#DNSSEC

    It was sort of unsupported anyway, before your arrival anyone had rarely even tried to analyse where the failure is. Even less to fix it.

  4. rpigott commented on Apr 3, 2024

    @rpigott
    ContributorAuthor

    @pemensik Thanks, that's clarifying.

    Tangentially related, but out of curiosity, are you aware of any implementations of EDNS0 CHAIN query (RFC7901) support? I'd like to reduce the round trips further, but it doesn't seem possible without this extension. AFAICT, nobody implements it :/.

    IMO it seems like DoQ+CHAIN is the dream. With no tcp and no auxiliary requests, it should be possible to complete every authenticated dns query in 1-RTT. That's what I want for sd-resolved. A client implementation of DoQ might be difficult, but the CHAIN client part doesn't seem too hard.

  5. pemensik commented on Apr 3, 2024

    @pemensik
    Contributor

    I admit I do not know any implementation. @letoams might know as author of that RFC. With decently populated cache those round trips are not significant, because TLDs are likely to stay in cache forever. I think smart enough cache management might help more than CHAIN support. Not flushing cache often would help as well. I think CHAIN support were intended primary for DANE TLS cert authentication, which is not used as well. As long as queries have immediate reaction and no timeouts, round trips do not create noticeable delays.

    I think better solution might provide parallel attempts to contact alternative server, when current one is not responding as fast as it was before. It can be client to router low-quality connection, where it would not help. If delays are caused between _gateway and target server, then faster switching to better responding server would provide noticeable improvement (in given cases only).

    From my point of view, actually caching even dnssec records, also in case when dnssec=no would help much more. @rpigott Please consider joining https://chat.dns-oarc.net for similar questions. DNS veterans reside there and are better informed than me in many details. I think your contribution would be appreciated there a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFE 🎁resolve

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions