blob: 0befbf1861a9e11a5acdd1b7f481772700fa8f08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/bin/sh
set -e
LPATH="$(dirname "$0")"
if [ -f "$LPATH/utils" ]; then
. "$LPATH/utils"
elif [ -f "$LPATH/../utils" ]; then
. "$LPATH/../utils"
else
echo "Can't locate utilities!"
exit 1
fi
######################################
mkdir -p /etc/iptables
configure() {
if ! grep -q "$3_SAVE=\"/etc/iptables/$1\"" "/etc/conf.d/$2"; then
echo "Reconfiguring $2 service configuration"
sed -i "s#^$3_SAVE=.*\$#$3_SAVE=\"/etc/iptables/$1\"#" "/etc/conf.d/$2"
fi
}
configure ipv4 iptables IPTABLES
configure ipv6 ip6tables IP6TABLES
H="$(hostname)"
if inst "firewall/$H.ipv4" /etc/iptables/ipv4; then
echo "Reloading IPv4 firewall"
service iptables reload
fi
if inst "firewall/$H.ipv6" /etc/iptables/ipv6; then
echo "Reloading IPv6 firewall"
service ip6tables reload
fi
|