From e509d5a1964e9d25aebf624ad104fb4ce5f5cb50 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 18 Mar 2018 10:03:43 +0000 Subject: [PATCH] Move firewall display to security settings --- src/freedombone-controlpanel | 84 +++++++++++++++--------------------- src/freedombone-sec | 21 ++++++++- 2 files changed, 54 insertions(+), 51 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index ca1bd962..a5309372 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -1775,18 +1775,6 @@ function reinstall_mariadb { --msgbox $"MariaDB has been reinstalled" 6 40 } -function show_firewall { - W=() - while read -r line; do - firewall_name=$(echo "$line" | awk -F '=' '{print $1}') - firewall_port=$(echo "$line" | awk -F '=' '{print $2}') - W+=("$(pad_string "${firewall_name}")" "${firewall_port}") - done < "$FIREWALL_CONFIG" - - # shellcheck disable=SC2068 - dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Firewall" --menu $"Press ESC to return to main menu" 28 50 28 "${W[@]}" 3>&2 2>&1 1>&3 -} - function email_extra_domains { email_hostnames=$(grep "dc_other_hostnames" /etc/exim4/update-exim4.conf.conf | awk -F "'" '{print $2}') @@ -2242,27 +2230,26 @@ function menu_top_level { W=(1 $"About this system" 2 $"Passwords" 3 $"Backup and Restore" - 4 $"Show Firewall" - 5 $"Verify Tripwire Code" - 6 $"Reset Tripwire" - 7 $"App Settings" - 8 $"Add/Remove Apps" - 9 $"Logging on/off" - 10 $"Ping enable/disable" - 11 $"Manage Users" - 12 $"Email Menu" - 13 $"Domain or User Blocking" - 14 $"Security Settings" - 15 $"Change the name of this system" - 16 $"Set a static local IP address" - 17 $"Wifi menu" - 18 $"Add Clacks" - 19 $"Check for updates" - 20 $"Power off the system" - 21 $"Restart the system") + 4 $"Verify Tripwire Code" + 5 $"Reset Tripwire" + 6 $"App Settings" + 7 $"Add/Remove Apps" + 8 $"Logging on/off" + 9 $"Ping enable/disable" + 10 $"Manage Users" + 11 $"Email Menu" + 12 $"Domain or User Blocking" + 13 $"Security Settings" + 14 $"Change the name of this system" + 15 $"Set a static local IP address" + 16 $"Wifi menu" + 17 $"Add Clacks" + 18 $"Check for updates" + 19 $"Power off the system" + 20 $"Restart the system") # shellcheck disable=SC2068 - selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Administrator Control Panel" --menu $"Choose an operation, or ESC to exit:" 28 60 28 "${W[@]}" 3>&2 2>&1 1>&3) + 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) if [ ! "$selection" ]; then break @@ -2274,28 +2261,27 @@ function menu_top_level { 1) show_about;; 2) view_or_change_passwords;; 3) menu_backup_restore;; - 4) show_firewall;; - 5) show_tripwire_verification_code + 4) show_tripwire_verification_code any_key_verify;; - 6) reset_tripwire;; - 7) menu_app_settings;; - 8) if ! /usr/local/bin/addremove; then + 5) reset_tripwire;; + 6) menu_app_settings;; + 7) if ! /usr/local/bin/addremove; then any_key fi ;; - 9) logging_on_off;; - 10) ping_enable_disable;; - 11) menu_users;; - 12) menu_email;; - 13) domain_blocking;; - 14) security_settings;; - 15) change_system_name;; - 16) set_static_IP;; - 17) menu_wifi;; - 18) add_clacks;; - 19) check_for_updates;; - 20) shut_down_system;; - 21) restart_system;; + 8) logging_on_off;; + 9) ping_enable_disable;; + 10) menu_users;; + 11) menu_email;; + 12) domain_blocking;; + 13) security_settings;; + 14) change_system_name;; + 15) set_static_IP;; + 16) menu_wifi;; + 17) add_clacks;; + 18) check_for_updates;; + 19) shut_down_system;; + 20) restart_system;; esac done } diff --git a/src/freedombone-sec b/src/freedombone-sec index 15ac0373..0191bd9d 100755 --- a/src/freedombone-sec +++ b/src/freedombone-sec @@ -69,6 +69,18 @@ LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory' MY_USERNAME= +function show_firewall { + W=() + while read -r line; do + firewall_name=$(echo "$line" | awk -F '=' '{print $1}') + firewall_port=$(echo "$line" | awk -F '=' '{print $2}') + W+=("$(pad_string "${firewall_name}")" "${firewall_port}") + done < "$FIREWALL_CONFIG" + + # shellcheck disable=SC2068 + dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Firewall" --menu $"Press ESC to return to main menu" 28 50 28 "${W[@]}" 3>&2 2>&1 1>&3 +} + function export_passwords { detect_usb_drive dialog --title $"Export passwords to USB drive $USB_DRIVE" \ @@ -976,10 +988,11 @@ function menu_security_settings { 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") + 15 $"Allow ssh login with passwords" + 16 $"Show firewall") # 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) + selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Security Settings" --menu $"Choose an operation, or ESC to exit:" 24 76 24 "${W[@]}" 3>&2 2>&1 1>&3) if [ ! "$selection" ]; then exit 0 @@ -1062,6 +1075,10 @@ function menu_security_settings { change_ssh_settings exit 0 ;; + 16) + show_firewall + exit 0 + ;; esac change_website_settings