Security menu style

This commit is contained in:
Bob Mottram 2018-03-17 22:10:44 +00:00
parent ee1556bb9c
commit b2f92bbcc5
1 changed files with 37 additions and 69 deletions

View File

@ -924,86 +924,66 @@ function remove_tor_bridge_relay {
} }
function menu_tor_bridges { function menu_tor_bridges {
data=$(mktemp 2>/dev/null) W=(1 $"Show bridges"
dialog --backtitle $"Freedombone Control Panel" \ 2 $"Add a bridge"
--title $"Tor Bridges" \ 3 $"Remove a bridge"
--radiolist $"Choose an operation:" 14 50 6 \ 4 $"Make this system into a bridge"
1 $"Show bridges" off \ 5 $"Stop being a bridge")
2 $"Add a bridge" off \
3 $"Remove a bridge" off \
4 $"Make this system into a bridge" off \
5 $"Stop being a bridge" off \
6 $"Go Back/Exit" on 2> "$data"
sel=$?
case $sel in
1) rm -f "$data"
exit 1;;
255) rm -f "$data"
exit 1;;
esac
case $(cat "$data") in # shellcheck disable=SC2068
selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Security Settings" --menu $"Choose an operation, or ESC to go back:" 14 50 6 "${W[@]}" 3>&2 2>&1 1>&3)
if [ ! "$selection" ]; then
exit 0
fi
case $selection in
1) 1)
show_tor_bridges show_tor_bridges
rm -f "$data"
exit 0 exit 0
;; ;;
2) 2)
add_tor_bridge add_tor_bridge
rm -f "$data"
exit 0 exit 0
;; ;;
3) 3)
remove_tor_bridge remove_tor_bridge
rm -f "$data"
exit 0 exit 0
;; ;;
4) 4)
add_tor_bridge_relay add_tor_bridge_relay
rm -f "$data"
exit 0 exit 0
;; ;;
5) 5)
remove_tor_bridge_relay remove_tor_bridge_relay
rm -f "$data"
exit 0
;;
6)
rm -f "$data"
exit 0 exit 0
;; ;;
esac esac
rm -f "$data"
} }
function menu_security_settings { function menu_security_settings {
data=$(mktemp 2>/dev/null) W=(1 $"Run STIG tests"
dialog --backtitle $"Freedombone Control Panel" \ 2 $"Fix STIG test failures"
--title $"Security Settings" \ 3 $"Show ssh host public key"
--radiolist $"Choose an operation:" 23 76 23 \ 4 $"Tor bridges"
1 $"Run STIG tests" off \ 5 $"Password storage"
2 $"Fix STIG test failures" off \ 6 $"Export passwords"
3 $"Show ssh host public key" off \ 7 $"Regenerate ssh host keys"
4 $"Tor bridges" off \ 8 $"Regenerate Diffie-Hellman keys"
5 $"Password storage" off \ 9 $"Update cipersuite"
6 $"Export passwords" off \ 10 $"Create a new Let's Encrypt certificate"
7 $"Regenerate ssh host keys" off \ 11 $"Renew Let's Encrypt certificate"
8 $"Regenerate Diffie-Hellman keys" off \ 12 $"Delete a Let's Encrypt certificate"
9 $"Update cipersuite" off \ 13 $"Enable GPG based authentication (monkeysphere)"
10 $"Create a new Let's Encrypt certificate" off \ 14 $"Register a website with monkeysphere"
11 $"Renew Let's Encrypt certificate" off \ 15 $"Allow ssh login with passwords")
12 $"Delete a Let's Encrypt certificate" off \
13 $"Enable GPG based authentication (monkeysphere)" off \ # shellcheck disable=SC2068
14 $"Register a website with monkeysphere" off \ selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Security Settings" --menu $"Choose an operation, or ESC to exit:" 23 76 23 "${W[@]}" 3>&2 2>&1 1>&3)
15 $"Allow ssh login with passwords" off \
16 $"Go Back/Exit" on 2> "$data" if [ ! "$selection" ]; then
sel=$? exit 0
case $sel in fi
1) rm -f "$data"
exit 1;;
255) rm -f "$data"
exit 1;;
esac
clear clear
@ -1019,13 +999,12 @@ function menu_security_settings {
import_settings import_settings
export_settings export_settings
case $(cat "$data") in case $selection in
1) 1)
clear clear
echo $'Running STIG tests...' echo $'Running STIG tests...'
echo '' echo ''
${PROJECT_NAME}-tests --stig showall ${PROJECT_NAME}-tests --stig showall
rm -f "$data"
exit 0 exit 0
;; ;;
2) 2)
@ -1034,28 +1013,23 @@ function menu_security_settings {
echo '' echo ''
${PROJECT_NAME}-tests --stig fix ${PROJECT_NAME}-tests --stig fix
echo $'Fixes applied. You will need to run the STIG tests again to be sure that they were all fixed.' echo $'Fixes applied. You will need to run the STIG tests again to be sure that they were all fixed.'
rm -f "$data"
exit 0 exit 0
;; ;;
3) 3)
dialog --title $"SSH host public keys" \ dialog --title $"SSH host public keys" \
--msgbox "\n$(get_ssh_server_key)" 12 60 --msgbox "\\n$(get_ssh_server_key)" 12 60
rm -f "$data"
exit 0 exit 0
;; ;;
4) 4)
menu_tor_bridges menu_tor_bridges
rm -f "$data"
exit 0 exit 0
;; ;;
5) 5)
store_passwords store_passwords
rm -f "$data"
exit 0 exit 0
;; ;;
6) 6)
export_passwords export_passwords
rm -f "$data"
exit 0 exit 0
;; ;;
7) 7)
@ -1086,15 +1060,9 @@ function menu_security_settings {
15) 15)
allow_ssh_passwords allow_ssh_passwords
change_ssh_settings change_ssh_settings
rm -f "$data"
exit 0
;;
16)
rm -f "$data"
exit 0 exit 0
;; ;;
esac esac
rm -f "$data"
change_website_settings change_website_settings
change_imap_settings change_imap_settings