#420 adding ssh reset feature

This commit is contained in:
rootzoll
2020-03-18 14:07:27 -07:00
parent 22435519bf
commit 09308ee217

View File

@@ -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
################################