gpg2 can only connect to HKPS keyserver with sudo

Bug #1724688 reported by John Ankarström
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnupg2 (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have been trying to search for GPG keys on the Mailbox.org HKPS key server, using the following command:

gpg2 --debug-all --keyserver=hkps://pgp.mailbox.org --search <email address hidden>

This, however, fails with the following output:

------------------------------------------------------------
gpg: reading options from '/home/john/.gnupg/gpg.conf'
gpg: enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing cardio ipc clock lookup extprog
gpg: DBG: [not enabled in the source] start
gpg: DBG: chan_3 <- # Home: /home/john/.gnupg
gpg: DBG: chan_3 <- # Config: /home/john/.gnupg/dirmngr.conf
gpg: DBG: chan_3 <- OK Dirmngr 2.1.15 at your service
gpg: DBG: connection to the dirmngr established
gpg: DBG: chan_3 -> GETINFO version
gpg: DBG: chan_3 <- D 2.1.15
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KEYSERVER --clear hkps://pgp.mailbox.org
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KS_SEARCH -- <email address hidden>
gpg: DBG: chan_3 <- ERR 1 General error <Unspecified source>
gpg: error searching keyserver: General error
gpg: keyserver search failed: General error
gpg: DBG: chan_3 -> BYE
gpg: DBG: [not enabled in the source] stop
gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
gpg: secmem usage: 0/65536 bytes in 0 blocks
------------------------------------------------------------

This confused me, as I am perfectly able to connect and find the key by manually using dirmngr.

What is interesting is that gpg2 is able to connect and find the key when I prefix the command with sudo:

sudo gpg2 --debug-all --keyserver=hkps://pgp.mailbox.org --search <email address hidden>

This outputs the following:

------------------------------------------------------------
gpg: WARNING: unsafe ownership on homedir '/home/john/.gnupg'
gpg: reading options from '/home/john/.gnupg/gpg.conf'
gpg: enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing cardio ipc clock lookup extprog
gpg: DBG: [not enabled in the source] start
gpg: DBG: chan_3 <- # Home: /home/john/.gnupg
gpg: DBG: chan_3 <- # Config: /home/john/.gnupg/dirmngr.conf
gpg: DBG: chan_3 <- OK Dirmngr 2.1.15 at your service
gpg: DBG: connection to the dirmngr established
gpg: DBG: chan_3 -> GETINFO version
gpg: DBG: chan_3 <- D 2.1.15
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KEYSERVER --clear hkps://pgp.mailbox.org
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KS_SEARCH -- <email address hidden>
gpg: DBG: chan_3 <- S PROGRESS tick ? 0 0
gpg: DBG: chan_3 <- S SOURCE https://pgp.mailbox.org:443
gpg: DBG: chan_3 <- D info:1:1%0D%0Apub:854f20b818a24864:1:4096:1392491184:1518721584:%0D%0Auid:"mailbox.org Support-Team (mailbox.org Support-Team) <email address hidden>":1392491184:1518721584:%0D%0A
gpg: data source: https://pgp.mailbox.org:443
gpg: DBG: chan_3 <- OK
gpg: DBG: iobuf-1.0: close '?'
(1) "mailbox.org Support-Team (mailbox.org Support-Team) <support@mailbox.
   4096 bit RSA key 854F20B818A24864, created: 2014-02-15, expires: 2018-02-15
Keys 1-1 of 1 for "<email address hidden>". Enter number(s), N)ext, or Q)uit > Q
gpg: error searching keyserver: Operation cancelled
gpg: keyserver search failed: Operation cancelled
gpg: DBG: chan_3 -> BYE
gpg: DBG: [not enabled in the source] stop
gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
gpg: secmem usage: 0/65536 bytes in 0 blocks
------------------------------------------------------------

I am using version 17.04 of Ubuntu, and version 2.1.15-1ubuntu7 of gnupg2. Thanks for any help. This really does seem like a bug.

Edit: to clarify, when I manually used dirmngr, I did not use sudo.

Tags: dirmngr hkps keys
Revision history for this message
John Ankarström (john.aj) wrote :

I suppose I'll attach my ~/.gnupg/gpg.conf and ~/.gnupg/dirmngr.conf, just in case. First, here's my gpg.conf.

Revision history for this message
John Ankarström (john.aj) wrote :

And here's my dirmngr.conf.

description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.