Allowing xfce4-session to use external ssh-agent

Olivier Duchateau duchateau.olivier at gmail.com
Sun Nov 19 20:12:05 CET 2017


On Sun, 19 Nov 2017 19:23:04 +0100
Silvio Knizek <killermoehre at gmx.net> wrote:

> Am Sonntag, den 19.11.2017, 02:51 +0200 schrieb Ivan Kabaivanov:
> > Hi,
> > 
> > 
> > 
> > I've been using xfce for almost two years after having used kde for
> > 19.  I love xfce and I would like to thank each and every developer
> > who has worked and is working on it.
> > 
> > 
> > 
> > I would like to request a feature and I am submitting a patch for
> > your consideration.
> > 
> > 
> > 
> > I very often work on my machines remotely and start ssh-agent via a
> > set of commands in .bashrc,  so I always have a running ssh-agent,
> > even before starting xfce.  I would like to xfce to use the already
> > running ssh-agent.
> > 
> > 
> > 
> > Here's a very crude patch that I've tested and have confirmed as
> > working.  I'm sure I am forgetting some cases.  But I would like your
> > critique and input on the feasibility of this patch making it into
> > xfce.
> > 
> > 
> > 
> > 
> > --- xfce4-session-4.13.0.original/xfce4-session/xfsm-startup.c  2014-
> > 09-28 17:51:01.000000000 +0300
> > +++ xfce4-session-4.13.0/xfce4-session/xfsm-startup.c   2017-11-19
> > 02:15:05.108424383 +0200
> > @@ -199,6 +199,7 @@
> >  {
> >    gchar       *ssh_agent;
> >    gchar       *ssh_agent_path = NULL;
> > +  gchar       *ssh_agent_socket = NULL;
> >    gchar       *gpg_agent_path = NULL;
> >    gchar       *cmd;
> >    pid_t        agentpid;
> > @@ -256,6 +257,14 @@
> >          }
> >        g_free (ssh_agent);
> >      }
> > +  else
> > +    {
> > +      if (xfconf_channel_get_bool (channel, "/startup/ssh-
> > agent/external", TRUE))
> > +        {
> > +          ssh_agent_socket = xfconf_channel_get_string (channel,
> > "/startup/ssh-agent/external_socket", NULL);
> > +          g_setenv ("SSH_AUTH_SOCK", ssh_agent_socket, TRUE);
> > +        }
> > +    }
> > 
> >    if (G_LIKELY (ssh_agent_path != NULL || gpgagent_ssh_enabled))
> >      {
> > 
> > 
> > 
> > In order to use an external ssh-agent, you need to set two new
> > properties:
> > 
> > 
> > 
> > xfconf-query -c xfce4-session -p /startup/ssh-agent/external -n -t
> > string -s true
> > 
> > xfconf-query -c xfce4-session -p /startup/ssh-agent/external_socket
> > -n -t string -s PATH_TO_SSH_SOCKET
> > 
> > 
> >  I start ssh-agent like so:
> >  ssh-agent -a PATH_TO_SSH_SOCKET so the socket location never
> > changes.
> >   I would appreciate your feedback.
> >  Thanks,
> > IvanK.
> > _______________________________________________
> > Xfce4-dev mailing list
> > Xfce4-dev at xfce.org
> > https://mail.xfce.org/mailman/listinfo/xfce4-dev
> 
> Hi,
> 
> I think the easiest solution would be to "hardcode" the SSH_AUTH_SOCK
> variable as deterministic string (a.k.a. wihtout random tmp-path and
> without PID) into ~/.pam_environment (read by pam_env.so), which set
> this variable for every application in your PAM session. Than you would
> start ssh-agent as »ssh-agent -a "$SSH_AUTH_SOCK"«. You would tell Xfce
> to just not start the ssh-agent.

PAM is not a good solution for some systems.

> 
> HTH
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> https://mail.xfce.org/mailman/listinfo/xfce4-dev

-- 
olivier


More information about the Xfce4-dev mailing list