|
@@ -129,44 +129,10 @@ fi
|
129
|
129
|
|
130
|
130
|
function any_key {
|
131
|
131
|
echo ''
|
|
132
|
+ # shellcheck disable=SC2034
|
132
|
133
|
read -n1 -rsp $"Press any key to continue..." key
|
133
|
134
|
}
|
134
|
135
|
|
135
|
|
-function any_key_verify {
|
136
|
|
- echo ''
|
137
|
|
- read -n1 -rsp $"Press any key to continue or C to check a hash..." key
|
138
|
|
- if [[ "$key" != 'c' && "$key" != 'C' ]]; then
|
139
|
|
- return
|
140
|
|
- fi
|
141
|
|
-
|
142
|
|
- data=$(mktemp 2>/dev/null)
|
143
|
|
- dialog --title $"Check tripwire hash" \
|
144
|
|
- --backtitle $"Freedombone Control Panel" \
|
145
|
|
- --inputbox $"Paste your tripwire hash below and it will be checked against the current database" 12 60 2>"$data"
|
146
|
|
- sel=$?
|
147
|
|
- case $sel in
|
148
|
|
- 0)
|
149
|
|
- GIVEN_HASH=$(<"$data")
|
150
|
|
- if [ ${#GIVEN_HASH} -gt 8 ]; then
|
151
|
|
- if [[ "$GIVEN_HASH" == *' '* ]]; then
|
152
|
|
- dialog --title $"Check tripwire" \
|
153
|
|
- --msgbox $"\\nThe hash should not contain any spaces" 10 40
|
154
|
|
- else
|
155
|
|
- DBHASH=$(sha512sum "/var/lib/tripwire/${HOSTNAME}.twd" | awk -F ' ' '{print $1}')
|
156
|
|
- if [[ "$DBHASH" == "$GIVEN_HASH" ]]; then
|
157
|
|
- dialog --title $"Check tripwire" \
|
158
|
|
- --msgbox $"\\nSuccess\\n\\nThe hash you gave matches the current tripwire database" 10 40
|
159
|
|
- else
|
160
|
|
- dialog --title $"Check tripwire" \
|
161
|
|
- --msgbox $"\\nFailed\\n\\nThe hash you gave does not match the current tripwire database. This might be because you reset the tripwire, or there could have been an unauthorised modification of the system" 12 50
|
162
|
|
- fi
|
163
|
|
- fi
|
164
|
|
- fi
|
165
|
|
- ;;
|
166
|
|
- esac
|
167
|
|
- rm -f "$data"
|
168
|
|
-}
|
169
|
|
-
|
170
|
136
|
function reset_password_tries {
|
171
|
137
|
passwords_select_user
|
172
|
138
|
if [ ! "$SELECTED_USERNAME" ]; then
|
|
@@ -1182,81 +1148,6 @@ function security_settings {
|
1182
|
1148
|
"${PROJECT_NAME}-sec"
|
1183
|
1149
|
}
|
1184
|
1150
|
|
1185
|
|
-function show_tripwire_verification_code {
|
1186
|
|
- if [ ! -f "/var/lib/tripwire/${HOSTNAME}.twd" ]; then
|
1187
|
|
- return
|
1188
|
|
- fi
|
1189
|
|
- clear
|
1190
|
|
- echo ''
|
1191
|
|
- echo $'Tripwire Verification Code'
|
1192
|
|
- echo ''
|
1193
|
|
- DBHASH=$(sha512sum "/var/lib/tripwire/${HOSTNAME}.twd")
|
1194
|
|
- echo -n "$DBHASH" | qrencode -t UTF8
|
1195
|
|
- echo ''
|
1196
|
|
- echo "$DBHASH"
|
1197
|
|
- echo ''
|
1198
|
|
-}
|
1199
|
|
-
|
1200
|
|
-function reset_tripwire {
|
1201
|
|
- if [ ! -f /usr/bin/reset-tripwire ]; then
|
1202
|
|
- echo $'Missing /usr/bin/reset-tripwire'
|
1203
|
|
- any_key
|
1204
|
|
- return
|
1205
|
|
- fi
|
1206
|
|
- if [ ! -f "/etc/tripwire/${HOSTNAME}-local.key" ]; then
|
1207
|
|
- if [ -f "/etc/tripwire/${PROJECT_NAME}-local.key" ]; then
|
1208
|
|
- # shellcheck disable=SC2086
|
1209
|
|
- mv /etc/tripwire/${PROJECT_NAME}-local.key /etc/tripwire/${HOSTNAME}-local.key
|
1210
|
|
- # shellcheck disable=SC2086
|
1211
|
|
- mv /etc/tripwire/${PROJECT_NAME}-site.key /etc/tripwire/${HOSTNAME}-site.key
|
1212
|
|
- else
|
1213
|
|
- echo $'Error: missing local key'
|
1214
|
|
- any_key
|
1215
|
|
- return
|
1216
|
|
- fi
|
1217
|
|
- fi
|
1218
|
|
- clear
|
1219
|
|
- echo $'Turing off logging...'
|
1220
|
|
- "${PROJECT_NAME}-logging" off
|
1221
|
|
- echo $'Locking down permissions...'
|
1222
|
|
- lockdown_permissions
|
1223
|
|
- echo $'Creating configuration...'
|
1224
|
|
- echo '
|
1225
|
|
-
|
1226
|
|
- ' | twadmin --create-cfgfile -S "/etc/tripwire/${HOSTNAME}-site.key" /etc/tripwire/twcfg.txt
|
1227
|
|
- echo $'Resetting policy...'
|
1228
|
|
- echo '
|
1229
|
|
-
|
1230
|
|
- ' | twadmin --create-polfile -S "/etc/tripwire/${HOSTNAME}-site.key" /etc/tripwire/twpol.txt
|
1231
|
|
- echo $'Creating tripwire database'
|
1232
|
|
- echo '
|
1233
|
|
-
|
1234
|
|
-' | tripwire --init --cfgfile /etc/tripwire/tw.cfg --polfile /etc/tripwire/tw.pol --dbfile "/var/lib/tripwire/${HOSTNAME}.twd"
|
1235
|
|
- echo $'Resetting the Tripwire...'
|
1236
|
|
- echo ''
|
1237
|
|
- echo '
|
1238
|
|
-
|
1239
|
|
- ' | reset-tripwire
|
1240
|
|
- echo ''
|
1241
|
|
-
|
1242
|
|
- # Sometimes nginx fails to restart if matrix is installed
|
1243
|
|
- # Restart matrix first
|
1244
|
|
- if [ -d /etc/matrix ]; then
|
1245
|
|
- systemctl restart matrix
|
1246
|
|
- systemctl restart nginx
|
1247
|
|
- fi
|
1248
|
|
-
|
1249
|
|
- if [ -f "/var/lib/tripwire/${HOSTNAME}.twd" ]; then
|
1250
|
|
- show_tripwire_verification_code
|
1251
|
|
- echo $'Tripwire is now reset. Take a note of the above hash, or record'
|
1252
|
|
- echo $'the QR code using a mobile device. This will enable you to independently'
|
1253
|
|
- echo $'verify the integrity of the tripwire.'
|
1254
|
|
- else
|
1255
|
|
- echo $'ERROR: tripwire database was not created'
|
1256
|
|
- fi
|
1257
|
|
- any_key
|
1258
|
|
-}
|
1259
|
|
-
|
1260
|
1151
|
function format_drive {
|
1261
|
1152
|
detect_usb_drive
|
1262
|
1153
|
dialog --title $"Format USB drive $USB_DRIVE" \
|
|
@@ -2082,26 +1973,24 @@ function menu_top_level {
|
2082
|
1973
|
do
|
2083
|
1974
|
W=(1 $"About this system"
|
2084
|
1975
|
2 $"Backup and Restore"
|
2085
|
|
- 3 $"Verify Tripwire Code"
|
2086
|
|
- 4 $"Reset Tripwire"
|
2087
|
|
- 5 $"App Settings"
|
2088
|
|
- 6 $"Add/Remove Apps"
|
2089
|
|
- 7 $"Logging on/off"
|
2090
|
|
- 8 $"Ping enable/disable"
|
2091
|
|
- 9 $"Manage Users"
|
2092
|
|
- 10 $"Email Menu"
|
2093
|
|
- 11 $"Domain or User Blocking"
|
2094
|
|
- 12 $"Security Settings"
|
2095
|
|
- 13 $"Change the name of this system"
|
2096
|
|
- 14 $"Set a static local IP address"
|
2097
|
|
- 15 $"Wifi menu"
|
2098
|
|
- 16 $"Add Clacks"
|
2099
|
|
- 17 $"Check for updates"
|
2100
|
|
- 18 $"Power off the system"
|
2101
|
|
- 19 $"Restart the system")
|
|
1976
|
+ 3 $"App Settings"
|
|
1977
|
+ 4 $"Add/Remove Apps"
|
|
1978
|
+ 5 $"Logging on/off"
|
|
1979
|
+ 6 $"Ping enable/disable"
|
|
1980
|
+ 7 $"Manage Users"
|
|
1981
|
+ 8 $"Email Menu"
|
|
1982
|
+ 9 $"Domain or User Blocking"
|
|
1983
|
+ 10 $"Security Settings"
|
|
1984
|
+ 11 $"Change the name of this system"
|
|
1985
|
+ 12 $"Set a static local IP address"
|
|
1986
|
+ 13 $"Wifi menu"
|
|
1987
|
+ 14 $"Add Clacks"
|
|
1988
|
+ 15 $"Check for updates"
|
|
1989
|
+ 16 $"Power off the system"
|
|
1990
|
+ 17 $"Restart the system")
|
2102
|
1991
|
|
2103
|
1992
|
# shellcheck disable=SC2068
|
2104
|
|
- selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Administrator Control Panel" --menu $"Choose an operation, or ESC to exit:" 27 60 27 "${W[@]}" 3>&2 2>&1 1>&3)
|
|
1993
|
+ selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Administrator Control Panel" --menu $"Choose an operation, or ESC to exit:" 25 60 25 "${W[@]}" 3>&2 2>&1 1>&3)
|
2105
|
1994
|
|
2106
|
1995
|
if [ ! "$selection" ]; then
|
2107
|
1996
|
break
|
|
@@ -2112,27 +2001,24 @@ function menu_top_level {
|
2112
|
2001
|
case $selection in
|
2113
|
2002
|
1) show_about;;
|
2114
|
2003
|
2) menu_backup_restore;;
|
2115
|
|
- 3) show_tripwire_verification_code
|
2116
|
|
- any_key_verify;;
|
2117
|
|
- 4) reset_tripwire;;
|
2118
|
|
- 5) menu_app_settings;;
|
2119
|
|
- 6) if ! /usr/local/bin/addremove; then
|
|
2004
|
+ 3) menu_app_settings;;
|
|
2005
|
+ 4) if ! /usr/local/bin/addremove; then
|
2120
|
2006
|
any_key
|
2121
|
2007
|
fi
|
2122
|
2008
|
;;
|
2123
|
|
- 7) logging_on_off;;
|
2124
|
|
- 8) ping_enable_disable;;
|
2125
|
|
- 9) menu_users;;
|
2126
|
|
- 10) menu_email;;
|
2127
|
|
- 11) domain_blocking;;
|
2128
|
|
- 12) security_settings;;
|
2129
|
|
- 13) change_system_name;;
|
2130
|
|
- 14) set_static_IP;;
|
2131
|
|
- 15) menu_wifi;;
|
2132
|
|
- 16) add_clacks;;
|
2133
|
|
- 17) check_for_updates;;
|
2134
|
|
- 18) shut_down_system;;
|
2135
|
|
- 19) restart_system;;
|
|
2009
|
+ 5) logging_on_off;;
|
|
2010
|
+ 6) ping_enable_disable;;
|
|
2011
|
+ 7) menu_users;;
|
|
2012
|
+ 8) menu_email;;
|
|
2013
|
+ 9) domain_blocking;;
|
|
2014
|
+ 10) security_settings;;
|
|
2015
|
+ 11) change_system_name;;
|
|
2016
|
+ 12) set_static_IP;;
|
|
2017
|
+ 13) menu_wifi;;
|
|
2018
|
+ 14) add_clacks;;
|
|
2019
|
+ 15) check_for_updates;;
|
|
2020
|
+ 16) shut_down_system;;
|
|
2021
|
+ 17) restart_system;;
|
2136
|
2022
|
esac
|
2137
|
2023
|
done
|
2138
|
2024
|
}
|