Home GnuPG
Diffusion GnuPG 36ba7845995d

agent: Add envvar "gnupg_SSH_AUTH_SOCK_by"
36ba7845995dUnpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

agent: Add envvar "gnupg_SSH_AUTH_SOCK_by"

* agent/gpg-agent.c (main): Pass new envar gnupg_SSH_AUTH_SOCK_by to
an invoked process.

This environment variable is useful for debugging if
--use-standard-socket is used (which is the default since 2.1).
Commonly you should have this in your init script (e.g. ~/.bashrc):

unset GPG_AGENT_INFO
unset SSH_AGENT_PID
SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
export SSH_AUTH_SOCK

The problem is that gpg-agent won't be able to override the
SSH_AUTH_SOCK envvar if gpg-agent has been invoked as

gpg-agent --enable-ssh-support --daemon /bin/bash

To fix this you should instead use this code in the init script:

unset GPG_AGENT_INFO
unset SSH_AGENT_PID
if [ ${gnupg_SSH_AUTH_SOCK_by:-0} -ne $$ ]; then
  export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
fi

This will work in all cases and thus allows to start gpg-agent for
testing purposes with a different homedir and use this gpg-agent as an
ssh-agent. Example:

GNUPGHOME=$(pwd) gpg-agent --enable-ssh-support --daemon /bin/bash

gnupg_SSH_AUTH_SOCK_by is set to the PID of the exec-ed process and
thus will work safely if called recursively.

Details

Provenance
wernerAuthored on Dec 10 2012, 2:45 PM
Parents
rGceab60b59d90: config: Update npth.m4.
Branches
Unknown
Tags
Unknown

Event Timeline

Werner Koch <wk@gnupg.org> committed rG36ba7845995d: agent: Add envvar "gnupg_SSH_AUTH_SOCK_by" (authored by Werner Koch <wk@gnupg.org>).Dec 10 2012, 2:45 PM