check correct sourcing of configuration file, and exit if it fails
This commit is contained in:
parent
1cdb7af52c
commit
ac9400aa8c
16
minifirewall
16
minifirewall
|
@ -91,7 +91,21 @@ $IPT -A LOG_ACCEPT -j LOG --log-prefix '[IPTABLES ACCEPT] : '
|
|||
$IPT -A LOG_ACCEPT -j ACCEPT
|
||||
|
||||
# Configuration
|
||||
test -f /etc/firewall.rc && . /etc/firewall.rc
|
||||
configfile="/etc/firewall.rc"
|
||||
|
||||
if ! test -f $configfile; then
|
||||
echo "$configfile does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tmpfile=`mktemp`
|
||||
. $configfile 2>$tmpfile >&2
|
||||
if [ -s $tmpfile ]; then
|
||||
echo "$configfile returns standard or error output (see below). Stopping."
|
||||
cat $tmpfile
|
||||
exit 1
|
||||
fi
|
||||
rm $tmpfile
|
||||
|
||||
# trusted ip addresses
|
||||
$IPT -N ONLYTRUSTED
|
||||
|
|
Loading…
Reference in New Issue