From bf26066aaf6d589c6f9fc1daedce12a841d3a373 Mon Sep 17 00:00:00 2001 From: Ariejan de Vroom Date: Fri, 7 Jun 2024 12:31:29 +0200 Subject: [PATCH] Add ssh setup script --- group_vars/all.yml | 1 + scripts/setup_ssh_key.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100755 scripts/setup_ssh_key.sh diff --git a/group_vars/all.yml b/group_vars/all.yml index 0916655..39d4dcd 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -26,6 +26,7 @@ packages: - git - gnupg - htop + - inetutils - iotop - linux-firmware - lm_sensors diff --git a/scripts/setup_ssh_key.sh b/scripts/setup_ssh_key.sh new file mode 100755 index 0000000..9d3edf5 --- /dev/null +++ b/scripts/setup_ssh_key.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env -S bash -i + +if [ -f "${HOME}/.ssh/id_ed25519" ]; then + echo "SSH private key already exists. Exiting." + exit 1 +fi + +HOSTNAME=`hostname` + +ssh-keygen -t ed25519 -C "$USER@$HOSTNAME" + +ssh-keyscan -H git.devroom.io >> "${HOME}/.ssh/known_hosts" +ssh-keyscan -H github.com >> "${HOME}/.ssh/known_hosts" + +echo "--- Your public key, sir:" +cat "${HOME}/.ssh/id_ed25519.pub" \ No newline at end of file