From a6417d76537858c2b4f84c0a786d098cbd1f3370 Mon Sep 17 00:00:00 2001 From: Raul Negron Date: Thu, 16 Feb 2023 18:04:00 -0400 Subject: [PATCH] added more SSH key types --- public_key/run.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 public_key/run.sh diff --git a/public_key/run.sh b/public_key/run.sh old mode 100644 new mode 100755 index 8db0d67..5db73f4 --- a/public_key/run.sh +++ b/public_key/run.sh @@ -6,9 +6,13 @@ function do_install { set -e cachengo-cli updateInstallStatus $APPID "Installing" # Remove user@host to add our own identifier - key="$( cut -d ' ' -f 2 <<< "$PUBLIC_KEY" )" + key="$( cut -d ' ' -f 1,2 <<< "$PUBLIC_KEY" )" + if [ $(wc -w <<< "$key") -lt 2 ]; then + echo "Missing SSH Key Type" + exit 1 + fi sed -i -e '$a\' /home/$TARGET_USER/.ssh/authorized_keys - echo "ssh-rsa $key $APPID" >> /home/$TARGET_USER/.ssh/authorized_keys + echo "$key $APPID" >> /home/$TARGET_USER/.ssh/authorized_keys cachengo-cli updateInstallStatus $APPID "Installed" }