Compare commits

..

9 Commits

Author SHA1 Message Date
Tom Eastep
a98c1d5b35 Correct convertion of tcrules->mangle when a writable mangle exists
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 15:23:58 -08:00
Tom Eastep
928f54d37c Correct logging in inline policy actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 13:37:59 -08:00
Tom Eastep
073235aa48 Correct typo in action.AllowICMPs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 13:03:49 -08:00
Tom Eastep
519fef5e87 Clear the firewall on Debian systemd 'stop' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 11:53:47 -08:00
Tom Eastep
944651e46d Correct compiler directives WRT omitting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 11:51:40 -08:00
Tom Eastep
bdf0950317 Correct the handling of tcp-reset
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 11:44:45 -08:00
Tom Eastep
2fb1f9db01 Change AllowICMPs to an inline action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 11:41:05 -08:00
Tom Eastep
c3661ad476 Change macro.ICMPs to an inline action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 11:30:38 -08:00
Tom Eastep
a4dcc3f555 Restore logging to the BLACKLIST action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-03 10:19:07 -08:00
179 changed files with 19857 additions and 5008 deletions

View File

@@ -190,7 +190,7 @@ for p in ${!params[@]}; do
done done
echo '#' > shorewallrc echo '#' > shorewallrc
echo "# Created by Shorewall Core version $VERSION configure - " `date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}"` >> shorewallrc echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc
echo "# rc file: $rcfile" >> shorewallrc echo "# rc file: $rcfile" >> shorewallrc
echo '#' >> shorewallrc echo '#' >> shorewallrc

View File

@@ -173,12 +173,7 @@ my $outfile;
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!"; open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
if ( $ENV{SOURCE_DATE_EPOCH} ) { printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s\n", VERSION, `date --utc --date=\"\@$ENV{SOURCE_DATE_EPOCH}\"`;
} else {
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
}
print $outfile "# rc file: $rcfilename\n#\n"; print $outfile "# rc file: $rcfilename\n#\n";
print $outfile "# Input: @ARGV\n#\n" if @ARGV; print $outfile "# Input: @ARGV\n#\n" if @ARGV;

View File

@@ -22,20 +22,64 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <http://www.gnu.org/licenses/>.
# #
VERSION=xxx # The Build script inserts the actual version VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall-core PRODUCT=shorewall-core
Product="Shorewall Core" Product="Shorewall Core"
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]" echo "usage: $ME [ <configuration-file> ] "
echo "where <option> is one of" echo " $ME -v"
echo " -h" echo " $ME -h"
echo " -v"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure shorewall to start automatically at boot" >&2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
install_file() # $1 = source $2 = target $3 = mode install_file() # $1 = source $2 = target $3 = mode
{ {
if cp -f $1 $2; then if cp -f $1 $2; then
@@ -54,16 +98,16 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1 exit 1
} }
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
#
# Source common functions
#
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
# #
# Parse the run line # Parse the run line
# #
@@ -82,7 +126,7 @@ while [ $finished -eq 0 ]; do
usage 0 usage 0
;; ;;
v) v)
echo "$Product Firewall Installer Version $VERSION" echo "Shorewall Firewall Installer Version $VERSION"
exit 0 exit 0
;; ;;
*) *)
@@ -104,14 +148,14 @@ done
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc
file=./shorewallrc file=./shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
file=~/.shorewallrc file=~/.shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc
file=/usr/share/shorewall/shorewallrc file=/usr/share/shorewall/shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -125,7 +169,7 @@ elif [ $# -eq 1 ]; then
;; ;;
esac esac
. $file || fatal_error "Can not load the RC file: $file" . $file
else else
usage 1 usage 1
fi fi
@@ -241,12 +285,13 @@ case "$HOST" in
debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt) debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt)
;; ;;
*) *)
fatal_error "Unknown HOST \"$HOST\"" echo "ERROR: Unknown HOST \"$HOST\"" >&2
exit 1;
;; ;;
esac esac
if [ -z "$file" ]; then if [ -z "$file" ]; then
if [ $HOST = linux ]; then if $HOST = linux; then
file=shorewallrc.default file=shorewallrc.default
else else
file=shorewallrc.${HOST} file=shorewallrc.${HOST}
@@ -259,8 +304,7 @@ if [ -z "$file" ]; then
echo "" >&2 echo "" >&2
echo "Example:" >&2 echo "Example:" >&2
echo "" >&2 echo "" >&2
echo " ./install.sh $file" >&2 echo " ./install.sh $file" &>2
exit 1
fi fi
if [ -n "$DESTDIR" ]; then if [ -n "$DESTDIR" ]; then
@@ -271,31 +315,45 @@ if [ -n "$DESTDIR" ]; then
fi fi
fi fi
echo "Installing $Product Version $VERSION" echo "Installing Shorewall Core Version $VERSION"
# #
# Create directories # Create directories
# #
make_parent_directory ${DESTDIR}${LIBEXECDIR}/shorewall 0755 mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall
chmod 755 ${DESTDIR}${LIBEXECDIR}/shorewall
make_parent_directory ${DESTDIR}${SHAREDIR}/shorewall 0755 mkdir -p ${DESTDIR}${SHAREDIR}/shorewall
chmod 755 ${DESTDIR}${SHAREDIR}/shorewall
make_parent_directory ${DESTDIR}${CONFDIR} 0755 mkdir -p ${DESTDIR}${CONFDIR}
chmod 755 ${DESTDIR}${CONFDIR}
[ -n "${SYSCONFDIR}" ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755 if [ -n "${SYSCONFDIR}" ]; then
mkdir -p ${DESTDIR}${SYSCONFDIR}
chmod 755 ${DESTDIR}${SYSCONFDIR}
fi
if [ -z "${SERVICEDIR}" ]; then if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD" SERVICEDIR="$SYSTEMD"
fi fi
[ -n "${SERVICEDIR}" ] && make_parent_directory ${DESTDIR}${SERVICEDIR} 0755 if [ -n "${SERVICEDIR}" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR}
chmod 755 ${DESTDIR}${SERVICEDIR}
fi
make_parent_directory ${DESTDIR}${SBINDIR} 0755 mkdir -p ${DESTDIR}${SBINDIR}
chmod 755 ${DESTDIR}${SBINDIR}
[ -n "${MANDIR}" ] && make_parent_directory ${DESTDIR}${MANDIR} 0755 if [ -n "${MANDIR}" ]; then
mkdir -p ${DESTDIR}${MANDIR}
chmod 755 ${DESTDIR}${MANDIR}
fi
if [ -n "${INITFILE}" ]; then if [ -n "${INITFILE}" ]; then
make_parent_directory ${DESTDIR}${INITDIR} 0755 mkdir -p ${DESTDIR}${INITDIR}
chmod 755 ${DESTDIR}${INITDIR}
if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then
install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544 install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544
@@ -324,14 +382,8 @@ echo "wait4ifup installed in ${DESTDIR}${LIBEXECDIR}/shorewall/wait4ifup"
# Install the libraries # Install the libraries
# #
for f in lib.* ; do for f in lib.* ; do
case $f in install_file $f ${DESTDIR}${SHAREDIR}/shorewall/$f 0644
*installer) echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/shorewall/$f"
;;
*)
install_file $f ${DESTDIR}${SHAREDIR}/shorewall/$f 0644
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/shorewall/$f"
;;
esac
done done
if [ $SHAREDIR != /usr/share ]; then if [ $SHAREDIR != /usr/share ]; then
@@ -346,11 +398,11 @@ fi
if [ -n "$MANDIR" ]; then if [ -n "$MANDIR" ]; then
cd manpages cd manpages
[ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man8 0755 [ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man8/
for f in *.8; do for f in *.8; do
gzip -9c $f > $f.gz gzip -9c $f > $f.gz
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 0644 install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 644
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz" echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
done done
@@ -367,7 +419,7 @@ ln -sf lib.base ${DESTDIR}${SHAREDIR}/shorewall/functions
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion
chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion chmod 644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion
if [ -z "${DESTDIR}" ]; then if [ -z "${DESTDIR}" ]; then
if [ $update -ne 0 ]; then if [ $update -ne 0 ]; then
@@ -392,20 +444,14 @@ fi
if [ ${SHAREDIR} != /usr/share ]; then if [ ${SHAREDIR} != /usr/share ]; then
for f in lib.*; do for f in lib.*; do
case $f in if [ $BUILD != apple ]; then
*installer) eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
;; else
*) eval sed -i \'\' -e \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
if [ $BUILD != apple ]; then fi
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
else
eval sed -i \'\' -e \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
fi
;;
esac
done done
fi fi
# #
# Report Success # Report Success
# #
echo "$Product Version $VERSION Installed" echo "Shorewall Core Version $VERSION Installed"

View File

@@ -25,7 +25,7 @@
# loaded after this one and replaces some of the functions declared here. # loaded after this one and replaces some of the functions declared here.
# #
SHOREWALL_CAPVERSION=50106 SHOREWALL_CAPVERSION=50100
if [ -z "$g_basedir" ]; then if [ -z "$g_basedir" ]; then
# #
@@ -2803,8 +2803,6 @@ determine_capabilities() {
WAIT_OPTION= WAIT_OPTION=
CPU_FANOUT= CPU_FANOUT=
NETMAP_TARGET= NETMAP_TARGET=
NFLOG_SIZE=
RESTORE_WAIT_OPTION=
AMANDA_HELPER= AMANDA_HELPER=
FTP_HELPER= FTP_HELPER=
@@ -2828,11 +2826,9 @@ determine_capabilities() {
qt $arptables -L OUT && ARPTABLESJF=Yes qt $arptables -L OUT && ARPTABLESJF=Yes
fi fi
[ -z "$(${g_tool}-restore --wait < /dev/null 2>&1)" ] && RESTORE_WAIT_OPTION=Yes
if qt $g_tool --wait -t filter -L INPUT -n -v; then if qt $g_tool --wait -t filter -L INPUT -n -v; then
WAIT_OPTION=Yes WAIT_OPTION=Yes
g_tool="$g_tool --wait" tool="$tool --wait"
fi fi
chain=fooX$$ chain=fooX$$
@@ -3140,13 +3136,10 @@ determine_capabilities() {
qt $g_tool -A $chain -j LOGMARK && LOGMARK_TARGET=Yes qt $g_tool -A $chain -j LOGMARK && LOGMARK_TARGET=Yes
qt $g_tool -A $chain -j LOG || LOG_TARGET= qt $g_tool -A $chain -j LOG || LOG_TARGET=
qt $g_tool -A $chain -j ULOG && ULOG_TARGET=Yes qt $g_tool -A $chain -j ULOG && ULOG_TARGET=Yes
qt $g_tool -A $chain -j NFLOG && NFLOG_TARGET=Yes
qt $g_tool -A $chain -j MARK --set-mark 5 && MARK_ANYWHERE=Yes qt $g_tool -A $chain -j MARK --set-mark 5 && MARK_ANYWHERE=Yes
qt $g_tool -A $chain -m statistic --mode nth --every 2 --packet 1 && STATISTIC_MATCH=Yes qt $g_tool -A $chain -m statistic --mode nth --every 2 --packet 1 && STATISTIC_MATCH=Yes
qt $g_tool -A $chain -m geoip --src-cc US && GEOIP_MATCH=Yes qt $g_tool -A $chain -m geoip --src-cc US && GEOIP_MATCH=Yes
if qt $g_tool -A $chain -j NFLOG; then
NFLOG_TARGET=Yes
qt $g_tool -A $chain -j NFLOG --nflog-size 64 && NFLOG_SIZE=Yes
fi
if [ $g_family -eq 4 ]; then if [ $g_family -eq 4 ]; then
qt $g_tool -A $chain -j ACCOUNT --addr 192.168.1.0/29 --tname $chain && ACCOUNT_TARGET=Yes qt $g_tool -A $chain -j ACCOUNT --addr 192.168.1.0/29 --tname $chain && ACCOUNT_TARGET=Yes
@@ -3302,11 +3295,9 @@ report_capabilities_unsorted() {
if [ $g_family -eq 4 ]; then if [ $g_family -eq 4 ]; then
report_capability "iptables -S (IPTABLES_S)" $IPTABLES_S report_capability "iptables -S (IPTABLES_S)" $IPTABLES_S
report_capability "iptables --wait option (WAIT_OPTION)" $WAIT_OPTION report_capability "iptables --wait option (WAIT_OPTION)" $WAIT_OPTION
report_capability "iptables-restore --wait option (RESTORE_WAIT_OPTION)" $RESTORE_WAIT_OPTION
else else
report_capability "ip6tables -S (IPTABLES_S)" $IPTABLES_S report_capability "ip6tables -S (IPTABLES_S)" $IPTABLES_S
report_capability "ip6tables --wait option (WAIT_OPTION)" $WAIT_OPTION report_capability "ip6tables --wait option (WAIT_OPTION)" $WAIT_OPTION
report_capability "ip6tables-restore --wait option (RESTORE_WAIT_OPTION)" $RESTORE_WAIT_OPTION
fi fi
report_capability "Basic Filter (BASIC_FILTER)" $BASIC_FILTER report_capability "Basic Filter (BASIC_FILTER)" $BASIC_FILTER
@@ -3314,7 +3305,6 @@ report_capabilities_unsorted() {
report_capability "CT Target (CT_TARGET)" $CT_TARGET report_capability "CT Target (CT_TARGET)" $CT_TARGET
report_capability "NFQUEUE CPU Fanout (CPU_FANOUT)" $CPU_FANOUT report_capability "NFQUEUE CPU Fanout (CPU_FANOUT)" $CPU_FANOUT
report_capability "NETMAP Target (NETMAP_TARGET)" $NETMAP_TARGET report_capability "NETMAP Target (NETMAP_TARGET)" $NETMAP_TARGET
report_capability "--nflog-size support (NFLOG_SIZE)" $NFLOG_SIZE
echo " Kernel Version (KERNELVERSION): $KERNELVERSION" echo " Kernel Version (KERNELVERSION): $KERNELVERSION"
echo " Capabilities Version (CAPVERSION): $CAPVERSION" echo " Capabilities Version (CAPVERSION): $CAPVERSION"
@@ -3421,8 +3411,6 @@ report_capabilities_unsorted1() {
report_capability1 WAIT_OPTION report_capability1 WAIT_OPTION
report_capability1 CPU_FANOUT report_capability1 CPU_FANOUT
report_capability1 NETMAP_TARGET report_capability1 NETMAP_TARGET
report_capability1 NFLOG_SIZE
report_capability1 RESTORE_WAIT_OPTION
report_capability1 AMANDA_HELPER report_capability1 AMANDA_HELPER
report_capability1 FTP_HELPER report_capability1 FTP_HELPER
@@ -4276,17 +4264,12 @@ usage() # $1 = exit status
echo " reenable <interface>" echo " reenable <interface>"
ecko " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]" ecko " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]"
echo " reject <address> ..." echo " reject <address> ..."
ecko " reload [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
if [ -n "$g_lite" ]; then
echo " reload [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]"
else
echo " reload [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ <directory> ]"
fi
if [ -z "$g_lite" ]; then if [ -z "$g_lite" ]; then
echo " remote-reload [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>" echo " remote-reload [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " remote-restart [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>" echo " remote-restart [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " remote-start [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>" echo " remote-start [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
fi fi
echo " reset [ <chain> ... ]" echo " reset [ <chain> ... ]"

View File

@@ -1,89 +0,0 @@
#
#
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer.
#
# (c) 2017 - Tom Eastep (teastep@shorewall.net)
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
#
# Complete documentation is available at http://shorewall.net
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# 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, see <http://www.gnu.org/licenses/>.
#
# The purpose of this library is to hold those functions used by the products installer.
#
#########################################################################################
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
make_directory() # $1 = directory , $2 = mode
{
mkdir $1
chmod $2 $1
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}
make_parent_directory() # $1 = directory , $2 = mode
{
mkdir -p $1
chmod $2 $1
[ -n "$OWNERSHIP" ] && chown $OWNER:$GROUP $1
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure $Product to start automatically at boot" >&2
}

View File

@@ -1,106 +0,0 @@
#
#
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer.
#
# (c) 2017 - Tom Eastep (teastep@shorewall.net)
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
#
# Complete documentation is available at http://shorewall.net
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# 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, see <http://www.gnu.org/licenses/>.
#
# The purpose of this library is to hold those functions used by the products uninstaller.
#
#########################################################################################
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to remove
{
if [ -n "$1" ] ; then
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
fi
}
remove_directory() # $1 = directory to remove
{
if [ -n "$1" ] ; then
if [ -d $1 ] ; then
rm -rf $1
echo "$1 Removed"
fi
fi
}
remove_file_with_wildcard() # $1 = file with wildcard to remove
{
if [ -n "$1" ] ; then
for f in $1; do
if [ -d $f ] ; then
rm -rf $f
echo "$f Removed"
elif [ -f $f -o -L $f ] ; then
rm -f $f
echo "$f Removed"
fi
done
fi
}
restore_file() # $1 = file to restore
{
if [ -f ${1}-shorewall.bkout ]; then
if (mv -f ${1}-shorewall.bkout $1); then
echo
echo "$1 restored"
else
exit 1
fi
fi
}

View File

@@ -432,33 +432,6 @@
<arg choice="plain"><replaceable>address</replaceable></arg> <arg choice="plain"><replaceable>address</replaceable></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis>
<command>shorewall[6][-lite]</command>
<arg
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
<arg>options</arg>
<arg choice="plain"><option>reload</option></arg>
<arg><option>-n</option></arg>
<arg><option>-p</option><arg><option>-d</option></arg></arg>
<arg><option>-f</option></arg>
<arg><option>-c</option></arg>
<arg><option>-T</option></arg>
<arg><option>-i</option></arg>
<arg><option>-C</option></arg>
<arg><replaceable>directory</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
<command>shorewall[6]</command> <command>shorewall[6]</command>
@@ -1943,11 +1916,10 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">remote-start</emphasis> <term><emphasis role="bold">remote-start</emphasis>
[-<option>n</option>] [-<option>s</option>] [-<option>c</option>] [-<option>s</option>] [-<option>c</option>] [-<option>r</option>
[-<option>r</option> <replaceable>root-user-name</replaceable>] <replaceable>root-user-name</replaceable>] [-<option>T</option>]
[-<option>T</option>] [-<option>i</option>] [ [ -D ] [-<option>i</option>] [ [ -D ] <replaceable>directory</replaceable> ]
<replaceable>directory</replaceable> ] [ [ <replaceable>system</replaceable> ]</term>
<replaceable>system</replaceable> ]</term>
<listitem> <listitem>
<para>This command was renamed from <command>load</command> in <para>This command was renamed from <command>load</command> in
@@ -1983,9 +1955,6 @@
<replaceable>directory</replaceable>, then the <option>-D</option> <replaceable>directory</replaceable>, then the <option>-D</option>
option must be given.</para> option must be given.</para>
<para>The <option>-n</option> option causes Shorewall to avoid
updating the routing table(s).</para>
<para>If <emphasis role="bold">-s</emphasis> is specified and the <para>If <emphasis role="bold">-s</emphasis> is specified and the
<emphasis role="bold">start</emphasis> command succeeds, then the <emphasis role="bold">start</emphasis> command succeeds, then the
remote Shorewall-lite configuration is saved by executing <emphasis remote Shorewall-lite configuration is saved by executing <emphasis
@@ -3173,8 +3142,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/</para> <para>/etc/shorewall/</para>
<para>/etc/shorewall6/</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -3184,17 +3151,13 @@
url="/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink></para> url="/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink></para>
<para>shorewall-accounting(5), shorewall-actions(5), <para>shorewall-accounting(5), shorewall-actions(5),
shorewall-arprules(5), shorewall-blrules(5), shorewall.conf(5), shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-conntrack(5), shorewall-ecn(5), shorewall-exclusion(5), shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-hosts(5), shorewall-init(5), shorewall_interfaces(5), shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-mangle(5),
shorewall-masq(5), shorewall-modules(5), shorewall-nat(5),
shorewall-nesting(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5), shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall6-proxyndp(5), shorewall-routes(5), shorewall-rtrules(5), shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall-rtrules(5), shorewall-rules(5), shorewall-secmarks(5), shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-snat(5), shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-tcdevices(5), shorewall-tcrules(5), shorewall-tos(5),
shorewall-tcfilters(5), shorewall-tcinterfaces(5), shorewall-tcpri(5), shorewall-tunnels(5), shorewall-zones(5)</para>
shorewall-tunnels(5), shorewall-vardir(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -1,5 +1,5 @@
# #
# Debian Shorewall 5.0 rc file # Debian Shorewall 4.5 rc file
# #
BUILD= #Default is to detect the build system BUILD= #Default is to detect the build system
HOST=debian HOST=debian
@@ -14,7 +14,7 @@ INITDIR= #Directory where SysV init scripts are installed.
INITFILE= #Name of the product's installed SysV init script INITFILE= #Name of the product's installed SysV init script
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed ANNOTATED= #If non-zero, annotated configuration files are installed
SYSCONFFILE=default.debian.systemd #Name of the distributed file to be installed in $SYSCONFDIR SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR
SERVICEFILE=$PRODUCT.service.debian #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service SERVICEFILE=$PRODUCT.service.debian #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only) SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)

View File

@@ -1,5 +1,5 @@
# #
# Debian Shorewall 5.0 rc file # Debian Shorewall 4.5 rc file
# #
BUILD= #Default is to detect the build system BUILD= #Default is to detect the build system
HOST=debian HOST=debian
@@ -14,7 +14,7 @@ INITDIR=/etc/init.d #Directory where SysV init scripts are i
INITFILE=$PRODUCT #Name of the product's installed SysV init script INITFILE=$PRODUCT #Name of the product's installed SysV init script
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed ANNOTATED= #If non-zero, annotated configuration files are installed
SYSCONFFILE=default.debian.sysvinit #Name of the distributed file to be installed in $SYSCONFDIR SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
SERVICEDIR= #Directory where .service files are installed (systems running systemd only) SERVICEDIR= #Directory where .service files are installed (systems running systemd only)

View File

@@ -1,8 +1,8 @@
# #
# Default Shorewall 5.0 rc file # Default Shorewall 5.0 rc file
# #
BUILD= #Default is to detect the build system
HOST=linux #Generic Linux HOST=linux #Generic Linux
BUILD= #Default is to detect the build system
PREFIX=/usr #Top-level directory for shared files, libraries, etc. PREFIX=/usr #Top-level directory for shared files, libraries, etc.
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files. SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts. LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.

View File

@@ -1,8 +1,8 @@
# #
# OpenWRT Shorewall 5.0 rc file # Created by Shorewall Core version 5.0.2-RC1 configure - Fri, Nov 06, 2015 10:02:03 AM
#
# Input: host=openwrt
# #
BUILD= #Default is to detect the build system
HOST=openwrt
PREFIX=/usr #Top-level directory for shared files, libraries, etc. PREFIX=/usr #Top-level directory for shared files, libraries, etc.
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files. SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts. LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Script to back uninstall Shoreline Firewall Core Modules # Script to back uninstall Shoreline Firewall
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# #
@@ -26,75 +26,63 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx # The Build script inserts the actual version VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall-core PRODUCT="shorewall-core"
Product="Shorewall Core" Product="Shorewall Core"
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]" echo "usage: $ME [ <shorewallrc file> ]"
echo "where <option> is one of"
echo " -h"
echo " -v"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
}
restore_file() # $1 = file to restore
{
if [ -f ${1}-shorewall.bkout ]; then
if (mv -f ${1}-shorewall.bkout $1); then
echo
echo "$1 restored"
else
exit 1
fi
fi
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
#
# Source common functions
#
. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; }
#
# Parse the run line
#
finished=0
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Uninstaller Version $VERSION"
exit 0
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
# #
# Read the RC file # Read the RC file
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc" . ./shorewallrc
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc" . ~/.shorewallrc || exit 1
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc" . /usr/share/shorewall/shorewallrc
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -104,11 +92,11 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file || exit 1 file=./$file
;; ;;
esac esac
. $file || fatal_error "Can not load the RC file: $file" . $file
else else
usage 1 usage 1
fi fi
@@ -116,26 +104,20 @@ fi
if [ -f ${SHAREDIR}/shorewall/coreversion ]; then if [ -f ${SHAREDIR}/shorewall/coreversion ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)" INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: $Product Version $INSTALLED_VERSION is installed" echo "WARNING: Shorewall Core Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller." echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION" VERSION="$INSTALLED_VERSION"
fi fi
else else
echo "WARNING: $Product Version $VERSION is not installed" echo "WARNING: Shorewall Core Version $VERSION is not installed"
VERSION="" VERSION=""
fi fi
echo "Uninstalling $Product $VERSION" echo "Uninstalling Shorewall Core $VERSION"
if [ -n "${MANDIR}" ]; then rm -rf ${SHAREDIR}/shorewall
remove_file_with_wildcard ${MANDIR}/man5/shorewall\* rm -f ~/.shorewallrc
remove_file_with_wildcard ${MANDIR}/man8/shorewall\*
fi echo "Shorewall Core Uninstalled"
remove_directory ${SHAREDIR}/shorewall
remove_file ~/.shorewallrc
#
# Report Success
#
echo "$Product $VERSION Uninstalled"

View File

@@ -1,21 +0,0 @@
# List the Shorewall products that Shorewall-init is to
# initialize (space-separated list).
#
# Sample: PRODUCTS="shorewall shorewall6"
#
PRODUCTS=""
#
# Set this to 1 if you want Shorewall-init to react to
# ifup/ifdown and NetworkManager events
#
IFUPDOWN=0
#
# Where Up/Down events get logged
#
LOGFILE=/var/log/shorewall-ifupdown.log
# Startup options - set verbosity to 0 (minimal reporting)
OPTIONS="-V0"
# IOF

View File

@@ -1,27 +0,0 @@
# List the Shorewall products that Shorewall-init is to
# initialize (space-separated list).
#
# Sample: PRODUCTS="shorewall shorewall6"
#
PRODUCTS=""
#
# Set this to 1 if you want Shorewall-init to react to
# ifup/ifdown and NetworkManager events
#
IFUPDOWN=0
#
# Set this to the name of the file that is to hold
# ipset contents. Shorewall-init will load those ipsets
# during 'start' and will save them there during 'stop'.
#
SAVE_IPSETS=""
#
# Where Up/Down events get logged
#
LOGFILE=/var/log/shorewall-ifupdown.log
# Startup options - set verbosity to 0 (minimal reporting)
OPTIONS="-V0"
# IOF

View File

@@ -27,21 +27,58 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
VERSION=xxx # The Build script inserts the actual version VERSION=xxx #The Build script inserts the actual version.
PRODUCT=shorewall-init PRODUCT=shorewall-init
Product="Shorewall Init" Product="Shorewall Init"
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]" echo "usage: $ME [ <configuration-file> ]"
echo "where <option> is one of" echo " $ME -v"
echo " -h" echo " $ME -h"
echo " -v" echo " $ME -n"
echo " -n"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure shorewall init to start automatically at boot" >&2
}
install_file() # $1 = source $2 = target $3 = mode install_file() # $1 = source $2 = target $3 = mode
{ {
if cp -f $1 $2; then if cp -f $1 $2; then
@@ -60,16 +97,23 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1 exit 1
} }
make_directory() # $1 = directory , $2 = mode
{
mkdir -p $1
chmod 0755 $1
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
#
# Source common functions
#
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
# #
# Parse the run line # Parse the run line
# #
@@ -90,7 +134,7 @@ while [ $finished -eq 0 ] ; do
usage 0 usage 0
;; ;;
v) v)
echo "$Product Firewall Installer Version $VERSION" echo "Shorewall-init Firewall Installer Version $VERSION"
exit 0 exit 0
;; ;;
n*) n*)
@@ -115,17 +159,17 @@ done
# Read the RC file # Read the RC file
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
#
# Load packager's settings if any
#
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc || exit 1
file=./shorewallrc file=./shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
file=~/.shorewallrc file=~/.shorewallrc
. $file || fatal_error "Can not load the RC file: $file" else
elif [ -f /usr/share/shorewall/shorewallrc ]; then fatal_error "No configuration file specified and ~/.shorewallrc not found"
file=/usr/share/shorewall/shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
elif [ $# -eq 1 ]; then elif [ $# -eq 1 ]; then
file=$1 file=$1
@@ -133,11 +177,11 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file || exit 1 file=./$file
;; ;;
esac esac
. $file || fatal_error "Can not load the RC file: $file" . $file
else else
usage 1 usage 1
fi fi
@@ -254,10 +298,12 @@ case "$HOST" in
echo "Installing Openwrt-specific configuration..." echo "Installing Openwrt-specific configuration..."
;; ;;
linux) linux)
fatal_error "Shorewall-init is not supported on this system" echo "ERROR: Shorewall-init is not supported on this system" >&2
exit 1
;; ;;
*) *)
fatal_error "Unsupported HOST distribution: \"$HOST\"" echo "ERROR: Unsupported HOST distribution: \"$HOST\"" >&2
exit 1;
;; ;;
esac esac
@@ -269,27 +315,30 @@ if [ -n "$DESTDIR" ]; then
OWNERSHIP="" OWNERSHIP=""
fi fi
make_parent_directory ${DESTDIR}${INITDIR} 0755 make_directory ${DESTDIR}${INITDIR} 0755
fi fi
echo "Installing $Product Version $VERSION" echo "Installing Shorewall Init Version $VERSION"
# #
# Check for /usr/share/shorewall-init/version # Check for /usr/share/shorewall-init/version
# #
if [ -f ${DESTDIR}${SHAREDIR}/$PRODUCT/version ]; then if [ -f ${DESTDIR}${SHAREDIR}/shorewall-init/version ]; then
first_install="" first_install=""
else else
first_install="Yes" first_install="Yes"
fi fi
[ -n "$DESTDIR" ] && make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755 if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
chmod 0755 ${DESTDIR}${CONFDIR}/logrotate.d
fi
# #
# Install the Firewall Script # Install the Firewall Script
# #
if [ -n "$INITFILE" ]; then if [ -n "$INITFILE" ]; then
make_parent_directory ${DESTDIR}${INITDIR} 0755 mkdir -p ${DESTDIR}${INITDIR}
install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544 install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE
@@ -308,21 +357,25 @@ if [ -z "${SERVICEDIR}" ]; then
fi fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
make_parent_directory ${DESTDIR}${SERVICEDIR} 0755 mkdir -p ${DESTDIR}${SERVICEDIR}
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644 install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service" echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
[ -n "$DESTDIR" -o $configure -eq 0 ] && make_parent_directory ${DESTDIR}${SBINDIR} 0755 if [ -n "$DESTDIR" -o $configure -eq 0 ]; then
install_file $PRODUCT ${DESTDIR}${SBINDIR}/$PRODUCT 0700 mkdir -p ${DESTDIR}${SBINDIR}
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/$PRODUCT chmod 0755 ${DESTDIR}${SBINDIR}
echo "CLI installed as ${DESTDIR}${SBINDIR}/$PRODUCT" fi
install_file shorewall-init ${DESTDIR}${SBINDIR}/shorewall-init 0700
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/shorewall-init
echo "CLI installed as ${DESTDIR}${SBINDIR}/shorewall-init"
fi fi
# #
# Create /usr/share/shorewall-init if needed # Create /usr/share/shorewall-init if needed
# #
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT 0755 mkdir -p ${DESTDIR}${SHAREDIR}/shorewall-init
chmod 0755 ${DESTDIR}${SHAREDIR}/shorewall-init
# #
# Install logrotate file # Install logrotate file
@@ -335,53 +388,55 @@ fi
# #
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/$PRODUCT/version echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/shorewall-init/version
chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall-init/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
if [ -z "$DESTDIR" ]; then if [ -z "$DESTDIR" ]; then
rm -f ${SHAREDIR}/$PRODUCT/init rm -f ${SHAREDIR}/shorewall-init/init
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/$PRODUCT/init ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/shorewall-init/init
fi fi
if [ $HOST = debian ]; then if [ $HOST = debian ]; then
if [ -n "${DESTDIR}" ]; then if [ -n "${DESTDIR}" ]; then
make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755 mkdir -p ${DESTDIR}${ETC}/network/if-up.d/
make_parent_directory ${DESTDIR}${ETC}/network/if-down.d 0755 mkdir -p ${DESTDIR}${ETC}/network/if-down.d/
make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755 mkdir -p ${DESTDIR}${ETC}/network/if-post-down.d/
elif [ $configure -eq 0 ]; then elif [ $configure -eq 0 ]; then
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-up.d 0755 mkdir -p ${DESTDIR}${CONFDIR}/network/if-up.d/
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-down.d 0755 mkdir -p ${DESTDIR}${CONFDIR}/network/if-down.d/
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-post-down.d 0755 mkdir -p ${DESTDIR}${CONFDIR}/network/if-post-down.d/
fi fi
if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then if [ ! -f ${DESTDIR}${CONFDIR}/default/shorewall-init ]; then
[ -n "${DESTDIR}" ] && make_parent_directory ${DESTDIR}${ETC}/default 0755 if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}${ETC}/default
fi
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/default 0755 [ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default
install_file ${SYSCONFFILE} ${DESTDIR}${ETC}/default/$PRODUCT 0644 install_file sysconfig ${DESTDIR}${ETC}/default/shorewall-init 0644
echo "${SYSCONFFILE} file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}" echo "sysconfig file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
fi fi
IFUPDOWN=ifupdown.debian.sh IFUPDOWN=ifupdown.debian.sh
else else
if [ -n "$DESTDIR" ]; then if [ -n "$DESTDIR" ]; then
make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755 mkdir -p ${DESTDIR}${SYSCONFDIR}
if [ -z "$RPM" ]; then if [ -z "$RPM" ]; then
if [ $HOST = suse ]; then if [ $HOST = suse ]; then
make_parent_directory ${DESTDIR}${ETC}/sysconfig/network/if-up.d 0755 mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-up.d
make_parent_directory ${DESTDIR}${ETC}/sysconfig/network/if-down.d 0755 mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-down.d
elif [ $HOST = gentoo ]; then elif [ $HOST = gentoo ]; then
# Gentoo does not support if-{up,down}.d # Gentoo does not support if-{up,down}.d
/bin/true /bin/true
elif [ $HOST = openwrt ]; then elif [ $HOST = openwrt ]; then
# Not implemented on OpenWRT # Not implemented on openwrt
/bin/true /bin/true
else else
make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755 mkdir -p ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d
fi fi
fi fi
fi fi
@@ -403,13 +458,13 @@ if [ $HOST != openwrt ]; then
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755 mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown 0544 install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
fi fi
if [ -d ${DESTDIR}/etc/NetworkManager ]; then if [ -d ${DESTDIR}/etc/NetworkManager ]; then
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755 [ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544 install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
fi fi
@@ -428,8 +483,8 @@ case $HOST in
suse) suse)
if [ -z "$RPM" ]; then if [ -z "$RPM" ]; then
if [ $configure -eq 0 ]; then if [ $configure -eq 0 ]; then
make_parent_directory ${DESTDIR}${SYSCONFDIR}/network/if-up.d 0755 mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-up.d/
make_parent_directory ${DESTDIR}${SYSCONFDIR}/network/if-down.d 0755 mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-down.d/
fi fi
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544 install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544
@@ -463,17 +518,17 @@ if [ -z "$DESTDIR" ]; then
if [ $HOST = debian ]; then if [ $HOST = debian ]; then
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
if systemctl enable ${PRODUCT}.service; then if systemctl enable ${PRODUCT}.service; then
echo "$Product will start automatically at boot" echo "Shorewall Init will start automatically at boot"
fi fi
elif mywhich insserv; then elif mywhich insserv; then
if insserv ${INITDIR}/$PRODUCT; then if insserv ${INITDIR}/shorewall-init; then
echo "$Product will start automatically at boot" echo "Shorewall Init will start automatically at boot"
else else
cant_autostart cant_autostart
fi fi
elif mywhich update-rc.d ; then elif mywhich update-rc.d ; then
if update-rc.d $PRODUCT enable; then if update-rc.d $PRODUCT enable; then
echo "$Product will start automatically at boot" echo "$PRODUCT will start automatically at boot"
echo "Set startup=1 in ${CONFDIR}/default/$PRODUCT to enable" echo "Set startup=1 in ${CONFDIR}/default/$PRODUCT to enable"
else else
cant_autostart cant_autostart
@@ -494,31 +549,31 @@ if [ -z "$DESTDIR" ]; then
/bin/true /bin/true
else else
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
if systemctl enable ${PRODUCT}.service; then if systemctl enable shorewall-init.service; then
echo "$Product will start automatically at boot" echo "Shorewall Init will start automatically at boot"
fi fi
elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then
if insserv ${INITDIR}/$PRODUCT ; then if insserv ${INITDIR}/shorewall-init ; then
echo "$Product will start automatically at boot" echo "Shorewall Init will start automatically at boot"
else else
cant_autostart cant_autostart
fi fi
elif [ -x ${SBINDIR}/chkconfig -o -x /usr${SBINDIR}/chkconfig ]; then elif [ -x ${SBINDIR}/chkconfig -o -x /usr${SBINDIR}/chkconfig ]; then
if chkconfig --add $PRODUCT ; then if chkconfig --add shorewall-init ; then
echo "$Product will start automatically at boot" echo "Shorewall Init will start automatically in run levels as follows:"
chkconfig --list $PRODUCT chkconfig --list shorewall-init
else else
cant_autostart cant_autostart
fi fi
elif [ -x ${SBINDIR}/rc-update ]; then elif [ -x ${SBINDIR}/rc-update ]; then
if rc-update add $PRODUCT default; then if rc-update add shorewall-init default; then
echo "$Product will start automatically at boot" echo "Shorewall Init will start automatically at boot"
else else
cant_autostart cant_autostart
fi fi
elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then
/etc/init.d/$PRODUCT enable /etc/init.d/$PRODUCT enable
if /etc/init.d/$PRODUCT enabled; then if /etc/init.d/shorewall-init enabled; then
echo "$Product will start automatically at boot" echo "$Product will start automatically at boot"
else else
cant_autostart cant_autostart
@@ -532,11 +587,11 @@ else
if [ $configure -eq 1 -a -n "$first_install" ]; then if [ $configure -eq 1 -a -n "$first_install" ]; then
if [ $HOST = debian -a -z "$SERVICEDIR" ]; then if [ $HOST = debian -a -z "$SERVICEDIR" ]; then
if [ -n "${DESTDIR}" ]; then if [ -n "${DESTDIR}" ]; then
make_parent_directory ${DESTDIR}/etc/rcS.d 0755 mkdir -p ${DESTDIR}/etc/rcS.d
fi fi
ln -sf ../init.d/$PRODUCT ${DESTDIR}${CONFDIR}/rcS.d/S38${PRODUCT} ln -sf ../init.d/shorewall-init ${DESTDIR}${CONFDIR}/rcS.d/S38shorewall-init
echo "$Product will start automatically at boot" echo "Shorewall Init will start automatically at boot"
fi fi
fi fi
fi fi
@@ -547,8 +602,8 @@ if [ -d ${DESTDIR}/etc/ppp ]; then
case $HOST in case $HOST in
debian|suse) debian|suse)
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
make_parent_directory ${DESTDIR}/etc/ppp/$directory 0755 #SuSE doesn't create the IPv6 directories mkdir -p ${DESTDIR}/etc/ppp/$directory #SuSE doesn't create the IPv6 directories
cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall
done done
;; ;;
redhat) redhat)
@@ -559,19 +614,19 @@ if [ -d ${DESTDIR}/etc/ppp ]; then
FILE=${DESTDIR}/etc/ppp/$file FILE=${DESTDIR}/etc/ppp/$file
if [ -f $FILE ]; then if [ -f $FILE ]; then
if grep -qF Shorewall-based $FILE ; then if grep -qF Shorewall-based $FILE ; then
cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown $FILE cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE
else else
echo "$FILE already exists -- ppp devices will not be handled" echo "$FILE already exists -- ppp devices will not be handled"
break break
fi fi
else else
cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown $FILE cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE
fi fi
done done
;; ;;
esac esac
fi fi
# #
# Report Success # Report Success
# #
echo "shorewall Init Version $VERSION Installed" echo "shorewall Init Version $VERSION Installed"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Script to back uninstall Shoreline Firewall Init # Script to back uninstall Shoreline Firewall
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# #
@@ -26,34 +26,62 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx # The Build script inserts the actual version VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall-init PRODUCT=shorewall-init
Product="Shorewall Init" Product="Shorewall Init"
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]" echo "usage: $ME [ <shorewallrc file> ]"
echo "where <option> is one of"
echo " -h"
echo " -v"
echo " -n"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
#
# Source common functions
#
. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; }
#
# Parse the run line
#
finished=0 finished=0
configure=1 configure=1
@@ -90,17 +118,16 @@ while [ $finished -eq 0 ]; do
;; ;;
esac esac
done done
# #
# Read the RC file # Read the RC file
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc" . ./shorewallrc
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc" . ~/.shorewallrc || exit 1
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc" . /usr/share/shorewall/shorewallrc
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -110,72 +137,72 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file || exit 1 file=./$file
;; ;;
esac esac
. $file || fatal_error "Can not load the RC file: $file" . $file || exit 1
else else
usage 1 usage 1
fi fi
if [ -f ${SHAREDIR}/$PRODUCT/version ]; then if [ -f ${SHAREDIR}/shorewall-init/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/$PRODUCT/version)" INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-init/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: $Product Version $INSTALLED_VERSION is installed" echo "WARNING: Shorewall Init Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller." echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION" VERSION="$INSTALLED_VERSION"
fi fi
else else
echo "WARNING: $Product Version $VERSION is not installed" echo "WARNING: Shorewall Init Version $VERSION is not installed"
VERSION="" VERSION=""
fi fi
echo "Uninstalling $Product $VERSION" [ -n "${LIBEXEC:=${SHAREDIR}}" ]
echo "Uninstalling Shorewall Init $VERSION"
[ -n "$SANDBOX" ] && configure=0 [ -n "$SANDBOX" ] && configure=0
[ -n "${LIBEXEC:=${SHAREDIR}}" ] INITSCRIPT=${CONFDIR}/init.d/shorewall-init
remove_file ${SBINDIR}/$PRODUCT if [ -f "$INITSCRIPT" ]; then
FIREWALL=${CONFDIR}/init.d/$PRODUCT
if [ -f "$FIREWALL" ]; then
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
if [ $HOST = openwrt ] ; then if [ $HOST = openwrt ]; then
if /etc/init.d/$PRODUCT enabled; then if /etc/init.d/shorewall-init enabled; then
/etc/init.d/$PRODUCT disable /etc/init.d/shorewall-init disable
fi fi
elif mywhich updaterc.d ; then
updaterc.d shorewall-init remove
elif mywhich insserv ; then elif mywhich insserv ; then
insserv -r $FIREWALL insserv -r $INITSCRIPT
elif mywhich update-rc.d ; then
update-rc.d ${PRODUCT} remove
elif mywhich chkconfig ; then elif mywhich chkconfig ; then
chkconfig --del $(basename $FIREWALL) chkconfig --del $(basename $INITSCRIPT)
fi fi
fi fi
remove_file $FIREWALL remove_file $INITSCRIPT
fi fi
[ -z "${SERVICEDIR}" ] && SERVICEDIR="$SYSTEMD" if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD"
fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service [ $configure -eq 1 ] && systemctl disable shorewall-init.service
remove_file $SERVICEDIR/${PRODUCT}.service rm -f $SERVICEDIR/shorewall-init.service
fi fi
if [ $HOST = openwrt ]; then if [ $HOST = openwrt ]; then
[ "$(readlink -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifup-local [ "$(readlink -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
[ "$(readlink -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifdown-local [ "$(readlink -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local
else else
[ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifup-local [ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
[ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifdown-local [ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local
fi fi
remove_file ${CONFDIR}/default/$PRODUCT remove_file ${CONFDIR}/default/shorewall-init
remove_file ${CONFDIR}/sysconfig/$PRODUCT remove_file ${CONFDIR}/sysconfig/shorewall-init
remove_file ${CONFDIR}/NetworkManager/dispatcher.d/01-shorewall remove_file ${CONFDIR}/NetworkManager/dispatcher.d/01-shorewall
@@ -200,11 +227,10 @@ if [ -d ${CONFDIR}/ppp ]; then
done done
fi fi
remove_directory ${SHAREDIR}/$PRODUCT rm -f ${SBINDIR}/shorewall-init
remove_directory ${LIBEXECDIR}/$PRODUCT rm -rf ${SHAREDIR}/shorewall-init
remove_file ${CONFDIR}/logrotate.d/$PRODUCT rm -rf ${LIBEXECDIR}/shorewall-init
echo "Shorewall Init Uninstalled"
#
# Report Success
#
echo "$Product $VERSION Uninstalled"

View File

@@ -1,5 +1,5 @@
# prevent startup with default configuration # prevent startup with default configuration
# set the following variable to 1 in order to allow Shorewall-lite to start # set the following varible to 1 in order to allow Shorewall-lite to start
startup=0 startup=0
@@ -16,7 +16,7 @@ startup=0
# wait_interface= # wait_interface=
# #
# Global start/restart/reload/stop options # Startup options
# #
OPTIONS="" OPTIONS=""
@@ -30,16 +30,6 @@ STARTOPTIONS=""
# #
RESTARTOPTIONS="" RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# #
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf # Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf
# #

View File

@@ -1,26 +0,0 @@
#
# Global start/restart/reload/stop options
#
OPTIONS=""
#
# Start options
#
STARTOPTIONS=""
#
# Restart options
#
RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# EOF

View File

@@ -22,19 +22,62 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <http://www.gnu.org/licenses/>.
# #
VERSION=xxx # The Build script inserts the actual version VERSION=xxx #The Build script inserts the actual version
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]" echo "usage: $ME [ <configuration-file> ]"
echo "where <option> is one of" echo " $ME -v"
echo " -h" echo " $ME -h"
echo " -v" echo " $ME -n"
echo " -n"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure $Product to start automatically at boot" >&2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
install_file() # $1 = source $2 = target $3 = mode install_file() # $1 = source $2 = target $3 = mode
{ {
if cp -f $1 $2; then if cp -f $1 $2; then
@@ -53,6 +96,19 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1 exit 1
} }
make_directory() # $1 = directory , $2 = mode
{
mkdir -p $1
chmod 755 $1
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
@@ -66,11 +122,6 @@ else
Product="Shorewall6 Lite" Product="Shorewall6 Lite"
fi fi
#
# Source common functions
#
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
# #
# Parse the run line # Parse the run line
# #
@@ -117,14 +168,12 @@ done
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc || exit 1
file=./shorewallrc file=./shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
file=~/.shorewallrc . ~/.shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
file=/usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -134,11 +183,11 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file || exit 1 file=./$file
;; ;;
esac esac
. $file || fatal_error "Can not load the RC file: $file" . $file
else else
usage 1 usage 1
fi fi
@@ -269,7 +318,8 @@ case "$HOST" in
linux) linux)
;; ;;
*) *)
fatal_error "ERROR: Unknown HOST \"$HOST\"" echo "ERROR: Unknown HOST \"$HOST\"" >&2
exit 1;
;; ;;
esac esac
@@ -281,7 +331,7 @@ if [ -n "$DESTDIR" ]; then
OWNERSHIP="" OWNERSHIP=""
fi fi
make_parent_directory ${DESTDIR}${INITDIR} 0755 make_directory ${DESTDIR}${INITDIR} 755
else else
if [ ! -f ${SHAREDIR}/shorewall/coreversion ]; then if [ ! -f ${SHAREDIR}/shorewall/coreversion ]; then
@@ -321,20 +371,25 @@ fi
delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules
[ -n "${INITFILE}" ] && make_parent_directory ${DESTDIR}${INITDIR} 0755 [ -n "${INITFILE}" ] && make_directory ${DESTDIR}${INITDIR} 755
# #
# Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed # Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed
# #
make_parent_directory ${DESTDIR}${CONFDIR}/$PRODUCT 0755 mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT 0755 mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT
make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755 mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT
make_parent_directory ${DESTDIR}${SBINDIR} 0755 mkdir -p ${DESTDIR}${SBINDIR}
make_parent_directory ${DESTDIR}${VARDIR} 0755 mkdir -p ${DESTDIR}${VARDIR}
chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT
if [ -n "$DESTDIR" ]; then if [ -n "$DESTDIR" ]; then
make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755 mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
make_parent_directory ${DESTDIR}${INITDIR} 0755 chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
mkdir -p ${DESTDIR}${INITDIR}
chmod 755 ${DESTDIR}${INITDIR}
fi fi
if [ -n "$INITFILE" ]; then if [ -n "$INITFILE" ]; then
@@ -355,9 +410,9 @@ if [ -z "${SERVICEDIR}" ]; then
fi fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
make_parent_directory ${DESTDIR}${SERVICEDIR} 0755 mkdir -p ${DESTDIR}${SERVICEDIR}
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644 install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 644
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service" echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
fi fi
@@ -386,14 +441,8 @@ echo "Default config path file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/confi
# #
for f in lib.* ; do for f in lib.* ; do
if [ -f $f ]; then if [ -f $f ]; then
case $f in install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
*installer) echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
;;
*)
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
;;
esac
fi fi
done done
@@ -421,12 +470,12 @@ if [ -f modules ]; then
fi fi
if [ -f helpers ]; then if [ -f helpers ]; then
install_file helpers ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers 0600 install_file helpers ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers 600
echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers" echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers"
fi fi
for f in modules.*; do for f in modules.*; do
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644 install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 644
echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f" echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
done done
@@ -437,19 +486,19 @@ done
if [ -d manpages -a -n "$MANDIR" ]; then if [ -d manpages -a -n "$MANDIR" ]; then
cd manpages cd manpages
make_parent_directory ${DESTDIR}${MANDIR}/man5 0755 mkdir -p ${DESTDIR}${MANDIR}/man5/
for f in *.5; do for f in *.5; do
gzip -c $f > $f.gz gzip -c $f > $f.gz
install_file $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz 0644 install_file $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz 644
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz" echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz"
done done
make_parent_directory ${DESTDIR}${MANDIR}/man8 0755 mkdir -p ${DESTDIR}${MANDIR}/man8/
for f in *.8; do for f in *.8; do
gzip -c $f > $f.gz gzip -c $f > $f.gz
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 0644 install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 644
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz" echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
done done
@@ -459,7 +508,7 @@ if [ -d manpages -a -n "$MANDIR" ]; then
fi fi
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 0644 install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 644
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT" echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
fi fi
@@ -467,7 +516,7 @@ fi
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version
chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
@@ -490,7 +539,10 @@ ln -sf shorewall ${DESTDIR}${SBINDIR}/${PRODUCT}
# Note -- not all packages will have the SYSCONFFILE so we need to check for its existance here # Note -- not all packages will have the SYSCONFFILE so we need to check for its existance here
# #
if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
[ ${DESTDIR} ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755 if [ ${DESTDIR} ]; then
mkdir -p ${DESTDIR}${SYSCONFDIR}
chmod 755 ${DESTDIR}${SYSCONFDIR}
fi
install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640 install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640
echo "$SYSCONFFILE file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}" echo "$SYSCONFFILE file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
@@ -558,6 +610,6 @@ if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${
fi fi
# #
# Report Success # Report Success
# #
echo "$Product Version $VERSION Installed" echo "$Product Version $VERSION Installed"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Script to back uninstall Shoreline Firewall Lite # Script to back uninstall Shoreline Firewall
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# #
@@ -26,7 +26,9 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx # The Build script inserts the actual version VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall-lite
Product="Shorewall Lite"
usage() # $1 = exit status usage() # $1 = exit status
{ {
@@ -39,27 +41,46 @@ usage() # $1 = exit status
exit $1 exit $1
} }
# fatal_error()
# Change to the directory containing this script {
# echo " ERROR: $@" >&2
cd "$(dirname $0)" exit 1
}
if [ -f shorewall-lite.service ]; then qt()
PRODUCT=shorewall-lite {
Product="Shorewall Lite" "$@" >/dev/null 2>&1
else }
PRODUCT=shorewall6-lite
Product="Shorewall6 Lite"
fi
# split() {
# Source common functions local ifs
# ifs=$IFS
. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; } IFS=:
set -- $1
echo $*
IFS=$ifs
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
#
# Parse the run line
#
finished=0 finished=0
configure=1 configure=1
@@ -76,7 +97,7 @@ while [ $finished -eq 0 ]; do
usage 0 usage 0
;; ;;
v) v)
echo "$Product Firewall Uninstaller Version $VERSION" echo "$Product Firewall Installer Version $VERSION"
exit 0 exit 0
;; ;;
n*) n*)
@@ -96,17 +117,16 @@ while [ $finished -eq 0 ]; do
;; ;;
esac esac
done done
# #
# Read the RC file # Read the RC file
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc" . ./shorewallrc
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc" . ~/.shorewallrc || exit 1
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc" . /usr/share/shorewall/shorewallrc
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -116,50 +136,46 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file || exit 1 file=./$file
;; ;;
esac esac
. $file || fatal_error "Can not load the RC file: $file" . $file
else else
usage 1 usage 1
fi fi
if [ -f ${SHAREDIR}/$PRODUCT/version ]; then if [ -f ${SHAREDIR}/shorewall-lite/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/$PRODUCT/version)" INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-lite/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: $Product Version $INSTALLED_VERSION is installed" echo "WARNING: Shorewall Lite Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller." echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION" VERSION="$INSTALLED_VERSION"
fi fi
else else
echo "WARNING: $Product Version $VERSION is not installed" echo "WARNING: Shorewall Lite Version $VERSION is not installed"
VERSION="" VERSION=""
fi fi
echo "Uninstalling $Product $VERSION" echo "Uninstalling Shorewall Lite $VERSION"
[ -n "$SANDBOX" ] && configure=0 [ -n "$SANDBOX" ] && configure=0
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then
${SBINDIR}/$PRODUCT clear shorewall-lite clear
elif qt ip6tables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall6 ]; then
${SBINDIR}/$PRODUCT clear
fi fi
fi fi
remove_file ${SBINDIR}/$PRODUCT if [ -L ${SHAREDIR}/shorewall-lite/init ]; then
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
if [ $HOST = openwrt ]; then if [ $HOST = openwrt ]; then
if [ $configure -eq 1 ] && /etc/init.d/$PRODUCT enabled; then if [ $configure -eq 1 ] && /etc/init.d/shorewall-lite enabled; then
/etc/init.d/$PRODUCT disable /etc/init.d/shorewall-lite disable
fi fi
FIREWALL=$(readlink ${SHAREDIR}/$PRODUCT/init) FIREWALL=$(readlink ${SHAREDIR}/shorewall-lite/init)
else else
FIREWALL=$(readlink -m -q ${SHAREDIR}/$PRODUCT/init) FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall-lite/init)
fi fi
elif [ -n "$INITFILE" ]; then elif [ -n "$INITFILE" ]; then
FIREWALL=${INITDIR}/${INITFILE} FIREWALL=${INITDIR}/${INITFILE}
@@ -167,10 +183,10 @@ fi
if [ -f "$FIREWALL" ]; then if [ -f "$FIREWALL" ]; then
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
if mywhich insserv ; then if mywhich updaterc.d ; then
updaterc.d shorewall-lite remove
elif mywhich insserv ; then
insserv -r $FIREWALL insserv -r $FIREWALL
elif mywhich update-rc.d ; then
update-rc.d ${PRODUCT} remove
elif mywhich chkconfig ; then elif mywhich chkconfig ; then
chkconfig --del $(basename $FIREWALL) chkconfig --del $(basename $FIREWALL)
fi fi
@@ -179,29 +195,26 @@ if [ -f "$FIREWALL" ]; then
remove_file $FIREWALL remove_file $FIREWALL
fi fi
[ -z "${SERVICEDIR}" ] && SERVICEDIR="$SYSTEMD" [ -z "$SERVICEDIR" ] && SERVICEDIR="$SYSTEMD"
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service [ $configure -eq 1 ] && systemctl disable ${PRODUCT}
remove_file $SERVICEDIR/${PRODUCT}.service rm -f $SERVICEDIR/shorewall-lite.service
fi fi
remove_directory ${CONFDIR}/$PRODUCT rm -f ${SBINDIR}/shorewall-lite
remove_directory ${VARDIR}
remove_directory ${SHAREDIR}/$PRODUCT
remove_directory ${LIBEXECDIR}/$PRODUCT
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
if [ -n "$SYSCONFDIR" ]; then rm -rf ${CONFDIR}/shorewall-lite
[ -n "$SYSCONFFILE" ] && remove_file ${SYSCONFDIR}/${PRODUCT} rm -rf ${VARDIR}
fi rm -rf ${SHAREDIR}/shorewall-lite
rm -rf ${LIBEXECDIR}/shorewall-lite
rm -f ${CONFDIR}/logrotate.d/shorewall-lite
rm -f ${SYSCONFDIR}/shorewall-lite
if [ -n "${MANDIR}" ]; then if [ -n "${MANDIR}" ]; then
remove_file_with_wildcard ${MANDIR}/man5/${PRODUCT}\* rm -f ${MANDIR}/man5/shorewall-lite*
remove_file_with_wildcard ${MANDIR}/man8/${PRODUCT}\* rm -f ${MANDIR}/man8/shorewall-lite*
fi fi
# echo "Shorewall Lite Uninstalled"
# Report Success
#
echo "$Product $VERSION Uninstalled"

