-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.sh
More file actions
174 lines (152 loc) · 5.06 KB
/
menu.sh
File metadata and controls
174 lines (152 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
#<TBD> = To Be Done / To Be Developed
function nocase()
{
if [ "`echo $1 | tr [:lower:] [:upper:]`" = "`echo $2 | tr [:lower:] [:upper:]`" ]
then
return 0 # true
else
return 1 # false
fi
}
exit=FALSE
while [ "$exit" = "FALSE" ]
do
clear
echo -------------------------------
echo This is the script named \"menu\"
echo -------------------------------
echo -e '0: Mount USB drive to read settings <DONE>'
echo -e '1: Change default password for pi'
echo -e '2: Run raspi-config and setup hostname, overclocking, other settings <DONE>'
echo -e '3A: Create RSA 4096 bit SSH keys for RPi and copy them to USB for safe keeping (I suggest you save it in the default location (/home/pi/.ssh/id_rsa) by just hitting Enter) <DONE>'
echo -e '3B: Copy RSA keys from USB and set them working <DONE>'
echo -e '4: Create passwordless SSH connection'
echo -e '5: Create Wifi access point (requires 2 wifi adapters)'
echo -e '6: Create Ad-hoc wifi network'
echo -e '7: Change SSH port from 22 to something like 45678'
echo -e '8: Create Ad-hoc bluetooth network (for SSH connection)'
echo -e '9: Add option to SSH via USB'
echo -e '10: Add VPN settings, so RPi always connects to home LAN network if possible'
echo -e '11: Auto mount network NAS at startup'
echo -e '12: ===> Option to run read and run scripts from NAS?'
echo -e '13: Setup backups for RPi to NAS'
echo -e '14: Setup Alexa (might be complicated)'
echo -e '15: Install important applications (Python for GPIO, Nginx, Others)'
echo -e '16: Install additional security settings'
echo -e '999: Disable root login from SSH (CAREFUL IF YOU WANT TO INSTALL SOMETHING LATER - ONLY SCREEN+KEYBOARD WILL WORK)'
echo -e 'S: Show Network config '
echo -e 'I: IP Address '
echo -e 'C: Change Network config'
echo -e 'N: Change Network Name'
echo -e 'Q: Quit '
echo -n 'You choose > '
read opt
if nocase "$opt" "S"
then
./network.status
echo -n Hit [return]
read a
elif nocase "$opt" "I"
then
./ip
read a
elif nocase "$opt" "C"
then
sudo ./switch
elif nocase "$opt" "N"
then
sudo ./change.network.name
#0: Mount USB drive to read settings <DONE>
elif nocase "$opt" "0"
then
sudo fdisk -l #Lists all available disks
sudo mkdir /mnt/usb
sudo mount /dev/sda1 /mnt/usb
#1: Change default password for user "pi"
elif nocase "$opt" "1"
then
sudo ./setup-user-password.sh
#2: Run raspi-config and setup hostname, overclocking, other settings <DONE>
elif nocase "$opt" "2"
then
sudo raspi-config
#3A: Create RSA 4096 bit SSH keys for RPi and copy them to USB for safe keeping <DONE>
#Guide: https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md
elif nocase "$opt" "3A"
then
sudo ./setup-ssh-keys.sh
#3B: Copy RSA keys from USB and set them working <DONE>
#Tip: try using one generated by JuiceSSH
elif nocase "$opt" "3B"
then
sudo ./copy-ssh-keys.sh
#4: Create passwordless SSH connection, so only logins with SSH keys work <TBD>
#Guide: https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md
elif nocase "$opt" "4"
then
sudo ./setup-passwordless-ssh.sh
#5: Create Wifi access point (requires 2 wifi adapters)
elif nocase "$opt" "5"
then
sudo ./setup-wifi-ap.sh
#6: Create Ad-hoc wifi network <TBD>
elif nocase "$opt" "6"
then
sudo ./setup-adhoc.sh
#7: Change SSH port from 22 to something like 45678'
elif nocase "$opt" "7"
then
sudo ./setup-ssh-port.sh
#8: Create Ad-hoc bluetooth network (for SSH connection)
elif nocase "$opt" "8"
then
sudo ./setup-bluetooth-ssh.sh
#9: Add option to SSH via USB' <TBD>
elif nocase "$opt" "9"
then
sudo ./setup-usb-ssh.sh
#10: Add VPN settings, so RPi always connects to home LAN network if possible
elif nocase "$opt" "10"
then
sudo ./setup-vpn.sh
#11: Auto mount network NAS at startup
elif nocase "$opt" "11"
then
sudo ./setup-mount-nas.sh
#12: Run scripts from NAS?
elif nocase "$opt" "12"
then
sudo ./run-nas-script.sh
#13: Setup backups for RPi to NAS
elif nocase "$opt" "13"
then
sudo ./setup-backup-nas.sh
#14: Setup Alexa (might be complicated)
#Guide: https://github.com/alexa/alexa-avs-raspberry-pi
elif nocase "$opt" "14"
then
sudo ./setup-alexa.sh
#15: Install important applications (Python for GPIO, Nginx, Others)
elif nocase "$opt" "15"
then
sudo ./setup-applications.sh
#16: Install additional security settings
# Check reports:
# awk '($(NF-1) = /Ban/){print $NF}' /var/log/fail2ban.log | sort | uniq -c | sort -n
# zgrep -h "Ban " /var/log/fail2ban.log* | awk '{print $NF}' | sort | uniq -c
elif nocase "$opt" "18"
then
sudo sudo apt-get install fail2ban -y
#999: Disable root login from SSH (CAREFUL IF YOU WANT TO INSTALL SOMETHING LATER - ONLY SCREEN+KEYBOARD WILL WORK)
elif nocase "$opt" "999"
then
sudo nano /etc/ssh/sshd_config
#<find line and change it to "PermitRootLogin no"> <TBD>
elif nocase "$opt" "Q"
then
exit=TRUE
else
echo Goobye
fi
done