Skip to content

resolved: gpg --send-keys fails with stub-resolv.conf #23737

@Tachi107

Description

@Tachi107

systemd version the issue has been seen with

systemd 251 (251.2-5)
+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified

Used distribution

Debian Testing (12)

Linux kernel version used (uname -srvmo)

Linux 5.17.0-1-amd64 #1 SMP PREEMPT Debian 5.17.3-1 (2022-04-18) x86_64 GNU/Linux

CPU architecture issue was seen on

x86_64

Expected behaviour you didn't see

gpg --send-keys should be able to send keys when using systemd-resolved and /etc/resolv.conf points to the resolved stub

Unexpected behaviour you saw

$ ls -lh /etc/resolv.conf
lrwxrwxrwx 1 root root 37 14 giu 11.54 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
$ gpg --keyserver pgp.surf.nl --send-key 66DEF15282990C2199EFA801A8A128A8AB1CEE49
gpg: sending key A8A128A8AB1CEE49 to hkp://pgp.surf.nl
gpg: keyserver send failed: Server indicated a failure
gpg: keyserver send failed: Server indicated a failure

$ ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
$ gpg --verbose --verbose --keyserver pgp.surf.nl --send-key 66DEF15282990C2199EFA801A8A128A8AB1CEE49
gpg: sending key A8A128A8AB1CEE49 to hkp://pgp.surf.nl
$ echo $?
0

Steps to reproduce the problem

  1. Fully enable systemd-resolved, also with /etc/resolv.conf pointing to /run/systemd/resolve/stub-resolv.conf
  2. Run gpg --keyserver "$keyserver" --send-key "$my_key"

Additional program output to the terminal or log subsystem illustrating the issue

$ resolvectl status 
Global
         Protocols: +LLMNR +mDNS +DNSOverTLS DNSSEC=yes/supported
  resolv.conf mode: stub
Current DNS Server: 9.9.9.9#dns.quad9.net
       DNS Servers: 9.9.9.9#dns.quad9.net

Link 2 (enp7s0)
    Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 mDNS/IPv4 mDNS/IPv6
         Protocols: +DefaultRoute +LLMNR +mDNS +DNSOverTLS DNSSEC=yes/supported
Current DNS Server: 192.168.178.1
       DNS Servers: 192.168.178.1

$ journalctl --no-hostname --boot --follow
giu 14 11:32:51 dirmngr[3727]: command 'KS_PUT' failed: Server indicated a failure <Unspecified source>
Details
$ gpg --verbose --verbose --debug-all --keyserver pgp.surf.nl --send-key 66DEF15282990C2199EFA801A8A128A8AB1CEE49
gpg: reading options from '/home/tachi/.gnupg/gpg.conf'
gpg: reading options from '[cmdline]'
gpg: enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing ipc clock lookup extprog
gpg: DBG: [not enabled in the source] start
gpg: DBG: chan_3 <- # Home: /home/tachi/.gnupg
gpg: DBG: chan_3 <- # Config: /home/tachi/.gnupg/dirmngr.conf
gpg: DBG: chan_3 <- OK Dirmngr 2.2.35 at your service
gpg: DBG: connection to the dirmngr established
gpg: DBG: chan_3 -> GETINFO version
gpg: DBG: chan_3 <- D 2.2.35
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KEYSERVER --clear hkp://pgp.surf.nl
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KEYSERVER
gpg: DBG: chan_3 <- S KEYSERVER hkp://pgp.surf.nl
gpg: DBG: chan_3 <- OK
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: FPR20: '66DE F152 8299 0C21 99EF  A801 A8A1 28A8 AB1C EE49'
gpg: DBG: keydb_search: searching keybox (resource 0 of 1)
gpg: DBG: keydb_search: searched keybox (resource 0 of 1) => Success
gpg: DBG: [not enabled in the source] keydb_search leave (found)
gpg: DBG: [not enabled in the source] keydb_get_keybock enter
gpg: DBG: parse_packet(iob=2): type=6 length=51 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=12 length=12 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=13 length=57 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=12 length=12 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=2 length=144 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=12 length=6 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=2 length=563 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=12 length=6 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=14 length=56 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=2 length=120 (parse.../../g10/keydb.c.1257)
gpg: DBG: parse_packet(iob=2): type=12 length=6 (parse.../../g10/keydb.c.1257)
gpg: DBG: iobuf-2.0: underflow: buffer size: 1056; still buffered: 0 => space for 1056 bytes
gpg: DBG: iobuf-2.0: close '?'
gpg: DBG: [not enabled in the source] keydb_get_keyblock leave
gpg: DBG: build_packet() type=6
gpg: DBG: iobuf-3.0: close '?'
gpg: DBG: build_packet() type=13
gpg: DBG: build_packet() type=2
gpg: DBG: iobuf-4.0: close '?'
gpg: DBG: build_packet() type=2
gpg: DBG: iobuf-5.0: close '?'
gpg: DBG: build_packet() type=14
gpg: DBG: iobuf-6.0: close '?'
gpg: DBG: build_packet() type=2
gpg: DBG: iobuf-7.0: close '?'
gpg: DBG: iobuf-1.0: close '?'
gpg: sending key A8A128A8AB1CEE49 to hkp://pgp.surf.nl
gpg: DBG: chan_3 -> KS_PUT
gpg: DBG: chan_3 <- INQUIRE KEYBLOCK
gpg: DBG: chan_3 -> [ 44 20 98 33 04 5f ef 42 de 16 09 2b 06 01 04 01 ...(982 byte(s) skipped) ]
gpg: DBG: chan_3 -> [ 44 20 c8 0f 7a e9 7c ac 90 88 cc f5 6a 30 75 5d ...(16 byte(s) skipped) ]
gpg: DBG: chan_3 -> END
gpg: DBG: chan_3 <- INQUIRE KEYBLOCK_INFO
gpg: DBG: chan_3 -> D pub::255:22:A8A128A8AB1CEE49:1609515742::::::::::::::%0Afpr:::::::::66DEF15282990C2199EFA801A8A128A8AB1CEE49:<snip>
gpg: DBG: chan_3 -> END
gpg: DBG: chan_3 <- ERR 219 Server indicated a failure <Unspecified source>
gpg: DBG: free_packet() type=6
gpg: DBG: free_packet() type=13
gpg: DBG: free_packet() type=2
gpg: DBG: free_packet() type=2
gpg: DBG: free_packet() type=14
gpg: DBG: free_packet() type=2
gpg: keyserver send failed: Server indicated a failure
gpg: keyserver send failed: Server indicated a failure
gpg: DBG: chan_3 -> BYE
gpg: DBG: [not enabled in the source] stop
gpg: keydb: handles=1 locks=0 parse=1 get=1
gpg:        build=0 update=0 insert=0 delete=0
gpg:        reset=0 found=1 not=0 cache=0 not=0
gpg: kid_not_found_cache: count=0 peak=0 flushes=0
gpg: sig_cache: total=2 cached=2 good=2 bad=0
gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
gpg: rndjent stat: collector=0x0000000000000000 calls=0 bytes=0
gpg: secmem usage: 0/65536 bytes in 0 blocks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions