GNOME Bugzilla – Bug 586480
gnome-keyring should clear SSH_AGENT_PID
Last modified: 2012-03-15 09:18:14 UTC
If gnome-keyring is started after a ssh-agent was started, then the value in SSH_AGENT_PID will be stale. I guess we don't want "ssh-agent -k" to kill the keyring daemon, so gnome-keyring should probably just clear SSH_AGENT_PID.
Created attachment 137422 [details] [review] Clear SSH_AGENT_PID when setting SSH_AUTH_SOCK Here's a patch which does this.... However, it's not clear why SSH_AGENT_PID is no longer valid or should be touched in any way by gnome-keyring-daemon. The ssh-agent command sets this environment variable and anyone using it is expecting to be interacting with ssh-agent. The ssh-agent process is still running. Has this caused problems?
(In reply to comment #1) > Created an attachment (id=137422) [edit] > Clear SSH_AGENT_PID when setting SSH_AUTH_SOCK > > Here's a patch which does this.... > > However, it's not clear why SSH_AGENT_PID is no longer valid or should be > touched in any way by gnome-keyring-daemon. The ssh-agent command sets this > environment variable and anyone using it is expecting to be interacting with > ssh-agent. The ssh-agent process is still running. > > Has this caused problems? People are expecting SSH_AGENT_PID to match the process owning SSH_AUTH_SOCK. If you do "ssh-add -k" and an agent is killed but it's not the one you expect, it's kind of useless.
It's 'ssh-agent -k' that kills the agent, which is as expected. That is it's controlling an ssh-agent process with the ssh-agent command. It seems to me that any SSH_AGENT_* variables are set by and relevant to the 'ssh-agent' process, no?
(In reply to comment #3) > It's 'ssh-agent -k' that kills the agent, which is as expected. That is it's > controlling an ssh-agent process with the ssh-agent command. > > It seems to me that any SSH_AGENT_* variables are set by and relevant to the > 'ssh-agent' process, no? I guess it depends on the point of view -- it could easily be argued that the SSH_AGENT_* variables are relevant to any program being a ssh agent. cc'ing Lucas who was at the origin of my report: he might have a stronger rationale than I do.
Well, another nicer way to solve that problem would be for SSH_AGENT_PID to take the pid of gnome-keyring instead of keeping the one from the (killed) ssh-agent. That way it is clear that gnome-keyring is acting as the ssh agent.
The SSH_AGENT_XXX environment variables belong to the ssh-agent from openssh. In particular 'ssh-agent -k' uses SSH_AGENT_PID to determine which process to kill. I don't want 'ssh-agent -k' to kill gnome-keyring-daemon.