From 8da975b098fcc95854d2734498477ed25a3233dd Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 24 Dec 2024 17:57:40 +0100 Subject: [PATCH] Fix install docs and deploy keys script --- docs/install.org | 2 +- secrets/ssh-keys/deploy_keys.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/install.org b/docs/install.org index 0ee4f15..13d7147 100644 --- a/docs/install.org +++ b/docs/install.org @@ -105,7 +105,7 @@ cp ~/.ssh/id_ /mnt/home/marc/.ssh/id_ * Initialization Steps after reboot ** Set up the user -You'll set the root password during the installation. You can then reboot and use the installed OS. First thing you'll have to do is log in as root and set the password for your user: +You'll set the root password during the installation. You can then reboot and use the installed OS. First thing you'll have to do is log in as root (via vultr dashboard) and set the password for your user: #+BEGIN_SRC bash passwd marc #+END_SRC diff --git a/secrets/ssh-keys/deploy_keys.sh b/secrets/ssh-keys/deploy_keys.sh index f9fa3e0..939acfa 100755 --- a/secrets/ssh-keys/deploy_keys.sh +++ b/secrets/ssh-keys/deploy_keys.sh @@ -11,7 +11,15 @@ fi read -p "Username: " USERNAME PRIVATE_KEY="id_$HOSTNAME" +ENCRYPTED_PRIVATE_KEY="$PRIVATE_KEY.gpg" PUBLIC_KEY="id_$HOSTNAME.pub" +DECRYPTED=f + +if [ ! -f $PRIVATE_KEY ]; then + DECRYPTED=t + echo "Decrypting private key ..." + gpg -d $ENCRYPTED_PRIVATE_KEY > $PRIVATE_KEY +fi echo "Deploying private key ($PRIVATE_KEY) to ($USERNAME@$HOSTIP) ..." scp $PRIVATE_KEY $USERNAME@$HOSTIP:.ssh/$PRIVATE_KEY @@ -19,4 +27,9 @@ scp $PRIVATE_KEY $USERNAME@$HOSTIP:.ssh/$PRIVATE_KEY echo "Deploying public key ($PUBLIC_KEY) to ($USERNAME@$HOSTIP) ..." scp $PUBLIC_KEY $USERNAME@$HOSTIP:.ssh/$PUBLIC_KEY +if [ "$DECRYPTED" = 't' ]; then + echo "Deleting decrypted private key ..." + rm $PRIVATE_KEY +fi + echo "Done"