diff options
author | Ashlee Young <ashlee@onosfw.com> | 2015-09-09 22:15:21 -0700 |
---|---|---|
committer | Ashlee Young <ashlee@onosfw.com> | 2015-09-09 22:15:21 -0700 |
commit | 13d05bc8458758ee39cb829098241e89616717ee (patch) | |
tree | 22a4d1ce65f15952f07a3df5af4b462b4697cb3a /framework/src/onos/tools/test/bin/onos-secure-ssh | |
parent | 6139282e1e93c2322076de4b91b1c85d0bc4a8b3 (diff) |
ONOS checkin based on commit tag e796610b1f721d02f9b0e213cf6f7790c10ecd60
Change-Id: Ife8810491034fe7becdba75dda20de4267bd15cd
Diffstat (limited to 'framework/src/onos/tools/test/bin/onos-secure-ssh')
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-secure-ssh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/framework/src/onos/tools/test/bin/onos-secure-ssh b/framework/src/onos/tools/test/bin/onos-secure-ssh new file mode 100755 index 00000000..3c15fa3c --- /dev/null +++ b/framework/src/onos/tools/test/bin/onos-secure-ssh @@ -0,0 +1,31 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# Secures the ONOS console for all instances in the cell ONOS cluster. +# ----------------------------------------------------------------------------- + +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 +. $ONOS_ROOT/tools/build/envDefaults + +nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) + +for node in $nodes; do + # Setup passwordless login for the remote user on the local bench host + onos-user-key $node + + # Prune the node entry from the known hosts file since server key changes + ssh-keygen -f "$HOME/.ssh/known_hosts" -R [$node]:8101 + + # Setup passwordless login for the local user on the remote node + ssh $ONOS_USER@$node " + [ ! -f ~/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -f ~/.ssh/id_rsa -P '' -q + $ONOS_INSTALL_DIR/bin/onos-user-key \$(id -un) \$(cut -d\\ -f2 ~/.ssh/id_rsa.pub) + $ONOS_INSTALL_DIR/bin/onos-secure-ssh "$@" + + # Implicitly accept the new server key in dev/test environments + while ! ssh -p 8101 -o StrictHostKeyChecking=no localhost list 2>/dev/null; do + echo Waiting for connection... + sleep 1 + done + " +done + |