瀏覽代碼

Move firewall display to security settings

Bob Mottram 7 年之前
父節點
當前提交
e509d5a196
共有 2 個檔案被更改,包括 54 行新增51 行删除
  1. 35
    49
      src/freedombone-controlpanel
  2. 19
    2
      src/freedombone-sec

+ 35
- 49
src/freedombone-controlpanel 查看文件

@@ -1775,18 +1775,6 @@ function reinstall_mariadb {
1775 1775
            --msgbox $"MariaDB has been reinstalled" 6 40
1776 1776
 }
1777 1777
 
1778
-function show_firewall {
1779
-    W=()
1780
-    while read -r line; do
1781
-        firewall_name=$(echo "$line" | awk -F '=' '{print $1}')
1782
-        firewall_port=$(echo "$line" | awk -F '=' '{print $2}')
1783
-        W+=("$(pad_string "${firewall_name}")" "${firewall_port}")
1784
-    done < "$FIREWALL_CONFIG"
1785
-
1786
-    # shellcheck disable=SC2068
1787
-    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
1788
-}
1789
-
1790 1778
 function email_extra_domains {
1791 1779
     email_hostnames=$(grep "dc_other_hostnames" /etc/exim4/update-exim4.conf.conf | awk -F "'" '{print $2}')
1792 1780
 
@@ -2242,27 +2230,26 @@ function menu_top_level {
2242 2230
         W=(1 $"About this system"
2243 2231
            2 $"Passwords"
2244 2232
            3 $"Backup and Restore"
2245
-           4 $"Show Firewall"
2246
-           5 $"Verify Tripwire Code"
2247
-           6 $"Reset Tripwire"
2248
-           7 $"App Settings"
2249
-           8 $"Add/Remove Apps"
2250
-           9 $"Logging on/off"
2251
-           10 $"Ping enable/disable"
2252
-           11 $"Manage Users"
2253
-           12 $"Email Menu"
2254
-           13 $"Domain or User Blocking"
2255
-           14 $"Security Settings"
2256
-           15 $"Change the name of this system"
2257
-           16 $"Set a static local IP address"
2258
-           17 $"Wifi menu"
2259
-           18 $"Add Clacks"
2260
-           19 $"Check for updates"
2261
-           20 $"Power off the system"
2262
-           21 $"Restart the system")
2233
+           4 $"Verify Tripwire Code"
2234
+           5 $"Reset Tripwire"
2235
+           6 $"App Settings"
2236
+           7 $"Add/Remove Apps"
2237
+           8 $"Logging on/off"
2238
+           9 $"Ping enable/disable"
2239
+           10 $"Manage Users"
2240
+           11 $"Email Menu"
2241
+           12 $"Domain or User Blocking"
2242
+           13 $"Security Settings"
2243
+           14 $"Change the name of this system"
2244
+           15 $"Set a static local IP address"
2245
+           16 $"Wifi menu"
2246
+           17 $"Add Clacks"
2247
+           18 $"Check for updates"
2248
+           19 $"Power off the system"
2249
+           20 $"Restart the system")
2263 2250
 
2264 2251
         # shellcheck disable=SC2068
2265
-        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)
2252
+        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)
2266 2253
 
2267 2254
         if [ ! "$selection" ]; then
2268 2255
             break
@@ -2274,28 +2261,27 @@ function menu_top_level {
2274 2261
             1) show_about;;
2275 2262
             2) view_or_change_passwords;;
2276 2263
             3) menu_backup_restore;;
2277
-            4) show_firewall;;
2278
-            5) show_tripwire_verification_code
2264
+            4) show_tripwire_verification_code
2279 2265
                any_key_verify;;
2280
-            6) reset_tripwire;;
2281
-            7) menu_app_settings;;
2282
-            8) if ! /usr/local/bin/addremove; then
2266
+            5) reset_tripwire;;
2267
+            6) menu_app_settings;;
2268
+            7) if ! /usr/local/bin/addremove; then
2283 2269
                    any_key
2284 2270
                fi
2285 2271
                ;;
2286
-            9) logging_on_off;;
2287
-            10) ping_enable_disable;;
2288
-            11) menu_users;;
2289
-            12) menu_email;;
2290
-            13) domain_blocking;;
2291
-            14) security_settings;;
2292
-            15) change_system_name;;
2293
-            16) set_static_IP;;
2294
-            17) menu_wifi;;
2295
-            18) add_clacks;;
2296
-            19) check_for_updates;;
2297
-            20) shut_down_system;;
2298
-            21) restart_system;;
2272
+            8) logging_on_off;;
2273
+            9) ping_enable_disable;;
2274
+            10) menu_users;;
2275
+            11) menu_email;;
2276
+            12) domain_blocking;;
2277
+            13) security_settings;;
2278
+            14) change_system_name;;
2279
+            15) set_static_IP;;
2280
+            16) menu_wifi;;
2281
+            17) add_clacks;;
2282
+            18) check_for_updates;;
2283
+            19) shut_down_system;;
2284
+            20) restart_system;;
2299 2285
         esac
2300 2286
     done
2301 2287
 }

+ 19
- 2
src/freedombone-sec 查看文件

@@ -69,6 +69,18 @@ LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
69 69
 
70 70
 MY_USERNAME=
71 71
 
72
+function show_firewall {
73
+    W=()
74
+    while read -r line; do
75
+        firewall_name=$(echo "$line" | awk -F '=' '{print $1}')
76
+        firewall_port=$(echo "$line" | awk -F '=' '{print $2}')
77
+        W+=("$(pad_string "${firewall_name}")" "${firewall_port}")
78
+    done < "$FIREWALL_CONFIG"
79
+
80
+    # shellcheck disable=SC2068
81
+    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
82
+}
83
+
72 84
 function export_passwords {
73 85
     detect_usb_drive
74 86
     dialog --title $"Export passwords to USB drive $USB_DRIVE" \
@@ -976,10 +988,11 @@ function menu_security_settings {
976 988
        12 $"Delete a Let's Encrypt certificate"
977 989
        13 $"Enable GPG based authentication (monkeysphere)"
978 990
        14 $"Register a website with monkeysphere"
979
-       15 $"Allow ssh login with passwords")
991
+       15 $"Allow ssh login with passwords"
992
+       16 $"Show firewall")
980 993
 
981 994
     # shellcheck disable=SC2068
982
-    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)
995
+    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)
983 996
 
984 997
     if [ ! "$selection" ]; then
985 998
         exit 0
@@ -1062,6 +1075,10 @@ function menu_security_settings {
1062 1075
             change_ssh_settings
1063 1076
             exit 0
1064 1077
             ;;
1078
+        16)
1079
+            show_firewall
1080
+            exit 0
1081
+            ;;
1065 1082
     esac
1066 1083
 
1067 1084
     change_website_settings