|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | + |
| 4 | +echo "Removing any generated SSL keys and certs." |
| 5 | +rm /etc/ssh/ssh_host_dsa_key |
| 6 | +rm /etc/ssh/ssh_host_dsa_key.pub |
| 7 | +rm /etc/ssh/ssh_host_rsa_key |
| 8 | +rm /etc/ssh/ssh_host_rsa_key.pub |
| 9 | +rm /home/coder/coder-dist/coder-base/certs/server.* |
| 10 | +echo "" |
| 11 | + |
| 12 | +echo "Resetting Coder http configuration defaults." |
| 13 | +cp /home/coder/coder-dist/coder-base/config.js.default /home/coder/coder-dist/coder-base/config.js |
| 14 | +cp /home/coder/coder-dist/coder-base/device.json.reset /home/coder/coder-dist/coder-base/device.json |
| 15 | +rm -rf /home/coder/coder-dist/coder-base/tmp/* |
| 16 | +echo "" |
| 17 | + |
| 18 | +echo "Clearing out user history files." |
| 19 | +rm /root/.bash_history |
| 20 | +rm /root/.viminfo |
| 21 | +rm /home/pi/.bash_history |
| 22 | +rm /home/pi/.viminfo |
| 23 | +rm /home/coder/.bash_history |
| 24 | +rm /home/coder/.viminfo |
| 25 | +rm /home/coder/.gitconfig |
| 26 | +echo "" |
| 27 | + |
| 28 | +echo "Resetting hostname and hosts files in /boot/coder_settings." |
| 29 | +touch /boot/coder_settings/reset.txt |
| 30 | +cp ../../../raspbian-addons/boot/coder_settings/hosts.txt /boot/coder_settings/hosts.txt |
| 31 | +cp ../../../raspbian-addons/boot/coder_settings/hostname.txt /boot/coder_settings/hostname.txt |
| 32 | +echo "" |
| 33 | + |
| 34 | +echo "Resetting wifi and network defaults." |
| 35 | +cp ../../../raspbian-addons/etc/network/interfaces /etc/network/interfaces |
| 36 | +cp ../../../raspbian-addons/etc/network/interfaces.reset /etc/network/interfaces.reset |
| 37 | +chown root:root /etc/network/interfaces |
| 38 | +chown root:root /etc/network/interfaces.reset |
| 39 | +chmod 664 /etc/network/interfaces |
| 40 | +chmod 664 /etc/network/interfaces.reset |
| 41 | +cp ../../../raspbian-addons/etc/wpa_supplicant/wpa_supplicant.conf.reset /etc/wpa_supplicant/wpa_supplicant.conf |
| 42 | +chown root:wpaconfig /etc/wpa_supplicant/wpa_supplicant.conf |
| 43 | +chmod 660 /etc/wpa_supplicant/wpa_supplicant.conf |
| 44 | +echo "" |
| 45 | + |
| 46 | +echo "Clearing system log files." |
| 47 | +rm /var/log/messages |
| 48 | +rm /var/log/syslog |
| 49 | +rm /var/log/wtmp |
| 50 | +touch /var/log/wtmp |
| 51 | +chmod 644 /var/log/wtmp |
| 52 | +rm /var/log/dmesg* |
| 53 | +rm /var/log/debug |
| 54 | +touch /var/log/debug |
| 55 | +rm /var/log/btmp |
| 56 | +touch /var/log/btmp |
| 57 | +chmod 644 /var/log/btmp |
| 58 | +rm /var/log/auth.log |
| 59 | +touch /var/log/auth.log |
| 60 | +chown root:adm /var/log/auth.log |
| 61 | +chmod 640 /var/log/auth.log |
| 62 | +touch /var/log/user.log |
| 63 | +chown root:adm /var/log/user.log |
| 64 | +chmod 640 /var/log/user.log |
| 65 | +echo "" |
| 66 | + |
| 67 | +# Reset pi password to raspberry |
| 68 | +echo "Choose the default pi passwd (normally this should be raspberry)" |
| 69 | +passwd pi |
| 70 | + |
| 71 | +echo "" |
| 72 | +echo "Done!" |
| 73 | +echo "" |
| 74 | + |
0 commit comments