2004-01-31 17:11:22 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Script to install Shoreline Firewall
|
|
|
|
#
|
|
|
|
# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
|
|
|
|
#
|
|
|
|
# (c) 2000,2001,2002,2003,2004 - Tom Eastep (teastep@shorewall.net)
|
|
|
|
#
|
2004-02-21 21:31:16 +01:00
|
|
|
# Shorewall documentation is available at http://shorewall.net
|
2004-01-31 17:11:22 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2004-12-25 03:49:48 +01:00
|
|
|
VERSION=2.2.0-RC2
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
usage() # $1 = exit status
|
|
|
|
{
|
2004-02-02 21:15:44 +01:00
|
|
|
ME=$(basename $0)
|
2004-02-29 16:51:08 +01:00
|
|
|
echo "usage: $ME"
|
2004-02-21 21:31:16 +01:00
|
|
|
echo " $ME -v"
|
2004-02-29 16:51:08 +01:00
|
|
|
echo " $ME -h"
|
2004-01-31 17:11:22 +01:00
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
run_install()
|
|
|
|
{
|
|
|
|
if ! install $*; then
|
|
|
|
echo
|
|
|
|
echo "ERROR: Failed to install $*"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
cant_autostart()
|
|
|
|
{
|
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "WARNING: Unable to configure shorewall to start"
|
2004-01-31 17:11:22 +01:00
|
|
|
echo " automatically at boot"
|
|
|
|
}
|
|
|
|
|
|
|
|
backup_file() # $1 = file to backup
|
|
|
|
{
|
|
|
|
if [ -z "$PREFIX" -a -f $1 -a ! -f ${1}-${VERSION}.bkout ]; then
|
|
|
|
if (cp $1 ${1}-${VERSION}.bkout); then
|
|
|
|
echo
|
|
|
|
echo "$1 saved to ${1}-${VERSION}.bkout"
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
delete_file() # $1 = file to delete
|
|
|
|
{
|
|
|
|
if [ -z "$PREFIX" -a -f $1 -a ! -f ${1}-${VERSION}.bkout ]; then
|
|
|
|
if (mv $1 ${1}-${VERSION}.bkout); then
|
|
|
|
echo
|
|
|
|
echo "$1 moved to ${1}-${VERSION}.bkout"
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_file_with_backup() # $1 = source $2 = target $3 = mode
|
|
|
|
{
|
|
|
|
backup_file $2
|
|
|
|
run_install -o $OWNER -g $GROUP -m $3 $1 ${2}
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Parse the run line
|
|
|
|
#
|
|
|
|
# DEST is the SysVInit script directory
|
2004-05-10 23:15:14 +02:00
|
|
|
# INIT is the name of the script in the $DEST directory
|
2004-01-31 17:11:22 +01:00
|
|
|
# RUNLEVELS is the chkconfig parmeters for firewall
|
|
|
|
# ARGS is "yes" if we've already parsed an argument
|
|
|
|
#
|
|
|
|
ARGS=""
|
|
|
|
|
2004-06-02 19:30:29 +02:00
|
|
|
if [ -z "$DEST" ] ; then
|
|
|
|
DEST="/etc/init.d"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$INIT" ] ; then
|
|
|
|
INIT="shorewall"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$RUNLEVELS" ] ; then
|
|
|
|
RUNLEVELS=""
|
|
|
|
fi
|
|
|
|
|
2004-01-31 17:11:22 +01:00
|
|
|
if [ -z "$OWNER" ] ; then
|
|
|
|
OWNER=root
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$GROUP" ] ; then
|
|
|
|
GROUP=root
|
|
|
|
fi
|
|
|
|
|
|
|
|
while [ $# -gt 0 ] ; do
|
|
|
|
case "$1" in
|
|
|
|
-h|help|?)
|
|
|
|
usage 0
|
|
|
|
;;
|
|
|
|
-v)
|
|
|
|
echo "Shorewall Firewall Installer Version $VERSION"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
2004-02-21 21:31:16 +01:00
|
|
|
usage 1
|
2004-01-31 17:11:22 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
ARGS="yes"
|
|
|
|
done
|
|
|
|
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
|
|
|
|
|
|
|
#
|
|
|
|
# Determine where to install the firewall script
|
|
|
|
#
|
2004-02-01 23:50:45 +01:00
|
|
|
DEBIAN=
|
|
|
|
|
2004-01-31 17:11:22 +01:00
|
|
|
if [ -n "$PREFIX" ]; then
|
|
|
|
install -d -o $OWNER -g $GROUP -m 755 ${PREFIX}/sbin
|
|
|
|
install -d -o $OWNER -g $GROUP -m 755 ${PREFIX}${DEST}
|
2004-02-01 23:50:45 +01:00
|
|
|
elif [ -d /etc/apt -a -e /usr/bin/dpkg ]; then
|
|
|
|
DEBIAN=yes
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Change to the directory containing this script
|
|
|
|
#
|
2004-02-02 21:15:44 +01:00
|
|
|
cd "$(dirname $0)"
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
echo "Installing Shorewall Version $VERSION"
|
|
|
|
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
# Check for /etc/shorewall
|
2004-01-31 17:11:22 +01:00
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -d ${PREFIX}/etc/shorewall ]; then
|
2004-01-31 17:11:22 +01:00
|
|
|
first_install=""
|
|
|
|
else
|
|
|
|
first_install="Yes"
|
|
|
|
fi
|
|
|
|
|
2004-02-10 00:52:01 +01:00
|
|
|
install_file_with_backup shorewall ${PREFIX}/sbin/shorewall 0544
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "shorewall control program installed in ${PREFIX}/sbin/shorewall"
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Install the Firewall Script
|
|
|
|
#
|
2004-02-02 00:21:10 +01:00
|
|
|
if [ -n "$DEBIAN" ]; then
|
2004-02-10 00:52:01 +01:00
|
|
|
install_file_with_backup init.debian.sh /etc/init.d/shorewall 0544
|
2004-02-02 00:21:10 +01:00
|
|
|
else
|
2004-05-10 23:15:14 +02:00
|
|
|
install_file_with_backup init.sh ${PREFIX}${DEST}/$INIT 0544
|
2004-02-02 00:21:10 +01:00
|
|
|
fi
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
echo
|
2004-05-10 23:15:14 +02:00
|
|
|
echo "Shorewall script installed in ${PREFIX}${DEST}/$INIT"
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
# Create /etc/shorewall, /usr/share/shorewall and /var/shorewall if needed
|
2004-01-31 17:11:22 +01:00
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
mkdir -p ${PREFIX}/etc/shorewall
|
|
|
|
mkdir -p ${PREFIX}/usr/share/shorewall
|
2004-01-31 17:11:22 +01:00
|
|
|
mkdir -p ${PREFIX}/var/lib/shorewall
|
|
|
|
#
|
|
|
|
# Install the config file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then
|
|
|
|
backup_file /etc/shorewall/shorewall.conf
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the zones file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/zones ]; then
|
|
|
|
backup_file /etc/shorewall/zones
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0744 zones ${PREFIX}/etc/shorewall/zones
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Zones file installed as ${PREFIX}/etc/shorewall/zones"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install the functions file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/functions ]; then
|
|
|
|
backup_file ${PREFIX}/etc/shorewall/functions
|
|
|
|
rm -f ${PREFIX}/etc/shorewall/functions
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
|
2004-02-10 00:52:01 +01:00
|
|
|
install_file_with_backup functions ${PREFIX}/usr/share/shorewall/functions 0444
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Common functions installed in ${PREFIX}/usr/share/shorewall/functions"
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Install the Help file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
install_file_with_backup help ${PREFIX}/usr/share/shorewall/help 0544
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Help command executor installed in ${PREFIX}/usr/share/shorewall/help"
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Delete the icmp.def file
|
|
|
|
#
|
|
|
|
delete_file icmp.def
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install the policy file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/policy ]; then
|
|
|
|
backup_file /etc/shorewall/policy
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 policy ${PREFIX}/etc/shorewall/policy
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Policy file installed as ${PREFIX}/etc/shorewall/policy"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the interfaces file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/interfaces ]; then
|
|
|
|
backup_file /etc/shorewall/interfaces
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 interfaces ${PREFIX}/etc/shorewall/interfaces
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Interfaces file installed as ${PREFIX}/etc/shorewall/interfaces"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
2004-08-19 00:29:09 +02:00
|
|
|
# Install the ipsec file
|
|
|
|
#
|
|
|
|
if [ -f ${PREFIX}/etc/shorewall/ipsec ]; then
|
|
|
|
backup_file /etc/shorewall/ipsec
|
|
|
|
else
|
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 ipsec ${PREFIX}/etc/shorewall/ipsec
|
|
|
|
echo
|
|
|
|
echo "Ipsec file installed as ${PREFIX}/etc/shorewall/ipsec"
|
|
|
|
fi
|
|
|
|
#
|
2004-01-31 17:11:22 +01:00
|
|
|
# Install the hosts file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/hosts ]; then
|
|
|
|
backup_file /etc/shorewall/hosts
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 hosts ${PREFIX}/etc/shorewall/hosts
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Hosts file installed as ${PREFIX}/etc/shorewall/hosts"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the rules file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/rules ]; then
|
|
|
|
backup_file /etc/shorewall/rules
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 rules ${PREFIX}/etc/shorewall/rules
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Rules file installed as ${PREFIX}/etc/shorewall/rules"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the NAT file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/nat ]; then
|
|
|
|
backup_file /etc/shorewall/nat
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 nat ${PREFIX}/etc/shorewall/nat
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "NAT file installed as ${PREFIX}/etc/shorewall/nat"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
2004-03-18 22:36:27 +01:00
|
|
|
# Install the NETMAP file
|
|
|
|
#
|
|
|
|
if [ -f ${PREFIX}/etc/shorewall/netmap ]; then
|
|
|
|
backup_file /etc/shorewall/netmap
|
|
|
|
else
|
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 netmap ${PREFIX}/etc/shorewall/netmap
|
|
|
|
echo
|
|
|
|
echo "NETMAP file installed as ${PREFIX}/etc/shorewall/netmap"
|
|
|
|
fi
|
|
|
|
#
|
2004-01-31 17:11:22 +01:00
|
|
|
# Install the Parameters file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/params ]; then
|
|
|
|
backup_file /etc/shorewall/params
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 params ${PREFIX}/etc/shorewall/params
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Parameter file installed as ${PREFIX}/etc/shorewall/params"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the proxy ARP file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/proxyarp ]; then
|
|
|
|
backup_file /etc/shorewall/proxyarp
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 proxyarp ${PREFIX}/etc/shorewall/proxyarp
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Proxy ARP file installed as ${PREFIX}/etc/shorewall/proxyarp"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the Stopped Routing file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/routestopped ]; then
|
|
|
|
backup_file /etc/shorewall/routestopped
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 routestopped ${PREFIX}/etc/shorewall/routestopped
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Stopped Routing file installed as ${PREFIX}/etc/shorewall/routestopped"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the Mac List file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/maclist ]; then
|
|
|
|
backup_file /etc/shorewall/maclist
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 maclist ${PREFIX}/etc/shorewall/maclist
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "MAC list file installed as ${PREFIX}/etc/shorewall/maclist"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the Masq file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/masq ]; then
|
|
|
|
backup_file /etc/shorewall/masq
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 masq ${PREFIX}/etc/shorewall/masq
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Masquerade file installed as ${PREFIX}/etc/shorewall/masq"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the Modules file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/modules ]; then
|
|
|
|
backup_file /etc/shorewall/modules
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 modules ${PREFIX}/etc/shorewall/modules
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Modules file installed as ${PREFIX}/etc/shorewall/modules"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the TC Rules file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/tcrules ]; then
|
|
|
|
backup_file /etc/shorewall/tcrules
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 tcrules ${PREFIX}/etc/shorewall/tcrules
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "TC Rules file installed as ${PREFIX}/etc/shorewall/tcrules"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install the TOS file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/tos ]; then
|
|
|
|
backup_file /etc/shorewall/tos
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 tos ${PREFIX}/etc/shorewall/tos
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "TOS file installed as ${PREFIX}/etc/shorewall/tos"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the Tunnels file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/tunnels ]; then
|
|
|
|
backup_file /etc/shorewall/tunnels
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 tunnels ${PREFIX}/etc/shorewall/tunnels
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Tunnels file installed as ${PREFIX}/etc/shorewall/tunnels"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the blacklist file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/blacklist ]; then
|
|
|
|
backup_file /etc/shorewall/blacklist
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 blacklist ${PREFIX}/etc/shorewall/blacklist
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Blacklist file installed as ${PREFIX}/etc/shorewall/blacklist"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Backup and remove the whitelist file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/whitelist ]; then
|
|
|
|
backup_file /etc/shorewall/whitelist
|
|
|
|
rm -f ${PREFIX}/etc/shorewall/whitelist
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the rfc1918 file
|
|
|
|
#
|
2004-02-16 22:05:28 +01:00
|
|
|
install_file_with_backup rfc1918 ${PREFIX}/usr/share/shorewall/rfc1918 0600
|
|
|
|
echo
|
2004-04-15 15:51:55 +02:00
|
|
|
echo "RFC 1918 file installed as ${PREFIX}/usr/share/shorewall/rfc1918"
|
2004-01-31 17:11:22 +01:00
|
|
|
#
|
2004-03-17 20:06:54 +01:00
|
|
|
# Install the bogons file
|
|
|
|
#
|
|
|
|
install_file_with_backup bogons ${PREFIX}/usr/share/shorewall/bogons 0600
|
|
|
|
echo
|
2004-04-15 15:51:55 +02:00
|
|
|
echo "Bogon file installed as ${PREFIX}/usr/share/shorewall/bogons"
|
|
|
|
#
|
|
|
|
# Install the default config path file
|
|
|
|
#
|
|
|
|
install_file_with_backup configpath ${PREFIX}/usr/share/shorewall/configpath 0600
|
|
|
|
echo
|
2004-05-24 23:38:44 +02:00
|
|
|
echo " Default config path file installed as ${PREFIX}/usr/share/shorewall/configpath"
|
2004-03-17 20:06:54 +01:00
|
|
|
#
|
2004-01-31 17:11:22 +01:00
|
|
|
# Install the init file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/init ]; then
|
|
|
|
backup_file /etc/shorewall/init
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 init ${PREFIX}/etc/shorewall/init
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Init file installed as ${PREFIX}/etc/shorewall/init"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
2004-05-11 03:47:45 +02:00
|
|
|
# Install the initdone file
|
|
|
|
#
|
|
|
|
if [ -f ${PREFIX}/etc/shorewall/initdone ]; then
|
|
|
|
backup_file /etc/shorewall/initdone
|
|
|
|
else
|
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 initdone ${PREFIX}/etc/shorewall/initdone
|
|
|
|
echo
|
|
|
|
echo "Initdone file installed as ${PREFIX}/etc/shorewall/initdone"
|
|
|
|
fi
|
|
|
|
#
|
2004-01-31 17:11:22 +01:00
|
|
|
# Install the start file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/start ]; then
|
|
|
|
backup_file /etc/shorewall/start
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 start ${PREFIX}/etc/shorewall/start
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Start file installed as ${PREFIX}/etc/shorewall/start"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the stop file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/stop ]; then
|
|
|
|
backup_file /etc/shorewall/stop
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 stop ${PREFIX}/etc/shorewall/stop
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Stop file installed as ${PREFIX}/etc/shorewall/stop"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the stopped file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/stopped ]; then
|
|
|
|
backup_file /etc/shorewall/stopped
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 stopped ${PREFIX}/etc/shorewall/stopped
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Stopped file installed as ${PREFIX}/etc/shorewall/stopped"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the ECN file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/ecn ]; then
|
|
|
|
backup_file /etc/shorewall/ecn
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 ecn ${PREFIX}/etc/shorewall/ecn
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "ECN file installed as ${PREFIX}/etc/shorewall/ecn"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Install the Accounting file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/accounting ]; then
|
|
|
|
backup_file /etc/shorewall/accounting
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 accounting ${PREFIX}/etc/shorewall/accounting
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Accounting file installed as ${PREFIX}/etc/shorewall/accounting"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
# Install the Standard Actions file
|
|
|
|
#
|
2004-02-15 18:52:27 +01:00
|
|
|
install_file_with_backup actions.std ${PREFIX}/usr/share/shorewall/actions.std 0600
|
2004-02-14 17:36:30 +01:00
|
|
|
echo
|
|
|
|
echo "Standard actions file installed as ${PREFIX}/etc/shorewall/actions.std"
|
|
|
|
|
2004-02-10 00:52:01 +01:00
|
|
|
#
|
2004-01-31 17:11:22 +01:00
|
|
|
# Install the Actions file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f ${PREFIX}/etc/shorewall/actions ]; then
|
|
|
|
backup_file /etc/shorewall/actions
|
2004-01-31 17:11:22 +01:00
|
|
|
else
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 actions ${PREFIX}/etc/shorewall/actions
|
2004-01-31 17:11:22 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "Actions file installed as ${PREFIX}/etc/shorewall/actions"
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
#
|
2004-01-31 19:06:14 +01:00
|
|
|
# Install the Action files
|
2004-01-31 17:11:22 +01:00
|
|
|
#
|
2004-01-31 19:06:14 +01:00
|
|
|
for f in action.* ; do
|
2004-02-15 18:52:27 +01:00
|
|
|
if [ -f ${PREFIX}/usr/share/shorewall/$f ]; then
|
|
|
|
backup_file /usr/share/shorewall/$f
|
2004-01-31 19:06:14 +01:00
|
|
|
else
|
2004-02-15 18:52:27 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0600 $f ${PREFIX}/usr/share/shorewall/$f
|
2004-01-31 19:06:14 +01:00
|
|
|
echo
|
2004-05-24 23:38:44 +02:00
|
|
|
echo "Action ${f#*.} file installed as ${PREFIX}/usr/share/shorewall/$f"
|
2004-01-31 19:06:14 +01:00
|
|
|
fi
|
|
|
|
done
|
2004-01-31 17:11:22 +01:00
|
|
|
#
|
|
|
|
# Backup the version file
|
|
|
|
#
|
|
|
|
if [ -z "$PREFIX" ]; then
|
2004-02-10 00:52:01 +01:00
|
|
|
if [ -f /usr/share/shorewall/version ]; then
|
|
|
|
backup_file /usr/share/shorewall/version
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Create the version file
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "$VERSION" > ${PREFIX}/usr/share/shorewall/version
|
|
|
|
chmod 644 ${PREFIX}/usr/share/shorewall/version
|
2004-01-31 17:11:22 +01:00
|
|
|
#
|
|
|
|
# Remove and create the symbolic link to the init script
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ -z "$PREFIX" ]; then
|
2004-02-10 00:52:01 +01:00
|
|
|
rm -f /usr/share/shorewall/init
|
2004-05-10 23:15:14 +02:00
|
|
|
ln -s ${DEST}/${INIT} /usr/share/shorewall/init
|
2004-01-31 17:11:22 +01:00
|
|
|
fi
|
2004-02-15 18:52:27 +01:00
|
|
|
|
2004-01-31 17:11:22 +01:00
|
|
|
#
|
|
|
|
# Install the firewall script
|
|
|
|
#
|
2004-02-10 00:52:01 +01:00
|
|
|
install_file_with_backup firewall ${PREFIX}/usr/share/shorewall/firewall 0544
|
2004-01-31 17:11:22 +01:00
|
|
|
|
|
|
|
if [ -z "$PREFIX" -a -n "$first_install" ]; then
|
2004-01-31 19:06:14 +01:00
|
|
|
if [ -n "$DEBIAN" ]; then
|
2004-02-10 00:52:01 +01:00
|
|
|
run_install -o $OWNER -g $GROUP -m 0644 default.debian /etc/default/shorewall
|
|
|
|
ln -s ../init.d/shorewall /etc/rcS.d/S40shorewall
|
2004-01-31 19:06:14 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "shorewall will start automatically at boot"
|
|
|
|
echo "Set startup=1 in /etc/default/shorewall to enable"
|
2004-01-31 19:06:14 +01:00
|
|
|
else
|
|
|
|
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
|
2004-05-04 20:39:21 +02:00
|
|
|
if insserv /etc/init.d/shorewall ; then
|
2004-01-31 19:06:14 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "shorewall will start automatically at boot"
|
2004-08-02 23:48:40 +02:00
|
|
|
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"
|
2004-01-31 19:06:14 +01:00
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
|
2004-02-10 00:52:01 +01:00
|
|
|
if chkconfig --add shorewall ; then
|
2004-01-31 19:06:14 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "shorewall will start automatically in run levels as follows:"
|
2004-08-02 23:48:40 +02:00
|
|
|
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"
|
2004-02-10 00:52:01 +01:00
|
|
|
chkconfig --list shorewall
|
2004-01-31 19:06:14 +01:00
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
elif [ -x /sbin/rc-update ]; then
|
2004-02-10 00:52:01 +01:00
|
|
|
if rc-update add shorewall default; then
|
2004-01-31 19:06:14 +01:00
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "shorewall will start automatically at boot"
|
2004-08-02 23:48:40 +02:00
|
|
|
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"
|
2004-01-31 19:06:14 +01:00
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
2004-05-10 23:15:14 +02:00
|
|
|
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
|
2004-01-31 17:11:22 +01:00
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Report Success
|
|
|
|
#
|
|
|
|
echo
|
2004-02-10 00:52:01 +01:00
|
|
|
echo "shorewall Version $VERSION Installed"
|