GNOME Bugzilla – Bug 577614
gvfs is not using the gnome-keyring agent for ssh connections
Last modified: 2019-02-22 11:46:48 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
I think using org.gnome.SessionManager.Setenv would be more natural, and has the same effect.
Hrm. Is this always reproducable or is this a race issue? It seems to work fine for me.
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 ?)
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.
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.
looking to /proc/$(pidof gvfsd)/environ there list the ssh-agent directory for the ssh agent
(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.
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
Patch for gvfsd-sftp attached to bug #578708
Changes to gvfs have been committed, although not in time for the recent release of gvfs (1.2.2).