diff --git a/Shorewall/changelog.txt b/Shorewall/changelog.txt index 2d69f1b51..8b9d2d140 100644 --- a/Shorewall/changelog.txt +++ b/Shorewall/changelog.txt @@ -99,3 +99,5 @@ Changes in 3.1.x. 42) Be sure that restore file name is preserved regardless of 'set --' in define_firewall().) + +43) Add Simon's redhat prog files. diff --git a/Shorewall/prog.footer.redhat b/Shorewall/prog.footer.redhat new file mode 100644 index 000000000..c7b5f50db --- /dev/null +++ b/Shorewall/prog.footer.redhat @@ -0,0 +1,155 @@ +# +# Give Usage Information +# +usage() { + echo $"Usage: $BASENAME [ -q ] [ -v ] [ -n ] {start|stop|clear|restart|condrestart|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 + echo -n $"$BASENAME already running." + echo_failure + echo + status=1 + else + echo -n $"Starting $BASENAME: " + define_firewall + status=$? + [ $status = 0 -a -n "$SUBSYSLOCK" ] && touch $SUBSYSLOCK + [ $status -eq 0 ] && echo_success || echo_failure + echo + fi + ;; + stop) + echo -n $"Shutting down $BASENAME: " + stop_firewall + status=0 + [ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK + echo_success + echo + ;; + restart) + if shorewall_is_started; then + echo -n $"Restarting $BASENAME: " + else + echo -n $"Starting $BASENAME: " + fi + + define_firewall + status=$? + [ $status = 0 -a -n "$SUBSYSLOCK" ] && touch $SUBSYSLOCK + [ $status -eq 0 ] && echo_success || echo_failure + echo + ;; + condrestart) + if shorewall_is_started; then + echo -n $"Restarting $BASENAME: " + define_firewall + status=$? + [ $status = 0 -a -n "$SUBSYSLOCK" ] && touch $SUBSYSLOCK + [ $status -eq 0 ] && echo_success || echo_failure + echo + fi + ;; + restore) + echo -n $"Restoring $BASENAME: " + restore_firewall + status=$? + [ $status = 0 -a -n "$SUBSYSLOCK" ] && touch $SUBSYSLOCK + [ $status -eq 0 ] && echo_success || echo_failure + echo + ;; + clear) + echo -n $"Clearing $BASENAME: " + clear_firewall + status=0 + [ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK + echo_success + echo + ;; + 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.redhat b/Shorewall/prog.header.redhat new file mode 100644 index 000000000..fdda06ae9 --- /dev/null +++ b/Shorewall/prog.header.redhat @@ -0,0 +1,29 @@ +#!/bin/sh +# +# chkconfig: 2345 25 90 +# +# description: Firewall script for configuring Netfilter generated by \ +# the Shoreline Firewall. + +# Source function library +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions +elif [ -f /etc/rc.d/init.d/functions ]; then + . /etc/rc.d/init.d/functions +else + exit 0 +fi + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 0 + +# This is our service name +BASENAME=$(basename $0) +if [ -L $0 ]; then + BASENAME=$(find $0 -name $BASENAME -printf %l) + BASENAME=$(basename $BASENAME) +fi + diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index 7633e1665..81db9274c 100644 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -37,7 +37,9 @@ Problems Corrected in 3.1.9 Other changes in 3.1.9 -None. +1) The 'redhat' distribution is now supported in the compile command's -d + option (e.g., "compile -e -d redhat prog"). Thanks go to Simon Matter + for this support. Migration Considerations: @@ -128,16 +130,22 @@ New Features: additional consideration a) below). -d Compile the script for execution on the distribution specified by . Currently, - 'suse' is the only valid . + the supported distributions are: + + suse + redhat (which includes Fedora Core and + CentOS). Note that specifying a distribution should only be required if you intend to install the compiled script in /etc/init.d on the - target system. + target system and the target system runs + a distribution different from the system + where you are doing your compiles. Example: - shorewall compile -d suse foo + shorewall compile -e -d redhat foo Additional distributions are expected to be supported shortly.