Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: remote_access.sh

Issue 6288004: remote_access.sh: remove dependence on ssh-agent (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Remove bashism and add comment. Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remote_access.sh
diff --git a/remote_access.sh b/remote_access.sh
index 45531f15526aa4f08327e5732f08b3bb0e0b1155..222fdf7e943399431ffa048a86e0f01d951be3be 100644
--- a/remote_access.sh
+++ b/remote_access.sh
@@ -15,22 +15,24 @@ DEFINE_integer ssh_port 22 \
# Copies $1 to $2 on remote host
function remote_cp_to() {
- REMOTE_OUT=$(scp -P ${FLAGS_ssh_port} -o StrictHostKeyChecking=no -o \
- UserKnownHostsFile=$TMP_KNOWN_HOSTS $1 root@$FLAGS_remote:$2)
+ REMOTE_OUT=$(scp -P ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \
+ -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY $1 \
+ root@$FLAGS_remote:$2)
return ${PIPESTATUS[0]}
}
# Copies a list of remote files specified in file $1 to local location
# $2. Directory paths in $1 are collapsed into $2.
function remote_rsync_from() {
- rsync -e "ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no -o \
- UserKnownHostsFile=$TMP_KNOWN_HOSTS" --no-R \
- --files-from=$1 root@${FLAGS_remote}:/ $2
+ rsync -e "ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \
+ -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY" \
+ --no-R --files-from=$1 root@${FLAGS_remote}:/ $2
}
function remote_sh() {
- REMOTE_OUT=$(ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no -o \
- UserKnownHostsFile=$TMP_KNOWN_HOSTS root@$FLAGS_remote "$@")
+ REMOTE_OUT=$(ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \
+ -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY \
+ root@$FLAGS_remote "$@")
return ${PIPESTATUS[0]}
}
@@ -40,15 +42,8 @@ function remote_sh_allow_changed_host_key() {
}
function set_up_remote_access() {
- if [ -z "$SSH_AGENT_PID" ]; then
- eval $(ssh-agent)
- OWN_SSH_AGENT=1
- else
- OWN_SSH_AGENT=0
- fi
cp $FLAGS_private_key $TMP_PRIVATE_KEY
chmod 0400 $TMP_PRIVATE_KEY
- ssh-add $TMP_PRIVATE_KEY
# Verify the client is reachable before continuing
echo "Initiating first contact with remote host"
@@ -121,15 +116,10 @@ function remote_reboot() {
done
}
+# Called by clients before exiting.
+# Part of the remote_access.sh interface but now empty.
function cleanup_remote_access() {
- # Call this function from the exit trap of the main script.
- # Iff we started ssh-agent, be nice and clean it up.
- # Note, only works if called from the main script - no subshells.
- if [[ 1 -eq ${OWN_SSH_AGENT} ]]
- then
- kill ${SSH_AGENT_PID} 2>/dev/null
- unset SSH_AGENT_PID SSH_AUTH_SOCK
- fi
+ true
}
function remote_access_init() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698