diff --git a/static/authorized_keys b/static/authorized_keys index c824c61..b3b2226 100644 --- a/static/authorized_keys +++ b/static/authorized_keys @@ -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 diff --git a/static/setup.sh b/static/setup.sh index 725ae72..e5e4897 100644 --- a/static/setup.sh +++ b/static/setup.sh @@ -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