Public key authentication for svn over ssh: Difference between revisions

From FAIWiki
Jump to navigation Jump to search
No edit summary
 
m (+ category)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Also demonstrated here is the ability to use the sshpass package to scp an identity file from another server (say, a keyserver). To do this, make sure the nfsroot has the sshpass package installed.
Also demonstrated here is the ability to use the sshpass package to scp an identity file from another server (say, a keyserver). To do this, make sure the nfsroot has the sshpass package installed.


<pre>
#! /bin/bash
#! /bin/bash


Line 24: Line 25:


exit $error
exit $error
</pre>
[[Category:Howto]]

Latest revision as of 10:35, 17 November 2009

Also demonstrated here is the ability to use the sshpass package to scp an identity file from another server (say, a keyserver). To do this, make sure the nfsroot has the sshpass package installed.

#! /bin/bash

# Author: Ryan Steele
#   Date: 2008-11-11

error=0 ; trap "error=$((error|1))" ERR

set -x

# Make sure the .subversion directory exists
mkdir $target/root/.subversion

# Add some ssh config options
echo -e "[tunnels]\nssh = \$SVN_SSH ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes" -i /root/.ssh/svn_rsa\n" > $target/root/.subversion/config

# Grab the identity from the keyserver
sshpass -p 'SECRET' scp -o StrictHostKeyChecking=no keyserver:/path/to/sshkeys/svn_rsa $target/root/.ssh/svn_rsa

# Run the checkout.  Pass the shell as an argument to ssh-agent so commands run in that shell can contact the agent for authentication.
# Per the man pages, "If a commandline is given, this is executed as a subprocess of the agent.  When the command dies, so does the agent."
$ROOTCMD bash -c 'ssh-agent bash -c "ssh-add /root/.ssh/svn_rsa; svn co --non-interactive svn+ssh://svnserver/repos;"'

exit $error