Forward gpg-agent to container

Benjamin Kircher benjamin.kircher at gmail.com
Sun Jun 10 18:23:50 CEST 2018



> On 10. Jun 2018, at 18:05, Benjamin Kircher <benjamin.kircher at gmail.com> wrote:
> 
> 
> 
>> On 6. Jun 2018, at 02:27, Phil Pennock <gnupg-users at spodhuis.org> wrote:
>> 
>> On 2018-06-05 at 17:17 -0400, Phil Pennock wrote:
>>> Shell 2:
>>> $ docker run -it --rm -v /var/run/pdp.gnupg:/root/.gnupg/S.gpg-agent.ssh alpine
>>> / # chmod 0700 /root/.gnupg && chown root:root /root/.gnupg/S.gpg-agent
>>> / # apk update && apk add --no-cache gnupg
>> 
>> I apologise, I missed fixing one glitch in review before sending.
>> 
>> The correct command to invoke Docker here is:
>> 
>> docker run -it --rm -v /var/run/pdp.gnupg:/root/.gnupg/S.gpg-agent alpine
>> 
>> Don't use the `.ssh` name, that speaks an entirely different protocol
>> and was a mental glitch when I first wrote the above, fixed in testing
>> but not repaired in the email.
>> 
>> The command-line if you're running on Linux should thus be (untested):
>> 
>> docker run -it --rm -v $HOME/.gnupg/S.gpg-agent.extra:/root/.gnupg/S.gpg-agent alpine
>> 
>> Adjust as appropriate for other images.
> 
> This gives me
> 
>  gpg: can't connect to the agent: IPC connect call failed
> 
> from within the container.
> 
> Command lines that led to this output are:
> 
>  $ docker run --volume $(gpgconf --list-dirs agent-extra-socket):/root/.gnupg/S.gpg-agent --entrypoint=sh -ti --rm fedora:latest
> 
> And the inside the container:
> 
>  # chmod 700 ~/.gnupg
>  # gpg2 --keyserver pgp.uni-mainz.de --recv-keys <key-id>
>  # gpg2 --list-secret-keys

To amend last message, reported errors and logs are:

# gpg-connect-agent "keyinfo --list" /bye
gpg-connect-agent: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: waiting for the agent to come up ... (4s)
gpg-connect-agent: waiting for the agent to come up ... (3s)
gpg-connect-agent: waiting for the agent to come up ... (1s)
gpg-connect-agent: can't connect to the agent: IPC connect call failed
gpg-connect-agent: error sending standard options: No agent running
sh-4.4# cat /tmp/gpg-agent.log 
2018-06-10 16:21:15 gpg-agent[10] error binding socket to '/root/.gnupg/S.gpg-agent': Address already in use
2018-06-10 16:21:15 gpg-agent[10] random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
2018-06-10 16:21:15 gpg-agent[10] rndjent stat: collector=0x0000000000000000 calls=0 bytes=0
2018-06-10 16:21:15 gpg-agent[10] secmem usage: 0/65536 bytes in 0 blocks

BK




More information about the Gnupg-users mailing list