After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 577614 - gvfs is not using the gnome-keyring agent for ssh connections
gvfs is not using the gnome-keyring agent for ssh connections
Status: RESOLVED FIXED
Product: libgnome-keyring
Classification: Core
Component: General
2.26.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on: 578708
Blocks:
 
 
Reported: 2009-04-01 14:48 UTC by Sebastien Bacher
Modified: 2019-02-22 11:46 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26



Description Sebastien Bacher 2009-04-01 14:48:20 UTC
the bug has been opened on https://bugs.launchpad.net/bugs/345496

The gvfsd environment doesn't have the right ssh variable so it's not using the gnome-keyring agent, gnome-keyring should use UpdateActivationEnvironment to update the dbus session environment
Comment 1 Matthias Clasen 2009-04-03 05:42:19 UTC
I think using org.gnome.SessionManager.Setenv would be more natural, and has the same effect.
Comment 2 Vincent Untz 2009-04-03 12:19:26 UTC
Hrm. Is this always reproducable or is this a race issue? It seems to work fine for me.
Comment 3 Matthias Clasen 2009-04-03 13:27:36 UTC
I am slightly confused too, since there must be code somewhere already that does set the activation environment, either in the pam module or in the wrapper (but you killed that, right ?)
Comment 4 Matthias Clasen 2009-04-03 13:30:35 UTC
Indeed, register_environment_in_session seems to do the necessary things, so this must just be some ordering problem where something causes gvfsd to be started before gnome-keyring-daemon.
Comment 5 Ray Strode [halfline] 2009-04-03 13:37:32 UTC
So we should definitely reorder the house of cards to make sure that gvfsd is started after gnome-keyring, but this just highlights again how much using environment variables sucks for this sort of thing.

I wonder if it would make sense to fix gnome-keyring to export the ssh agent stuff over the session bus and fix gvfsd to check there.
Comment 6 Sebastien Bacher 2009-04-03 14:23:11 UTC
looking to /proc/$(pidof gvfsd)/environ there list the ssh-agent directory for the ssh agent
Comment 7 Stef Walter 2009-04-03 15:44:16 UTC
(In reply to comment #2)
> Hrm. Is this always reproducable or is this a race issue? It seems to work fine
> for me.

Vincent, it must be a race issue on certain distros, with certain things happening on startup. For me it was fine with Ubuntu Intrepid + gnome-keyring 2.26, but it failed on Ubuntu Jaunty. 

Sebastian, assuming you're looking at Ubuntu, that SSH_AUTH_SOCK is for the OpenSSH ssh-agent, which Ubuntu also starts.

Matthias, gnome-keyring-daemon has a two step initialization. It needs to interact with PAM in the primidoral stages of the user session, and then later once dbus is started it completes its initialization. The later stage is when the SSH agent is started, registers with the session, environment variables are sent to gnome-session etc... More details here:

http://live.gnome.org/GnomeKeyring/RunningDaemon

Ray, I could work on adding code to gvfsd-sftp. However this smells of fixing fixing a symptom rather than the problem. However, in lieu of a better solution, I guess this is our best bet. 
Comment 8 Stef Walter 2009-04-10 20:53:41 UTC
Committed this to gnome-2-26 branch of gnome-keyring. This adds a GetEnvironment dbus method which returns a dictionary of environment variables.

2009-04-10  Stef Walter  <stef@memberwebs.com>

	* daemon/gkr-daemon-dbus.c: Add DBus method for getting the 
	important environment variables that the gnome-keyring
	daemon wants to set. See bug #577614

Comment 9 Stef Walter 2009-04-11 16:05:19 UTC
Patch for gvfsd-sftp attached to bug #578708
Comment 10 Stef Walter 2009-04-13 19:23:07 UTC
Changes to gvfs have been committed, although not in time for the recent release of gvfs (1.2.2).