View File

@@ -1,9 +0,0 @@
#
# Shorewall6 -- /usr/share/shorewall/action.A_AllowICMPs
#
# This action A_ACCEPTs needed ICMP types
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT
AllowICMPs(A_ACCEPT)

View File

@@ -13,7 +13,6 @@
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!! # IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
# #
?require AUDIT_TARGET ?require AUDIT_TARGET
?warning "You are using the deprecated A_Drop default action. Please see http://www.shorewall.net/Actions.html
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT #ACTION SOURCE DEST PROTO DPORT SPORT
# #
@@ -32,10 +31,9 @@ Auth(A_DROP)
# #
A_AllowICMPs - - icmp A_AllowICMPs - - icmp
# #
# Don't log broadcasts and multicasts # Don't log broadcasts
# #
dropBcast(audit) dropBcast(audit)
dropMcast(audit)
# #
# Drop packets that are in the INVALID state -- these are usually ICMP packets # Drop packets that are in the INVALID state -- these are usually ICMP packets
# and just confuse people when they appear in the log. # and just confuse people when they appear in the log.

View File

@@ -11,8 +11,6 @@
# internet operation are always ACCEPTed. # internet operation are always ACCEPTed.
# #
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!! # IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
?require AUDIT_TARGET
?warning "You are using the deprecated A_REJECT default action. Please see http://www.shorewall.net/Actions.html
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO #ACTION SOURCE DEST PROTO
# #
@@ -27,11 +25,10 @@ COUNT
# #
A_AllowICMPs - - icmp A_AllowICMPs - - icmp
# #
# Drop Broadcasts and multicasts so they don't clutter up the log # Drop Broadcasts so they don't clutter up the log
# (these must *not* be rejected). # (broadcasts must *not* be rejected).
# #
dropBcast(audit) dropBcast(audit)
dropMcast(audit)
# #
# Drop packets that are in the INVALID state -- these are usually ICMP packets # Drop packets that are in the INVALID state -- these are usually ICMP packets
# and just confuse people when they appear in the log (these ICMPs cannot be # and just confuse people when they appear in the log (these ICMPs cannot be

View File

@@ -7,39 +7,5 @@
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
DEFAULTS ACCEPT DEFAULTS ACCEPT
@1 - - icmp fragmentation-needed {comment="Needed ICMP types"}
?if __IPV4 @1 - - icmp time-exceeded {comment="Needed ICMP types"}
@1 - - icmp fragmentation-needed {comment="Needed ICMP types"}
@1 - - icmp time-exceeded {comment="Needed ICMP types"}
?else
?COMMENT Needed ICMP types (RFC4890)
@1 - - ipv6-icmp destination-unreachable
@1 - - ipv6-icmp packet-too-big
@1 - - ipv6-icmp time-exceeded
@1 - - ipv6-icmp parameter-problem
# The following should have a ttl of 255 and must be allowed to transit a bridge
@1 - - ipv6-icmp router-solicitation
@1 - - ipv6-icmp router-advertisement
@1 - - ipv6-icmp neighbour-solicitation
@1 - - ipv6-icmp neighbour-advertisement
@1 - - ipv6-icmp 137 # Redirect
@1 - - ipv6-icmp 141 # Inverse neighbour discovery solicitation
@1 - - ipv6-icmp 142 # Inverse neighbour discovery advertisement
# The following should have a link local source address and must be allowed to transit a bridge
@1 fe80::/10 - ipv6-icmp 130 # Listener query
@1 fe80::/10 - ipv6-icmp 131 # Listener report
@1 fe80::/10 - ipv6-icmp 132 # Listener done
@1 fe80::/10 - ipv6-icmp 143 # Listener report v2
# The following should be received with a ttl of 255 and must be allowed to transit a bridge
@1 - - ipv6-icmp 148 # Certificate path solicitation
@1 - - ipv6-icmp 149 # Certificate path advertisement
# The following should have a link local source address and a ttl of 1 and must be allowed to transit abridge
@1 fe80::/10 - ipv6-icmp 151 # Multicast router advertisement
@1 fe80::/10 - ipv6-icmp 152 # Multicast router solicitation
@1 fe80::/10 - ipv6-icmp 153 # Multicast router termination
?endif

View File

@@ -20,7 +20,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# Broadcast[([<action>|[,{audit|-}])] # Broadcast[([<action>|-[,{audit|-}])]
# #
# Default action is DROP # Default action is DROP
# #
@@ -29,37 +29,27 @@
DEFAULTS DROP,- DEFAULTS DROP,-
?if __ADDRTYPE ?if __ADDRTYPE
@1 - - - ;; -m addrtype --dst-type BROADCAST @1 - - - ;; -m addrtype --dst-type BROADCAST
@1 - - - ;; -m addrtype --dst-type ANYCAST @1 - - - ;; -m addrtype --dst-type ANYCAST
?else ?else
?begin perl; ?begin perl;
use strict; use Shorewall::IPAddrs;
use Shorewall::IPAddrs; use Shorewall::Config;
use Shorewall::Config; use Shorewall::Chains;
use Shorewall::Chains;
my ( $action, $audit ) = get_action_params( 2 ); my ( $action ) = get_action_params( 1 );
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
fatal_error "Invalid parameter to action Broadcast" if supplied $audit && $audit ne 'audit'; add_commands $chainref, 'for address in $ALL_BCASTS; do';
incr_cmd_level $chainref;
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d $address ' if $level ne '';
add_jump $chainref, $action, 0, "-d \$address ";
decr_cmd_level $chainref;
add_commands $chainref, 'done';
my $target = require_audit ( $action , $audit ); 1;
if ( $family == F_IPV4 ) { ?end perl;
add_commands $chainref, 'for address in $ALL_BCASTS; do';
} elsif ($family == F_IPV6 ) {
add_commands $chainref, 'for address in $ALL_ACASTS; do';
}
incr_cmd_level $chainref;
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d $address ' if $level ne '';
add_jump $chainref, $target, 0, "-d \$address ";
decr_cmd_level $chainref;
add_commands $chainref, 'done';
1;
?end perl;
?endif ?endif

View File

@@ -1,33 +0,0 @@
#
# Shorewall -- /usr/share/shorewall/action.FIN
#
# FIN Action
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net)
#
# 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.
#
# FIN[([<action>])]
#
# Default action is ACCEPT
#
###############################################################################
DEFAULTS ACCEPT,-
@1 - - ;;+ -p 6 --tcp-flags ACK,FIN,PSH ACK,FIN,PSH

View File

@@ -13,9 +13,9 @@
DEFAULTS 2,0 DEFAULTS 2,0
?if @1 !~ /^\d+/ || ! @1 || @1 > 1024 ?if @1 !~ /^\d+/ || ! @1 || @1 > 1024
?error Invalid value (@1) for the GlusterFS Bricks argument ?error Invalid value for Bricks (@1)
?elsif @2 !~ /^[01]$/ ?elsif @2 !~ /^[01]$/
?error Invalid value (@2) for the GlusterFS IB argument ?error Invalid value for IB (@2)
?endif ?endif
#ACTION SOURCE DEST PROTO DPORT #ACTION SOURCE DEST PROTO DPORT

View File

@@ -22,49 +22,6 @@
# #
# Limit(<recent-set>,<num-connections>,<timeout>) # Limit(<recent-set>,<num-connections>,<timeout>)
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -,-,-
?begin perl
use strict;
use Shorewall::Config;
use Shorewall::Chains;
my $chainref = get_action_chain;
my @param = get_action_params(3);
my ( $level, $tag ) = get_action_logging;
@param = split( ',', $tag ), $tag = $param[0] unless supplied( join '', @param );
fatal_error 'Limit rules must include <set name>,<max connections>,<interval> as the log tag or as parameters' unless @param == 3;
my $set = $param[0];
for ( @param[1,2] ) {
fatal_error 'Max connections and interval in Limit rules must be numeric (' . join( ':', 'Limit', $level eq '' ? 'none' : $level, $tag ) . ')' unless /^\d+$/
}
my $count = $param[1] + 1;
require_capability( 'RECENT_MATCH' , 'Limit rules' , '' );
warning_message "The Limit action is deprecated in favor of per-IP rate limiting using the RATE LIMIT column";
add_irule $chainref, recent => "--name $set --set";
if ( $level ne '' ) {
my $xchainref = new_chain 'filter' , "$chainref->{name}%";
log_irule_limit( $level, $xchainref, '', 'DROP', [], $tag, 'add' , '' );
add_ijump $xchainref, j => 'DROP';
add_ijump $chainref, j => $xchainref, recent => "--name $set --update --seconds $param[2] --hitcount $count";
} else {
add_ijump $chainref, j => 'DROP', recent => "--update --name $set --seconds $param[2] --hitcount $count";
}
add_ijump $chainref, j => 'ACCEPT';
1;
?end perl

View File

@@ -29,28 +29,22 @@
DEFAULTS DROP,- DEFAULTS DROP,-
?if __ADDRTYPE ?if __ADDRTYPE
@1 - - - ;; -m addrtype --dst-type MULTICAST @1 - - - ;; -m addrtype --dst-type MULTICAST
?else ?else
?begin perl; ?begin perl;
use strict; use Shorewall::IPAddrs;
use Shorewall::IPAddrs; use Shorewall::Config;
use Shorewall::Config; use Shorewall::Chains;
use Shorewall::Chains;
my ( $action, $audit ) = get_action_params( 2 ); my ( $action ) = get_action_params( 1 );
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
fatal_error "Invalid parameter to action Multicast" if supplied $audit && $audit ne 'audit'; log_rule_limit $level, $chainref, 'Multicast' , $action, '', $tag, 'add', ' -d 224.0.0.0/4 ' if $level ne '';
add_jump $chainref, $action, 0, '-d 224.0.0.0/4 ';
my $target = require_audit ( $action , $audit ); 1;
my $dest = ( $family == F_IPV4 ) ? join( ' ', '-d', IPv4_MULTICAST . ' ' ) : join( ' ', '-d', IPv6_MULTICAST . ' ' );
log_rule_limit( $level, $chainref, 'Multicast' , $action, '', $tag, 'add', $dest ) if $level ne ''; ?end perl;
add_jump $chainref, $target, 0, $dest;
1;
?end perl;
?endif ?endif

View File

@@ -22,17 +22,6 @@
# #
# allowBcast[([audit])] # allowBcast[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Broadcast(A_ACCEPT)
?else
?error "Invalid argument (@1) to allowBcast"
?endif
?else
Broadcast(ACCEPT)
?endif

View File

@@ -22,17 +22,6 @@
# #
# allowMcast[([audit])] # allowMcast[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Multicast(A_ACCEPT)
?else
?error "Invalid argument (@1) to allowMcast"
?endif
?else
Multicast(ACCEPT)
?endif

View File

@@ -22,19 +22,6 @@
# #
# allowinUPnP[([audit])] # allowinUPnP[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
A_ACCEPT - - 17 1900
A_ACCEPT - - 6 49152
?else
?error "Invalid argument (@1) to allowinUPnP"
?endif
?else
ACCEPT - - 17 1900
ACCEPT - - 6 49152
?endif

View File

@@ -22,18 +22,6 @@
# #
# dropBcast[([audit])] # dropBcast[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Broadcast(A_DROP)
?else
?error "Invalid argument (@1) to dropBcast"
?endif
?else
Broadcast(DROP)
?endif

View File

@@ -1,39 +0,0 @@
#
# Shorewall -- /usr/share/shorewall/action.dropBcasts
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2017 Tom Eastep (teastep@shorewall.net)
#
# 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.
#
# dropBcasts[([audit])]
#
###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Broadcast(A_DROP)
?else
?error "Invalid argument (@1) to dropBcasts"
?endif
?else
Broadcast(DROP)
?endif

View File

@@ -22,17 +22,6 @@
# #
# dropMcast[([audit])] # dropMcast[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Multicast(A_DROP)
?else
?error "Invalid argument (@1) to dropMcast"
?endif
?else
Multicast(DROP)
?endif

View File

@@ -22,17 +22,6 @@
# #
# dropNotSyn[([audit])] # dropNotSyn[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
A_DROP {proto=6:!syn}
?else
?error "Invalid argument (@1) to dropNotSyn"
?endif
?else
DROP {proto=6:!syn}
?endif

View File

@@ -22,22 +22,6 @@
# #
# forwardUPnP # forwardUPnP
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?begin perl
use strict;
use Shorewall::Config;
use Shorewall::Chains;
my $chainref = get_action_chain;
set_optflags( $chainref, DONT_OPTIMIZE );
add_commands( $chainref , '[ -f ${VARDIR}/.forwardUPnP ] && cat ${VARDIR}/.forwardUPnP >&3' );
1;
?end perl

View File

@@ -22,18 +22,6 @@
# #
# rejNotSyn[([audit])] # rejNotSyn[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
A_REJECT {proto=6:!syn}
?else
?error "Invalid argument (@1) to rejNotSyn"
?endif
?else
REJECT(tcp-reset) {proto=6:!syn}
?endif

View File

@@ -6,5 +6,4 @@
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
PARAM - - udp 3389
PARAM - - tcp 3389 PARAM - - tcp 3389

View File

