[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#203942: More flexible ssh-agent invocation



Package: xfree86-common
Version: 4.2.1-6


The way ssh-agent is started in 90xfree86-common_ssh-agent is not very
flexible. In particular it makes it impossible to start extra processes
like an xterm or two that would inherit the SSH_XXX environment
variables.

So what I propose is the following:

 * Replace 90xfree86-common_ssh-agent with the following
--- cut here ---
SSHAGENT=/usr/bin/ssh-agent
SSHAGENTARGS=

if grep -qs ^use-ssh-agent "$OPTIONFILE"; then
  if [ -x "$SSHAGENT" -a -z "$SSH_AUTH_SOCK" -a -z "$SSH2_AUTH_SOCK" ]; then
    if [ -f /usr/bin/ssh-add1 ] && cmp -s "$SSHAGENT" /usr/bin/ssh-agent2; then
      # use ssh-agent2's ssh-agent1 compatibility mode
      SSHAGENTARGS=-1
    fi
  fi
fi
eval `"$SSHAGENT" -s $SSHAGENTARGS` >/dev/null
--- cut here ---

   'ssh-agent -s' outputs a mini-script that sets the SSH_XXX variables.
Our eval runs this code which sets the environment variables in the
current shell.

 * Add a 99xfree86-common_start script to actually invoke REALSTARTUP
--- cut here ---
exec $REALSTARTUP
--- cut here ---

 * Then, between 90 and 99 administrators are free to add whatever
scripts they want to run in the ssh-agent environment.


Next I'll send an example taking advantage of this.


-- 
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
                            1 + e ^ ( i * pi ) = 0







Reply to: