mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
Ubuntu/Debian save iptables rules
This commit is contained in:
parent
b00e1f6f0e
commit
e498d8786c
1 changed files with 12 additions and 3 deletions
|
@ -126,8 +126,10 @@ if [ -x "$VESTA/data/firewall/custom.sh" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checking fail2ban support
|
# Checking fail2ban support
|
||||||
chains=$VESTA/data/firewall/chains.conf
|
if [ ! -z "$FIREWALL_EXTENSION" ]; then
|
||||||
for chain in $(cat $chains 2>/dev/null); do
|
chains=$(cat $VESTA/data/firewall/chains.conf 2>/dev/null)
|
||||||
|
fi
|
||||||
|
for chain in $chains; do
|
||||||
eval $chain
|
eval $chain
|
||||||
if [[ "$PORT" =~ ,|-|: ]] ; then
|
if [[ "$PORT" =~ ,|-|: ]] ; then
|
||||||
port="-m multiport --dports $PORT"
|
port="-m multiport --dports $PORT"
|
||||||
|
@ -146,7 +148,14 @@ if [ -e "/etc/redhat-release" ]; then
|
||||||
/sbin/chkconfig iptables on
|
/sbin/chkconfig iptables on
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sbin/iptables-save > /etc/iptables.up.rules
|
/sbin/iptables-save > /etc/iptables.rules
|
||||||
|
preup="/etc/network/if-pre-up.d/iptables"
|
||||||
|
if [ ! -e "$preup" ]; then
|
||||||
|
echo '#!/bin/sh' > $preup
|
||||||
|
echo "/sbin/iptables-restore < /etc/iptables.rules" >> $preup
|
||||||
|
echo "exit 0" >> $preup
|
||||||
|
chmod +x $preup
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue