|
|
@@ -20,6 +20,63 @@
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
+help_message_lfirewall(){
|
|
|
+cat <<-EOF
|
|
|
+ Light Firewall configuration script.
|
|
|
+
|
|
|
+ $(basename ${0}) [OPTIONS...] COMMAND
|
|
|
+
|
|
|
+ COMMANDS
|
|
|
+
|
|
|
+ start : starts the firewall
|
|
|
+ clear : stops the firewall (removes all IPTABLES rules and let all connections work)
|
|
|
+ stop : stops all network connections (USE with CAUTION)
|
|
|
+ test : tests the existing rules for 30 seconds
|
|
|
+
|
|
|
+ OPTIONS
|
|
|
+ -v --verbose : verbose mode
|
|
|
+ -h --help : display this help message
|
|
|
+
|
|
|
+ AUTHOR
|
|
|
+ Original author: Nicolargo
|
|
|
+ Modified by: Laurent Hubert
|
|
|
+EOF
|
|
|
+}
|
|
|
+
|
|
|
+options=$(getopt -l "help,verbose" -o "hv" -- "$@")
|
|
|
+
|
|
|
+if [[ $? != 0 ]] ; then
|
|
|
+ help_message_lfirewall
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+eval set -- "$options"
|
|
|
+
|
|
|
+verbose=0
|
|
|
+
|
|
|
+while :
|
|
|
+do
|
|
|
+ if [[ ${verbose} = "1" ]] ; then
|
|
|
+ echo "$@"
|
|
|
+ fi
|
|
|
+
|
|
|
+ case "$1" in
|
|
|
+ -h|--help)
|
|
|
+ help_message_lfirewall
|
|
|
+ exit 0
|
|
|
+ ;;
|
|
|
+ -v|--verbose)
|
|
|
+ verbose=1
|
|
|
+ set -xv
|
|
|
+ ;;
|
|
|
+ --)
|
|
|
+ shift
|
|
|
+ break
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ shift
|
|
|
+done
|
|
|
+
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|
|
|
|
|
#Defautl network interface
|