Page MenuHome GnuPG

dirmngr issues malformed DNS queries
Closed, ResolvedPublic

Description

I've configured an otherwise empty GNUPGHOME with dirmngr.conf containing only no-use-tor (to be able to diagnose more easily -- this problem might exist with tor as well). /etc/resolv.conf contains nameserver 127.0.0.53 (this refers to a locally-running stub resolver, implemented by systemd-resolved)

In that environment, i did:

gpg --keyserver keys.riseup.net --search $KEYID

and i captured packets on the loopback to see what was being sent. here's what tshark shows:

 1 0.000000000    127.0.0.1 → 127.0.0.53   DNS 93 Standard query 0xcf2f SRV _pgpkey-http._tcp.keys.riseup.net
 2 0.000296446   127.0.0.53 → 127.0.0.1    DNS 93 Standard query response 0xcf2f No such name SRV _pgpkey-http._tcp.keys.riseup.net
 3 0.000666257    127.0.0.1 → 127.0.0.53   DNS 94 Standard query 0xc7bd Unused _pgpkey-http._tcp.keys.riseup.net
 4 0.000770855   127.0.0.53 → 127.0.0.1    DNS 54 Standard query response 0xc7bd Format error
 5 5.011447229    127.0.0.1 → 127.0.0.53   DNS 94 Standard query 0xc7bd Unused _pgpkey-http._tcp.keys.riseup.net
 6 5.011711829   127.0.0.53 → 127.0.0.1    DNS 54 Standard query response 0xc7bd Format error
 7 10.021579705    127.0.0.1 → 127.0.0.53   DNS 75 Standard query 0xe09f A keys.riseup.net
 8 10.022275031   127.0.0.53 → 127.0.0.1    DNS 91 Standard query response 0xe09f A keys.riseup.net A 216.66.15.2
 9 10.022776210    127.0.0.1 → 127.0.0.53   DNS 75 Standard query 0x4dbb AAAA keys.riseup.net
10 10.026563845   127.0.0.53 → 127.0.0.1    DNS 75 Standard query response 0x4dbb AAAA keys.riseup.net
11 10.026950565    127.0.0.1 → 127.0.0.53   DNS 76 Standard query 0x377f Unused keys.riseup.net
12 10.027121863   127.0.0.53 → 127.0.0.1    DNS 54 Standard query response 0x377f Format error
13 15.035047005    127.0.0.1 → 127.0.0.53   DNS 76 Standard query 0x377f Unused keys.riseup.net
14 15.035285597   127.0.0.53 → 127.0.0.1    DNS 54 Standard query response 0x377f Format error
15 20.100402262    127.0.0.1 → 127.0.0.53   DNS 75 Standard query 0xe063 A keys.riseup.net
16 20.100684943   127.0.0.53 → 127.0.0.1    DNS 91 Standard query response 0xe063 A keys.riseup.net A 216.66.15.2
17 20.100897027    127.0.0.1 → 127.0.0.53   DNS 75 Standard query 0xaa6b AAAA keys.riseup.net
18 20.122736194   127.0.0.53 → 127.0.0.1    DNS 75 Standard query response 0xaa6b AAAA keys.riseup.net
19 20.122959015    127.0.0.1 → 127.0.0.53   DNS 76 Standard query 0x9084 Unused keys.riseup.net
20 20.123046323   127.0.0.53 → 127.0.0.1    DNS 54 Standard query response 0x9084 Format error
21 25.130848494    127.0.0.1 → 127.0.0.53   DNS 76 Standard query 0x9084 Unused keys.riseup.net
22 25.131098687   127.0.0.53 → 127.0.0.1    DNS 54 Standard query response 0x9084 Format error

My biggest concern here is the "Format error" responses. on further inspection, it looks like the query itself is actually malformed. I think it's an extra zero-byte trailing the query name.

I'll upload the pcapng if i can figure out how to do that.

Details

Version
2.2.4

Revisions and Commits

Event Timeline

hm, i think this is the file:

werner triaged this task as High priority.

I think that I identified the issue. This is the libdns (dirmngr/dns.c) problem when hostname is not FQDN.
If you change it to FQDN, you can see that it tries to search adding the domain name.

gniibe added a subscriber: werner.

I'll fix for the non-FQDN case.

gniibe changed the task status from Open to Testing.Jun 18 2018, 10:28 AM

And 2.2 branch.