More fixing my code.
parent
c45071c8fb
commit
da8f710864
|
@ -83,7 +83,7 @@ function iptables_rules_flush {
|
||||||
ipv6) VER_IPTABLES=$IP6TABLES ;;
|
ipv6) VER_IPTABLES=$IP6TABLES ;;
|
||||||
ipv4|*) VER_IPTABLES=$IPTABLES ;;
|
ipv4|*) VER_IPTABLES=$IPTABLES ;;
|
||||||
esac
|
esac
|
||||||
display_c RED "Flushing $VER_IPTABLES rules..."
|
display_c RED "Flushing ${IP_VERSION} rules..."
|
||||||
$VER_IPTABLES --flush &>/dev/null
|
$VER_IPTABLES --flush &>/dev/null
|
||||||
$VER_IPTABLES -F OUTPUT &>/dev/null
|
$VER_IPTABLES -F OUTPUT &>/dev/null
|
||||||
$VER_IPTABLES -F PREROUTING &>/dev/null
|
$VER_IPTABLES -F PREROUTING &>/dev/null
|
||||||
|
@ -97,6 +97,7 @@ function iptables_rules_flush {
|
||||||
|
|
||||||
# iptables_policy_set (ipv6|ipv4) (ACCEPT|DROP)
|
# iptables_policy_set (ipv6|ipv4) (ACCEPT|DROP)
|
||||||
# Sets all policy rules to either ACCEPT or DROP for ipv4 or ipv6
|
# Sets all policy rules to either ACCEPT or DROP for ipv4 or ipv6
|
||||||
|
# If no policy given, assume ACCEPT
|
||||||
function iptables_policy_reset {
|
function iptables_policy_reset {
|
||||||
IP_VERSION=$1
|
IP_VERSION=$1
|
||||||
SET_POLICY=${2=ACCEPT}
|
SET_POLICY=${2=ACCEPT}
|
||||||
|
@ -104,6 +105,7 @@ function iptables_policy_reset {
|
||||||
ipv6) VER_IPTABLES=$IP6TABLES ;;
|
ipv6) VER_IPTABLES=$IP6TABLES ;;
|
||||||
ipv4|*) VER_IPTABLES=$IPTABLES ;;
|
ipv4|*) VER_IPTABLES=$IPTABLES ;;
|
||||||
esac
|
esac
|
||||||
|
display_c RED "Setting ${IP_VERSION} policies to ${SET_POLICY}..."
|
||||||
$VER_IPTABLES --policy INPUT $SET_POLICY
|
$VER_IPTABLES --policy INPUT $SET_POLICY
|
||||||
$VER_IPTABLES --policy OUTPUT $SET_POLICY
|
$VER_IPTABLES --policy OUTPUT $SET_POLICY
|
||||||
$VER_IPTABLES --policy FORWARD $SET_POLICY
|
$VER_IPTABLES --policy FORWARD $SET_POLICY
|
||||||
|
@ -112,12 +114,7 @@ function iptables_policy_reset {
|
||||||
# show_help
|
# show_help
|
||||||
# Show command line options help
|
# Show command line options help
|
||||||
function show_help {
|
function show_help {
|
||||||
echo "Firewall/SOSDG ${FW_VERSION}"
|
echo "Firewall/SOSDG ${FW_VERSION} - Brielle Bruns <bruns@2mbit.com>"
|
||||||
echo "Brielle Bruns <bruns@2mbit.com>"
|
|
||||||
echo "http://www.sosdg.org/freestuff/firewall"
|
|
||||||
echo "This program comes with ABSOLUTELY NO WARRANTY."
|
|
||||||
echo "This is free software, and you are welcome to"
|
|
||||||
echo "redistribute it under certain conditions."
|
|
||||||
echo -e "\t--help\t\tShows this info"
|
echo -e "\t--help\t\tShows this info"
|
||||||
echo -e "\t--flush\t\tFlushes all rules back to default ACCEPT"
|
echo -e "\t--flush\t\tFlushes all rules back to default ACCEPT"
|
||||||
}
|
}
|
|
@ -37,6 +37,7 @@ while [ $# -gt 0 ]; do
|
||||||
iptables_policy_reset ipv6 ACCEPT
|
iptables_policy_reset ipv6 ACCEPT
|
||||||
iptables_rules_flush ipv4
|
iptables_rules_flush ipv4
|
||||||
iptables_rules_flush ipv6
|
iptables_rules_flush ipv6
|
||||||
|
exit 0
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
show_help
|
show_help
|
||||||
|
|
Loading…
Reference in New Issue