From 09308ee217ef1e439616e3f7e7a19357623fc58f Mon Sep 17 00:00:00 2001 From: rootzoll Date: Wed, 18 Mar 2020 14:07:27 -0700 Subject: [PATCH] #420 adding ssh reset feature --- home.admin/_bootstrap.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index b6e25ced4..27136e5cf 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -156,6 +156,28 @@ if [ ${forceHDMIoutput} -eq 1 ]; then exit 0 fi +################################ +# SSH SERVER CERTS RESET +# if a file called 'ssh.reset' gets +# placed onto the boot part of +# the sd card - switch to hdmi +################################ + +sshReset=$(sudo ls /boot/ssh.reset 2>/dev/null | grep -c reset) +if [ ${sshReset} -eq 1 ]; then + # delete that file (to prevent loop) + sudo rm /boot/ssh.reset + # show info ssh reset + sed -i "s/^state=.*/state=sshreset/g" ${infoFile} + sed -i "s/^message=.*/message='resetting SSH & reboot'/g" ${infoFile} + # delete ssh certs + sudo systemctl stop sshd + sudo rm /mnt/hdd/ssh/ssh_host* + sudo ssh-keygen -A + sudo /home/admin/XXshutdown.sh reboot + exit 0 +fi + ################################ # WAIT FOR LOCAL NETWORK ################################