Enable or disable ping

This commit is contained in:
Bob Mottram 2015-12-23 18:52:24 +00:00
parent d64d747e03
commit f8bd657549
1 changed files with 53 additions and 27 deletions

View File

@ -687,6 +687,30 @@ function restore_data_remote {
esac 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 { function logging_on_off {
logging="no" logging="no"
dialog --title $"Logging" \ dialog --title $"Logging" \
@ -1216,24 +1240,25 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \ dialog --backtitle $"Freedombone Control Panel" \
--title $"Control Panel" \ --title $"Control Panel" \
--radiolist $"Choose an operation:" 24 70 17 \ --radiolist $"Choose an operation:" 25 70 18 \
1 $"Backup and Restore" off \ 1 $"Backup and Restore" off \
2 $"Show SIP Phone Extensions" off \ 2 $"Show SIP Phone Extensions" off \
3 $"Reset Tripwire" off \ 3 $"Reset Tripwire" off \
4 $"Logging on/off" off \ 4 $"Logging on/off" off \
5 $"Manage Users" off \ 5 $"Ping enable/disable" off \
6 $"Email Filtering Rules" off \ 6 $"Manage Users" off \
7 $"Security Settings" off \ 7 $"Email Filtering Rules" off \
8 $"Hubzilla" off \ 8 $"Security Settings" off \
9 $"Media menu" off \ 9 $"Hubzilla" off \
10 $"IRC menu" off \ 10 $"Media menu" off \
11 $"Change the name of this system" off \ 11 $"IRC menu" off \
12 $"Set the TLS date/time source" off \ 12 $"Change the name of this system" off \
13 $"Set a static local IP address" off \ 13 $"Set the TLS date/time source" off \
14 $"Check for updates" off \ 14 $"Set a static local IP address" off \
15 $"Power off the system" off \ 15 $"Check for updates" off \
16 $"Restart the system" off \ 16 $"Power off the system" off \
17 $"Exit" on 2> $data 17 $"Restart the system" off \
18 $"Exit" on 2> $data
sel=$? sel=$?
case $sel in case $sel in
1) exit 1;; 1) exit 1;;
@ -1244,19 +1269,20 @@ function menu_top_level {
2) show_sip_extensions;; 2) show_sip_extensions;;
3) reset_tripwire;; 3) reset_tripwire;;
4) logging_on_off;; 4) logging_on_off;;
5) menu_users;; 5) ping_enable_disable;;
6) menu_email;; 6) menu_users;;
7) security_settings;; 7) menu_email;;
8) menu_hubzilla;; 8) security_settings;;
9) menu_media;; 9) menu_hubzilla;;
10) menu_irc;; 10) menu_media;;
11) change_system_name;; 11) menu_irc;;
12) set_tls_time_source;; 12) change_system_name;;
13) set_static_IP;; 13) set_tls_time_source;;
14) check_for_updates;; 14) set_static_IP;;
15) shut_down_system;; 15) check_for_updates;;
16) restart_system;; 16) shut_down_system;;
17) break;; 17) restart_system;;
18) break;;
esac esac
done done
} }