@@ -195,7 +195,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
$ports = '' if $ports eq 'any' || $ports eq 'all'; $ports = '' if $ports eq 'any' || $ports eq 'all';
$sports = '' if $sports eq 'any' || $sports eq 'all'; $sports = '' if $sports eq 'any' || $sports eq 'all';
fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT_SECTION; fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT;
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} ) . do_headers( $headers ); my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} ) . do_headers( $headers );
my $prerule = ''; my $prerule = '';
@@ -266,7 +266,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
if ( $source eq 'any' || $source eq 'all' ) { if ( $source eq 'any' || $source eq 'all' ) {
$source = ALLIP; $source = ALLIP;
} else { } else {
fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT_SECTION || ! $asection ); fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT || ! $asection );
} }
if ( have_bridges && ! $asection ) { if ( have_bridges && ! $asection ) {
@@ -519,9 +519,9 @@ sub setup_accounting() {
while ( $chainswithjumps && $progress ) { while ( $chainswithjumps && $progress ) {
$progress = 0; $progress = 0;
for my $chain1 ( keys %accountingjumps ) { for my $chain1 ( sort keys %accountingjumps ) {
if ( keys %{$accountingjumps{$chain1}} ) { if ( keys %{$accountingjumps{$chain1}} ) {
for my $chain2 ( keys %{$accountingjumps{$chain1}} ) { for my $chain2 ( sort keys %{$accountingjumps{$chain1}} ) {
delete $accountingjumps{$chain1}{$chain2}, $progress = 1 unless $accountingjumps{$chain2}; delete $accountingjumps{$chain1}{$chain2}, $progress = 1 unless $accountingjumps{$chain2};
} }
} else { } else {

View File

@@ -32,7 +32,6 @@ require Exporter;
use Scalar::Util 'reftype'; use Scalar::Util 'reftype';
use Digest::SHA qw(sha1_hex); use Digest::SHA qw(sha1_hex);
use File::Basename; use File::Basename;
use Socket;
use Shorewall::Config qw(:DEFAULT :internal); use Shorewall::Config qw(:DEFAULT :internal);
use Shorewall::Zones; use Shorewall::Zones;
use Shorewall::IPAddrs; use Shorewall::IPAddrs;
@@ -138,12 +137,6 @@ our %EXPORT_TAGS = (
ALL_COMMANDS ALL_COMMANDS
NOT_RESTORE NOT_RESTORE
validate_port
validate_portpair
validate_portpair1
validate_port_list
expand_port_range
PREROUTING PREROUTING
INPUT INPUT
FORWARD FORWARD
@@ -412,14 +405,14 @@ our $VERSION = 'MODULEVERSION';
# Provider Chains for provider <p> # Provider Chains for provider <p>
# Load Balance - ~<p> # Load Balance - ~<p>
# #
# Zone-pair chains for rules chain <z1-z2> # Zone-pair chains for rules chain <z12z2>
# #
# Syn Flood - @<z1-z2> # Syn Flood - @<z12z2>
# Blacklist - <z1-z2>~ # Blacklist - <z12z2>~
# Established - ^<z1-z2> # Established - ^<z12z2>
# Related - +<z1-z2> # Related - +<z12z2>
# Invalid - _<z1-z2> # Invalid - _<z12z2>
# Untracked - &<z1-z2> # Untracked - &<z12z2>
# #
our %chain_table; our %chain_table;
our $raw_table; our $raw_table;
@@ -441,7 +434,7 @@ use constant { STANDARD => 0x1, #defined by Netfilter
REDIRECT => 0x20, #'REDIRECT' REDIRECT => 0x20, #'REDIRECT'
ACTION => 0x40, #An action (may be built-in) ACTION => 0x40, #An action (may be built-in)
MACRO => 0x80, #A Macro MACRO => 0x80, #A Macro
LOGRULE => 0x100, #'LOG','ULOG','NFLOG' LOGRULE => 0x100, #'LOG','NFLOG'
NFQ => 0x200, #'NFQUEUE' NFQ => 0x200, #'NFQUEUE'
CHAIN => 0x400, #Manual Chain CHAIN => 0x400, #Manual Chain
SET => 0x800, #SET SET => 0x800, #SET
@@ -516,7 +509,6 @@ our $idiotcount1;
our $hashlimitset; our $hashlimitset;
our $global_variables; our $global_variables;
our %address_variables; our %address_variables;
our %port_variables;
our $ipset_rules; our $ipset_rules;
# #
@@ -792,7 +784,6 @@ sub initialize( $$$ ) {
%interfaceacasts = (); %interfaceacasts = ();
%interfacegateways = (); %interfacegateways = ();
%address_variables = (); %address_variables = ();
%port_variables = ();
$global_variables = 0; $global_variables = 0;
$idiotcount = 0; $idiotcount = 0;
@@ -828,211 +819,6 @@ sub initialize( $$$ ) {
# #
} }
sub record_runtime_port( $ ) {
my ( $variable ) = @_;
if ( $variable =~ /^{([a-zA-Z_]\w*)}$/ ) {
fatal_error "Variable %variable is already used as an address variable" if $address_variables{$1};
$port_variables{$1} = 1;
} else {
fatal_error( "Invalid port variable (%$variable)" );
}
"\$$variable";
}
################################################################################
# Functions moved from IPAddrs.pm in 5.1.5 #
################################################################################
sub validate_port( $$ ) {
my ($proto, $port) = @_;
my $value;
if ( $port =~ /^(\d+)$/ || $port =~ /^0x/ ) {
$value = numeric_value $port;
if ( defined $value ) {
if ( $value && $value <= 65535 ) {
return $value;
} else {
$value = undef;
}
}
} elsif ( $port =~ /^%(.*)/ ) {
$value = record_runtime_port( $1 );
} else {
$proto = proto_name $proto if $proto =~ /^(\d+)$/;
$value = getservbyname( $port, $proto );
}
return $value if defined $value;
fatal_error "The separator for a port range is ':', not '-' ($port)" if $port =~ /^\d+-\d+$/;
fatal_error "Invalid/Unknown $proto port/service ($_[1])" unless defined $value;
}
sub validate_portpair( $$ ) {
my ($proto, $portpair) = @_;
my $what;
my $pair = $portpair;
#
# Accept '-' as a port-range separator
#
$pair =~ tr/-/:/ if $pair =~ /^[-0-9]+$/;
fatal_error "Invalid port range ($portpair)" if $pair =~ tr/:/:/ > 1;
$pair = "0$pair" if substr( $pair, 0, 1 ) eq ':';
$pair = "${pair}65535" if substr( $pair, -1, 1 ) eq ':';
my @ports = split /:/, $pair, 2;
my $protonum = resolve_proto( $proto ) || 0;
$_ = validate_port( $protonum, $_) for grep $_, @ports;
if ( @ports == 2 ) {
$what = 'port range';
unless ($ports[0] =~ /^\$/ || $ports[1] =~ /^\$/ ) {
fatal_error "Invalid port range ($_[1])" unless $ports[0] < $ports[1];
}
} else {
$what = 'port';
}
fatal_error "Using a $what ( $_[1] ) requires PROTO TCP, UDP, UDPLITE, SCTP or DCCP" unless
defined $protonum && ( $protonum == TCP ||
$protonum == UDP ||
$protonum == UDPLITE ||
$protonum == SCTP ||
$protonum == DCCP );
join ':', @ports;
}
sub validate_portpair1( $$ ) {
my ($proto, $portpair) = @_;
my $what;
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
$portpair = "1$portpair" if substr( $portpair, 0, 1 ) eq ':';
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
my @ports = split /-/, $portpair, 2;
my $protonum = resolve_proto( $proto ) || 0;
$_ = validate_port( $protonum, $_) for grep $_, @ports;
if ( @ports == 2 ) {
$what = 'port range';
unless ($ports[0] =~ /^\$/ || $ports[1] =~ /^\$/ ) {
fatal_error "Invalid port range ($portpair)" unless $ports[0] && $ports[0] < $ports[1];
}
} else {
$what = 'port';
fatal_error 'Invalid port number (0)' unless $portpair;
}
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
defined $protonum && ( $protonum == TCP ||
$protonum == UDP ||
$protonum == SCTP ||
$protonum == DCCP );
join '-', @ports;
}
sub validate_port_list( $$ ) {
my $result = '';
my ( $proto, $list ) = @_;
my @list = split_list( $list, 'port' );
if ( @list > 1 && $list =~ /[:-]/ ) {
require_capability( 'XMULTIPORT' , 'Port ranges in a port list', '' );
}
$proto = proto_name $proto;
for ( @list ) {
my $value = validate_portpair( $proto , $_ );
$result = $result ? join ',', $result, $value : $value;
}
$result;
}
#
# Expands a port range into a minimal list of ( port, mask ) pairs.
# Each port and mask are expressed as 4 hex nibbles without a leading '0x'.
#
# Example:
#
# DB<3> @foo = Shorewall::IPAddrs::expand_port_range( 6, '110:' ); print "@foo\n"
# 006e fffe 0070 fff0 0080 ff80 0100 ff00 0200 fe00 0400 fc00 0800 f800 1000 f000 2000 e000 4000 c000 8000 8000
#
sub expand_port_range( $$ ) {
my ( $proto, $range ) = @_;
if ( $range =~ /^(.*):(.*)$/ ) {
my ( $first, $last ) = ( $1, $2);
my @result;
fatal_error "Invalid port range ($range)" unless $first ne '' or $last ne '';
#
# Supply missing first/last port number
#
$first = 0 if $first eq '';
$last = 65535 if $last eq '';
#
# Validate the ports
#
( $first , $last ) = ( validate_port( $proto, $first || 1 ) , validate_port( $proto, $last ) );
$last++; #Increment last address for limit testing.
#
# Break the range into groups:
#
# - If the first port in the remaining range is odd, then the next group is ( <first>, ffff ).
# - Otherwise, find the largest power of two P that divides the first address such that
# the remaining range has less than or equal to P ports. The next group is
# ( <first> , ~( P-1 ) ).
#
while ( ( my $ports = ( $last - $first ) ) > 0 ) {
my $mask = 0xffff; #Mask for current ports in group.
my $y = 2; #Next power of two to test
my $z = 1; #Number of ports in current group (Previous value of $y).
while ( ( ! ( $first % $y ) ) && ( $y <= $ports ) ) {
$mask <<= 1;
$z = $y;
$y <<= 1;
}
#
#
push @result, sprintf( '%04x', $first ) , sprintf( '%04x' , $mask & 0xffff );
$first += $z;
}
fatal_error "Invalid port range ($range)" unless @result; # first port > last port
@result;
} else {
( sprintf( '%04x' , validate_port( $proto, $range ) ) , 'ffff' );
}
}
################################################################################
# End functions moved from IPAddrs.pm in 5.1.5 #
################################################################################
# #
# Functions to manipulate cmdlevel # Functions to manipulate cmdlevel
# #
@@ -1295,11 +1081,11 @@ sub format_option( $$ ) {
assert( ! reftype $value ); assert( ! reftype $value );
my $rule; my $rule = '';
$value =~ s/\s*$//; $value =~ s/\s*$//;
$rule = join( ' ' , ' -m', $option, $value ); $rule .= join( ' ' , ' -m', $option, $value );
$rule; $rule;
} }
@@ -1345,6 +1131,8 @@ sub format_rule( $$;$ ) {
} else { } else {
$rule .= join( '' , ' --', $_, ' ', $value ); $rule .= join( '' , ' --', $_, ' ', $value );
} }
next;
} elsif ( $type == EXPENSIVE ) { } elsif ( $type == EXPENSIVE ) {
# #
# Only emit expensive matches now if there are '-m nfacct' or '-m recent' matches in the rule # Only emit expensive matches now if there are '-m nfacct' or '-m recent' matches in the rule
@@ -1435,7 +1223,7 @@ sub merge_rules( $$$ ) {
} }
} }
for my $option ( grep ! $opttype{$_} || $_ eq 'nfacct' || $_ eq 'recent', keys %$fromref ) { for my $option ( grep ! $opttype{$_} || $_ eq 'nfacct' || $_ eq 'recent', sort { $b cmp $a } keys %$fromref ) {
set_rule_option( $toref, $option, $fromref->{$option} ); set_rule_option( $toref, $option, $fromref->{$option} );
} }
@@ -1451,7 +1239,7 @@ sub merge_rules( $$$ ) {
set_rule_option( $toref, 'policy', $fromref->{policy} ) if exists $fromref->{policy}; set_rule_option( $toref, 'policy', $fromref->{policy} ) if exists $fromref->{policy};
for my $option ( grep( get_opttype( $_, 0 ) == EXPENSIVE, keys %$fromref ) ) { for my $option ( grep( get_opttype( $_, 0 ) == EXPENSIVE, sort keys %$fromref ) ) {
set_rule_option( $toref, $option, $fromref->{$option} ); set_rule_option( $toref, $option, $fromref->{$option} );
} }
@@ -1927,7 +1715,7 @@ sub delete_reference( $$ ) {
assert( $toref ); assert( $toref );
delete $toref->{references}{$fromref->{name}} if --$toref->{references}{$fromref->{name}} <= 0; delete $toref->{references}{$fromref->{name}} unless --$toref->{references}{$fromref->{name}} > 0;
} }
# #
@@ -2065,7 +1853,7 @@ sub adjust_reference_counts( $$$ ) {
my ($toref, $name1, $name2) = @_; my ($toref, $name1, $name2) = @_;
if ( $toref ) { if ( $toref ) {
delete $toref->{references}{$name1} if --$toref->{references}{$name1} <= 0; delete $toref->{references}{$name1} unless --$toref->{references}{$name1} > 0;
$toref->{references}{$name2}++; $toref->{references}{$name2}++;
} }
} }
@@ -3898,21 +3686,12 @@ sub optimize_level8( $$$ ) {
} }
$combined{ $chainref1->{name} } = $chainref->{name}; $combined{ $chainref1->{name} } = $chainref->{name};
#
# While rare, it is possible for a policy chain to be combined with a non-policy chain. So we need to preserve
# the policy attributes in the combined chain
#
if ( $chainref->{policychain} ) {
@{$chainref1}{qw(policychain policy)} = @{$chainref}{qw(policychain policy)} unless $chainref1->{policychain};
} elsif ( $chainref1->{policychain} ) {
@{$chainref}{qw(policychain policy)} = @{$chainref1}{qw(policychain policy)} unless $chainref->{policychain};
}
} }
} }
} }
if ( $progress ) { if ( $progress ) {
my @rename = keys %rename; my @rename = sort keys %rename;
# #
# First create aliases for each renamed chain and change the {name} member. # First create aliases for each renamed chain and change the {name} member.
# #
@@ -4777,8 +4556,7 @@ sub do_proto( $$$;$ )
if ( $proto ne '' ) { if ( $proto ne '' ) {
my $synonly = ( $proto =~ s/:(!)?syn$//i ); my $synonly = ( $proto =~ s/:syn$//i );
my $notsyn = $1;
my $invert = ( $proto =~ s/^!// ? '! ' : '' ); my $invert = ( $proto =~ s/^!// ? '! ' : '' );
my $protonum = resolve_proto $proto; my $protonum = resolve_proto $proto;
@@ -4796,7 +4574,7 @@ sub do_proto( $$$;$ )
$output = "${invert}-p ${proto} "; $output = "${invert}-p ${proto} ";
} else { } else {
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert; fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
$output = $notsyn ? "-p $proto ! --syn " : "-p $proto --syn "; $output = "-p $proto --syn ";
} }
fatal_error "SOURCE/DEST PORT(S) not allowed with PROTO !$pname" if $invert && ($ports ne '' || $sports ne ''); fatal_error "SOURCE/DEST PORT(S) not allowed with PROTO !$pname" if $invert && ($ports ne '' || $sports ne '');
@@ -4833,7 +4611,7 @@ sub do_proto( $$$;$ )
$multiport = 1; $multiport = 1;
} else { } else {
fatal_error "Missing DEST PORT" unless supplied $ports; fatal_error "Missing DEST PORT" unless supplied $ports;
$ports = validate_portpair $pname , $ports unless $ports =~ /^\$/; $ports = validate_portpair $pname , $ports;
$output .= ( $srcndst ? "-m multiport ${invert}--ports ${ports} " : "${invert}--dport ${ports} " ); $output .= ( $srcndst ? "-m multiport ${invert}--ports ${ports} " : "${invert}--dport ${ports} " );
} }
} }
@@ -5040,7 +4818,7 @@ sub do_iproto( $$$ )
$multiport = 1; $multiport = 1;
} else { } else {
fatal_error "Missing DEST PORT" unless supplied $ports; fatal_error "Missing DEST PORT" unless supplied $ports;
$ports = validate_portpair $pname , $ports unless $ports =~ /^\$/; $ports = validate_portpair $pname , $ports;
if ( $srcndst ) { if ( $srcndst ) {
push @output, multiport => "${invert}--ports ${ports}"; push @output, multiport => "${invert}--ports ${ports}";
@@ -5979,7 +5757,6 @@ sub record_runtime_address( $$;$$ ) {
if ( $interface =~ /^{([a-zA-Z_]\w*)}$/ ) { if ( $interface =~ /^{([a-zA-Z_]\w*)}$/ ) {
fatal_error "Mixed required/optional usage of address variable $1" if ( $address_variables{$1} || $addrtype ) ne $addrtype; fatal_error "Mixed required/optional usage of address variable $1" if ( $address_variables{$1} || $addrtype ) ne $addrtype;
fatal_error "Variable %variable is already used as a port variable" if $port_variables{$1};
$address_variables{$1} = $addrtype; $address_variables{$1} = $addrtype;
return '$' . "$1 "; return '$' . "$1 ";
} }
@@ -6325,7 +6102,7 @@ sub match_dest_net( $;$ ) {
return '-d ' . record_runtime_address $1, $2; return '-d ' . record_runtime_address $1, $2;
} }
$net = validate_net $net, 1 unless $net =~ /^\$/; # Don't validate if runtime address variable $net = validate_net $net, 1;
$net eq ALLIP ? '' : "-d $net "; $net eq ALLIP ? '' : "-d $net ";
} }
@@ -6406,7 +6183,7 @@ sub imatch_dest_net( $;$ ) {
return ( d => record_runtime_address( $1, $2, 1 ) ); return ( d => record_runtime_address( $1, $2, 1 ) );
} }
$net = validate_net $net, 1 unless $net =~ /^\$/; # Don't validate if runtime address variable $net = validate_net $net, 1;
$net eq ALLIP ? () : ( d => $net ); $net eq ALLIP ? () : ( d => $net );
} }
@@ -7203,13 +6980,13 @@ sub set_global_variables( $$ ) {
if ( $conditional ) { if ( $conditional ) {
my ( $interface, @interfaces ); my ( $interface, @interfaces );
@interfaces = keys %interfaceaddr; @interfaces = sort keys %interfaceaddr;
for $interface ( @interfaces ) { for $interface ( @interfaces ) {
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfaceaddr{$interface}) ); emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfaceaddr{$interface}) );
} }
@interfaces = keys %interfacegateways; @interfaces = sort keys %interfacegateways;
for $interface ( @interfaces ) { for $interface ( @interfaces ) {
emit( qq(if [ -z "\$interface" -o "\$interface" = "$interface" ]; then) ); emit( qq(if [ -z "\$interface" -o "\$interface" = "$interface" ]; then) );
@@ -7219,36 +6996,36 @@ sub set_global_variables( $$ ) {
emit( qq(fi\n) ); emit( qq(fi\n) );
} }
@interfaces = keys %interfacemacs; @interfaces = sort keys %interfacemacs;
for $interface ( @interfaces ) { for $interface ( @interfaces ) {
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfacemacs{$interface}) ); emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfacemacs{$interface}) );
} }
} else { } else {
emit $_ for values %interfaceaddr; emit $_ for sort values %interfaceaddr;
emit "$_\n" for values %interfacegateways; emit "$_\n" for sort values %interfacegateways;
emit $_ for values %interfacemacs; emit $_ for sort values %interfacemacs;
} }
if ( $setall ) { if ( $setall ) {
emit $_ for values %interfaceaddrs; emit $_ for sort values %interfaceaddrs;
emit $_ for values %interfacenets; emit $_ for sort values %interfacenets;
unless ( have_capability( 'ADDRTYPE' ) ) { unless ( have_capability( 'ADDRTYPE' ) ) {
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
emit 'ALL_BCASTS="$(get_all_bcasts) 255.255.255.255"'; emit 'ALL_BCASTS="$(get_all_bcasts) 255.255.255.255"';
emit $_ for values %interfacebcasts; emit $_ for sort values %interfacebcasts;
} else { } else {
emit 'ALL_ACASTS="$(get_all_acasts)"'; emit 'ALL_ACASTS="$(get_all_acasts)"';
emit $_ for values %interfaceacasts; emit $_ for sort values %interfaceacasts;
} }
} }
} }
} }
sub verify_address_variables() { sub verify_address_variables() {
for my $variable ( keys %address_variables ) { for my $variable ( sort keys %address_variables ) {
my $type = $address_variables{$variable}; my $type = $address_variables{$variable};
my $address = "\$$variable"; my $address = "\$$variable";
@@ -7267,19 +7044,6 @@ sub verify_address_variables() {
qq( startup_error "Invalid value ($address) for address variable $variable"), qq( startup_error "Invalid value ($address) for address variable $variable"),
qq(fi\n) ); qq(fi\n) );
} }
for my $variable( keys %port_variables ) {
my $port = "\$$variable";
my $type = $port_variables{$variable};
emit( qq(if [ -z "$port" ]; then) ,
qq( $variable=255) ,
qq(elif qt \$g_tool -A INPUT -p 6 --dport $port; then) ,
qq( qt \$g_tool -D INPUT -p 6 --dport $variable) ,
qq(else) ,
qq( startup_error "Invalid valid ($port) for port variable $variable") ,
qq(fi\n) );
}
} }
# #
@@ -7529,11 +7293,6 @@ sub isolate_dest_interface( $$$$ ) {
$rule .= "-d $variable "; $rule .= "-d $variable ";
} }
} elsif ( $dest =~ /^\$/ ) {
#
# Runtime address variable
#
$dnets = $dest;
} elsif ( $family == F_IPV4 ) { } elsif ( $family == F_IPV4 ) {
if ( $dest =~ /^(.+?):(.+)$/ ) { if ( $dest =~ /^(.+?):(.+)$/ ) {
$diface = $1; $diface = $1;
@@ -8183,7 +7942,7 @@ sub add_interface_options( $ ) {
# #
# Generate a digest for each chain # Generate a digest for each chain
# #
for my $chainref ( values %input_chains, values %forward_chains ) { for my $chainref ( sort { $a->{name} cmp $b->{name} } values %input_chains, values %forward_chains ) {
my $digest = ''; my $digest = '';
assert( $chainref ); assert( $chainref );
@@ -8202,7 +7961,7 @@ sub add_interface_options( $ ) {
# Insert jumps to the interface chains into the rules chains # Insert jumps to the interface chains into the rules chains
# #
for my $zone1 ( off_firewall_zones ) { for my $zone1 ( off_firewall_zones ) {
my @input_interfaces = keys %{zone_interfaces( $zone1 )}; my @input_interfaces = sort keys %{zone_interfaces( $zone1 )};
my @forward_interfaces = @input_interfaces; my @forward_interfaces = @input_interfaces;
if ( @input_interfaces > 1 ) { if ( @input_interfaces > 1 ) {
@@ -8288,7 +8047,7 @@ sub add_interface_options( $ ) {
for my $zone1 ( firewall_zone, vserver_zones ) { for my $zone1 ( firewall_zone, vserver_zones ) {
for my $zone2 ( off_firewall_zones ) { for my $zone2 ( off_firewall_zones ) {
my $chainref = $filter_table->{rules_chain( $zone1, $zone2 )}; my $chainref = $filter_table->{rules_chain( $zone1, $zone2 )};
my @interfaces = keys %{zone_interfaces( $zone2 )}; my @interfaces = sort keys %{zone_interfaces( $zone2 )};
my $chain1ref; my $chain1ref;
for my $interface ( @interfaces ) { for my $interface ( @interfaces ) {
@@ -8694,7 +8453,7 @@ sub create_save_ipsets() {
# #
$ipsets{$_} = 1 for ( @ipsets, @{$globals{SAVED_IPSETS}} ); $ipsets{$_} = 1 for ( @ipsets, @{$globals{SAVED_IPSETS}} );
my @sets = keys %ipsets; my @sets = sort keys %ipsets;
emit( '' , emit( '' ,
' rm -f $file' , ' rm -f $file' ,
@@ -8870,7 +8629,7 @@ sub create_load_ipsets() {
# #
sub create_nfobjects() { sub create_nfobjects() {
my @objects = ( keys %nfobjects ); my @objects = ( sort keys %nfobjects );
if ( @objects ) { if ( @objects ) {
if ( $config{NFACCT} ) { if ( $config{NFACCT} ) {
@@ -8885,7 +8644,7 @@ sub create_nfobjects() {
} }
} }
for ( keys %nfobjects ) { for ( sort keys %nfobjects ) {
emit( qq(if ! qt \$NFACCT get $_; then), emit( qq(if ! qt \$NFACCT get $_; then),
qq( \$NFACCT add $_), qq( \$NFACCT add $_),
qq(fi\n) ); qq(fi\n) );
@@ -8914,15 +8673,9 @@ sub create_netfilter_load( $ ) {
my $UTILITY = $family == F_IPV4 ? 'IPTABLES_RESTORE' : 'IP6TABLES_RESTORE'; my $UTILITY = $family == F_IPV4 ? 'IPTABLES_RESTORE' : 'IP6TABLES_RESTORE';
emit( '', emit( '',
'if [ "$COMMAND" = reload -a -n "$g_counters" ] && chain_exists $g_sha1sum1 && chain_exists $g_sha1sum2 ; then' ); 'if [ "$COMMAND" = reload -a -n "$g_counters" ] && chain_exists $g_sha1sum1 && chain_exists $g_sha1sum2 ; then',
' option="--counters"',
if ( have_capability( 'RESTORE_WAIT_OPTION' ) ) { '',
emit( ' option="--counters --wait "' . $config{MUTEX_TIMEOUT} );
} else {
emit( ' option="--counters"' );
}
emit( '',
' progress_message "Reusing existing ruleset..."', ' progress_message "Reusing existing ruleset..."',
'', '',
'else' 'else'
@@ -8930,11 +8683,7 @@ sub create_netfilter_load( $ ) {
push_indent; push_indent;
if ( have_capability( 'RESTORE_WAIT_OPTION' ) ) { emit 'option=';
emit 'option="--wait "' . $config{MUTEX_TIMEOUT};
} else {
emit 'option=';
}
save_progress_message "Preparing $utility input..."; save_progress_message "Preparing $utility input...";
@@ -9349,11 +9098,7 @@ sub create_stop_load( $ ) {
enter_cmd_mode; enter_cmd_mode;
if ( have_capability( 'RESTORE_WAIT_OPTION' ) ) { emit( '[ -n "$g_debug_iptables" ] && command=debug_restore_input || command=$' . $UTILITY );
emit( '[ -n "$g_debug_iptables" ] && command=debug_restore_input || command="$' . $UTILITY . ' --wait ' . $config{MUTEX_TIMEOUT} . '"' );
} else {
emit( '[ -n "$g_debug_iptables" ] && command=debug_restore_input || command=$' . $UTILITY );
}
emit( '', emit( '',
'progress_message2 "Running $command..."', 'progress_message2 "Running $command..."',
@@ -9375,7 +9120,7 @@ sub initialize_switches() {
if ( keys %switches ) { if ( keys %switches ) {
emit( 'if [ $COMMAND = start ]; then' ); emit( 'if [ $COMMAND = start ]; then' );
push_indent; push_indent;
for my $switch ( keys %switches ) { for my $switch ( sort keys %switches ) {
my $setting = $switches{$switch}; my $setting = $switches{$switch};
my $file = "/proc/net/nf_condition/$switch"; my $file = "/proc/net/nf_condition/$switch";
emit "[ -f $file ] && echo $setting->{setting} > $file"; emit "[ -f $file ] && echo $setting->{setting} > $file";

View File

@@ -93,10 +93,11 @@ sub generate_script_1( $ ) {
my $date = compiletime; my $date = compiletime;
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#"; emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
copy $globals{SHAREDIRPL} . '/lib.runtime', 0;
copy2 $globals{SHAREDIRPL} . '/lib.common' , $debug;
} }
copy $globals{SHAREDIRPL} . '/lib.runtime', 0;
copy2 $globals{SHAREDIRPL} . '/lib.common' , $debug;
} }
my $lib = find_file 'lib.private'; my $lib = find_file 'lib.private';
@@ -109,7 +110,7 @@ sub generate_script_1( $ ) {
################################################################################ ################################################################################
EOF EOF
for my $exit ( qw/init start tcclear started stop stopped clear refresh refreshed restored enabled disabled/ ) { for my $exit ( qw/init start tcclear started stop stopped clear refresh refreshed restored/ ) {
emit "\nrun_${exit}_exit() {"; emit "\nrun_${exit}_exit() {";
push_indent; push_indent;
append_file $exit or emit 'true'; append_file $exit or emit 'true';
@@ -209,8 +210,6 @@ sub generate_script_2() {
emit ( '[ -f ${g_confdir}/vardir ] && . ${g_confdir}/vardir' ); emit ( '[ -f ${g_confdir}/vardir ] && . ${g_confdir}/vardir' );
emit ( qq([ -n "\${VARDIR:=$shorewallrc1{VARDIR}}" ]) ); emit ( qq([ -n "\${VARDIR:=$shorewallrc1{VARDIR}}" ]) );
emit ( qq([ -n "\${VARLIB:=$shorewallrc1{VARLIB}}" ]) ); emit ( qq([ -n "\${VARLIB:=$shorewallrc1{VARLIB}}" ]) );
emit ( qq([ -n "\${CONFDIR:=$shorewallrc1{CONFDIR}}" ]) );
emit ( qq([ -n "\${SHAREDIR:=$shorewallrc1{SHAREDIR}}" ]) );
emit 'TEMPFILE='; emit 'TEMPFILE=';
@@ -946,7 +945,7 @@ sub compiler {
# #
# Copy the footer to the script # Copy the footer to the script
# #
copy $globals{SHAREDIRPL} . 'prog.footer'; copy $globals{SHAREDIRPL} . 'prog.footer' unless $test;
disable_script; disable_script;
# #

View File

@@ -86,9 +86,6 @@ our @EXPORT = qw(
kernel_version kernel_version
compiletime compiletime
F_IPV4
F_IPV6
); );
our @EXPORT_OK = qw( $shorewall_dir initialize shorewall); our @EXPORT_OK = qw( $shorewall_dir initialize shorewall);
@@ -200,6 +197,9 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
PARMSMODIFIED PARMSMODIFIED
USEDCALLER USEDCALLER
F_IPV4
F_IPV6
TCP TCP
UDP UDP
UDPLITE UDPLITE
@@ -413,9 +413,7 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
WAIT_OPTION => 'iptables --wait option', WAIT_OPTION => 'iptables --wait option',
CPU_FANOUT => 'NFQUEUE CPU Fanout', CPU_FANOUT => 'NFQUEUE CPU Fanout',
NETMAP_TARGET => 'NETMAP Target', NETMAP_TARGET => 'NETMAP Target',
NFLOG_SIZE => '--nflog-size support',
RESTORE_WAIT_OPTION
=> 'iptables-restore --wait option',
AMANDA_HELPER => 'Amanda Helper', AMANDA_HELPER => 'Amanda Helper',
FTP_HELPER => 'FTP Helper', FTP_HELPER => 'FTP Helper',
FTP0_HELPER => 'FTP-0 Helper', FTP0_HELPER => 'FTP-0 Helper',
@@ -490,55 +488,53 @@ our %helpers_aliases;
our %helpers_enabled; our %helpers_enabled;
our %config_files = ( #accounting => 1, our %config_files = ( #accounting => 1,
actions => 1, actions => 1,
blacklist => 1, blacklist => 1,
clear => 1, clear => 1,
conntrack => 1, conntrack => 1,
ecn => 1, ecn => 1,
findgw => 1, findgw => 1,
hosts => 1, hosts => 1,
init => 1, init => 1,
initdone => 1, initdone => 1,
interfaces => 1, interfaces => 1,
isusable => 1, isusable => 1,
maclist => 1, maclist => 1,
mangle => 1, masq => 1,
masq => 1, nat => 1,
nat => 1, netmap => 1,
netmap => 1, params => 1,
params => 1, policy => 1,
policy => 1, providers => 1,
providers => 1, proxyarp => 1,
proxyarp => 1, refresh => 1,
refresh => 1, refreshed => 1,
refreshed => 1, restored => 1,
restored => 1, rawnat => 1,
rawnat => 1,
route_rules => 1, route_rules => 1,
routes => 1, routes => 1,
routestopped => 1, routestopped => 1,
rtrules => 1, rtrules => 1,
rules => 1, rules => 1,
scfilter => 1, scfilter => 1,
secmarks => 1, secmarks => 1,
snat => 1, start => 1,
start => 1, started => 1,
started => 1, stop => 1,
stop => 1, stopped => 1,
stopped => 1,
stoppedrules => 1, stoppedrules => 1,
tcclasses => 1, tcclasses => 1,
tcclear => 1, tcclear => 1,
tcdevices => 1, tcdevices => 1,
tcfilters => 1, tcfilters => 1,
tcinterfaces => 1, tcinterfaces => 1,
tcpri => 1, tcpri => 1,
tcrules => 1, tcrules => 1,
tos => 1, tos => 1,
tunnels => 1, tunnels => 1,
zones => 1 ); zones => 1 );
# #
# Options that involve the AUDIT target # Options that involve the the AUDIT target
# #
our @auditoptions = qw( BLACKLIST_DISPOSITION MACLIST_DISPOSITION TCP_FLAGS_DISPOSITION ); our @auditoptions = qw( BLACKLIST_DISPOSITION MACLIST_DISPOSITION TCP_FLAGS_DISPOSITION );
# #
@@ -752,8 +748,8 @@ sub initialize( $;$$) {
TC_SCRIPT => '', TC_SCRIPT => '',
EXPORT => 0, EXPORT => 0,
KLUDGEFREE => '', KLUDGEFREE => '',
VERSION => "5.1.5-RC1", VERSION => "5.1.1-RC1",
CAPVERSION => 50106 , CAPVERSION => 50100 ,
BLACKLIST_LOG_TAG => '', BLACKLIST_LOG_TAG => '',
RELATED_LOG_TAG => '', RELATED_LOG_TAG => '',
MACLIST_LOG_TAG => '', MACLIST_LOG_TAG => '',
@@ -911,8 +907,6 @@ sub initialize( $;$$) {
ZERO_MARKS => undef , ZERO_MARKS => undef ,
FIREWALL => undef , FIREWALL => undef ,
BALANCE_PROVIDERS => undef , BALANCE_PROVIDERS => undef ,
PERL_HASH_SEED => undef ,
USE_NFLOG_SIZE => undef ,
# #
# Packet Disposition # Packet Disposition
# #
@@ -1046,8 +1040,6 @@ sub initialize( $;$$) {
WAIT_OPTION => undef, WAIT_OPTION => undef,
CPU_FANOUT => undef, CPU_FANOUT => undef,
NETMAP_TARGET => undef, NETMAP_TARGET => undef,
NFLOG_SIZE => undef,
RESTORE_WAIT_OPTION => undef,
AMANDA_HELPER => undef, AMANDA_HELPER => undef,
FTP_HELPER => undef, FTP_HELPER => undef,
@@ -1100,7 +1092,7 @@ sub initialize( $;$$) {
%compiler_params = (); %compiler_params = ();
%actparams = ( 0 => 0, loglevel => '', logtag => '', chain => '', disposition => '', caller => '', callfile => '', callline => '' ); %actparams = ( 0 => 0, loglevel => '', logtag => '', chain => '', disposition => '', caller => '' );
$parmsmodified = 0; $parmsmodified = 0;
$usedcaller = 0; $usedcaller = 0;
%ipsets = (); %ipsets = ();
@@ -1173,7 +1165,7 @@ sub initialize( $;$$) {
# #
# Process the global shorewallrc file # Process the global shorewallrc file
# #
# Note: The build script calls this function passing only the protocol family # Note: The build file executes this function passing only the protocol family
# #
process_shorewallrc( $shorewallrc, process_shorewallrc( $shorewallrc,
$family == F_IPV4 ? 'shorewall' : 'shorewall6' $family == F_IPV4 ? 'shorewall' : 'shorewall6'
@@ -1224,9 +1216,10 @@ sub compiletime() {
# Create 'currentlineinfo' # Create 'currentlineinfo'
# #
sub currentlineinfo() { sub currentlineinfo() {
if ( $currentfilename ) { my $linenumber = $currentlinenumber || 1;
my $linenumber = $currentlinenumber || 1;
my $lineinfo = " $currentfilename "; if ( $currentfile ) {
my $lineinfo = " $currentfilename ";
if ( $linenumber eq 'EOF' ) { if ( $linenumber eq 'EOF' ) {
$lineinfo .= '(EOF)' $lineinfo .= '(EOF)'
@@ -2239,7 +2232,7 @@ sub split_list4( $ ) {
sub split_columns( $ ) { sub split_columns( $ ) {
my ($list) = @_; my ($list) = @_;
return split ' ', $list unless $list =~ /[()]/; return split ' ', $list unless $list =~ /\(/;
my @list1 = split ' ', $list; my @list1 = split ' ', $list;
my @list2; my @list2;
@@ -2280,7 +2273,9 @@ sub split_columns( $ ) {
} }
} }
fatal_error "Mismatched parentheses ($list)" unless $opencount == 0; unless ( $opencount == 0 ) {
fatal_error "Mismatched parentheses ($list)";
}
@list2; @list2;
} }
@@ -2293,7 +2288,7 @@ sub clear_comment();
# ensure that it has an appropriate number of columns. # ensure that it has an appropriate number of columns.
# supply '-' in omitted trailing columns. # supply '-' in omitted trailing columns.
# Handles all of the supported forms of column/pair specification # Handles all of the supported forms of column/pair specification
# Handles segragating raw iptables input in rules # Handles segragating raw iptables input in INLINE rules
# #
sub split_line2( $$;$$$ ) { sub split_line2( $$;$$$ ) {
my ( $description, $columnsref, $nopad, $maxcolumns, $inline ) = @_; my ( $description, $columnsref, $nopad, $maxcolumns, $inline ) = @_;
@@ -2346,7 +2341,7 @@ sub split_line2( $$;$$$ ) {
$inline_matches = $pairs; $inline_matches = $pairs;
if ( $columns =~ /^(\s*|.*[^&@%])\{(.*)\}\s*$/ ) { if ( $columns =~ /^(\s*|.*[^&@%]){(.*)}\s*$/ ) {
# #
# Pairs are enclosed in curly brackets. # Pairs are enclosed in curly brackets.
# #
@@ -2362,7 +2357,7 @@ sub split_line2( $$;$$$ ) {
if ( $currline =~ /^\s*INLINE(?:\(.*\)(:.*)?|:.*)?\s/ || $currline =~ /^\s*IP6?TABLES(?:\(.*\)|:.*)?\s/ ) { if ( $currline =~ /^\s*INLINE(?:\(.*\)(:.*)?|:.*)?\s/ || $currline =~ /^\s*IP6?TABLES(?:\(.*\)|:.*)?\s/ ) {
$inline_matches = $pairs; $inline_matches = $pairs;
if ( $columns =~ /^(\s*|.*[^&@%])\{(.*)\}\s*$/ ) { if ( $columns =~ /^(\s*|.*[^&@%]){(.*)}\s*$/ ) {
# #
# Pairs are enclosed in curly brackets. # Pairs are enclosed in curly brackets.
# #
@@ -2376,7 +2371,7 @@ sub split_line2( $$;$$$ ) {
} elsif ( $checkinline ) { } elsif ( $checkinline ) {
warning_message "This entry needs to be changed before INLINE_MATCHES can be set to Yes"; warning_message "This entry needs to be changed before INLINE_MATCHES can be set to Yes";
} }
} elsif ( $currline =~ /^(\s*|.*[^&@%])\{(.*)\}$/ ) { } elsif ( $currline =~ /^(\s*|.*[^&@%]){(.*)}$/ ) {
# #
# Pairs are enclosed in curly brackets. # Pairs are enclosed in curly brackets.
# #
@@ -2442,12 +2437,12 @@ sub split_line2( $$;$$$ ) {
} }
} else { } else {
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column}; fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
$column = $columnsref->{$column};
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
$value = $1 if $value =~ /^"([^"]+)"$/; $value = $1 if $value =~ /^"([^"]+)"$/;
$value =~ s/\\"/"/g; $value =~ s/\\"/"/g;
fatal_error "Non-ASCII gunk in the value of the $column column" if $value =~ /[^\s[:print:]]/; fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
my $colnum = $columnsref->{$column}; $line[$column] = $value;
warning_message qq(Replacing "$line[$colnum]" with "$value" in the ) . uc( $column ) . ' column' if $line[$colnum] ne '-';
$line[$colnum] = $value;
} }
} }
} }
@@ -2787,7 +2782,7 @@ sub evaluate_expression( $$$$ ) {
my ( $first, $var, $rest ) = ( $1, $3, $4); my ( $first, $var, $rest ) = ( $1, $3, $4);
$var = numeric_value( $var ) if $var =~ /^\d/; $var = numeric_value( $var ) if $var =~ /^\d/;
$val = $var ? $actparams{$var} : $chain; $val = $var ? $actparams{$var} : $chain;
$usedcaller = USEDCALLER if $var =~ /^(?:caller|callfile|callline)$/; $usedcaller = USEDCALLER if $var eq 'caller';
$expression = join_parts( $first, $val, $rest , $just_expand ); $expression = join_parts( $first, $val, $rest , $just_expand );
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100; directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
} }
@@ -2823,6 +2818,7 @@ sub evaluate_expression( $$$$ ) {
# #
# Not a simple one-term expression -- compile it # Not a simple one-term expression -- compile it
# #
declare_passed unless $evals++; declare_passed unless $evals++;
$val = eval qq(package Shorewall::User; $val = eval qq(package Shorewall::User;
@@ -2839,7 +2835,6 @@ sub evaluate_expression( $$$$ ) {
$val; $val;
} }
sub pop_open();
# #
# Set callback # Set callback
# #
@@ -2847,40 +2842,6 @@ sub directive_callback( $ ) {
$directive_callback = shift; $directive_callback = shift;
} }
sub directive_message( \&$$$$ ) {
my ( $functptr, $verbose, $expression, $filename, $linenumber ) = @_;
unless ( $omitting ) {
if ( $actparams{0} ) {
#
# When issuing a message from an action, report the action invocation
# site rather than the action file and line number.
#
# Avoid double-reporting by temporarily removing the invocation site
# from the open stack.
#
my $saveopens = pop @openstack;
$functptr->( $verbose ,
evaluate_expression( $expression ,
$filename ,
$linenumber ,
1 ),
$actparams{callfile} ,
$actparams{callline} );
push @openstack, $saveopens;
} else {
$functptr->( $verbose ,
evaluate_expression( $expression ,
$filename ,
$linenumber ,
1 ),
$filename ,
$linenumber );
}
}
}
# #
# Each entry in @ifstack consists of a 4-tupple # Each entry in @ifstack consists of a 4-tupple
# #
@@ -2894,8 +2855,7 @@ sub process_compiler_directive( $$$$ ) {
print "CD===> $line\n" if $debug; print "CD===> $line\n" if $debug;
directive_error( "Invalid compiler directive ($line)" , $filename, $linenumber ) directive_error( "Invalid compiler directive ($line)" , $filename, $linenumber ) unless $line =~ /^\s*\?(IF\s+|ELSE|ELSIF\s+|ENDIF|SET\s+|RESET\s+|FORMAT\s+|COMMENT\s*|ERROR\s+|WARNING\s+|INFO\s+|WARNING!\s+|INFO!\s+|REQUIRE\s+)(.*)$/i;
unless $line =~ /^\s*\?(IF\s+|ELSE|ELSIF\s+|ENDIF|SET\s+|RESET\s+|FORMAT\s+|COMMENT\s*|ERROR\s+|WARNING\s+|INFO\s+|WARNING!\s+|INFO!\s+|REQUIRE\s+)(.*)$/i;
my ($keyword, $expression) = ( uc $1, $2 ); my ($keyword, $expression) = ( uc $1, $2 );
@@ -2997,16 +2957,15 @@ sub process_compiler_directive( $$$$ ) {
$var = $2 || 'chain'; $var = $2 || 'chain';
directive_error( "Shorewall variables may only be RESET in the body of an action", $filename, $linenumber ) unless $actparams{0}; directive_error( "Shorewall variables may only be RESET in the body of an action", $filename, $linenumber ) unless $actparams{0};
if ( exists $actparams{$var} ) { if ( exists $actparams{$var} ) {
if ( $var =~ /^(?:loglevel|logtag|chain|disposition|caller|callfile|callline)$/ ) { if ( $var =~ /^loglevel|logtag|chain|disposition|caller$/ ) {
$actparams{$var} = ''; $actparams{$var} = '';
} else { } else {
delete $actparams{$var} delete $actparams{$var}
} }
$parmsmodified = PARMSMODIFIED if @ifstack > $ifstack;
} else { } else {
directive_warning( 'Yes', "Shorewall variable $2 does not exist", $filename, $linenumber ); directive_warning( 'Yes', "Shorewall variable $2 does not exist", $filename, $linenumber );
} }
} else { } else {
if ( exists $variables{$2} ) { if ( exists $variables{$2} ) {
delete $variables{$2}; delete $variables{$2};
@@ -3037,85 +2996,68 @@ sub process_compiler_directive( $$$$ ) {
ERROR => sub() { ERROR => sub() {
unless ( $omitting ) { unless ( $omitting ) {
if ( $actparams{0} ) { directive_error( evaluate_expression( $expression ,
close $currentfile; $filename ,
# $linenumber ,
# Avoid 'missing ?ENDIF' error in pop_open' 1 ) ,
# $filename ,
@ifstack = (); $linenumber ) unless $omitting;
#
# Avoid double-reporting the action invocation site
#
pop_open;
directive_error( evaluate_expression( $expression ,
$filename ,
$linenumber ,
1 ) ,
$actparams{callfile} ,
$actparams{callline} );
} else {
directive_error( evaluate_expression( $expression ,
$filename ,
$linenumber ,
1 ) ,
$filename ,
$linenumber ) unless $omitting;
}
} }
} , } ,
WARNING => sub() { WARNING => sub() {
directive_message( &directive_warning , unless ( $omitting ) {
$config{VERBOSE_MESSAGES}, directive_warning( $config{VERBOSE_MESSAGES} ,
$expression , evaluate_expression( $expression ,
$filename , $filename ,
$linenumber ); $linenumber ,
1 ),
$filename ,
$linenumber ) unless $omitting;
}
} , } ,
INFO => sub() { INFO => sub() {
directive_message( &directive_info, unless ( $omitting ) {
$config{VERBOSE_MESSAGES} , directive_info( $config{VERBOSE_MESSAGES} ,
$expression , evaluate_expression( $expression ,
$filename , $filename ,
$linenumber ); $linenumber ,
1 ),
$filename ,
$linenumber ) unless $omitting;
}
} , } ,
'WARNING!' => sub() { 'WARNING!' => sub() {
directive_message( &directive_warning , unless ( $omitting ) {
! $config{VERBOSE_MESSAGES} , directive_warning( ! $config{VERBOSE_MESSAGES} ,
$expression , evaluate_expression( $expression ,
$filename , $filename ,
$linenumber ); $linenumber ,
1 ),
$filename ,
$linenumber ) unless $omitting;
}
} , } ,
'INFO!' => sub() { 'INFO!' => sub() {
directive_message( &directive_info , unless ( $omitting ) {
! $config{VERBOSE_MESSAGES} , directive_info( ! $config{VERBOSE_MESSAGES} ,
$expression , evaluate_expression( $expression ,
$filename , $filename ,
$linenumber ); $linenumber ,
1 ),
$filename ,
$linenumber ) unless $omitting;
}
} , } ,
REQUIRE => sub() { REQUIRE => sub() {
unless ( $omitting ) { unless ( $omitting ) {
fatal_error "?REQUIRE may only be used within action files" unless $actparams{0}; fatal_error "?REQUIRE may only be used within action files" unless $actparams{0};
fatal_error "Unknown capability ($expression)" unless ( my $capdesc = $capdesc{$expression} ); fatal_error "Unknown capability ($expression)" unless exists $capabilities{$expression};
unless ( have_capability( $expression ) ) { require_capability( $expression, "The $actparams{action} action", 's' );
close $currentfile;
#
# Avoid 'missing ?ENDIF' error in pop_open'
#
@ifstack = ();
#
# Avoid double-reporting the action call site
#
pop_open;
directive_error( "The $actparams{action} action requires the $capdesc capability",
$actparams{callfile} ,
$actparams{callline} );
}
} }
} , } ,
@@ -3617,8 +3559,6 @@ sub push_action_params( $$$$$$ ) {
$actparams{loglevel} = $loglevel; $actparams{loglevel} = $loglevel;
$actparams{logtag} = $logtag; $actparams{logtag} = $logtag;
$actparams{caller} = $caller; $actparams{caller} = $caller;
$actparams{callfile} = $currentfilename;
$actparams{callline} = $currentlinenumber;
$actparams{disposition} = '' if $chainref->{action}; $actparams{disposition} = '' if $chainref->{action};
# #
# The Shorewall variable '@chain' has non-word characters other than hyphen removed # The Shorewall variable '@chain' has non-word characters other than hyphen removed
@@ -3749,7 +3689,6 @@ sub expand_variables( \$ ) {
$usedcaller = USEDCALLER if $var eq 'caller'; $usedcaller = USEDCALLER if $var eq 'caller';
} else { } else {
fatal_error "Undefined shell variable (\$$var)" unless $config{IGNOREUNKNOWNVARIABLES} || exists $config{$var}; fatal_error "Undefined shell variable (\$$var)" unless $config{IGNOREUNKNOWNVARIABLES} || exists $config{$var};
$val = $config{$var};
} }
$val = '' unless defined $val; $val = '' unless defined $val;
@@ -4051,7 +3990,7 @@ sub make_mask( $ ) {
0xffffffff >> ( 32 - $_[0] ); 0xffffffff >> ( 32 - $_[0] );
} }
my @suffixes; my @suffixes = qw(group range threshold nlgroup cprange qthreshold);
# #
# Validate a log level -- Drop the trailing '!' and translate to numeric value if appropriate" # Validate a log level -- Drop the trailing '!' and translate to numeric value if appropriate"
@@ -4320,7 +4259,7 @@ sub load_kernel_modules( ) {
close LSMOD; close LSMOD;
$config{MODULE_SUFFIX} = 'ko ko.gz ko.xz o o.gz o.xz gz xz' unless $config{MODULE_SUFFIX}; $config{MODULE_SUFFIX} = 'o gz xz ko o.gz o.xz ko.gz ko.xz' unless $config{MODULE_SUFFIX};
my @suffixes = split /\s+/ , $config{MODULE_SUFFIX}; my @suffixes = split /\s+/ , $config{MODULE_SUFFIX};
@@ -4823,10 +4762,6 @@ sub NFLog_Target() {
qt1( "$iptables $iptablesw -A $sillyname -j NFLOG" ); qt1( "$iptables $iptablesw -A $sillyname -j NFLOG" );
} }
sub NFLog_Size() {
have_capability( 'NFLOG_TARGET' ) && qt1( "$iptables $iptablesw -A $sillyname -j NFLOG --nflog-size 64" );
}
sub Logmark_Target() { sub Logmark_Target() {
qt1( "$iptables $iptablesw -A $sillyname -j LOGMARK" ); qt1( "$iptables $iptablesw -A $sillyname -j LOGMARK" );
} }
@@ -4950,10 +4885,6 @@ sub Cpu_Fanout() {
have_capability( 'NFQUEUE_TARGET' ) && qt1( "$iptables -A $sillyname -j NFQUEUE --queue-balance 0:3 --queue-cpu-fanout" ); have_capability( 'NFQUEUE_TARGET' ) && qt1( "$iptables -A $sillyname -j NFQUEUE --queue-balance 0:3 --queue-cpu-fanout" );
} }
sub Restore_Wait_Option() {
length( `${iptables}-restore --wait < /dev/null 2>&1` ) == 0;
}
our %detect_capability = our %detect_capability =
( ACCOUNT_TARGET =>\&Account_Target, ( ACCOUNT_TARGET =>\&Account_Target,
AMANDA_HELPER => \&Amanda_Helper, AMANDA_HELPER => \&Amanda_Helper,
@@ -5006,7 +4937,6 @@ our %detect_capability =
LOG_TARGET => \&Log_Target, LOG_TARGET => \&Log_Target,
ULOG_TARGET => \&Ulog_Target, ULOG_TARGET => \&Ulog_Target,
NFLOG_TARGET => \&NFLog_Target, NFLOG_TARGET => \&NFLog_Target,
NFLOG_SIZE => \&NFLog_Size,
MANGLE_ENABLED => \&Mangle_Enabled, MANGLE_ENABLED => \&Mangle_Enabled,
MANGLE_FORWARD => \&Mangle_Forward, MANGLE_FORWARD => \&Mangle_Forward,
MARK => \&Mark, MARK => \&Mark,
@@ -5034,7 +4964,6 @@ our %detect_capability =
REALM_MATCH => \&Realm_Match, REALM_MATCH => \&Realm_Match,
REAP_OPTION => \&Reap_Option, REAP_OPTION => \&Reap_Option,
RECENT_MATCH => \&Recent_Match, RECENT_MATCH => \&Recent_Match,
RESTORE_WAIT_OPTION => \&Restore_Wait_Option,
RPFILTER_MATCH => \&RPFilter_Match, RPFILTER_MATCH => \&RPFilter_Match,
SANE_HELPER => \&SANE_Helper, SANE_HELPER => \&SANE_Helper,
SANE0_HELPER => \&SANE0_Helper, SANE0_HELPER => \&SANE0_Helper,
@@ -5201,9 +5130,6 @@ sub determine_capabilities() {
$capabilities{TCPMSS_TARGET} = detect_capability( 'TCPMSS_TARGET' ); $capabilities{TCPMSS_TARGET} = detect_capability( 'TCPMSS_TARGET' );
$capabilities{CPU_FANOUT} = detect_capability( 'CPU_FANOUT' ); $capabilities{CPU_FANOUT} = detect_capability( 'CPU_FANOUT' );
$capabilities{NETMAP_TARGET} = detect_capability( 'NETMAP_TARGET' ); $capabilities{NETMAP_TARGET} = detect_capability( 'NETMAP_TARGET' );
$capabilities{NFLOG_SIZE} = detect_capability( 'NFLOG_SIZE' );
$capabilities{RESTORE_WAIT_OPTION}
= detect_capability( 'RESTORE_WAIT_OPTION' );
unless ( have_capability 'CT_TARGET' ) { unless ( have_capability 'CT_TARGET' ) {
$capabilities{HELPER_MATCH} = detect_capability 'HELPER_MATCH'; $capabilities{HELPER_MATCH} = detect_capability 'HELPER_MATCH';
@@ -5381,11 +5307,11 @@ sub update_config_file( $ ) {
update_default( 'BALANCE_PROVIDERS', 'Yes' ); update_default( 'BALANCE_PROVIDERS', 'Yes' );
} }
update_default( 'EXPORTMODULES', 'No' ); update_default( 'EXPORTMODULES', 'No' );
update_default( 'RESTART', 'reload' ); update_default( 'RESTART', 'reload' );
update_default( 'PAGER', $shorewallrc1{DEFAULT_PAGER} ); update_default( 'PAGER', $shorewallrc1{DEFAULT_PAGER} );
update_default( 'LOGFORMAT', 'Shorewall:%s:%s:' ); update_default( 'LOGFORMAT', 'Shorewall:%s:%s:' );
update_default( 'LOGLIMIT', '' ); update_default( 'LOGLIMIT', '' );
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
update_default( 'BLACKLIST_DEFAULT', 'dropBcasts,dropNotSyn,dropInvalid' ); update_default( 'BLACKLIST_DEFAULT', 'dropBcasts,dropNotSyn,dropInvalid' );
@@ -5442,12 +5368,8 @@ sub update_config_file( $ ) {
} }
} }
if ( supplied $val ) {
# $val = conditional_quote $val;
# Log LEVEL and DEFAULT settings often contain parens
#
$val = ($var =~ /(?:LEVEL|DEFAULT)$/) ? qq("$val") : conditional_quote $val;
}
$_ = "$var=$val\n"; $_ = "$var=$val\n";
} }
@@ -5510,7 +5432,6 @@ EOF
sub process_shorewall_conf( $$ ) { sub process_shorewall_conf( $$ ) {
my ( $update, $annotate ) = @_; my ( $update, $annotate ) = @_;
my $file = find_file "$product.conf"; my $file = find_file "$product.conf";
my @vars;
if ( -f $file ) { if ( -f $file ) {
$globals{CONFIGDIR} = $configfile = $file; $globals{CONFIGDIR} = $configfile = $file;
@@ -5524,7 +5445,7 @@ sub process_shorewall_conf( $$ ) {
# Don't expand shell variables or allow embedded scripting # Don't expand shell variables or allow embedded scripting
# #
while ( read_a_line( STRIP_COMMENTS | SUPPRESS_WHITESPACE | CHECK_GUNK ) ) { while ( read_a_line( STRIP_COMMENTS | SUPPRESS_WHITESPACE | CHECK_GUNK ) ) {
if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*)$/ ) { if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*?)\s*$/ ) {
my ($var, $val) = ($1, $2); my ($var, $val) = ($1, $2);
if ( exists $config{$var} ) { if ( exists $config{$var} ) {
@@ -5543,12 +5464,6 @@ sub process_shorewall_conf( $$ ) {
next; next;
} }
if ( $update ) {
push @vars, $var;
} else {
expand_variables( $val ) unless $val =~ /^'.*'$/;
}
$config{$var} = ( $val =~ /\"([^\"]*)\"$/ ? $1 : $val ); $config{$var} = ( $val =~ /\"([^\"]*)\"$/ ? $1 : $val );
warning_message "Option $var=$val is deprecated" warning_message "Option $var=$val is deprecated"
@@ -5569,19 +5484,14 @@ sub process_shorewall_conf( $$ ) {
# #
# Now update the config file if asked # Now update the config file if asked
# #
if ( $update ) { update_config_file( $annotate ) if $update;
update_config_file( $annotate ); #
# # Config file update requires that the option values not have
# Config file update requires that the option values not have # Shell variables expanded. We do that now.
# Shell variables expanded. We do that now. #
# for ( values %config ) {
# To handle options like LOG_LEVEL, we process the options if ( supplied $_ ) {
# in the order in which they appear in the .conf file. expand_variables( $_ ) unless /^'(.+)'$/;
#
for ( @vars ) {
if ( supplied( my $val = $config{$_} ) ) {
expand_variables( $config{$_} ) unless $val =~ /^'.*'$/;
}
} }
} }
} }
@@ -6070,6 +5980,7 @@ sub get_configuration( $$$$ ) {
# #
# get_capabilities requires that the true settings of these options be established # get_capabilities requires that the true settings of these options be established
# #
default 'MODULE_PREFIX', 'ko ko.gz o o.gz gz';
default_yes_no 'LOAD_HELPERS_ONLY' , 'Yes'; default_yes_no 'LOAD_HELPERS_ONLY' , 'Yes';
if ( ! $export && $> == 0 ) { if ( ! $export && $> == 0 ) {
@@ -6410,17 +6321,6 @@ sub get_configuration( $$$$ ) {
default_yes_no 'AUTOMAKE' , ''; default_yes_no 'AUTOMAKE' , '';
default_yes_no 'TRACK_PROVIDERS' , ''; default_yes_no 'TRACK_PROVIDERS' , '';
default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : ''; default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : '';
default_yes_no 'USE_NFLOG_SIZE' , '';
if ( $config{USE_NFLOG_SIZE} ) {
if ( have_capability( 'NFLOG_SIZE' ) ) {
@suffixes = qw(group size threshold nlgroup cprange qthreshold);
} else {
fatal_error "USE_NFLOG_SIZE=Yes, but the --nflog-size capabiity is not present";
}
} else {
@suffixes = qw(group range threshold nlgroup cprange qthreshold);
}
unless ( ( $config{NULL_ROUTE_RFC1918} || '' ) =~ /^(?:blackhole|unreachable|prohibit)$/ ) { unless ( ( $config{NULL_ROUTE_RFC1918} || '' ) =~ /^(?:blackhole|unreachable|prohibit)$/ ) {
default_yes_no( 'NULL_ROUTE_RFC1918', '' ); default_yes_no( 'NULL_ROUTE_RFC1918', '' );
@@ -6841,12 +6741,6 @@ sub get_configuration( $$$$ ) {
} }
} }
if ( supplied( $val = $config{MUTEX_TIMEOUT} ) ) {
fatal_error "Invalid value ($val) for MUTEX_TIMEOUT" unless $val && $val =~ /^\d+$/;
} else {
$config{MUTEX_TIMEOUT} = 60;
}
add_variables %config; add_variables %config;
while ( my ($var, $val ) = each %renamed ) { while ( my ($var, $val ) = each %renamed ) {

View File

@@ -63,6 +63,7 @@ our @EXPORT = ( qw( ALLIPv4
validate_host validate_host
validate_range validate_range
ip_range_explicit ip_range_explicit
expand_port_range
allipv4 allipv4
allipv6 allipv6
allip allip
@@ -73,6 +74,10 @@ our @EXPORT = ( qw( ALLIPv4
resolve_proto resolve_proto
resolve_dnsname resolve_dnsname
proto_name proto_name
validate_port
validate_portpair
validate_portpair1
validate_port_list
validate_icmp validate_icmp
validate_icmp6 validate_icmp6
) ); ) );
@@ -384,8 +389,6 @@ sub resolve_proto( $ ) {
my $proto = $_[0]; my $proto = $_[0];
my $number; my $number;
$proto =~ s/:.*//;
if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) { if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) {
$number = numeric_value ( $proto ); $number = numeric_value ( $proto );
defined $number && $number <= 255 ? $number : undef; defined $number && $number <= 255 ? $number : undef;
@@ -406,6 +409,114 @@ sub proto_name( $ ) {
$proto =~ /^(\d+)$/ ? $prototoname[ $proto ] || scalar getprotobynumber $proto : $proto $proto =~ /^(\d+)$/ ? $prototoname[ $proto ] || scalar getprotobynumber $proto : $proto
} }
sub validate_port( $$ ) {
my ($proto, $port) = @_;
my $value;
if ( $port =~ /^(\d+)$/ || $port =~ /^0x/ ) {
$port = numeric_value $port;
return $port if defined $port && $port && $port <= 65535;
} else {
$proto = proto_name $proto if $proto =~ /^(\d+)$/;
$value = getservbyname( $port, $proto );
}
return $value if defined $value;
fatal_error "The separator for a port range is ':', not '-' ($port)" if $port =~ /^\d+-\d+$/;
fatal_error "Invalid/Unknown $proto port/service ($_[1])" unless defined $value;
}
sub validate_portpair( $$ ) {
my ($proto, $portpair) = @_;
my $what;
my $pair = $portpair;
#
# Accept '-' as a port-range separator
#
$pair =~ tr/-/:/ if $pair =~ /^[-0-9]+$/;
fatal_error "Invalid port range ($portpair)" if $pair =~ tr/:/:/ > 1;
$pair = "0$pair" if substr( $pair, 0, 1 ) eq ':';
$pair = "${pair}65535" if substr( $pair, -1, 1 ) eq ':';
my @ports = split /:/, $pair, 2;
my $protonum = resolve_proto( $proto ) || 0;
$_ = validate_port( $protonum, $_) for grep $_, @ports;
if ( @ports == 2 ) {
$what = 'port range';
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
} else {
$what = 'port';
}
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, UDPLITE, SCTP or DCCP" unless
defined $protonum && ( $protonum == TCP ||
$protonum == UDP ||
$protonum == UDPLITE ||
$protonum == SCTP ||
$protonum == DCCP );
join ':', @ports;
}
sub validate_portpair1( $$ ) {
my ($proto, $portpair) = @_;
my $what;
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
$portpair = "1$portpair" if substr( $portpair, 0, 1 ) eq ':';
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
my @ports = split /-/, $portpair, 2;
my $protonum = resolve_proto( $proto ) || 0;
$_ = validate_port( $protonum, $_) for grep $_, @ports;
if ( @ports == 2 ) {
$what = 'port range';
fatal_error "Invalid port range ($portpair)" unless $ports[0] && $ports[0] < $ports[1];
} else {
$what = 'port';
fatal_error 'Invalid port number (0)' unless $portpair;
}
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
defined $protonum && ( $protonum == TCP ||
$protonum == UDP ||
$protonum == SCTP ||
$protonum == DCCP );
join '-', @ports;
}
sub validate_port_list( $$ ) {
my $result = '';
my ( $proto, $list ) = @_;
my @list = split_list( $list, 'port' );
if ( @list > 1 && $list =~ /[:-]/ ) {
require_capability( 'XMULTIPORT' , 'Port ranges in a port list', '' );
}
$proto = proto_name $proto;
for ( @list ) {
my $value = validate_portpair( $proto , $_ );
$result = $result ? join ',', $result, $value : $value;
}
$result;
}
my %icmp_types = ( any => 'any', my %icmp_types = ( any => 'any',
'echo-reply' => 0, 'echo-reply' => 0,
'destination-unreachable' => 3, 'destination-unreachable' => 3,
@@ -459,6 +570,67 @@ sub validate_icmp( $ ) {
fatal_error "Invalid ICMP Type ($type)" fatal_error "Invalid ICMP Type ($type)"
} }
#
# Expands a port range into a minimal list of ( port, mask ) pairs.
# Each port and mask are expressed as 4 hex nibbles without a leading '0x'.
#
# Example:
#
# DB<3> @foo = Shorewall::IPAddrs::expand_port_range( 6, '110:' ); print "@foo\n"
# 006e fffe 0070 fff0 0080 ff80 0100 ff00 0200 fe00 0400 fc00 0800 f800 1000 f000 2000 e000 4000 c000 8000 8000
#
sub expand_port_range( $$ ) {
my ( $proto, $range ) = @_;
if ( $range =~ /^(.*):(.*)$/ ) {
my ( $first, $last ) = ( $1, $2);
my @result;
fatal_error "Invalid port range ($range)" unless $first ne '' or $last ne '';
#
# Supply missing first/last port number
#
$first = 0 if $first eq '';
$last = 65535 if $last eq '';
#
# Validate the ports
#
( $first , $last ) = ( validate_port( $proto, $first || 1 ) , validate_port( $proto, $last ) );
$last++; #Increment last address for limit testing.
#
# Break the range into groups:
#
# - If the first port in the remaining range is odd, then the next group is ( <first>, ffff ).
# - Otherwise, find the largest power of two P that divides the first address such that
# the remaining range has less than or equal to P ports. The next group is
# ( <first> , ~( P-1 ) ).
#
while ( ( my $ports = ( $last - $first ) ) > 0 ) {
my $mask = 0xffff; #Mask for current ports in group.
my $y = 2; #Next power of two to test
my $z = 1; #Number of ports in current group (Previous value of $y).
while ( ( ! ( $first % $y ) ) && ( $y <= $ports ) ) {
$mask <<= 1;
$z = $y;
$y <<= 1;
}
#
#
push @result, sprintf( '%04x', $first ) , sprintf( '%04x' , $mask & 0xffff );
$first += $z;
}
fatal_error "Invalid port range ($range)" unless @result; # first port > last port
@result;
} else {
( sprintf( '%04x' , validate_port( $proto, $range ) ) , 'ffff' );
}
}
sub valid_6address( $ ) { sub valid_6address( $ ) {
my $address = $_[0]; my $address = $_[0];

View File

@@ -127,7 +127,7 @@ sub setup_ecn()
} }
if ( @hosts ) { if ( @hosts ) {
my @interfaces = ( keys %interfaces ); my @interfaces = ( sort { interface_number($a) <=> interface_number($b) } keys %interfaces );
progress_message "$doing ECN control on @interfaces..."; progress_message "$doing ECN control on @interfaces...";
@@ -1213,53 +1213,55 @@ sub add_common_rules ( $ ) {
} }
} }
my $announced = 0; if ( $family == F_IPV4 ) {
my $announced = 0;
$list = find_interfaces_by_option 'upnp'; $list = find_interfaces_by_option 'upnp';
if ( @$list ) { if ( @$list ) {
progress_message2 "$doing UPnP"; progress_message2 "$doing UPnP";
$chainref = set_optflags( new_nat_chain( 'UPnP' ), DONT_OPTIMIZE ); $chainref = set_optflags( new_nat_chain( 'UPnP' ), DONT_OPTIMIZE );
add_commands( $chainref, '[ -s /${VARDIR}/.UPnP ] && cat ${VARDIR}/.UPnP >&3' ); add_commands( $chainref, '[ -s /${VARDIR}/.UPnP ] && cat ${VARDIR}/.UPnP >&3' );
my $chainref1; my $chainref1;
if ( $config{MINIUPNPD} ) { if ( $config{MINIUPNPD} ) {
$chainref1 = set_optflags( new_nat_chain( 'MINIUPNPD-POSTROUTING' ), DONT_OPTIMIZE ); $chainref1 = set_optflags( new_nat_chain( 'MINIUPNPD-POSTROUTING' ), DONT_OPTIMIZE );
add_commands( $chainref, '[ -s /${VARDIR}/.MINIUPNPD-POSTROUTING ] && cat ${VARDIR}/.MINIUPNPD-POSTROUTING >&3' ); add_commands( $chainref, '[ -s /${VARDIR}/.MINIUPNPD-POSTROUTING ] && cat ${VARDIR}/.MINIUPNPD-POSTROUTING >&3' );
}
$announced = 1;
for $interface ( @$list ) {
add_ijump_extended $nat_table->{PREROUTING} , j => 'UPnP', get_interface_origin($interface), imatch_source_dev ( $interface );
add_ijump_extended $nat_table->{$globals{POSTROUTING}} , j => 'MINIUPNPD-POSTROUTING' , $origin{MINIUPNPD} , imatch_dest_dev ( $interface ) if $chainref1;
}
} }
$announced = 1; $list = find_interfaces_by_option 'upnpclient';
for $interface ( @$list ) { if ( @$list ) {
add_ijump_extended $nat_table->{PREROUTING} , j => 'UPnP', get_interface_origin($interface), imatch_source_dev ( $interface ); progress_message2 "$doing UPnP" unless $announced;
add_ijump_extended $nat_table->{$globals{POSTROUTING}} , j => 'MINIUPNPD-POSTROUTING' , $origin{MINIUPNPD} , imatch_dest_dev ( $interface ) if $chainref1;
}
}
$list = find_interfaces_by_option 'upnpclient'; for $interface ( @$list ) {
my $chainref = $filter_table->{input_option_chain $interface};
my $base = uc var_base get_physical $interface;
my $optional = interface_is_optional( $interface );
my $variable = get_interface_gateway( $interface, ! $optional );
my $origin = get_interface_origin( $interface );
if ( @$list ) { if ( $optional ) {
progress_message2 "$doing UPnP" unless $announced; add_commands( $chainref,
qq(if [ -n "SW_\$${base}_IS_USABLE" -a -n "$variable" ]; then) );
for $interface ( @$list ) { incr_cmd_level( $chainref );
my $chainref = $filter_table->{input_option_chain $interface}; add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
my $base = uc var_base get_physical $interface; decr_cmd_level( $chainref );
my $optional = interface_is_optional( $interface ); add_commands( $chainref, 'fi' );
my $variable = get_interface_gateway( $interface, ! $optional ); } else {
my $origin = get_interface_origin( $interface ); add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
}
if ( $optional ) {
add_commands( $chainref,
qq(if [ -n "SW_\$${base}_IS_USABLE" -a -n "$variable" ]; then) );
incr_cmd_level( $chainref );
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
decr_cmd_level( $chainref );
add_commands( $chainref, 'fi' );
} else {
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
} }
} }
} }
@@ -1295,7 +1297,7 @@ sub setup_mac_lists( $ ) {
$maclist_interfaces{ $hostref->[0] } = 1; $maclist_interfaces{ $hostref->[0] } = 1;
} }
my @maclist_interfaces = ( keys %maclist_interfaces ); my @maclist_interfaces = ( sort keys %maclist_interfaces );
if ( $phase == 1 ) { if ( $phase == 1 ) {
@@ -1616,7 +1618,7 @@ sub handle_loopback_traffic() {
# Handle conntrack rules # Handle conntrack rules
# #
if ( $notrackref->{referenced} ) { if ( $notrackref->{referenced} ) {
for my $hostref ( @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) { for my $hostref ( sort { $a->{type} cmp $b->{type} } @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
my $exclusion = source_exclusion( $hostref->{exclusions}, $notrackref); my $exclusion = source_exclusion( $hostref->{exclusions}, $notrackref);
my @ipsec_match = match_ipsec_in $z1 , $hostref; my @ipsec_match = match_ipsec_in $z1 , $hostref;
@@ -1637,8 +1639,8 @@ sub handle_loopback_traffic() {
# #
my $source_hosts_ref = defined_zone( $z1 )->{hosts}; my $source_hosts_ref = defined_zone( $z1 )->{hosts};
for my $typeref ( values %{$source_hosts_ref} ) { for my $typeref ( sort { $a->{type} cmp $b->{type} } values %{$source_hosts_ref} ) {
for my $hostref ( @{$typeref->{'%vserver%'}} ) { for my $hostref ( sort { $a->{type} cmp $b->{type} } @{$typeref->{'%vserver%'}} ) {
my $exclusion = source_exclusion( $hostref->{exclusions}, $natref); my $exclusion = source_exclusion( $hostref->{exclusions}, $natref);
for my $net ( @{$hostref->{hosts}} ) { for my $net ( @{$hostref->{hosts}} ) {
@@ -1660,7 +1662,7 @@ sub add_interface_jumps {
our %input_jump_added; our %input_jump_added;
our %output_jump_added; our %output_jump_added;
our %forward_jump_added; our %forward_jump_added;
my @interfaces = grep $_ ne '%vserver%', @_; my @interfaces = sort grep $_ ne '%vserver%', @_;
my $dummy; my $dummy;
my $lo_jump_added = interface_zone( loopback_interface ) && ! get_interface_option( loopback_interface, 'destonly' ); my $lo_jump_added = interface_zone( loopback_interface ) && ! get_interface_option( loopback_interface, 'destonly' );
# #
@@ -1774,7 +1776,7 @@ sub handle_complex_zone( $$ ) {
my $type = $zoneref->{type}; my $type = $zoneref->{type};
my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {}; my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {};
for my $interface ( keys %$source_ref ) { for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$source_ref ) {
my $sourcechainref = $filter_table->{forward_chain $interface}; my $sourcechainref = $filter_table->{forward_chain $interface};
my @interfacematch; my @interfacematch;
my $interfaceref = find_interface $interface; my $interfaceref = find_interface $interface;
@@ -2286,9 +2288,9 @@ sub generate_matrix() {
# #
# Take care of PREROUTING, INPUT and OUTPUT jumps # Take care of PREROUTING, INPUT and OUTPUT jumps
# #
for my $type ( keys %$source_hosts_ref ) { for my $type ( sort keys %$source_hosts_ref ) {
my $typeref = $source_hosts_ref->{$type}; my $typeref = $source_hosts_ref->{$type};
for my $interface ( keys %$typeref ) { for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) {
if ( get_physical( $interface ) eq '+' ) { if ( get_physical( $interface ) eq '+' ) {
# #
# Insert the interface-specific jumps before this one which is not interface-specific # Insert the interface-specific jumps before this one which is not interface-specific
@@ -2373,9 +2375,9 @@ sub generate_matrix() {
my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT
for my $type ( keys %{$zone1ref->{hosts}} ) { for my $type ( sort keys %{$zone1ref->{hosts}} ) {
my $typeref = $zone1ref->{hosts}{$type}; my $typeref = $zone1ref->{hosts}{$type};
for my $interface ( keys %$typeref ) { for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) {
for my $hostref ( @{$typeref->{$interface}} ) { for my $hostref ( @{$typeref->{$interface}} ) {
next if $hostref->{options}{sourceonly}; next if $hostref->{options}{sourceonly};
if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) { if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) {

View File

@@ -941,17 +941,7 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
} else { } else {
$server = $1 if $family == F_IPV6 && $server =~ /^\[(.+)\]$/; $server = $1 if $family == F_IPV6 && $server =~ /^\[(.+)\]$/;
fatal_error "Invalid server IP address ($server)" if $server eq ALLIP || $server eq NILIP; fatal_error "Invalid server IP address ($server)" if $server eq ALLIP || $server eq NILIP;
my @servers = validate_address $server, 1;
my @servers;
if ( ( $server =~ /^([&%])(.+)/ ) ) {
$server = record_runtime_address( $1, $2 );
$server =~ s/ $//;
@servers = ( $server );
} else {
@servers = validate_address $server, 1;
}
$server = join ',', @servers; $server = join ',', @servers;
} }

View File

@@ -64,8 +64,6 @@ our @load_interfaces;
our $balancing; our $balancing;
our $fallback; our $fallback;
our $balanced_providers;
our $fallback_providers;
our $metrics; our $metrics;
our $first_default_route; our $first_default_route;
our $first_fallback_route; our $first_fallback_route;
@@ -101,8 +99,6 @@ sub initialize( $ ) {
%provider_interfaces = (); %provider_interfaces = ();
@load_interfaces = (); @load_interfaces = ();
$balancing = 0; $balancing = 0;
$balanced_providers = 0;
$fallback_providers = 0;
$fallback = 0; $fallback = 0;
$metrics = 0; $metrics = 0;
$first_default_route = 1; $first_default_route = 1;
@@ -327,13 +323,7 @@ sub balance_default_route( $$$$ ) {
emit ''; emit '';
if ( $first_default_route ) { if ( $first_default_route ) {
if ( $balanced_providers == 1 ) { if ( $gateway ) {
if ( $gateway ) {
emit "DEFAULT_ROUTE=\"via $gateway dev $interface $realm\"";
} else {
emit "DEFAULT_ROUTE=\"dev $interface $realm\"";
}
} elsif ( $gateway ) {
emit "DEFAULT_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\""; emit "DEFAULT_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\"";
} else { } else {
emit "DEFAULT_ROUTE=\"nexthop dev $interface weight $weight $realm\""; emit "DEFAULT_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
@@ -357,13 +347,7 @@ sub balance_fallback_route( $$$$ ) {
emit ''; emit '';
if ( $first_fallback_route ) { if ( $first_fallback_route ) {
if ( $fallback_providers == 1 ) { if ( $gateway ) {
if ( $gateway ) {
emit "FALLBACK_ROUTE=\"via $gateway dev $interface $realm\"";
} else {
emit "FALLBACK_ROUTE=\"dev $interface $realm\"";
}
} elsif ( $gateway ) {
emit "FALLBACK_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\""; emit "FALLBACK_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\"";
} else { } else {
emit "FALLBACK_ROUTE=\"nexthop dev $interface weight $weight $realm\""; emit "FALLBACK_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
@@ -609,12 +593,7 @@ sub process_a_provider( $ ) {
} }
} }
if ( $balance ) { fatal_error q(The 'balance' and 'fallback' options are mutually exclusive) if $balance && $default;
fatal_error q(The 'balance' and 'fallback' options are mutually exclusive) if $default;
$balanced_providers++;
} elsif ( $default ) {
$fallback_providers++;
}
if ( $load ) { if ( $load ) {
fatal_error q(The 'balance=<weight>' and 'load=<load-factor>' options are mutually exclusive) if $balance > 1; fatal_error q(The 'balance=<weight>' and 'load=<load-factor>' options are mutually exclusive) if $balance > 1;
@@ -1088,10 +1067,7 @@ CEOF
emit( "setup_${dev}_tc" ) if $tcdevices->{$interface}; emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
} }
emit( qq(rm -f \${VARDIR}/${physical}_disabled), emit( qq(rm -f \${VARDIR}/${physical}_disabled) );
$pseudo ? "run_enabled_exit ${physical} ${interface}" : "run_enabled_exit ${physical} ${interface} ${table}"
);
emit_started_message( '', 2, $pseudo, $table, $number ); emit_started_message( '', 2, $pseudo, $table, $number );
if ( get_interface_option( $interface, 'used_address_variable' ) || get_interface_option( $interface, 'used_gateway_variable' ) ) { if ( get_interface_option( $interface, 'used_address_variable' ) || get_interface_option( $interface, 'used_gateway_variable' ) ) {
@@ -1236,9 +1212,7 @@ CEOF
"qt \$TC qdisc del dev $physical ingress\n" ) if $tcdevices->{$interface}; "qt \$TC qdisc del dev $physical ingress\n" ) if $tcdevices->{$interface};
} }
emit( "echo 1 > \${VARDIR}/${physical}.status", emit( "echo 1 > \${VARDIR}/${physical}.status" );
$pseudo ? "run_disabled_exit ${physical} ${interface}" : "run_disabled_exit ${physical} ${interface} ${table}"
);
if ( $pseudo ) { if ( $pseudo ) {
emit( "progress_message2 \" Optional Interface $table stopped\"" ); emit( "progress_message2 \" Optional Interface $table stopped\"" );
@@ -1560,9 +1534,9 @@ sub finish_providers() {
} else { } else {
emit ( " if echo \$DEFAULT_ROUTE | grep -q 'nexthop.+nexthop'; then", emit ( " if echo \$DEFAULT_ROUTE | grep -q 'nexthop.+nexthop'; then",
" qt \$IP -6 route delete default scope global table $table \$DEFAULT_ROUTE", " qt \$IP -6 route delete default scope global table $table \$DEFAULT_ROUTE",
" run_ip route add default scope global table $table \$DEFAULT_ROUTE", " run_ip -6 route add default scope global table $table \$DEFAULT_ROUTE",
' else', ' else',
" run_ip route replace default scope global table $table \$DEFAULT_ROUTE", " run_ip -6 route replace default scope global table $table \$DEFAULT_ROUTE",
' fi', ' fi',
'' ); '' );
} }
@@ -1825,7 +1799,7 @@ sub map_provider_to_interface() {
my $haveoptional; my $haveoptional;
for my $providerref ( values %providers ) { for my $providerref ( sort { $a->{number} cmp $b->{number} } values %providers ) {
if ( $providerref->{optional} ) { if ( $providerref->{optional} ) {
unless ( $haveoptional++ ) { unless ( $haveoptional++ ) {
emit( 'if [ -n "$interface" ]; then', emit( 'if [ -n "$interface" ]; then',
@@ -1989,7 +1963,7 @@ sub compile_updown() {
} }
my @nonshared = ( grep $providers{$_}->{optional}, my @nonshared = ( grep $providers{$_}->{optional},
values %provider_interfaces ); sort( { $providers{$a}->{number} <=> $providers{$b}->{number} } values %provider_interfaces ) );
if ( @nonshared ) { if ( @nonshared ) {
my $interfaces = join( '|', map $providers{$_}->{physical}, @nonshared ); my $interfaces = join( '|', map $providers{$_}->{physical}, @nonshared );
@@ -2184,7 +2158,7 @@ sub handle_optional_interfaces( $ ) {
# names but they might derive from wildcard interface entries. Optional interfaces which do not have # names but they might derive from wildcard interface entries. Optional interfaces which do not have
# wildcard physical names are also included in the providers table. # wildcard physical names are also included in the providers table.
# #
for my $providerref ( grep $_->{optional} , values %providers ) { for my $providerref ( grep $_->{optional} , sort { $a->{number} <=> $b->{number} } values %providers ) {
push @interfaces, $providerref->{interface}; push @interfaces, $providerref->{interface};
$wildcards ||= $providerref->{wildcard}; $wildcards ||= $providerref->{wildcard};
} }

View File

@@ -154,7 +154,7 @@ sub setup_proxy_arp() {
emit ''; emit '';
for my $interface ( keys %reset ) { for my $interface ( sort keys %reset ) {
unless ( $set{interface} ) { unless ( $set{interface} ) {
my $physical = get_physical $interface; my $physical = get_physical $interface;
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" , emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
@@ -163,7 +163,7 @@ sub setup_proxy_arp() {
} }
} }
for my $interface ( keys %set ) { for my $interface ( sort keys %set ) {
my $physical = get_physical $interface; my $physical = get_physical $interface;
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" , emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
" echo 1 > /proc/sys/net/ipv$family/conf/$physical/$proc_file" ); " echo 1 > /proc/sys/net/ipv$family/conf/$physical/$proc_file" );

View File

@@ -144,6 +144,8 @@ our %macros;
our $family; our $family;
our @builtins;
# #
# Commands that can be embedded in a basic rule and how many total tokens on the line (0 => unlimited). # Commands that can be embedded in a basic rule and how many total tokens on the line (0 => unlimited).
# #
@@ -350,7 +352,7 @@ sub initialize( $ ) {
# #
$macro_nest_level = 0; $macro_nest_level = 0;
# #
# All actions mentioned in /etc/shorewall[6]/actions and /usr/share/shorewall[6]/actions.std # All builtin actions plus those mentioned in /etc/shorewall[6]/actions and /usr/share/shorewall[6]/actions.std
# #
%actions = (); %actions = ();
# #
@@ -361,6 +363,7 @@ sub initialize( $ ) {
@columns = ( ( '-' ) x LAST_COLUMN, 0 ); @columns = ( ( '-' ) x LAST_COLUMN, 0 );
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
@builtins = qw/dropBcast dropMcast allowBcast allowMcast dropNotSyn rejNotSyn allowinUPnP forwardUPnP Limit/;
%reject_options = ( 'icmp-net-unreachable' => 1, %reject_options = ( 'icmp-net-unreachable' => 1,
'icmp-host-unreachable' => 1, 'icmp-host-unreachable' => 1,
'icmp-port-unreachable' => 1, 'icmp-port-unreachable' => 1,
@@ -373,6 +376,7 @@ sub initialize( $ ) {
); );
} else { } else {
@builtins = qw/dropBcast dropMcast allowBcast allowMcast dropNotSyn rejNotSyn/;
%reject_options = ( 'icmp6-no-route' => 1, %reject_options = ( 'icmp6-no-route' => 1,
'no-route' => 1, 'no-route' => 1,
'icmp6-adm-prohibited' => 1, 'icmp6-adm-prohibited' => 1,
@@ -617,7 +621,7 @@ sub handle_nfqueue( $$ ) {
fatal_error "Invalid NFQUEUE queue number ($queue1)" unless defined( $queuenum1) && $queuenum1 >= 0 && $queuenum1 <= 65535; fatal_error "Invalid NFQUEUE queue number ($queue1)" unless defined( $queuenum1) && $queuenum1 >= 0 && $queuenum1 <= 65535;
if ( supplied $queue2 ) { if ( supplied $queue2 ) {
$fanout = $queue2 =~ s/c$// ? ' --queue-cpu-fanout' : ''; $fanout = ' --queue-cpu-fanout' if $queue2 =~ s/c$//;
$queuenum2 = numeric_value( $queue2 ); $queuenum2 = numeric_value( $queue2 );
fatal_error "Invalid NFQUEUE queue number ($queue2)" unless defined( $queuenum2) && $queuenum2 >= 0 && $queuenum2 <= 65535 && $queuenum1 < $queuenum2; fatal_error "Invalid NFQUEUE queue number ($queue2)" unless defined( $queuenum2) && $queuenum2 >= 0 && $queuenum2 <= 65535 && $queuenum1 < $queuenum2;
@@ -747,21 +751,22 @@ sub process_a_policy1($$$$$$$) {
if ( $serverwild ) { if ( $serverwild ) {
for my $zone ( @zonelist ) { for my $zone ( @zonelist ) {
for my $zone1 ( @zonelist ) { for my $zone1 ( @zonelist ) {
set_policy_chain rules_chain( ${zone}, ${zone1} ), $zone, $zone1, $chainref, $policy, $intrazone; set_policy_chain rules_chain( ${zone}, ${zone1} ), $client, $server, $chainref, $policy, $intrazone;
print_policy $zone, $zone1, $originalpolicy, $chain; print_policy $zone, $zone1, $originalpolicy, $chain;
} }
} }
} else { } else {
for my $zone ( all_zones ) { for my $zone ( all_zones ) {
set_policy_chain rules_chain( ${zone}, ${server} ), $zone, $server, $chainref, $policy, $intrazone; set_policy_chain rules_chain( ${zone}, ${server} ), $client, $server, $chainref, $policy, $intrazone;
print_policy $zone, $server, $originalpolicy, $chain; print_policy $zone, $server, $originalpolicy, $chain;
} }
} }
} elsif ( $serverwild ) { } elsif ( $serverwild ) {
for my $zone ( @zonelist ) { for my $zone ( @zonelist ) {
set_policy_chain rules_chain( ${client}, ${zone} ), $client, $zone, $chainref, $policy, $intrazone; set_policy_chain rules_chain( ${client}, ${zone} ), $client, $server, $chainref, $policy, $intrazone;
print_policy $client, $zone, $originalpolicy, $chain; print_policy $client, $zone, $originalpolicy, $chain;
} }
} else { } else {
print_policy $client, $server, $originalpolicy, $chain; print_policy $client, $server, $originalpolicy, $chain;
} }
@@ -1705,6 +1710,191 @@ sub map_old_actions( $ ) {
} }
} }
#
# The following small functions generate rules for the builtin actions of the same name
#
sub dropBcast( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit ( 'DROP', $audit );
if ( have_capability( 'ADDRTYPE' ) ) {
if ( $level ne '' ) {
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', addrtype => '--dst-type BROADCAST' );
if ( $family == F_IPV4 ) {
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '224.0.0.0/4' );
} else {
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => IPv6_MULTICAST );
}
}
add_ijump $chainref, j => $target, addrtype => '--dst-type BROADCAST';
} else {
if ( $family == F_IPV4 ) {
add_commands $chainref, 'for address in $ALL_BCASTS; do';
} else {
add_commands $chainref, 'for address in $ALL_ACASTS; do';
}
incr_cmd_level $chainref;
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '$address' ) if $level ne '';
add_ijump $chainref, j => $target, d => '$address';
decr_cmd_level $chainref;
add_commands $chainref, 'done';
}
}
sub dropMcast( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit ( 'DROP', $audit );
if ( $family == F_IPV4 ) {
log_irule_limit $level, $chainref, 'dropMcast' , 'DROP', [], $tag, 'add', '', d => '224.0.0.0/4' if $level ne '';
add_ijump $chainref, j => $target, d => '224.0.0.0/4';
} else {
log_irule_limit( $level, $chainref, 'dropMcast' , 'DROP', [], $tag, 'add', '', d => IPv6_MULTICAST ) if $level ne '';
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
}
}
sub allowBcast( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit( 'ACCEPT', $audit );
if ( $family == F_IPV4 && have_capability( 'ADDRTYPE' ) ) {
if ( $level ne '' ) {
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', addrtype => '--dst-type BROADCAST' );
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', d => '224.0.0.0/4' );
}
add_ijump $chainref, j => $target, addrtype => '--dst-type BROADCAST';
} else {
if ( $family == F_IPV4 ) {
add_commands $chainref, 'for address in $ALL_BCASTS; do';
} else {
add_commands $chainref, 'for address in $ALL_MACASTS; do';
}
incr_cmd_level $chainref;
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', d => '$address' ) if $level ne '';
add_ijump $chainref, j => $target, d => '$address';
decr_cmd_level $chainref;
add_commands $chainref, 'done';
}
}
sub allowMcast( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit( 'ACCEPT', $audit );
if ( $family == F_IPV4 ) {
log_irule_limit( $level, $chainref, 'allowMcast' , 'ACCEPT', [], $tag, 'add', '', d => '224.0.0.0/4' ) if $level ne '';
add_ijump $chainref, j => $target, d => '224.0.0.0/4';
} else {
log_irule_limit( $level, $chainref, 'allowMcast' , 'ACCEPT', '', $tag, 'add', '', d => IPv6_MULTICAST ) if $level ne '';
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
}
}
sub dropNotSyn ( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit( 'DROP', $audit );
log_irule_limit( $level, $chainref, 'dropNotSyn' , 'DROP', [], $tag, 'add', '', p => '6 ! --syn' ) if $level ne '';
add_ijump $chainref , j => $target, p => '6 ! --syn';
}
sub rejNotSyn ( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
warning_message "rejNotSyn is deprecated in favor of NotSyn(REJECT)";
my $target = 'REJECT --reject-with tcp-reset';
if ( supplied $audit ) {
$target = require_audit( 'REJECT' , $audit );
}
log_irule_limit( $level, $chainref, 'rejNotSyn' , 'REJECT', [], $tag, 'add', '', p => '6 ! --syn' ) if $level ne '';
add_ijump $chainref , j => $target, p => '6 ! --syn';
}
sub forwardUPnP ( $$$$ ) {
my $chainref = set_optflags( 'forwardUPnP', DONT_OPTIMIZE );
add_commands( $chainref , '[ -f ${VARDIR}/.forwardUPnP ] && cat ${VARDIR}/.forwardUPnP >&3' );
}
sub allowinUPnP ( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit( 'ACCEPT', $audit );
if ( $level ne '' ) {
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', '', p => '17 --dport 1900' );
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', '', p => '6 --dport 49152' );
}
add_ijump $chainref, j => $target, p => '17 --dport 1900';
add_ijump $chainref, j => $target, p => '6 --dport 49152';
}
sub Limit( $$$$ ) {
my ($chainref, $level, $tag, $param ) = @_;
my @param;
if ( $param ) {
@param = split /,/, $param;
} else {
@param = split /,/, $tag;
$tag = '';
}
fatal_error 'Limit rules must include <set name>,<max connections>,<interval> as the log tag or as parameters' unless @param == 3;
my $set = $param[0];
for ( @param[1,2] ) {
fatal_error 'Max connections and interval in Limit rules must be numeric (' . join( ':', 'Limit', $level eq '' ? 'none' : $level, $tag ) . ')' unless /^\d+$/
}
my $count = $param[1] + 1;
require_capability( 'RECENT_MATCH' , 'Limit rules' , '' );
warning_message "The Limit action is deprecated in favor of per-IP rate limiting using the RATE LIMIT column";
add_irule $chainref, recent => "--name $set --set";
if ( $level ne '' ) {
my $xchainref = new_chain 'filter' , "$chainref->{name}%";
log_irule_limit( $level, $xchainref, $param[0], 'DROP', [], $tag, 'add' , '' );
add_ijump $xchainref, j => 'DROP';
add_ijump $chainref, j => $xchainref, recent => "--name $set --update --seconds $param[2] --hitcount $count";
} else {
add_ijump $chainref, j => 'DROP', recent => "--update --name $set --seconds $param[2] --hitcount $count";
}
add_ijump $chainref, j => 'ACCEPT';
}
my %builtinops = ( 'dropBcast' => \&dropBcast,
'dropMcast' => \&dropMcast,
'allowBcast' => \&allowBcast,
'allowMcast' => \&allowMcast,
'dropNotSyn' => \&dropNotSyn,
'rejNotSyn' => \&rejNotSyn,
'allowinUPnP' => \&allowinUPnP,
'forwardUPnP' => \&forwardUPnP,
'Limit' => \&Limit,
);
sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ); sub process_rule ( $$$$$$$$$$$$$$$$$$$$ );
sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ); sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ );
sub process_snat1( $$$$$$$$$$$$ ); sub process_snat1( $$$$$$$$$$$$ );
@@ -1726,6 +1916,12 @@ sub process_action(\$\$$) {
my $actionref = $actions{$action}; my $actionref = $actions{$action};
my $matches = fetch_inline_matches; my $matches = fetch_inline_matches;
if ( $type & BUILTIN ) {
$level = '' if $level =~ /none!?/;
$builtinops{$action}->( $chainref, $level, $tag, $param );
return 0;
}
if ( $type & MANGLE_TABLE ) { if ( $type & MANGLE_TABLE ) {
fatal_error "Action $action may only be used in the mangle file" unless $chainref->{table} eq 'mangle'; fatal_error "Action $action may only be used in the mangle file" unless $chainref->{table} eq 'mangle';
} else { } else {
@@ -1998,6 +2194,7 @@ sub process_action(\$\$$) {
# #
# This function is called prior to processing of the policy file. It: # This function is called prior to processing of the policy file. It:
# #
# - Adds the builtin actions to the target table
# - Reads actions.std and actions (in that order) and for each entry: # - Reads actions.std and actions (in that order) and for each entry:
# o Adds the action to the target table # o Adds the action to the target table
# o Verifies that the corresponding action file exists # o Verifies that the corresponding action file exists
@@ -2006,6 +2203,10 @@ sub process_action(\$\$$) {
sub process_actions() { sub process_actions() {
progress_message2 "Locating Action Files..."; progress_message2 "Locating Action Files...";
#
# Add built-in actions to the target table and create those actions
#
$targets{$_} = new_action( $_ , ACTION + BUILTIN, NOINLINE_OPT, '' , '' ) for @builtins;
for my $file ( qw/actions.std actions/ ) { for my $file ( qw/actions.std actions/ ) {
open_file( $file, 2 ); open_file( $file, 2 );
@@ -5642,23 +5843,15 @@ sub process_snat( )
sub setup_snat( $ ) # Convert masq->snat if true sub setup_snat( $ ) # Convert masq->snat if true
{ {
my $fn; my $fn;
my $have_masq;
if ( $_[0] ) { convert_masq() if $_[0];
convert_masq();
} elsif ( $fn = open_file( 'masq', 1, 1 ) ) { if ( $fn = open_file( 'masq', 1, 1 ) ) {
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty masq file" , 's'; } ); first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty masq file" , 's'; } );
process_one_masq(0), $have_masq = 1 while read_a_line( NORMAL_READ ); process_one_masq(0) while read_a_line( NORMAL_READ );
} } elsif ( $fn = open_file( 'snat', 1, 1 ) ) {
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty snat file" , 's'; } );
unless ( $have_masq ) { process_snat while read_a_line( NORMAL_READ );
#
# Masq file empty or didn't exist
#
if ( $fn = open_file( 'snat', 1, 1 ) ) {
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty snat file" , 's'; } );
process_snat while read_a_line( NORMAL_READ );
}
} }
} }

View File

@@ -1434,7 +1434,7 @@ sub process_tc_filter2( $$$$$$$$$ ) {
while ( @sportlist ) { while ( @sportlist ) {
my ( $sport, $smask ) = ( shift @sportlist, shift @sportlist ); my ( $sport, $smask ) = ( shift @sportlist, shift @sportlist );
$rule .= "\\\n cmp\\( u16 at 0 layer 2 mask 0x$smask eq 0x$sport \\)"; $rule .= "\\\n cmp\\( u16 at 0 layer 2 mask $smask eq 0x$sport \\)";
$rule .= ' or' if @sportlist; $rule .= ' or' if @sportlist;
} }
@@ -1924,7 +1924,7 @@ sub process_traffic_shaping() {
my ( $options, $redopts ) = ( '', $tcref->{redopts} ); my ( $options, $redopts ) = ( '', $tcref->{redopts} );
for my $option ( keys %validredoptions ) { for my $option ( sort keys %validredoptions ) {
my $type = $validredoptions{$option}; my $type = $validredoptions{$option};
if ( my $value = $redopts->{$option} ) { if ( my $value = $redopts->{$option} ) {
@@ -1943,7 +1943,7 @@ sub process_traffic_shaping() {
my ( $options, $codelopts ) = ( '', $tcref->{codelopts} ); my ( $options, $codelopts ) = ( '', $tcref->{codelopts} );
for my $option ( keys %validcodeloptions ) { for my $option ( sort keys %validcodeloptions ) {
my $type = $validcodeloptions{$option}; my $type = $validcodeloptions{$option};
if ( my $value = $codelopts->{$option} ) { if ( my $value = $codelopts->{$option} ) {

View File

@@ -92,7 +92,7 @@ our @EXPORT = ( qw( NOTHING
find_interfaces_by_option find_interfaces_by_option
find_interfaces_by_option1 find_interfaces_by_option1
get_interface_option get_interface_option
get_interface_origin get_interface_origin
interface_has_option interface_has_option
set_interface_option set_interface_option
interface_zone interface_zone
@@ -108,37 +108,55 @@ our @EXPORT = ( qw( NOTHING
our @EXPORT_OK = qw( initialize ); our @EXPORT_OK = qw( initialize );
our $VERSION = 'MODULEVERSION'; our $VERSION = 'MODULEVERSION';
#
# IPSEC Option types
#
use constant { NOTHING => 'NOTHING',
NUMERIC => '0x[\da-fA-F]+|\d+',
NETWORK => '\d+.\d+.\d+.\d+(\/\d+)?',
IPSECPROTO => 'ah|esp|ipcomp',
IPSECMODE => 'tunnel|transport'
};
#
# Option columns
#
use constant { IN_OUT => 1,
IN => 2,
OUT => 3 };
# #
# Zone Table. # Zone Table.
# #
# @zones contains the ordered list of zones with sub-zones appearing before their parents. # @zones contains the ordered list of zones with sub-zones appearing before their parents.
# #
# %zones{<zone1> => {name => <name>, # %zones{<zone1> => {name => <name>,
# type => <zone type> FIREWALL, IP, IPSEC, BPORT; # type => <zone type> FIREWALL, IP, IPSEC, BPORT;
# complex => 0|1 # complex => 0|1
# super => 0|1 # super => 0|1
# options => { in_out => < policy match string > # options => { in_out => < policy match string >
# in => < policy match string > # in => < policy match string >
# out => < policy match string > # out => < policy match string >
# } # }
# parents => [ <parents> ] Parents, Children and interfaces are listed by name # parents => [ <parents> ] Parents, Children and interfaces are listed by name
# children => [ <children> ] # children => [ <children> ]
# interfaces => { <interfaces1> => 1, ... } # interfaces => { <interfaces1> => 1, ... }
# bridge => <bridge> # bridge => <bridge>
# hosts { <type> } => [ { <interface1> => { ipsec => 'ipsec'|'none' # hosts { <type> } => [ { <interface1> => { ipsec => 'ipsec'|'none'
# options => { <option1> => <value1> # options => { <option1> => <value1>
# ... # ...
# } # }
# hosts => [ <net1> , <net2> , ... ] # hosts => [ <net1> , <net2> , ... ]
# exclusions => [ <net1>, <net2>, ... ] # exclusions => [ <net1>, <net2>, ... ]
# origin => <where defined> # origin => <where defined>
# } # }
# <interface2> => ... # <interface2> => ...
# } # }
# ] # ]
# } # }
# <zone2> => ... # <zone2> => ...
# } # }
# #
# $firewall_zone names the firewall zone. # $firewall_zone names the firewall zone.
# #
@@ -160,27 +178,27 @@ our %reservedName = ( all => 1,
# #
# @interfaces lists the interface names in the order that they appear in the interfaces file. # @interfaces lists the interface names in the order that they appear in the interfaces file.
# #
# %interfaces { <interface1> => { name => <name of interface> # %interfaces { <interface1> => { name => <name of interface>
# root => <name without trailing '+'> # root => <name without trailing '+'>
# options => { port => undef|1 # options => { port => undef|1
# { <option1> } => <val1> , #See %validinterfaceoptions # { <option1> } => <val1> , #See %validinterfaceoptions
# ... # ...
# } # }
# zone => <zone name> # zone => <zone name>
# multizone => undef|1 #More than one zone interfaces through this interface # multizone => undef|1 #More than one zone interfaces through this interface
# nets => <number of nets in interface/hosts records referring to this interface> # nets => <number of nets in interface/hosts records referring to this interface>
# bridge => <bridge name> # Same as ->{name} if not a bridge port. # bridge => <bridge name> # Same as ->{name} if not a bridge port.
# ports => <number of port on this bridge> # ports => <number of port on this bridge>
# ipsec => undef|1 # Has an ipsec host group # ipsec => undef|1 # Has an ipsec host group
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ] # broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
# number => <ordinal position in the interfaces file> # number => <ordinal position in the interfaces file>
# physical => <physical interface name> # physical => <physical interface name>
# base => <shell variable base representing this interface> # base => <shell variable base representing this interface>
# wildcard => undef|1 # Wildcard Name # wildcard => undef|1 # Wildcard Name
# zones => { zone1 => 1, ... } # zones => { zone1 => 1, ... }
# origin => <where defined> # origin => <where defined>
# } # }
# } # }
# #
# The purpose of the 'base' member is to ensure that the base names associated with the physical interfaces are assigned in # The purpose of the 'base' member is to ensure that the base names associated with the physical interfaces are assigned in
# the same order as the interfaces are encountered in the configuration files. # the same order as the interfaces are encountered in the configuration files.
@@ -203,26 +221,6 @@ our $zonemarkincr;
our $zonemarklimit; our $zonemarklimit;
our $loopback_interface; our $loopback_interface;
#
# IPSEC Option types
#
use constant { NOTHING => 'NOTHING',
NUMERIC => '0x[\da-fA-F]+|\d+',
IPSECPROTO => 'ah|esp|ipcomp',
IPSECMODE => 'tunnel|transport'
};
sub NETWORK() {
$family == F_IPV4 ? '\d+.\d+.\d+.\d+(\/\d+)?' : '(?:[0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}(?:\/d+)?';
}
#
# Option columns
#
use constant { IN_OUT => 1,
IN => 2,
OUT => 3 };
use constant { FIREWALL => 1, use constant { FIREWALL => 1,
IP => 2, IP => 2,
BPORT => 4, BPORT => 4,
@@ -278,7 +276,19 @@ our %maxoptionvalue = ( routefilter => 2, mss => 100000 , wait => 120 , ignore =
our %validhostoptions; our %validhostoptions;
our %validzoneoptions; our %validzoneoptions = ( mss => NUMERIC,
nomark => NOTHING,
blacklist => NOTHING,
dynamic_shared => NOTHING,
strict => NOTHING,
next => NOTHING,
reqid => NUMERIC,
spi => NUMERIC,
proto => IPSECPROTO,
mode => IPSECMODE,
"tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK,
);
use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 }; use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 };
# #
@@ -320,20 +330,6 @@ sub initialize( $$ ) {
$minroot = 0; $minroot = 0;
$loopback_interface = ''; $loopback_interface = '';
%validzoneoptions = ( mss => NUMERIC,
nomark => NOTHING,
blacklist => NOTHING,
dynamic_shared => NOTHING,
strict => NOTHING,
next => NOTHING,
reqid => NUMERIC,
spi => NUMERIC,
proto => IPSECPROTO,
mode => IPSECMODE,
"tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK,
);
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION, %validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
arp_ignore => ENUM_IF_OPTION, arp_ignore => ENUM_IF_OPTION,
@@ -411,8 +407,6 @@ sub initialize( $$ ) {
forward => BINARY_IF_OPTION, forward => BINARY_IF_OPTION,
physical => STRING_IF_OPTION + IF_OPTION_HOST, physical => STRING_IF_OPTION + IF_OPTION_HOST,
unmanaged => SIMPLE_IF_OPTION, unmanaged => SIMPLE_IF_OPTION,
upnp => SIMPLE_IF_OPTION,
upnpclient => SIMPLE_IF_OPTION,
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK, wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
); );
%validhostoptions = ( %validhostoptions = (
@@ -701,40 +695,6 @@ sub haveipseczones() {
0; 0;
} }
#
# Returns 1 if the two interfaces passed are related
#
sub interface_match( $$ ) {
my ( $piface, $ciface ) = @_;
return 1 if $piface eq $ciface;
my ( $pifaceref, $cifaceref ) = @interfaces{$piface, $ciface};
return 1 if $piface eq $cifaceref->{bridge};
return 1 if $ciface eq $pifaceref->{bridge};
if ( $minroot ) {
if ( $piface =~ /\+$/ ) {
my $root = $pifaceref->{root};
my $rlength = length( $root );
while ( length( $ciface ) >= $rlength ) {
return 1 if $ciface eq $root;
chop $ciface;
}
} elsif ( $ciface =~ /\+$/ ) {
my $root = $cifaceref->{root};
my $rlength = length( $root );
while ( length( $piface ) >= $rlength ) {
return 1 if $piface eq $root;
chop $piface;
}
}
}
0;
}
# #
# Report about zones. # Report about zones.
# #
@@ -753,10 +713,10 @@ sub zone_report()
my $printed = 0; my $printed = 0;
if ( $hostref ) { if ( $hostref ) {
for my $type ( keys %$hostref ) { for my $type ( sort keys %$hostref ) {
my $interfaceref = $hostref->{$type}; my $interfaceref = $hostref->{$type};
for my $interface ( keys %$interfaceref ) { for my $interface ( sort keys %$interfaceref ) {
my $iref = $interfaces{$interface}; my $iref = $interfaces{$interface};
my $arrayref = $interfaceref->{$interface}; my $arrayref = $interfaceref->{$interface};
@@ -772,7 +732,7 @@ sub zone_report()
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
progress_message_nocompress " $iref->{physical}:$grouplist"; progress_message_nocompress " $iref->{physical}:$grouplist";
} else { } else {
progress_message_nocompress " $iref->{physical}:[$grouplist]"; progress_message_nocompress " $iref->{physical}:<$grouplist>";
} }
$printed = 1; $printed = 1;
} }
@@ -781,17 +741,6 @@ sub zone_report()
} }
} }
PARENT:
for my $p ( @{$zoneref->{parents}} ) {
for my $pi ( keys ( %{$zones{$p}{interfaces}} ) ) {
for my $ci ( keys( %{$zoneref->{interfaces}} ) ) {
next PARENT if interface_match( $pi, $ci );
}
}
warning_message "Zone $zone is defined as a sub-zone of $p, yet the two zones have no interface in common";
}
unless ( $printed ) { unless ( $printed ) {
fatal_error "No bridge has been associated with zone $zone" if $type & BPORT && ! $zoneref->{bridge}; fatal_error "No bridge has been associated with zone $zone" if $type & BPORT && ! $zoneref->{bridge};
warning_message "*** $zone is an EMPTY ZONE ***" unless $type == FIREWALL; warning_message "*** $zone is an EMPTY ZONE ***" unless $type == FIREWALL;
@@ -817,10 +766,10 @@ sub dump_zone_contents() {
$entry .= ( " mark=" . in_hex( $zoneref->{mark} ) ) if exists $zoneref->{mark}; $entry .= ( " mark=" . in_hex( $zoneref->{mark} ) ) if exists $zoneref->{mark};
if ( $hostref ) { if ( $hostref ) {
for my $type ( keys %$hostref ) { for my $type ( sort keys %$hostref ) {
my $interfaceref = $hostref->{$type}; my $interfaceref = $hostref->{$type};
for my $interface ( keys %$interfaceref ) { for my $interface ( sort keys %$interfaceref ) {
my $iref = $interfaces{$interface}; my $iref = $interfaces{$interface};
my $arrayref = $interfaceref->{$interface}; my $arrayref = $interfaceref->{$interface};
@@ -1364,7 +1313,7 @@ sub process_interface( $$ ) {
assert(0); assert(0);
} }
} elsif ( $type == STRING_IF_OPTION ) { } elsif ( $type == STRING_IF_OPTION ) {
fatal_error "The '$option' option requires a value" unless supplied $value; fatal_error "The '$option' option requires a value" unless defined $value;
if ( $option eq 'physical' ) { if ( $option eq 'physical' ) {
fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/; fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/;
@@ -1620,7 +1569,9 @@ sub known_interface($)
# #
# We have wildcard interfaces -- see if this interface matches one of their roots # We have wildcard interfaces -- see if this interface matches one of their roots
# #
while ( length $iface >= $minroot ) { while ( length $iface > $minroot ) {
chop $iface;
if ( my $i = $roots{$iface} ) { if ( my $i = $roots{$iface} ) {
# #
# Found one # Found one
@@ -1642,8 +1593,6 @@ sub known_interface($)
}; };
return $interfaceref; return $interfaceref;
} }
chop $iface;
} }
} }
@@ -2270,9 +2219,9 @@ sub find_hosts_by_option( $ ) {
} }
for my $zone ( grep ! ( $zones{$_}{type} & FIREWALL ) , @zones ) { for my $zone ( grep ! ( $zones{$_}{type} & FIREWALL ) , @zones ) {
for my $type (keys %{$zones{$zone}{hosts}} ) { for my $type (sort keys %{$zones{$zone}{hosts}} ) {
my $interfaceref = $zones{$zone}{hosts}->{$type}; my $interfaceref = $zones{$zone}{hosts}->{$type};
for my $interface ( keys %$interfaceref ) { for my $interface ( sort keys %$interfaceref ) {
my $arrayref = $interfaceref->{$interface}; my $arrayref = $interfaceref->{$interface};
for my $host ( @{$arrayref} ) { for my $host ( @{$arrayref} ) {
my $ipsec = $host->{ipsec}; my $ipsec = $host->{ipsec};
@@ -2300,9 +2249,9 @@ sub find_zone_hosts_by_option( $$ ) {
my @hosts; my @hosts;
unless ( $zones{$zone}{type} & FIREWALL ) { unless ( $zones{$zone}{type} & FIREWALL ) {
for my $type (keys %{$zones{$zone}{hosts}} ) { for my $type (sort keys %{$zones{$zone}{hosts}} ) {
my $interfaceref = $zones{$zone}{hosts}->{$type}; my $interfaceref = $zones{$zone}{hosts}->{$type};
for my $interface ( keys %$interfaceref ) { for my $interface ( sort keys %$interfaceref ) {
my $arrayref = $interfaceref->{$interface}; my $arrayref = $interfaceref->{$interface};
for my $host ( @{$arrayref} ) { for my $host ( @{$arrayref} ) {
if ( my $value = $host->{options}{$option} ) { if ( my $value = $host->{options}{$option} ) {

View File

@@ -43,8 +43,6 @@
# --inline # Update alternative column specifications # --inline # Update alternative column specifications
# --update # Update configuration to current release # --update # Update configuration to current release
# #
# If the <filename> is omitted, then a 'check' operation is performed.
#
use strict; use strict;
use FindBin; use FindBin;
use lib "$FindBin::Bin"; use lib "$FindBin::Bin";

View File

@@ -32,7 +32,7 @@
# down Stop an optional interface # down Stop an optional interface
# enable Enable an optional interface # enable Enable an optional interface
# help Show command syntax # help Show command syntax
# reenable Disable then enable an optional # reenable Disable then nable an optional
# interface # interface
# refresh Refresh the firewall # refresh Refresh the firewall
# reload Reload the firewall # reload Reload the firewall
@@ -421,7 +421,7 @@ restore_default_route() # $1 = USE_DEFAULT_RT
conditionally_flush_conntrack() { conditionally_flush_conntrack() {
if [ -n "$g_purge" ]; then if [ -n "$g_purge" ]; then
if [ -n "$(mywhich conntrack)" ]; then if [ -n $(mywhich conntrack) ]; then
conntrack -F conntrack -F
else else
error_message "WARNING: The '-p' option requires the conntrack utility which does not appear to be installed on this system" error_message "WARNING: The '-p' option requires the conntrack utility which does not appear to be installed on this system"

View File

@@ -33,7 +33,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL="info" LOG_LEVEL=info
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -55,19 +55,19 @@ LOGTAGONLY=No
LOGLIMIT="s:1/sec:10" LOGLIMIT="s:1/sec:10"
MACLIST_LOG_LEVEL="$LOG_LEVEL" MACLIST_LOG_LEVEL=$LOG_LEVEL
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL="$LOG_LEVEL" RPFILTER_LOG_LEVEL=$LOG_LEVEL
SFILTER_LOG_LEVEL="$LOG_LEVEL" SFILTER_LOG_LEVEL=$LOG_LEVEL
SMURF_LOG_LEVEL="$LOG_LEVEL" SMURF_LOG_LEVEL=$LOG_LEVEL
STARTUP_LOG=/var/log/shorewall-init.log STARTUP_LOG=/var/log/shorewall-init.log
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL" TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -109,11 +109,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT="none" ACCEPT_DEFAULT=none
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs,dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs"
NFQUEUE_DEFAULT="none" NFQUEUE_DEFAULT=none
QUEUE_DEFAULT="none" QUEUE_DEFAULT=none
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -217,8 +217,6 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=Yes REQUIRE_INTERFACE=Yes
@@ -249,8 +247,6 @@ TRACK_RULES=No
USE_DEFAULT_RT=Yes USE_DEFAULT_RT=Yes
USE_NFLOG_SIZE=No
USE_PHYSICAL_NAMES=No USE_PHYSICAL_NAMES=No
USE_RT_NAMES=No USE_RT_NAMES=No

View File

@@ -120,11 +120,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT="none" ACCEPT_DEFAULT=none
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs,dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs"
NFQUEUE_DEFAULT="none" NFQUEUE_DEFAULT=none
QUEUE_DEFAULT="none" QUEUE_DEFAULT=none
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -228,8 +228,6 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No
@@ -260,8 +258,6 @@ TRACK_RULES=No
USE_DEFAULT_RT=Yes USE_DEFAULT_RT=Yes
USE_NFLOG_SIZE=No
USE_PHYSICAL_NAMES=No USE_PHYSICAL_NAMES=No
USE_RT_NAMES=No USE_RT_NAMES=No

View File

@@ -41,7 +41,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL="info" LOG_LEVEL=info
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -63,19 +63,19 @@ LOGTAGONLY=No
LOGLIMIT="s:1/sec:10" LOGLIMIT="s:1/sec:10"
MACLIST_LOG_LEVEL="$LOG_LEVEL" MACLIST_LOG_LEVEL=$LOG_LEVEL
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL="$LOG_LEVEL" RPFILTER_LOG_LEVEL=$LOG_LEVEL
SFILTER_LOG_LEVEL="$LOG_LEVEL" SFILTER_LOG_LEVEL=$LOG_LEVEL
SMURF_LOG_LEVEL="$LOG_LEVEL" SMURF_LOG_LEVEL=$LOG_LEVEL
STARTUP_LOG=/var/log/shorewall-init.log STARTUP_LOG=/var/log/shorewall-init.log
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL" TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -117,11 +117,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT="none" ACCEPT_DEFAULT=none
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs,dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs"
NFQUEUE_DEFAULT="none" NFQUEUE_DEFAULT=none
QUEUE_DEFAULT="none" QUEUE_DEFAULT=none
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -225,8 +225,6 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No
@@ -257,8 +255,6 @@ TRACK_RULES=No
USE_DEFAULT_RT=Yes USE_DEFAULT_RT=Yes
USE_NFLOG_SIZE=No
USE_PHYSICAL_NAMES=No USE_PHYSICAL_NAMES=No
USE_RT_NAMES=No USE_RT_NAMES=No

View File

@@ -44,7 +44,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL="info" LOG_LEVEL=info
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -66,19 +66,19 @@ LOGTAGONLY=No
LOGLIMIT="s:1/sec:10" LOGLIMIT="s:1/sec:10"
MACLIST_LOG_LEVEL="$LOG_LEVEL" MACLIST_LOG_LEVEL=$LOG_LEVEL
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL="$LOG_LEVEL" RPFILTER_LOG_LEVEL=$LOG_LEVEL
SFILTER_LOG_LEVEL="$LOG_LEVEL" SFILTER_LOG_LEVEL=$LOG_LEVEL
SMURF_LOG_LEVEL="$LOG_LEVEL" SMURF_LOG_LEVEL=$LOG_LEVEL
STARTUP_LOG=/var/log/shorewall-init.log STARTUP_LOG=/var/log/shorewall-init.log
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL" TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -120,11 +120,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT="none" ACCEPT_DEFAULT=none
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs,dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs"
NFQUEUE_DEFAULT="none" NFQUEUE_DEFAULT=none
QUEUE_DEFAULT="none" QUEUE_DEFAULT=none
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -228,8 +228,6 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No
@@ -260,8 +258,6 @@ TRACK_RULES=No
USE_DEFAULT_RT=Yes USE_DEFAULT_RT=Yes
USE_NFLOG_SIZE=No
USE_PHYSICAL_NAMES=No USE_PHYSICAL_NAMES=No
USE_RT_NAMES=No USE_RT_NAMES=No

View File

@@ -20,4 +20,4 @@
MASQUERADE 10.0.0.0/8,\ MASQUERADE 10.0.0.0/8,\
169.254.0.0/16,\ 169.254.0.0/16,\
172.16.0.0/12,\ 172.16.0.0/12,\
192.168.0.0/16 eth0 92.168.0.0/16 eth0

View File

@@ -6,44 +6,45 @@
# Please see http://shorewall.net/Actions.html for additional # Please see http://shorewall.net/Actions.html for additional
# information. # information.
# #
# Builtin Actions are:
#
?if 0
allowBcast # Silently Allow Broadcast
allowMcast # Silently Allow Multicast
dropBcast # Silently Drop Broadcast
dropMcast # Silently Drop Multicast
dropNotSyn # Silently Drop Non-syn TCP packets
rejNotSyn # Silently Reject Non-syn TCP packets
allowinUPnP # Allow UPnP inbound (to firewall) traffic
forwardUPnP # Allow traffic that upnpd has redirected from 'upnp' interfaces.
Limit # Limit the rate of connections from each individual IP address
?endif
############################################################################### ###############################################################################
#ACTION #ACTION
A_AllowICMPs inline # Audited version of AllowICMPs
A_Drop # Audited Default Action for DROP policy A_Drop # Audited Default Action for DROP policy
A_REJECT noinline,logjump # Audits then rejects a connection request A_REJECT noinline,logjump # Audits then rejects a connection request
A_REJECT! inline # Audits then rejects a connection request A_REJECT! inline # Audits then rejects a connection request
A_Reject # Audited Default action for REJECT policy A_Reject # Audited Default action for REJECT policy
AllowICMPs inline # Allow Required ICMP packets AllowICMPs inline # Allow Required ICMP packets
allowBcast inline # Silently Allow Broadcast
allowinUPnP inline # Allow UPnP inbound (to firewall) traffic
allowInvalid inline # Accepts packets in the INVALID conntrack state allowInvalid inline # Accepts packets in the INVALID conntrack state
allowMcast inline # Silently Allow Multicast
AutoBL noinline # Auto-blacklist IPs that exceed thesholds AutoBL noinline # Auto-blacklist IPs that exceed thesholds
AutoBLL noinline # Helper for AutoBL AutoBLL noinline # Helper for AutoBL
BLACKLIST logjump,section # Add sender to the dynamic blacklist BLACKLIST logjump,section # Add sender to the dynamic blacklist
Broadcast noinline,audit # Handles Broadcast/Anycast Broadcast noinline,audit # Handles Broadcast/Anycast
DNSAmp # Matches one-question recursive DNS queries DNSAmp # Matches one-question recursive DNS queries
Drop # Default Action for DROP policy (deprecated) Drop # Default Action for DROP policy (deprecated)
dropBcast inline # Silently Drop Broadcast
dropBcasts inline # Silently Drop Broadcast
dropInvalid inline # Drops packets in the INVALID conntrack state dropInvalid inline # Drops packets in the INVALID conntrack state
dropMcast inline # Silently Drop Multicast
dropNotSyn noinline # Silently Drop Non-syn TCP packets
DropDNSrep inline # Drops DNS replies DropDNSrep inline # Drops DNS replies
DropSmurfs noinline # Drop smurf packets DropSmurfs noinline # Drop smurf packets
Established inline,\ # Handles packets in the ESTABLISHED state Established inline,\ # Handles packets in the ESTABLISHED state
state=ESTABLISHED # state=ESTABLISHED #
FIN inline,audit # Handles ACK,FIN,PSH packets
forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces.
GlusterFS inline # Handles GlusterFS GlusterFS inline # Handles GlusterFS
IfEvent noinline # Perform an action based on an event IfEvent noinline # Perform an action based on an event
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
state=INVALID # state=INVALID #
Limit noinline # Limit the rate of connections from each individual IP address
Multicast noinline,audit # Handles Multicast Multicast noinline,audit # Handles Multicast
New inline,state=NEW # Handles packets in the NEW conntrack state New inline,state=NEW # Handles packets in the NEW conntrack state
NotSyn inline,audit # Handles TCP packets which do not have SYN=1 and ACK=0 NotSyn inline,audit # Handles TCP packets which do not have SYN=1 and ACK=0
rejNotSyn noinline # Silently Reject Non-syn TCP packets
Reject # Default Action for REJECT policy (deprecated) Reject # Default Action for REJECT policy (deprecated)
Related inline,\ # Handles packets in the RELATED conntrack state Related inline,\ # Handles packets in the RELATED conntrack state
state=RELATED # state=RELATED #

View File

@@ -1,12 +0,0 @@
#
# Shorewall -- /etc/shorewall/disabled
#
# Add commands below that you want executed when an optional
# interface is successfully disabled using the 'disable' command
#
# When the commands are invoked:
#
# $1 contains the physical name of the interface
# $2 contains the logical name of the interface
# $3 contains the name of the provider associated with the interface,
if any

View File

@@ -1,12 +0,0 @@
#
# Shorewall -- /etc/shorewall/enabled
#
# Add commands below that you want executed when an optional
# interface is successfully enabled using the 'enable' command
#
# When the commands are invoked:
#
# $1 contains the physical name of the interface
# $2 contains the logical name of the interface
# $3 contains the name of the provider associated with the interface,
if any

View File

@@ -33,7 +33,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL="info" LOG_LEVEL=info
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -55,19 +55,19 @@ LOGTAGONLY=No
LOGLIMIT="s:1/sec:10" LOGLIMIT="s:1/sec:10"
MACLIST_LOG_LEVEL="$LOG_LEVEL" MACLIST_LOG_LEVEL=$LOG_LEVEL
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL="$LOG_LEVEL" RPFILTER_LOG_LEVEL=$LOG_LEVEL
SFILTER_LOG_LEVEL="$LOG_LEVEL" SFILTER_LOG_LEVEL=$LOG_LEVEL
SMURF_LOG_LEVEL="$LOG_LEVEL" SMURF_LOG_LEVEL=$LOG_LEVEL
STARTUP_LOG=/var/log/shorewall-init.log STARTUP_LOG=/var/log/shorewall-init.log
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL" TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -109,11 +109,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT="none" ACCEPT_DEFAULT=none
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs,dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP),AllowICMPs"
NFQUEUE_DEFAULT="none" NFQUEUE_DEFAULT=none
QUEUE_DEFAULT="none" QUEUE_DEFAULT=none
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -205,7 +205,7 @@ MARK_IN_FORWARD_CHAIN=No
MINIUPNPD=No MINIUPNPD=No
MODULE_SUFFIX="ko ko.xz" MODULE_SUFFIX=ko
MULTICAST=No MULTICAST=No
@@ -217,8 +217,6 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No
@@ -249,8 +247,6 @@ TRACK_RULES=No
USE_DEFAULT_RT=Yes USE_DEFAULT_RT=Yes
USE_NFLOG_SIZE=No
USE_PHYSICAL_NAMES=No USE_PHYSICAL_NAMES=No
USE_RT_NAMES=No USE_RT_NAMES=No

View File

@@ -1,5 +1,5 @@
# prevent startup with default configuration # prevent startup with default configuration
# set the following variable to 1 in order to allow Shorewall to start # set the following varible to 1 in order to allow Shorewall to start
startup=0 startup=0
@@ -16,7 +16,7 @@ startup=0
# wait_interface= # wait_interface=
# #
# Global start/restart/reload/stop options # Global start/restart options
# #
OPTIONS="" OPTIONS=""
@@ -28,17 +28,12 @@ STARTOPTIONS=""
# #
# Restart options # Restart options
# #
RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS="" RELOADOPTIONS=""
# #
# Stop options # Restart options
# #
STOPOPTIONS="" RESTARTOPTIONS=""
# #
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf # Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf

View File

@@ -1,26 +0,0 @@
#
# Global start/restart/reload/stop options
#
OPTIONS=""
#
# Start options
#
STARTOPTIONS=""
#
# Restart options
#
RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# EOF

View File

@@ -22,22 +22,55 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <http://www.gnu.org/licenses/>.
# #
VERSION=xxx # The Build script inserts the actual version VERSION=4.5.5 #The Build script inserts the actual version
#
# Change to the directory containing this script
#
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]" echo "usage: $ME [ <configuration-file> ]"
echo "where <option> is one of" echo " $ME -v"
echo " -h" echo " $ME -h"
echo " -v" echo " $ME -s"
echo " -s" echo " $ME -a"
echo " -a" echo " $ME -n"
echo " -p"
echo " -n"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
run_install() run_install()
{ {
if ! install $*; then if ! install $*; then
@@ -47,14 +80,27 @@ run_install()
fi fi
} }
cant_autostart()
{
echo
echo "WARNING: Unable to configure $PRODUCT to start automatically at boot" >&2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
install_file() # $1 = source $2 = target $3 = mode install_file() # $1 = source $2 = target $3 = mode
{ {
run_install $T $OWNERSHIP -m $3 $1 ${2} run_install $T $OWNERSHIP -m $3 $1 ${2}
} }
# require()
# Change to the directory containing this script {
# eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
cd "$(dirname $0)" cd "$(dirname $0)"
if [ -f shorewall.service ]; then if [ -f shorewall.service ]; then
@@ -65,11 +111,6 @@ else
Product=Shorewall6 Product=Shorewall6
fi fi
#
# Source common functions
#
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
# #
# Parse the run line # Parse the run line
# #
@@ -131,14 +172,11 @@ done
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
file=./shorewallrc . ./shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
file=~/.shorewallrc . ~/.shorewallrc || exit 1
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
file=/usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -148,11 +186,11 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file || exit 1 file=./$file
;; ;;
esac esac
. $file || fatal_error "Can not load the RC file: $file" . $file
else else
usage 1 usage 1
fi fi
@@ -267,7 +305,8 @@ case "$HOST" in
linux) linux)
;; ;;
*) *)
fatal_error "Unknown HOST \"$HOST\"" echo "ERROR: Unknown HOST \"$HOST\"" >&2
exit 1;
;; ;;
esac esac
@@ -278,7 +317,8 @@ if [ $PRODUCT = shorewall ]; then
# #
if [ "$DIGEST" != SHA ]; then if [ "$DIGEST" != SHA ]; then
if [ "$BUILD" = "$HOST" ] && ! eval perl -e \'use Digest::$DIGEST\;\' 2> /dev/null ; then if [ "$BUILD" = "$HOST" ] && ! eval perl -e \'use Digest::$DIGEST\;\' 2> /dev/null ; then
fatal_error "Perl compilation with Digest::$DIGEST failed" echo "ERROR: Perl compilation with Digest::$DIGEST failed" >&2
exit 1;
fi fi
cp -af Perl/Shorewall/Chains.pm Perl/Shorewall/Chains.pm.bak cp -af Perl/Shorewall/Chains.pm Perl/Shorewall/Chains.pm.bak
@@ -301,7 +341,8 @@ if [ $PRODUCT = shorewall ]; then
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm
DIGEST=SHA1 DIGEST=SHA1
else else
fatal_error "Shorewall $VERSION requires either Digest::SHA or Digest::SHA1" echo "ERROR: Shorewall $VERSION requires either Digest::SHA or Digest::SHA1" >&2
exit 1
fi fi
fi fi
fi fi
@@ -329,10 +370,11 @@ if [ $BUILD != cygwin ]; then
fi fi
fi fi
run_install -d $OWNERSHIP -m 0755 ${DESTDIR}${SBINDIR} install -d $OWNERSHIP -m 755 ${DESTDIR}${SBINDIR}
[ -n "${INITFILE}" ] && run_install -d $OWNERSHIP -m 0755 ${DESTDIR}${INITDIR} [ -n "${INITFILE}" ] && install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
if [ -z "$DESTDIR" -a $PRODUCT != shorewall ]; then if [ -z "$DESTDIR" -a $PRODUCT != shorewall ]; then
[ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || fatal_error "Shorewall >= 4.5.0 is not installed" [ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || \
{ echo " ERROR: Shorewall >= 4.5.0 is not installed" >&2; exit 1; }
fi fi
echo "Installing $Product Version $VERSION" echo "Installing $Product Version $VERSION"
@@ -346,7 +388,7 @@ else
first_install="Yes" first_install="Yes"
fi fi
if [ -z "${DESTDIR}" -a $PRODUCT = shorewall -a ! -f ${SHAREDIR}/shorewall/coreversion ]; then if [ -z "${DESTDIR}" -a $PRODUCT = shorewall -a ! -f ${SHAREDIR}/$PRODUCT/coreversion ]; then
echo "Shorewall $VERSION requires Shorewall Core which does not appear to be installed" echo "Shorewall $VERSION requires Shorewall Core which does not appear to be installed"
exit 1 exit 1
fi fi
@@ -368,16 +410,22 @@ fi
# #
# Create /etc/$PRODUCT and other directories # Create /etc/$PRODUCT and other directories
# #
make_parent_directory ${DESTDIR}${CONFDIR}/$PRODUCT 0755 mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT
make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755 mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT
make_parent_directory ${DESTDIR}${PERLLIBDIR}/Shorewall 0755 mkdir -p ${DESTDIR}${PERLLIBDIR}/Shorewall
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles 0755 mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated 0755 mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated
make_parent_directory ${DESTDIR}${VARDIR} 0755 mkdir -p ${DESTDIR}${VARDIR}
chmod 0755 ${DESTDIR}${SHAREDIR}/$PRODUCT chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated
[ -n "$DESTDIR" ] && make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755 if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
fi
# #
# Install the .service file # Install the .service file
@@ -387,9 +435,9 @@ if [ -z "${SERVICEDIR}" ]; then
fi fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
make_parent_directory ${DESTDIR}${SERVICEDIR} 0755 mkdir -p ${DESTDIR}${SERVICEDIR}
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
run_install $OWNERSHIP -m 0644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service" echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
fi fi
@@ -442,14 +490,6 @@ if [ -z "$first_install" ]; then
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_REJECT delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_REJECT
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Drop delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Drop
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Reject delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Reject
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_Drop
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_Reject
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_AllowICMPs
else
delete_file ${DESTDIR}${SHAREDIR}/shorewall6/action.A_AllowICMPs
delete_file ${DESTDIR}${SHAREDIR}/shorewall6/action.AllowICMPs
delete_file ${DESTDIR}${SHAREDIR}/shorewall6/action.Broadcast
delete_file ${DESTDIR}${SHAREDIR}/shorewall6/action.Multicast
fi fi
fi fi
@@ -492,11 +532,8 @@ fi
# #
# Install the config file # Install the config file
# #
run_install $OWNERSHIP -m 0644 $PRODUCT.conf ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/ run_install $OWNERSHIP -m 0644 $PRODUCT.conf ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/
run_install $OWNERSHIP -m 0644 $PRODUCT.conf.annotated ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/
if [ $PRODUCT = shorewall ]; then
run_install $OWNERSHIP -m 0644 shorewall.conf.annotated ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/
fi
if [ ! -f ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf ]; then if [ ! -f ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf ]; then
run_install $OWNERSHIP -m 0600 ${PRODUCT}.conf${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf run_install $OWNERSHIP -m 0600 ${PRODUCT}.conf${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf
@@ -616,14 +653,8 @@ run_install $OWNERSHIP -m 0644 params.annotated ${DESTDIR}${SHAREDIR}/$PRODUCT/c
if [ -f ${DESTDIR}${CONFDIR}/$PRODUCT/params ]; then if [ -f ${DESTDIR}${CONFDIR}/$PRODUCT/params ]; then
chmod 0644 ${DESTDIR}${CONFDIR}/$PRODUCT/params chmod 0644 ${DESTDIR}${CONFDIR}/$PRODUCT/params
else else
case "$SPARSE" in run_install $OWNERSHIP -m 0600 params${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/params
[Vv]ery) echo "Parameter file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/params"
;;
*)
run_install $OWNERSHIP -m 0600 params${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/params
echo "Parameter file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/params"
;;
esac
fi fi
if [ $PRODUCT = shorewall ]; then if [ $PRODUCT = shorewall ]; then
@@ -699,16 +730,10 @@ fi
run_install $OWNERSHIP -m 0644 conntrack ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles run_install $OWNERSHIP -m 0644 conntrack ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
run_install $OWNERSHIP -m 0644 conntrack.annotated ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles run_install $OWNERSHIP -m 0644 conntrack.annotated ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
case "$SPARSE" in if [ ! -f ${DESTDIR}${CONFDIR}/$PRODUCT/conntrack ]; then
[Vv]ery) run_install $OWNERSHIP -m 0600 conntrack${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/conntrack
;; echo "Conntrack file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/conntrack"
*) fi
if [ ! -f ${DESTDIR}${CONFDIR}/$PRODUCT/conntrack ]; then
run_install $OWNERSHIP -m 0600 conntrack${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/conntrack
echo "Conntrack file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/conntrack"
fi
;;
esac
# #
# Install the Mangle file # Install the Mangle file
@@ -1069,14 +1094,8 @@ cd ..
# #
for f in lib.* Perl/lib.*; do for f in lib.* Perl/lib.*; do
if [ -f $f ]; then if [ -f $f ]; then
case $f in install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$(basename $f) 0644
*installer) echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
;;
*)
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$(basename $f) 0644
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
;;
esac
fi fi
done done
@@ -1086,7 +1105,7 @@ if [ $PRODUCT = shorewall6 ]; then
# #
ln -sf lib.base ${DESTDIR}${SHAREDIR}/$PRODUCT/functions ln -sf lib.base ${DESTDIR}${SHAREDIR}/$PRODUCT/functions
# #
# And create a symbolic link for the CLI # And create a sybolic link for the CLI
# #
ln -sf shorewall ${DESTDIR}${SBINDIR}/shorewall6 ln -sf shorewall ${DESTDIR}${SBINDIR}/shorewall6
fi fi
@@ -1095,7 +1114,8 @@ if [ -d Perl ]; then
# #
# ${SHAREDIR}/$PRODUCT/$Product if needed # ${SHAREDIR}/$PRODUCT/$Product if needed
# #
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product 0755 mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product
# #
# Install the Compiler # Install the Compiler
# #
@@ -1144,7 +1164,7 @@ fi
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version
chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
@@ -1162,41 +1182,15 @@ if [ -n "$MANDIR" ]; then
cd manpages cd manpages
if [ $PRODUCT = shorewall ]; then [ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man5/
[ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man5 0755
for f in *.5; do for f in *.5; do
gzip -9c $f > $f.gz gzip -9c $f > $f.gz
run_install $INSTALLD -m 0644 $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz run_install $INSTALLD -m 0644 $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz" echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz"
done done
fi
if [ $PRODUCT = shorewall6 ]; then [ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man8/
make_parent_directory ${DESTDIR}${MANDIR}/man5 0755
rm -f ${DESTDIR}${MANDIR}/man5/shorewall6*
for f in \
shorewall-accounting.5 shorewall-ipsets.5 shorewall-providers.5 shorewall-tcclasses.5 \
shorewall-actions.5 shorewall-maclist.5 shorewall-tcdevices.5 \
shorewall-mangle.5 shorewall-proxyndp.5 shorewall-tcfilters.5 \
shorewall-blacklist.5 shorewall-masq.5 shorewall-routes.5 shorewall-tcinterfaces.5 \
shorewall-blrules.5 shorewall-modules.5 shorewall-routestopped.5 shorewall-tcpri.5 \
shorewall-conntrack.5 shorewall-nat.5 shorewall-rtrules.5 shorewall-tcrules.5 \
shorewall-nesting.5 shorewall-rules.5 shorewall-tos.5 \
shorewall-exclusion.5 shorewall-netmap.5 shorewall-secmarks.5 shorewall-tunnels.5 \
shorewall-hosts.5 shorewall-params.5 shorewall-snat.5 shorewall-vardir.5 \
shorewall-interfaces.5 shorewall-policy.5 shorewall-stoppedrules.5 shorewall-zones.5
do
f6=shorewall6-${f#*-}
echo ".so man5/$f" > ${DESTDIR}${MANDIR}/man5/$f6
done
echo ".so man5/shorewall.conf.5" > ${DESTDIR}${MANDIR}/man5/shorewall6.conf.5
fi
[ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man8 0755
for f in *.8; do for f in *.8; do
gzip -9c $f > $f.gz gzip -9c $f > $f.gz
@@ -1219,7 +1213,8 @@ fi
# #
if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
if [ ${DESTDIR} ]; then if [ ${DESTDIR} ]; then
make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755 mkdir -p ${DESTDIR}${SYSCONFDIR}
chmod 755 ${DESTDIR}${SYSCONFDIR}
fi fi
run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT
@@ -1277,6 +1272,6 @@ if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${
fi fi
# #
# Report Success # Report Success
# #
echo "$Product Version $VERSION Installed" echo "$Product Version $VERSION Installed"

View File

@@ -341,18 +341,6 @@ get_config() {
setup_dbl setup_dbl
fi fi
if [ -z "$PERL_HASH_SEED" ]; then
PERL_HASH_SEED=0
else
case $PERL_HASH_SEED in
[0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]|random)
;;
*)
fatal_error "Invalid setting ($PERL_HASH_SEED) for PERL_HASH_SEED"
;;
esac
fi
lib=$(find_file lib.cli-user) lib=$(find_file lib.cli-user)
[ -f $lib ] && . $lib [ -f $lib ] && . $lib
@@ -496,18 +484,6 @@ compiler() {
# #
[ "$g_debugging" != trace -a -z "$g_preview" ] || [ -n "$g_debug" ] && g_pager= [ "$g_debugging" != trace -a -z "$g_preview" ] || [ -n "$g_debug" ] && g_pager=
case $PERL_HASH_SEED in
random)
unset PERL_HASH_SEED
unset PERL_PERTURB_KEYS
;;
*)
export PERL_HASH_SEED
PERL_PERTURB_KEYS=0
export PERL_PERTURB_KEYS
;;
esac
if [ ${PERLLIBDIR} = ${LIBEXECDIR}/shorewall ]; then if [ ${PERLLIBDIR} = ${LIBEXECDIR}/shorewall ]; then
eval $PERL $debugflags $pc $options $@ $g_pager eval $PERL $debugflags $pc $options $@ $g_pager
else else
@@ -534,6 +510,28 @@ start_command() {
local rc local rc
rc=0 rc=0
do_it() {
if [ -n "$AUTOMAKE" ]; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/firewall $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
g_file="${VARDIR}/.start"
if compiler $g_debugging $nolock compile "$g_file"; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.start $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
rc=$?
mylogger kern.err "ERROR:$g_product start failed"
fi
fi
exit $rc
}
if product_is_started; then if product_is_started; then
error_message "Shorewall is already running" error_message "Shorewall is already running"
exit 0 exit 0
@@ -625,25 +623,7 @@ start_command() {
fi fi
fi fi
if [ -n "$AUTOMAKE" ]; then do_it
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/firewall $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
g_file="${VARDIR}/.start"
if compiler $g_debugging $nolock compile "$g_file"; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.start $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
rc=$?
mylogger kern.err "ERROR:$g_product start failed"
fi
fi
exit $rc
} }
# #

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/accounting</command> <command>/etc/shorewall/accounting</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -783,8 +783,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/accounting</para> <para>/etc/shorewall/accounting</para>
<para>/etc/shorewall6/accounting</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -800,6 +798,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-actions(5), shorewall-blacklist(5),
shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/actions</command> <command>/etc/shorewall/actions</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -148,9 +148,9 @@
<listitem> <listitem>
<para>Added in Shorewall 5.0.7. Specifies that this action is <para>Added in Shorewall 5.0.7. Specifies that this action is
to be used in <ulink to be used in <ulink
url="/manpages/shorewall-mangle.html">shorewall-mangle(5)</ulink> url="shorewall-mangle.html">shorewall-mangle(5)</ulink> rather
rather than <ulink than <ulink
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink>.</para> url="shorewall-rules.html">shorewall-rules(5)</ulink>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -160,11 +160,11 @@
<listitem> <listitem>
<para>Added in Shorewall 5.0.13. Specifies that this action is <para>Added in Shorewall 5.0.13. Specifies that this action is
to be used in <ulink to be used in <ulink
url="/manpages/shorewall-snat.html">shorewall-snat(5)</ulink> url="shorewall-snat.html">shorewall-snat(5)</ulink> rather
rather than <ulink than <ulink
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink>. url="shorewall-rules.html">shorewall-rules(5)</ulink>. The
The <option>mangle</option> and <option>nat</option> options <option>mangle</option> and <option>nat</option> options are
are mutually exclusive.</para> mutually exclusive.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -206,7 +206,7 @@
<para>Given that neither the <filename>snat</filename> nor the <para>Given that neither the <filename>snat</filename> nor the
<filename>mangle</filename> file is sectioned, this parameter <filename>mangle</filename> file is sectioned, this parameter
has no effect when <option>mangle</option> or has no effect when <option>mangle</option> or
<option>nat</option> is specified.</para> <option>nat</option> is specified. </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -239,8 +239,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/actions</para> <para>/etc/shorewall/actions</para>
<para>/etc/shorewall6/actions</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -249,6 +247,14 @@
<para><ulink <para><ulink
url="/Actions.html">http://www.shorewall.net/Actions.html</ulink></para> url="/Actions.html">http://www.shorewall.net/Actions.html</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-blacklist(5),
shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -25,8 +25,6 @@
<refsect1> <refsect1>
<title>Description</title> <title>Description</title>
<para>IPv4 only.</para>
<para>This file was added in Shorewall 4.5.12 and is used to describe <para>This file was added in Shorewall 4.5.12 and is used to describe
low-level rules managed by arptables (8). These rules only affect Address low-level rules managed by arptables (8). These rules only affect Address
Resolution Protocol (ARP), Reverse Address Resolution Protocol (RARP) and Resolution Protocol (ARP), Reverse Address Resolution Protocol (RARP) and
@@ -379,10 +377,4 @@ SNAT:10.1.10.11 - eth1:10.1.10.0/24 1</programlis
<para>/etc/shorewall/arprules</para> <para>/etc/shorewall/arprules</para>
</refsect1> </refsect1>
<refsect1>
<title>See ALSO</title>
<para>shorewall(8)</para>
</refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/blrules</command> <command>/etc/shorewall/blrules</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -27,9 +27,12 @@
<para>This file is used to perform blacklisting and whitelisting.</para> <para>This file is used to perform blacklisting and whitelisting.</para>
<para>Rules in this file are applied depending on the setting of BLACKLIST <para>Rules in this file are applied depending on the setting of
in <ulink BLACKLISTNEWONLY in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para> url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5). If
BLACKLISTNEWONLY=No, then they are applied regardless of the connection
tracking state of the packet. If BLACKLISTNEWONLY=Yes, they are applied to
connections in the NEW and INVALID states.</para>
<para>The format of rules in this file is the same as the format of rules <para>The format of rules in this file is the same as the format of rules
in <ulink url="/manpages/shorewall-rules.html">shorewall-rules in <ulink url="/manpages/shorewall-rules.html">shorewall-rules
@@ -115,10 +118,10 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>A_DROP</term> <term>A_DROP and A_DROP!</term>
<listitem> <listitem>
<para>Audited version of DROP. Requires AUDIT_TARGET support <para>Audited versions of DROP. Requires AUDIT_TARGET support
in the kernel and ip6tables.</para> in the kernel and ip6tables.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -167,7 +170,7 @@
<listitem> <listitem>
<para>queues matching packets to a back end logging daemon via <para>queues matching packets to a back end logging daemon via
a netlink socket then continues to the next rule. See <ulink a netlink socket then continues to the next rule. See <ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para> url="/shorewall.logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -273,11 +276,11 @@
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>Examples</title> <title>Example</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1:</term> <term>Example 1:</term>
<listitem> <listitem>
<para>Drop Teredo packets from the net.</para> <para>Drop Teredo packets from the net.</para>
@@ -287,28 +290,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2:</term> <term>Example 2:</term>
<listitem>
<para>Don't subject packets from 2001:DB8::/64 to the remaining
rules in the file.</para>
<programlisting>WHITELIST net:[2001:DB8::/64] all</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 1:</term>
<listitem>
<para>Drop Teredo packets from the net.</para>
<programlisting>DROP net:[2001::/32] all</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 2:</term>
<listitem> <listitem>
<para>Don't subject packets from 2001:DB8::/64 to the remaining <para>Don't subject packets from 2001:DB8::/64 to the remaining
@@ -324,8 +306,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/blrules</para> <para>/etc/shorewall/blrules</para>
<para>/etc/shorewall6/blrules</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -337,6 +317,12 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-hosts(5), shorewall-interfaces(5), shorewall-maclist(5),
shorewall6-netmap(5),shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-rtrules(5), shorewall-routestopped(5),
shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5),
shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-mangle(5),
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/conntrack</command> <command>/etc/shorewall/conntrack</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -35,7 +35,7 @@
<emphasis role="bold">conntrack</emphasis>.</para> <emphasis role="bold">conntrack</emphasis>.</para>
<para>The file supports three different column layouts: FORMAT 1, FORMAT <para>The file supports three different column layouts: FORMAT 1, FORMAT
2, and FORMAT 3 with FORMAT 1 being the default. The three differ as 2, and FORMAT 3, FORMAT 1 being the default. The three differ as
follows:</para> follows:</para>
<itemizedlist> <itemizedlist>
@@ -311,9 +311,9 @@
<listitem> <listitem>
<para><option>ULOG</option></para> <para><option>ULOG</option></para>
<para>IPv4 only. Added in Shoreawll 4.6.0. Queues the packet to <para>Added in Shoreawll 4.6.0. Queues the packet to a backend
a backend logging daemon using the ULOG netfilter target with logging daemon using the ULOG netfilter target with the
the specified <replaceable>ulog-parameters</replaceable>.</para> specified <replaceable>ulog-parameters</replaceable>.</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
@@ -689,57 +689,31 @@
<refsect1> <refsect1>
<title>EXAMPLE</title> <title>EXAMPLE</title>
<para>IPv4 Example 1:</para> <para>Example 1:</para>
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER <programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting> CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
<para>IPv4 Example 2 (Shorewall 4.5.10 or later):</para> <para>Example 2 (Shorewall 4.5.10 or later):</para>
<para>Drop traffic to/from all zones to IP address 1.2.3.4</para> <para>Drop traffic to/from all zones to IP address 1.2.3.4</para>
<programlisting>?FORMAT 2 <programlisting>FORMAT 2
#ACTION SOURCE DEST PROTO DPORT SPORT USER #ACTION SOURCE DEST PROTO DPORT SPORT USER
DROP all-:1.2.3.4 - DROP all-:1.2.3.4 -
DROP all 1.2.3.4</programlisting> DROP all 1.2.3.4</programlisting>
<para>or<programlisting>?FORMAT 3 <para>or<programlisting>FORMAT 3
#ACTION SOURCE DEST PROTO DPORT SPORT USER #ACTION SOURCE DEST PROTO DPORT SPORT USER
DROP:P 1.2.3.4 - DROP:P 1.2.3.4 -
DROP:PO - 1.2.3.4 DROP:PO - 1.2.3.4
</programlisting></para> </programlisting></para>
<para>IPv6 Example 1:</para>
<para>Use the FTP helper for TCP port 21 connections from the firewall
itself.</para>
<programlisting>FORMAT 2
#ACTION SOURCE DEST PROTO DPORT SPORT USER
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
<para>IPv6 Example 2 (Shorewall 4.5.10 or later):</para>
<para>Drop traffic to/from all zones to IP address 2001:1.2.3::4</para>
<programlisting>FORMAT 2
#ACTION SOURCE DEST PROTO DPORT SPORT USER
DROP all-:2001:1.2.3::4 -
DROP all 2001:1.2.3::4
</programlisting>
<para>or<programlisting>FORMAT 3
#ACTION SOURCE DEST PROTO DPORT SPORT USER
DROP:P 2001:1.2.3::4 -
DROP:PO - 2001:1.2.3::4</programlisting></para>
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/conntrack</para> <para>/etc/shorewall/conntrack</para>
<para>/etc/shorewall6/conntrack</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -748,6 +722,14 @@ DROP:PO - 2001:1.2.3::4</programlisting><
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -25,12 +25,8 @@
<refsect1> <refsect1>
<title>Description</title> <title>Description</title>
<para>IPv4 only.</para>
<para>Use this file to list the destinations for which you want to disable <para>Use this file to list the destinations for which you want to disable
ECN (Explicit Congestion Notification). Use of this file is deprecated in ECN (Explicit Congestion Notification).</para>
favor of ECN rules in <ulink
url="/manpages/shorewall-mangle.html">shorewall-mangle</ulink>(8).</para>
<para>The columns in the file are as follows.</para> <para>The columns in the file are as follows.</para>
@@ -69,6 +65,14 @@
<refsect1> <refsect1>
<title>See ALSO</title> <title>See ALSO</title>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -49,10 +49,9 @@
<para>Beginning in Shorewall 4.4.13, the second form of exclusion is <para>Beginning in Shorewall 4.4.13, the second form of exclusion is
allowed after <emphasis role="bold">all</emphasis> and <emphasis allowed after <emphasis role="bold">all</emphasis> and <emphasis
role="bold">any</emphasis> in the SOURCE and DEST columns of <ulink role="bold">any</emphasis> in the SOURCE and DEST columns of
url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(5). It allows /etc/shorewall/rules. It allows you to omit arbitrary zones from the list
you to omit arbitrary zones from the list generated by those key generated by those key words.</para>
words.</para>
<warning> <warning>
<para>If you omit a sub-zone and there is an explicit or explicit <para>If you omit a sub-zone and there is an explicit or explicit
@@ -118,7 +117,7 @@ ACCEPT all!z2 net tcp 22</programlisting>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1 - All IPv4 addresses except 192.168.3.4</term> <term>Example 1 - All IPv4 addresses except 192.168.3.4</term>
<listitem> <listitem>
<para>!192.168.3.4</para> <para>!192.168.3.4</para>
@@ -126,8 +125,8 @@ ACCEPT all!z2 net tcp 22</programlisting>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2 - All IPv4 addresses except the network <term>Example 2 - All IPv4 addresses except the network 192.168.1.0/24
192.168.1.0/24 and the host 10.2.3.4</term> and the host 10.2.3.4</term>
<listitem> <listitem>
<para>!192.168.1.0/24,10.1.3.4</para> <para>!192.168.1.0/24,10.1.3.4</para>
@@ -135,7 +134,7 @@ ACCEPT all!z2 net tcp 22</programlisting>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 3 - All IPv4 addresses except the range <term>Example 3 - All IPv4 addresses except the range
192.168.1.3-192.168.1.12 and the network 10.0.0.0/8</term> 192.168.1.3-192.168.1.12 and the network 10.0.0.0/8</term>
<listitem> <listitem>
@@ -144,8 +143,8 @@ ACCEPT all!z2 net tcp 22</programlisting>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 4 - The network 192.168.1.0/24 except hosts <term>Example 4 - The network 192.168.1.0/24 except hosts 192.168.1.3
192.168.1.3 and 192.168.1.9</term> and 192.168.1.9</term>
<listitem> <listitem>
<para>192.168.1.0/24!192.168.1.3,192.168.1.9</para> <para>192.168.1.0/24!192.168.1.3,192.168.1.9</para>
@@ -177,6 +176,14 @@ ACCEPT all!z2 net tcp 22</programlisting>
<refsect1> <refsect1>
<title>See ALSO</title> <title>See ALSO</title>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/hosts</command> <command>/etc/shorewall/hosts</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -270,8 +270,6 @@ vpn ppp+:192.168.3.0/24</programlisting></para>
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/hosts</para> <para>/etc/shorewall/hosts</para>
<para>/etc/shorewall6/hosts</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -280,6 +278,14 @@ vpn ppp+:192.168.3.0/24</programlisting></para>
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall_interfaces(5), shorewall-ipsets(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
shorewall-nesting(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -165,6 +165,14 @@
<refsect1> <refsect1>
<title>See ALSO</title> <title>See ALSO</title>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/interfaces</command> <command>/etc/shorewall/interfaces</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -104,7 +104,9 @@ loc eth2 -</programlisting>
<para>You may use wildcards here by specifying a prefix followed by <para>You may use wildcards here by specifying a prefix followed by
the plus sign ("+"). For example, if you want to make an entry that the plus sign ("+"). For example, if you want to make an entry that
applies to all PPP interfaces, use 'ppp+'; that would match ppp0, applies to all PPP interfaces, use 'ppp+'; that would match ppp0,
ppp1, ppp2, …</para> ppp1, ppp2, … Please note that the '+' means '<emphasis
role="bold">one</emphasis> or more additional characters' so 'ppp'
does not match 'ppp+'.</para>
<para>When using Shorewall versions before 4.1.4, care must be <para>When using Shorewall versions before 4.1.4, care must be
exercised when using wildcards where there is another zone that uses exercised when using wildcards where there is another zone that uses
@@ -197,12 +199,11 @@ loc eth2 -</programlisting>
<term><emphasis role="bold">arp_filter[={0|1}]</emphasis></term> <term><emphasis role="bold">arp_filter[={0|1}]</emphasis></term>
<listitem> <listitem>
<para>IPv4 only. If specified, this interface will only <para>If specified, this interface will only respond to ARP
respond to ARP who-has requests for IP addresses configured on who-has requests for IP addresses configured on the interface.
the interface. If not specified, the interface can respond to If not specified, the interface can respond to ARP who-has
ARP who-has requests for IP addresses on any of the firewall's requests for IP addresses on any of the firewall's interface.
interface. The interface must be up when Shorewall is The interface must be up when Shorewall is started.</para>
started.</para>
<para>Only those interfaces with the <para>Only those interfaces with the
<option>arp_filter</option> option will have their setting <option>arp_filter</option> option will have their setting
@@ -224,8 +225,8 @@ loc eth2 -</programlisting>
role="bold">arp_ignore</emphasis>[=<emphasis>number</emphasis>]</term> role="bold">arp_ignore</emphasis>[=<emphasis>number</emphasis>]</term>
<listitem> <listitem>
<para>IPv4 only. If specified, this interface will respond to <para>If specified, this interface will respond to arp
arp requests based on the value of <emphasis>number</emphasis> requests based on the value of <emphasis>number</emphasis>
(defaults to 1).</para> (defaults to 1).</para>
<para>1 - reply only if the target IP address is local address <para>1 - reply only if the target IP address is local address
@@ -256,7 +257,7 @@ loc eth2 -</programlisting>
<warning> <warning>
<para>Do not specify <emphasis <para>Do not specify <emphasis
role="bold">arp_ignore</emphasis> for any interface involved role="bold">arp_ignore</emphasis> for any interface involved
in <ulink url="/ProxyARP.htm">Proxy ARP</ulink>.</para> in <ulink url="../ProxyARP.htm">Proxy ARP</ulink>.</para>
</warning> </warning>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -322,7 +323,7 @@ loc eth2 -</programlisting>
and/or destination address is to be compared against the and/or destination address is to be compared against the
ipset-based dynamic blacklist (DYNAMIC_BLACKLIST=ipset... in ipset-based dynamic blacklist (DYNAMIC_BLACKLIST=ipset... in
<ulink <ulink
url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>). url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink>).
The default is determine by the setting of The default is determine by the setting of
DYNAMIC_BLACKLIST:</para> DYNAMIC_BLACKLIST:</para>
@@ -410,13 +411,13 @@ loc eth2 -</programlisting>
<listitem> <listitem>
<para>the interface is a <ulink <para>the interface is a <ulink
url="/SimpleBridge.html">simple bridge</ulink> with a DHCP url="../SimpleBridge.html">simple bridge</ulink> with a
server on one port and DHCP clients on another DHCP server on one port and DHCP clients on another
port.</para> port.</para>
<note> <note>
<para>If you use <ulink <para>If you use <ulink
url="/bridge-Shorewall-perl.html">Shorewall-perl for url="../bridge-Shorewall-perl.html">Shorewall-perl for
firewall/bridging</ulink>, then you need to include firewall/bridging</ulink>, then you need to include
DHCP-specific rules in <ulink DHCP-specific rules in <ulink
url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(5). url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(5).
@@ -466,15 +467,15 @@ loc eth2 -</programlisting>
role="bold">logmartians[={0|1}]</emphasis></term> role="bold">logmartians[={0|1}]</emphasis></term>
<listitem> <listitem>
<para>IPv4 only. Turn on kernel martian logging (logging of <para>Turn on kernel martian logging (logging of packets with
packets with impossible source addresses. It is strongly impossible source addresses. It is strongly suggested that if
suggested that if you set <emphasis you set <emphasis role="bold">routefilter</emphasis> on an
role="bold">routefilter</emphasis> on an interface that you interface that you also set <emphasis
also set <emphasis role="bold">logmartians</emphasis>. Even if role="bold">logmartians</emphasis>. Even if you do not specify
you do not specify the <option>routefilter</option> option, it the <option>routefilter</option> option, it is a good idea to
is a good idea to specify <option>logmartians</option> because specify <option>logmartians</option> because your distribution
your distribution may have enabled route filtering without you may have enabled route filtering without you knowing
knowing it.</para> it.</para>
<para>Only those interfaces with the <para>Only those interfaces with the
<option>logmartians</option> option will have their setting <option>logmartians</option> option will have their setting
@@ -575,8 +576,8 @@ loc eth2 -</programlisting>
<term><emphasis role="bold">nosmurfs</emphasis></term> <term><emphasis role="bold">nosmurfs</emphasis></term>
<listitem> <listitem>
<para>IPv4 only. Filter packets for smurfs (packets with a <para>Filter packets for smurfs (packets with a broadcast
broadcast address as the source).</para> address as the source).</para>
<para>Smurfs will be optionally logged based on the setting of <para>Smurfs will be optionally logged based on the setting of
SMURF_LOG_LEVEL in <ulink SMURF_LOG_LEVEL in <ulink
@@ -595,9 +596,9 @@ loc eth2 -</programlisting>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>a <filename <para>a <filename
class="directory">/proc/sys/net/ipv[46]/conf/</filename> class="directory">/proc/sys/net/ipv4/conf/</filename>
entry for the interface cannot be modified (including for entry for the interface cannot be modified (including for
proxy ARP or proxy NDP).</para> proxy ARP).</para>
</listitem> </listitem>
<listitem> <listitem>
@@ -637,7 +638,7 @@ loc eth2 -</programlisting>
<term><emphasis role="bold">proxyarp[={0|1}]</emphasis></term> <term><emphasis role="bold">proxyarp[={0|1}]</emphasis></term>
<listitem> <listitem>
<para>IPv4 only. Sets <para>Sets
/proc/sys/net/ipv4/conf/<emphasis>interface</emphasis>/proxy_arp. /proc/sys/net/ipv4/conf/<emphasis>interface</emphasis>/proxy_arp.
Do NOT use this option if you are employing Proxy ARP through Do NOT use this option if you are employing Proxy ARP through
entries in <ulink entries in <ulink
@@ -658,24 +659,6 @@ loc eth2 -</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">proxyndp</emphasis>[={0|1}]</term>
<listitem>
<para>IPv6 only. Sets
/proc/sys/net/ipv6/conf/<emphasis>interface</emphasis>/proxy_ndp.</para>
<para><emphasis role="bold">Note</emphasis>: This option does
not work with a wild-card <replaceable>interface</replaceable>
name (e.g., eth0.+) in the INTERFACE column.</para>
<para>Only those interfaces with the <option>proxyndp</option>
option will have their setting changed; the value assigned to
the setting will be the value specified (if any) or 1 if no
value is given.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">required</emphasis></term> <term><emphasis role="bold">required</emphasis></term>
@@ -717,8 +700,8 @@ loc eth2 -</programlisting>
role="bold">routefilter[={0|1|2}]</emphasis></term> role="bold">routefilter[={0|1|2}]</emphasis></term>
<listitem> <listitem>
<para>IPv4 only. Turn on kernel route filtering for this <para>Turn on kernel route filtering for this interface
interface (anti-spoofing measure).</para> (anti-spoofing measure).</para>
<para>Only those interfaces with the <para>Only those interfaces with the
<option>routefilter</option> option will have their setting <option>routefilter</option> option will have their setting
@@ -902,14 +885,11 @@ loc eth2 -</programlisting>
<member><emphasis <member><emphasis
role="bold">routefilter</emphasis></member> role="bold">routefilter</emphasis></member>
<member><emphasis
role="bold">proxyarp</emphasis></member>
<member><emphasis
role="bold">proxyudp</emphasis></member>
<member><emphasis <member><emphasis
role="bold">sourceroute</emphasis></member> role="bold">sourceroute</emphasis></member>
<member><emphasis
role="bold">proxyndp</emphasis></member>
</simplelist> </simplelist>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
@@ -922,9 +902,7 @@ loc eth2 -</programlisting>
<listitem> <listitem>
<para>Incoming requests from this interface may be remapped <para>Incoming requests from this interface may be remapped
via UPNP (upnpd). See <ulink via UPNP (upnpd). See <ulink
url="/UPnP.html">http://www.shorewall.net/UPnP.html</ulink>. url="/UPnP.html">http://www.shorewall.net/UPnP.html</ulink>.</para>
Supported in IPv4 and in IPv6 in Shorewall 5.1.4 and
later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -938,8 +916,7 @@ loc eth2 -</programlisting>
causes Shorewall to detect the default gateway through the causes Shorewall to detect the default gateway through the
interface and to accept UDP packets from that gateway. Note interface and to accept UDP packets from that gateway. Note
that, like all aspects of UPnP, this is a security hole so use that, like all aspects of UPnP, this is a security hole so use
this option at your own risk. Supported in IPv4 and in IPv6 in this option at your own risk.</para>
Shorewall 5.1.4 and later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -966,7 +943,7 @@ loc eth2 -</programlisting>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1:</term> <term>Example 1:</term>
<listitem> <listitem>
<para>Suppose you have eth0 connected to a DSL modem and eth1 <para>Suppose you have eth0 connected to a DSL modem and eth1
@@ -979,7 +956,7 @@ loc eth2 -</programlisting>
<para>Your entries for this setup would look like:</para> <para>Your entries for this setup would look like:</para>
<programlisting>?FORMAT 1 <programlisting>FORMAT 1
#ZONE INTERFACE BROADCAST OPTIONS #ZONE INTERFACE BROADCAST OPTIONS
net eth0 206.191.149.223 dhcp net eth0 206.191.149.223 dhcp
loc eth1 192.168.1.255 loc eth1 192.168.1.255
@@ -994,7 +971,7 @@ dmz eth2 192.168.2.255</programlisting>
<para>The same configuration without specifying broadcast addresses <para>The same configuration without specifying broadcast addresses
is:</para> is:</para>
<programlisting>?FORMAT 2 <programlisting>FORMAT 2
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
net eth0 dhcp net eth0 dhcp
loc eth1 loc eth1
@@ -1009,7 +986,7 @@ dmz eth2</programlisting>
<para>You have a simple dial-in system with no Ethernet <para>You have a simple dial-in system with no Ethernet
connections.</para> connections.</para>
<programlisting>?FORMAT 2 <programlisting>FORMAT 2
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
net ppp0 -</programlisting> net ppp0 -</programlisting>
</listitem> </listitem>
@@ -1022,7 +999,7 @@ net ppp0 -</programlisting>
<para>You have a bridge with no IP address and you want to allow <para>You have a bridge with no IP address and you want to allow
traffic through the bridge.</para> traffic through the bridge.</para>
<programlisting>?FORMAT 2 <programlisting>FORMAT 2
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
- br0 bridge</programlisting> - br0 bridge</programlisting>
</listitem> </listitem>
@@ -1034,8 +1011,6 @@ net ppp0 -</programlisting>
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/interfaces</para> <para>/etc/shorewall/interfaces</para>
<para>/etc/shorewall6/interfaces</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -1044,6 +1019,13 @@ net ppp0 -</programlisting>
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall-maclist(5),
shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5),
shorewall-params(5), shorewall-policy(5), shorewall-providers(5),
shorewall-proxyarp(5), shorewall-rtrules(5), shorewall-routestopped(5),
shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5),
shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-mangle(5),
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -103,7 +103,7 @@
<important> <important>
<para>These additional match options are not available in <ulink <para>These additional match options are not available in <ulink
url="/manpages/shorewall-tcfilters.html">shorewall-tcfilters(5)</ulink>.</para> url="shorewall-tcfilters.html">shorewall-tcfilters(5)</ulink>.</para>
</important> </important>
<para>Available options are:</para> <para>Available options are:</para>
@@ -251,44 +251,34 @@
<para>/etc/shorewall/accounting</para> <para>/etc/shorewall/accounting</para>
<para>/etc/shorewall6/accounting</para>
<para>/etc/shorewall/blrules</para> <para>/etc/shorewall/blrules</para>
<para>/etc/shorewall6/blrules</para>
<para>/etc/shorewall/hosts -- <emphasis role="bold">Note:</emphasis> <para>/etc/shorewall/hosts -- <emphasis role="bold">Note:</emphasis>
Multiple matches enclosed in +[...] may not be used in this file.</para> Multiple matches enclosed in +[...] may not be used in this file.</para>
<para>/etc/shorewall6/hosts -- <emphasis role="bold">Note:</emphasis>
Multiple matches enclosed in +[...] may not be used in this file.</para>
<para>/etc/shorewall/maclist -- <emphasis role="bold">Note:</emphasis> <para>/etc/shorewall/maclist -- <emphasis role="bold">Note:</emphasis>
Multiple matches enclosed in +[...] may not be used in this file.</para> Multiple matches enclosed in +[...] may not be used in this file.</para>
<para>/etc/shorewall6/maclist -- <emphasis role="bold">Note:</emphasis> <para>/etc/shorewall/masq</para>
Multiple matches enclosed in +[...] may not be used in this file.</para>
<para>/etc/shorewall/rules</para> <para>/etc/shorewall/rules</para>
<para>/etc/shorewall6/rules</para>
<para>/etc/shorewall/secmarks</para> <para>/etc/shorewall/secmarks</para>
<para>/etc/shorewall6/secmarks</para>
<para>/etc/shorewall/mangle</para> <para>/etc/shorewall/mangle</para>
<para>/etc/shorewall6/mangle</para>
<para>/etc/shorewall/snat</para>
<para>/etc/shorewall6/snat</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>See ALSO</title> <title>See ALSO</title>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/maclist</command> <command>/etc/shorewall/maclist</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -97,8 +97,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/maclist</para> <para>/etc/shorewall/maclist</para>
<para>/etc/shorewall6/maclist</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -110,6 +108,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,17 +18,31 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/mangle</command> <command>/etc/shorewall/mangle</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
<refsect1> <refsect1>
<title>Description</title> <title>Description</title>
<para>This file was introduced in Shorewall 4.6.0 and replaces <ulink <para>This file was introduced in Shorewall 4.6.0 and is intended to
replace <ulink
url="/manpages/shorewall-tcrules.html">shorewall-tcrules(5)</ulink>. This url="/manpages/shorewall-tcrules.html">shorewall-tcrules(5)</ulink>. This
file is only processed by the compiler if:</para> file is only processed by the compiler if:</para>
<orderedlist numeration="loweralpha">
<listitem>
<para>No file named 'tcrules' exists on the current CONFIG_PATH (see
<ulink url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>);
or</para>
</listitem>
<listitem>
<para>The first file named 'tcrules' found on the CONFIG_PATH contains
no non-commentary entries.</para>
</listitem>
</orderedlist>
<para>Entries in this file cause packets to be marked as a means of <para>Entries in this file cause packets to be marked as a means of
classifying them for traffic control or policy routing.</para> classifying them for traffic control or policy routing.</para>
@@ -103,7 +117,9 @@
SOURCE is $FW, the generated rule is always placed in the OUTPUT SOURCE is $FW, the generated rule is always placed in the OUTPUT
chain. If DEST is '$FW', then the rule is placed in the INPUT chain. chain. If DEST is '$FW', then the rule is placed in the INPUT chain.
Additionally, a <replaceable>chain-designator</replaceable> may not Additionally, a <replaceable>chain-designator</replaceable> may not
be specified in an action body.</para> be specified in an action body unless the action is declared as
<option>inline</option> in <ulink
url="shorewall6-actions.html">shorewall-actions</ulink>(5).</para>
<para>Where a command takes parameters, those parameters are <para>Where a command takes parameters, those parameters are
enclosed in parentheses ("(....)") and separated by commas.</para> enclosed in parentheses ("(....)") and separated by commas.</para>
@@ -283,7 +299,7 @@
configuration described at <ulink configuration described at <ulink
url="http://www.loadbalancer.org/blog/setting-up-haproxy-with-transparent-mode-on-centos-6-x">http://www.loadbalancer.org/blog/setting-up-haproxy-with-transparent-mode-on-centos-6-x</ulink>, url="http://www.loadbalancer.org/blog/setting-up-haproxy-with-transparent-mode-on-centos-6-x">http://www.loadbalancer.org/blog/setting-up-haproxy-with-transparent-mode-on-centos-6-x</ulink>,
place this entry in <ulink place this entry in <ulink
url="/manpages/shorewall-providers.html">shorewall-providers(5)</ulink>:</para> url="manpages/shorewall-providers.html">shorewall-providers(5)</ulink>:</para>
<programlisting>#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY <programlisting>#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY
TProxy 1 - - lo - tproxy</programlisting> TProxy 1 - - lo - tproxy</programlisting>
@@ -349,9 +365,8 @@ DIVERTHA - - tcp</programlisting>
<listitem> <listitem>
<para>Added in Shorewall 5.0.6 as an alternative to entries in <para>Added in Shorewall 5.0.6 as an alternative to entries in
<ulink <ulink url="shorewall-ecn.html">shorewall-ecn(5)</ulink>. If a
url="/manpages/shorewall-ecn.html">shorewall-ecn(5)</ulink>. PROTO is specified, it must be 'tcp' (6). If no PROTO is
If a PROTO is specified, it must be 'tcp' (6). If no PROTO is
supplied, TCP is assumed. This action causes all ECN bits in supplied, TCP is assumed. This action causes all ECN bits in
the TCP header to be cleared.</para> the TCP header to be cleared.</para>
</listitem> </listitem>
@@ -773,7 +788,7 @@ Normal-Service =&gt; 0x00</programlisting>
<listitem> <listitem>
<para>where <replaceable>interface</replaceable> is the <para>where <replaceable>interface</replaceable> is the
logical name of an interface defined in <ulink logical name of an interface defined in <ulink
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5). url="shorewall-interfaces.html">shorewall-interfaces</ulink>(5).
Matches packets entering the firewall from the named Matches packets entering the firewall from the named
interface. May not be used in CLASSIFY rules or in rules using interface. May not be used in CLASSIFY rules or in rules using
the :T chain qualifier.</para> the :T chain qualifier.</para>
@@ -849,7 +864,7 @@ Normal-Service =&gt; 0x00</programlisting>
on the firewall and whose source IP address matches one of the on the firewall and whose source IP address matches one of the
listed addresses and does not match any address listed in the listed addresses and does not match any address listed in the
<replaceable>exclusion</replaceable>. May not be used with a <replaceable>exclusion</replaceable>. May not be used with a
chain qualifier (:P, :F, etc.) in the ACTION column.</para> chain qualifier (:P, :F, etc.) in the ACTION column. </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -896,12 +911,11 @@ Normal-Service =&gt; 0x00</programlisting>
<listitem> <listitem>
<para>where <replaceable>interface</replaceable> is the <para>where <replaceable>interface</replaceable> is the
logical name of an interface defined in <ulink logical name of an interface defined in <ulink
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5). url="shorewall-interfaces.html">shorewall-interfaces</ulink>(5).
Matches packets leaving the firewall through the named Matches packets leaving the firewall through the named
interface. May not be used in the PREROUTING chain (:P in the interface. May not be used in the PREROUTING chain (:P in the
mark column or no chain qualifier and MARK_IN_FORWARD_CHAIN=No mark column or no chain qualifier and MARK_IN_FORWARD_CHAIN=No
in <ulink in <ulink url="manpages/shorewall.conf">shorewall.conf</ulink>
url="/manpages/shorewall.conf">shorewall.conf</ulink>
(5)).</para> (5)).</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -938,7 +952,7 @@ Normal-Service =&gt; 0x00</programlisting>
when both the outgoing interface and destination IP address when both the outgoing interface and destination IP address
match. May not be used in the PREROUTING chain (:P in the mark match. May not be used in the PREROUTING chain (:P in the mark
column or no chain qualifier and MARK_IN_FORWARD_CHAIN=No in column or no chain qualifier and MARK_IN_FORWARD_CHAIN=No in
<ulink url="/manpages/shorewall.conf">shorewall.conf</ulink> <ulink url="manpages/shorewall.conf">shorewall.conf</ulink>
(5)).</para> (5)).</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -953,7 +967,7 @@ Normal-Service =&gt; 0x00</programlisting>
<replaceable>exclusion</replaceable>. May not be used in the <replaceable>exclusion</replaceable>. May not be used in the
PREROUTING chain (:P in the mark column or no chain qualifier PREROUTING chain (:P in the mark column or no chain qualifier
and MARK_IN_FORWARD_CHAIN=No in <ulink and MARK_IN_FORWARD_CHAIN=No in <ulink
url="/manpages/shorewall.conf">shorewall.conf</ulink> url="manpages/shorewall.conf">shorewall.conf</ulink>
(5)).</para> (5)).</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1014,16 +1028,15 @@ Normal-Service =&gt; 0x00</programlisting>
<varlistentry> <varlistentry>
<term><emphasis role="bold">PROTO</emphasis> - {<emphasis <term><emphasis role="bold">PROTO</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis role="bold">-</emphasis>|<emphasis
role="bold">{tcp:[!]syn</emphasis>|<emphasis role="bold">{tcp:syn</emphasis>|<emphasis
role="bold">ipp2p</emphasis>|<emphasis role="bold">ipp2p</emphasis>|<emphasis
role="bold">ipp2p:udp</emphasis>|<emphasis role="bold">ipp2p:udp</emphasis>|<emphasis
role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis
role="bold">all}[,...]}</emphasis></term> role="bold">all}[,...]}</emphasis></term>
<listitem> <listitem>
<para>See <ulink <para>Protocol - <emphasis role="bold">ipp2p</emphasis> requires
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink> for ipp2p match support in your kernel and iptables.</para>
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>
@@ -1529,7 +1542,7 @@ Normal-Service =&gt; 0x00</programlisting>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1:</term> <term>Example 1:</term>
<listitem> <listitem>
<para>Mark all ICMP echo traffic with packet mark 1. Mark all peer <para>Mark all ICMP echo traffic with packet mark 1. Mark all peer
@@ -1558,7 +1571,7 @@ Normal-Service =&gt; 0x00</programlisting>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2:</term> <term>Example 2:</term>
<listitem> <listitem>
<para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in <para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in
@@ -1570,41 +1583,12 @@ Normal-Service =&gt; 0x00</programlisting>
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST #ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW
/etc/shorewall/snat: /etc/shorewall/masq:
#ACTION SOURCE DEST ... #INTERFACE SOURCE ADDRESS ...
SNAT(1.1.1.1) eth0:192.168.1.0/24 - { mark=1:C } eth0 192.168.1.0/24 1.1.1.1 ; mark=1:C
SNAT(1.1.1.3) eth0:192.168.1.0/24 - { mark=2:C } eth0 192.168.1.0/24 1.1.1.3 ; mark=2:C
SNAT(1.1.1.4) eth0:192.168.1.0/24 - { mark=3:C }</programlisting> eth0 192.168.1.0/24 1.1.1.4 ; mark=3:C</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 1:</term>
<listitem>
<para>Mark all ICMP echo traffic with packet mark 1. Mark all peer
to peer traffic with packet mark 4.</para>
<para>This is a little more complex than otherwise expected. Since
the ipp2p module is unable to determine all packets in a connection
are P2P packets, we mark the entire connection as P2P if any of the
packets are determined to match.</para>
<para>We assume packet/connection mark 0 means unclassified.</para>
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
MARK(1):T ::/0 ::/0 icmp echo-request
MARK(1):T ::/0 ::/0 icmp echo-reply
RESTORE:T ::/0 ::/0 all - - - 0
CONTINUE:T ::/0 ::/0 all - - - !0
MARK(4):T ::/0 ::/0 ipp2p:all
SAVE:T ::/0 ::/0 all - - - !0</programlisting>
<para>If a packet hasn't been classified (packet mark is 0), copy
the connection mark to the packet mark. If the packet mark is set,
we're done. If the packet is P2P, set the packet mark to 4. If the
packet mark has been set, save it to the connection mark.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
@@ -1614,8 +1598,6 @@ Normal-Service =&gt; 0x00</programlisting>
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/mangle</para> <para>/etc/shorewall/mangle</para>
<para>/etc/shorewall6/mangle</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -1633,6 +1615,14 @@ Normal-Service =&gt; 0x00</programlisting>
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-ecn(5), shorewall-exclusion(5),
shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/masq</command> <command>/etc/shorewall/masq</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -579,7 +579,7 @@
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1:</term> <term>Example 1:</term>
<listitem> <listitem>
<para>You have a simple masquerading setup where eth0 connects to a <para>You have a simple masquerading setup where eth0 connects to a
@@ -594,7 +594,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2:</term> <term>Example 2:</term>
<listitem> <listitem>
<para>You add a router to your local network to connect subnet <para>You add a router to your local network to connect subnet
@@ -607,7 +607,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 3:</term> <term>Example 3:</term>
<listitem> <listitem>
<para>You have an IPSEC tunnel through ipsec0 and you want to <para>You have an IPSEC tunnel through ipsec0 and you want to
@@ -620,7 +620,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 4:</term> <term>Example 4:</term>
<listitem> <listitem>
<para>You want all outgoing traffic from 192.168.1.0/24 through eth0 <para>You want all outgoing traffic from 192.168.1.0/24 through eth0
@@ -634,7 +634,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 5:</term> <term>Example 5:</term>
<listitem> <listitem>
<para>You want all outgoing SMTP traffic entering the firewall from <para>You want all outgoing SMTP traffic entering the firewall from
@@ -654,7 +654,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 6:</term> <term>Example 6:</term>
<listitem> <listitem>
<para>Connections leaving on eth0 and destined to any host defined <para>Connections leaving on eth0 and destined to any host defined
@@ -667,7 +667,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 7:</term> <term>Example 7:</term>
<listitem> <listitem>
<para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in <para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in
@@ -689,7 +689,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 8:</term> <term>Example 8:</term>
<listitem> <listitem>
<para>Your eth1 has two public IP addresses: 70.90.191.121 and <para>Your eth1 has two public IP addresses: 70.90.191.121 and
@@ -716,49 +716,6 @@
</programlisting> </programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>IPv6 Example 1:</term>
<listitem>
<para>You have a simple 'masquerading' setup where eth0 connects to
a DSL or cable modem and eth1 connects to your local network with
subnet 2001:470:b:787::0/64</para>
<para>Your entry in the file will be:</para>
<programlisting> #INTERFACE SOURCE ADDRESS
eth0 2001:470:b:787::0/64 -</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 2:</term>
<listitem>
<para>Your sit1 interface has two public IP addresses:
2001:470:a:227::1 and 2001:470:b:227::1. You want to use the
iptables statistics match to masquerade outgoing connections evenly
between these two addresses.</para>
<programlisting>/etc/shorewall/masq:
#INTERFACE SOURCE ADDRESS
INLINE(sit1) ::/0 2001:470:a:227::1 ; -m statistic --mode random --probability 0.50
sit1 ::/0 2001:470:a:227::2
</programlisting>
<para>If INLINE_MATCHES=Yes in <ulink
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5),
then these rules may be specified as follows:</para>
<programlisting>/etc/shorewall/masq:
#INTERFACE SOURCE ADDRESS
sit1 ::/0 2001:470:a:227::1 ; -m statistic --mode random --probability 0.50
sit1 ::/0 2001:470:a:227::2</programlisting>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
@@ -766,8 +723,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/masq</para> <para>/etc/shorewall/masq</para>
<para>/etc/shorewall6/masq</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -776,6 +731,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-exclusion(5), shorewall-hosts(5),
shorewall_interfaces(5), shorewall-ipsets(5), shorewall-maclist(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,11 +18,11 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/usr/share/shorewall[6]/modules</command> <command>/usr/share/shorewall/modules</command>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
<command>/usr/share/shorewall[6]/helpers</command> <command>/usr/share/shorewall/helpers</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -82,19 +82,19 @@
<para>/etc/shorewall/modules</para> <para>/etc/shorewall/modules</para>
<para>/etc/shorewall/helpers</para> <para>/etc/shorewall/helpers</para>
<para>/usr/share/shorewall6/modules</para>
<para>/usr/share/shorewall6/helpers</para>
<para>/etc/shorewall6/modules</para>
<para>/etc/shorewall6/helpers</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>See ALSO</title> <title>See ALSO</title>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -34,8 +34,6 @@
url="/FAQ.htm#faq1">http://www.shorewall.net/FAQ.htm#faq1</ulink>. Also, url="/FAQ.htm#faq1">http://www.shorewall.net/FAQ.htm#faq1</ulink>. Also,
in many cases, Proxy ARP (<ulink in many cases, Proxy ARP (<ulink
url="/manpages/shorewall-proxyarp.html">shorewall-proxyarp</ulink>(5)) url="/manpages/shorewall-proxyarp.html">shorewall-proxyarp</ulink>(5))
or Proxy-NDP(<ulink
url="/manpages6/shorewall6-proxyndp.html">shorewall6-proxyndp</ulink>(5))
is a better solution that one-to-one NAT.</para> is a better solution that one-to-one NAT.</para>
</warning> </warning>
@@ -201,7 +199,7 @@ all all REJECT info
<listitem> <listitem>
<para>Set IMPLICIT_CONTINUE=Yes in <ulink <para>Set IMPLICIT_CONTINUE=Yes in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>.</para> url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink>.</para>
</listitem> </listitem>
</orderedlist> </orderedlist>
</refsect1> </refsect1>
@@ -210,8 +208,6 @@ all all REJECT info
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/nat</para> <para>/etc/shorewall/nat</para>
<para>/etc/shorewall6/nat</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -223,6 +219,14 @@ all all REJECT info
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -200,16 +200,6 @@
<para>/etc/shorewall/policy</para> <para>/etc/shorewall/policy</para>
<para>/etc/shorewall/rules</para> <para>/etc/shorewall/rules</para>
<para>/etc/shorewall6/zones</para>
<para>/etc/shorewall6/interfaces</para>
<para>/etc/shorewall6/hosts</para>
<para>/etc/shorewall6/policy</para>
<para>/etc/shorewall6/rules</para>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/netmap</command> <command>/etc/shorewall/netmap</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -44,6 +44,8 @@
role="bold">SNAT}</emphasis></term> role="bold">SNAT}</emphasis></term>
<listitem> <listitem>
<para>Must be DNAT or SNAT</para>
<para>If DNAT, traffic entering INTERFACE and addressed to NET1 has <para>If DNAT, traffic entering INTERFACE and addressed to NET1 has
its destination address rewritten to the corresponding address in its destination address rewritten to the corresponding address in
NET2.</para> NET2.</para>
@@ -167,8 +169,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/netmap</para> <para>/etc/shorewall/netmap</para>
<para>/etc/shorewall6/netmap</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -180,6 +180,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/params</command> <command>/etc/shorewall/params</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -107,7 +107,7 @@
<programlisting>NET_IF=eth0 <programlisting>NET_IF=eth0
NET_BCAST=130.252.100.255 NET_BCAST=130.252.100.255
NET_OPTIONS=routefilter</programlisting> NET_OPTIONS=routefilter,norfc1918</programlisting>
<para>Example <ulink <para>Example <ulink
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5) url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5)
@@ -119,15 +119,13 @@ net $NET_IF $NET_BCAST $NET_OPTIONS</programlisting>
<para>This is the same as if the interfaces file had contained:</para> <para>This is the same as if the interfaces file had contained:</para>
<programlisting>ZONE INTERFACE BROADCAST OPTIONS <programlisting>ZONE INTERFACE BROADCAST OPTIONS
net eth0 130.252.100.255 routefilter</programlisting> net eth0 130.252.100.255 routefilter,norfc1918</programlisting>
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/params</para> <para>/etc/shorewall/params</para>
<para>/etc/shorewall6/params</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -136,6 +134,14 @@ net eth0 130.252.100.255 routefilter</programlisting>
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Variables">http://www.shorewall.net/configuration_file_basics.htm#Variables</ulink></para> url="/configuration_file_basics.htm#Variables">http://www.shorewall.net/configuration_file_basics.htm#Variables</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/policy</command> <command>/etc/shorewall/policy</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -33,30 +33,25 @@
<para>The order of entries in this file is important</para> <para>The order of entries in this file is important</para>
<para>This file determines what to do with a new connection request if <para>This file determines what to do with a new connection request if
we don't get a match from the <ulink we don't get a match from the /etc/shorewall/rules file . For each
url="/manpages/shorewall-blrules.html">shorewall-blrules</ulink>(5) or source/destination pair, the file is processed in order until a match is
<ulink url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(5) found ("all" will match any source or destination).</para>
files. For each source/destination pair, the file is processed in order
until a match is found ("all" will match any source or
destination).</para>
</important> </important>
<important> <important>
<para>Intra-zone policies are pre-defined</para> <para>Intra-zone policies are pre-defined</para>
<para>For $FW and for all of the zones defined in <ulink <para>For $FW and for all of the zones defined in /etc/shorewall/zones,
url="/manpages/shorewall-zones.html">shorewall-zones</ulink>(5), the the POLICY for connections from the zone to itself is ACCEPT (with no
POLICY for connections from the zone to itself is ACCEPT (with no
logging or TCP connection rate limiting) but may be overridden by an logging or TCP connection rate limiting) but may be overridden by an
entry in this file. The overriding entry must be explicit (specifying entry in this file. The overriding entry must be explicit (specifying
the zone name in both SOURCE and DEST) or it must use "all+" (Shorewall the zone name in both SOURCE and DEST) or it must use "all+" (Shorewall
4.5.17 or later).</para> 4.5.17 or later).</para>
<para>Similarly, if you have IMPLICIT_CONTINUE=Yes in <ulink <para>Similarly, if you have IMPLICIT_CONTINUE=Yes in shorewall.conf,
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5), then the then the implicit policy to/from any sub-zone is CONTINUE. These
implicit policy to/from any sub-zone is CONTINUE. These implicit implicit CONTINUE policies may also be overridden by an explicit entry
CONTINUE policies may also be overridden by an explicit entry in this in this file.</para>
file.</para>
</important> </important>
<para>The columns in the file are as follows (where the column name is <para>The columns in the file are as follows (where the column name is
@@ -401,8 +396,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/policy</para> <para>/etc/shorewall/policy</para>
<para>/etc/shorewall6/policy</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -411,6 +404,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -82,11 +82,14 @@
url="/manpages/shorewall-mangle.html">shorewall-mangle(5)</ulink> url="/manpages/shorewall-mangle.html">shorewall-mangle(5)</ulink>
file to direct packets to this provider.</para> file to direct packets to this provider.</para>
<para>If PROVIDER_OFFSET is non-zero in <ulink <para>If HIGH_ROUTE_MARKS=Yes in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>, then url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>, then
the value must be a mutiple of 2^^PROVIDER_OFFSET. In all cases, the the value must be a multiple of 256 between 256 and 65280 or their
number of significant bits may not exceed PROVIDER_OFFSET + hexadecimal equivalents (0x0100 and 0xff00 with the low-order byte
PROVIDER_BITS.</para> of the value being zero). Otherwise, the value must be between 1 and
255. Each provider must be assigned a unique mark value. This column
may be omitted if you don't use packet marking to direct connections
to a particular provider.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -113,9 +116,9 @@
listed in <ulink listed in <ulink
url="/manpages/shorewall-interfaces.html">shorewall-interfaces(5)</ulink>. url="/manpages/shorewall-interfaces.html">shorewall-interfaces(5)</ulink>.
In general, that interface should not have the In general, that interface should not have the
<option>proxyarp</option> or <option>proxyndp</option> option <option>proxyarp</option> option specified unless
specified unless <option>loose</option> is given in the OPTIONS <option>loose</option> is given in the OPTIONS column of this
column of this entry.</para> entry.</para>
<para>Where more than one provider is serviced through a single <para>Where more than one provider is serviced through a single
interface, the <emphasis>interface</emphasis> must be followed by a interface, the <emphasis>interface</emphasis> must be followed by a
@@ -214,14 +217,7 @@
BALANCE_PROVIDERS=Yes, <option>balance=1</option> is assumed BALANCE_PROVIDERS=Yes, <option>balance=1</option> is assumed
unless the <option>fallback</option>, <option>loose</option>, unless the <option>fallback</option>, <option>loose</option>,
<option>load</option> or <option>tproxy</option> option is <option>load</option> or <option>tproxy</option> option is
specified.I</para> specified.</para>
<caution>
<para>In IPV6, the <option>balance</option> option does not
cause balanced default routes to be created; it rather
causes a sequence of default routes with different metrics
to be created. </para>
</caution>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -344,14 +340,6 @@
<para>Prior to Shorewall 4.4.24, the option is ignored with a <para>Prior to Shorewall 4.4.24, the option is ignored with a
warning message if USE_DEFAULT_RT=Yes in warning message if USE_DEFAULT_RT=Yes in
<filename>shorewall.conf</filename>.</para> <filename>shorewall.conf</filename>.</para>
<caution>
<para>In IPV6, specifying the <option>fallback</option>
option on multiple providers does not cause balanced
fallback routes to be created; it rather causes a sequence
of fallback routes with different metrics to be
created.</para>
</caution>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -473,7 +461,7 @@
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1:</term> <term>Example 1:</term>
<listitem> <listitem>
<para>You run squid in your DMZ on IP address 192.168.2.99. Your DMZ <para>You run squid in your DMZ on IP address 192.168.2.99. Your DMZ
@@ -485,7 +473,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2:</term> <term>Example 2:</term>
<listitem> <listitem>
<para>eth0 connects to ISP 1. The IP address of eth0 is <para>eth0 connects to ISP 1. The IP address of eth0 is
@@ -503,36 +491,6 @@
ISP2 2 2 main eth1 130.252.99.254 track,balance eth2</programlisting> ISP2 2 2 main eth1 130.252.99.254 track,balance eth2</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>IPv6 Example 1:</term>
<listitem>
<para>You run squid in your DMZ on IP address 2002:ce7c:92b4:1::2.
Your DMZ interface is eth2</para>
<programlisting> #NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS
Squid 1 1 - eth2 2002:ce7c:92b4:1::2 -</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 2:</term>
<listitem>
<para>eth0 connects to ISP 1. The ISP's gateway router has IP
address 2001:ce7c:92b4:1::2.</para>
<para>eth1 connects to ISP 2. The ISP's gateway router has IP
address 2001:d64c:83c9:12::8b.</para>
<para>eth2 connects to a local network.</para>
<programlisting> #NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY
ISP1 1 1 main eth0 2001:ce7c:92b4:1::2 track eth2
ISP2 2 2 main eth1 2001:d64c:83c9:12::8b track eth2</programlisting>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
@@ -540,8 +498,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/providers</para> <para>/etc/shorewall/providers</para>
<para>/etc/shorewall6/providers</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -553,6 +509,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -25,8 +25,6 @@
<refsect1> <refsect1>
<title>Description</title> <title>Description</title>
<para>IPv4 only.</para>
<para>This file is used to define Proxy ARP. There is one entry in this <para>This file is used to define Proxy ARP. There is one entry in this
file for each IP address to be proxied.</para> file for each IP address to be proxied.</para>
@@ -141,6 +139,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/routes</command> <command>/etc/shorewall/routes</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -109,8 +109,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/routes</para> <para>/etc/shorewall/routes</para>
<para>/etc/shorewall6/routes</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -119,6 +117,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/rtrules</command> <command>/etc/shorewall/rtrules</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -177,7 +177,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2:</term> <term>Example 2:</term>
<listitem> <listitem>
<para>You use OpenVPN (routed setup /tunX) in combination with <para>You use OpenVPN (routed setup /tunX) in combination with
@@ -199,8 +199,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/rtrules</para> <para>/etc/shorewall/rtrules</para>
<para>/etc/shorewall6/rtrules</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -212,6 +210,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/rules</command> <command>/etc/shorewall/rules</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -54,8 +54,7 @@
<listitem> <listitem>
<para>This section was added in Shorewall 4.4.23. Rules in this <para>This section was added in Shorewall 4.4.23. Rules in this
section are applied, regardless of the connection tracking state of section are applied, regardless of the connection tracking state of
the packet and are applied before rules in the other the packet.</para>
sections.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -67,7 +66,7 @@
this section.</para> this section.</para>
<para>The only ACTIONs allowed in this section are ACCEPT, DROP, <para>The only ACTIONs allowed in this section are ACCEPT, DROP,
REJECT, LOG, NFQUEUE and QUEUE</para> REJECT, LOG and QUEUE</para>
<para>There is an implicit ACCEPT rule inserted at the end of this <para>There is an implicit ACCEPT rule inserted at the end of this
section.</para> section.</para>
@@ -82,7 +81,7 @@
section.</para> section.</para>
<para>The only ACTIONs allowed in this section are ACCEPT, DROP, <para>The only ACTIONs allowed in this section are ACCEPT, DROP,
REJECT, LOG, NFQUEUE and QUEUE</para> REJECT, LOG and QUEUE</para>
<para>There is an implicit rule added at the end of this section <para>There is an implicit rule added at the end of this section
that invokes the RELATED_DISPOSITION (<ulink that invokes the RELATED_DISPOSITION (<ulink
@@ -98,7 +97,7 @@
processed by rules in this section.</para> processed by rules in this section.</para>
<para>The only Actions allowed in this section are ACCEPT, DROP, <para>The only Actions allowed in this section are ACCEPT, DROP,
REJECT, LOG, NFQUEUE and QUEUE.</para> REJECT, LOG and QUEUE.</para>
<para>There is an implicit rule added at the end of this section <para>There is an implicit rule added at the end of this section
that invokes the INVALID_DISPOSITION (<ulink that invokes the INVALID_DISPOSITION (<ulink
@@ -114,7 +113,7 @@
processed by rules in this section.</para> processed by rules in this section.</para>
<para>The only Actions allowed in this section are ACCEPT, DROP, <para>The only Actions allowed in this section are ACCEPT, DROP,
REJECT, LOG, NFQUEUE and QUEUE.</para> REJECT, LOG and QUEUE.</para>
<para>There is an implicit rule added at the end of this section <para>There is an implicit rule added at the end of this section
that invokes the UNTRACKED_DISPOSITION (<ulink that invokes the UNTRACKED_DISPOSITION (<ulink
@@ -137,8 +136,11 @@
<note> <note>
<para>If you are not familiar with Netfilter to the point where you are <para>If you are not familiar with Netfilter to the point where you are
comfortable with the differences between the various connection tracking comfortable with the differences between the various connection tracking
states, then it is suggested that you place all of your rules in the NEW states, then it is suggested that you omit the <emphasis
section (That's after the line that reads ?SECTION NEW').</para> role="bold">ESTABLISHED</emphasis> and <emphasis
role="bold">RELATED</emphasis> sections and place all of your
non-blacklisting rules in the NEW section (That's after the line that
reads ?SECTION NEW').</para>
</note> </note>
<warning> <warning>
@@ -147,8 +149,8 @@
<emphasis role="bold">ALL, ESTABLISHED</emphasis> and <emphasis <emphasis role="bold">ALL, ESTABLISHED</emphasis> and <emphasis
role="bold">RELATED</emphasis> sections must be empty.</para> role="bold">RELATED</emphasis> sections must be empty.</para>
<para>An exception is made if you are running Shorewall 4.4.27 or later <para>An except is made if you are running Shorewall 4.4.27 or later and
and you have specified a non-default value for RELATED_DISPOSITION or you have specified a non-default value for RELATED_DISPOSITION or
RELATED_LOG_LEVEL. In that case, you may have rules in the RELATED RELATED_LOG_LEVEL. In that case, you may have rules in the RELATED
section of this file.</para> section of this file.</para>
</warning> </warning>
@@ -212,8 +214,7 @@
role="bold">DNAT</emphasis>[<emphasis role="bold">DNAT</emphasis>[<emphasis
role="bold">-</emphasis>] or <emphasis role="bold">-</emphasis>] or <emphasis
role="bold">REDIRECT</emphasis>[<emphasis role="bold">REDIRECT</emphasis>[<emphasis
role="bold">-</emphasis>] rules. Use with IPv6 requires role="bold">-</emphasis>] rules.</para>
Shorewall 4.5.14 or later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -234,7 +235,7 @@
<para>The name of an <emphasis>action</emphasis> declared in <para>The name of an <emphasis>action</emphasis> declared in
<ulink <ulink
url="/manpages/shorewall-actions.html">shorewall-actions</ulink>(5) url="/manpages/shorewall-actions.html">shorewall-actions</ulink>(5)
or in /usr/share/shorewall[6]/actions.std.</para> or in /usr/share/shorewall/actions.std.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -288,8 +289,7 @@
<listitem> <listitem>
<para>Added in Shorewall 4.4.20. Audited versions of ACCEPT, <para>Added in Shorewall 4.4.20. Audited versions of ACCEPT,
ACCEPT+ and ACCEPT! respectively. Require AUDIT_TARGET support ACCEPT+ and ACCEPT! respectively. Require AUDIT_TARGET support
in the kernel and iptables. A_ACCEPT+ with IPv6 requires in the kernel and iptables.</para>
Shorewall 4.5.14 or later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -404,8 +404,7 @@
<listitem> <listitem>
<para>Forward the request to another system (and optionally <para>Forward the request to another system (and optionally
another port). Use with IPv6 requires Shorewall 4.5.14 or another port).</para>
later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -418,8 +417,7 @@
<para>Like <emphasis role="bold">DNAT</emphasis> but only <para>Like <emphasis role="bold">DNAT</emphasis> but only
generates the <emphasis role="bold">DNAT</emphasis> iptables generates the <emphasis role="bold">DNAT</emphasis> iptables
rule and not the companion <emphasis rule and not the companion <emphasis
role="bold">ACCEPT</emphasis> rule. Use with IPv6 requires role="bold">ACCEPT</emphasis> rule.</para>
Shorewall 4.5.14 or later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -501,11 +499,11 @@
[<replaceable>option</replaceable> ...])</term> [<replaceable>option</replaceable> ...])</term>
<listitem> <listitem>
<para>IPv4 only. This action allows you to specify an iptables <para>This action allows you to specify an iptables target
target with options (e.g., 'IPTABLES(MARK --set-xmark with options (e.g., 'IPTABLES(MARK --set-xmark 0x01/0xff)'. If
0x01/0xff)'. If the <replaceable>iptables-target</replaceable> the <replaceable>iptables-target</replaceable> is not one
is not one recognized by Shorewall, the following error recognized by Shorewall, the following error message will be
message will be issued:</para> issued:</para>
<programlisting> ERROR: Unknown target (<replaceable>iptables-target</replaceable>)</programlisting> <programlisting> ERROR: Unknown target (<replaceable>iptables-target</replaceable>)</programlisting>
@@ -526,39 +524,6 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis
role="bold">IP6TABLES</emphasis>({<replaceable>ip6tables-target</replaceable>
[<replaceable>option</replaceable> ...])</term>
<listitem>
<para>IPv6 only. This action allows you to specify an
ip6tables target with options (e.g., 'IPTABLES(MARK
--set-xmark 0x01/0xff)'. If the
<replaceable>ip6tables-target</replaceable> is not one
recognized by Shorewall, the following error message will be
issued:</para>
<programlisting> ERROR: Unknown target (<replaceable>ip6tables-target</replaceable>)</programlisting>
<para>This error message may be eliminated by adding
the<replaceable>
ip6tables-</replaceable><replaceable>target</replaceable> as a
builtin action in <ulink
url="/manpages6/shorewall6-actions.html">shorewall-actions</ulink>(5).</para>
<important>
<para>If you specify REJECT as the
<replaceable>ip6tables-target</replaceable>, the target of
the rule will be the i6ptables REJECT target and not
Shorewall's builtin 'reject' chain which is used when REJECT
(see below) is specified as the
<replaceable>target</replaceable> in the ACTION
column.</para>
</important>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">LOG:<replaceable>level</replaceable></emphasis></term> role="bold">LOG:<replaceable>level</replaceable></emphasis></term>
@@ -630,7 +595,7 @@
<para>Added in Shorewall 4.5.9.3. Queues matching packets to a <para>Added in Shorewall 4.5.9.3. Queues matching packets to a
back end logging daemon via a netlink socket then continues to back end logging daemon via a netlink socket then continues to
the next rule. See <ulink the next rule. See <ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para> url="/shorewall.logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
<para>The <replaceable>nflog-parameters</replaceable> are a <para>The <replaceable>nflog-parameters</replaceable> are a
comma-separated list of up to 3 numbers:</para> comma-separated list of up to 3 numbers:</para>
@@ -711,8 +676,7 @@
<para>Excludes the connection from any subsequent <emphasis <para>Excludes the connection from any subsequent <emphasis
role="bold">DNAT</emphasis>[-] or <emphasis role="bold">DNAT</emphasis>[-] or <emphasis
role="bold">REDIRECT</emphasis>[-] rules but doesn't generate role="bold">REDIRECT</emphasis>[-] rules but doesn't generate
a rule to accept the traffic. Use with IPv6 requires Shorewall a rule to accept the traffic.</para>
4.5.14 or later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -747,7 +711,7 @@
<para>Beginning with Shorewall 5.0.8, the type of reject may <para>Beginning with Shorewall 5.0.8, the type of reject may
be specified in the <replaceable>option</replaceable> be specified in the <replaceable>option</replaceable>
paramater. Valid IPv4 <replaceable>option</replaceable> values paramater. Valid <replaceable>option</replaceable> values
are:</para> are:</para>
<simplelist> <simplelist>
@@ -766,31 +730,7 @@
<member><option>icmp-admin-prohibited</option></member> <member><option>icmp-admin-prohibited</option></member>
<member><option>icmp-tcp-reset</option> (the PROTO column <member><option>icmp-tcp-reset</option> (the PROTO column
must specify TCP). Beginning with Shorewall 5.1.3, this must specify TCP)</member>
option may also be specified as
<option>tcp-reset</option>.</member>
</simplelist>
<para>Valid IPv6 <replaceable>option</replaceable> values
are:</para>
<simplelist>
<member><option>icmp6-no-route</option></member>
<member><option>no-route</option></member>
<member><option>i</option><option>cmp6-adm-prohibited</option></member>
<member><option>adm-prohibited</option></member>
<member><option>icmp6-addr-unreachable</option></member>
<member><option>addr-unreach</option></member>
<member><option>icmp6-port-unreachable</option></member>
<member><option>tcp-reset</option> (the PROTO column must
specify TCP)</member>
</simplelist> </simplelist>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -810,8 +750,7 @@
<listitem> <listitem>
<para>Redirect the request to a server running on the <para>Redirect the request to a server running on the
firewall. Use with IPv6 requires Shorewall 4.5.14 or firewall.</para>
later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -824,8 +763,7 @@
<para>Like <emphasis role="bold">REDIRECT</emphasis> but only <para>Like <emphasis role="bold">REDIRECT</emphasis> but only
generates the <emphasis role="bold">REDIRECT</emphasis> generates the <emphasis role="bold">REDIRECT</emphasis>
iptables rule and not the companion <emphasis iptables rule and not the companion <emphasis
role="bold">ACCEPT</emphasis> rule. Use with IPv6 requires role="bold">ACCEPT</emphasis> rule.</para>
Shorewall 4.5.14 or later.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -905,10 +843,10 @@
role="bold">ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)]</term> role="bold">ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)]</term>
<listitem> <listitem>
<para>IPv4 only. Added in Shorewall 4.5.10. Queues matching <para>Added in Shorewall 4.5.10. Queues matching packets to a
packets to a back end logging daemon via a netlink socket then back end logging daemon via a netlink socket then continues to
continues to the next rule. See <ulink the next rule. See <ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para> url="/shorewall.logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
<para>Similar to<emphasis role="bold"> <para>Similar to<emphasis role="bold">
LOG:ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)], LOG:ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)],
@@ -952,10 +890,10 @@
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<para>You may also specify <emphasis role="bold">ULOG</emphasis> <para>You may also specify <emphasis role="bold">ULOG</emphasis> or
(IPv4 only) or <emphasis role="bold">NFLOG</emphasis> (must be in <emphasis role="bold">NFLOG</emphasis> (must be in upper case) as a
upper case) as a log level.This will log to the ULOG or NFLOG target log level.This will log to the ULOG or NFLOG target for routing to a
for routing to a separate log through use of ulogd (<ulink separate log through use of ulogd (<ulink
url="http://www.netfilter.org/projects/ulogd/index.html">http://www.netfilter.org/projects/ulogd/index.html</ulink>).</para> url="http://www.netfilter.org/projects/ulogd/index.html">http://www.netfilter.org/projects/ulogd/index.html</ulink>).</para>
<para>Actions specifying logging may be followed by a log tag (a <para>Actions specifying logging may be followed by a log tag (a
@@ -985,9 +923,9 @@
<listitem> <listitem>
<para>The name of a zone defined in <ulink <para>The name of a zone defined in <ulink
url="/manpages/shorewall-zones.html">shorewall-zones</ulink>(5). url="shorewall-zones.html">shorewall-zones</ulink>(5). When
When only the zone name is specified, the packet source may be only the zone name is specified, the packet source may be any
any host in that zone.</para> host in that zone.</para>
<para>zone may also be one of the following:</para> <para>zone may also be one of the following:</para>
@@ -1052,12 +990,11 @@
<replaceable>interface</replaceable> must be the name of an <replaceable>interface</replaceable> must be the name of an
interface associated with the named interface associated with the named
<replaceable>zone</replaceable> in either <ulink <replaceable>zone</replaceable> in either <ulink
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5) url="shorewall-interfaces.html">shorewall-interfaces</ulink>(5)
or <ulink or <ulink
url="/manpages/shorewall.hosts.html">shorewall-hosts</ulink>(5). url="shorewall.hosts.html">shorewall-hosts</ulink>(5). Only
Only packets from hosts in the <replaceable>zone</replaceable> packets from hosts in the <replaceable>zone</replaceable> that
that arrive through the named interface will match the arrive through the named interface will match the rule.</para>
rule.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1071,7 +1008,7 @@
<listitem> <listitem>
<para>A host or network IP address. A network address may <para>A host or network IP address. A network address may
be followed by exclusion (see <ulink be followed by exclusion (see <ulink
url="/manpages/shorewall-exclusion.html">shorewall-exclusion</ulink>(5)).</para> url="shorewall-exclusion.html">shorewall-exclusion</ulink>(5)).</para>
</listitem> </listitem>
<listitem> <listitem>
@@ -1131,7 +1068,7 @@
<listitem> <listitem>
<para>This form matches if the host IP address does not match <para>This form matches if the host IP address does not match
any of the entries in the exclusion (see <ulink any of the entries in the exclusion (see <ulink
url="/manpages/shorewall-exclusion.html">shorewall-exclusion</ulink>(5)).</para> url="shorewall-exclusion.html">shorewall-exclusion</ulink>(5)).</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1272,49 +1209,6 @@
of the net zone.</para> of the net zone.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>dmz:[2002:ce7c:2b4:1::2]</term>
<listitem>
<para>Host 2002:ce7c:92b4:1::2 in the DMZ</para>
</listitem>
</varlistentry>
<varlistentry>
<term>net:2001:4d48:ad51:24::/64</term>
<listitem>
<para>Subnet 2001:4d48:ad51:24::/64 on the Internet</para>
</listitem>
</varlistentry>
<varlistentry>
<term>loc:[2002:cec792b4:1::2],[2002:cec792b4:1::44]</term>
<listitem>
<para>Hosts 2002:cec792b4:1::2 and 2002:cec792b4:1::44 in the
local zone.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>loc:~00-A0-C9-15-39-78</term>
<listitem>
<para>Host in the local zone with MAC address
00:A0:C9:15:39:78.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>net:[2001:4d48:ad51:24::]/64![2001:4d48:ad51:24:6::]/80</term>
<listitem>
<para>Subnet 2001:4d48:ad51:24::/64 on the Internet except for
2001:4d48:ad51:24:6::/80.</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1336,9 +1230,9 @@
<listitem> <listitem>
<para>The name of a zone defined in <ulink <para>The name of a zone defined in <ulink
url="/manpages/shorewall-zones.html">shorewall-zones</ulink>(5). url="shorewall-zones.html">shorewall-zones</ulink>(5). When
When only the zone name is specified, the packet destination only the zone name is specified, the packet destination may be
may be any host in that zone.</para> any host in that zone.</para>
<para>zone may also be one of the following:</para> <para>zone may also be one of the following:</para>
@@ -1403,11 +1297,11 @@
<replaceable>interface</replaceable> must be the name of an <replaceable>interface</replaceable> must be the name of an
interface associated with the named interface associated with the named
<replaceable>zone</replaceable> in either <ulink <replaceable>zone</replaceable> in either <ulink
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5) url="shorewall-interfaces.html">shorewall-interfaces</ulink>(5)
or <ulink or <ulink
url="/manpages/shorewall-hosts.html">shorewall-hosts</ulink>(5). url="shorewall.hosts.html">shorewall-hosts</ulink>(5). Only
Only packets to hosts in the <replaceable>zone</replaceable> packets to hosts in the <replaceable>zone</replaceable> that
that are sent through the named interface will match the are sent through the named interface will match the
rule.</para> rule.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1422,7 +1316,7 @@
<listitem> <listitem>
<para>A host or network IP address. A network address may <para>A host or network IP address. A network address may
be followed by exclusion (see <ulink be followed by exclusion (see <ulink
url="/manpages/shorewall-exclusion.html">shorewall-exclusion</ulink>(5)).</para> url="shorewall-exclusion.html">shorewall-exclusion</ulink>(5)).</para>
</listitem> </listitem>
<listitem> <listitem>
@@ -1477,7 +1371,7 @@
<listitem> <listitem>
<para>This form matches if the host IP address does not match <para>This form matches if the host IP address does not match
any of the entries in the exclusion (see <ulink any of the entries in the exclusion (see <ulink
url="/manpages/shorewall-exclusion.html">shorewall-exclusion</ulink>(5)).</para> url="shorewall-exclusion.html">shorewall-exclusion</ulink>(5)).</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1699,7 +1593,7 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">PROTO</emphasis>- {<emphasis <term><emphasis role="bold">PROTO</emphasis>- {<emphasis
role="bold">-</emphasis>|<emphasis role="bold">-</emphasis>|<emphasis
role="bold">tcp:[!]syn</emphasis>|<emphasis role="bold">tcp:syn</emphasis>|<emphasis
role="bold">ipp2p</emphasis>|<emphasis role="bold">ipp2p</emphasis>|<emphasis
role="bold">ipp2p:udp</emphasis>|<emphasis role="bold">ipp2p:udp</emphasis>|<emphasis
role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis
@@ -1710,10 +1604,7 @@
requires ipp2p match support in your kernel and iptables. <emphasis requires ipp2p match support in your kernel and iptables. <emphasis
role="bold">tcp:syn</emphasis> implies <emphasis role="bold">tcp:syn</emphasis> implies <emphasis
role="bold">tcp</emphasis> plus the SYN flag must be set and the role="bold">tcp</emphasis> plus the SYN flag must be set and the
RST, ACK and FIN flags must be reset. Beginning with Shorewall RST,ACK and FIN flags must be reset.</para>
5.1.3, you may also specify <emphasis
role="bold">tcp:!syn</emphasis>, which matches if SYN is not set or
if RST, ACK or FIN is set.</para>
<para>Beginning with Shorewall 4.4.19, this column can contain a <para>Beginning with Shorewall 4.4.19, this column can contain a
comma-separated list of protocol-numbers and/or protocol comma-separated list of protocol-numbers and/or protocol
@@ -2189,100 +2080,12 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">HEADERS - <term><emphasis role="bold">HEADERS</emphasis></term>
[!][any:|exactly:]</emphasis><replaceable>header-list
</replaceable>(Optional - Added in Shorewall 4.4.15)</term>
<listitem> <listitem>
<para>This column is only used in IPv6. In IPv4, supply "-" in this <para>Added in Shorewall 4.4.15. Not used in IPv4 configurations. If
column if you with to place a value in one of the following you with to supply a value for one of the later columns, enter '-'
columns.</para> in this column.</para>
<para>The <replaceable>header-list</replaceable> consists of a
comma-separated list of headers from the following list.</para>
<variablelist>
<varlistentry>
<term><emphasis role="bold">auth</emphasis>, <emphasis
role="bold">ah</emphasis>, or <emphasis
role="bold">51</emphasis></term>
<listitem>
<para><firstterm>Authentication Headers</firstterm> extension
header.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">esp</emphasis>, or <emphasis
role="bold">50</emphasis></term>
<listitem>
<para><firstterm>Encrypted Security Payload</firstterm>
extension header.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">hop</emphasis>, <emphasis
role="bold">hop-by-hop</emphasis> or <emphasis
role="bold">0</emphasis></term>
<listitem>
<para>Hop-by-hop options extension header.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">route</emphasis>, <emphasis
role="bold">ipv6-route</emphasis> or <emphasis
role="bold">43</emphasis></term>
<listitem>
<para>IPv6 Route extension header.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">frag</emphasis>, <emphasis
role="bold">ipv6-frag</emphasis> or <emphasis
role="bold">44</emphasis></term>
<listitem>
<para>IPv6 fragmentation extension header.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">none</emphasis>, <emphasis
role="bold">ipv6-nonxt</emphasis> or <emphasis
role="bold">59</emphasis></term>
<listitem>
<para>No next header</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">proto</emphasis>, <emphasis
role="bold">protocol</emphasis> or <emphasis
role="bold">255</emphasis></term>
<listitem>
<para>Any protocol header.</para>
</listitem>
</varlistentry>
</variablelist>
<para>If <emphasis role="bold">any:</emphasis> is specified, the
rule will match if any of the listed headers are present. If
<emphasis role="bold">exactly:</emphasis> is specified, the will
match packets that exactly include all specified headers. If neither
is given, <emphasis role="bold">any:</emphasis> is assumed.</para>
<para>If <emphasis role="bold">!</emphasis> is entered, the rule
will match those packets which would not be matched when <emphasis
role="bold">!</emphasis> is omitted.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -2608,20 +2411,6 @@
SECCTX builtin</programlisting> SECCTX builtin</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>Example 15:</term>
<listitem>
<para>You want to accept SSH connections to your firewall only from
internet IP addresses 2002:ce7c::92b4:1::2 and
2002:ce7c::92b4:1::22</para>
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
ACCEPT net:&lt;2002:ce7c::92b4:1::2,2002:ce7c::92b4:1::22&gt; \
$FW tcp 22</programlisting>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
@@ -2629,8 +2418,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/rules</para> <para>/etc/shorewall/rules</para>
<para>/etc/shorewall6/rules</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -2645,6 +2432,14 @@
<para><ulink <para><ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink></para> url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-blrules(5), shorewall-hosts(5),
shorewall_interfaces(5), shorewall-ipsets(5), shorewall-maclist(5),
shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5),
shorewall-params(5), shorewall-policy(5), shorewall-providers(5),
shorewall-proxyarp(5), shorewall-rtrules(5), shorewall-routestopped(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/secmarks</command> <command>/etc/shorewall/secmarks</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -229,9 +229,8 @@
role="bold">all}[,...]</emphasis></term> role="bold">all}[,...]</emphasis></term>
<listitem> <listitem>
<para>See <ulink <para>Protocol - <emphasis role="bold">ipp2p</emphasis> requires
url="shorewall-rules.html">shorewall-rules(5)</ulink> for ipp2p match support in your kernel and iptables.</para>
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>
@@ -404,8 +403,6 @@ RESTORE I:ER</programlisting>
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/secmarks</para> <para>/etc/shorewall/secmarks</para>
<para>/etc/shorewall6/secmarks</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -417,6 +414,14 @@ RESTORE I:ER</programlisting>
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/snat</command> <command>/etc/shorewall/snat</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -27,7 +27,7 @@
<para>This file is used to define dynamic NAT (Masquerading) and to define <para>This file is used to define dynamic NAT (Masquerading) and to define
Source NAT (SNAT). It superseded <ulink Source NAT (SNAT). It superseded <ulink
url="/manpages/shorewall-masq.html">shorewall-masq</ulink>(5) in Shorewall url="shorewall-masq.html">shorewall-masq</ulink>(5) in Shorewall
5.0.14.</para> 5.0.14.</para>
<warning> <warning>
@@ -86,7 +86,7 @@
ADD_SNAT_ALIASES is set to Yes or yes in <ulink ADD_SNAT_ALIASES is set to Yes or yes in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5) url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
then Shorewall will automatically add this address to the then Shorewall will automatically add this address to the
INTERFACE named in the first column (IPv4 only).</para> INTERFACE named in the first column.</para>
<para>You may also specify a range of up to 256 IP addresses <para>You may also specify a range of up to 256 IP addresses
if you want the SNAT address to be assigned from that range in if you want the SNAT address to be assigned from that range in
@@ -105,7 +105,9 @@
role="bold">:random</emphasis>) with <emphasis role="bold">:random</emphasis>) with <emphasis
role="bold">:persistent</emphasis>. This is only useful when role="bold">:persistent</emphasis>. This is only useful when
an address range is specified and causes a client to be given an address range is specified and causes a client to be given
the same source/destination IP pair.</para> the same source/destination IP pair. This feature replaces the
SAME modifier which was removed from Shorewall in version
4.4.0.</para>
<para>You may also use the special value <para>You may also use the special value
<option>detect</option> which causes Shorewall to determine <option>detect</option> which causes Shorewall to determine
@@ -148,8 +150,8 @@
<listitem> <listitem>
<para>where <replaceable>action</replaceable> is an action <para>where <replaceable>action</replaceable> is an action
declared in <ulink declared in <ulink
url="/manpages/shorewall-actions.html">shorewall-actions(5)</ulink> url="shorewall-actions.html">shorewall-actions(5)</ulink> with
with the <option>nat</option> option. See <ulink the <option>nat</option> option. See <ulink
url="/Actions.html">www.shorewall.net/Actions.html</ulink> for url="/Actions.html">www.shorewall.net/Actions.html</ulink> for
further information.</para> further information.</para>
</listitem> </listitem>
@@ -254,10 +256,8 @@
<listitem> <listitem>
<para>If you wish to restrict this entry to a particular protocol <para>If you wish to restrict this entry to a particular protocol
then enter the protocol name (from protocols(5)) or number here. See then enter the protocol name (from protocols(5)) or number
<ulink here.</para>
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink> for
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>
@@ -598,7 +598,7 @@
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1:</term> <term>Example 1:</term>
<listitem> <listitem>
<para>You have a simple masquerading setup where eth0 connects to a <para>You have a simple masquerading setup where eth0 connects to a
@@ -613,7 +613,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2:</term> <term>Example 2:</term>
<listitem> <listitem>
<para>You add a router to your local network to connect subnet <para>You add a router to your local network to connect subnet
@@ -627,7 +627,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 3:</term> <term>Example 3:</term>
<listitem> <listitem>
<para>You want all outgoing traffic from 192.168.1.0/24 through eth0 <para>You want all outgoing traffic from 192.168.1.0/24 through eth0
@@ -641,7 +641,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 4:</term> <term>Example 4:</term>
<listitem> <listitem>
<para>You want all outgoing SMTP traffic entering the firewall from <para>You want all outgoing SMTP traffic entering the firewall from
@@ -665,7 +665,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 5:</term> <term>Example 5:</term>
<listitem> <listitem>
<para>Connections leaving on eth0 and destined to any host defined <para>Connections leaving on eth0 and destined to any host defined
@@ -678,7 +678,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 6:</term> <term>Example 6:</term>
<listitem> <listitem>
<para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in <para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in
@@ -700,34 +700,19 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv6 Example 1:</term> <term>Example 7:</term>
<listitem> <listitem>
<para>You have a simple 'masquerading' setup where eth0 connects to <para>Your eth1 has two public IP addresses: 70.90.191.121 and
a DSL or cable modem and eth1 connects to your local network with 70.90.191.123. You want to use the iptables statistics match to
subnet 2001:470:b:787::0/64</para> masquerade outgoing connections evenly between these two
addresses.</para>
<para>Your entry in the file will be:</para>
<programlisting> #ACTION SOURCE DEST
MASQUERADE 2001:470:b:787::0/64 eth0</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 2:</term>
<listitem>
<para>Your sit1 interface has two public IP addresses:
2001:470:a:227::1 and 2001:470:b:227::1. You want to use the
iptables statistics match to masquerade outgoing connections evenly
between these two addresses.</para>
<programlisting>/etc/shorewall/snat: <programlisting>/etc/shorewall/snat:
#ACTION SOURCE DEST #ACTION SOURCE DEST
SNAT(2001:470:a:227::1) ::/0 sit1 { probability=0.50 } SNAT(70.90.191.121) - eth1 { probability=.50 }
SNAT(2001:470:a:227::2) ::/0 sit</programlisting> SNAT(70.90.191.123) - eth1</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
@@ -737,8 +722,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/snat</para> <para>/etc/shorewall/snat</para>
<para>/etc/shorewall6/snat</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -747,6 +730,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-exclusion(5), shorewall-hosts(5),
shorewall_interfaces(5), shorewall-ipsets(5), shorewall-maclist(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -19,7 +19,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/stoppedrules</command> <command>/etc/shorewall/stoppedrules</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -153,8 +153,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/stoppedrules</para> <para>/etc/shorewall/stoppedrules</para>
<para>/etc/shorewall6/stoppedrules</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -166,6 +164,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/tcclasses</command> <command>/etc/shorewall/tcclasses</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -763,8 +763,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/tcclasses</para> <para>/etc/shorewall/tcclasses</para>
<para>/etc/shorewall6/tcclasses</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -780,6 +778,14 @@
<para>tc-red(8)</para> <para>tc-red(8)</para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/tcdevices</command> <command>/etc/shorewall/tcdevices</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -276,8 +276,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/tcdevices</para> <para>/etc/shorewall/tcdevices</para>
<para>/etc/shorewall6/tcdevices</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -294,6 +292,14 @@
<para><ulink <para><ulink
url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink></para> url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/tcfilters</command> <command>/etc/shorewall/tcfilters</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -89,12 +89,12 @@
Beginning with Shorewall 4.6.0, an ipset name (prefixed with '+') Beginning with Shorewall 4.6.0, an ipset name (prefixed with '+')
may be used if your kernel and ip6tables have the <firstterm>Basic may be used if your kernel and ip6tables have the <firstterm>Basic
Ematch</firstterm> capability and you set BASIC_FILTERS=Yes in Ematch</firstterm> capability and you set BASIC_FILTERS=Yes in
<ulink url="/manpages/shorewall.conf.html">shorewall.conf <ulink url="shorewall.conf.html">shorewall.conf (5)</ulink>. The
(5)</ulink>. The ipset name may optionally be followed by a number ipset name may optionally be followed by a number or a comma
or a comma separated list of src and/or dst enclosed in square separated list of src and/or dst enclosed in square brackets
brackets ([...]). See <ulink ([...]). See <ulink
url="/manpages/shorewall-ipsets.html">shorewall-ipsets(5)</ulink> url="shorewall-ipsets.html">shorewall-ipsets(5)</ulink> for
for details.</para> details.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -108,12 +108,12 @@
Beginning with Shorewall 4.6.0, an ipset name (prefixed with '+') Beginning with Shorewall 4.6.0, an ipset name (prefixed with '+')
may be used if your kernel and ip6tables have the <firstterm>Basic may be used if your kernel and ip6tables have the <firstterm>Basic
Ematch</firstterm> capability and you set BASIC_FILTERS=Yes in Ematch</firstterm> capability and you set BASIC_FILTERS=Yes in
<ulink url="/manpages/shorewall.conf.html">shorewall.conf <ulink url="shorewall.conf.html">shorewall.conf (5)</ulink>. The
(5)</ulink>. The ipset name may optionally be followed by a number ipset name may optionally be followed by a number or a comma
or a comma separated list of src and/or dst enclosed in square separated list of src and/or dst enclosed in square brackets
brackets ([...]). See <ulink ([...]). See <ulink
url="/manpages/shorewall-ipsets.html">shorewall-ipsets(5)</ulink> url="shorewall-ipsets.html">shorewall-ipsets(5)</ulink> for
for details.</para> details.</para>
<para>You may exclude certain hosts from the set already defined <para>You may exclude certain hosts from the set already defined
through use of an <emphasis>exclusion</emphasis> (see <ulink through use of an <emphasis>exclusion</emphasis> (see <ulink
@@ -288,7 +288,7 @@
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1:</term> <term>Example 1:</term>
<listitem> <listitem>
<para>Place all 'ping' traffic on interface 1 in class 10. Note that <para>Place all 'ping' traffic on interface 1 in class 10. Note that
@@ -310,7 +310,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2:</term> <term>Example 2:</term>
<listitem> <listitem>
<para>Add two filters with priority 10 (Shorewall 4.5.8 or <para>Add two filters with priority 10 (Shorewall 4.5.8 or
@@ -324,22 +324,6 @@
1:10 0.0.0.0/0 0.0.0.0/0 icmp echo-reply 10</programlisting> 1:10 0.0.0.0/0 0.0.0.0/0 icmp echo-reply 10</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>IPv6 Example 1:</term>
<listitem>
<para>Add two filters with priority 10 (Shorewall 4.5.8 or
later).</para>
<programlisting> #CLASS SOURCE DEST PROTO DPORT PRIORITY
IPV6
1:10 ::/0 ::/0 icmp echo-request 10
1:10 ::/0 ::/0 icmp echo-reply 10</programlisting>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
@@ -347,8 +331,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/tcfilters</para> <para>/etc/shorewall/tcfilters</para>
<para>/etc/shorewall6/tcfilters</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -366,6 +348,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-ecn(5), shorewall-exclusion(5),
shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/tcinterfaces</command> <command>/etc/shorewall/tcinterfaces</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -201,9 +201,7 @@
<refsect1> <refsect1>
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/tcinterfaces</para> <para>/etc/shorewall/tcinterfaces.</para>
<para>/etc/shorewall6/tcinterfaces</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -215,6 +213,14 @@
<para><ulink <para><ulink
url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink></para> url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcpri(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/tcpri</command> <command>/etc/shorewall/tcpri</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -148,8 +148,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/tcpri</para> <para>/etc/shorewall/tcpri</para>
<para>/etc/shorewall6/tcpri</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -158,6 +156,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>prio(8), shorewall(8)</para> <para>prio(8), shorewall(8), shorewall-accounting(5),
shorewall-actions(5), shorewall-blacklist(5), shorewall-hosts(5),
shorewall_interfaces(5), shorewall-ipsets(5), shorewall-maclist(5),
shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5),
shorewall-params(5), shorewall-policy(5), shorewall-providers(5),
shorewall-proxyarp(5), shorewall-rtrules(5), shorewall-routestopped(5),
shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5),
shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-mangle(5),
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,7 +18,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>/etc/shorewall[6]/tunnels</command> <command>/etc/shorewall/tunnels</command>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@@ -173,7 +173,7 @@
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>IPv4 Example 1:</term> <term>Example 1:</term>
<listitem> <listitem>
<para>IPSec tunnel.</para> <para>IPSec tunnel.</para>
@@ -187,7 +187,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 2:</term> <term>Example 2:</term>
<listitem> <listitem>
<para>Road Warrior (LapTop that may connect from anywhere) where the <para>Road Warrior (LapTop that may connect from anywhere) where the
@@ -199,7 +199,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 3:</term> <term>Example 3:</term>
<listitem> <listitem>
<para>Host 4.33.99.124 is a standalone system connected via an ipsec <para>Host 4.33.99.124 is a standalone system connected via an ipsec
@@ -211,7 +211,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 4:</term> <term>Example 4:</term>
<listitem> <listitem>
<para>Road Warriors that may belong to zones vpn1, vpn2 or vpn3. The <para>Road Warriors that may belong to zones vpn1, vpn2 or vpn3. The
@@ -225,7 +225,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 5:</term> <term>Example 5:</term>
<listitem> <listitem>
<para>You run the Linux PPTP client on your firewall and connect to <para>You run the Linux PPTP client on your firewall and connect to
@@ -237,7 +237,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 6:</term> <term>Example 6:</term>
<listitem> <listitem>
<para>You run a PPTP server on your firewall.</para> <para>You run a PPTP server on your firewall.</para>
@@ -260,7 +260,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 8:</term> <term>Example 8:</term>
<listitem> <listitem>
<para>You have a tunnel that is not one of the supported types. Your <para>You have a tunnel that is not one of the supported types. Your
@@ -273,7 +273,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>IPv4 Example 9:</term> <term>Example 9:</term>
<listitem> <listitem>
<para>TINC tunnel where the remote gateways are not specified. If <para>TINC tunnel where the remote gateways are not specified. If
@@ -284,83 +284,6 @@
tinc net 0.0.0.0/0</programlisting> tinc net 0.0.0.0/0</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>IPv6 Example 1:</term>
<listitem>
<para>IPSec tunnel.</para>
<para>The remote gateway is 2001:cec792b4:1::44. The tunnel does not
use the AH protocol</para>
<programlisting> #TYPE ZONE GATEWAY
ipsec:noah net 2002:cec792b4:1::44</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 2:</term>
<listitem>
<para>Road Warrior (LapTop that may connect from anywhere) where the
"gw" zone is used to represent the remote LapTop</para>
<programlisting> #TYPE ZONE GATEWAY GATEWAY ZONES
ipsec net ::/0 gw</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 3:</term>
<listitem>
<para>Host 2001:cec792b4:1::44 is a standalone system connected via
an ipsec tunnel to the firewall system. The host is in zone
gw.</para>
<programlisting> #TYPE ZONE GATEWAY GATEWAY ZONES
ipsec net 2001:cec792b4:1::44 gw</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 4:</term>
<listitem>
<para>OPENVPN tunnel. The remote gateway is 2001:cec792b4:1::44 and
openvpn uses port 7777.</para>
<programlisting> #TYPE ZONE GATEWAY GATEWAY ZONES
openvpn:7777 net 2001:cec792b4:1::44</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 8:</term>
<listitem>
<para>You have a tunnel that is not one of the supported types. Your
tunnel uses UDP port 4444. The other end of the tunnel is
2001:cec792b4:1::44.</para>
<programlisting> #TYPE ZONE GATEWAY GATEWAY ZONES
generic:udp:4444 net 2001:cec792b4:1::44</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>IPv6 Example 9:</term>
<listitem>
<para>TINC tunnel where the remote gateways are not specified. If
you wish to specify a list of gateways, you can do so in the GATEWAY
column.</para>
<programlisting> #TYPE ZONE GATEWAY GATEWAY ZONES
tinc net ::/0</programlisting>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
@@ -368,8 +291,6 @@
<title>FILES</title> <title>FILES</title>
<para>/etc/shorewall/tunnels</para> <para>/etc/shorewall/tunnels</para>
<para>/etc/shorewall6/tunnels</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@@ -378,6 +299,14 @@
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tcdevices(5), shorewall-mangle(5), shorewall-tos(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

Some files were not shown because too many files have changed in this diff Show More