|
@@ -185,73 +185,6 @@ function get_app_icann_address {
|
185
|
185
|
echo "${DEFAULT_DOMAIN_NAME}"
|
186
|
186
|
}
|
187
|
187
|
|
188
|
|
-function passwords_select_user {
|
189
|
|
- SELECTED_USERNAME=
|
190
|
|
-
|
191
|
|
- # shellcheck disable=SC2207
|
192
|
|
- users_array=($(ls /home))
|
193
|
|
-
|
194
|
|
- delete=(git)
|
195
|
|
- # shellcheck disable=SC2068
|
196
|
|
- for del in ${delete[@]}
|
197
|
|
- do
|
198
|
|
- # shellcheck disable=SC2206
|
199
|
|
- users_array=(${users_array[@]/$del})
|
200
|
|
- done
|
201
|
|
-
|
202
|
|
- i=0
|
203
|
|
- W=()
|
204
|
|
- name=()
|
205
|
|
- # shellcheck disable=SC2068
|
206
|
|
- for u in ${users_array[@]}
|
207
|
|
- do
|
208
|
|
- if [[ $(is_valid_user "$u") == "1" ]]; then
|
209
|
|
- i=$((i+1))
|
210
|
|
- W+=("$i" "$u")
|
211
|
|
- name+=("$u")
|
212
|
|
- fi
|
213
|
|
- done
|
214
|
|
-
|
215
|
|
- if [ $i -eq 1 ]; then
|
216
|
|
- SELECTED_USERNAME="${name[0]}"
|
217
|
|
- else
|
218
|
|
- # shellcheck disable=SC2068
|
219
|
|
- user_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select User" --menu $"Select one of the following:" 24 40 17 ${W[@]} 3>&2 2>&1 1>&3)
|
220
|
|
-
|
221
|
|
- # shellcheck disable=SC2181
|
222
|
|
- if [ $? -eq 0 ]; then
|
223
|
|
- SELECTED_USERNAME="${name[$((user_index-1))]}"
|
224
|
|
- fi
|
225
|
|
- fi
|
226
|
|
-}
|
227
|
|
-
|
228
|
|
-function passwords_show_apps {
|
229
|
|
- SELECTED_APP=
|
230
|
|
- i=0
|
231
|
|
- W=()
|
232
|
|
- name=()
|
233
|
|
- # shellcheck disable=SC2068
|
234
|
|
- for a in ${APPS_AVAILABLE[@]}
|
235
|
|
- do
|
236
|
|
- if [[ $(function_exists "change_password_${a}") == "1" ]]; then
|
237
|
|
- i=$((i+1))
|
238
|
|
- W+=("$i" "$a")
|
239
|
|
- name+=("$a")
|
240
|
|
- fi
|
241
|
|
- done
|
242
|
|
- i=$((i+1))
|
243
|
|
- W+=("$i" "mariadb")
|
244
|
|
- name+=("mariadb")
|
245
|
|
-
|
246
|
|
- # shellcheck disable=SC2068
|
247
|
|
- selected_app_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select App" --menu $"Select one of the following:" 24 40 17 ${W[@]} 3>&2 2>&1 1>&3)
|
248
|
|
-
|
249
|
|
- # shellcheck disable=SC2181
|
250
|
|
- if [ $? -eq 0 ]; then
|
251
|
|
- SELECTED_APP="${name[$((selected_app_index-1))]}"
|
252
|
|
- fi
|
253
|
|
-}
|
254
|
|
-
|
255
|
188
|
function reset_password_tries {
|
256
|
189
|
passwords_select_user
|
257
|
190
|
if [ ! "$SELECTED_USERNAME" ]; then
|
|
@@ -262,67 +195,6 @@ function reset_password_tries {
|
262
|
195
|
--msgbox $"Password tries have been reset for $SELECTED_USERNAME" 6 60
|
263
|
196
|
}
|
264
|
197
|
|
265
|
|
-function view_or_change_passwords {
|
266
|
|
- passwords_select_user
|
267
|
|
- if [ ! "$SELECTED_USERNAME" ]; then
|
268
|
|
- return
|
269
|
|
- fi
|
270
|
|
- detect_installed_apps
|
271
|
|
- passwords_show_apps
|
272
|
|
- if [ ! "$SELECTED_APP" ]; then
|
273
|
|
- return
|
274
|
|
- fi
|
275
|
|
-
|
276
|
|
- CURR_PASSWORD=$("${PROJECT_NAME}-pass" -u "${SELECTED_USERNAME}" -a "${SELECTED_APP}")
|
277
|
|
-
|
278
|
|
- icann_address=$(get_app_icann_address "${SELECTED_APP}")
|
279
|
|
- onion_address=$(get_app_onion_address "${SELECTED_APP}")
|
280
|
|
-
|
281
|
|
- titlestr=$"View or Change Password"
|
282
|
|
- if [ ${#onion_address} -gt 0 ]; then
|
283
|
|
- viewstr=$"${SELECTED_APP} password for ${SELECTED_USERNAME} on $icann_address or $onion_address\\n\\nCopy or change it if you wish."
|
284
|
|
- else
|
285
|
|
- viewstr=$"${SELECTED_APP} password for ${SELECTED_USERNAME} on $icann_address\\n\\nCopy or change it if you wish."
|
286
|
|
- fi
|
287
|
|
-
|
288
|
|
- if [ -f /root/.nostore ]; then
|
289
|
|
- titlestr=$"Change Password"
|
290
|
|
- if [ ${#onion_address} -gt 0 ]; then
|
291
|
|
- viewstr=$"Change the ${SELECTED_APP} password for ${SELECTED_USERNAME} on $icann_address or $onion_address."
|
292
|
|
- else
|
293
|
|
- viewstr=$"Change the ${SELECTED_APP} password for ${SELECTED_USERNAME} on $icann_address."
|
294
|
|
- fi
|
295
|
|
- fi
|
296
|
|
-
|
297
|
|
- if [[ "${SELECTED_APP}" == 'mariadb' ]]; then
|
298
|
|
- CURR_PASSWORD=$("${PROJECT_NAME}-pass" -u root -a mariadb)
|
299
|
|
- dialog --title $"MariaDB database password" \
|
300
|
|
- --msgbox "\\n ${CURR_PASSWORD}" 7 40
|
301
|
|
- return
|
302
|
|
- fi
|
303
|
|
-
|
304
|
|
- data=$(mktemp 2>/dev/null)
|
305
|
|
- dialog --title "$titlestr" \
|
306
|
|
- --backtitle $"Freedombone Control Panel" \
|
307
|
|
- --inputbox "$viewstr" 12 75 "$CURR_PASSWORD" 2>"$data"
|
308
|
|
- sel=$?
|
309
|
|
- case $sel in
|
310
|
|
- 0)
|
311
|
|
- CURR_PASSWORD=$(<"$data")
|
312
|
|
- if [ ${#CURR_PASSWORD} -gt 8 ]; then
|
313
|
|
- "${PROJECT_NAME}-pass" -u "${SELECTED_USERNAME}" -a "${SELECTED_APP}" -p "${CURR_PASSWORD}"
|
314
|
|
- "change_password_${SELECTED_APP}" "${SELECTED_USERNAME}" "${CURR_PASSWORD}"
|
315
|
|
- dialog --title $"Change password" \
|
316
|
|
- --msgbox $"The password was changed" 6 40
|
317
|
|
- else
|
318
|
|
- dialog --title $"Change password" \
|
319
|
|
- --msgbox $"The password given must be at least 8 characters" 6 40
|
320
|
|
- fi
|
321
|
|
- ;;
|
322
|
|
- esac
|
323
|
|
- rm -f "$data"
|
324
|
|
-}
|
325
|
|
-
|
326
|
198
|
function check_for_updates {
|
327
|
199
|
if [ ! -f "/etc/cron.weekly/$UPGRADE_SCRIPT_NAME" ]; then
|
328
|
200
|
dialog --title $"Check for updates" \
|
|
@@ -2227,25 +2099,24 @@ function menu_top_level {
|
2227
|
2099
|
while true
|
2228
|
2100
|
do
|
2229
|
2101
|
W=(1 $"About this system"
|
2230
|
|
- 2 $"Passwords"
|
2231
|
|
- 3 $"Backup and Restore"
|
2232
|
|
- 4 $"Verify Tripwire Code"
|
2233
|
|
- 5 $"Reset Tripwire"
|
2234
|
|
- 6 $"App Settings"
|
2235
|
|
- 7 $"Add/Remove Apps"
|
2236
|
|
- 8 $"Logging on/off"
|
2237
|
|
- 9 $"Ping enable/disable"
|
2238
|
|
- 10 $"Manage Users"
|
2239
|
|
- 11 $"Email Menu"
|
2240
|
|
- 12 $"Domain or User Blocking"
|
2241
|
|
- 13 $"Security Settings"
|
2242
|
|
- 14 $"Change the name of this system"
|
2243
|
|
- 15 $"Set a static local IP address"
|
2244
|
|
- 16 $"Wifi menu"
|
2245
|
|
- 17 $"Add Clacks"
|
2246
|
|
- 18 $"Check for updates"
|
2247
|
|
- 19 $"Power off the system"
|
2248
|
|
- 20 $"Restart the system")
|
|
2102
|
+ 2 $"Backup and Restore"
|
|
2103
|
+ 3 $"Verify Tripwire Code"
|
|
2104
|
+ 4 $"Reset Tripwire"
|
|
2105
|
+ 5 $"App Settings"
|
|
2106
|
+ 6 $"Add/Remove Apps"
|
|
2107
|
+ 7 $"Logging on/off"
|
|
2108
|
+ 8 $"Ping enable/disable"
|
|
2109
|
+ 9 $"Manage Users"
|
|
2110
|
+ 10 $"Email Menu"
|
|
2111
|
+ 11 $"Domain or User Blocking"
|
|
2112
|
+ 12 $"Security Settings"
|
|
2113
|
+ 13 $"Change the name of this system"
|
|
2114
|
+ 14 $"Set a static local IP address"
|
|
2115
|
+ 15 $"Wifi menu"
|
|
2116
|
+ 16 $"Add Clacks"
|
|
2117
|
+ 17 $"Check for updates"
|
|
2118
|
+ 18 $"Power off the system"
|
|
2119
|
+ 19 $"Restart the system")
|
2249
|
2120
|
|
2250
|
2121
|
# shellcheck disable=SC2068
|
2251
|
2122
|
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)
|
|
@@ -2258,29 +2129,28 @@ function menu_top_level {
|
2258
|
2129
|
|
2259
|
2130
|
case $selection in
|
2260
|
2131
|
1) show_about;;
|
2261
|
|
- 2) view_or_change_passwords;;
|
2262
|
|
- 3) menu_backup_restore;;
|
2263
|
|
- 4) show_tripwire_verification_code
|
|
2132
|
+ 2) menu_backup_restore;;
|
|
2133
|
+ 3) show_tripwire_verification_code
|
2264
|
2134
|
any_key_verify;;
|
2265
|
|
- 5) reset_tripwire;;
|
2266
|
|
- 6) menu_app_settings;;
|
2267
|
|
- 7) if ! /usr/local/bin/addremove; then
|
|
2135
|
+ 4) reset_tripwire;;
|
|
2136
|
+ 5) menu_app_settings;;
|
|
2137
|
+ 6) if ! /usr/local/bin/addremove; then
|
2268
|
2138
|
any_key
|
2269
|
2139
|
fi
|
2270
|
2140
|
;;
|
2271
|
|
- 8) logging_on_off;;
|
2272
|
|
- 9) ping_enable_disable;;
|
2273
|
|
- 10) menu_users;;
|
2274
|
|
- 11) menu_email;;
|
2275
|
|
- 12) domain_blocking;;
|
2276
|
|
- 13) security_settings;;
|
2277
|
|
- 14) change_system_name;;
|
2278
|
|
- 15) set_static_IP;;
|
2279
|
|
- 16) menu_wifi;;
|
2280
|
|
- 17) add_clacks;;
|
2281
|
|
- 18) check_for_updates;;
|
2282
|
|
- 19) shut_down_system;;
|
2283
|
|
- 20) restart_system;;
|
|
2141
|
+ 7) logging_on_off;;
|
|
2142
|
+ 8) ping_enable_disable;;
|
|
2143
|
+ 9) menu_users;;
|
|
2144
|
+ 10) menu_email;;
|
|
2145
|
+ 11) domain_blocking;;
|
|
2146
|
+ 12) security_settings;;
|
|
2147
|
+ 13) change_system_name;;
|
|
2148
|
+ 14) set_static_IP;;
|
|
2149
|
+ 15) menu_wifi;;
|
|
2150
|
+ 16) add_clacks;;
|
|
2151
|
+ 17) check_for_updates;;
|
|
2152
|
+ 18) shut_down_system;;
|
|
2153
|
+ 19) restart_system;;
|
2284
|
2154
|
esac
|
2285
|
2155
|
done
|
2286
|
2156
|
}
|