Test updates

This commit is contained in:
idanoo 2022-10-11 22:50:28 +13:00
parent 76fd0177e7
commit 59e6055f78
Signed by: idanoo
GPG Key ID: 387387CDBC02F132
2 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,3 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBwm+4i0Ql1OYXfOpEUrFjC/XpiI5yxBBU3iH4QOKRpN
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCqGnqkZWJLfZmu9elk0qQPixaSaQ8XTw8qdIu/UTck5DfwFOIvteNXksmyH2kg7VqAv5uhLmIVldxooCMS6NPQzwLO13pDY2eOEmlZDz/c262bLBGOPXD73h9JcIityUpnyNsuDooe+DreiH9EmMTsENp3OCZ428dAEFMlxcBQdtd3ky3vOWV5ZCFbBRGbIPCWfC3JNweSH9ZXHf3Q9jhqUzHTltcBpFKGWb4aojTITarfkHrbM3iIi4R2GpSyp/qTMHEaywMlssqXHOJ31h8uFcHwi1tI+e+rgKxIskXgdshGNnjavNT6OfpCfuTZeUG11fi4zsaRi3gGVFYgtIYEdoL5SWLWByN9VnvydGWOcanJkQP9kAwhfSppF13Ae5p1PWJXLgz3bWVpQ27+991eGttRZTSPn//0++jJhwAgNxCGZojbIS3X7OhISKm5KJ/uIJOh7JEVVqhbaiUDZqcznpyMkf+2V5xpVzj+/TkoHPKVLHsvBWBZrw87Qx3TKKthyIkkDdWmtctycUWKywcTqq7lnqM6p/JpZ8PQGKJljVDz93UyfPQX4QBm0C88SM3EsiXZP31ImTqke453rVlgBu9GY9mcY0OxllJjEQPoGlI2sa7BS9o3J+c9Qt5SxHvrHNwubsbULtJW7J9VUit9pG8C8Gsh2UmUQYGf40N96Q==
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBwm+4i0Ql1OYXfOpEUrFjC/XpiI5yxBBU3iH4QOKRpN

View File

@ -10,21 +10,25 @@ if [[ "$1" == "uninstall" ]]; then
sed -i 's/^AuthorizedKeysCommand/#&/' /etc/ssh/sshd_config
sed -i 's/^AuthorizedKeysCommandUser/#&/' /etc/ssh/sshd_config
exit;
elif [[ "$1" == "update" ]]; then
wget -q -O /tmp/authorized_keys https://m2.nz/authorized_keys || curl -sSo /tmp/authorized_keys https://m2.nz/authorized_keys
exit;
fi
# Write script
sudo cat << EOF > /usr/local/bin/check_keys
#!/bin/bash
# Check if we have in tmp, if so use that then pull new ones, else just pull new ones
# Check if we have it cached, if so use that
if test -f "/tmp/authorized_keys"; then
cat /tmp/authorized_keys
(wget -O /tmp/authorized_keys https://m2.nz/authorized_keys || curl -o /tmp/authorized_keys https://m2.nz/authorized_keys) &
# update for next login
bash /usr/local/bin/check_keys update &
else
wget -O /tmp/authorized_keys https://m2.nz/authorized_keys || curl -o /tmp/authorized_keys https://m2.nz/authorized_keys
wget -q -O /tmp/authorized_keys https://m2.nz/authorized_keys || curl -sSo /tmp/authorized_keys https://m2.nz/authorized_keys
cat /tmp/authorized_keys
fi
EOF
# Make executable