Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 258944

Summary: app-crypt/gnupg should have gpg-agent loader
Product: Gentoo Linux Reporter: Leonid Evdokimov <leon+gentoo>
Component: New packagesAssignee: Crypto team [DISABLED] <crypto+disabled>
Status: RESOLVED NEEDINFO    
Severity: enhancement CC: arne_bab, cbm, confabulate, jer, lack, laurento.frittella, matija, netbox253, xmw
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: gpg-agent startup script
gpg-agent startup script
/etc/X11/xinit/xinitrc.d/20-gpg-agent working with app-crypt/gnupg-2.0.11
Updated script to work with gdm

Description Leonid Evdokimov 2009-02-14 09:11:12 UTC
I assume, that gnupg should ship with some sort of gpg-agent loader, that may be disabled by default, but that should exist.

GPG User guide has separate section about auto-launching GPG agent on X-session start that will be never complete. Why? There are some non-trivial glitches about launching gpg-agent. For example, gpg-agent should be launched before dbus when XFCE is used as xfrun4 (xfce program launcher) starts programs using dbus API.

/etc/X11/xinit/xinitrc.d/20-gpg-agent looks like proper place for launching gpg-agent.

Bug #134984 may be relevant too.

[1] http://www.gentoo.org/doc/en/gnupg-user.xml#doc_chap4_sect3
Comment 1 Leonid Evdokimov 2009-02-14 09:11:59 UTC
Created attachment 181978 [details]
gpg-agent startup script
Comment 2 Leonid Evdokimov 2009-03-03 18:01:30 UTC
Created attachment 183784 [details]
gpg-agent startup script

Added check for existing $HOME/.gnupg directory.
Comment 3 Michael Weber (RETIRED) gentoo-dev 2009-07-30 03:39:43 UTC
*** Bug 279545 has been marked as a duplicate of this bug. ***
Comment 4 Michael Weber (RETIRED) gentoo-dev 2009-07-30 03:46:02 UTC
Hi,
i've experienced the same troubles with non-starting gpg-agent. 
But I see the .gpg-agent-info as $HOME/.gnupg/.gpg-agent-info (app-crypt/gnupg-2.0.11).

I'll commit an suggestion, referring to http://bugs.gentoo.org/attachment.cgi?id=199613 .

Comment 5 Michael Weber (RETIRED) gentoo-dev 2009-07-30 04:31:08 UTC
Created attachment 199615 [details]
/etc/X11/xinit/xinitrc.d/20-gpg-agent working with app-crypt/gnupg-2.0.11

works with gnome on amd64,  can somebody test this, please?
Comment 6 Fab 2009-10-01 21:16:28 UTC
> works with gnome on amd64,  can somebody test this, please?
> 

Works here on stable x86 with (unstable) gnome-light-2.26.3. Thanks.
Comment 7 Fab 2009-10-02 12:24:27 UTC
Created attachment 205831 [details]
Updated script to work with gdm

Finally I found two problems with the script from comment #5.

I'm using gdm. Since the gpg-agent is launched with the eval command, it is not linked to gnome-session, and is not killed when logout. The process is still running alone, which bring us to the second problem : when I re-login, the old gpg-agent is still running, but the eval command was not executed, so the GPG_AGENT_INFO variable was not exported to the environment, resulting in the current gpg-agent process unusable.

The attached script fix these two issues. In my case (gnome-light, gdm), since gdm provide a script to launch the ssh-agent, I think that this one should also be provided by gdm.
Comment 8 Lukasz Pawelczyk 2009-12-04 21:12:49 UTC
GDM shouldn't provide ssh-agent script IMO so this script should belong to gnupg package. Those scripts are full usable outside of GDM without it even installed.
Comment 9 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-12-04 21:26:32 UTC
kde-base/kdebase-startkde provides /etc/kde/startup/agent-startup.sh :) .
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-12-04 21:30:48 UTC
1. please do NOT pass extra options like "--default-cache-ttl 300 --max-cache-ttl 999999". If we install them in the core system, they override the options in ~/.gnupg/gpg-agent.conf
2. The latest attachment doesn't seem to actually execute the agent here. Please test more on awesomeWM and fluxbox.
Comment 11 MickKi 2010-03-16 12:33:00 UTC
(In reply to comment #10)

> 2. The latest attachment doesn't seem to actually execute the agent here.
> Please test more on awesomeWM and fluxbox.

I noticed that fluxbox will only execute gpg-agent with this script if the Xsession is launched with startx from a console:
===================================================
 7201 tty2     Ss     0:00 /bin/login --        
 9140 tty2     S      0:00  \_ -bash
 9322 tty2     S+     0:00      \_ /bin/sh /usr/bin/startx
 9338 tty2     S+     0:00          \_ xinit /etc/X11/xinit/xinitrc -- /etc/X11/xinit/xserverrc :0 -auth /home/michael/.serverauth.9322
 9339 tty7     Ss+    0:04              \_ /usr/bin/X -nolisten tcp
 9345 tty2     S      0:00              \_ /usr/bin/ck-launch-session /usr/bin/gpg-agent --sh --write-env-file /home/michael/.gnupg/.gpg-agent-info --daemon -- /etc/X11/Sessions/fluxbox
 9423 tty2     S      0:00                  \_ /usr/bin/fluxbox
 9424 ?        Ss     0:00                      \_ /usr/bin/gpg-agent --sh --write-env-file /home/michael/.gnupg/.gpg-agent-info --daemon -- /etc/X11/Sessions/fluxbox
===================================================

(This looks odd, is gpg-agent being executed twice?)

When I launch fluxbox from a login manager (xdm) then it seems that xinit is not used and therefore the gpg-agent is not executed.  I'll check on a second machine tonight to see what that gives.
-- 
Regards,
Mick
Comment 12 Jim Ramsay (lack) (RETIRED) gentoo-dev 2010-09-15 18:29:27 UTC
> When I launch fluxbox from a login manager (xdm) then it seems that xinit is
> not used and therefore the gpg-agent is not executed.  I'll check on a second
> machine tonight to see what that gives.

I would consider that in particular to be a fluxbox bug.  Its Xsession script needs to be updated to jive more cleanly with the new xinit.d scripts.

As a workaround, just set your XSESSION environment to be '/usr/src/startfluxbox' and all the xinit.d scripts should fire as expected.
Comment 13 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-10-19 00:58:10 UTC
I haven't seen any posts from the OP in more than a year. It's still broken on AwesomeWM (w/ xdm).

Please reopen w/ a fixed script. Also anybody that uses an alternative agent will want to NOT use this.