Clean up Generated Program

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3312 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-01-18 00:29:19 +00:00
parent 49cb3fa6c6
commit 62a0cdfb02
3 changed files with 76 additions and 10 deletions

View File

@ -8940,10 +8940,6 @@ stop_firewall() {
$IPTABLES -X
}
setpolicy() {
$IPTABLES -P \$1 \$2
}
setcontinue() {
$IPTABLES -A \$1 -m state --state ESTABLISHED,RELATED -j ACCEPT
}
@ -9314,6 +9310,34 @@ __EOF__
cat >> $RESTOREBASE << __EOF__
setpolicy() {
$IPTABLES -P \$1 \$2
}
clear_firewall() {
stop_firewall
setpolicy INPUT ACCEPT
setpolicy FORWARD ACCEPT
setpolicy OUTPUT ACCEPT
run_iptables -F
echo 1 > /proc/sys/net/ipv4/ip_forward
if qt mywhich ip6tables; then
ip6tables -P INPUT ACCEPT 2> /dev/null
ip6tables -P OUTPUT ACCEPT 2> /dev/null
ip6tables -P FORWARD ACCEPT 2> /dev/null
fi
run_user_exit clear
set_state "Cleared"
logger "Shorewall Cleared"
}
fatal_error()
{
echo " ERROR: \$@" >&2
@ -9360,6 +9384,7 @@ initialize() {
LOGRULENUMBERS="$LOGRULENUMBERS"
LOGFORMAT="$LOGFORMAT"
RESTOREFILE="$RESTOREFILE"
VERSION="$VERSION"
STOPPING=
#
@ -9490,7 +9515,6 @@ __EOF__
if [ -n "$PROGRAM" ]; then
INDENT=
save_command "}"
write_globals
save_command ""
cat $(find_file prog.header) $RESTOREBASE $(find_file prog.footer) > $outfile
rm $RESTOREBASE

View File

@ -2,7 +2,7 @@
# Give Usage Information #
################################################################################
usage() {
echo "Usage: $0 start|stop|reload|restart|status"
echo "Usage: $0 start|stop|clear|reload|restart|status|version"
exit 1
}
################################################################################
@ -10,6 +10,44 @@ usage() {
################################################################################
initialize
finished=0
while [ $finished -eq 0 ]; do
[ $# -eq 0 ] && usage 1
option=$1
case $option in
-*)
option=${option#-}
[ -z "$option" ] && usage 1
while [ -n "$option" ]; do
case $option in
q*)
QUIET=$(($QUIET + 1 ))
option=${option#q}
;;
n*)
NOROUTES=Yes
option=${option#n}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
if [ $# -eq 0 ]; then
usage 1
fi
COMMAND="$1"
case "$COMMAND" in
@ -38,7 +76,7 @@ case "$COMMAND" in
echo "done."
;;
status)
echo "Shorewall Status at $HOSTNAME - $(date)"
echo "Shorewall-$VERSION Status at $HOSTNAME - $(date)"
echo
if iptables -L shorewall -n > /dev/null 2>&1; then
echo "Shorewall is running"
@ -61,6 +99,10 @@ case "$COMMAND" in
echo "State:$state"
echo
;;
version)
echo $VERSION
status=0
;;
*)
usage
status=2

View File

@ -3,13 +3,11 @@ RCDLINKS="2,S41 3,S41 6,K41"
#
# Generated by the Shoreline Firewall (Shorewall) Packet Filtering Firewall - V3.2
#
# Generated $(date) by $USER
#
# 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/shorewall.
# On most distributions, this file should be called /etc/init.d/firewall.
#
# Complete documentation is available at http://shorewall.net
#
@ -37,6 +35,8 @@ RCDLINKS="2,S41 3,S41 6,K41"
# 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