Re: gpg-agent support for GNUPGHOME and systemd

2020-08-20 Thread Werner Koch via Gnupg-users
Hi!

On Wed, 19 Aug 2020 23:19, Ben Fiedler said:

> % gpgconf --dry-run --create-socketdir
> gpgconf: socketdir is '/run/user/1000/gnupg/d.6oynbz4mc38pz8n5gyedka7a'
> gpgconf:  non-default homedir
>
> This is pretty unexpected to me, why is this the case? And is there a
> way to mitigate this behaviour?

It should be obvious that for a different homedirectory GnuPG also
requires a different socket.  Thus we hash the name of the homedir and
append it to the standard directory for sockets.

The ~/.gnupg file name is pretty important and there is no way to chnage
this to something different without breaking a lot of stuff.  You can
simply use a symlink, though.  That is how I handle this with .gnupg
being stored on a g13 encrypted partition.


Salam-Shalom,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


signature.asc
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Re: gpg-agent support for GNUPGHOME and systemd

2020-08-20 Thread Ben Fiedler

On Wed Aug 19, 2020 at 10:10 PM, Ben Fiedler wrote:

Relevant env vars:
DBUS_SESSION_BUS_ADDRESS correctly set
GNUPGHOME=${HOME}/.config/gnupg, set for both the systemd service and
GPG_TTY=$(tty) set and exported in .zshrc
SSH_AUTH_SOCK=${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh set and exported
in .zprofile


Aha! I think I've found the issue: When GNUPGHOME is set
the gpg command line tools use different sockets:

% unset GNUPGHOME
% gpgconf --dry-run --create-socketdir
gpgconf: socketdir is '/run/user/1000/gnupg'
% export GNUPGHOME=$HOME/.config/gnupg
% gpgconf --dry-run --create-socketdir
gpgconf: socketdir is '/run/user/1000/gnupg/d.6oynbz4mc38pz8n5gyedka7a'
gpgconf:non-default homedir

This is pretty unexpected to me, why is this the case? And is there a
way to mitigate this behaviour?

A bit of background: The original "problem" I'm trying to solve is
uncluttering my homedir from `.appname` folders and trying to get as
much as possible to conform to the XDG directory specification. The Arch
wiki [1] recommends setting GNUPGHOME, which is probably not intended to
be used that way when using socket-based activation with systemd. I've
seen that the gpg project doesn't intend to support automatically
creating it's config in XDG_CONFIG_HOME, but would there be a way to
set the socket dir instead of using the pseudo-random location? The
result would be a systemd-socket-activation-compliant way of using
GNUPGHOME to set the GnuPG directory with minimal changes needed.

If someone can give me a few pointers I'd be glad to take a look at
implementing it myself.

Best,
Ben

[1]: https://wiki.archlinux.org/index.php/XDG_Base_Directory#Partial

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users