paulbsd-salt/states/old/iptables/iptables-service.j2

35 lines
592 B
Plaintext
Raw Normal View History

2020-07-10 00:58:55 +02:00
#!/bin/bash
flush()
{
for chain in INPUT OUTPUT FORWARD
do
iptables -P $chain ACCEPT
iptables -F $chain
ip6tables -P $chain ACCEPT
ip6tables -F $chain
done
#for chain in INPUT OUTPUT PREROUTING POSTROUTING
for chain in POSTROUTING
do
iptables -t nat -F $chain
ip6tables -t nat -F $chain
done
}
load()
{
iptables-restore -n /etc/iptables/iptables.conf
ip6tables-restore -n /etc/iptables/ip6tables.conf
}
if [[ $1 == 'start' || $1 == 'restart' ]]
then
flush
load
elif [[ $1 == 'stop' ]]
then
flush
else
echo "Please provide start or stop"
fi