diff --git a/Shorewall/compiler b/Shorewall/compiler index c59dce393..b49d583e9 100755 --- a/Shorewall/compiler +++ b/Shorewall/compiler @@ -8652,7 +8652,7 @@ __EOF__ echo "Shorewall configuration verified" else INDENT= - cat $(find_file prog.header) $OUTPUT $(find_file prog.footer) > $outfile + cat $(find_file prog.header${DISTRIBUTION}) $OUTPUT $(find_file prog.footer${DISTRIBUTION}) > $outfile chmod 700 $outfile progress_message2 "Shorewall configuration compiled to $outfile" rm -f $OUTPUT diff --git a/Shorewall/help b/Shorewall/help index e61ff7cb2..32db773e9 100755 --- a/Shorewall/help +++ b/Shorewall/help @@ -88,7 +88,7 @@ clear) ;; compile) - echo "compile: compile [ -e ] [ ] + echo "compile: compile [ -e ] [ -d ] [ ] Compiles the current configuration into the executable file . If names a file in /var/lib/shorewall then the file may be executed using the \"restore\" command. @@ -97,6 +97,16 @@ compile) other than where the compiled script will run. This option disables certain configuration options that require the script to be compiled where it is to be run. + + When -d is given, the script is built for execution + on the distribution specified by . Currently, 'suse' is the + only valid . Usually specified together with -e. + + Example: + + shorewall compile -ed suse foo + + Additional distributions are expected to be supported shortly." ;; debug) diff --git a/Shorewall/prog.footer.suse b/Shorewall/prog.footer.suse new file mode 100644 index 000000000..cdd1f2867 --- /dev/null +++ b/Shorewall/prog.footer.suse @@ -0,0 +1,132 @@ +# +# Give Usage Information +# +usage() { + echo "Usage: $0 [ -q ] [ -v ] [ -n ] [ start|stop|clear|restart|status|version ]" + exit $1 +} +################################################################################ +# E X E C U T I O N B E G I N S H E R E # +################################################################################ +initialize + +finished=0 + +while [ $finished -eq 0 -a $# -gt 0 ]; do + option=$1 + case $option in + -*) + option=${option#-} + + [ -z "$option" ] && usage 1 + + while [ -n "$option" ]; do + case $option in + v*) + VERBOSE=$(($VERBOSE + 1 )) + option=${option#v} + ;; + q*) + VERBOSE=$(($VERBOSE - 1 )) + option=${option#q} + ;; + n*) + NOROUTES=Yes + option=${option#n} + ;; + *) + usage 1 + ;; + esac + done + shift + ;; + *) + finished=1 + ;; + esac +done + +if [ $# -ne 1 ]; then + usage 2 +else + COMMAND="$1" +fi + +case "$COMMAND" in + start) + if shorewall_is_started; then + error_message "Shorewall is already Running" + status=1 + else + progress_message3 "Starting Shorewall...." + define_firewall + status=$? + progress_message3 "done." + fi + ;; + stop) + progress_message3 "Stopping Shorewall...." + stop_firewall + status=0 + progress_message3 "done." + ;; + restart) + if shorewall_is_started; then + progress_message3 "Restarting Shorewall...." + else + echo "Shorewall is not running" >&2 + progress_message3 "Starting Shorewall...." + fi + + define_firewall + status=$? + progress_message3 "done." + ;; + restore) + restore_firewall + status=$? + ;; + clear) + progress_message3 "Clearing Shorewall...." + clear_firewall + status=0 + progress_message3 "done." + ;; + status) + echo "Shorewall-$VERSION Status at $HOSTNAME - $(date)" + echo + if shorewall_is_started; then + echo "Shorewall is running" + status=0 + else + echo "Shorewall is stopped" + status=4 + fi + + if [ -f /var/lib/shorewall/state ]; then + state="$(cat /var/lib/shorewall/state)" + case $state in + Stopped*|Clear*) + status=3 + ;; + esac + else + state=Unknown + fi + echo "State:$state" + echo + ;; + version) + echo $VERSION + status=0 + ;; + help) + usage 0 + ;; + *) + usage 2 + ;; +esac + +exit $status diff --git a/Shorewall/prog.header.suse b/Shorewall/prog.header.suse new file mode 100644 index 000000000..d55057742 --- /dev/null +++ b/Shorewall/prog.header.suse @@ -0,0 +1,59 @@ +#!/bin/sh +RCDLINKS="2,S41 3,S41 6,K41" +# +# Generated by the Shoreline Firewall (Shorewall) Packet Filtering Firewall - V3.2 +# +# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm] +# +# (c) 2006 - Tom Eastep (teastep@shorewall.net) +# +# On most distributions, this file should be called /etc/init.d/firewall. +# +# Complete documentation is available at http://shorewall.net +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of Version 2 of the GNU General Public License +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA +# +# If an error occurs while starting or restarting the firewall, the +# firewall is automatically restored if there is a current +# restore file (created by "shorewall save"). If there is no restore +# file, the firewall is stopped. +# +# Options are: +# +# -n Don't alter Routing +# -v and -q Standard Shorewall Verbosity control +# +# Commands are: +# +# start Starts the firewall +# restart Restarts the firewall +# reload Reload the firewall +# clear Removes all firewall rules +# stop Stops the firewall +# status Displays firewall status +# version Displays the version of Shorewall that +# generated this program +# + +# chkconfig: 2345 25 90 +# description: Packet filtering firewall + +### BEGIN INIT INFO +# Provides: firewall +# Required-Start: $network +# Required-Stop: +# Default-Start: 2 3 5 +# Default-Stop: 0 1 6 +# Description: starts and stops the shorewall-generated firewall +### END INIT INFO diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index 8e5866dc0..3b996f279 100755 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -66,7 +66,7 @@ Migration Considerations: DNAT Z1!Z2 loc:192.168.1.4 ... That syntax has never worked correctly when Z2 is a dynamic zone. - Furthermore, now that Shorewall supports exclusion lists the capability + Furthermore, now that Shorewall supports exclusion lists, the capability is redundant since the above rule can now be written in the form: DNAT Z1:! loc:192.168.1.4 ... @@ -78,12 +78,11 @@ New Features: 1) A new 'shorewall compile' command has been added. - shorewall compile [ -v ] [ -q ] [ -e ] [ ]