From 0ec2b0210c2a5b269ca6a974fcca30c6705843ef Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 29 Apr 2004 15:47:07 +0000 Subject: [PATCH] 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 --- Shorewall2/firewall | 11 ++++++----- Shorewall2/shorewall | 14 ++++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Shorewall2/firewall b/Shorewall2/firewall index 11bcbab71..00fa2da16 100755 --- a/Shorewall2/firewall +++ b/Shorewall2/firewall @@ -1194,7 +1194,7 @@ stop_firewall() { ;; *) 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... . /var/lib/shorewall/restore echo Shorewall restored @@ -5341,21 +5341,22 @@ define_firewall() # $1 = Command (Start or Restart) date > $STATEDIR/restarted - save_command "date > $STATEDIR/restarted" - report "Shorewall ${1}ed" rm -rf $TMP_DIR - save_command "iptables-restore < /var/lib/shorewall/iptsave" - for file in chains nat proxyarp zones; do append_file $file done + save_command "date > $STATEDIR/restarted" + + save_command 'iptables-restore << EOF' + mv -f /var/lib/shorewall/restore-$$ /var/lib/shorewall/restore-new chmod +x /var/lib/shorewall/restore-new + } # diff --git a/Shorewall2/shorewall b/Shorewall2/shorewall index eea7d430a..9dd626cd8 100755 --- a/Shorewall2/shorewall +++ b/Shorewall2/shorewall @@ -730,7 +730,7 @@ case "$1" in [ $# -ne 1 ] && usage 1 get_config 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... . /var/lib/shorewall/restore date > $STATEDIR/restarted @@ -965,10 +965,16 @@ case "$1" in [ -d /var/lib/shorewall ] || mkdir /var/lib/shorewall if iptables -L dynamic -n > /var/lib/shorewall/save; then - echo "Dynamic Rules Saved" - if iptables-save > /var/lib/shorewall/iptsave; then + echo " Dynamic Rules Saved" + if [ -f /var/lib/shorewall/restore-new ]; then 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 else echo "Error Saving the Dynamic Rules"