SSH_AUTH_SOCK is overwritten by gnome-keyring

Bug #1748167 reported by asdasdas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-keyring (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hello, I'm using ubuntu v14 with unity. The problem I'm having is with SSH_AUTH_SOCK. I want to create an X-session and have my unix socket set in SSH_AUTH_SOCK. The session is created successfully but if I open terminal into that session and see the content of SSH_AUTH_SOCK, its different from what I've set.

I investigated this issue and found that gnome-keyring checks if SSH_AUTH_SOCK is empty in /usr/share/upstart/sessions/gnome-keyring-ssh.conf and if it is, then it creates the socket and sets SSH_AUTH_SOCK. I've even added logs in this file and it clearly exits in [ -z "$SSH_AUTH_SOCK" ] || { stop; exit 0; }. So it should not be the cause. Then I set the X-GNOME-Autostart-enabled=false in ~/.config/autostart/gnome-keyring-ssh.desktop and for some reason the value in SSH_AUTH_SOCK was correct(the one that I've set in init). So it fixed the problem of overwriting SSH_AUTH_SOCK.

I deleted X-GNOME-Autostart-enabled=false and then manually checked and some of the proccesses in this session had my value in SSH_AUTH_SOCK and some of them didn't. I checked with lsof and the other SSH_AUTH_SOCK was listen by gnome-keyring, so I assumed that when gnome-keyring is launched, it creates its own SSH_AUTH_SOCK and overwrites the env variable.

I downloaded the source code of gnome-keyring and found that it creates a SSH_AUTH_SOCK and sets it in it's environment(but for some reason when I check /proc/<pid_of_gnome-keyring>/environ there is my path in SSH_AUTH_SOCK). I also checked if X-GNOME-Autostart-enabled was hardcoded in gnome-keyring but it wasn't.

I've searched in internet and found that gnome-session might be involved in this. Downloaded the source code of gnome-sesison and it clearly parses X-GNOME-Autostart-enabled parameter from some config file and uses it in some way. Then I found this interesting comment in it:

capture output from gnome-keyring-daemon and set SSH_AUTH_SOCK and
 GNOME_KEYRING_PID env variables properly.

and as I understand(please correct me if I'm wrong) those two procceses (gnome-keyring and gnome-session) communicate with each other. gnome-session process checks if X-GNOME-Autostart-enabled is set and if it isn't it asks gnome-keyring to create new SSH_AUTH_SOCK.

So it appears that gnome-keyring doesn't care what is in /usr/share/upstart/sessions/gnome-keyring-ssh.conf. Plus it doesn't care if SSH_AUTH_SOCK is set or not. The only option to disable gnome-keyring from creating one, is to set the X-GNOME-Autostart-enabled.

What I basically want is to have my path set in SSH_AUTH_SOCK without setting X-GNOME-Autostart-enabled, which should be possible since before setting it, it is checked whether SSH_AUTH_SOCK is set or not.

P.S. On ubuntu v16 when I create session and open terminal in it, there is my path set in SSH_ATUH_SOCK.

My info -> https://pastebin.com/j1TNzZU9

asdasdas (giorgal2)
description: updated
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.