From f8bd6575495c73ac78c05b6315450967d73cfa15 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 23 Dec 2015 18:52:24 +0000 Subject: [PATCH] Enable or disable ping --- src/freedombone-controlpanel | 80 ++++++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 27 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 36d91856..8a7fba2c 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -687,6 +687,30 @@ function restore_data_remote { esac } +function ping_enable_disable { + ping_str=$"\nDo you want to enable other systems to ping this machine?\n\nPing may be useful for diagnostic purposes, but for added security you may not want to enable it." + enable_ping="no" + dialog --title $"Enable Ping / ICMP" \ + --backtitle $"Freedombone Control Panel" \ + --defaultno \ + --yesno "$ping_str" 10 60 + sel=$? + case $sel in + 0) enable_ping="yes";; + 255) return;; + esac + + if [[ $enable_ping == "yes" ]]; then + iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT + iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT + echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_all + else + iptables -D INPUT -p icmp --icmp-type echo-request -j ACCEPT + iptables -D OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT + echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all + fi +} + function logging_on_off { logging="no" dialog --title $"Logging" \ @@ -1216,24 +1240,25 @@ function menu_top_level { trap "rm -f $data" 0 1 2 5 15 dialog --backtitle $"Freedombone Control Panel" \ --title $"Control Panel" \ - --radiolist $"Choose an operation:" 24 70 17 \ + --radiolist $"Choose an operation:" 25 70 18 \ 1 $"Backup and Restore" off \ 2 $"Show SIP Phone Extensions" off \ 3 $"Reset Tripwire" off \ 4 $"Logging on/off" off \ - 5 $"Manage Users" off \ - 6 $"Email Filtering Rules" off \ - 7 $"Security Settings" off \ - 8 $"Hubzilla" off \ - 9 $"Media menu" off \ - 10 $"IRC menu" off \ - 11 $"Change the name of this system" off \ - 12 $"Set the TLS date/time source" off \ - 13 $"Set a static local IP address" off \ - 14 $"Check for updates" off \ - 15 $"Power off the system" off \ - 16 $"Restart the system" off \ - 17 $"Exit" on 2> $data + 5 $"Ping enable/disable" off \ + 6 $"Manage Users" off \ + 7 $"Email Filtering Rules" off \ + 8 $"Security Settings" off \ + 9 $"Hubzilla" off \ + 10 $"Media menu" off \ + 11 $"IRC menu" off \ + 12 $"Change the name of this system" off \ + 13 $"Set the TLS date/time source" off \ + 14 $"Set a static local IP address" off \ + 15 $"Check for updates" off \ + 16 $"Power off the system" off \ + 17 $"Restart the system" off \ + 18 $"Exit" on 2> $data sel=$? case $sel in 1) exit 1;; @@ -1244,19 +1269,20 @@ function menu_top_level { 2) show_sip_extensions;; 3) reset_tripwire;; 4) logging_on_off;; - 5) menu_users;; - 6) menu_email;; - 7) security_settings;; - 8) menu_hubzilla;; - 9) menu_media;; - 10) menu_irc;; - 11) change_system_name;; - 12) set_tls_time_source;; - 13) set_static_IP;; - 14) check_for_updates;; - 15) shut_down_system;; - 16) restart_system;; - 17) break;; + 5) ping_enable_disable;; + 6) menu_users;; + 7) menu_email;; + 8) security_settings;; + 9) menu_hubzilla;; + 10) menu_media;; + 11) menu_irc;; + 12) change_system_name;; + 13) set_tls_time_source;; + 14) set_static_IP;; + 15) check_for_updates;; + 16) shut_down_system;; + 17) restart_system;; + 18) break;; esac done }