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