diff --git a/Shorewall-core/shorewallrc.suse b/Shorewall-core/shorewallrc.suse index 6f2e44de7..f1ec6ca22 100644 --- a/Shorewall-core/shorewallrc.suse +++ b/Shorewall-core/shorewallrc.suse @@ -12,7 +12,7 @@ SBINDIR=/sbin #Directory where system ad MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed. INITDIR=/etc/init.d #Directory where SysV init scripts are installed. INITFILE=$PRODUCT #Name of the product's SysV init script -INITSOURCE=init.sh #Name of the distributed file to be installed as the SysV init script +INITSOURCE=init.suse.sh #Name of the distributed file to be installed as the SysV init script ANNOTATED= #If non-zero, annotated configuration files are installed SYSTEMD= #Directory where .service files are installed (systems running systemd only) SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR diff --git a/Shorewall-init/init.suse.sh b/Shorewall-init/init.suse.sh new file mode 100644 index 000000000..0afa523f2 --- /dev/null +++ b/Shorewall-init/init.suse.sh @@ -0,0 +1,115 @@ +#! /bin/bash +# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5 +# +# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] +# +# (c) 2010,2012 - Tom Eastep (teastep@shorewall.net) +# +# On most distributions, this file should be called /etc/init.d/shorewall. +# +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# +### BEGIN INIT INFO +# Provides: shorewall-init +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: 2 3 5 +# Default-Stop: 0 1 6 +# Short-Description: Initialize the firewall at boot time +# Description: Place the firewall in a safe state at boot time +# prior to bringing up the network. +### END INIT INFO + +if [ "$(id -u)" != "0" ] +then + echo "You must be root to start, stop or restart \"Shorewall \"." + exit 1 +fi + +# check if shorewall-init is configured or not +if [ -f "/etc/sysconfig/shorewall-init" ] +then + . /etc/sysconfig/shorewall-init + if [ -z "$PRODUCTS" ] + then + exit 0 + fi +else + exit 0 +fi + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +# Initialize the firewall +shorewall_start () { + local PRODUCT + local VARDIR + + echo -n "Initializing \"Shorewall-based firewalls\": " + for PRODUCT in $PRODUCTS; do + if [ -x ${VARDIR}/firewall ]; then + if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then + ${VARDIR}/firewall stop || echo_notdone + fi + fi + done + + if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then + ipset -R < "$SAVE_IPSETS" + fi + + return 0 +} + +# Clear the firewall +shorewall_stop () { + local PRODUCT + local VARDIR + + echo -n "Clearing \"Shorewall-based firewalls\": " + for PRODUCT in $PRODUCTS; do + if [ -x ${VARDIR}/firewall ]; then + ${VARDIR}/firewall clear || exit 1 + fi + done + + if [ -n "$SAVE_IPSETS" ]; then + mkdir -p $(dirname "$SAVE_IPSETS") + if ipset -S > "${SAVE_IPSETS}.tmp"; then + grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" + fi + fi + + return 0 +} + +case "$1" in + start) + shorewall_start + ;; + stop) + shorewall_stop + ;; + *) + echo "Usage: /etc/init.d/shorewall-init {start|stop}" + exit 1 +esac + +exit 0 diff --git a/Shorewall-lite/init.suse.sh b/Shorewall-lite/init.suse.sh new file mode 100644 index 000000000..ea7df61c7 --- /dev/null +++ b/Shorewall-lite/init.suse.sh @@ -0,0 +1,92 @@ +#!/bin/sh +# +# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5 +# +# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] +# +# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012 - Tom Eastep (teastep@shorewall.net) +# +# On most distributions, this file should be called /etc/init.d/shorewall. +# +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# If an error occurs while starting or restarting the firewall, the +# firewall is automatically stopped. +# +# Commands are: +# +# shorewall start Starts the firewall +# shorewall restart Restarts the firewall +# shorewall reload Reload the firewall +# (same as restart) +# shorewall stop Stops the firewall +# shorewall status Displays firewall status +# + + +### BEGIN INIT INFO +# Provides: shorewall-lite +# Required-Start: $network $remote_fs +# Required-Stop: +# Default-Start: 2 3 5 +# Default-Stop: 0 1 6 +# Description: starts and stops the shorewall firewall +# Short-Description: Packet filtering firewall +### END INIT INFO + +################################################################################ +# Give Usage Information # +################################################################################ +usage() { + echo "Usage: $0 start|stop|reload|restart|status" + exit 1 +} + +################################################################################ +# Get startup options (override default) +################################################################################ +OPTIONS= + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +if [ -f ${SYSCONFDIR}/shorewall-lite ]; then + . ${SYSCONFDIR}/shorewall-lite +fi + +SHOREWALL_INIT_SCRIPT=1 + +################################################################################ +# E X E C U T I O N B E G I N S H E R E # +################################################################################ +command="$1" + +case "$command" in + start) + exec ${SBINDIR}/shorewall-lite $OPTIONS start $STARTOPTIONS + ;; + restart|reload) + exec ${SBINDIR}/shorewall-lite $OPTIONS restart $RESTARTOPTIONS + ;; + status|stop) + exec ${SBINDIR}/shorewall-lite $OPTIONS $command $@ + ;; + *) + usage + ;; +esac diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index f751dbcb8..3c932098a 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -253,7 +253,10 @@ case "$HOST" in archlinux) echo "Installing ArchLinux-specific configuration..." ;; - linux|suse) + suse) + echo "Installing Suse-specific configuration..." + ;; + linux) ;; *) echo "ERROR: Unknown HOST \"$HOST\"" >&2 diff --git a/Shorewall/init.suse.sh b/Shorewall/init.suse.sh new file mode 100644 index 000000000..a7157db53 --- /dev/null +++ b/Shorewall/init.suse.sh @@ -0,0 +1,93 @@ +#!/bin/sh +# +# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.2 +# +# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] +# +# (c) 1999,2000,2001,2002,2003,2004,2005 - Tom Eastep (teastep@shorewall.net) +# +# On most distributions, this file should be called /etc/init.d/shorewall. +# +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# If an error occurs while starting or restarting the firewall, the +# firewall is automatically stopped. +# +# Commands are: +# +# shorewall start Starts the firewall +# shorewall restart Restarts the firewall +# shorewall reload Reload the firewall +# (same as restart) +# shorewall stop Stops the firewall +# shorewall status Displays firewall status +# + +### BEGIN INIT INFO +# Provides: shorewall +# Required-Start: $network $remote_fs +# Required-Stop: $network $remote_fs +# Default-Start: 2 3 5 +# Default-Stop: 0 6 +# Short-Description: Configure the firewall at boot time +# Description: Configure the firewall according to the rules specified in +# /etc/shorewall +### END INIT INFO + +################################################################################ +# Give Usage Information # +################################################################################ +usage() { + echo "Usage: $0 start|stop|reload|restart|status" >&2 + exit 1 +} + +################################################################################ +# Get startup options (override default) +################################################################################ +OPTIONS="-v0" + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +if [ -f ${SYSCONFDIR}/shorewall ]; then + . ${SYSCONFDIR}/shorewall +fi + +export SHOREWALL_INIT_SCRIPT=1 + +################################################################################ +# E X E C U T I O N B E G I N S H E R E # +################################################################################ +command="$1" +shift + +case "$command" in + start) + exec $SBINDIR/shorewall $OPTIONS start $STARTOPTIONS + ;; + restart|reload) + exec $SBINDIR/shorewall $OPTIONS restart $RESTARTOPTIONS + ;; + status|stop) + exec $SBINDIR/shorewall $OPTIONS $command + ;; + *) + usage + ;; +esac diff --git a/Shorewall6-lite/init.suse.sh b/Shorewall6-lite/init.suse.sh new file mode 100644 index 000000000..f9764f6d1 --- /dev/null +++ b/Shorewall6-lite/init.suse.sh @@ -0,0 +1,87 @@ +#!/bin/sh +# +# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5 +# +# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] +# +# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012 - Tom Eastep (teastep@shorewall.net) +# +# On most distributions, this file should be called /etc/init.d/shorewall. +# +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# If an error occurs while starting or restarting the firewall, the +# firewall is automatically stopped. +# +# Commands are: +# +# shorewall6-lite start Starts the firewall +# shorewall6-lite restart Restarts the firewall +# shorewall6-lite reload Reload the firewall +# (same as restart) +# shorewall6-lite stop Stops the firewall +# shorewall6-lite status Displays firewall status +# + +### BEGIN INIT INFO +# Provides: shorewall6-lite +# Required-Start: $local_fs $remote_fs $syslog $network +# Required-Stop: $network $remote_fs +# Default-Start: 2 3 5 +# Default-Stop: 0 1 6 +# Description: starts and stops the shorewall firewall +# Short-Description: Packet filtering firewall +### END INIT INFO + +################################################################################ +# Give Usage Information # +################################################################################ +usage() { + echo "Usage: $0 start|stop|reload|restart|status" + exit 1 +} + +################################################################################ +# Get startup options (override default) +################################################################################ +OPTIONS= + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +export SHOREWALL_INIT_SCRIPT=1 + +################################################################################ +# E X E C U T I O N B E G I N S H E R E # +################################################################################ +command="$1" + +case "$command" in + start) + exec ${SBINDIR}/shorewall6-lite $OPTIONS start $STARTOPTIONS + ;; + restart|reload) + exec ${SBINDIR}/shorewall6-lite $OPTIONS restart $RESTARTOPTIONS + ;; + status|stop) + exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $@ + ;; + *) + usage + ;; +esac diff --git a/Shorewall6/init.suse.sh b/Shorewall6/init.suse.sh new file mode 100644 index 000000000..358d9345f --- /dev/null +++ b/Shorewall6/init.suse.sh @@ -0,0 +1,89 @@ +#!/bin/sh +# +# The Shoreline Firewall (Shorewall6) Packet Filtering Firewall - V4.5 +# +# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] +# +# (c) 1999,2000,2001,2002,2003,2004,2005,2012 - Tom Eastep (teastep@shorewall.net) +# +# On most distributions, this file should be called /etc/init.d/shorewall. +# +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# If an error occurs while starting or restarting the firewall, the +# firewall is automatically stopped. +# +# Commands are: +# +# shorewall6 start Starts the firewall +# shorewall6 restart Restarts the firewall +# shorewall6 reload Reload the firewall +# (same as restart) +# shorewall6 stop Stops the firewall +# shorewall6 status Displays firewall status +# + +### BEGIN INIT INFO +# Provides: shorewall6 +# Required-Start: $local_fs $remote_fs $syslog +# Should-Start: VMware $time $named +# Should-Stop: $null +# Required-Stop: $null +# Default-Start: 2 3 5 +# Default-Stop: 0 1 6 +# Description: starts and stops the shorewall6 firewall +# Short-Description: Packet filtering firewall +### END INIT INFO + +################################################################################ +# Give Usage Information # +################################################################################ +usage() { + echo "Usage: $0 start|stop|reload|restart|status" + exit 1 +} + +################################################################################ +# Get startup options (override default) +################################################################################ +OPTIONS="-v0" + +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + +export SHOREWALL_INIT_SCRIPT=1 + +################################################################################ +# E X E C U T I O N B E G I N S H E R E # +################################################################################ +command="$1" + +case "$command" in + start) + exec ${SBINDIR}/shorewall6 $OPTIONS start $STARTOPTIONS + ;; + restart|reload) + exec ${SBINDIR}/shorewall6 $OPTIONS restart $RESTARTOPTIONS + ;; + status|stop) + exec ${SBINDIR}/shorewall6 $OPTIONS $command $@ + ;; + *) + usage + ;; +esac