summaryrefslogtreecommitdiff
path: root/scripts/install
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2012-02-29 22:55:09 +0000
committerJohn Southworth <john.southworth@vyatta.com>2012-02-29 22:55:09 +0000
commit82b0bced0463c33ef48d8268072940a36ce04d68 (patch)
treee666f1f1de3fce51427e589400d410010f031365 /scripts/install
parent34e44dde1973bdbd45cd737a9b785edd26265477 (diff)
downloadvyatta-cfg-system-82b0bced0463c33ef48d8268072940a36ce04d68.tar.gz
vyatta-cfg-system-82b0bced0463c33ef48d8268072940a36ce04d68.zip
Bugfix 7555: allow users to import ssh keys when running add system image
Diffstat (limited to 'scripts/install')
-rwxr-xr-xscripts/install/install-image23
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/install/install-image b/scripts/install/install-image
index 95acd733..57730611 100755
--- a/scripts/install/install-image
+++ b/scripts/install/install-image
@@ -68,7 +68,28 @@ fetch_iso_by_url ()
filename="${TEMP_DIR}/${NEW_ISO##*/}"
curl "$client_hdr" "$vers_hdr" $auth -f -o $filename $NEW_ISO
- if [ $? -ne 0 ]; then
+ curlerror=$?
+ if [ $curlerror -eq 51 ]; then
+ host=${NEW_ISO##scp://}
+ host=${host%%/*}
+ rsa_key=$(ssh-keyscan -t rsa $host 2>/dev/null)
+ if [[ $VYATTA_PROCESS_CLIENT == "gui2_rest" ]]; then
+ response="yes"
+ else
+ echo "The authenticity of host '$host' can't be established."
+ echo "RSA key fingerprint is $(ssh-keygen -lf /dev/stdin <<<$rsa_key \
+ | awk {' print $2 '} ) ."
+ echo "Are you sure you want to continue connecting (yes/no) [yes]?"
+ response=$(get_response "Yes" "Yes No Y N")
+ fi
+ if [[ "$response" == "yes" || "$response" == "y" ]]; then
+ mkdir -p ~/.ssh/
+ echo $rsa_key >> ~/.ssh/known_hosts
+ curl $auth -f -o $filename $NEW_ISO
+ curlerror=$?
+ fi
+ fi
+ if [ $curlerror -ne 0 ]; then
echo "Unable to fetch ISO from $NEW_ISO"
rm -f $filename
exit 1