iptables-restore checking remove
This commit is contained in:
parent
08c1b84f49
commit
070d8a305b
@ -74,20 +74,12 @@ iptables -A INPUT -p tcp --dport 1701 -j ACCEPT
|
|||||||
|
|
||||||
iptables-save | awk '($0 !~ /^-A/)||!($0 in a) {a[$0];print}' > $IPTABLES
|
iptables-save | awk '($0 !~ /^-A/)||!($0 in a) {a[$0];print}' > $IPTABLES
|
||||||
|
|
||||||
IPTABLESRESTOR=$(which iptables-restore)
|
|
||||||
RESTORPRESENTS=$(grep iptables-restore $RCLOCAL)
|
RESTORPRESENTS=$(grep iptables-restore $RCLOCAL)
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
if [[ ! -z $IPTABLESRESTOR ]]; then
|
|
||||||
sed -i -e "/exit 0/d" $RCLOCAL
|
sed -i -e "/exit 0/d" $RCLOCAL
|
||||||
echo "$IPTABLESRESTOR < $IPTABLES" >> $RCLOCAL
|
echo "iptables-restore < $IPTABLES" >> $RCLOCAL
|
||||||
echo "exit 0" >> $RCLOCAL
|
echo "exit 0" >> $RCLOCAL
|
||||||
else
|
|
||||||
echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
iptables -F
|
iptables -F
|
||||||
|
iptables-restore < $IPTABLES
|
||||||
if [[ ! -z $IPTABLERESTOR ]]; then
|
|
||||||
$IPTABLESRESTOR < $IPTABLES
|
|
||||||
fi
|
|
||||||
|
|||||||
@ -88,20 +88,12 @@ if [ $? -ne 0 ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IPTABLESRESTOR=$(which iptables-restore)
|
|
||||||
RESTORPRESENTS=$(grep iptables-restore $RCLOCAL)
|
RESTORPRESENTS=$(grep iptables-restore $RCLOCAL)
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
if [[ ! -z $IPTABLESRESTOR ]]; then
|
|
||||||
sed -i -e "/exit 0/d" $RCLOCAL
|
sed -i -e "/exit 0/d" $RCLOCAL
|
||||||
echo "$IPTABLESRESTOR < $IPTABLES" >> $RCLOCAL
|
echo "iptables-restore < $IPTABLES" >> $RCLOCAL
|
||||||
echo "exit 0" >> $RCLOCAL
|
echo "exit 0" >> $RCLOCAL
|
||||||
else
|
|
||||||
echo "Cannot save iptables-restore from $IPTABLES to $RCLOCAL."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
iptables -F
|
iptables -F
|
||||||
|
iptables-restore < $IPTABLES
|
||||||
if [[ ! -z $IPTABLERESTOR ]]; then
|
|
||||||
$IPTABLESRESTOR < $IPTABLES
|
|
||||||
fi
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user