Include iptables-save output in /var/lib/shorewall/restore

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1289 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2004-04-29 15:47:07 +00:00
parent e11652b86a
commit 0ec2b0210c
2 changed files with 16 additions and 9 deletions

View File

@ -1194,7 +1194,7 @@ stop_firewall() {
;; ;;
*) *)
set +x set +x
if [ -f /var/lib/shorewall/restore -a -f /var/lib/shorewall/iptsave ]; then if [ -f /var/lib/shorewall/restore ]; then
echo Restoring Shorewall... echo Restoring Shorewall...
. /var/lib/shorewall/restore . /var/lib/shorewall/restore
echo Shorewall restored echo Shorewall restored
@ -5341,21 +5341,22 @@ define_firewall() # $1 = Command (Start or Restart)
date > $STATEDIR/restarted date > $STATEDIR/restarted
save_command "date > $STATEDIR/restarted"
report "Shorewall ${1}ed" report "Shorewall ${1}ed"
rm -rf $TMP_DIR rm -rf $TMP_DIR
save_command "iptables-restore < /var/lib/shorewall/iptsave"
for file in chains nat proxyarp zones; do for file in chains nat proxyarp zones; do
append_file $file append_file $file
done done
save_command "date > $STATEDIR/restarted"
save_command 'iptables-restore << EOF'
mv -f /var/lib/shorewall/restore-$$ /var/lib/shorewall/restore-new mv -f /var/lib/shorewall/restore-$$ /var/lib/shorewall/restore-new
chmod +x /var/lib/shorewall/restore-new chmod +x /var/lib/shorewall/restore-new
} }
# #

View File

@ -730,7 +730,7 @@ case "$1" in
[ $# -ne 1 ] && usage 1 [ $# -ne 1 ] && usage 1
get_config get_config
if [ -n "$FAST" ]; then if [ -n "$FAST" ]; then
if [ -f /var/lib/shorewall/restore -a -f /var/lib/shorewall/iptsave ]; then if [ -f /var/lib/shorewall/restore ]; then
echo Restoring Shorewall... echo Restoring Shorewall...
. /var/lib/shorewall/restore . /var/lib/shorewall/restore
date > $STATEDIR/restarted date > $STATEDIR/restarted
@ -965,10 +965,16 @@ case "$1" in
[ -d /var/lib/shorewall ] || mkdir /var/lib/shorewall [ -d /var/lib/shorewall ] || mkdir /var/lib/shorewall
if iptables -L dynamic -n > /var/lib/shorewall/save; then if iptables -L dynamic -n > /var/lib/shorewall/save; then
echo "Dynamic Rules Saved" echo " Dynamic Rules Saved"
if iptables-save > /var/lib/shorewall/iptsave; then if [ -f /var/lib/shorewall/restore-new ]; then
mv -f /var/lib/shorewall/restore-new /var/lib/shorewall/restore mv -f /var/lib/shorewall/restore-new /var/lib/shorewall/restore
echo "Last Started Configuration Saved" if iptables-save >> /var/lib/shorewall/restore ; then
echo EOF >> /var/lib/shorewall/restore
echo " Currently-running Configuration Saved"
else
rm -f /var/lib/shorewall/restore
echo " ERROR: Currently-running Configuration Not Saved"
fi
fi fi
else else
echo "Error Saving the Dynamic Rules" echo "Error Saving the Dynamic Rules"