mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-25 15:41:04 +02:00
Revert "remote_access.sh: remove dependence on ssh-agent"
This reverts commit 78476aba5f30d213eb5ec83f3a3f6f00ed83750b. BUG= TEST=Reverted on bot and re-ran test suite Review URL: http://codereview.chromium.org/6311002 Change-Id: Ib9405dac19b8b19d89e5d2346f5e1fd130a7280f
This commit is contained in:
parent
bb4661dee7
commit
5c9571a926
@ -15,24 +15,22 @@ DEFINE_integer ssh_port 22 \
|
|||||||
|
|
||||||
# Copies $1 to $2 on remote host
|
# Copies $1 to $2 on remote host
|
||||||
function remote_cp_to() {
|
function remote_cp_to() {
|
||||||
REMOTE_OUT=$(scp -P ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \
|
REMOTE_OUT=$(scp -P ${FLAGS_ssh_port} -o StrictHostKeyChecking=no -o \
|
||||||
-o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY $1 \
|
UserKnownHostsFile=$TMP_KNOWN_HOSTS $1 root@$FLAGS_remote:$2)
|
||||||
root@$FLAGS_remote:$2)
|
|
||||||
return ${PIPESTATUS[0]}
|
return ${PIPESTATUS[0]}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copies a list of remote files specified in file $1 to local location
|
# Copies a list of remote files specified in file $1 to local location
|
||||||
# $2. Directory paths in $1 are collapsed into $2.
|
# $2. Directory paths in $1 are collapsed into $2.
|
||||||
function remote_rsync_from() {
|
function remote_rsync_from() {
|
||||||
rsync -e "ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \
|
rsync -e "ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no -o \
|
||||||
-o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY" \
|
UserKnownHostsFile=$TMP_KNOWN_HOSTS" --no-R \
|
||||||
--no-R --files-from=$1 root@${FLAGS_remote}:/ $2
|
--files-from=$1 root@${FLAGS_remote}:/ $2
|
||||||
}
|
}
|
||||||
|
|
||||||
function remote_sh() {
|
function remote_sh() {
|
||||||
REMOTE_OUT=$(ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \
|
REMOTE_OUT=$(ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no -o \
|
||||||
-o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY \
|
UserKnownHostsFile=$TMP_KNOWN_HOSTS root@$FLAGS_remote "$@")
|
||||||
root@$FLAGS_remote "$@")
|
|
||||||
return ${PIPESTATUS[0]}
|
return ${PIPESTATUS[0]}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +40,15 @@ function remote_sh_allow_changed_host_key() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function set_up_remote_access() {
|
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
|
cp $FLAGS_private_key $TMP_PRIVATE_KEY
|
||||||
chmod 0400 $TMP_PRIVATE_KEY
|
chmod 0400 $TMP_PRIVATE_KEY
|
||||||
|
ssh-add $TMP_PRIVATE_KEY
|
||||||
|
|
||||||
# Verify the client is reachable before continuing
|
# Verify the client is reachable before continuing
|
||||||
echo "Initiating first contact with remote host"
|
echo "Initiating first contact with remote host"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user