forked from extern/shorewall_code
Compare commits
229 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
69a0061d0f | ||
|
eea3cca90c | ||
|
a420ef04d9 | ||
|
cf9773c4de | ||
|
939f0e92a5 | ||
|
320d448684 | ||
|
2d0cb5c2d8 | ||
|
d9dc6bcfe2 | ||
|
ff51915b4f | ||
|
1ad796ba5d | ||
|
c8e2b4ae28 | ||
|
9d160d4342 | ||
|
1301848315 | ||
|
f050fc6e05 | ||
|
61b6898782 | ||
|
aee8c14ea6 | ||
|
ff2323b249 | ||
|
b4a06e9656 | ||
|
4122021344 | ||
|
71d50e0217 | ||
|
1b6f15d577 | ||
|
7515520b46 | ||
|
1e2030fd6f | ||
|
708644f7c9 | ||
|
2f5687c65a | ||
|
66d1fbd3aa | ||
|
c410459e27 | ||
|
987e54cd54 | ||
|
42a46d42b6 | ||
|
d8ef934f24 | ||
|
62a60ad995 | ||
|
b1ba05db2b | ||
|
57f7cb4f3c | ||
|
4cf60258af | ||
|
1061644ac7 | ||
|
4a262c0e1b | ||
|
29ffb7eb4b | ||
|
a775fdcb7c | ||
|
6338aa42b0 | ||
|
12a32d3a6b | ||
|
45d96a5d64 | ||
|
f21d6de4d6 | ||
|
965a8e8f68 | ||
|
eb26a467e9 | ||
|
28e3218041 | ||
|
bb70a3637b | ||
|
6c20cc7c4f | ||
|
d4e05f6163 | ||
|
6201f37913 | ||
|
7ee44d6b4b | ||
|
363b8f9802 | ||
|
d365a9ff18 | ||
|
00d4724fd8 | ||
|
749c8047d8 | ||
|
a00f2e6365 | ||
|
a46f19899b | ||
|
d2392c3a9b | ||
|
0763b27b0b | ||
|
8b90827611 | ||
|
8507c97b5a | ||
|
a6306f2c08 | ||
|
a79dc194a4 | ||
|
ccf9d73c72 | ||
|
bdcf93f92c | ||
|
6b84727886 | ||
|
5f445d9c2b | ||
|
31bd10ffdd | ||
|
c3303067fc | ||
|
55cf06d0a8 | ||
|
c36a7cd35b | ||
|
561efa595c | ||
|
158f6305b1 | ||
|
6407520a35 | ||
|
54336eaa80 | ||
|
5b85627fb8 | ||
|
a00d7217e3 | ||
|
54ef4e4ced | ||
|
a447d726fa | ||
|
c6050f9fbb | ||
|
fe29adbd66 | ||
|
4dc6be6b3b | ||
|
6ebc8f4266 | ||
|
c5c4211081 | ||
|
4010f9bce4 | ||
|
02bb717d7d | ||
|
046998ed84 | ||
|
24a014655b | ||
|
0b8945da8e | ||
|
da363880a9 | ||
|
b049d1805d | ||
|
037fe490f3 | ||
|
a8d7675322 | ||
|
b13014c9ab | ||
|
76aef6cb04 | ||
|
4c72b3ee58 | ||
|
d9071c5308 | ||
|
5729be6431 | ||
|
1a381f717c | ||
|
c534c458dd | ||
|
61435936fe | ||
|
2d4c1411bd | ||
|
655f260cb6 | ||
|
85d571d013 | ||
|
fdb78898fc | ||
|
d4c016d9c5 | ||
|
3d8d5aa469 | ||
|
49811d24fa | ||
|
fe4aaee1b4 | ||
|
0ec7bc846e | ||
|
dbcd4d9d16 | ||
|
5a996cbda7 | ||
|
6019adaae5 | ||
|
4f869c3506 | ||
|
e3c2874b21 | ||
|
e8a0142480 | ||
|
a4768776f7 | ||
|
8e000b158e | ||
|
f1d1ab6411 | ||
|
cd103bb715 | ||
|
5f1370f1b4 | ||
|
dc53fa2665 | ||
|
71d9a03697 | ||
|
137d4bcc90 | ||
|
356d3fa2dd | ||
|
80d93235b5 | ||
|
c1e7fce1c5 | ||
|
63ec936f21 | ||
|
dabe0bd205 | ||
|
63cf7dd699 | ||
|
0b3a32b365 | ||
|
a839a6f7d0 | ||
|
fec967a41d | ||
|
a7d45e9566 | ||
|
876d76b294 | ||
|
9075a6dd7a | ||
|
c900e3e51c | ||
|
e585ce04f4 | ||
|
61f5e3531c | ||
|
e8a5c45aae | ||
|
d20ad64739 | ||
|
7ffe8e4e4b | ||
|
7644e1d49f | ||
|
06c6a017d5 | ||
|
75fd8ccb37 | ||
|
c04845534a | ||
|
8c7e6fddfd | ||
|
e6ed4d425d | ||
|
783e438b4a | ||
|
27a620347a | ||
|
a496edef54 | ||
|
50a9b4cc6a | ||
|
22b044f350 | ||
|
c58efe7698 | ||
|
f48b2e715f | ||
|
f6f7e691d0 | ||
|
a9048b63f2 | ||
|
bc1df90829 | ||
|
09462cf92b | ||
|
315d4c39b8 | ||
|
42554f8f31 | ||
|
f0debcb6fb | ||
|
e8a9b8ddc8 | ||
|
20cc56f2f1 | ||
|
4e771083c7 | ||
|
a3fc110dc9 | ||
|
813f592b46 | ||
|
a6eebc8ecf | ||
|
6966270822 | ||
|
118e4f73c9 | ||
|
10b39f3855 | ||
|
c4f21ffefb | ||
|
a71b61c238 | ||
|
944888c04f | ||
|
48d301b2cf | ||
|
735919d8d3 | ||
|
b4561e97c8 | ||
|
66a63a4da5 | ||
|
8c9fb501fd | ||
|
977fa81d46 | ||
|
09fda9eb6c | ||
|
7e984af094 | ||
|
af8d4e32c2 | ||
|
ca33a7ef65 | ||
|
e91f414223 | ||
|
5cd2f26b51 | ||
|
dab9e1d7c4 | ||
|
b9471a2499 | ||
|
3b82721956 | ||
|
95ffada759 | ||
|
b2553fb008 | ||
|
8bc70674f3 | ||
|
cecb8a1950 | ||
|
079d862bb3 | ||
|
d50fdea2a7 | ||
|
4c97c58981 | ||
|
92133e5a6b | ||
|
686ca9d3a3 | ||
|
fa7ad6bd74 | ||
|
e45b96ca20 | ||
|
eac2639684 | ||
|
70a395892f | ||
|
d2d11df4f6 | ||
|
b985654600 | ||
|
62ff6d3fa5 | ||
|
2bbb5c8c1e | ||
|
33b4ee4d31 | ||
|
889ca756a1 | ||
|
d111e4f186 | ||
|
634c8debda | ||
|
71dd5d016b | ||
|
6b408869d2 | ||
|
edf08bf408 | ||
|
4a01e910ff | ||
|
2a010f827b | ||
|
9c3a82f628 | ||
|
e6933f4c8d | ||
|
cc3b8793e0 | ||
|
ac5fd195ec | ||
|
45b9ddf188 | ||
|
2d16fac9ed | ||
|
f23970b4f7 | ||
|
04112647d3 | ||
|
2ca1ae734a | ||
|
b36b07b567 | ||
|
64c249a174 | ||
|
0019ca53e5 | ||
|
0d2a5089a9 | ||
|
50d09e76cb | ||
|
a15b2918a4 |
2
Shorewall-core/configure
vendored
2
Shorewall-core/configure
vendored
@@ -190,7 +190,7 @@ for p in ${!params[@]}; do
|
||||
done
|
||||
|
||||
echo '#' > shorewallrc
|
||||
echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc
|
||||
echo "# Created by Shorewall Core version $VERSION configure - " `date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}"` >> shorewallrc
|
||||
echo "# rc file: $rcfile" >> shorewallrc
|
||||
echo '#' >> shorewallrc
|
||||
|
||||
|
@@ -173,7 +173,12 @@ my $outfile;
|
||||
|
||||
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
|
||||
|
||||
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];
|
||||
if ( $ENV{SOURCE_DATE_EPOCH} ) {
|
||||
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 "# Input: @ARGV\n#\n" if @ARGV;
|
||||
|
@@ -22,64 +22,20 @@
|
||||
# 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"
|
||||
|
||||
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME [ <configuration-file> ] "
|
||||
echo " $ME -v"
|
||||
echo " $ME -h"
|
||||
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
|
||||
echo "where <option> is one of"
|
||||
echo " -h"
|
||||
echo " -v"
|
||||
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
|
||||
{
|
||||
if cp -f $1 $2; then
|
||||
@@ -98,16 +54,16 @@ install_file() # $1 = source $2 = target $3 = mode
|
||||
exit 1
|
||||
}
|
||||
|
||||
require()
|
||||
{
|
||||
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
||||
}
|
||||
|
||||
#
|
||||
# Change to the directory containing this script
|
||||
#
|
||||
cd "$(dirname $0)"
|
||||
|
||||
#
|
||||
# Source common functions
|
||||
#
|
||||
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
@@ -126,7 +82,7 @@ while [ $finished -eq 0 ]; do
|
||||
usage 0
|
||||
;;
|
||||
v)
|
||||
echo "Shorewall Firewall Installer Version $VERSION"
|
||||
echo "$Product Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
@@ -148,14 +104,14 @@ done
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
file=./shorewallrc
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
file=~/.shorewallrc
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
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
|
||||
@@ -169,7 +125,7 @@ elif [ $# -eq 1 ]; then
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
@@ -285,13 +241,12 @@ case "$HOST" in
|
||||
debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown HOST \"$HOST\"" >&2
|
||||
exit 1;
|
||||
fatal_error "Unknown HOST \"$HOST\""
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$file" ]; then
|
||||
if $HOST = linux; then
|
||||
if [ $HOST = linux ]; then
|
||||
file=shorewallrc.default
|
||||
else
|
||||
file=shorewallrc.${HOST}
|
||||
@@ -304,7 +259,8 @@ if [ -z "$file" ]; then
|
||||
echo "" >&2
|
||||
echo "Example:" >&2
|
||||
echo "" >&2
|
||||
echo " ./install.sh $file" &>2
|
||||
echo " ./install.sh $file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
@@ -315,45 +271,31 @@ if [ -n "$DESTDIR" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Installing Shorewall Core Version $VERSION"
|
||||
echo "Installing $Product Version $VERSION"
|
||||
|
||||
#
|
||||
# Create directories
|
||||
#
|
||||
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall
|
||||
chmod 755 ${DESTDIR}${LIBEXECDIR}/shorewall
|
||||
make_parent_directory ${DESTDIR}${LIBEXECDIR}/shorewall 0755
|
||||
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall
|
||||
chmod 755 ${DESTDIR}${SHAREDIR}/shorewall
|
||||
make_parent_directory ${DESTDIR}${SHAREDIR}/shorewall 0755
|
||||
|
||||
mkdir -p ${DESTDIR}${CONFDIR}
|
||||
chmod 755 ${DESTDIR}${CONFDIR}
|
||||
make_parent_directory ${DESTDIR}${CONFDIR} 0755
|
||||
|
||||
if [ -n "${SYSCONFDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}
|
||||
chmod 755 ${DESTDIR}${SYSCONFDIR}
|
||||
fi
|
||||
[ -n "${SYSCONFDIR}" ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
|
||||
|
||||
if [ -z "${SERVICEDIR}" ]; then
|
||||
SERVICEDIR="$SYSTEMD"
|
||||
fi
|
||||
|
||||
if [ -n "${SERVICEDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}${SERVICEDIR}
|
||||
chmod 755 ${DESTDIR}${SERVICEDIR}
|
||||
fi
|
||||
[ -n "${SERVICEDIR}" ] && make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
|
||||
|
||||
mkdir -p ${DESTDIR}${SBINDIR}
|
||||
chmod 755 ${DESTDIR}${SBINDIR}
|
||||
make_parent_directory ${DESTDIR}${SBINDIR} 0755
|
||||
|
||||
if [ -n "${MANDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}${MANDIR}
|
||||
chmod 755 ${DESTDIR}${MANDIR}
|
||||
fi
|
||||
[ -n "${MANDIR}" ] && make_parent_directory ${DESTDIR}${MANDIR} 0755
|
||||
|
||||
if [ -n "${INITFILE}" ]; then
|
||||
mkdir -p ${DESTDIR}${INITDIR}
|
||||
chmod 755 ${DESTDIR}${INITDIR}
|
||||
make_parent_directory ${DESTDIR}${INITDIR} 0755
|
||||
|
||||
if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then
|
||||
install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544
|
||||
@@ -369,7 +311,7 @@ fi
|
||||
#
|
||||
install_file shorewall ${DESTDIR}${SBINDIR}/shorewall 0755
|
||||
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/shorewall
|
||||
echo "Shorewall CLI program installed in ${DESTDIR}${SBINDIR}/$PRODUCT"
|
||||
echo "Shorewall CLI program installed in ${DESTDIR}${SBINDIR}/shorewall"
|
||||
#
|
||||
# Install wait4ifup
|
||||
#
|
||||
@@ -382,8 +324,14 @@ echo "wait4ifup installed in ${DESTDIR}${LIBEXECDIR}/shorewall/wait4ifup"
|
||||
# Install the libraries
|
||||
#
|
||||
for f in lib.* ; do
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/shorewall/$f 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/shorewall/$f"
|
||||
case $f in
|
||||
*installer)
|
||||
;;
|
||||
*)
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/shorewall/$f 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/shorewall/$f"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $SHAREDIR != /usr/share ]; then
|
||||
@@ -398,11 +346,11 @@ fi
|
||||
if [ -n "$MANDIR" ]; then
|
||||
cd manpages
|
||||
|
||||
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man8/
|
||||
[ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man8 0755
|
||||
|
||||
for f in *.8; do
|
||||
gzip -9c $f > $f.gz
|
||||
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 644
|
||||
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 0644
|
||||
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
|
||||
done
|
||||
|
||||
@@ -419,7 +367,7 @@ ln -sf lib.base ${DESTDIR}${SHAREDIR}/shorewall/functions
|
||||
# Create the version file
|
||||
#
|
||||
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion
|
||||
chmod 644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion
|
||||
chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion
|
||||
|
||||
if [ -z "${DESTDIR}" ]; then
|
||||
if [ $update -ne 0 ]; then
|
||||
@@ -444,14 +392,20 @@ fi
|
||||
|
||||
if [ ${SHAREDIR} != /usr/share ]; then
|
||||
for f in lib.*; do
|
||||
if [ $BUILD != apple ]; then
|
||||
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
|
||||
case $f in
|
||||
*installer)
|
||||
;;
|
||||
*)
|
||||
if [ $BUILD != apple ]; then
|
||||
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
|
||||
fi
|
||||
#
|
||||
# Report Success
|
||||
# Report Success
|
||||
#
|
||||
echo "Shorewall Core Version $VERSION Installed"
|
||||
echo "$Product Version $VERSION Installed"
|
||||
|
@@ -25,7 +25,7 @@
|
||||
# loaded after this one and replaces some of the functions declared here.
|
||||
#
|
||||
|
||||
SHOREWALL_CAPVERSION=50100
|
||||
SHOREWALL_CAPVERSION=50105
|
||||
|
||||
if [ -z "$g_basedir" ]; then
|
||||
#
|
||||
@@ -78,29 +78,6 @@ showchain() # $1 = name of chain
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# The 'awk' hack that compensates for bugs in iptables-save (or rather in the extension modules).
|
||||
#
|
||||
|
||||
iptablesbug()
|
||||
{
|
||||
if [ $g_family -eq 4 ]; then
|
||||
if qt mywhich awk ; then
|
||||
awk 'BEGIN { sline=""; };\
|
||||
/^-[jg]/ { print sline $0; next };\
|
||||
/-m policy.*-[jg] / { print $0; next };\
|
||||
/-m policy/ { sline=$0; next };\
|
||||
/--mask ff/ { sub( /--mask ff/, "--mask 0xff" ) };\
|
||||
{ print ; sline="" }'
|
||||
else
|
||||
echo " WARNING: You don't have 'awk' on this system so the output of the save command may be unusable" >&2
|
||||
cat
|
||||
fi
|
||||
else
|
||||
cat
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Validate the value of RESTOREFILE
|
||||
#
|
||||
@@ -1150,6 +1127,11 @@ show_macros() {
|
||||
done
|
||||
}
|
||||
|
||||
show_an_action() {
|
||||
echo "Shorewall $SHOREWALL_VERSION Action $1 at $g_hostname - $(date)"
|
||||
cat ${directory}/action.$1
|
||||
}
|
||||
|
||||
show_a_macro() {
|
||||
echo "Shorewall $SHOREWALL_VERSION Macro $1 at $g_hostname - $(date)"
|
||||
cat ${directory}/macro.$1
|
||||
@@ -1458,12 +1440,27 @@ show_command() {
|
||||
;;
|
||||
*)
|
||||
case $1 in
|
||||
action)
|
||||
[ $# -lt 2 ] && fatal_error 'Missing <action>'
|
||||
[ $# -gt 2 ] && too_many_arguments $2
|
||||
|
||||
for directory in $(split $CONFIG_PATH); do
|
||||
if [ -f ${directory}/action.$2 ]; then
|
||||
eval show_an_action $2 $g_pager
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
echo " WARNING: Action $2 not found" >&2
|
||||
return
|
||||
;;
|
||||
actions)
|
||||
[ $# -gt 1 ] && too_many_arguments $2
|
||||
eval show_actions_sorted $g_pager
|
||||
return
|
||||
;;
|
||||
macro)
|
||||
[ $# -lt 2 ] && fatal_error 'Missing <macro>'
|
||||
[ $# -ne 2 ] && too_many_arguments $2
|
||||
for directory in $(split $CONFIG_PATH); do
|
||||
if [ -f ${directory}/macro.$2 ]; then
|
||||
@@ -2806,6 +2803,7 @@ determine_capabilities() {
|
||||
WAIT_OPTION=
|
||||
CPU_FANOUT=
|
||||
NETMAP_TARGET=
|
||||
NFLOG_SIZE=
|
||||
|
||||
AMANDA_HELPER=
|
||||
FTP_HELPER=
|
||||
@@ -3139,10 +3137,13 @@ determine_capabilities() {
|
||||
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 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 -m statistic --mode nth --every 2 --packet 1 && STATISTIC_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
|
||||
qt $g_tool -A $chain -j ACCOUNT --addr 192.168.1.0/29 --tname $chain && ACCOUNT_TARGET=Yes
|
||||
@@ -3308,6 +3309,7 @@ report_capabilities_unsorted() {
|
||||
report_capability "CT Target (CT_TARGET)" $CT_TARGET
|
||||
report_capability "NFQUEUE CPU Fanout (CPU_FANOUT)" $CPU_FANOUT
|
||||
report_capability "NETMAP Target (NETMAP_TARGET)" $NETMAP_TARGET
|
||||
report_capability "--nflog-size support (NFLOG_SIZE)" $NFLOG_SIZE
|
||||
|
||||
echo " Kernel Version (KERNELVERSION): $KERNELVERSION"
|
||||
echo " Capabilities Version (CAPVERSION): $CAPVERSION"
|
||||
@@ -3414,6 +3416,7 @@ report_capabilities_unsorted1() {
|
||||
report_capability1 WAIT_OPTION
|
||||
report_capability1 CPU_FANOUT
|
||||
report_capability1 NETMAP_TARGET
|
||||
report_capability1 NFLOG_SIZE
|
||||
|
||||
report_capability1 AMANDA_HELPER
|
||||
report_capability1 FTP_HELPER
|
||||
@@ -4267,12 +4270,17 @@ usage() # $1 = exit status
|
||||
echo " reenable <interface>"
|
||||
ecko " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]"
|
||||
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
|
||||
echo " remote-reload [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
||||
echo " remote-restart [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
||||
echo " remote-start [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
||||
echo " remote-reload [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
||||
echo " remote-restart [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
||||
echo " remote-start [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
||||
fi
|
||||
|
||||
echo " reset [ <chain> ... ]"
|
||||
@@ -4291,6 +4299,7 @@ usage() # $1 = exit status
|
||||
echo " savesets"
|
||||
echo " [ show | list | ls ] [ -b ] [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]"
|
||||
ecko " [ show | list | ls ] actions"
|
||||
ecko " [ show | list | ls ] action <action>"
|
||||
echo " [ show | list | ls ] arptables"
|
||||
echo " [ show | list | ls ] [ -f ] capabilities"
|
||||
echo " [ show | list | ls ] [ -x ] {bl|blacklists}"
|
||||
@@ -4393,7 +4402,10 @@ shorewall_cli() {
|
||||
finished=0
|
||||
|
||||
while [ $finished -eq 0 ]; do
|
||||
[ $# -eq 0 ] && usage 1
|
||||
if [ $# -eq 0 ]; then
|
||||
setup_product_environment 1
|
||||
usage 1
|
||||
fi
|
||||
option=$1
|
||||
case $option in
|
||||
-)
|
||||
@@ -4523,10 +4535,6 @@ shorewall_cli() {
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
setup_product_environment 1
|
||||
|
||||
[ -n "$g_lite" ] || . ${SHAREDIR}/shorewall/lib.cli-std
|
||||
|
89
Shorewall-core/lib.installer
Normal file
89
Shorewall-core/lib.installer
Normal file
@@ -0,0 +1,89 @@
|
||||
#
|
||||
#
|
||||
# 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
|
||||
}
|
106
Shorewall-core/lib.uninstaller
Normal file
106
Shorewall-core/lib.uninstaller
Normal file
@@ -0,0 +1,106 @@
|
||||
#
|
||||
#
|
||||
# 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
|
||||
}
|
@@ -432,6 +432,33 @@
|
||||
<arg choice="plain"><replaceable>address</replaceable></arg>
|
||||
</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>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
@@ -685,6 +712,31 @@
|
||||
<arg choice="plain"><option>capabilities</option></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
|
||||
<arg><option>-f</option></arg>
|
||||
|
||||
<arg choice="plain"><option>{actions|macros}</option></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
|
||||
<arg choice="plain"><option>action</option><arg
|
||||
choice="plain"><replaceable>action</replaceable></arg></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
@@ -695,7 +747,7 @@
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
|
||||
<arg
|
||||
choice="req"><option>actions|classifiers|connections|config|events|filters|ip|ipa|ipsec|macros|zones|policies|marks</option></arg>
|
||||
choice="req"><option>classifiers|connections|config|events|filters|ip|ipa|ipsec|zones|policies|marks</option></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
@@ -1891,10 +1943,11 @@
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">remote-start</emphasis>
|
||||
[-<option>s</option>] [-<option>c</option>] [-<option>r</option>
|
||||
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
|
||||
[-<option>i</option>] [ [ -D ] <replaceable>directory</replaceable> ]
|
||||
[ <replaceable>system</replaceable> ]</term>
|
||||
[-<option>n</option>] [-<option>s</option>] [-<option>c</option>]
|
||||
[-<option>r</option> <replaceable>root-user-name</replaceable>]
|
||||
[-<option>T</option>] [-<option>i</option>] [ [ -D ]
|
||||
<replaceable>directory</replaceable> ] [
|
||||
<replaceable>system</replaceable> ]</term>
|
||||
|
||||
<listitem>
|
||||
<para>This command was renamed from <command>load</command> in
|
||||
@@ -1930,6 +1983,9 @@
|
||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
||||
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
|
||||
<emphasis role="bold">start</emphasis> command succeeds, then the
|
||||
remote Shorewall-lite configuration is saved by executing <emphasis
|
||||
@@ -2415,12 +2471,23 @@
|
||||
arguments:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">action
|
||||
<replaceable>action</replaceable></emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Lists the named action file. Available on Shorewall and
|
||||
Shorewall6 only.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">actions</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Produces a report about the available actions (built-in,
|
||||
standard and user-defined).</para>
|
||||
standard and user-defined). Available on Shorewall and
|
||||
Shorewall6 only.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -3106,6 +3173,8 @@
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/</para>
|
||||
|
||||
<para>/etc/shorewall6/</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -3115,13 +3184,17 @@
|
||||
url="/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink></para>
|
||||
|
||||
<para>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-arprules(5), shorewall-blrules(5), shorewall.conf(5),
|
||||
shorewall-conntrack(5), shorewall-ecn(5), shorewall-exclusion(5),
|
||||
shorewall-hosts(5), shorewall-init(5), shorewall_interfaces(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-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
|
||||
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
|
||||
shorewall-tcdevices(5), shorewall-tcrules(5), shorewall-tos(5),
|
||||
shorewall-tunnels(5), shorewall-zones(5)</para>
|
||||
shorewall6-proxyndp(5), shorewall-routes(5), shorewall-rtrules(5),
|
||||
shorewall-rtrules(5), shorewall-rules(5), shorewall-secmarks(5),
|
||||
shorewall-snat(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
|
||||
shorewall-tcfilters(5), shorewall-tcinterfaces(5), shorewall-tcpri(5),
|
||||
shorewall-tunnels(5), shorewall-vardir(5), shorewall-zones(5)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Debian Shorewall 4.5 rc file
|
||||
# Debian Shorewall 5.0 rc file
|
||||
#
|
||||
BUILD= #Default is to detect the build system
|
||||
HOST=debian
|
||||
@@ -14,7 +14,7 @@ INITDIR= #Directory where SysV init scripts are installed.
|
||||
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
|
||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
||||
SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR
|
||||
SYSCONFFILE=default.debian.systemd #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
|
||||
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)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Debian Shorewall 4.5 rc file
|
||||
# Debian Shorewall 5.0 rc file
|
||||
#
|
||||
BUILD= #Default is to detect the build system
|
||||
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
|
||||
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
|
||||
SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR
|
||||
SYSCONFFILE=default.debian.sysvinit #Name of the distributed file to be installed in $SYSCONFDIR
|
||||
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
|
||||
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
|
||||
SERVICEDIR= #Directory where .service files are installed (systems running systemd only)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#
|
||||
# Default Shorewall 5.0 rc file
|
||||
#
|
||||
HOST=linux #Generic Linux
|
||||
BUILD= #Default is to detect the build system
|
||||
HOST=linux #Generic Linux
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#
|
||||
# Created by Shorewall Core version 5.0.2-RC1 configure - Fri, Nov 06, 2015 10:02:03 AM
|
||||
#
|
||||
# Input: host=openwrt
|
||||
# OpenWRT Shorewall 5.0 rc file
|
||||
#
|
||||
BUILD= #Default is to detect the build system
|
||||
HOST=openwrt
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Script to back uninstall Shoreline Firewall
|
||||
# Script to back uninstall Shoreline Firewall Core Modules
|
||||
#
|
||||
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
@@ -26,63 +26,75 @@
|
||||
# You may only use this script to uninstall the version
|
||||
# shown below. Simply run this script to remove Shorewall Firewall
|
||||
|
||||
VERSION=xxx #The Build script inserts the actual version
|
||||
PRODUCT="shorewall-core"
|
||||
VERSION=xxx # The Build script inserts the actual version
|
||||
PRODUCT=shorewall-core
|
||||
Product="Shorewall Core"
|
||||
|
||||
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME [ <shorewallrc file> ]"
|
||||
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
|
||||
echo "where <option> is one of"
|
||||
echo " -h"
|
||||
echo " -v"
|
||||
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
|
||||
#
|
||||
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
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||
else
|
||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||
fi
|
||||
@@ -92,11 +104,11 @@ elif [ $# -eq 1 ]; then
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
file=./$file || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
@@ -104,20 +116,26 @@ fi
|
||||
if [ -f ${SHAREDIR}/shorewall/coreversion ]; then
|
||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)"
|
||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||
echo "WARNING: Shorewall Core Version $INSTALLED_VERSION is installed"
|
||||
echo "WARNING: $Product Version $INSTALLED_VERSION is installed"
|
||||
echo " and this is the $VERSION uninstaller."
|
||||
VERSION="$INSTALLED_VERSION"
|
||||
fi
|
||||
else
|
||||
echo "WARNING: Shorewall Core Version $VERSION is not installed"
|
||||
echo "WARNING: $Product Version $VERSION is not installed"
|
||||
VERSION=""
|
||||
fi
|
||||
|
||||
echo "Uninstalling Shorewall Core $VERSION"
|
||||
echo "Uninstalling $Product $VERSION"
|
||||
|
||||
rm -rf ${SHAREDIR}/shorewall
|
||||
rm -f ~/.shorewallrc
|
||||
|
||||
echo "Shorewall Core Uninstalled"
|
||||
if [ -n "${MANDIR}" ]; then
|
||||
remove_file_with_wildcard ${MANDIR}/man5/shorewall\*
|
||||
remove_file_with_wildcard ${MANDIR}/man8/shorewall\*
|
||||
fi
|
||||
|
||||
remove_directory ${SHAREDIR}/shorewall
|
||||
remove_file ~/.shorewallrc
|
||||
|
||||
#
|
||||
# Report Success
|
||||
#
|
||||
echo "$Product $VERSION Uninstalled"
|
||||
|
21
Shorewall-init/default.debian.systemd
Normal file
21
Shorewall-init/default.debian.systemd
Normal file
@@ -0,0 +1,21 @@
|
||||
# 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
|
27
Shorewall-init/default.debian.sysvinit
Normal file
27
Shorewall-init/default.debian.sysvinit
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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
|
@@ -27,58 +27,21 @@
|
||||
# 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"
|
||||
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME [ <configuration-file> ]"
|
||||
echo " $ME -v"
|
||||
echo " $ME -h"
|
||||
echo " $ME -n"
|
||||
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
|
||||
echo "where <option> is one of"
|
||||
echo " -h"
|
||||
echo " -v"
|
||||
echo " -n"
|
||||
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
|
||||
{
|
||||
if cp -f $1 $2; then
|
||||
@@ -97,23 +60,16 @@ install_file() # $1 = source $2 = target $3 = mode
|
||||
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
|
||||
#
|
||||
cd "$(dirname $0)"
|
||||
|
||||
#
|
||||
# Source common functions
|
||||
#
|
||||
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
@@ -134,7 +90,7 @@ while [ $finished -eq 0 ] ; do
|
||||
usage 0
|
||||
;;
|
||||
v)
|
||||
echo "Shorewall-init Firewall Installer Version $VERSION"
|
||||
echo "$Product Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
n*)
|
||||
@@ -159,17 +115,17 @@ done
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
#
|
||||
# Load packager's settings if any
|
||||
#
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc || exit 1
|
||||
file=./shorewallrc
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
file=~/.shorewallrc
|
||||
else
|
||||
fatal_error "No configuration file specified and ~/.shorewallrc not found"
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
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
|
||||
elif [ $# -eq 1 ]; then
|
||||
file=$1
|
||||
@@ -177,11 +133,11 @@ elif [ $# -eq 1 ]; then
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
file=./$file || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
@@ -298,12 +254,10 @@ case "$HOST" in
|
||||
echo "Installing Openwrt-specific configuration..."
|
||||
;;
|
||||
linux)
|
||||
echo "ERROR: Shorewall-init is not supported on this system" >&2
|
||||
exit 1
|
||||
fatal_error "Shorewall-init is not supported on this system"
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unsupported HOST distribution: \"$HOST\"" >&2
|
||||
exit 1;
|
||||
fatal_error "Unsupported HOST distribution: \"$HOST\""
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -315,30 +269,27 @@ if [ -n "$DESTDIR" ]; then
|
||||
OWNERSHIP=""
|
||||
fi
|
||||
|
||||
make_directory ${DESTDIR}${INITDIR} 0755
|
||||
make_parent_directory ${DESTDIR}${INITDIR} 0755
|
||||
fi
|
||||
|
||||
echo "Installing Shorewall Init Version $VERSION"
|
||||
echo "Installing $Product Version $VERSION"
|
||||
|
||||
#
|
||||
# Check for /usr/share/shorewall-init/version
|
||||
#
|
||||
if [ -f ${DESTDIR}${SHAREDIR}/shorewall-init/version ]; then
|
||||
if [ -f ${DESTDIR}${SHAREDIR}/$PRODUCT/version ]; then
|
||||
first_install=""
|
||||
else
|
||||
first_install="Yes"
|
||||
fi
|
||||
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
chmod 0755 ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
fi
|
||||
[ -n "$DESTDIR" ] && make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755
|
||||
|
||||
#
|
||||
# Install the Firewall Script
|
||||
#
|
||||
if [ -n "$INITFILE" ]; then
|
||||
mkdir -p ${DESTDIR}${INITDIR}
|
||||
make_parent_directory ${DESTDIR}${INITDIR} 0755
|
||||
install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544
|
||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE
|
||||
|
||||
@@ -357,25 +308,21 @@ if [ -z "${SERVICEDIR}" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$SERVICEDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${SERVICEDIR}
|
||||
make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
|
||||
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
|
||||
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644
|
||||
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
|
||||
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
|
||||
if [ -n "$DESTDIR" -o $configure -eq 0 ]; then
|
||||
mkdir -p ${DESTDIR}${SBINDIR}
|
||||
chmod 0755 ${DESTDIR}${SBINDIR}
|
||||
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"
|
||||
[ -n "$DESTDIR" -o $configure -eq 0 ] && make_parent_directory ${DESTDIR}${SBINDIR} 0755
|
||||
install_file $PRODUCT ${DESTDIR}${SBINDIR}/$PRODUCT 0700
|
||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/$PRODUCT
|
||||
echo "CLI installed as ${DESTDIR}${SBINDIR}/$PRODUCT"
|
||||
fi
|
||||
|
||||
#
|
||||
# Create /usr/share/shorewall-init if needed
|
||||
#
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall-init
|
||||
chmod 0755 ${DESTDIR}${SHAREDIR}/shorewall-init
|
||||
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT 0755
|
||||
|
||||
#
|
||||
# Install logrotate file
|
||||
@@ -388,55 +335,53 @@ fi
|
||||
#
|
||||
# Create the version file
|
||||
#
|
||||
echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/shorewall-init/version
|
||||
chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall-init/version
|
||||
echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/$PRODUCT/version
|
||||
chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
|
||||
#
|
||||
# Remove and create the symbolic link to the init script
|
||||
#
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
rm -f ${SHAREDIR}/shorewall-init/init
|
||||
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/shorewall-init/init
|
||||
rm -f ${SHAREDIR}/$PRODUCT/init
|
||||
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/$PRODUCT/init
|
||||
fi
|
||||
|
||||
if [ $HOST = debian ]; then
|
||||
if [ -n "${DESTDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}${ETC}/network/if-up.d/
|
||||
mkdir -p ${DESTDIR}${ETC}/network/if-down.d/
|
||||
mkdir -p ${DESTDIR}${ETC}/network/if-post-down.d/
|
||||
make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755
|
||||
make_parent_directory ${DESTDIR}${ETC}/network/if-down.d 0755
|
||||
make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755
|
||||
elif [ $configure -eq 0 ]; then
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/network/if-up.d/
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/network/if-down.d/
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/network/if-post-down.d/
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-up.d 0755
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-down.d 0755
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-post-down.d 0755
|
||||
fi
|
||||
|
||||
if [ ! -f ${DESTDIR}${CONFDIR}/default/shorewall-init ]; then
|
||||
if [ -n "${DESTDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}${ETC}/default
|
||||
fi
|
||||
if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then
|
||||
[ -n "${DESTDIR}" ] && make_parent_directory ${DESTDIR}${ETC}/default 0755
|
||||
|
||||
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default
|
||||
install_file sysconfig ${DESTDIR}${ETC}/default/shorewall-init 0644
|
||||
echo "sysconfig file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
||||
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/default 0755
|
||||
install_file ${SYSCONFFILE} ${DESTDIR}${ETC}/default/$PRODUCT 0644
|
||||
echo "${SYSCONFFILE} file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
||||
fi
|
||||
|
||||
IFUPDOWN=ifupdown.debian.sh
|
||||
else
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}
|
||||
make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
|
||||
|
||||
if [ -z "$RPM" ]; then
|
||||
if [ $HOST = suse ]; then
|
||||
mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-up.d
|
||||
mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-down.d
|
||||
make_parent_directory ${DESTDIR}${ETC}/sysconfig/network/if-up.d 0755
|
||||
make_parent_directory ${DESTDIR}${ETC}/sysconfig/network/if-down.d 0755
|
||||
elif [ $HOST = gentoo ]; then
|
||||
# Gentoo does not support if-{up,down}.d
|
||||
/bin/true
|
||||
elif [ $HOST = openwrt ]; then
|
||||
# Not implemented on openwrt
|
||||
# Not implemented on OpenWRT
|
||||
/bin/true
|
||||
else
|
||||
mkdir -p ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d
|
||||
make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -458,13 +403,13 @@ if [ $HOST != openwrt ]; then
|
||||
|
||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
|
||||
|
||||
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
|
||||
make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755
|
||||
|
||||
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
|
||||
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown 0544
|
||||
fi
|
||||
|
||||
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
|
||||
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/
|
||||
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755
|
||||
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
|
||||
fi
|
||||
|
||||
@@ -483,8 +428,8 @@ case $HOST in
|
||||
suse)
|
||||
if [ -z "$RPM" ]; then
|
||||
if [ $configure -eq 0 ]; then
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-up.d/
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-down.d/
|
||||
make_parent_directory ${DESTDIR}${SYSCONFDIR}/network/if-up.d 0755
|
||||
make_parent_directory ${DESTDIR}${SYSCONFDIR}/network/if-down.d 0755
|
||||
fi
|
||||
|
||||
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544
|
||||
@@ -518,17 +463,17 @@ if [ -z "$DESTDIR" ]; then
|
||||
if [ $HOST = debian ]; then
|
||||
if [ -n "$SERVICEDIR" ]; then
|
||||
if systemctl enable ${PRODUCT}.service; then
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
echo "$Product will start automatically at boot"
|
||||
fi
|
||||
elif mywhich insserv; then
|
||||
if insserv ${INITDIR}/shorewall-init; then
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
if insserv ${INITDIR}/$PRODUCT; then
|
||||
echo "$Product will start automatically at boot"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif mywhich update-rc.d ; 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"
|
||||
else
|
||||
cant_autostart
|
||||
@@ -549,31 +494,31 @@ if [ -z "$DESTDIR" ]; then
|
||||
/bin/true
|
||||
else
|
||||
if [ -n "$SERVICEDIR" ]; then
|
||||
if systemctl enable shorewall-init.service; then
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
if systemctl enable ${PRODUCT}.service; then
|
||||
echo "$Product will start automatically at boot"
|
||||
fi
|
||||
elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then
|
||||
if insserv ${INITDIR}/shorewall-init ; then
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
if insserv ${INITDIR}/$PRODUCT ; then
|
||||
echo "$Product will start automatically at boot"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ -x ${SBINDIR}/chkconfig -o -x /usr${SBINDIR}/chkconfig ]; then
|
||||
if chkconfig --add shorewall-init ; then
|
||||
echo "Shorewall Init will start automatically in run levels as follows:"
|
||||
chkconfig --list shorewall-init
|
||||
if chkconfig --add $PRODUCT ; then
|
||||
echo "$Product will start automatically at boot"
|
||||
chkconfig --list $PRODUCT
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ -x ${SBINDIR}/rc-update ]; then
|
||||
if rc-update add shorewall-init default; then
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
if rc-update add $PRODUCT default; then
|
||||
echo "$Product will start automatically at boot"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then
|
||||
/etc/init.d/$PRODUCT enable
|
||||
if /etc/init.d/shorewall-init enabled; then
|
||||
if /etc/init.d/$PRODUCT enabled; then
|
||||
echo "$Product will start automatically at boot"
|
||||
else
|
||||
cant_autostart
|
||||
@@ -587,11 +532,11 @@ else
|
||||
if [ $configure -eq 1 -a -n "$first_install" ]; then
|
||||
if [ $HOST = debian -a -z "$SERVICEDIR" ]; then
|
||||
if [ -n "${DESTDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}/etc/rcS.d
|
||||
make_parent_directory ${DESTDIR}/etc/rcS.d 0755
|
||||
fi
|
||||
|
||||
ln -sf ../init.d/shorewall-init ${DESTDIR}${CONFDIR}/rcS.d/S38shorewall-init
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
ln -sf ../init.d/$PRODUCT ${DESTDIR}${CONFDIR}/rcS.d/S38${PRODUCT}
|
||||
echo "$Product will start automatically at boot"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -602,8 +547,8 @@ if [ -d ${DESTDIR}/etc/ppp ]; then
|
||||
case $HOST in
|
||||
debian|suse)
|
||||
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
|
||||
mkdir -p ${DESTDIR}/etc/ppp/$directory #SuSE doesn't create the IPv6 directories
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall
|
||||
make_parent_directory ${DESTDIR}/etc/ppp/$directory 0755 #SuSE doesn't create the IPv6 directories
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall
|
||||
done
|
||||
;;
|
||||
redhat)
|
||||
@@ -614,19 +559,19 @@ if [ -d ${DESTDIR}/etc/ppp ]; then
|
||||
FILE=${DESTDIR}/etc/ppp/$file
|
||||
if [ -f $FILE ]; then
|
||||
if grep -qF Shorewall-based $FILE ; then
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown $FILE
|
||||
else
|
||||
echo "$FILE already exists -- ppp devices will not be handled"
|
||||
break
|
||||
fi
|
||||
else
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown $FILE
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
#
|
||||
# Report Success
|
||||
# Report Success
|
||||
#
|
||||
echo "shorewall Init Version $VERSION Installed"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Script to back uninstall Shoreline Firewall
|
||||
# Script to back uninstall Shoreline Firewall Init
|
||||
#
|
||||
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
@@ -26,62 +26,34 @@
|
||||
# You may only use this script to uninstall the version
|
||||
# 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"
|
||||
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME [ <shorewallrc file> ]"
|
||||
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
|
||||
echo "where <option> is one of"
|
||||
echo " -h"
|
||||
echo " -v"
|
||||
echo " -n"
|
||||
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
|
||||
#
|
||||
cd "$(dirname $0)"
|
||||
|
||||
#
|
||||
# Source common functions
|
||||
#
|
||||
. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; }
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
finished=0
|
||||
configure=1
|
||||
|
||||
@@ -118,16 +90,17 @@ while [ $finished -eq 0 ]; do
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||
else
|
||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||
fi
|
||||
@@ -137,72 +110,72 @@ elif [ $# -eq 1 ]; then
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
file=./$file || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file || exit 1
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [ -f ${SHAREDIR}/shorewall-init/version ]; then
|
||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-init/version)"
|
||||
if [ -f ${SHAREDIR}/$PRODUCT/version ]; then
|
||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/$PRODUCT/version)"
|
||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||
echo "WARNING: Shorewall Init Version $INSTALLED_VERSION is installed"
|
||||
echo "WARNING: $Product Version $INSTALLED_VERSION is installed"
|
||||
echo " and this is the $VERSION uninstaller."
|
||||
VERSION="$INSTALLED_VERSION"
|
||||
fi
|
||||
else
|
||||
echo "WARNING: Shorewall Init Version $VERSION is not installed"
|
||||
echo "WARNING: $Product Version $VERSION is not installed"
|
||||
VERSION=""
|
||||
fi
|
||||
|
||||
[ -n "${LIBEXEC:=${SHAREDIR}}" ]
|
||||
|
||||
echo "Uninstalling Shorewall Init $VERSION"
|
||||
echo "Uninstalling $Product $VERSION"
|
||||
|
||||
[ -n "$SANDBOX" ] && configure=0
|
||||
|
||||
INITSCRIPT=${CONFDIR}/init.d/shorewall-init
|
||||
[ -n "${LIBEXEC:=${SHAREDIR}}" ]
|
||||
|
||||
if [ -f "$INITSCRIPT" ]; then
|
||||
remove_file ${SBINDIR}/$PRODUCT
|
||||
|
||||
FIREWALL=${CONFDIR}/init.d/$PRODUCT
|
||||
|
||||
if [ -f "$FIREWALL" ]; then
|
||||
if [ $configure -eq 1 ]; then
|
||||
if [ $HOST = openwrt ]; then
|
||||
if /etc/init.d/shorewall-init enabled; then
|
||||
/etc/init.d/shorewall-init disable
|
||||
if [ $HOST = openwrt ] ; then
|
||||
if /etc/init.d/$PRODUCT enabled; then
|
||||
/etc/init.d/$PRODUCT disable
|
||||
fi
|
||||
elif mywhich updaterc.d ; then
|
||||
updaterc.d shorewall-init remove
|
||||
elif mywhich insserv ; then
|
||||
insserv -r $INITSCRIPT
|
||||
insserv -r $FIREWALL
|
||||
elif mywhich update-rc.d ; then
|
||||
update-rc.d ${PRODUCT} remove
|
||||
elif mywhich chkconfig ; then
|
||||
chkconfig --del $(basename $INITSCRIPT)
|
||||
chkconfig --del $(basename $FIREWALL)
|
||||
fi
|
||||
fi
|
||||
|
||||
remove_file $INITSCRIPT
|
||||
remove_file $FIREWALL
|
||||
fi
|
||||
|
||||
if [ -z "${SERVICEDIR}" ]; then
|
||||
SERVICEDIR="$SYSTEMD"
|
||||
fi
|
||||
[ -z "${SERVICEDIR}" ] && SERVICEDIR="$SYSTEMD"
|
||||
|
||||
if [ -n "$SERVICEDIR" ]; then
|
||||
[ $configure -eq 1 ] && systemctl disable shorewall-init.service
|
||||
rm -f $SERVICEDIR/shorewall-init.service
|
||||
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
|
||||
remove_file $SERVICEDIR/${PRODUCT}.service
|
||||
fi
|
||||
|
||||
if [ $HOST = openwrt ]; then
|
||||
[ "$(readlink -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
|
||||
[ "$(readlink -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local
|
||||
[ "$(readlink -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifup-local
|
||||
[ "$(readlink -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifdown-local
|
||||
else
|
||||
[ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
|
||||
[ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local
|
||||
[ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifup-local
|
||||
[ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifdown-local
|
||||
fi
|
||||
|
||||
remove_file ${CONFDIR}/default/shorewall-init
|
||||
remove_file ${CONFDIR}/sysconfig/shorewall-init
|
||||
remove_file ${CONFDIR}/default/$PRODUCT
|
||||
remove_file ${CONFDIR}/sysconfig/$PRODUCT
|
||||
|
||||
remove_file ${CONFDIR}/NetworkManager/dispatcher.d/01-shorewall
|
||||
|
||||
@@ -227,10 +200,11 @@ if [ -d ${CONFDIR}/ppp ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
rm -f ${SBINDIR}/shorewall-init
|
||||
rm -rf ${SHAREDIR}/shorewall-init
|
||||
rm -rf ${LIBEXECDIR}/shorewall-init
|
||||
|
||||
echo "Shorewall Init Uninstalled"
|
||||
|
||||
remove_directory ${SHAREDIR}/$PRODUCT
|
||||
remove_directory ${LIBEXECDIR}/$PRODUCT
|
||||
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
|
||||
|
||||
#
|
||||
# Report Success
|
||||
#
|
||||
echo "$Product $VERSION Uninstalled"
|
||||
|
26
Shorewall-lite/default.debian.systemd
Normal file
26
Shorewall-lite/default.debian.systemd
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Global start/restart/reload/stop options
|
||||
#
|
||||
OPTIONS=""
|
||||
|
||||
#
|
||||
# Start options
|
||||
#
|
||||
STARTOPTIONS=""
|
||||
|
||||
#
|
||||
# Restart options
|
||||
#
|
||||
RESTARTOPTIONS=""
|
||||
|
||||
#
|
||||
# Reload options
|
||||
#
|
||||
RELOADOPTIONS=""
|
||||
|
||||
#
|
||||
# Stop options
|
||||
#
|
||||
STOPOPTIONS=""
|
||||
|
||||
# EOF
|
@@ -1,5 +1,5 @@
|
||||
# prevent startup with default configuration
|
||||
# set the following varible to 1 in order to allow Shorewall-lite to start
|
||||
# set the following variable to 1 in order to allow Shorewall-lite to start
|
||||
|
||||
startup=0
|
||||
|
||||
@@ -16,7 +16,7 @@ startup=0
|
||||
# wait_interface=
|
||||
|
||||
#
|
||||
# Startup options
|
||||
# Global start/restart/reload/stop options
|
||||
#
|
||||
OPTIONS=""
|
||||
|
||||
@@ -30,6 +30,16 @@ STARTOPTIONS=""
|
||||
#
|
||||
RESTARTOPTIONS=""
|
||||
|
||||
#
|
||||
# Reload options
|
||||
#
|
||||
RELOADOPTIONS=""
|
||||
|
||||
#
|
||||
# Stop options
|
||||
#
|
||||
STOPOPTIONS=""
|
||||
|
||||
#
|
||||
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf
|
||||
#
|
@@ -22,62 +22,19 @@
|
||||
# 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
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME [ <configuration-file> ]"
|
||||
echo " $ME -v"
|
||||
echo " $ME -h"
|
||||
echo " $ME -n"
|
||||
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
|
||||
echo "where <option> is one of"
|
||||
echo " -h"
|
||||
echo " -v"
|
||||
echo " -n"
|
||||
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
|
||||
{
|
||||
if cp -f $1 $2; then
|
||||
@@ -96,19 +53,6 @@ install_file() # $1 = source $2 = target $3 = mode
|
||||
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
|
||||
#
|
||||
@@ -122,6 +66,11 @@ else
|
||||
Product="Shorewall6 Lite"
|
||||
fi
|
||||
|
||||
#
|
||||
# Source common functions
|
||||
#
|
||||
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
@@ -168,12 +117,14 @@ done
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc || exit 1
|
||||
file=./shorewallrc
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc
|
||||
file=~/.shorewallrc
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
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
|
||||
@@ -183,11 +134,11 @@ elif [ $# -eq 1 ]; then
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
file=./$file || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
@@ -318,8 +269,7 @@ case "$HOST" in
|
||||
linux)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown HOST \"$HOST\"" >&2
|
||||
exit 1;
|
||||
fatal_error "ERROR: Unknown HOST \"$HOST\""
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -331,7 +281,7 @@ if [ -n "$DESTDIR" ]; then
|
||||
OWNERSHIP=""
|
||||
fi
|
||||
|
||||
make_directory ${DESTDIR}${INITDIR} 755
|
||||
make_parent_directory ${DESTDIR}${INITDIR} 0755
|
||||
|
||||
else
|
||||
if [ ! -f ${SHAREDIR}/shorewall/coreversion ]; then
|
||||
@@ -371,25 +321,20 @@ fi
|
||||
|
||||
delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules
|
||||
|
||||
[ -n "${INITFILE}" ] && make_directory ${DESTDIR}${INITDIR} 755
|
||||
[ -n "${INITFILE}" ] && make_parent_directory ${DESTDIR}${INITDIR} 0755
|
||||
|
||||
#
|
||||
# Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed
|
||||
#
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${SBINDIR}
|
||||
mkdir -p ${DESTDIR}${VARDIR}
|
||||
|
||||
chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/$PRODUCT 0755
|
||||
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT 0755
|
||||
make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755
|
||||
make_parent_directory ${DESTDIR}${SBINDIR} 0755
|
||||
make_parent_directory ${DESTDIR}${VARDIR} 0755
|
||||
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
mkdir -p ${DESTDIR}${INITDIR}
|
||||
chmod 755 ${DESTDIR}${INITDIR}
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755
|
||||
make_parent_directory ${DESTDIR}${INITDIR} 0755
|
||||
fi
|
||||
|
||||
if [ -n "$INITFILE" ]; then
|
||||
@@ -410,9 +355,9 @@ if [ -z "${SERVICEDIR}" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$SERVICEDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${SERVICEDIR}
|
||||
make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
|
||||
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
|
||||
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 644
|
||||
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644
|
||||
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
|
||||
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
|
||||
fi
|
||||
@@ -441,8 +386,14 @@ echo "Default config path file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/confi
|
||||
#
|
||||
for f in lib.* ; do
|
||||
if [ -f $f ]; then
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
|
||||
case $f in
|
||||
*installer)
|
||||
;;
|
||||
*)
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -470,12 +421,12 @@ if [ -f modules ]; then
|
||||
fi
|
||||
|
||||
if [ -f helpers ]; then
|
||||
install_file helpers ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers 600
|
||||
install_file helpers ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers 0600
|
||||
echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers"
|
||||
fi
|
||||
|
||||
for f in modules.*; do
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 644
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
|
||||
echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
|
||||
done
|
||||
|
||||
@@ -486,19 +437,19 @@ done
|
||||
if [ -d manpages -a -n "$MANDIR" ]; then
|
||||
cd manpages
|
||||
|
||||
mkdir -p ${DESTDIR}${MANDIR}/man5/
|
||||
make_parent_directory ${DESTDIR}${MANDIR}/man5 0755
|
||||
|
||||
for f in *.5; do
|
||||
gzip -c $f > $f.gz
|
||||
install_file $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz 644
|
||||
install_file $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz 0644
|
||||
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz"
|
||||
done
|
||||
|
||||
mkdir -p ${DESTDIR}${MANDIR}/man8/
|
||||
make_parent_directory ${DESTDIR}${MANDIR}/man8 0755
|
||||
|
||||
for f in *.8; do
|
||||
gzip -c $f > $f.gz
|
||||
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 644
|
||||
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 0644
|
||||
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
|
||||
done
|
||||
|
||||
@@ -508,7 +459,7 @@ if [ -d manpages -a -n "$MANDIR" ]; then
|
||||
fi
|
||||
|
||||
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
|
||||
install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 644
|
||||
install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 0644
|
||||
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
|
||||
fi
|
||||
|
||||
@@ -516,7 +467,7 @@ fi
|
||||
# Create the version file
|
||||
#
|
||||
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
#
|
||||
# Remove and create the symbolic link to the init script
|
||||
#
|
||||
@@ -539,10 +490,7 @@ ln -sf shorewall ${DESTDIR}${SBINDIR}/${PRODUCT}
|
||||
# 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 [ ${DESTDIR} ]; then
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}
|
||||
chmod 755 ${DESTDIR}${SYSCONFDIR}
|
||||
fi
|
||||
[ ${DESTDIR} ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
|
||||
|
||||
install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640
|
||||
echo "$SYSCONFFILE file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
||||
@@ -610,6 +558,6 @@ if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${
|
||||
fi
|
||||
|
||||
#
|
||||
# Report Success
|
||||
# Report Success
|
||||
#
|
||||
echo "$Product Version $VERSION Installed"
|
||||
|
@@ -16,7 +16,7 @@ RemainAfterExit=yes
|
||||
EnvironmentFile=-/etc/default/shorewall-lite
|
||||
StandardOutput=syslog
|
||||
ExecStart=/sbin/shorewall-lite $OPTIONS start $STARTOPTIONS
|
||||
ExecStop=/sbin/shorewall-lite $OPTIONS stop
|
||||
ExecStop=/sbin/shorewall-lite $OPTIONS clear
|
||||
ExecReload=/sbin/shorewall-lite $OPTIONS reload $RELOADOPTIONS
|
||||
|
||||
[Install]
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Script to back uninstall Shoreline Firewall
|
||||
# Script to back uninstall Shoreline Firewall Lite
|
||||
#
|
||||
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
@@ -26,9 +26,7 @@
|
||||
# You may only use this script to uninstall the version
|
||||
# shown below. Simply run this script to remove Shorewall Firewall
|
||||
|
||||
VERSION=xxx #The Build script inserts the actual version
|
||||
PRODUCT=shorewall-lite
|
||||
Product="Shorewall Lite"
|
||||
VERSION=xxx # The Build script inserts the actual version
|
||||
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
@@ -41,46 +39,27 @@ usage() # $1 = exit status
|
||||
exit $1
|
||||
}
|
||||
|
||||
fatal_error()
|
||||
{
|
||||
echo " ERROR: $@" >&2
|
||||
exit 1
|
||||
}
|
||||
#
|
||||
# Change to the directory containing this script
|
||||
#
|
||||
cd "$(dirname $0)"
|
||||
|
||||
qt()
|
||||
{
|
||||
"$@" >/dev/null 2>&1
|
||||
}
|
||||
if [ -f shorewall-lite.service ]; then
|
||||
PRODUCT=shorewall-lite
|
||||
Product="Shorewall Lite"
|
||||
else
|
||||
PRODUCT=shorewall6-lite
|
||||
Product="Shorewall6 Lite"
|
||||
fi
|
||||
|
||||
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
|
||||
}
|
||||
#
|
||||
# Source common functions
|
||||
#
|
||||
. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; }
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
finished=0
|
||||
configure=1
|
||||
|
||||
@@ -97,7 +76,7 @@ while [ $finished -eq 0 ]; do
|
||||
usage 0
|
||||
;;
|
||||
v)
|
||||
echo "$Product Firewall Installer Version $VERSION"
|
||||
echo "$Product Firewall Uninstaller Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
n*)
|
||||
@@ -117,16 +96,17 @@ while [ $finished -eq 0 ]; do
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
. ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
. ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
. /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
|
||||
else
|
||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||
fi
|
||||
@@ -136,46 +116,50 @@ elif [ $# -eq 1 ]; then
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
file=./$file || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [ -f ${SHAREDIR}/shorewall-lite/version ]; then
|
||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-lite/version)"
|
||||
if [ -f ${SHAREDIR}/$PRODUCT/version ]; then
|
||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/$PRODUCT/version)"
|
||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||
echo "WARNING: Shorewall Lite Version $INSTALLED_VERSION is installed"
|
||||
echo "WARNING: $Product Version $INSTALLED_VERSION is installed"
|
||||
echo " and this is the $VERSION uninstaller."
|
||||
VERSION="$INSTALLED_VERSION"
|
||||
fi
|
||||
else
|
||||
echo "WARNING: Shorewall Lite Version $VERSION is not installed"
|
||||
echo "WARNING: $Product Version $VERSION is not installed"
|
||||
VERSION=""
|
||||
fi
|
||||
|
||||
echo "Uninstalling Shorewall Lite $VERSION"
|
||||
echo "Uninstalling $Product $VERSION"
|
||||
|
||||
[ -n "$SANDBOX" ] && configure=0
|
||||
|
||||
if [ $configure -eq 1 ]; then
|
||||
if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then
|
||||
shorewall-lite clear
|
||||
${SBINDIR}/$PRODUCT clear
|
||||
elif qt ip6tables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT clear
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -L ${SHAREDIR}/shorewall-lite/init ]; then
|
||||
remove_file ${SBINDIR}/$PRODUCT
|
||||
|
||||
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
|
||||
if [ $HOST = openwrt ]; then
|
||||
if [ $configure -eq 1 ] && /etc/init.d/shorewall-lite enabled; then
|
||||
/etc/init.d/shorewall-lite disable
|
||||
if [ $configure -eq 1 ] && /etc/init.d/$PRODUCT enabled; then
|
||||
/etc/init.d/$PRODUCT disable
|
||||
fi
|
||||
|
||||
FIREWALL=$(readlink ${SHAREDIR}/shorewall-lite/init)
|
||||
FIREWALL=$(readlink ${SHAREDIR}/$PRODUCT/init)
|
||||
else
|
||||
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall-lite/init)
|
||||
FIREWALL=$(readlink -m -q ${SHAREDIR}/$PRODUCT/init)
|
||||
fi
|
||||
elif [ -n "$INITFILE" ]; then
|
||||
FIREWALL=${INITDIR}/${INITFILE}
|
||||
@@ -183,10 +167,10 @@ fi
|
||||
|
||||
if [ -f "$FIREWALL" ]; then
|
||||
if [ $configure -eq 1 ]; then
|
||||
if mywhich updaterc.d ; then
|
||||
updaterc.d shorewall-lite remove
|
||||
elif mywhich insserv ; then
|
||||
if mywhich insserv ; then
|
||||
insserv -r $FIREWALL
|
||||
elif mywhich update-rc.d ; then
|
||||
update-rc.d ${PRODUCT} remove
|
||||
elif mywhich chkconfig ; then
|
||||
chkconfig --del $(basename $FIREWALL)
|
||||
fi
|
||||
@@ -195,26 +179,29 @@ if [ -f "$FIREWALL" ]; then
|
||||
remove_file $FIREWALL
|
||||
fi
|
||||
|
||||
[ -z "$SERVICEDIR" ] && SERVICEDIR="$SYSTEMD"
|
||||
[ -z "${SERVICEDIR}" ] && SERVICEDIR="$SYSTEMD"
|
||||
|
||||
if [ -n "$SERVICEDIR" ]; then
|
||||
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
|
||||
rm -f $SERVICEDIR/shorewall-lite.service
|
||||
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
|
||||
remove_file $SERVICEDIR/${PRODUCT}.service
|
||||
fi
|
||||
|
||||
rm -f ${SBINDIR}/shorewall-lite
|
||||
remove_directory ${CONFDIR}/$PRODUCT
|
||||
remove_directory ${VARDIR}
|
||||
remove_directory ${SHAREDIR}/$PRODUCT
|
||||
remove_directory ${LIBEXECDIR}/$PRODUCT
|
||||
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
|
||||
|
||||
rm -rf ${CONFDIR}/shorewall-lite
|
||||
rm -rf ${VARDIR}
|
||||
rm -rf ${SHAREDIR}/shorewall-lite
|
||||
rm -rf ${LIBEXECDIR}/shorewall-lite
|
||||
rm -f ${CONFDIR}/logrotate.d/shorewall-lite
|
||||
rm -f ${SYSCONFDIR}/shorewall-lite
|
||||
if [ -n "$SYSCONFDIR" ]; then
|
||||
[ -n "$SYSCONFFILE" ] && remove_file ${SYSCONFDIR}/${PRODUCT}
|
||||
fi
|
||||
|
||||
if [ -n "${MANDIR}" ]; then
|
||||
rm -f ${MANDIR}/man5/shorewall-lite*
|
||||
rm -f ${MANDIR}/man8/shorewall-lite*
|
||||
remove_file_with_wildcard ${MANDIR}/man5/${PRODUCT}\*
|
||||
remove_file_with_wildcard ${MANDIR}/man8/${PRODUCT}\*
|
||||
fi
|
||||
|
||||
echo "Shorewall Lite Uninstalled"
|
||||
|
||||
#
|
||||
# Report Success
|
||||
#
|
||||
echo "$Product $VERSION Uninstalled"
|
||||
|
9
Shorewall/Actions/action.A_AllowICMPs.deprecated
Normal file
9
Shorewall/Actions/action.A_AllowICMPs.deprecated
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# Shorewall6 -- /usr/share/shorewall/action.A_AllowICMPs
|
||||
#
|
||||
# This action A_ACCEPTs needed ICMP types
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT
|
||||
|
||||
AllowICMPs(A_ACCEPT)
|
@@ -12,6 +12,8 @@
|
||||
#
|
||||
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
|
||||
#
|
||||
?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
|
||||
#
|
||||
@@ -30,9 +32,10 @@ Auth(A_DROP)
|
||||
#
|
||||
A_AllowICMPs - - icmp
|
||||
#
|
||||
# Don't log broadcasts
|
||||
# Don't log broadcasts and multicasts
|
||||
#
|
||||
dropBcast(audit)
|
||||
dropMcast(audit)
|
||||
#
|
||||
# Drop packets that are in the INVALID state -- these are usually ICMP packets
|
||||
# and just confuse people when they appear in the log.
|
@@ -22,8 +22,9 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# A_REJECTWITH[([<option>])] where <option> is a valid REJECT option.#
|
||||
# A_REJECT[([<option>])] where <option> is a valid REJECT option.#
|
||||
###############################################################################
|
||||
?require AUDIT_TARGET
|
||||
|
||||
DEFAULTS -
|
||||
|
||||
|
@@ -22,8 +22,9 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# A_REJECTWITH[([<option>])] where <option> is a valid REJECT option.#
|
||||
# A_REJECT[([<option>])] where <option> is a valid REJECT option.#
|
||||
###############################################################################
|
||||
?require AUDIT_TARGET
|
||||
|
||||
DEFAULTS -
|
||||
|
||||
|
@@ -11,6 +11,8 @@
|
||||
# internet operation are always ACCEPTed.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
@@ -25,10 +27,11 @@ COUNT
|
||||
#
|
||||
A_AllowICMPs - - icmp
|
||||
#
|
||||
# Drop Broadcasts so they don't clutter up the log
|
||||
# (broadcasts must *not* be rejected).
|
||||
# Drop Broadcasts and multicasts so they don't clutter up the log
|
||||
# (these must *not* be rejected).
|
||||
#
|
||||
dropBcast(audit)
|
||||
dropMcast(audit)
|
||||
#
|
||||
# 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
|
||||
|
45
Shorewall/Actions/action.AllowICMPs
Normal file
45
Shorewall/Actions/action.AllowICMPs
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.AllowICMPs
|
||||
#
|
||||
# This action ACCEPTs needed ICMP types.
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
|
||||
DEFAULTS ACCEPT
|
||||
|
||||
?if __IPV4
|
||||
@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
|
50
Shorewall/Actions/action.BLACKLIST
Normal file
50
Shorewall/Actions/action.BLACKLIST
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# Shorewall - /usr/share/shorewall/action.BLACKLIST
|
||||
#
|
||||
# This action:
|
||||
#
|
||||
# - Adds the sender to the dynamic blacklist ipset
|
||||
# - Optionally acts on the packet (default is DROP)
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# 1 - Action to take after adding the packet. Default is DROP.
|
||||
# Pass -- if you don't want to take any action.
|
||||
# 2 - Timeout for ipset entry. Default is the timeout specified in
|
||||
# DYNAMIC_BLACKLIST or the one specified when the ipset was created.
|
||||
#
|
||||
###############################################################################
|
||||
# Note -- This action is defined with the 'section' option, so the first
|
||||
# parameter is always the section name. That means that in the
|
||||
# following text, the first parameter passed in the rule is actually
|
||||
# @2.
|
||||
###############################################################################
|
||||
?if $1 eq 'BLACKLIST'
|
||||
?if $BLACKLIST_LOG_LEVEL
|
||||
blacklog
|
||||
?else
|
||||
$BLACKLIST_DISPOSITION
|
||||
?endif
|
||||
?else
|
||||
?if ! "$SW_DBL_IPSET"
|
||||
? error The BLACKLIST action may only be used with ipset-based dynamic blacklisting
|
||||
?endif
|
||||
|
||||
DEFAULTS -,DROP,-
|
||||
#
|
||||
# Add to the blacklist
|
||||
#
|
||||
?if passed(@3)
|
||||
ADD($SW_DBL_IPSET:src:@3)
|
||||
?elsif $SW_DBL_TIMEOUT
|
||||
ADD($SW_DBL_IPSET:src:$SW_DBL_TIMEOUT)
|
||||
?else
|
||||
ADD($SW_DBL_IPSET:src)
|
||||
?endif
|
||||
#
|
||||
# Dispose of the packet if asked
|
||||
#
|
||||
?if passed(@2)
|
||||
@2
|
||||
?endif
|
||||
?endif
|
@@ -20,7 +20,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Broadcast[([<action>|-[,{audit|-}])]
|
||||
# Broadcast[([<action>|[,{audit|-}])]
|
||||
#
|
||||
# Default action is DROP
|
||||
#
|
||||
@@ -29,31 +29,37 @@
|
||||
DEFAULTS DROP,-
|
||||
|
||||
?if __ADDRTYPE
|
||||
@1 - - - ;; -m addrtype --dst-type BROADCAST
|
||||
@1 - - - ;; -m addrtype --dst-type MULTICAST
|
||||
@1 - - - ;; -m addrtype --dst-type ANYCAST
|
||||
@1 - - - ;; -m addrtype --dst-type BROADCAST
|
||||
@1 - - - ;; -m addrtype --dst-type ANYCAST
|
||||
?else
|
||||
?begin perl;
|
||||
?begin perl;
|
||||
|
||||
use Shorewall::IPAddrs;
|
||||
use Shorewall::Config;
|
||||
use Shorewall::Chains;
|
||||
use strict;
|
||||
use Shorewall::IPAddrs;
|
||||
use Shorewall::Config;
|
||||
use Shorewall::Chains;
|
||||
|
||||
my ( $action ) = get_action_params( 1 );
|
||||
my $chainref = get_action_chain;
|
||||
my ( $level, $tag ) = get_action_logging;
|
||||
my ( $action, $audit ) = get_action_params( 2 );
|
||||
my $chainref = get_action_chain;
|
||||
my ( $level, $tag ) = get_action_logging;
|
||||
|
||||
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';
|
||||
fatal_error "Invalid parameter to action Broadcast" if supplied $audit && $audit ne 'audit';
|
||||
|
||||
log_rule_limit $level, $chainref, 'Broadcast' , $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;
|
||||
if ( $family == F_IPV4 ) {
|
||||
add_commands $chainref, 'for address in $ALL_BCASTS; do';
|
||||
} elsif ($family == F_IPV6 ) {
|
||||
add_commands $chainref, 'for address in $ALL_ACASTS; do';
|
||||
}
|
||||
|
||||
?end perl;
|
||||
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
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.Drop
|
||||
#
|
||||
# The default DROP common rules
|
||||
# The former default DROP common rules. Use of this action is now deprecated
|
||||
#
|
||||
# This action is invoked before a DROP policy is enforced. The purpose
|
||||
# of the action is:
|
||||
@@ -20,7 +20,7 @@
|
||||
# depending on the setting of the first parameter.
|
||||
# 4 - Action to take with required ICMP packets. Default is ACCEPT or
|
||||
# A_ACCEPT depending on the first parameter.
|
||||
# 5 - Action to take with late UDP replies (UDP source port 53). Default
|
||||
# 5 - Action to take with late DNS replies (UDP source port 53). Default
|
||||
# is DROP or A_DROP depending on the first parameter.
|
||||
# 6 - Action to take with UPnP packets. Default is DROP or A_DROP
|
||||
# depending on the first parameter.
|
||||
@@ -28,6 +28,7 @@
|
||||
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
|
||||
#
|
||||
###############################################################################
|
||||
?warning "You are using the deprecated Drop default action. Please see http://www.shorewall.net/Actions.html#Default"
|
||||
|
||||
?if passed(@1)
|
||||
?if @1 eq 'audit'
|
||||
@@ -58,9 +59,10 @@ Auth(@2)
|
||||
#
|
||||
AllowICMPs(@4) - - icmp
|
||||
#
|
||||
# Don't log broadcasts
|
||||
# Don't log broadcasts or multicasts
|
||||
#
|
||||
Broadcast(DROP,@1)
|
||||
Multicast(DROP,@1)
|
||||
#
|
||||
# Drop packets that are in the INVALID state -- these are usually ICMP packets
|
||||
# and just confuse people when they appear in the log.
|
10
Shorewall/Actions/action.DropDNSrep
Normal file
10
Shorewall/Actions/action.DropDNSrep
Normal file
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.DropDNSrep
|
||||
#
|
||||
# This macro silently drops DNS UDP replies that are in the New state
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
|
||||
DEFAULTS DROP
|
||||
@1 - - udp - 53 { comment="Late DNS Replies" }
|
33
Shorewall/Actions/action.FIN
Normal file
33
Shorewall/Actions/action.FIN
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# 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
|
@@ -13,9 +13,9 @@
|
||||
DEFAULTS 2,0
|
||||
|
||||
?if @1 !~ /^\d+/ || ! @1 || @1 > 1024
|
||||
?error Invalid value for Bricks (@1)
|
||||
?error Invalid value (@1) for the GlusterFS Bricks argument
|
||||
?elsif @2 !~ /^[01]$/
|
||||
?error Invalid value for IB (@2)
|
||||
?error Invalid value (@2) for the GlusterFS IB argument
|
||||
?endif
|
||||
|
||||
#ACTION SOURCE DEST PROTO DPORT
|
||||
|
70
Shorewall/Actions/action.Limit
Normal file
70
Shorewall/Actions/action.Limit
Normal file
@@ -0,0 +1,70 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.Limit
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Limit(<recent-set>,<num-connections>,<timeout>)
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
56
Shorewall/Actions/action.Multicast
Normal file
56
Shorewall/Actions/action.Multicast
Normal file
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.Multicast
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2011-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.
|
||||
#
|
||||
# Multicast[([<action>|-[,{audit|-}])]
|
||||
#
|
||||
# Default action is DROP
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
DEFAULTS DROP,-
|
||||
|
||||
?if __ADDRTYPE
|
||||
@1 - - - ;; -m addrtype --dst-type MULTICAST
|
||||
?else
|
||||
?begin perl;
|
||||
|
||||
use strict;
|
||||
use Shorewall::IPAddrs;
|
||||
use Shorewall::Config;
|
||||
use Shorewall::Chains;
|
||||
|
||||
my ( $action, $audit ) = get_action_params( 2 );
|
||||
my $chainref = get_action_chain;
|
||||
my ( $level, $tag ) = get_action_logging;
|
||||
|
||||
fatal_error "Invalid parameter to action Multicast" if supplied $audit && $audit ne 'audit';
|
||||
|
||||
my $target = require_audit ( $action , $audit );
|
||||
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 '';
|
||||
add_jump $chainref, $target, 0, $dest;
|
||||
|
||||
1;
|
||||
|
||||
?end perl;
|
||||
?endif
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.Reject
|
||||
#
|
||||
# The default REJECT action common rules
|
||||
# The former default REJECT action common rules. Use of this action is deprecated.
|
||||
#
|
||||
# This action is invoked before a REJECT policy is enforced. The purpose
|
||||
# of the action is:
|
||||
@@ -20,13 +20,14 @@
|
||||
# depending on the setting of the first parameter.
|
||||
# 4 - Action to take with required ICMP packets. Default is ACCEPT or
|
||||
# A_ACCEPT depending on the first parameter.
|
||||
# 5 - Action to take with late UDP replies (UDP source port 53). Default
|
||||
# 5 - Action to take with late DNS replies (UDP source port 53). Default
|
||||
# is DROP or A_DROP depending on the first parameter.
|
||||
# 6 - Action to take with UPnP packets. Default is DROP or A_DROP
|
||||
# depending on the first parameter.
|
||||
#
|
||||
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
|
||||
###############################################################################
|
||||
?warning "You are using the deprecated Reject default action. Please see http://www.shorewall.net/Actions.html#Default"
|
||||
|
||||
?if passed(@1)
|
||||
?if @1 eq 'audit'
|
||||
@@ -61,6 +62,7 @@ AllowICMPs(@4) - - icmp
|
||||
# (broadcasts must *not* be rejected).
|
||||
#
|
||||
Broadcast(DROP,@1)
|
||||
Multicast(DROP,@1)
|
||||
#
|
||||
# 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
|
38
Shorewall/Actions/action.allowBcast
Normal file
38
Shorewall/Actions/action.allowBcast
Normal file
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.allowBcast
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# allowBcast[([audit])]
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
38
Shorewall/Actions/action.allowMcast
Normal file
38
Shorewall/Actions/action.allowMcast
Normal file
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.allowMcast
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# allowMcast[([audit])]
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
40
Shorewall/Actions/action.allowinUPnP
Normal file
40
Shorewall/Actions/action.allowinUPnP
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.allowinUPnP
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# allowinUPnP[([audit])]
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
39
Shorewall/Actions/action.dropBcast
Normal file
39
Shorewall/Actions/action.dropBcast
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.dropBcast
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# dropBcast[([audit])]
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
||||
|
39
Shorewall/Actions/action.dropBcasts
Normal file
39
Shorewall/Actions/action.dropBcasts
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# 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
|
||||
|
38
Shorewall/Actions/action.dropMcast
Normal file
38
Shorewall/Actions/action.dropMcast
Normal file
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.dropMcast
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# dropMcast[([audit])]
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
38
Shorewall/Actions/action.dropNotSyn
Normal file
38
Shorewall/Actions/action.dropNotSyn
Normal file
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.dropNotSyn
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# dropNotSyn[([audit])]
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
43
Shorewall/Actions/action.forwardUPnP
Normal file
43
Shorewall/Actions/action.forwardUPnP
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.forwardUPnP
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# forwardUPnP
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
39
Shorewall/Actions/action.rejNotSyn
Normal file
39
Shorewall/Actions/action.rejNotSyn
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/action.rejNotSyn
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# rejNotSyn[([audit])]
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
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
|
||||
|
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/macro.AllowICMPs
|
||||
#
|
||||
# This macro ACCEPTs needed ICMP types.
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
|
||||
?COMMENT Needed ICMP types
|
||||
|
||||
DEFAULT ACCEPT
|
||||
PARAM - - icmp fragmentation-needed
|
||||
PARAM - - icmp time-exceeded
|
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/macro.blacklist
|
||||
#
|
||||
# This macro handles blacklisting using BLACKLIST_DISPOSITION and BLACKLIST_LOGLEVEL.
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
|
||||
?if $BLACKLIST_LOGLEVEL
|
||||
blacklog
|
||||
?else
|
||||
$BLACKLIST_DISPOSITION
|
||||
?endif
|
@@ -1,49 +0,0 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/macro.Drop
|
||||
#
|
||||
# This macro generates the same rules as the Drop default action
|
||||
# It is used in place of action.Drop when USE_ACTIONS=No.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# Drop net all
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
#
|
||||
# Don't log 'auth' DROP
|
||||
#
|
||||
DROP - - tcp 113
|
||||
#
|
||||
# Drop Broadcasts so they don't clutter up the log
|
||||
# (broadcasts must *not* be rejected).
|
||||
#
|
||||
dropBcast
|
||||
#
|
||||
# ACCEPT critical ICMP types
|
||||
#
|
||||
ACCEPT - - icmp fragmentation-needed
|
||||
ACCEPT - - icmp time-exceeded
|
||||
#
|
||||
# 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
|
||||
# rejected).
|
||||
#
|
||||
dropInvalid
|
||||
#
|
||||
# Drop Microsoft noise so that it doesn't clutter up the log.
|
||||
#
|
||||
DROP - - udp 135,445
|
||||
DROP - - udp 137:139
|
||||
DROP - - udp 1024: 137
|
||||
DROP - - tcp 135,139,445
|
||||
DROP - - udp 1900
|
||||
#
|
||||
# Drop 'newnotsyn' traffic so that it doesn't get logged.
|
||||
#
|
||||
dropNotSyn
|
||||
#
|
||||
# Drop late-arriving DNS replies. These are just a nuisance and clutter up
|
||||
# the log.
|
||||
#
|
||||
DROP - - udp - 53
|
@@ -1,12 +0,0 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/macro.DropDNSrep
|
||||
#
|
||||
# This macro silently drops DNS UDP replies
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
|
||||
?COMMENT Late DNS Replies
|
||||
|
||||
DEFAULT DROP
|
||||
PARAM - - udp - 53
|
@@ -1,49 +0,0 @@
|
||||
#
|
||||
# Shorewall -- /usr/share/shorewall/macro.Reject
|
||||
#
|
||||
# This macro generates the same rules as the Reject default action
|
||||
# It is used in place of action.Reject when USE_ACTIONS=No.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# Reject loc fw
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
#
|
||||
# Don't log 'auth' REJECT
|
||||
#
|
||||
REJECT - - tcp 113
|
||||
#
|
||||
# Drop Broadcasts so they don't clutter up the log
|
||||
# (broadcasts must *not* be rejected).
|
||||
#
|
||||
dropBcast
|
||||
#
|
||||
# ACCEPT critical ICMP types
|
||||
#
|
||||
ACCEPT - - icmp fragmentation-needed
|
||||
ACCEPT - - icmp time-exceeded
|
||||
#
|
||||
# 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
|
||||
# rejected).
|
||||
#
|
||||
dropInvalid
|
||||
#
|
||||
# Reject Microsoft noise so that it doesn't clutter up the log.
|
||||
#
|
||||
REJECT - - udp 135,445
|
||||
REJECT - - udp 137:139
|
||||
REJECT - - udp 1024: 137
|
||||
REJECT - - tcp 135,139,445
|
||||
DROP - - udp 1900
|
||||
#
|
||||
# Drop 'newnotsyn' traffic so that it doesn't get logged.
|
||||
#
|
||||
dropNotSyn
|
||||
#
|
||||
# Drop late-arriving DNS replies. These are just a nuisance and clutter up
|
||||
# the log.
|
||||
#
|
||||
DROP - - udp - 53
|
@@ -195,7 +195,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
||||
$ports = '' if $ports eq 'any' || $ports 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;
|
||||
fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT_SECTION;
|
||||
|
||||
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} ) . do_headers( $headers );
|
||||
my $prerule = '';
|
||||
@@ -266,7 +266,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
||||
if ( $source eq 'any' || $source eq 'all' ) {
|
||||
$source = ALLIP;
|
||||
} else {
|
||||
fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT || ! $asection );
|
||||
fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT_SECTION || ! $asection );
|
||||
}
|
||||
|
||||
if ( have_bridges && ! $asection ) {
|
||||
@@ -519,9 +519,9 @@ sub setup_accounting() {
|
||||
|
||||
while ( $chainswithjumps && $progress ) {
|
||||
$progress = 0;
|
||||
for my $chain1 ( sort keys %accountingjumps ) {
|
||||
for my $chain1 ( keys %accountingjumps ) {
|
||||
if ( keys %{$accountingjumps{$chain1}} ) {
|
||||
for my $chain2 ( sort keys %{$accountingjumps{$chain1}} ) {
|
||||
for my $chain2 ( keys %{$accountingjumps{$chain1}} ) {
|
||||
delete $accountingjumps{$chain1}{$chain2}, $progress = 1 unless $accountingjumps{$chain2};
|
||||
}
|
||||
} else {
|
||||
|
@@ -32,6 +32,7 @@ require Exporter;
|
||||
use Scalar::Util 'reftype';
|
||||
use Digest::SHA qw(sha1_hex);
|
||||
use File::Basename;
|
||||
use Socket;
|
||||
use Shorewall::Config qw(:DEFAULT :internal);
|
||||
use Shorewall::Zones;
|
||||
use Shorewall::IPAddrs;
|
||||
@@ -137,6 +138,12 @@ our %EXPORT_TAGS = (
|
||||
ALL_COMMANDS
|
||||
NOT_RESTORE
|
||||
|
||||
validate_port
|
||||
validate_portpair
|
||||
validate_portpair1
|
||||
validate_port_list
|
||||
expand_port_range
|
||||
|
||||
PREROUTING
|
||||
INPUT
|
||||
FORWARD
|
||||
@@ -405,14 +412,14 @@ our $VERSION = 'MODULEVERSION';
|
||||
# Provider Chains for provider <p>
|
||||
# Load Balance - ~<p>
|
||||
#
|
||||
# Zone-pair chains for rules chain <z12z2>
|
||||
# Zone-pair chains for rules chain <z1-z2>
|
||||
#
|
||||
# Syn Flood - @<z12z2>
|
||||
# Blacklist - <z12z2>~
|
||||
# Established - ^<z12z2>
|
||||
# Related - +<z12z2>
|
||||
# Invalid - _<z12z2>
|
||||
# Untracked - &<z12z2>
|
||||
# Syn Flood - @<z1-z2>
|
||||
# Blacklist - <z1-z2>~
|
||||
# Established - ^<z1-z2>
|
||||
# Related - +<z1-z2>
|
||||
# Invalid - _<z1-z2>
|
||||
# Untracked - &<z1-z2>
|
||||
#
|
||||
our %chain_table;
|
||||
our $raw_table;
|
||||
@@ -434,7 +441,7 @@ use constant { STANDARD => 0x1, #defined by Netfilter
|
||||
REDIRECT => 0x20, #'REDIRECT'
|
||||
ACTION => 0x40, #An action (may be built-in)
|
||||
MACRO => 0x80, #A Macro
|
||||
LOGRULE => 0x100, #'LOG','NFLOG'
|
||||
LOGRULE => 0x100, #'LOG','ULOG','NFLOG'
|
||||
NFQ => 0x200, #'NFQUEUE'
|
||||
CHAIN => 0x400, #Manual Chain
|
||||
SET => 0x800, #SET
|
||||
@@ -509,6 +516,7 @@ our $idiotcount1;
|
||||
our $hashlimitset;
|
||||
our $global_variables;
|
||||
our %address_variables;
|
||||
our %port_variables;
|
||||
our $ipset_rules;
|
||||
|
||||
#
|
||||
@@ -784,6 +792,7 @@ sub initialize( $$$ ) {
|
||||
%interfaceacasts = ();
|
||||
%interfacegateways = ();
|
||||
%address_variables = ();
|
||||
%port_variables = ();
|
||||
|
||||
$global_variables = 0;
|
||||
$idiotcount = 0;
|
||||
@@ -819,6 +828,211 @@ 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
|
||||
#
|
||||
@@ -1081,11 +1295,11 @@ sub format_option( $$ ) {
|
||||
|
||||
assert( ! reftype $value );
|
||||
|
||||
my $rule = '';
|
||||
my $rule;
|
||||
|
||||
$value =~ s/\s*$//;
|
||||
|
||||
$rule .= join( ' ' , ' -m', $option, $value );
|
||||
$rule = join( ' ' , ' -m', $option, $value );
|
||||
|
||||
$rule;
|
||||
}
|
||||
@@ -1223,7 +1437,7 @@ sub merge_rules( $$$ ) {
|
||||
}
|
||||
}
|
||||
|
||||
for my $option ( grep ! $opttype{$_} || $_ eq 'nfacct' || $_ eq 'recent', sort { $b cmp $a } keys %$fromref ) {
|
||||
for my $option ( grep ! $opttype{$_} || $_ eq 'nfacct' || $_ eq 'recent', keys %$fromref ) {
|
||||
set_rule_option( $toref, $option, $fromref->{$option} );
|
||||
}
|
||||
|
||||
@@ -1239,7 +1453,7 @@ sub merge_rules( $$$ ) {
|
||||
|
||||
set_rule_option( $toref, 'policy', $fromref->{policy} ) if exists $fromref->{policy};
|
||||
|
||||
for my $option ( grep( get_opttype( $_, 0 ) == EXPENSIVE, sort keys %$fromref ) ) {
|
||||
for my $option ( grep( get_opttype( $_, 0 ) == EXPENSIVE, keys %$fromref ) ) {
|
||||
set_rule_option( $toref, $option, $fromref->{$option} );
|
||||
}
|
||||
|
||||
@@ -3691,7 +3905,7 @@ sub optimize_level8( $$$ ) {
|
||||
}
|
||||
|
||||
if ( $progress ) {
|
||||
my @rename = sort keys %rename;
|
||||
my @rename = keys %rename;
|
||||
#
|
||||
# First create aliases for each renamed chain and change the {name} member.
|
||||
#
|
||||
@@ -4556,7 +4770,8 @@ sub do_proto( $$$;$ )
|
||||
|
||||
if ( $proto ne '' ) {
|
||||
|
||||
my $synonly = ( $proto =~ s/:syn$//i );
|
||||
my $synonly = ( $proto =~ s/:(!)?syn$//i );
|
||||
my $notsyn = $1;
|
||||
my $invert = ( $proto =~ s/^!// ? '! ' : '' );
|
||||
my $protonum = resolve_proto $proto;
|
||||
|
||||
@@ -4574,7 +4789,7 @@ sub do_proto( $$$;$ )
|
||||
$output = "${invert}-p ${proto} ";
|
||||
} else {
|
||||
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
|
||||
$output = "-p $proto --syn ";
|
||||
$output = $notsyn ? "-p $proto ! --syn " : "-p $proto --syn ";
|
||||
}
|
||||
|
||||
fatal_error "SOURCE/DEST PORT(S) not allowed with PROTO !$pname" if $invert && ($ports ne '' || $sports ne '');
|
||||
@@ -5757,6 +5972,7 @@ sub record_runtime_address( $$;$$ ) {
|
||||
|
||||
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 "Variable %variable is already used as a port variable" if $port_variables{$1};
|
||||
$address_variables{$1} = $addrtype;
|
||||
return '$' . "$1 ";
|
||||
}
|
||||
@@ -6980,13 +7196,13 @@ sub set_global_variables( $$ ) {
|
||||
if ( $conditional ) {
|
||||
my ( $interface, @interfaces );
|
||||
|
||||
@interfaces = sort keys %interfaceaddr;
|
||||
@interfaces = keys %interfaceaddr;
|
||||
|
||||
for $interface ( @interfaces ) {
|
||||
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfaceaddr{$interface}) );
|
||||
}
|
||||
|
||||
@interfaces = sort keys %interfacegateways;
|
||||
@interfaces = keys %interfacegateways;
|
||||
|
||||
for $interface ( @interfaces ) {
|
||||
emit( qq(if [ -z "\$interface" -o "\$interface" = "$interface" ]; then) );
|
||||
@@ -6996,36 +7212,36 @@ sub set_global_variables( $$ ) {
|
||||
emit( qq(fi\n) );
|
||||
}
|
||||
|
||||
@interfaces = sort keys %interfacemacs;
|
||||
@interfaces = keys %interfacemacs;
|
||||
|
||||
for $interface ( @interfaces ) {
|
||||
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfacemacs{$interface}) );
|
||||
}
|
||||
} else {
|
||||
emit $_ for sort values %interfaceaddr;
|
||||
emit "$_\n" for sort values %interfacegateways;
|
||||
emit $_ for sort values %interfacemacs;
|
||||
emit $_ for values %interfaceaddr;
|
||||
emit "$_\n" for values %interfacegateways;
|
||||
emit $_ for values %interfacemacs;
|
||||
}
|
||||
|
||||
if ( $setall ) {
|
||||
emit $_ for sort values %interfaceaddrs;
|
||||
emit $_ for sort values %interfacenets;
|
||||
emit $_ for values %interfaceaddrs;
|
||||
emit $_ for values %interfacenets;
|
||||
|
||||
unless ( have_capability( 'ADDRTYPE' ) ) {
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
emit 'ALL_BCASTS="$(get_all_bcasts) 255.255.255.255"';
|
||||
emit $_ for sort values %interfacebcasts;
|
||||
emit $_ for values %interfacebcasts;
|
||||
} else {
|
||||
emit 'ALL_ACASTS="$(get_all_acasts)"';
|
||||
emit $_ for sort values %interfaceacasts;
|
||||
emit $_ for values %interfaceacasts;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub verify_address_variables() {
|
||||
for my $variable ( sort keys %address_variables ) {
|
||||
for my $variable ( keys %address_variables ) {
|
||||
my $type = $address_variables{$variable};
|
||||
my $address = "\$$variable";
|
||||
|
||||
@@ -7044,6 +7260,19 @@ sub verify_address_variables() {
|
||||
qq( startup_error "Invalid value ($address) for address variable $variable"),
|
||||
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) );
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
@@ -7942,7 +8171,7 @@ sub add_interface_options( $ ) {
|
||||
#
|
||||
# Generate a digest for each chain
|
||||
#
|
||||
for my $chainref ( sort { $a->{name} cmp $b->{name} } values %input_chains, values %forward_chains ) {
|
||||
for my $chainref ( values %input_chains, values %forward_chains ) {
|
||||
my $digest = '';
|
||||
|
||||
assert( $chainref );
|
||||
@@ -7961,7 +8190,7 @@ sub add_interface_options( $ ) {
|
||||
# Insert jumps to the interface chains into the rules chains
|
||||
#
|
||||
for my $zone1 ( off_firewall_zones ) {
|
||||
my @input_interfaces = sort keys %{zone_interfaces( $zone1 )};
|
||||
my @input_interfaces = keys %{zone_interfaces( $zone1 )};
|
||||
my @forward_interfaces = @input_interfaces;
|
||||
|
||||
if ( @input_interfaces > 1 ) {
|
||||
@@ -8047,7 +8276,7 @@ sub add_interface_options( $ ) {
|
||||
for my $zone1 ( firewall_zone, vserver_zones ) {
|
||||
for my $zone2 ( off_firewall_zones ) {
|
||||
my $chainref = $filter_table->{rules_chain( $zone1, $zone2 )};
|
||||
my @interfaces = sort keys %{zone_interfaces( $zone2 )};
|
||||
my @interfaces = keys %{zone_interfaces( $zone2 )};
|
||||
my $chain1ref;
|
||||
|
||||
for my $interface ( @interfaces ) {
|
||||
@@ -8453,7 +8682,7 @@ sub create_save_ipsets() {
|
||||
#
|
||||
$ipsets{$_} = 1 for ( @ipsets, @{$globals{SAVED_IPSETS}} );
|
||||
|
||||
my @sets = sort keys %ipsets;
|
||||
my @sets = keys %ipsets;
|
||||
|
||||
emit( '' ,
|
||||
' rm -f $file' ,
|
||||
@@ -8629,7 +8858,7 @@ sub create_load_ipsets() {
|
||||
#
|
||||
sub create_nfobjects() {
|
||||
|
||||
my @objects = ( sort keys %nfobjects );
|
||||
my @objects = ( keys %nfobjects );
|
||||
|
||||
if ( @objects ) {
|
||||
if ( $config{NFACCT} ) {
|
||||
@@ -8644,7 +8873,7 @@ sub create_nfobjects() {
|
||||
}
|
||||
}
|
||||
|
||||
for ( sort keys %nfobjects ) {
|
||||
for ( keys %nfobjects ) {
|
||||
emit( qq(if ! qt \$NFACCT get $_; then),
|
||||
qq( \$NFACCT add $_),
|
||||
qq(fi\n) );
|
||||
@@ -9120,7 +9349,7 @@ sub initialize_switches() {
|
||||
if ( keys %switches ) {
|
||||
emit( 'if [ $COMMAND = start ]; then' );
|
||||
push_indent;
|
||||
for my $switch ( sort keys %switches ) {
|
||||
for my $switch ( keys %switches ) {
|
||||
my $setting = $switches{$switch};
|
||||
my $file = "/proc/net/nf_condition/$switch";
|
||||
emit "[ -f $file ] && echo $setting->{setting} > $file";
|
||||
|
@@ -93,11 +93,10 @@ sub generate_script_1( $ ) {
|
||||
my $date = compiletime;
|
||||
|
||||
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';
|
||||
@@ -945,7 +944,7 @@ sub compiler {
|
||||
#
|
||||
# Copy the footer to the script
|
||||
#
|
||||
copy $globals{SHAREDIRPL} . 'prog.footer' unless $test;
|
||||
copy $globals{SHAREDIRPL} . 'prog.footer';
|
||||
|
||||
disable_script;
|
||||
#
|
||||
|
@@ -86,6 +86,9 @@ our @EXPORT = qw(
|
||||
kernel_version
|
||||
|
||||
compiletime
|
||||
|
||||
F_IPV4
|
||||
F_IPV6
|
||||
);
|
||||
|
||||
our @EXPORT_OK = qw( $shorewall_dir initialize shorewall);
|
||||
@@ -196,9 +199,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
||||
|
||||
PARMSMODIFIED
|
||||
USEDCALLER
|
||||
|
||||
F_IPV4
|
||||
F_IPV6
|
||||
|
||||
TCP
|
||||
UDP
|
||||
@@ -413,6 +413,7 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
|
||||
WAIT_OPTION => 'iptables --wait option',
|
||||
CPU_FANOUT => 'NFQUEUE CPU Fanout',
|
||||
NETMAP_TARGET => 'NETMAP Target',
|
||||
NFLOG_SIZE => '--nflog-size support',
|
||||
|
||||
AMANDA_HELPER => 'Amanda Helper',
|
||||
FTP_HELPER => 'FTP Helper',
|
||||
@@ -488,53 +489,55 @@ our %helpers_aliases;
|
||||
our %helpers_enabled;
|
||||
|
||||
our %config_files = ( #accounting => 1,
|
||||
actions => 1,
|
||||
blacklist => 1,
|
||||
clear => 1,
|
||||
conntrack => 1,
|
||||
ecn => 1,
|
||||
findgw => 1,
|
||||
hosts => 1,
|
||||
init => 1,
|
||||
initdone => 1,
|
||||
actions => 1,
|
||||
blacklist => 1,
|
||||
clear => 1,
|
||||
conntrack => 1,
|
||||
ecn => 1,
|
||||
findgw => 1,
|
||||
hosts => 1,
|
||||
init => 1,
|
||||
initdone => 1,
|
||||
interfaces => 1,
|
||||
isusable => 1,
|
||||
maclist => 1,
|
||||
masq => 1,
|
||||
nat => 1,
|
||||
netmap => 1,
|
||||
params => 1,
|
||||
policy => 1,
|
||||
providers => 1,
|
||||
proxyarp => 1,
|
||||
refresh => 1,
|
||||
refreshed => 1,
|
||||
restored => 1,
|
||||
rawnat => 1,
|
||||
isusable => 1,
|
||||
maclist => 1,
|
||||
mangle => 1,
|
||||
masq => 1,
|
||||
nat => 1,
|
||||
netmap => 1,
|
||||
params => 1,
|
||||
policy => 1,
|
||||
providers => 1,
|
||||
proxyarp => 1,
|
||||
refresh => 1,
|
||||
refreshed => 1,
|
||||
restored => 1,
|
||||
rawnat => 1,
|
||||
route_rules => 1,
|
||||
routes => 1,
|
||||
routes => 1,
|
||||
routestopped => 1,
|
||||
rtrules => 1,
|
||||
rules => 1,
|
||||
scfilter => 1,
|
||||
secmarks => 1,
|
||||
start => 1,
|
||||
started => 1,
|
||||
stop => 1,
|
||||
stopped => 1,
|
||||
rtrules => 1,
|
||||
rules => 1,
|
||||
scfilter => 1,
|
||||
secmarks => 1,
|
||||
snat => 1,
|
||||
start => 1,
|
||||
started => 1,
|
||||
stop => 1,
|
||||
stopped => 1,
|
||||
stoppedrules => 1,
|
||||
tcclasses => 1,
|
||||
tcclear => 1,
|
||||
tcdevices => 1,
|
||||
tcfilters => 1,
|
||||
tcclasses => 1,
|
||||
tcclear => 1,
|
||||
tcdevices => 1,
|
||||
tcfilters => 1,
|
||||
tcinterfaces => 1,
|
||||
tcpri => 1,
|
||||
tcrules => 1,
|
||||
tos => 1,
|
||||
tunnels => 1,
|
||||
zones => 1 );
|
||||
tcpri => 1,
|
||||
tcrules => 1,
|
||||
tos => 1,
|
||||
tunnels => 1,
|
||||
zones => 1 );
|
||||
#
|
||||
# Options that involve the the AUDIT target
|
||||
# Options that involve the AUDIT target
|
||||
#
|
||||
our @auditoptions = qw( BLACKLIST_DISPOSITION MACLIST_DISPOSITION TCP_FLAGS_DISPOSITION );
|
||||
#
|
||||
@@ -748,8 +751,8 @@ sub initialize( $;$$) {
|
||||
TC_SCRIPT => '',
|
||||
EXPORT => 0,
|
||||
KLUDGEFREE => '',
|
||||
VERSION => "5.0.9-Beta2",
|
||||
CAPVERSION => 50100 ,
|
||||
VERSION => "5.1.5-RC1",
|
||||
CAPVERSION => 50105 ,
|
||||
BLACKLIST_LOG_TAG => '',
|
||||
RELATED_LOG_TAG => '',
|
||||
MACLIST_LOG_TAG => '',
|
||||
@@ -792,6 +795,7 @@ sub initialize( $;$$) {
|
||||
INVALID_LOG_LEVEL => undef,
|
||||
UNTRACKED_LOG_LEVEL => undef,
|
||||
LOG_BACKEND => undef,
|
||||
LOG_LEVEL => undef,
|
||||
#
|
||||
# Location of Files
|
||||
#
|
||||
@@ -816,6 +820,7 @@ sub initialize( $;$$) {
|
||||
ACCEPT_DEFAULT => undef,
|
||||
QUEUE_DEFAULT => undef,
|
||||
NFQUEUE_DEFAULT => undef,
|
||||
BLACKLIST_DEFAULT => undef,
|
||||
#
|
||||
# RSH/RCP Commands
|
||||
#
|
||||
@@ -904,6 +909,9 @@ sub initialize( $;$$) {
|
||||
VERBOSE_MESSAGES => undef ,
|
||||
ZERO_MARKS => undef ,
|
||||
FIREWALL => undef ,
|
||||
BALANCE_PROVIDERS => undef ,
|
||||
PERL_HASH_SEED => undef ,
|
||||
USE_NFLOG_SIZE => undef ,
|
||||
#
|
||||
# Packet Disposition
|
||||
#
|
||||
@@ -1037,6 +1045,7 @@ sub initialize( $;$$) {
|
||||
WAIT_OPTION => undef,
|
||||
CPU_FANOUT => undef,
|
||||
NETMAP_TARGET => undef,
|
||||
NFLOG_SIZE => undef,
|
||||
|
||||
AMANDA_HELPER => undef,
|
||||
FTP_HELPER => undef,
|
||||
@@ -1089,7 +1098,7 @@ sub initialize( $;$$) {
|
||||
|
||||
%compiler_params = ();
|
||||
|
||||
%actparams = ( 0 => 0, loglevel => '', logtag => '', chain => '', disposition => '', caller => '' );
|
||||
%actparams = ( 0 => 0, loglevel => '', logtag => '', chain => '', disposition => '', caller => '', callfile => '', callline => '' );
|
||||
$parmsmodified = 0;
|
||||
$usedcaller = 0;
|
||||
%ipsets = ();
|
||||
@@ -1162,7 +1171,7 @@ sub initialize( $;$$) {
|
||||
#
|
||||
# Process the global shorewallrc file
|
||||
#
|
||||
# Note: The build file executes this function passing only the protocol family
|
||||
# Note: The build script calls this function passing only the protocol family
|
||||
#
|
||||
process_shorewallrc( $shorewallrc,
|
||||
$family == F_IPV4 ? 'shorewall' : 'shorewall6'
|
||||
@@ -1213,10 +1222,9 @@ sub compiletime() {
|
||||
# Create 'currentlineinfo'
|
||||
#
|
||||
sub currentlineinfo() {
|
||||
my $linenumber = $currentlinenumber || 1;
|
||||
|
||||
if ( $currentfile ) {
|
||||
my $lineinfo = " $currentfilename ";
|
||||
if ( $currentfilename ) {
|
||||
my $linenumber = $currentlinenumber || 1;
|
||||
my $lineinfo = " $currentfilename ";
|
||||
|
||||
if ( $linenumber eq 'EOF' ) {
|
||||
$lineinfo .= '(EOF)'
|
||||
@@ -2174,7 +2182,7 @@ sub split_list3( $$ ) {
|
||||
$element = join ',', $element , $_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unless ( $opencount == 0 ) {
|
||||
fatal_error "Invalid $type ($list)";
|
||||
}
|
||||
@@ -2229,7 +2237,7 @@ sub split_list4( $ ) {
|
||||
sub split_columns( $ ) {
|
||||
my ($list) = @_;
|
||||
|
||||
return split ' ', $list unless $list =~ /\(/;
|
||||
return split ' ', $list unless $list =~ /[()]/;
|
||||
|
||||
my @list1 = split ' ', $list;
|
||||
my @list2;
|
||||
@@ -2270,9 +2278,7 @@ sub split_columns( $ ) {
|
||||
}
|
||||
}
|
||||
|
||||
unless ( $opencount == 0 ) {
|
||||
fatal_error "Mismatched parentheses ($list)";
|
||||
}
|
||||
fatal_error "Mismatched parentheses ($list)" unless $opencount == 0;
|
||||
|
||||
@list2;
|
||||
}
|
||||
@@ -2285,7 +2291,7 @@ sub clear_comment();
|
||||
# ensure that it has an appropriate number of columns.
|
||||
# supply '-' in omitted trailing columns.
|
||||
# Handles all of the supported forms of column/pair specification
|
||||
# Handles segragating raw iptables input in INLINE rules
|
||||
# Handles segragating raw iptables input in rules
|
||||
#
|
||||
sub split_line2( $$;$$$ ) {
|
||||
my ( $description, $columnsref, $nopad, $maxcolumns, $inline ) = @_;
|
||||
@@ -2338,7 +2344,7 @@ sub split_line2( $$;$$$ ) {
|
||||
|
||||
$inline_matches = $pairs;
|
||||
|
||||
if ( $columns =~ /^(\s*|.*[^&@%]){(.*)}\s*$/ ) {
|
||||
if ( $columns =~ /^(\s*|.*[^&@%])\{(.*)\}\s*$/ ) {
|
||||
#
|
||||
# Pairs are enclosed in curly brackets.
|
||||
#
|
||||
@@ -2354,7 +2360,7 @@ sub split_line2( $$;$$$ ) {
|
||||
if ( $currline =~ /^\s*INLINE(?:\(.*\)(:.*)?|:.*)?\s/ || $currline =~ /^\s*IP6?TABLES(?:\(.*\)|:.*)?\s/ ) {
|
||||
$inline_matches = $pairs;
|
||||
|
||||
if ( $columns =~ /^(\s*|.*[^&@%]){(.*)}\s*$/ ) {
|
||||
if ( $columns =~ /^(\s*|.*[^&@%])\{(.*)\}\s*$/ ) {
|
||||
#
|
||||
# Pairs are enclosed in curly brackets.
|
||||
#
|
||||
@@ -2368,7 +2374,7 @@ sub split_line2( $$;$$$ ) {
|
||||
} elsif ( $checkinline ) {
|
||||
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.
|
||||
#
|
||||
@@ -2434,12 +2440,12 @@ sub split_line2( $$;$$$ ) {
|
||||
}
|
||||
} else {
|
||||
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 =~ s/\\"/"/g;
|
||||
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
|
||||
$line[$column] = $value;
|
||||
fatal_error "Non-ASCII gunk in the value of the $column column" if $value =~ /[^\s[:print:]]/;
|
||||
my $colnum = $columnsref->{$column};
|
||||
warning_message qq(Replacing "$line[$colnum]" with "$value" in the ) . uc( $column ) . ' column' if $line[$colnum] ne '-';
|
||||
$line[$colnum] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2710,13 +2716,13 @@ sub directive_info( $$$$ ) {
|
||||
# Add quotes to the passed value if the passed 'first part' has an odd number of quotes
|
||||
# Return an expression that concatenates $first, $val and $rest
|
||||
#
|
||||
sub join_parts( $$$ ) {
|
||||
my ( $first, $val, $rest ) = @_;
|
||||
sub join_parts( $$$$ ) {
|
||||
my ( $first, $val, $rest, $just_expand ) = @_;
|
||||
|
||||
$val = '' unless defined $val;
|
||||
$val = "'$val'" unless ( $val =~ /^-?\d+$/ || # Value is numeric
|
||||
( ( ( $first =~ tr/"/"/ ) & 1 ) || # There are an odd number of double quotes preceding the value
|
||||
( ( $first =~ tr/'/'/ ) & 1 ) ) ); # There are an odd number of single quotes preceding the value
|
||||
$val = "'$val'" unless $just_expand || ( $val =~ /^-?\d+$/ || # Value is numeric
|
||||
( ( ( $first =~ tr/"/"/ ) & 1 ) || # There are an odd number of double quotes preceding the value
|
||||
( ( $first =~ tr/'/'/ ) & 1 ) ) ); # There are an odd number of single quotes preceding the value
|
||||
join( '', $first, $val, $rest );
|
||||
}
|
||||
|
||||
@@ -2769,7 +2775,7 @@ sub evaluate_expression( $$$$ ) {
|
||||
exists $capdesc{$var} ? have_capability( $var ) : '' );
|
||||
}
|
||||
|
||||
$expression = join_parts( $first, $val, $rest );
|
||||
$expression = join_parts( $first, $val, $rest, $just_expand );
|
||||
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
|
||||
}
|
||||
|
||||
@@ -2779,8 +2785,8 @@ sub evaluate_expression( $$$$ ) {
|
||||
my ( $first, $var, $rest ) = ( $1, $3, $4);
|
||||
$var = numeric_value( $var ) if $var =~ /^\d/;
|
||||
$val = $var ? $actparams{$var} : $chain;
|
||||
$usedcaller = USEDCALLER if $var eq 'caller';
|
||||
$expression = join_parts( $first, $val, $rest );
|
||||
$usedcaller = USEDCALLER if $var =~ /^(?:caller|callfile|callline)$/;
|
||||
$expression = join_parts( $first, $val, $rest , $just_expand );
|
||||
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
|
||||
}
|
||||
}
|
||||
@@ -2815,7 +2821,6 @@ sub evaluate_expression( $$$$ ) {
|
||||
#
|
||||
# Not a simple one-term expression -- compile it
|
||||
#
|
||||
|
||||
declare_passed unless $evals++;
|
||||
|
||||
$val = eval qq(package Shorewall::User;
|
||||
@@ -2832,6 +2837,7 @@ sub evaluate_expression( $$$$ ) {
|
||||
$val;
|
||||
}
|
||||
|
||||
sub pop_open();
|
||||
#
|
||||
# Set callback
|
||||
#
|
||||
@@ -2839,6 +2845,40 @@ sub directive_callback( $ ) {
|
||||
$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
|
||||
#
|
||||
@@ -2852,7 +2892,8 @@ sub process_compiler_directive( $$$$ ) {
|
||||
|
||||
print "CD===> $line\n" if $debug;
|
||||
|
||||
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+)(.*)$/i;
|
||||
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;
|
||||
|
||||
my ($keyword, $expression) = ( uc $1, $2 );
|
||||
|
||||
@@ -2954,15 +2995,16 @@ sub process_compiler_directive( $$$$ ) {
|
||||
$var = $2 || 'chain';
|
||||
directive_error( "Shorewall variables may only be RESET in the body of an action", $filename, $linenumber ) unless $actparams{0};
|
||||
if ( exists $actparams{$var} ) {
|
||||
if ( $var =~ /^loglevel|logtag|chain|disposition|caller$/ ) {
|
||||
if ( $var =~ /^(?:loglevel|logtag|chain|disposition|caller|callfile|callline)$/ ) {
|
||||
$actparams{$var} = '';
|
||||
} else {
|
||||
delete $actparams{$var}
|
||||
}
|
||||
|
||||
$parmsmodified = PARMSMODIFIED if @ifstack > $ifstack;
|
||||
} else {
|
||||
directive_warning( 'Yes', "Shorewall variable $2 does not exist", $filename, $linenumber );
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( exists $variables{$2} ) {
|
||||
delete $variables{$2};
|
||||
@@ -2992,52 +3034,87 @@ sub process_compiler_directive( $$$$ ) {
|
||||
} ,
|
||||
|
||||
ERROR => sub() {
|
||||
directive_error( evaluate_expression( $expression ,
|
||||
$filename ,
|
||||
$linenumber ,
|
||||
1 ) ,
|
||||
$filename ,
|
||||
$linenumber ) unless $omitting;
|
||||
unless ( $omitting ) {
|
||||
if ( $actparams{0} ) {
|
||||
close $currentfile;
|
||||
#
|
||||
# Avoid 'missing ?ENDIF' error in pop_open'
|
||||
#
|
||||
@ifstack = ();
|
||||
#
|
||||
# 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() {
|
||||
directive_warning( $config{VERBOSE_MESSAGES} ,
|
||||
evaluate_expression( $expression ,
|
||||
$filename ,
|
||||
$linenumber ,
|
||||
1 ),
|
||||
directive_message( &directive_warning ,
|
||||
$config{VERBOSE_MESSAGES},
|
||||
$expression ,
|
||||
$filename ,
|
||||
$linenumber ) unless $omitting;
|
||||
$linenumber );
|
||||
} ,
|
||||
|
||||
INFO => sub() {
|
||||
directive_info( $config{VERBOSE_MESSAGES} ,
|
||||
evaluate_expression( $expression ,
|
||||
$filename ,
|
||||
$linenumber ,
|
||||
1 ),
|
||||
$filename ,
|
||||
$linenumber ) unless $omitting;
|
||||
directive_message( &directive_info,
|
||||
$config{VERBOSE_MESSAGES} ,
|
||||
$expression ,
|
||||
$filename ,
|
||||
$linenumber );
|
||||
} ,
|
||||
|
||||
'WARNING!' => sub() {
|
||||
directive_warning( ! $config{VERBOSE_MESSAGES} ,
|
||||
evaluate_expression( $expression ,
|
||||
$filename ,
|
||||
$linenumber ,
|
||||
1 ),
|
||||
directive_message( &directive_warning ,
|
||||
! $config{VERBOSE_MESSAGES} ,
|
||||
$expression ,
|
||||
$filename ,
|
||||
$linenumber ) unless $omitting;
|
||||
$linenumber );
|
||||
} ,
|
||||
|
||||
'INFO!' => sub() {
|
||||
directive_info( ! $config{VERBOSE_MESSAGES} ,
|
||||
evaluate_expression( $expression ,
|
||||
$filename ,
|
||||
$linenumber ,
|
||||
1 ),
|
||||
$filename ,
|
||||
$linenumber ) unless $omitting;
|
||||
directive_message( &directive_info ,
|
||||
! $config{VERBOSE_MESSAGES} ,
|
||||
$expression ,
|
||||
$filename ,
|
||||
$linenumber );
|
||||
} ,
|
||||
|
||||
REQUIRE => sub() {
|
||||
unless ( $omitting ) {
|
||||
fatal_error "?REQUIRE may only be used within action files" unless $actparams{0};
|
||||
fatal_error "Unknown capability ($expression)" unless ( my $capdesc = $capdesc{$expression} );
|
||||
unless ( have_capability( $expression ) ) {
|
||||
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} );
|
||||
}
|
||||
}
|
||||
} ,
|
||||
|
||||
);
|
||||
@@ -3538,6 +3615,8 @@ sub push_action_params( $$$$$$ ) {
|
||||
$actparams{loglevel} = $loglevel;
|
||||
$actparams{logtag} = $logtag;
|
||||
$actparams{caller} = $caller;
|
||||
$actparams{callfile} = $currentfilename;
|
||||
$actparams{callline} = $currentlinenumber;
|
||||
$actparams{disposition} = '' if $chainref->{action};
|
||||
#
|
||||
# The Shorewall variable '@chain' has non-word characters other than hyphen removed
|
||||
@@ -3668,6 +3747,7 @@ sub expand_variables( \$ ) {
|
||||
$usedcaller = USEDCALLER if $var eq 'caller';
|
||||
} else {
|
||||
fatal_error "Undefined shell variable (\$$var)" unless $config{IGNOREUNKNOWNVARIABLES} || exists $config{$var};
|
||||
$val = $config{$var};
|
||||
}
|
||||
|
||||
$val = '' unless defined $val;
|
||||
@@ -3753,7 +3833,7 @@ sub read_a_line($) {
|
||||
#
|
||||
# Handle directives
|
||||
#
|
||||
if ( /^\s*\?(?:IF|ELSE|ELSIF|ENDIF|SET|RESET|FORMAT|COMMENT|ERROR|WARNING|INFO)/i ) {
|
||||
if ( /^\s*\?(?:IF|ELSE|ELSIF|ENDIF|SET|RESET|FORMAT|COMMENT|ERROR|WARNING|INFO|REQUIRE)/i ) {
|
||||
$omitting = process_compiler_directive( $omitting, $_, $currentfilename, $. );
|
||||
next;
|
||||
}
|
||||
@@ -3969,7 +4049,7 @@ sub make_mask( $ ) {
|
||||
0xffffffff >> ( 32 - $_[0] );
|
||||
}
|
||||
|
||||
my @suffixes = qw(group range threshold nlgroup cprange qthreshold);
|
||||
my @suffixes;
|
||||
|
||||
#
|
||||
# Validate a log level -- Drop the trailing '!' and translate to numeric value if appropriate"
|
||||
@@ -4741,6 +4821,10 @@ sub NFLog_Target() {
|
||||
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() {
|
||||
qt1( "$iptables $iptablesw -A $sillyname -j LOGMARK" );
|
||||
}
|
||||
@@ -4916,6 +5000,7 @@ our %detect_capability =
|
||||
LOG_TARGET => \&Log_Target,
|
||||
ULOG_TARGET => \&Ulog_Target,
|
||||
NFLOG_TARGET => \&NFLog_Target,
|
||||
NFLOG_SIZE => \&NFLog_Size,
|
||||
MANGLE_ENABLED => \&Mangle_Enabled,
|
||||
MANGLE_FORWARD => \&Mangle_Forward,
|
||||
MARK => \&Mark,
|
||||
@@ -5109,6 +5194,7 @@ sub determine_capabilities() {
|
||||
$capabilities{TCPMSS_TARGET} = detect_capability( 'TCPMSS_TARGET' );
|
||||
$capabilities{CPU_FANOUT} = detect_capability( 'CPU_FANOUT' );
|
||||
$capabilities{NETMAP_TARGET} = detect_capability( 'NETMAP_TARGET' );
|
||||
$capabilities{NFLOG_SIZE} = detect_capability( 'NFLOG_SIZE' );
|
||||
|
||||
unless ( have_capability 'CT_TARGET' ) {
|
||||
$capabilities{HELPER_MATCH} = detect_capability 'HELPER_MATCH';
|
||||
@@ -5279,11 +5365,24 @@ sub update_config_file( $ ) {
|
||||
}
|
||||
|
||||
update_default( 'USE_DEFAULT_RT', 'No' );
|
||||
update_default( 'EXPORTMODULES', 'No' );
|
||||
update_default( 'RESTART', 'reload' );
|
||||
update_default( 'PAGER', $shorewallrc1{DEFAULT_PAGER} );
|
||||
update_default( 'LOGFORMAT', 'Shorewall:%s:%s:' );
|
||||
update_default( 'LOGLIMIT', '' );
|
||||
|
||||
if ( $config{USE_DEFAULT_RT} eq '' || $config{USE_DEFAULT_RT} =~ /^no$/i ) {
|
||||
update_default( 'BALANCE_PROVIDERS', 'No' );
|
||||
} else {
|
||||
update_default( 'BALANCE_PROVIDERS', 'Yes' );
|
||||
}
|
||||
|
||||
update_default( 'EXPORTMODULES', 'No' );
|
||||
update_default( 'RESTART', 'reload' );
|
||||
update_default( 'PAGER', $shorewallrc1{DEFAULT_PAGER} );
|
||||
update_default( 'LOGFORMAT', 'Shorewall:%s:%s:' );
|
||||
update_default( 'LOGLIMIT', '' );
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
update_default( 'BLACKLIST_DEFAULT', 'dropBcasts,dropNotSyn,dropInvalid' );
|
||||
} else {
|
||||
update_default( 'BLACKLIST_DEFAULT', 'AllowICMPs,dropBcasts,dropNotSyn,dropInvalid' );
|
||||
}
|
||||
|
||||
my $fn;
|
||||
|
||||
@@ -5334,8 +5433,12 @@ sub update_config_file( $ ) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$val = conditional_quote $val;
|
||||
if ( supplied $val ) {
|
||||
#
|
||||
# Log LEVEL and DEFAULT settings often contain parens
|
||||
#
|
||||
$val = ($var =~ /(?:LEVEL|DEFAULT)$/) ? qq("$val") : conditional_quote $val;
|
||||
}
|
||||
|
||||
$_ = "$var=$val\n";
|
||||
}
|
||||
@@ -5398,6 +5501,7 @@ EOF
|
||||
sub process_shorewall_conf( $$ ) {
|
||||
my ( $update, $annotate ) = @_;
|
||||
my $file = find_file "$product.conf";
|
||||
my @vars;
|
||||
|
||||
if ( -f $file ) {
|
||||
$globals{CONFIGDIR} = $configfile = $file;
|
||||
@@ -5411,7 +5515,7 @@ sub process_shorewall_conf( $$ ) {
|
||||
# Don't expand shell variables or allow embedded scripting
|
||||
#
|
||||
while ( read_a_line( STRIP_COMMENTS | SUPPRESS_WHITESPACE | CHECK_GUNK ) ) {
|
||||
if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*?)\s*$/ ) {
|
||||
if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*)$/ ) {
|
||||
my ($var, $val) = ($1, $2);
|
||||
|
||||
if ( exists $config{$var} ) {
|
||||
@@ -5430,6 +5534,12 @@ sub process_shorewall_conf( $$ ) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
push @vars, $var;
|
||||
} else {
|
||||
expand_variables( $val ) unless $val =~ /^'.*'$/;
|
||||
}
|
||||
|
||||
$config{$var} = ( $val =~ /\"([^\"]*)\"$/ ? $1 : $val );
|
||||
|
||||
warning_message "Option $var=$val is deprecated"
|
||||
@@ -5450,14 +5560,19 @@ sub process_shorewall_conf( $$ ) {
|
||||
#
|
||||
# Now update the config file if asked
|
||||
#
|
||||
update_config_file( $annotate ) if $update;
|
||||
#
|
||||
# Config file update requires that the option values not have
|
||||
# Shell variables expanded. We do that now.
|
||||
#
|
||||
for ( values %config ) {
|
||||
if ( supplied $_ ) {
|
||||
expand_variables( $_ ) unless /^'(.+)'$/;
|
||||
if ( $update ) {
|
||||
update_config_file( $annotate );
|
||||
#
|
||||
# Config file update requires that the option values not have
|
||||
# Shell variables expanded. We do that now.
|
||||
#
|
||||
# To handle options like LOG_LEVEL, we process the options
|
||||
# in the order in which they appear in the .conf file.
|
||||
#
|
||||
for ( @vars ) {
|
||||
if ( supplied( my $val = $config{$_} ) ) {
|
||||
expand_variables( $config{$_} ) unless $val =~ /^'.*'$/;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6286,6 +6401,18 @@ sub get_configuration( $$$$ ) {
|
||||
default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes';
|
||||
default_yes_no 'AUTOMAKE' , '';
|
||||
default_yes_no 'TRACK_PROVIDERS' , '';
|
||||
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)$/ ) {
|
||||
default_yes_no( 'NULL_ROUTE_RFC1918', '' );
|
||||
@@ -6302,6 +6429,8 @@ sub get_configuration( $$$$ ) {
|
||||
$config{ACCOUNTING_TABLE} = 'filter';
|
||||
}
|
||||
|
||||
my %variables = ( SW_DBL_IPSET => '', SW_DBL_TIMEOUT => 0 );
|
||||
|
||||
if ( supplied( $val = $config{DYNAMIC_BLACKLIST} ) ) {
|
||||
if ( $val =~ /^ipset/ ) {
|
||||
my %simple_options = ( 'src-dst' => 1, 'disconnect' => 1 );
|
||||
@@ -6342,6 +6471,9 @@ sub get_configuration( $$$$ ) {
|
||||
|
||||
require_capability( 'IPSET_V5', 'DYNAMIC_BLACKLIST=ipset...', 's' );
|
||||
|
||||
$variables{SW_DBL_IPSET} = $set;
|
||||
$variables{SW_DBL_TIMEOUT} = $globals{DBL_TIMEOUT};
|
||||
|
||||
} else {
|
||||
default_yes_no( 'DYNAMIC_BLACKLIST', 'Yes' );
|
||||
}
|
||||
@@ -6349,6 +6481,8 @@ sub get_configuration( $$$$ ) {
|
||||
default_yes_no( 'DYNAMIC_BLACKLIST', 'Yes' );
|
||||
}
|
||||
|
||||
add_variables( %variables );
|
||||
|
||||
default_yes_no 'REQUIRE_INTERFACE' , '';
|
||||
default_yes_no 'FORWARD_CLEAR_MARK' , have_capability( 'MARK' ) ? 'Yes' : '';
|
||||
default_yes_no 'COMPLETE' , '';
|
||||
@@ -6446,6 +6580,12 @@ sub get_configuration( $$$$ ) {
|
||||
default_log_level 'INVALID_LOG_LEVEL', '';
|
||||
default_log_level 'UNTRACKED_LOG_LEVEL', '';
|
||||
|
||||
if ( supplied( $val = $config{LOG_LEVEL} ) ) {
|
||||
validate_level( $val );
|
||||
} else {
|
||||
$config{LOG_LEVEL} = 'info';
|
||||
}
|
||||
|
||||
if ( supplied( $val = $config{LOG_BACKEND} ) ) {
|
||||
if ( $family == F_IPV4 && $val eq 'ULOG' ) {
|
||||
$val = 'ipt_ULOG';
|
||||
@@ -6614,13 +6754,16 @@ sub get_configuration( $$$$ ) {
|
||||
}
|
||||
|
||||
default 'RESTOREFILE' , 'restore';
|
||||
default 'DROP_DEFAULT' , 'Drop';
|
||||
default 'REJECT_DEFAULT' , 'Reject';
|
||||
|
||||
default 'DROP_DEFAULT' , 'none';
|
||||
|
||||
default 'REJECT_DEFAULT' , 'none';
|
||||
default 'BLACKLIST_DEFAULT' , 'none';
|
||||
default 'QUEUE_DEFAULT' , 'none';
|
||||
default 'NFQUEUE_DEFAULT' , 'none';
|
||||
default 'ACCEPT_DEFAULT' , 'none';
|
||||
|
||||
for my $default ( qw/DROP_DEFAULT REJECT_DEFAULT QUEUE_DEFAULT NFQUEUE_DEFAULT ACCEPT_DEFAULT/ ) {
|
||||
for my $default ( qw/DROP_DEFAULT REJECT_DEFAULT BLACKLIST_DEFAULT QUEUE_DEFAULT NFQUEUE_DEFAULT ACCEPT_DEFAULT/ ) {
|
||||
$config{$default} = 'none' if "\L$config{$default}" eq 'none';
|
||||
}
|
||||
|
||||
|
@@ -63,7 +63,6 @@ our @EXPORT = ( qw( ALLIPv4
|
||||
validate_host
|
||||
validate_range
|
||||
ip_range_explicit
|
||||
expand_port_range
|
||||
allipv4
|
||||
allipv6
|
||||
allip
|
||||
@@ -74,10 +73,6 @@ our @EXPORT = ( qw( ALLIPv4
|
||||
resolve_proto
|
||||
resolve_dnsname
|
||||
proto_name
|
||||
validate_port
|
||||
validate_portpair
|
||||
validate_portpair1
|
||||
validate_port_list
|
||||
validate_icmp
|
||||
validate_icmp6
|
||||
) );
|
||||
@@ -389,6 +384,8 @@ sub resolve_proto( $ ) {
|
||||
my $proto = $_[0];
|
||||
my $number;
|
||||
|
||||
$proto =~ s/:.*//;
|
||||
|
||||
if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) {
|
||||
$number = numeric_value ( $proto );
|
||||
defined $number && $number <= 255 ? $number : undef;
|
||||
@@ -409,114 +406,6 @@ sub proto_name( $ ) {
|
||||
$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',
|
||||
'echo-reply' => 0,
|
||||
'destination-unreachable' => 3,
|
||||
@@ -570,67 +459,6 @@ sub validate_icmp( $ ) {
|
||||
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( $ ) {
|
||||
my $address = $_[0];
|
||||
|
||||
|
@@ -127,7 +127,7 @@ sub setup_ecn()
|
||||
}
|
||||
|
||||
if ( @hosts ) {
|
||||
my @interfaces = ( sort { interface_number($a) <=> interface_number($b) } keys %interfaces );
|
||||
my @interfaces = ( keys %interfaces );
|
||||
|
||||
progress_message "$doing ECN control on @interfaces...";
|
||||
|
||||
@@ -1213,55 +1213,53 @@ sub add_common_rules ( $ ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
my $announced = 0;
|
||||
my $announced = 0;
|
||||
|
||||
$list = find_interfaces_by_option 'upnp';
|
||||
$list = find_interfaces_by_option 'upnp';
|
||||
|
||||
if ( @$list ) {
|
||||
progress_message2 "$doing UPnP";
|
||||
if ( @$list ) {
|
||||
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} ) {
|
||||
$chainref1 = set_optflags( new_nat_chain( 'MINIUPNPD-POSTROUTING' ), DONT_OPTIMIZE );
|
||||
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;
|
||||
}
|
||||
if ( $config{MINIUPNPD} ) {
|
||||
$chainref1 = set_optflags( new_nat_chain( 'MINIUPNPD-POSTROUTING' ), DONT_OPTIMIZE );
|
||||
add_commands( $chainref, '[ -s /${VARDIR}/.MINIUPNPD-POSTROUTING ] && cat ${VARDIR}/.MINIUPNPD-POSTROUTING >&3' );
|
||||
}
|
||||
|
||||
$list = find_interfaces_by_option 'upnpclient';
|
||||
$announced = 1;
|
||||
|
||||
if ( @$list ) {
|
||||
progress_message2 "$doing UPnP" unless $announced;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
$list = find_interfaces_by_option 'upnpclient';
|
||||
|
||||
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' );
|
||||
}
|
||||
if ( @$list ) {
|
||||
progress_message2 "$doing UPnP" unless $announced;
|
||||
|
||||
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 ( $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' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1297,7 +1295,7 @@ sub setup_mac_lists( $ ) {
|
||||
$maclist_interfaces{ $hostref->[0] } = 1;
|
||||
}
|
||||
|
||||
my @maclist_interfaces = ( sort keys %maclist_interfaces );
|
||||
my @maclist_interfaces = ( keys %maclist_interfaces );
|
||||
|
||||
if ( $phase == 1 ) {
|
||||
|
||||
@@ -1618,7 +1616,7 @@ sub handle_loopback_traffic() {
|
||||
# Handle conntrack rules
|
||||
#
|
||||
if ( $notrackref->{referenced} ) {
|
||||
for my $hostref ( sort { $a->{type} cmp $b->{type} } @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
|
||||
for my $hostref ( @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
|
||||
my $exclusion = source_exclusion( $hostref->{exclusions}, $notrackref);
|
||||
my @ipsec_match = match_ipsec_in $z1 , $hostref;
|
||||
|
||||
@@ -1639,8 +1637,8 @@ sub handle_loopback_traffic() {
|
||||
#
|
||||
my $source_hosts_ref = defined_zone( $z1 )->{hosts};
|
||||
|
||||
for my $typeref ( sort { $a->{type} cmp $b->{type} } values %{$source_hosts_ref} ) {
|
||||
for my $hostref ( sort { $a->{type} cmp $b->{type} } @{$typeref->{'%vserver%'}} ) {
|
||||
for my $typeref ( values %{$source_hosts_ref} ) {
|
||||
for my $hostref ( @{$typeref->{'%vserver%'}} ) {
|
||||
my $exclusion = source_exclusion( $hostref->{exclusions}, $natref);
|
||||
|
||||
for my $net ( @{$hostref->{hosts}} ) {
|
||||
@@ -1662,7 +1660,7 @@ sub add_interface_jumps {
|
||||
our %input_jump_added;
|
||||
our %output_jump_added;
|
||||
our %forward_jump_added;
|
||||
my @interfaces = sort grep $_ ne '%vserver%', @_;
|
||||
my @interfaces = grep $_ ne '%vserver%', @_;
|
||||
my $dummy;
|
||||
my $lo_jump_added = interface_zone( loopback_interface ) && ! get_interface_option( loopback_interface, 'destonly' );
|
||||
#
|
||||
@@ -1776,7 +1774,7 @@ sub handle_complex_zone( $$ ) {
|
||||
my $type = $zoneref->{type};
|
||||
my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {};
|
||||
|
||||
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$source_ref ) {
|
||||
for my $interface ( keys %$source_ref ) {
|
||||
my $sourcechainref = $filter_table->{forward_chain $interface};
|
||||
my @interfacematch;
|
||||
my $interfaceref = find_interface $interface;
|
||||
@@ -2288,9 +2286,9 @@ sub generate_matrix() {
|
||||
#
|
||||
# Take care of PREROUTING, INPUT and OUTPUT jumps
|
||||
#
|
||||
for my $type ( sort keys %$source_hosts_ref ) {
|
||||
for my $type ( keys %$source_hosts_ref ) {
|
||||
my $typeref = $source_hosts_ref->{$type};
|
||||
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) {
|
||||
for my $interface ( keys %$typeref ) {
|
||||
if ( get_physical( $interface ) eq '+' ) {
|
||||
#
|
||||
# Insert the interface-specific jumps before this one which is not interface-specific
|
||||
@@ -2375,9 +2373,9 @@ sub generate_matrix() {
|
||||
|
||||
my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT
|
||||
|
||||
for my $type ( sort keys %{$zone1ref->{hosts}} ) {
|
||||
for my $type ( keys %{$zone1ref->{hosts}} ) {
|
||||
my $typeref = $zone1ref->{hosts}{$type};
|
||||
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) {
|
||||
for my $interface ( keys %$typeref ) {
|
||||
for my $hostref ( @{$typeref->{$interface}} ) {
|
||||
next if $hostref->{options}{sourceonly};
|
||||
if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) {
|
||||
|
@@ -64,6 +64,8 @@ our @load_interfaces;
|
||||
|
||||
our $balancing;
|
||||
our $fallback;
|
||||
our $balanced_providers;
|
||||
our $fallback_providers;
|
||||
our $metrics;
|
||||
our $first_default_route;
|
||||
our $first_fallback_route;
|
||||
@@ -99,6 +101,8 @@ sub initialize( $ ) {
|
||||
%provider_interfaces = ();
|
||||
@load_interfaces = ();
|
||||
$balancing = 0;
|
||||
$balanced_providers = 0;
|
||||
$fallback_providers = 0;
|
||||
$fallback = 0;
|
||||
$metrics = 0;
|
||||
$first_default_route = 1;
|
||||
@@ -323,7 +327,13 @@ sub balance_default_route( $$$$ ) {
|
||||
emit '';
|
||||
|
||||
if ( $first_default_route ) {
|
||||
if ( $gateway ) {
|
||||
if ( $balanced_providers == 1 ) {
|
||||
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\"";
|
||||
} else {
|
||||
emit "DEFAULT_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
||||
@@ -347,7 +357,13 @@ sub balance_fallback_route( $$$$ ) {
|
||||
emit '';
|
||||
|
||||
if ( $first_fallback_route ) {
|
||||
if ( $gateway ) {
|
||||
if ( $fallback_providers == 1 ) {
|
||||
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\"";
|
||||
} else {
|
||||
emit "FALLBACK_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
||||
@@ -519,11 +535,11 @@ sub process_a_provider( $ ) {
|
||||
my ( $loose, $track, $balance, $default, $default_balance, $optional, $mtu, $tproxy, $local, $load, $what, $hostroute, $persistent );
|
||||
|
||||
if ( $pseudo ) {
|
||||
( $loose, $track, $balance , $default, $default_balance, $optional, $mtu, $tproxy , $local, $load, $what , $hostroute, $persistent ) =
|
||||
( 0, 0 , 0 , 0, 0, 1 , '' , 0 , 0, 0, 'interface', 0, 0);
|
||||
( $loose, $track, $balance , $default, $default_balance, $optional, $mtu, $tproxy , $local, $load, $what , $hostroute, $persistent ) =
|
||||
( 0, 0 , 0 , 0, 0, 1 , '' , 0 , 0, 0, 'interface', 0, 0);
|
||||
} else {
|
||||
( $loose, $track, $balance , $default, $default_balance, $optional, $mtu, $tproxy , $local, $load, $what , $hostroute, $persistent )=
|
||||
( 0, $config{TRACK_PROVIDERS}, 0 , 0, $config{USE_DEFAULT_RT} ? 1 : 0, interface_is_optional( $interface ), '' , 0 , 0, 0, 'provider', 1, 0);
|
||||
( $loose, $track, $balance , $default, $default_balance, $optional, $mtu, $tproxy , $local, $load, $what , $hostroute, $persistent )=
|
||||
( 0, $config{TRACK_PROVIDERS}, 0 , 0, $config{BALANCE_PROVIDERS} ? 1 : 0, interface_is_optional( $interface ), '' , 0 , 0, 0, 'provider', 1, 0);
|
||||
}
|
||||
|
||||
unless ( $options eq '-' ) {
|
||||
@@ -593,7 +609,12 @@ sub process_a_provider( $ ) {
|
||||
}
|
||||
}
|
||||
|
||||
fatal_error q(The 'balance' and 'fallback' options are mutually exclusive) if $balance && $default;
|
||||
if ( $balance ) {
|
||||
fatal_error q(The 'balance' and 'fallback' options are mutually exclusive) if $default;
|
||||
$balanced_providers++;
|
||||
} elsif ( $default ) {
|
||||
$fallback_providers++;
|
||||
}
|
||||
|
||||
if ( $load ) {
|
||||
fatal_error q(The 'balance=<weight>' and 'load=<load-factor>' options are mutually exclusive) if $balance > 1;
|
||||
@@ -603,19 +624,37 @@ sub process_a_provider( $ ) {
|
||||
|
||||
fatal_error "A provider interface must have at least one associated zone" unless $tproxy || %{interface_zones($interface)};
|
||||
|
||||
if ( $local ) {
|
||||
fatal_error "GATEWAY not valid with 'local' provider" unless $gatewaycase eq 'omitted';
|
||||
fatal_error "'track' not valid with 'local'" if $track;
|
||||
fatal_error "DUPLICATE not valid with 'local'" if $duplicate ne '-';
|
||||
fatal_error "'persistent' is not valid with 'local" if $persistent;
|
||||
} elsif ( $tproxy ) {
|
||||
fatal_error "Only one 'tproxy' provider is allowed" if $tproxies++;
|
||||
fatal_error "GATEWAY not valid with 'tproxy' provider" unless $gatewaycase eq 'omitted';
|
||||
fatal_error "'track' not valid with 'tproxy'" if $track;
|
||||
fatal_error "DUPLICATE not valid with 'tproxy'" if $duplicate ne '-';
|
||||
fatal_error "MARK not allowed with 'tproxy'" if $mark ne '-';
|
||||
fatal_error "'persistent' is not valid with 'tproxy" if $persistent;
|
||||
$mark = $globals{TPROXY_MARK};
|
||||
unless ( $pseudo ) {
|
||||
if ( $local ) {
|
||||
fatal_error "GATEWAY not valid with 'local' provider" unless $gatewaycase eq 'omitted';
|
||||
fatal_error "'track' not valid with 'local'" if $track;
|
||||
fatal_error "DUPLICATE not valid with 'local'" if $duplicate ne '-';
|
||||
fatal_error "'persistent' is not valid with 'local" if $persistent;
|
||||
} elsif ( $tproxy ) {
|
||||
fatal_error "Only one 'tproxy' provider is allowed" if $tproxies++;
|
||||
fatal_error "GATEWAY not valid with 'tproxy' provider" unless $gatewaycase eq 'omitted';
|
||||
fatal_error "'track' not valid with 'tproxy'" if $track;
|
||||
fatal_error "DUPLICATE not valid with 'tproxy'" if $duplicate ne '-';
|
||||
fatal_error "MARK not allowed with 'tproxy'" if $mark ne '-';
|
||||
fatal_error "'persistent' is not valid with 'tproxy" if $persistent;
|
||||
$mark = $globals{TPROXY_MARK};
|
||||
} elsif ( ( my $rf = ( $config{ROUTE_FILTER} eq 'on' ) ) || $interfaceref->{options}{routefilter} ) {
|
||||
if ( $config{USE_DEFAULT_RT} ) {
|
||||
if ( $rf ) {
|
||||
fatal_error "There may be no providers when ROUTE_FILTER=Yes and USE_DEFAULT_RT=Yes";
|
||||
} else {
|
||||
fatal_error "Providers interfaces may not specify 'routefilter' when USE_DEFAULT_RT=Yes";
|
||||
}
|
||||
} else {
|
||||
unless ( $balance ) {
|
||||
if ( $rf ) {
|
||||
fatal_error "The 'balance' option is required when ROUTE_FILTER=Yes";
|
||||
} else {
|
||||
fatal_error "Provider interfaces may not specify 'routefilter' without 'balance' or 'primary'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $val = 0;
|
||||
@@ -1516,9 +1555,9 @@ sub finish_providers() {
|
||||
} else {
|
||||
emit ( " if echo \$DEFAULT_ROUTE | grep -q 'nexthop.+nexthop'; then",
|
||||
" qt \$IP -6 route delete default scope global table $table \$DEFAULT_ROUTE",
|
||||
" run_ip -6 route add default scope global table $table \$DEFAULT_ROUTE",
|
||||
" run_ip route add default scope global table $table \$DEFAULT_ROUTE",
|
||||
' else',
|
||||
" run_ip -6 route replace default scope global table $table \$DEFAULT_ROUTE",
|
||||
" run_ip route replace default scope global table $table \$DEFAULT_ROUTE",
|
||||
' fi',
|
||||
'' );
|
||||
}
|
||||
@@ -1781,7 +1820,7 @@ sub map_provider_to_interface() {
|
||||
|
||||
my $haveoptional;
|
||||
|
||||
for my $providerref ( sort { $a->{number} cmp $b->{number} } values %providers ) {
|
||||
for my $providerref ( values %providers ) {
|
||||
if ( $providerref->{optional} ) {
|
||||
unless ( $haveoptional++ ) {
|
||||
emit( 'if [ -n "$interface" ]; then',
|
||||
@@ -1945,7 +1984,7 @@ sub compile_updown() {
|
||||
}
|
||||
|
||||
my @nonshared = ( grep $providers{$_}->{optional},
|
||||
sort( { $providers{$a}->{number} <=> $providers{$b}->{number} } values %provider_interfaces ) );
|
||||
values %provider_interfaces );
|
||||
|
||||
if ( @nonshared ) {
|
||||
my $interfaces = join( '|', map $providers{$_}->{physical}, @nonshared );
|
||||
@@ -2140,7 +2179,7 @@ sub handle_optional_interfaces( $ ) {
|
||||
# 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.
|
||||
#
|
||||
for my $providerref ( grep $_->{optional} , sort { $a->{number} <=> $b->{number} } values %providers ) {
|
||||
for my $providerref ( grep $_->{optional} , values %providers ) {
|
||||
push @interfaces, $providerref->{interface};
|
||||
$wildcards ||= $providerref->{wildcard};
|
||||
}
|
||||
|
@@ -154,7 +154,7 @@ sub setup_proxy_arp() {
|
||||
|
||||
emit '';
|
||||
|
||||
for my $interface ( sort keys %reset ) {
|
||||
for my $interface ( keys %reset ) {
|
||||
unless ( $set{interface} ) {
|
||||
my $physical = get_physical $interface;
|
||||
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
|
||||
@@ -163,7 +163,7 @@ sub setup_proxy_arp() {
|
||||
}
|
||||
}
|
||||
|
||||
for my $interface ( sort keys %set ) {
|
||||
for my $interface ( keys %set ) {
|
||||
my $physical = get_physical $interface;
|
||||
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
|
||||
" echo 1 > /proc/sys/net/ipv$family/conf/$physical/$proc_file" );
|
||||
|
@@ -138,14 +138,12 @@ our %section_rmap = ( ALL_SECTION , 'ALL',
|
||||
|
||||
our @policy_chains;
|
||||
|
||||
our %default_actions;
|
||||
our %policy_actions;
|
||||
|
||||
our %macros;
|
||||
|
||||
our $family;
|
||||
|
||||
our @builtins;
|
||||
|
||||
#
|
||||
# Commands that can be embedded in a basic rule and how many total tokens on the line (0 => unlimited).
|
||||
#
|
||||
@@ -233,6 +231,7 @@ use constant { INLINE_OPT => 1 ,
|
||||
TERMINATING_OPT => 256 ,
|
||||
AUDIT_OPT => 512 ,
|
||||
LOGJUMP_OPT => 1024 ,
|
||||
SECTION_OPT => 2048 ,
|
||||
};
|
||||
|
||||
our %options = ( inline => INLINE_OPT ,
|
||||
@@ -246,6 +245,7 @@ our %options = ( inline => INLINE_OPT ,
|
||||
terminating => TERMINATING_OPT ,
|
||||
audit => AUDIT_OPT ,
|
||||
logjump => LOGJUMP_OPT ,
|
||||
section => SECTION_OPT ,
|
||||
);
|
||||
|
||||
our %reject_options;
|
||||
@@ -309,11 +309,14 @@ sub initialize( $ ) {
|
||||
# This is updated from the *_DEFAULT settings in shorewall.conf. Those settings were stored
|
||||
# in the %config hash when shorewall[6].conf was processed.
|
||||
#
|
||||
%default_actions = ( DROP => 'none' ,
|
||||
REJECT => 'none' ,
|
||||
ACCEPT => 'none' ,
|
||||
QUEUE => 'none' ,
|
||||
NFQUEUE => 'none' ,
|
||||
%policy_actions = ( DROP => [] ,
|
||||
REJECT => [] ,
|
||||
BLACKLIST => [] ,
|
||||
ACCEPT => [] ,
|
||||
QUEUE => [] ,
|
||||
NFQUEUE => [] ,
|
||||
CONTINUE => [] ,
|
||||
NONE => [] ,
|
||||
);
|
||||
#
|
||||
# These are set to 1 as sections are encountered.
|
||||
@@ -347,7 +350,7 @@ sub initialize( $ ) {
|
||||
#
|
||||
$macro_nest_level = 0;
|
||||
#
|
||||
# All builtin actions plus those mentioned in /etc/shorewall[6]/actions and /usr/share/shorewall[6]/actions.std
|
||||
# All actions mentioned in /etc/shorewall[6]/actions and /usr/share/shorewall[6]/actions.std
|
||||
#
|
||||
%actions = ();
|
||||
#
|
||||
@@ -358,7 +361,6 @@ sub initialize( $ ) {
|
||||
@columns = ( ( '-' ) x LAST_COLUMN, 0 );
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
@builtins = qw/dropBcast allowBcast dropNotSyn rejNotSyn allowinUPnP forwardUPnP Limit/;
|
||||
%reject_options = ( 'icmp-net-unreachable' => 1,
|
||||
'icmp-host-unreachable' => 1,
|
||||
'icmp-port-unreachable' => 1,
|
||||
@@ -367,10 +369,10 @@ sub initialize( $ ) {
|
||||
'icmp-host-prohibited' => 1,
|
||||
'icmp-admin-prohibited' => 1,
|
||||
'icmp-tcp-reset' => 2,
|
||||
'tcp-reset' => 2,
|
||||
);
|
||||
|
||||
} else {
|
||||
@builtins = qw/dropBcast allowBcast dropNotSyn rejNotSyn/;
|
||||
%reject_options = ( 'icmp6-no-route' => 1,
|
||||
'no-route' => 1,
|
||||
'icmp6-adm-prohibited' => 1,
|
||||
@@ -427,6 +429,7 @@ sub convert_to_policy_chain($$$$$$)
|
||||
$chainref->{audit} = $audit;
|
||||
$chainref->{policychain} = $chainref->{name};
|
||||
$chainref->{policypair} = [ $source, $dest ];
|
||||
$chainref->{pactions} = [];
|
||||
}
|
||||
|
||||
#
|
||||
@@ -476,7 +479,7 @@ sub set_policy_chain($$$$$$)
|
||||
$chainref->{synchain} = $polchainref->{synchain};
|
||||
}
|
||||
|
||||
$chainref->{default} = $polchainref->{default} if defined $polchainref->{default};
|
||||
$chainref->{pactions} = $polchainref->{pactions} || [];
|
||||
$chainref->{is_policy} = 1;
|
||||
push @policy_chains, $chainref;
|
||||
} else {
|
||||
@@ -525,12 +528,12 @@ sub normalize_action( $$$ );
|
||||
sub normalize_action_name( $ );
|
||||
sub normalize_single_action( $ );
|
||||
|
||||
sub process_default_action( $$$$ ) {
|
||||
my ( $originalpolicy, $policy, $default, $level ) = @_;
|
||||
sub process_policy_action( $$$$ ) {
|
||||
my ( $originalpolicy, $policy, $paction, $level ) = @_;
|
||||
|
||||
if ( supplied $default ) {
|
||||
my $default_option = ( $policy =~ /_DEFAULT$/ );
|
||||
my ( $def, $param ) = get_target_param( $default );
|
||||
if ( supplied $paction ) {
|
||||
my $paction_option = ( $policy =~ /_DEFAULT$/ );
|
||||
my ( $act, $param ) = get_target_param( $paction );
|
||||
|
||||
if ( supplied $level ) {
|
||||
validate_level( $level );
|
||||
@@ -538,35 +541,49 @@ sub process_default_action( $$$$ ) {
|
||||
$level = 'none';
|
||||
}
|
||||
|
||||
if ( "\L$default" eq 'none' ) {
|
||||
if ( supplied $param || ( supplied $level && $level ne 'none' ) ) {
|
||||
if ( $default_option ) {
|
||||
fatal_error "Invalid setting ($originalpolicy) for $policy";
|
||||
} else {
|
||||
fatal_error "Invalid policy ($originalpolicy)";
|
||||
}
|
||||
}
|
||||
|
||||
$default = 'none';
|
||||
} elsif ( ( $targets{$def} || 0 ) == ACTION ) {
|
||||
$default = supplied $param ? normalize_action( $def, $level, $param ) :
|
||||
$level eq 'none' ? normalize_action_name $def :
|
||||
normalize_action( $def, $level, '' );
|
||||
} elsif ( ( $targets{$def} || 0 ) == INLINE ) {
|
||||
$default = $def;
|
||||
$default = "$def($param)" if supplied $param;
|
||||
$default = join( ':', $default, $level ) if $level ne 'none';
|
||||
} elsif ( $default_option ) {
|
||||
fatal_error "Unknown Action ($default) in $policy setting";
|
||||
if ( ( $targets{$act} || 0 ) & ACTION ) {
|
||||
$paction = supplied $param ? normalize_action( $act, $level, $param ) :
|
||||
$level eq 'none' ? normalize_action_name $act :
|
||||
normalize_action( $act, $level, '' );
|
||||
} elsif ( ( $targets{$act} || 0 ) == INLINE ) {
|
||||
$paction = $act;
|
||||
$paction = "$act($param)" if supplied $param;
|
||||
$paction = join( ':', $paction, $level ) if $level ne 'none';
|
||||
} elsif ( $paction_option ) {
|
||||
fatal_error "Unknown Action ($paction) in $policy setting";
|
||||
} else {
|
||||
fatal_error "Unknown Default Action ($default)";
|
||||
fatal_error "Unknown Policy Action ($paction)";
|
||||
}
|
||||
|
||||
} else {
|
||||
$default = $default_actions{$policy} || 'none';
|
||||
$paction = $policy_actions{$policy};
|
||||
}
|
||||
|
||||
$default;
|
||||
$paction;
|
||||
}
|
||||
|
||||
sub process_policy_actions( $$$ ) {
|
||||
my ( $originalpolicy, $policy, $pactions ) = @_;
|
||||
|
||||
if ( supplied $pactions ) {
|
||||
my @pactions;
|
||||
|
||||
if ( lc $pactions ne 'none' ) {
|
||||
@pactions = @{$policy_actions{$policy}} if $pactions =~ s/^\+//;
|
||||
|
||||
for my $paction ( split_list3( $pactions, 'Policy Action' ) ) {
|
||||
my ( $action, $level, $remainder ) = split( /:/, $paction, 3 );
|
||||
|
||||
fatal_error "Invalid policy action ($paction:$level:$remainder)" if defined $remainder;
|
||||
|
||||
push @pactions, process_policy_action( $originalpolicy, $policy, $action, $level );
|
||||
}
|
||||
}
|
||||
|
||||
\@pactions;
|
||||
} else {
|
||||
$policy_actions{$policy};
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
@@ -600,7 +617,7 @@ sub handle_nfqueue( $$ ) {
|
||||
fatal_error "Invalid NFQUEUE queue number ($queue1)" unless defined( $queuenum1) && $queuenum1 >= 0 && $queuenum1 <= 65535;
|
||||
|
||||
if ( supplied $queue2 ) {
|
||||
$fanout = ' --queue-cpu-fanout' if $queue2 =~ s/c$//;
|
||||
$fanout = $queue2 =~ s/c$// ? ' --queue-cpu-fanout' : '';
|
||||
$queuenum2 = numeric_value( $queue2 );
|
||||
|
||||
fatal_error "Invalid NFQUEUE queue number ($queue2)" unless defined( $queuenum2) && $queuenum2 >= 0 && $queuenum2 <= 65535 && $queuenum1 < $queuenum2;
|
||||
@@ -654,12 +671,10 @@ sub process_a_policy1($$$$$$$) {
|
||||
|
||||
require_capability 'AUDIT_TARGET', ":audit", "s" if $audit;
|
||||
|
||||
my ( $policy, $default, $level, undef, $remainder ) = split( /:/, $originalpolicy, ACTION_TUPLE_ELEMENTS );
|
||||
my ( $policy, $pactions ) = split( /:/, $originalpolicy, 2 );
|
||||
|
||||
fatal_error "Invalid or missing POLICY ($originalpolicy)" unless $policy;
|
||||
|
||||
fatal_error "Invalid default action ($default:$level:$remainder)" if defined $remainder;
|
||||
|
||||
( $policy , my $queue ) = get_target_param $policy;
|
||||
|
||||
fatal_error "Invalid policy ($policy)" unless exists $validpolicies{$policy};
|
||||
@@ -668,7 +683,7 @@ sub process_a_policy1($$$$$$$) {
|
||||
fatal_error "A $policy policy may not be audited" unless $auditpolicies{$policy};
|
||||
}
|
||||
|
||||
$default = process_default_action( $originalpolicy, $policy, $default, $level );
|
||||
my $pactionref = process_policy_actions( $originalpolicy, $policy, $pactions );
|
||||
|
||||
if ( defined $queue ) {
|
||||
$policy = handle_nfqueue( $queue,
|
||||
@@ -679,6 +694,8 @@ sub process_a_policy1($$$$$$$) {
|
||||
if $clientwild || $serverwild;
|
||||
fatal_error "NONE policy not allowed to/from firewall zone"
|
||||
if ( zone_type( $client ) == FIREWALL ) || ( zone_type( $server ) == FIREWALL );
|
||||
} elsif ( $policy eq 'BLACKLIST' ) {
|
||||
fatal_error 'BLACKLIST policies require ipset-based dynamic blacklisting' unless $config{DYNAMIC_BLACKLIST} =~ /^ipset/;
|
||||
}
|
||||
|
||||
unless ( $clientwild || $serverwild ) {
|
||||
@@ -723,32 +740,28 @@ sub process_a_policy1($$$$$$$) {
|
||||
$chainref->{synchain} = $chain
|
||||
}
|
||||
|
||||
assert( $default );
|
||||
my $chainref1 = $usedactions{$default};
|
||||
$chainref->{default} = $chainref1 ? $chainref1->{name} : $default;
|
||||
|
||||
$chainref->{origin} = shortlineinfo('');
|
||||
$chainref->{pactions} = $pactionref;
|
||||
$chainref->{origin} = shortlineinfo('');
|
||||
|
||||
if ( $clientwild ) {
|
||||
if ( $serverwild ) {
|
||||
for my $zone ( @zonelist ) {
|
||||
for my $zone1 ( @zonelist ) {
|
||||
set_policy_chain rules_chain( ${zone}, ${zone1} ), $client, $server, $chainref, $policy, $intrazone;
|
||||
set_policy_chain rules_chain( ${zone}, ${zone1} ), $zone, $zone1, $chainref, $policy, $intrazone;
|
||||
print_policy $zone, $zone1, $originalpolicy, $chain;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for my $zone ( all_zones ) {
|
||||
set_policy_chain rules_chain( ${zone}, ${server} ), $client, $server, $chainref, $policy, $intrazone;
|
||||
set_policy_chain rules_chain( ${zone}, ${server} ), $zone, $server, $chainref, $policy, $intrazone;
|
||||
print_policy $zone, $server, $originalpolicy, $chain;
|
||||
}
|
||||
}
|
||||
} elsif ( $serverwild ) {
|
||||
for my $zone ( @zonelist ) {
|
||||
set_policy_chain rules_chain( ${client}, ${zone} ), $client, $server, $chainref, $policy, $intrazone;
|
||||
set_policy_chain rules_chain( ${client}, ${zone} ), $client, $zone, $chainref, $policy, $intrazone;
|
||||
print_policy $client, $zone, $originalpolicy, $chain;
|
||||
}
|
||||
|
||||
} else {
|
||||
print_policy $client, $server, $originalpolicy, $chain;
|
||||
}
|
||||
@@ -760,7 +773,11 @@ sub process_a_policy() {
|
||||
our @zonelist;
|
||||
|
||||
my ( $clients, $servers, $policy, $loglevel, $synparams, $connlimit ) =
|
||||
split_line 'policy file', { source => 0, dest => 1, policy => 2, loglevel => 3, limit => 4, connlimit => 5 } ;
|
||||
split_line2( 'policy file',
|
||||
{ source => 0, dest => 1, policy => 2, loglevel => 3, limit => 4, rate => 4, connlimit => 5 } ,
|
||||
{} , # nopad
|
||||
6 , # maxcolumns
|
||||
);
|
||||
|
||||
$loglevel = '' if $loglevel eq '-';
|
||||
$synparams = '' if $synparams eq '-';
|
||||
@@ -817,33 +834,35 @@ sub process_policies()
|
||||
our %validpolicies = (
|
||||
ACCEPT => undef,
|
||||
REJECT => undef,
|
||||
DROP => undef,
|
||||
DROP => undef,
|
||||
CONTINUE => undef,
|
||||
BLACKLIST => undef,
|
||||
QUEUE => undef,
|
||||
NFQUEUE => undef,
|
||||
NONE => undef
|
||||
);
|
||||
|
||||
our %map = ( DROP_DEFAULT => 'DROP' ,
|
||||
REJECT_DEFAULT => 'REJECT' ,
|
||||
ACCEPT_DEFAULT => 'ACCEPT' ,
|
||||
QUEUE_DEFAULT => 'QUEUE' ,
|
||||
NFQUEUE_DEFAULT => 'NFQUEUE' );
|
||||
our %map = ( DROP_DEFAULT => 'DROP' ,
|
||||
REJECT_DEFAULT => 'REJECT' ,
|
||||
BLACKLIST_DEFAULT => 'BLACKLIST' ,
|
||||
ACCEPT_DEFAULT => 'ACCEPT' ,
|
||||
QUEUE_DEFAULT => 'QUEUE' ,
|
||||
NFQUEUE_DEFAULT => 'NFQUEUE' );
|
||||
|
||||
my $zone;
|
||||
my $firewall = firewall_zone;
|
||||
our @zonelist = $config{EXPAND_POLICIES} ? all_zones : ( all_zones, 'all' );
|
||||
|
||||
for my $option ( qw( DROP_DEFAULT REJECT_DEFAULT ACCEPT_DEFAULT QUEUE_DEFAULT NFQUEUE_DEFAULT) ) {
|
||||
my $action = $config{$option};
|
||||
for my $option ( qw( DROP_DEFAULT REJECT_DEFAULT BLACKLIST_DEFAULT ACCEPT_DEFAULT QUEUE_DEFAULT NFQUEUE_DEFAULT) ) {
|
||||
my $actions = $config{$option};
|
||||
|
||||
unless ( $action eq 'none' ) {
|
||||
my ( $default, $level, $remainder ) = split( /:/, $action, 3 );
|
||||
fatal_error "Invalid setting ( $action ) for $option" if supplied $remainder;
|
||||
$action = process_default_action( $action, $option, $default, $level );
|
||||
if ( $actions eq 'none' ) {
|
||||
$actions = [];
|
||||
} else {
|
||||
$actions = process_policy_actions( $actions, $option, $actions );
|
||||
}
|
||||
|
||||
$default_actions{$map{$option}} = $action;
|
||||
$policy_actions{$map{$option}} = $actions;
|
||||
}
|
||||
|
||||
for $zone ( all_zones ) {
|
||||
@@ -903,31 +922,36 @@ sub process_policies()
|
||||
sub process_inline ($$$$$$$$$$$$$$$$$$$$$$);
|
||||
|
||||
sub add_policy_rules( $$$$$ ) {
|
||||
my ( $chainref , $target, $loglevel, $default, $dropmulticast ) = @_;
|
||||
my ( $chainref , $target, $loglevel, $pactions, $dropmulticast ) = @_;
|
||||
|
||||
unless ( $target eq 'NONE' ) {
|
||||
my @pactions;
|
||||
|
||||
@pactions = @$pactions;
|
||||
|
||||
add_ijump $chainref, j => 'RETURN', d => '224.0.0.0/4' if $dropmulticast && $target ne 'CONTINUE' && $target ne 'ACCEPT';
|
||||
|
||||
if ( $default && $default ne 'none' ) {
|
||||
my ( $action ) = split ':', $default;
|
||||
for my $paction ( @pactions ) {
|
||||
my ( $action ) = split ':', $paction;
|
||||
|
||||
if ( ( $targets{$action} || 0 ) == ACTION ) {
|
||||
if ( ( $targets{$action} || 0 ) & ACTION ) {
|
||||
#
|
||||
# Default action is a regular action -- jump to the action chain
|
||||
#
|
||||
add_ijump $chainref, j => use_policy_action( $default, $chainref->{name} );
|
||||
add_ijump $chainref, j => use_policy_action( $paction, $chainref->{name} );
|
||||
} else {
|
||||
#
|
||||
# Default action is an inline
|
||||
#
|
||||
( undef, my $level ) = split /:/, $paction, 2;
|
||||
( $action, my $param ) = get_target_param( $action );
|
||||
|
||||
process_inline( $action, #Inline
|
||||
$chainref, #Chain
|
||||
'', #Matches
|
||||
'', #Matches1
|
||||
$loglevel, #Log Level and Tag
|
||||
$default, #Target
|
||||
$level || '', #Log Level and Tag
|
||||
$paction, #Target
|
||||
$param || '', #Param
|
||||
'-', #Source
|
||||
'-', #Dest
|
||||
@@ -951,7 +975,20 @@ sub add_policy_rules( $$$$$ ) {
|
||||
log_rule $loglevel , $chainref , $target , '' if $loglevel ne '';
|
||||
fatal_error "Null target in policy_rules()" unless $target;
|
||||
|
||||
add_ijump( $chainref , j => 'AUDIT', targetopts => '--type ' . lc $target ) if $chainref->{audit};
|
||||
if ( $target eq 'BLACKLIST' ) {
|
||||
my ( $dbl_type, $dbl_ipset, $dbl_level, $dbl_tag ) = split( ':', $config{DYNAMIC_BLACKLIST} );
|
||||
|
||||
if ( my $timeout = $globals{DBL_TIMEOUT} ) {
|
||||
add_ijump( $chainref, j => "SET --add-set $dbl_ipset src --exist --timeout $timeout" );
|
||||
} else {
|
||||
add_ijump( $chainref, j => "SET --add-set $dbl_ipset src --exist" );
|
||||
}
|
||||
|
||||
$target = 'DROP';
|
||||
} else {
|
||||
add_ijump( $chainref , j => 'AUDIT', targetopts => '--type ' . lc $target ) if $chainref->{audit};
|
||||
}
|
||||
|
||||
add_ijump( $chainref , g => $target eq 'REJECT' ? 'reject' : $target ) unless $target eq 'CONTINUE';
|
||||
}
|
||||
}
|
||||
@@ -967,27 +1004,26 @@ sub complete_policy_chain( $$$ ) { #Chainref, Source Zone, Destination Zone
|
||||
my $chainref = $_[0];
|
||||
my $policyref = $filter_table->{$chainref->{policychain}};
|
||||
my $synparams = $policyref->{synparams};
|
||||
my $default = $policyref->{default};
|
||||
my $defaults = $policyref->{pactions};
|
||||
my $policy = $policyref->{policy};
|
||||
my $loglevel = $policyref->{loglevel};
|
||||
|
||||
assert( $policyref );
|
||||
|
||||
if ( $chainref eq $policyref ) {
|
||||
add_policy_rules $chainref , $policy, $loglevel , $default, $config{MULTICAST};
|
||||
add_policy_rules $chainref , $policy, $loglevel , $defaults, $config{MULTICAST};
|
||||
} else {
|
||||
if ( $policy eq 'ACCEPT' || $policy eq 'QUEUE' || $policy =~ /^NFQUEUE/ ) {
|
||||
if ( $synparams ) {
|
||||
report_syn_flood_protection;
|
||||
add_policy_rules $chainref , $policy , $loglevel , $default, $config{MULTICAST};
|
||||
add_policy_rules $chainref , $policy , $loglevel , $defaults, $config{MULTICAST};
|
||||
} else {
|
||||
add_ijump $chainref, g => $policyref;
|
||||
$chainref = $policyref;
|
||||
add_policy_rules( $chainref, $policy, $loglevel, $default, $config{MULTICAST} ) if $default =~/^macro\./;
|
||||
}
|
||||
} elsif ( $policy eq 'CONTINUE' ) {
|
||||
report_syn_flood_protection if $synparams;
|
||||
add_policy_rules $chainref , $policy , $loglevel , $default, $config{MULTICAST};
|
||||
add_policy_rules $chainref , $policy , $loglevel , $defaults, $config{MULTICAST};
|
||||
} else {
|
||||
report_syn_flood_protection if $synparams;
|
||||
add_ijump $chainref , g => $policyref;
|
||||
@@ -1010,7 +1046,7 @@ sub complete_policy_chains() {
|
||||
unless ( ( my $policy = $chainref->{policy} ) eq 'NONE' ) {
|
||||
my $loglevel = $chainref->{loglevel};
|
||||
my $provisional = $chainref->{provisional};
|
||||
my $default = $chainref->{default};
|
||||
my $defaults = $chainref->{pactions};
|
||||
my $name = $chainref->{name};
|
||||
my $synparms = $chainref->{synparms};
|
||||
|
||||
@@ -1022,7 +1058,7 @@ sub complete_policy_chains() {
|
||||
# is a single jump. Generate_matrix() will just use the policy target when
|
||||
# needed.
|
||||
#
|
||||
ensure_rules_chain $name if ( $default ne 'none' ||
|
||||
ensure_rules_chain $name if ( @$defaults ||
|
||||
$loglevel ||
|
||||
$synparms ||
|
||||
$config{MULTICAST} ||
|
||||
@@ -1033,7 +1069,7 @@ sub complete_policy_chains() {
|
||||
}
|
||||
|
||||
if ( $name =~ /^all[-2]|[-2]all$/ ) {
|
||||
add_policy_rules $chainref , $policy, $loglevel , $default, $config{MULTICAST};
|
||||
add_policy_rules $chainref , $policy, $loglevel , $defaults, $config{MULTICAST};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1062,20 +1098,18 @@ sub complete_standard_chain ( $$$$ ) {
|
||||
my ( $stdchainref, $zone, $zone2, $default ) = @_;
|
||||
|
||||
my $ruleschainref = $filter_table->{rules_chain( ${zone}, ${zone2} ) } || $filter_table->{rules_chain( 'all', 'all' ) };
|
||||
my ( $policy, $loglevel, $defaultaction ) = ( $default , 6, $config{$default . '_DEFAULT'} );
|
||||
my ( $policy, $loglevel ) = ( $default , 6 );
|
||||
my $policy_actions = $policy_actions{$policy};
|
||||
my $policychainref;
|
||||
|
||||
$policychainref = $filter_table->{$ruleschainref->{policychain}} if $ruleschainref;
|
||||
|
||||
if ( $policychainref ) {
|
||||
( $policy, $loglevel, $defaultaction ) = @{$policychainref}{'policy', 'loglevel', 'default' };
|
||||
( $policy, $loglevel, $policy_actions ) = @{$policychainref}{'policy', 'loglevel', 'pactions' };
|
||||
$stdchainref->{origin} = $policychainref->{origin};
|
||||
} elsif ( $defaultaction !~ /:/ ) {
|
||||
$defaultaction = normalize_single_action( $defaultaction );
|
||||
}
|
||||
|
||||
|
||||
add_policy_rules $stdchainref , $policy , $loglevel, $defaultaction, 0;
|
||||
add_policy_rules $stdchainref , $policy , $loglevel, $policy_actions, 0;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -1671,177 +1705,6 @@ 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';
|
||||
}
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
log_irule_limit $level, $chainref, 'dropBcast' , '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, 'dropBcast' , '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';
|
||||
}
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , '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, 'allowBcast' , '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,
|
||||
'allowBcast' => \&allowBcast,
|
||||
'dropNotSyn' => \&dropNotSyn,
|
||||
'rejNotSyn' => \&rejNotSyn,
|
||||
'allowinUPnP' => \&allowinUPnP,
|
||||
'forwardUPnP' => \&forwardUPnP,
|
||||
'Limit' => \&Limit,
|
||||
);
|
||||
|
||||
|
||||
sub process_rule ( $$$$$$$$$$$$$$$$$$$$ );
|
||||
sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ );
|
||||
sub process_snat1( $$$$$$$$$$$$ );
|
||||
@@ -1863,12 +1726,6 @@ sub process_action(\$\$$) {
|
||||
my $actionref = $actions{$action};
|
||||
my $matches = fetch_inline_matches;
|
||||
|
||||
if ( $type & BUILTIN ) {
|
||||
$level = '' if $level =~ /none!?/;
|
||||
$builtinops{$action}->( $chainref, $level, $tag, $param );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( $type & MANGLE_TABLE ) {
|
||||
fatal_error "Action $action may only be used in the mangle file" unless $chainref->{table} eq 'mangle';
|
||||
} else {
|
||||
@@ -1879,12 +1736,12 @@ sub process_action(\$\$$) {
|
||||
|
||||
progress_message2 "$doing $actionfile for chain $chainref->{name}...";
|
||||
|
||||
push_open $actionfile, 2, 1, undef, 2;
|
||||
|
||||
my $oldparms = push_action_params( $action, $chainref, $param, $level, $tag, $caller );
|
||||
my $options = $actionref->{options};
|
||||
my $nolog = $options & ( NOLOG_OPT | LOGJUMP_OPT );
|
||||
|
||||
push_open $actionfile, 2, 1, undef, 2;
|
||||
|
||||
setup_audit_action( $action ) if $options & AUDIT_OPT;
|
||||
|
||||
$active{$action}++;
|
||||
@@ -2141,7 +1998,6 @@ sub process_action(\$\$$) {
|
||||
#
|
||||
# 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:
|
||||
# o Adds the action to the target table
|
||||
# o Verifies that the corresponding action file exists
|
||||
@@ -2150,10 +2006,6 @@ sub process_action(\$\$$) {
|
||||
sub process_actions() {
|
||||
|
||||
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/ ) {
|
||||
open_file( $file, 2 );
|
||||
@@ -2718,7 +2570,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
#
|
||||
# Determine the validity of the action
|
||||
#
|
||||
$actiontype = ( $targets{$basictarget} || find_macro ( $basictarget ) );
|
||||
$actiontype = $targets{$basictarget} || find_macro( $basictarget );
|
||||
|
||||
if ( $config{ MAPOLDACTIONS } ) {
|
||||
( $basictarget, $actiontype , $param ) = map_old_actions( $basictarget ) unless $actiontype || supplied $param;
|
||||
@@ -2866,6 +2718,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
# tcp-reset
|
||||
#
|
||||
fatal_error "tcp-reset may only be used with PROTO tcp" unless ( resolve_proto( $proto ) || 0 ) == TCP;
|
||||
$exceptionrule = '-p 6 ';
|
||||
$param = 'tcp-reset';
|
||||
}
|
||||
|
||||
$action = "REJECT --reject-with $param";
|
||||
@@ -3126,6 +2980,10 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
my $actionchain; # Name of the action chain
|
||||
|
||||
if ( $actiontype & ACTION ) {
|
||||
#
|
||||
# Handle 'section' option
|
||||
#
|
||||
$param = supplied $param ? join( ',' , $section_rmap{$section}, $param ) : $section_rmap{$section} if $actions{$basictarget}{options} & SECTION_OPT;
|
||||
#
|
||||
# Create the action:level:tag:param tuple.
|
||||
#
|
||||
@@ -5784,15 +5642,23 @@ sub process_snat( )
|
||||
sub setup_snat( $ ) # Convert masq->snat if true
|
||||
{
|
||||
my $fn;
|
||||
my $have_masq;
|
||||
|
||||
convert_masq() if $_[0];
|
||||
|
||||
if ( $fn = open_file( 'masq', 1, 1 ) ) {
|
||||
if ( $_[0] ) {
|
||||
convert_masq();
|
||||
} elsif ( $fn = open_file( 'masq', 1, 1 ) ) {
|
||||
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty masq file" , 's'; } );
|
||||
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'; } );
|
||||
process_snat while read_a_line( NORMAL_READ );
|
||||
process_one_masq(0), $have_masq = 1 while read_a_line( NORMAL_READ );
|
||||
}
|
||||
|
||||
unless ( $have_masq ) {
|
||||
#
|
||||
# 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1434,7 +1434,7 @@ sub process_tc_filter2( $$$$$$$$$ ) {
|
||||
|
||||
while ( @sportlist ) {
|
||||
my ( $sport, $smask ) = ( shift @sportlist, shift @sportlist );
|
||||
$rule .= "\\\n cmp\\( u16 at 0 layer 2 mask $smask eq 0x$sport \\)";
|
||||
$rule .= "\\\n cmp\\( u16 at 0 layer 2 mask 0x$smask eq 0x$sport \\)";
|
||||
$rule .= ' or' if @sportlist;
|
||||
}
|
||||
|
||||
@@ -1924,7 +1924,7 @@ sub process_traffic_shaping() {
|
||||
|
||||
my ( $options, $redopts ) = ( '', $tcref->{redopts} );
|
||||
|
||||
for my $option ( sort keys %validredoptions ) {
|
||||
for my $option ( keys %validredoptions ) {
|
||||
my $type = $validredoptions{$option};
|
||||
|
||||
if ( my $value = $redopts->{$option} ) {
|
||||
@@ -1943,7 +1943,7 @@ sub process_traffic_shaping() {
|
||||
|
||||
my ( $options, $codelopts ) = ( '', $tcref->{codelopts} );
|
||||
|
||||
for my $option ( sort keys %validcodeloptions ) {
|
||||
for my $option ( keys %validcodeloptions ) {
|
||||
my $type = $validcodeloptions{$option};
|
||||
|
||||
if ( my $value = $codelopts->{$option} ) {
|
||||
@@ -2312,9 +2312,10 @@ EOF
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
return ( $mangle, $fn1 );
|
||||
}
|
||||
|
||||
return ( $mangle, $fn1 );
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@@ -108,24 +108,6 @@ our @EXPORT = ( qw( NOTHING
|
||||
|
||||
our @EXPORT_OK = qw( initialize );
|
||||
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.
|
||||
#
|
||||
@@ -221,6 +203,26 @@ our $zonemarkincr;
|
||||
our $zonemarklimit;
|
||||
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,
|
||||
IP => 2,
|
||||
BPORT => 4,
|
||||
@@ -276,19 +278,7 @@ our %maxoptionvalue = ( routefilter => 2, mss => 100000 , wait => 120 , ignore =
|
||||
|
||||
our %validhostoptions;
|
||||
|
||||
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,
|
||||
);
|
||||
our %validzoneoptions;
|
||||
|
||||
use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 };
|
||||
#
|
||||
@@ -330,6 +320,20 @@ sub initialize( $$ ) {
|
||||
$minroot = 0;
|
||||
$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 ) {
|
||||
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
|
||||
arp_ignore => ENUM_IF_OPTION,
|
||||
@@ -407,6 +411,8 @@ sub initialize( $$ ) {
|
||||
forward => BINARY_IF_OPTION,
|
||||
physical => STRING_IF_OPTION + IF_OPTION_HOST,
|
||||
unmanaged => SIMPLE_IF_OPTION,
|
||||
upnp => SIMPLE_IF_OPTION,
|
||||
upnpclient => SIMPLE_IF_OPTION,
|
||||
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||
);
|
||||
%validhostoptions = (
|
||||
@@ -713,10 +719,10 @@ sub zone_report()
|
||||
my $printed = 0;
|
||||
|
||||
if ( $hostref ) {
|
||||
for my $type ( sort keys %$hostref ) {
|
||||
for my $type ( keys %$hostref ) {
|
||||
my $interfaceref = $hostref->{$type};
|
||||
|
||||
for my $interface ( sort keys %$interfaceref ) {
|
||||
for my $interface ( keys %$interfaceref ) {
|
||||
my $iref = $interfaces{$interface};
|
||||
my $arrayref = $interfaceref->{$interface};
|
||||
|
||||
@@ -766,10 +772,10 @@ sub dump_zone_contents() {
|
||||
$entry .= ( " mark=" . in_hex( $zoneref->{mark} ) ) if exists $zoneref->{mark};
|
||||
|
||||
if ( $hostref ) {
|
||||
for my $type ( sort keys %$hostref ) {
|
||||
for my $type ( keys %$hostref ) {
|
||||
my $interfaceref = $hostref->{$type};
|
||||
|
||||
for my $interface ( sort keys %$interfaceref ) {
|
||||
for my $interface ( keys %$interfaceref ) {
|
||||
my $iref = $interfaces{$interface};
|
||||
my $arrayref = $interfaceref->{$interface};
|
||||
|
||||
@@ -1275,6 +1281,7 @@ sub process_interface( $$ ) {
|
||||
my $numval = numeric_value $value;
|
||||
fatal_error "Invalid value ($value) for option $option" unless defined $numval && $numval <= $maxoptionvalue{$option};
|
||||
require_capability 'TCPMSS_TARGET', "mss=$value", 's' if $option eq 'mss';
|
||||
$options{logmartians} = 1 if $option eq 'routefilter' && $numval && ! $config{LOG_MARTIANS};
|
||||
$options{$option} = $numval;
|
||||
$hostoptions{$option} = $numval if $hostopt;
|
||||
} elsif ( $type == IPLIST_IF_OPTION ) {
|
||||
@@ -1312,7 +1319,7 @@ sub process_interface( $$ ) {
|
||||
assert(0);
|
||||
}
|
||||
} elsif ( $type == STRING_IF_OPTION ) {
|
||||
fatal_error "The '$option' option requires a value" unless defined $value;
|
||||
fatal_error "The '$option' option requires a value" unless supplied $value;
|
||||
|
||||
if ( $option eq 'physical' ) {
|
||||
fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/;
|
||||
@@ -2218,9 +2225,9 @@ sub find_hosts_by_option( $ ) {
|
||||
}
|
||||
|
||||
for my $zone ( grep ! ( $zones{$_}{type} & FIREWALL ) , @zones ) {
|
||||
for my $type (sort keys %{$zones{$zone}{hosts}} ) {
|
||||
for my $type (keys %{$zones{$zone}{hosts}} ) {
|
||||
my $interfaceref = $zones{$zone}{hosts}->{$type};
|
||||
for my $interface ( sort keys %$interfaceref ) {
|
||||
for my $interface ( keys %$interfaceref ) {
|
||||
my $arrayref = $interfaceref->{$interface};
|
||||
for my $host ( @{$arrayref} ) {
|
||||
my $ipsec = $host->{ipsec};
|
||||
@@ -2248,9 +2255,9 @@ sub find_zone_hosts_by_option( $$ ) {
|
||||
my @hosts;
|
||||
|
||||
unless ( $zones{$zone}{type} & FIREWALL ) {
|
||||
for my $type (sort keys %{$zones{$zone}{hosts}} ) {
|
||||
for my $type (keys %{$zones{$zone}{hosts}} ) {
|
||||
my $interfaceref = $zones{$zone}{hosts}->{$type};
|
||||
for my $interface ( sort keys %$interfaceref ) {
|
||||
for my $interface ( keys %$interfaceref ) {
|
||||
my $arrayref = $interfaceref->{$interface};
|
||||
for my $host ( @{$arrayref} ) {
|
||||
if ( my $value = $host->{options}{$option} ) {
|
||||
|
@@ -43,6 +43,8 @@
|
||||
# --inline # Update alternative column specifications
|
||||
# --update # Update configuration to current release
|
||||
#
|
||||
# If the <filename> is omitted, then a 'check' operation is performed.
|
||||
#
|
||||
use strict;
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin";
|
||||
|
@@ -32,7 +32,7 @@
|
||||
# down Stop an optional interface
|
||||
# enable Enable an optional interface
|
||||
# help Show command syntax
|
||||
# reenable Disable then nable an optional
|
||||
# reenable Disable then enable an optional
|
||||
# interface
|
||||
# refresh Refresh the firewall
|
||||
# reload Reload the firewall
|
||||
@@ -349,7 +349,7 @@ replace_default_route() # $1 = USE_DEFAULT_RT
|
||||
case "$default_route" in
|
||||
*metric*)
|
||||
#
|
||||
# Don't restore a default route with a metric unless USE_DEFAULT_RT=Yes. Otherwise, we only replace the one with metric 0
|
||||
# Don't restore a default route with a metric unless USE_DEFAULT_RT=Yes or =Exact. Otherwise, we only replace the one with metric 0
|
||||
#
|
||||
[ -n "$1" ] && qt $IP -$g_family route replace $default_route && progress_message "Default Route (${default_route# }) restored"
|
||||
default_route=
|
||||
|
13
Shorewall/Samples/Universal/params
Normal file
13
Shorewall/Samples/Universal/params
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Shorewall - Sample Params File for universal configuration.
|
||||
# Copyright (C) 2006-2014 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------------------------------------
|
||||
# For information on entries in this file, type "man shorewall-params"
|
||||
######################################################################################################################################################################################################
|
@@ -7,7 +7,6 @@
|
||||
# http://www.shorewall.net/manpages/shorewall-policy.html
|
||||
#
|
||||
###############################################################################
|
||||
#SOURCE DEST POLICY LOG LIMIT: CONNLIMIT:
|
||||
# LEVEL BURST MASK
|
||||
#SOURCE DEST POLICY LOGLEVEL RATE CONNLIMIT
|
||||
$FW net ACCEPT
|
||||
net all DROP
|
||||
net all DROP $LOG_LEVEL
|
||||
|
@@ -33,6 +33,8 @@ FIREWALL=
|
||||
# L O G G I N G
|
||||
###############################################################################
|
||||
|
||||
LOG_LEVEL="info"
|
||||
|
||||
BLACKLIST_LOG_LEVEL=
|
||||
|
||||
INVALID_LOG_LEVEL=
|
||||
@@ -53,19 +55,19 @@ LOGTAGONLY=No
|
||||
|
||||
LOGLIMIT="s:1/sec:10"
|
||||
|
||||
MACLIST_LOG_LEVEL=info
|
||||
MACLIST_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
RPFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
SFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
SMURF_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
STARTUP_LOG=/var/log/shorewall-init.log
|
||||
|
||||
TCP_FLAGS_LOG_LEVEL=info
|
||||
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
UNTRACKED_LOG_LEVEL=
|
||||
|
||||
@@ -108,10 +110,11 @@ TC=
|
||||
###############################################################################
|
||||
|
||||
ACCEPT_DEFAULT="none"
|
||||
DROP_DEFAULT="Drop"
|
||||
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
|
||||
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
NFQUEUE_DEFAULT="none"
|
||||
QUEUE_DEFAULT="none"
|
||||
REJECT_DEFAULT="Reject"
|
||||
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
|
||||
###############################################################################
|
||||
# R S H / R C P C O M M A N D S
|
||||
@@ -140,6 +143,8 @@ AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=Yes
|
||||
|
||||
BALANCE_PROVIDERS=No
|
||||
|
||||
BASIC_FILTERS=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
@@ -212,6 +217,8 @@ OPTIMIZE=All
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
PERL_HASH_SEED=0
|
||||
|
||||
REJECT_ACTION=
|
||||
|
||||
REQUIRE_INTERFACE=Yes
|
||||
@@ -242,6 +249,8 @@ TRACK_RULES=No
|
||||
|
||||
USE_DEFAULT_RT=Yes
|
||||
|
||||
USE_NFLOG_SIZE=No
|
||||
|
||||
USE_PHYSICAL_NAMES=No
|
||||
|
||||
USE_RT_NAMES=No
|
||||
|
13
Shorewall/Samples/one-interface/params
Normal file
13
Shorewall/Samples/one-interface/params
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Shorewall - Sample Params File for one-interface configuration.
|
||||
# Copyright (C) 2006-2014 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------------------------------------
|
||||
# For information on entries in this file, type "man shorewall-params"
|
||||
######################################################################################################################################################################################################
|
@@ -11,8 +11,8 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-policy"
|
||||
###############################################################################
|
||||
#SOURCE DEST POLICY LOG LEVEL LIMIT:BURST
|
||||
$FW net ACCEPT
|
||||
net all DROP info
|
||||
#SOURCE DEST POLICY LOGLEVEL RATE CONNLIMIT
|
||||
$FW net ACCEPT
|
||||
net all DROP $LOG_LEVEL
|
||||
# The FOLLOWING POLICY MUST BE LAST
|
||||
all all REJECT info
|
||||
all all REJECT $LOG_LEVEL
|
||||
|
@@ -44,6 +44,8 @@ FIREWALL=
|
||||
# L O G G I N G
|
||||
###############################################################################
|
||||
|
||||
LOG_LEVEL=info
|
||||
|
||||
BLACKLIST_LOG_LEVEL=
|
||||
|
||||
INVALID_LOG_LEVEL=
|
||||
@@ -64,19 +66,19 @@ LOGTAGONLY=No
|
||||
|
||||
LOGLIMIT="s:1/sec:10"
|
||||
|
||||
MACLIST_LOG_LEVEL=info
|
||||
MACLIST_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
RPFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
SFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
SMURF_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
STARTUP_LOG=/var/log/shorewall-init.log
|
||||
|
||||
TCP_FLAGS_LOG_LEVEL=info
|
||||
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
UNTRACKED_LOG_LEVEL=
|
||||
|
||||
@@ -119,10 +121,11 @@ TC=
|
||||
###############################################################################
|
||||
|
||||
ACCEPT_DEFAULT="none"
|
||||
DROP_DEFAULT="Drop"
|
||||
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
|
||||
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
NFQUEUE_DEFAULT="none"
|
||||
QUEUE_DEFAULT="none"
|
||||
REJECT_DEFAULT="Reject"
|
||||
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
|
||||
###############################################################################
|
||||
# R S H / R C P C O M M A N D S
|
||||
@@ -151,6 +154,8 @@ AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=Yes
|
||||
|
||||
BALANCE_PROVIDERS=No
|
||||
|
||||
BASIC_FILTERS=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
@@ -223,6 +228,8 @@ OPTIMIZE=All
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
PERL_HASH_SEED=0
|
||||
|
||||
REJECT_ACTION=
|
||||
|
||||
REQUIRE_INTERFACE=No
|
||||
@@ -253,6 +260,8 @@ TRACK_RULES=No
|
||||
|
||||
USE_DEFAULT_RT=Yes
|
||||
|
||||
USE_NFLOG_SIZE=No
|
||||
|
||||
USE_PHYSICAL_NAMES=No
|
||||
|
||||
USE_RT_NAMES=No
|
||||
|
13
Shorewall/Samples/three-interfaces/params
Normal file
13
Shorewall/Samples/three-interfaces/params
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Shorewall - Sample Params File for three-interface configuration.
|
||||
# Copyright (C) 2006-2014 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------------------------------------
|
||||
# For information on entries in this file, type "man shorewall-params"
|
||||
######################################################################################################################################################################################################
|
@@ -11,9 +11,9 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-policy"
|
||||
###############################################################################
|
||||
#SOURCE DEST POLICY LOG LEVEL LIMIT:BURST
|
||||
#SOURCE DEST POLICY LOGLEVEL RATE CONNLIMIT
|
||||
|
||||
loc net ACCEPT
|
||||
net all DROP info
|
||||
loc net ACCEPT
|
||||
net all DROP $LOG_LEVEL
|
||||
# THE FOLLOWING POLICY MUST BE LAST
|
||||
all all REJECT info
|
||||
all all REJECT $LOG_LEVEL
|
||||
|
@@ -41,6 +41,8 @@ FIREWALL=
|
||||
# L O G G I N G
|
||||
###############################################################################
|
||||
|
||||
LOG_LEVEL="info"
|
||||
|
||||
BLACKLIST_LOG_LEVEL=
|
||||
|
||||
INVALID_LOG_LEVEL=
|
||||
@@ -61,19 +63,19 @@ LOGTAGONLY=No
|
||||
|
||||
LOGLIMIT="s:1/sec:10"
|
||||
|
||||
MACLIST_LOG_LEVEL=info
|
||||
MACLIST_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
RPFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
SFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
SMURF_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
STARTUP_LOG=/var/log/shorewall-init.log
|
||||
|
||||
TCP_FLAGS_LOG_LEVEL=info
|
||||
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
UNTRACKED_LOG_LEVEL=
|
||||
|
||||
@@ -116,10 +118,11 @@ TC=
|
||||
###############################################################################
|
||||
|
||||
ACCEPT_DEFAULT="none"
|
||||
DROP_DEFAULT="Drop"
|
||||
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
|
||||
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
NFQUEUE_DEFAULT="none"
|
||||
QUEUE_DEFAULT="none"
|
||||
REJECT_DEFAULT="Reject"
|
||||
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
|
||||
###############################################################################
|
||||
# R S H / R C P C O M M A N D S
|
||||
@@ -148,6 +151,8 @@ AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=Yes
|
||||
|
||||
BALANCE_PROVIDERS=No
|
||||
|
||||
BASIC_FILTERS=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
@@ -220,6 +225,8 @@ OPTIMIZE=All
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
PERL_HASH_SEED=0
|
||||
|
||||
REJECT_ACTION=
|
||||
|
||||
REQUIRE_INTERFACE=No
|
||||
@@ -250,6 +257,8 @@ TRACK_RULES=No
|
||||
|
||||
USE_DEFAULT_RT=Yes
|
||||
|
||||
USE_NFLOG_SIZE=No
|
||||
|
||||
USE_PHYSICAL_NAMES=No
|
||||
|
||||
USE_RT_NAMES=No
|
||||
|
13
Shorewall/Samples/two-interfaces/params
Normal file
13
Shorewall/Samples/two-interfaces/params
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Shorewall - Sample Params File for two-interface configuration.
|
||||
# Copyright (C) 2006-2014 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------------------------------------
|
||||
# For information on entries in this file, type "man shorewall-params"
|
||||
######################################################################################################################################################################################################
|
@@ -11,10 +11,10 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-policy"
|
||||
###############################################################################
|
||||
#SOURCE DEST POLICY LOG LEVEL LIMIT:BURST
|
||||
#SOURCE DEST POLICY LOGLEVEL RATE CONNLIMIT
|
||||
|
||||
loc net ACCEPT
|
||||
net all DROP info
|
||||
# THE FOLLOWING POLICY MUST BE LAST
|
||||
all all REJECT info
|
||||
loc net ACCEPT
|
||||
net all DROP $LOG_LEVEL
|
||||
# THE FOLOWING POLICY MUST BE LAST
|
||||
all all REJECT $LOG_LEVEL
|
||||
|
||||
|
@@ -44,6 +44,8 @@ FIREWALL=
|
||||
# L O G G I N G
|
||||
###############################################################################
|
||||
|
||||
LOG_LEVEL="info"
|
||||
|
||||
BLACKLIST_LOG_LEVEL=
|
||||
|
||||
INVALID_LOG_LEVEL=
|
||||
@@ -64,19 +66,19 @@ LOGTAGONLY=No
|
||||
|
||||
LOGLIMIT="s:1/sec:10"
|
||||
|
||||
MACLIST_LOG_LEVEL=info
|
||||
MACLIST_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
RPFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
SFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
SMURF_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
STARTUP_LOG=/var/log/shorewall-init.log
|
||||
|
||||
TCP_FLAGS_LOG_LEVEL=info
|
||||
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
UNTRACKED_LOG_LEVEL=
|
||||
|
||||
@@ -119,10 +121,11 @@ TC=
|
||||
###############################################################################
|
||||
|
||||
ACCEPT_DEFAULT="none"
|
||||
DROP_DEFAULT="Drop"
|
||||
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
|
||||
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
NFQUEUE_DEFAULT="none"
|
||||
QUEUE_DEFAULT="none"
|
||||
REJECT_DEFAULT="Reject"
|
||||
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
|
||||
###############################################################################
|
||||
# R S H / R C P C O M M A N D S
|
||||
@@ -151,6 +154,8 @@ AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=Yes
|
||||
|
||||
BALANCE_PROVIDERS=No
|
||||
|
||||
BASIC_FILTERS=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
@@ -223,6 +228,8 @@ OPTIMIZE=All
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
PERL_HASH_SEED=0
|
||||
|
||||
REJECT_ACTION=
|
||||
|
||||
REQUIRE_INTERFACE=No
|
||||
@@ -253,6 +260,8 @@ TRACK_RULES=No
|
||||
|
||||
USE_DEFAULT_RT=Yes
|
||||
|
||||
USE_NFLOG_SIZE=No
|
||||
|
||||
USE_PHYSICAL_NAMES=No
|
||||
|
||||
USE_RT_NAMES=No
|
||||
|
@@ -20,4 +20,4 @@
|
||||
MASQUERADE 10.0.0.0/8,\
|
||||
169.254.0.0/16,\
|
||||
172.16.0.0/12,\
|
||||
92.168.0.0/16 eth0
|
||||
192.168.0.0/16 eth0
|
||||
|
@@ -6,47 +6,50 @@
|
||||
# Please see http://shorewall.net/Actions.html for additional
|
||||
# information.
|
||||
#
|
||||
# Builtin Actions are:
|
||||
#
|
||||
?if 0
|
||||
A_ACCEPT # Audits then accepts a connection request
|
||||
A_DROP # Audits then drops a connection request
|
||||
allowBcast # Silently Allow Broadcast/multicast
|
||||
dropBcast # Silently Drop Broadcast/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
|
||||
A_Drop # Audited Default Action for DROP policy
|
||||
A_REJECT noinline,logjump # Audits then rejects a connection request
|
||||
A_REJECT! inline # Audits then rejects a connection request
|
||||
A_Reject # Audited Default action for REJECT policy
|
||||
A_AllowICMPs inline # Audited version of AllowICMPs
|
||||
A_Drop # Audited Default Action for DROP policy
|
||||
A_REJECT noinline,logjump # Audits then rejects a connection request
|
||||
A_REJECT! inline # Audits then rejects a connection request
|
||||
A_Reject # Audited Default action for REJECT policy
|
||||
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
|
||||
AutoBL noinline # Auto-blacklist IPs that exceed thesholds
|
||||
AutoBLL noinline # Helper for AutoBL
|
||||
Broadcast noinline,audit # Handles Broadcast/Multicast/Anycast
|
||||
DNSAmp # Matches one-question recursive DNS queries
|
||||
Drop # Default Action for DROP policy
|
||||
allowMcast inline # Silently Allow Multicast
|
||||
AutoBL noinline # Auto-blacklist IPs that exceed thesholds
|
||||
AutoBLL noinline # Helper for AutoBL
|
||||
BLACKLIST logjump,section # Add sender to the dynamic blacklist
|
||||
Broadcast noinline,audit # Handles Broadcast/Anycast
|
||||
DNSAmp # Matches one-question recursive DNS queries
|
||||
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
|
||||
DropSmurfs noinline # Drop smurf packets
|
||||
dropMcast inline # Silently Drop Multicast
|
||||
dropNotSyn noinline # Silently Drop Non-syn TCP packets
|
||||
DropDNSrep inline # Drops DNS replies
|
||||
DropSmurfs noinline # Drop smurf packets
|
||||
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
|
||||
IfEvent noinline # Perform an action based on an event
|
||||
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
|
||||
state=INVALID #
|
||||
IfEvent noinline # Perform an action based on an event
|
||||
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
|
||||
state=INVALID #
|
||||
Limit noinline # Limit the rate of connections from each individual IP address
|
||||
Multicast noinline,audit # Handles Multicast
|
||||
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
|
||||
Reject # Default Action for REJECT policy
|
||||
Related inline,\ # Handles packets in the RELATED conntrack state
|
||||
state=RELATED #
|
||||
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)
|
||||
Related inline,\ # Handles packets in the RELATED conntrack state
|
||||
state=RELATED #
|
||||
ResetEvent inline # Reset an Event
|
||||
RST inline,audit # Handle packets with RST set
|
||||
RST inline,audit # Handle packets with RST set
|
||||
SetEvent inline # Initialize an event
|
||||
TCPFlags # Handle bad flag combinations.
|
||||
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
|
||||
state=UNTRACKED #
|
||||
TCPFlags # Handle bad flag combinations.
|
||||
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
|
||||
state=UNTRACKED #
|
||||
|
@@ -7,4 +7,4 @@
|
||||
# http://www.shorewall.net/manpages/shorewall-policy.html
|
||||
#
|
||||
###############################################################################
|
||||
#SOURCE DEST POLICY LOGLEVEL LIMIT CONNLIMIT
|
||||
#SOURCE DEST POLICY LOGLEVEL RATE CONNLIMIT
|
||||
|
@@ -33,6 +33,8 @@ FIREWALL=
|
||||
# L O G G I N G
|
||||
###############################################################################
|
||||
|
||||
LOG_LEVEL="info"
|
||||
|
||||
BLACKLIST_LOG_LEVEL=
|
||||
|
||||
INVALID_LOG_LEVEL=
|
||||
@@ -53,19 +55,19 @@ LOGTAGONLY=No
|
||||
|
||||
LOGLIMIT="s:1/sec:10"
|
||||
|
||||
MACLIST_LOG_LEVEL=info
|
||||
MACLIST_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
RPFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
SFILTER_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
SMURF_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
STARTUP_LOG=/var/log/shorewall-init.log
|
||||
|
||||
TCP_FLAGS_LOG_LEVEL=info
|
||||
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
|
||||
|
||||
UNTRACKED_LOG_LEVEL=
|
||||
|
||||
@@ -107,11 +109,12 @@ TC=
|
||||
# D E F A U L T A C T I O N S / M A C R O S
|
||||
###############################################################################
|
||||
|
||||
ACCEPT_DEFAULT=none
|
||||
DROP_DEFAULT=Drop
|
||||
NFQUEUE_DEFAULT=none
|
||||
QUEUE_DEFAULT=none
|
||||
REJECT_DEFAULT=Reject
|
||||
ACCEPT_DEFAULT="none"
|
||||
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
|
||||
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
NFQUEUE_DEFAULT="none"
|
||||
QUEUE_DEFAULT="none"
|
||||
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
|
||||
###############################################################################
|
||||
# R S H / R C P C O M M A N D S
|
||||
@@ -140,6 +143,8 @@ AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=Yes
|
||||
|
||||
BALANCE_PROVIDERS=No
|
||||
|
||||
BASIC_FILTERS=No
|
||||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
@@ -212,6 +217,8 @@ OPTIMIZE=All
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
PERL_HASH_SEED=0
|
||||
|
||||
REJECT_ACTION=
|
||||
|
||||
REQUIRE_INTERFACE=No
|
||||
@@ -242,6 +249,8 @@ TRACK_RULES=No
|
||||
|
||||
USE_DEFAULT_RT=Yes
|
||||
|
||||
USE_NFLOG_SIZE=No
|
||||
|
||||
USE_PHYSICAL_NAMES=No
|
||||
|
||||
USE_RT_NAMES=No
|
||||
|
26
Shorewall/default.debian.systemd
Normal file
26
Shorewall/default.debian.systemd
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Global start/restart/reload/stop options
|
||||
#
|
||||
OPTIONS=""
|
||||
|
||||
#
|
||||
# Start options
|
||||
#
|
||||
STARTOPTIONS=""
|
||||
|
||||
#
|
||||
# Restart options
|
||||
#
|
||||
RESTARTOPTIONS=""
|
||||
|
||||
#
|
||||
# Reload options
|
||||
#
|
||||
RELOADOPTIONS=""
|
||||
|
||||
#
|
||||
# Stop options
|
||||
#
|
||||
STOPOPTIONS=""
|
||||
|
||||
# EOF
|
@@ -1,5 +1,5 @@
|
||||
# prevent startup with default configuration
|
||||
# set the following varible to 1 in order to allow Shorewall to start
|
||||
# set the following variable to 1 in order to allow Shorewall to start
|
||||
|
||||
startup=0
|
||||
|
||||
@@ -16,7 +16,7 @@ startup=0
|
||||
# wait_interface=
|
||||
|
||||
#
|
||||
# Global start/restart options
|
||||
# Global start/restart/reload/stop options
|
||||
#
|
||||
OPTIONS=""
|
||||
|
||||
@@ -28,12 +28,17 @@ STARTOPTIONS=""
|
||||
#
|
||||
# Restart options
|
||||
#
|
||||
RESTARTOPTIONS=""
|
||||
|
||||
#
|
||||
# Reload options
|
||||
#
|
||||
RELOADOPTIONS=""
|
||||
|
||||
#
|
||||
# Restart options
|
||||
# Stop options
|
||||
#
|
||||
RESTARTOPTIONS=""
|
||||
STOPOPTIONS=""
|
||||
|
||||
#
|
||||
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf
|
@@ -22,55 +22,22 @@
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
VERSION=4.5.5 #The Build script inserts the actual version
|
||||
VERSION=xxx # The Build script inserts the actual version
|
||||
|
||||
#
|
||||
# Change to the directory containing this script
|
||||
#
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME [ <configuration-file> ]"
|
||||
echo " $ME -v"
|
||||
echo " $ME -h"
|
||||
echo " $ME -s"
|
||||
echo " $ME -a"
|
||||
echo " $ME -n"
|
||||
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
|
||||
echo "where <option> is one of"
|
||||
echo " -h"
|
||||
echo " -v"
|
||||
echo " -s"
|
||||
echo " -a"
|
||||
echo " -p"
|
||||
echo " -n"
|
||||
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()
|
||||
{
|
||||
if ! install $*; then
|
||||
@@ -80,27 +47,14 @@ run_install()
|
||||
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
|
||||
{
|
||||
run_install $T $OWNERSHIP -m $3 $1 ${2}
|
||||
}
|
||||
|
||||
require()
|
||||
{
|
||||
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
||||
}
|
||||
|
||||
#
|
||||
# Change to the directory containing this script
|
||||
#
|
||||
cd "$(dirname $0)"
|
||||
|
||||
if [ -f shorewall.service ]; then
|
||||
@@ -111,6 +65,11 @@ else
|
||||
Product=Shorewall6
|
||||
fi
|
||||
|
||||
#
|
||||
# Source common functions
|
||||
#
|
||||
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
@@ -172,11 +131,14 @@ done
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
file=./shorewallrc
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
file=~/.shorewallrc
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
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
|
||||
@@ -186,11 +148,11 @@ elif [ $# -eq 1 ]; then
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
file=./$file || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
. $file || fatal_error "Can not load the RC file: $file"
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
@@ -305,8 +267,7 @@ case "$HOST" in
|
||||
linux)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown HOST \"$HOST\"" >&2
|
||||
exit 1;
|
||||
fatal_error "Unknown HOST \"$HOST\""
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -317,8 +278,7 @@ if [ $PRODUCT = shorewall ]; then
|
||||
#
|
||||
if [ "$DIGEST" != SHA ]; then
|
||||
if [ "$BUILD" = "$HOST" ] && ! eval perl -e \'use Digest::$DIGEST\;\' 2> /dev/null ; then
|
||||
echo "ERROR: Perl compilation with Digest::$DIGEST failed" >&2
|
||||
exit 1;
|
||||
fatal_error "Perl compilation with Digest::$DIGEST failed"
|
||||
fi
|
||||
|
||||
cp -af Perl/Shorewall/Chains.pm Perl/Shorewall/Chains.pm.bak
|
||||
@@ -341,8 +301,7 @@ if [ $PRODUCT = shorewall ]; then
|
||||
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm
|
||||
DIGEST=SHA1
|
||||
else
|
||||
echo "ERROR: Shorewall $VERSION requires either Digest::SHA or Digest::SHA1" >&2
|
||||
exit 1
|
||||
fatal_error "Shorewall $VERSION requires either Digest::SHA or Digest::SHA1"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -370,11 +329,10 @@ if [ $BUILD != cygwin ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}${SBINDIR}
|
||||
[ -n "${INITFILE}" ] && install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
|
||||
run_install -d $OWNERSHIP -m 0755 ${DESTDIR}${SBINDIR}
|
||||
[ -n "${INITFILE}" ] && run_install -d $OWNERSHIP -m 0755 ${DESTDIR}${INITDIR}
|
||||
if [ -z "$DESTDIR" -a $PRODUCT != shorewall ]; then
|
||||
[ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || \
|
||||
{ echo " ERROR: Shorewall >= 4.5.0 is not installed" >&2; exit 1; }
|
||||
[ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || fatal_error "Shorewall >= 4.5.0 is not installed"
|
||||
fi
|
||||
|
||||
echo "Installing $Product Version $VERSION"
|
||||
@@ -388,7 +346,7 @@ else
|
||||
first_install="Yes"
|
||||
fi
|
||||
|
||||
if [ -z "${DESTDIR}" -a $PRODUCT = shorewall -a ! -f ${SHAREDIR}/$PRODUCT/coreversion ]; then
|
||||
if [ -z "${DESTDIR}" -a $PRODUCT = shorewall -a ! -f ${SHAREDIR}/shorewall/coreversion ]; then
|
||||
echo "Shorewall $VERSION requires Shorewall Core which does not appear to be installed"
|
||||
exit 1
|
||||
fi
|
||||
@@ -410,22 +368,16 @@ fi
|
||||
#
|
||||
# Create /etc/$PRODUCT and other directories
|
||||
#
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${PERLLIBDIR}/Shorewall
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated
|
||||
mkdir -p ${DESTDIR}${VARDIR}
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/$PRODUCT 0755
|
||||
make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755
|
||||
make_parent_directory ${DESTDIR}${PERLLIBDIR}/Shorewall 0755
|
||||
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles 0755
|
||||
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated 0755
|
||||
make_parent_directory ${DESTDIR}${VARDIR} 0755
|
||||
|
||||
chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT
|
||||
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
|
||||
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated
|
||||
chmod 0755 ${DESTDIR}${SHAREDIR}/$PRODUCT
|
||||
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
fi
|
||||
[ -n "$DESTDIR" ] && make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755
|
||||
|
||||
#
|
||||
# Install the .service file
|
||||
@@ -435,9 +387,9 @@ if [ -z "${SERVICEDIR}" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$SERVICEDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${SERVICEDIR}
|
||||
make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
|
||||
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
|
||||
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
|
||||
run_install $OWNERSHIP -m 0644 $SERVICEFILE ${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"
|
||||
fi
|
||||
@@ -481,6 +433,24 @@ if [ -z "$first_install" ]; then
|
||||
delete_file ${DESTDIR}${MANDIR}/man5/$PRODUCT/${PRODUCT}-stoppedrules
|
||||
delete_file ${DESTDIR}${MANDIR}/man5/$PRODUCT/${PRODUCT}-notrack
|
||||
delete_file ${DESTDIR}${MANDIR}/man5/$PRODUCT/${PRODUCT}-blacklist
|
||||
|
||||
if [ $PRODUCT = shorewall ]; then
|
||||
#
|
||||
# Delete deprecated macros and actions
|
||||
#
|
||||
delete_file ${DESTDIR}${SHAREDIR}/shorewall/macro.SNMPTrap
|
||||
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_REJECT
|
||||
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Drop
|
||||
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
|
||||
|
||||
#
|
||||
@@ -522,8 +492,11 @@ fi
|
||||
#
|
||||
# Install the config file
|
||||
#
|
||||
run_install $OWNERSHIP -m 0644 $PRODUCT.conf ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/
|
||||
run_install $OWNERSHIP -m 0644 $PRODUCT.conf.annotated ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/
|
||||
run_install $OWNERSHIP -m 0644 $PRODUCT.conf ${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
|
||||
run_install $OWNERSHIP -m 0600 ${PRODUCT}.conf${suffix} ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf
|
||||
@@ -1084,8 +1057,14 @@ cd ..
|
||||
#
|
||||
for f in lib.* Perl/lib.*; do
|
||||
if [ -f $f ]; then
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$(basename $f) 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
|
||||
case $f in
|
||||
*installer)
|
||||
;;
|
||||
*)
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$(basename $f) 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -1095,7 +1074,7 @@ if [ $PRODUCT = shorewall6 ]; then
|
||||
#
|
||||
ln -sf lib.base ${DESTDIR}${SHAREDIR}/$PRODUCT/functions
|
||||
#
|
||||
# And create a sybolic link for the CLI
|
||||
# And create a symbolic link for the CLI
|
||||
#
|
||||
ln -sf shorewall ${DESTDIR}${SBINDIR}/shorewall6
|
||||
fi
|
||||
@@ -1104,8 +1083,7 @@ if [ -d Perl ]; then
|
||||
#
|
||||
# ${SHAREDIR}/$PRODUCT/$Product if needed
|
||||
#
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product
|
||||
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product
|
||||
make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product 0755
|
||||
#
|
||||
# Install the Compiler
|
||||
#
|
||||
@@ -1154,7 +1132,7 @@ fi
|
||||
# Create the version file
|
||||
#
|
||||
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
#
|
||||
# Remove and create the symbolic link to the init script
|
||||
#
|
||||
@@ -1172,15 +1150,41 @@ if [ -n "$MANDIR" ]; then
|
||||
|
||||
cd manpages
|
||||
|
||||
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man5/
|
||||
if [ $PRODUCT = shorewall ]; then
|
||||
[ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man5 0755
|
||||
|
||||
for f in *.5; do
|
||||
gzip -9c $f > $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"
|
||||
done
|
||||
for f in *.5; do
|
||||
gzip -9c $f > $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"
|
||||
done
|
||||
fi
|
||||
|
||||
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man8/
|
||||
if [ $PRODUCT = shorewall6 ]; then
|
||||
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
|
||||
gzip -9c $f > $f.gz
|
||||
@@ -1203,8 +1207,7 @@ fi
|
||||
#
|
||||
if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
|
||||
if [ ${DESTDIR} ]; then
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}
|
||||
chmod 755 ${DESTDIR}${SYSCONFDIR}
|
||||
make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
|
||||
fi
|
||||
|
||||
run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT
|
||||
@@ -1262,6 +1265,6 @@ if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${
|
||||
fi
|
||||
|
||||
#
|
||||
# Report Success
|
||||
# Report Success
|
||||
#
|
||||
echo "$Product Version $VERSION Installed"
|
||||
|
@@ -341,6 +341,18 @@ get_config() {
|
||||
setup_dbl
|
||||
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)
|
||||
|
||||
[ -f $lib ] && . $lib
|
||||
@@ -443,20 +455,21 @@ compiler() {
|
||||
fi
|
||||
|
||||
options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${shorewallrc}"
|
||||
[ -n "$shorewallrc1" ] && options="$options --shorewallrc1=${shorewallrc1}"
|
||||
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
|
||||
[ -n "$LOG_VERBOSITY" ] && options="$options --log_verbosity=$LOG_VERBOSITY";
|
||||
[ -n "$g_export" ] && options="$options --export"
|
||||
[ -n "$g_shorewalldir" ] && options="$options --directory=$g_shorewalldir"
|
||||
[ -n "$g_timestamp" ] && options="$options --timestamp"
|
||||
[ -n "$g_test" ] && options="$options --test"
|
||||
[ -n "$g_preview" ] && options="$options --preview"
|
||||
|
||||
[ -n "$shorewallrc1" ] && options="$options --shorewallrc1=${shorewallrc1}"
|
||||
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
|
||||
[ -n "$LOG_VERBOSITY" ] && options="$options --log_verbosity=$LOG_VERBOSITY";
|
||||
[ -n "$g_export" ] && options="$options --export"
|
||||
[ -n "$g_shorewalldir" ] && options="$options --directory=$g_shorewalldir"
|
||||
[ -n "$g_timestamp" ] && options="$options --timestamp"
|
||||
[ -n "$g_test" ] && options="$options --test"
|
||||
[ -n "$g_preview" ] && options="$options --preview"
|
||||
[ "$g_debugging" = trace ] && options="$options --debug"
|
||||
[ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
|
||||
[ -n "$g_confess" ] && options="$options --confess"
|
||||
[ -n "$g_update" ] && options="$options --update"
|
||||
[ -n "$g_annotate" ] && options="$options --annotate"
|
||||
[ -n "$g_inline" ] && options="$options --inline"
|
||||
[ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
|
||||
[ -n "$g_confess" ] && options="$options --confess"
|
||||
[ -n "$g_update" ] && options="$options --update"
|
||||
[ -n "$g_annotate" ] && options="$options --annotate"
|
||||
[ -n "$g_inline" ] && options="$options --inline"
|
||||
|
||||
if [ -n "$PERL" ]; then
|
||||
if [ ! -x "$PERL" ]; then
|
||||
@@ -483,6 +496,18 @@ compiler() {
|
||||
#
|
||||
[ "$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
|
||||
eval $PERL $debugflags $pc $options $@ $g_pager
|
||||
else
|
||||
@@ -509,28 +534,6 @@ start_command() {
|
||||
local rc
|
||||
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
|
||||
error_message "Shorewall is already running"
|
||||
exit 0
|
||||
@@ -622,7 +625,25 @@ start_command() {
|
||||
fi
|
||||
fi
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/accounting</command>
|
||||
<command>/etc/shorewall[6]/accounting</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -783,6 +783,8 @@
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/accounting</para>
|
||||
|
||||
<para>/etc/shorewall6/accounting</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -798,14 +800,6 @@
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/actions</command>
|
||||
<command>/etc/shorewall[6]/actions</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -148,9 +148,9 @@
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.0.7. Specifies that this action is
|
||||
to be used in <ulink
|
||||
url="shorewall-mangle.html">shorewall-mangle(5)</ulink> rather
|
||||
than <ulink
|
||||
url="shorewall-rules.html">shorewall-rules(5)</ulink>.</para>
|
||||
url="/manpages/shorewall-mangle.html">shorewall-mangle(5)</ulink>
|
||||
rather than <ulink
|
||||
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -160,11 +160,11 @@
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.0.13. Specifies that this action is
|
||||
to be used in <ulink
|
||||
url="shorewall-snat.html">shorewall-snat(5)</ulink> rather
|
||||
than <ulink
|
||||
url="shorewall-rules.html">shorewall-rules(5)</ulink>. The
|
||||
<option>mangle</option> and <option>nat</option> options are
|
||||
mutually exclusive.</para>
|
||||
url="/manpages/shorewall-snat.html">shorewall-snat(5)</ulink>
|
||||
rather than <ulink
|
||||
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink>.
|
||||
The <option>mangle</option> and <option>nat</option> options
|
||||
are mutually exclusive.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -191,6 +191,25 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>section</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.1.1. When specified, this option
|
||||
causes the rules file section name and a comma to be prepended
|
||||
to the parameters passed to the action (if any). Note that
|
||||
this means that the first parameter passed to the action by
|
||||
the user is actually the second parameter to the action. If
|
||||
the action is invoked out of the blrules file, 'BLACKLIST' is
|
||||
used as the section name.</para>
|
||||
|
||||
<para>Given that neither the <filename>snat</filename> nor the
|
||||
<filename>mangle</filename> file is sectioned, this parameter
|
||||
has no effect when <option>mangle</option> or
|
||||
<option>nat</option> is specified.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>state</option>={<option>UNTRACKED</option>|<option>NEW</option>|<option>ESTABLISHED</option>|<option>RELATED</option>|<option>INVALID</option>}</term>
|
||||
|
||||
@@ -205,9 +224,9 @@
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 4.6.4. When used with
|
||||
<replaceable>builtin</replaceable>, indicates that the
|
||||
built-in action is termiating (i.e., if the action is jumped
|
||||
to, the next rule in the chain is not evaluated).</para>
|
||||
<option>builtin</option>, indicates that the built-in action
|
||||
is termiating (i.e., if the action is jumped to, the next rule
|
||||
in the chain is not evaluated).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
@@ -220,6 +239,8 @@
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/actions</para>
|
||||
|
||||
<para>/etc/shorewall6/actions</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -228,14 +249,6 @@
|
||||
<para><ulink
|
||||
url="/Actions.html">http://www.shorewall.net/Actions.html</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -25,6 +25,8 @@
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>IPv4 only.</para>
|
||||
|
||||
<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
|
||||
Resolution Protocol (ARP), Reverse Address Resolution Protocol (RARP) and
|
||||
@@ -377,4 +379,10 @@ SNAT:10.1.10.11 - eth1:10.1.10.0/24 1</programlis
|
||||
|
||||
<para>/etc/shorewall/arprules</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See ALSO</title>
|
||||
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/blrules</command>
|
||||
<command>/etc/shorewall[6]/blrules</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -27,12 +27,9 @@
|
||||
|
||||
<para>This file is used to perform blacklisting and whitelisting.</para>
|
||||
|
||||
<para>Rules in this file are applied depending on the setting of
|
||||
BLACKLISTNEWONLY in <ulink
|
||||
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>Rules in this file are applied depending on the setting of BLACKLIST
|
||||
in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para>
|
||||
|
||||
<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
|
||||
@@ -118,10 +115,10 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>A_DROP and A_DROP!</term>
|
||||
<term>A_DROP</term>
|
||||
|
||||
<listitem>
|
||||
<para>Audited versions of DROP. Requires AUDIT_TARGET support
|
||||
<para>Audited version of DROP. Requires AUDIT_TARGET support
|
||||
in the kernel and ip6tables.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -170,7 +167,7 @@
|
||||
<listitem>
|
||||
<para>queues matching packets to a back end logging daemon via
|
||||
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>
|
||||
</varlistentry>
|
||||
|
||||
@@ -276,11 +273,11 @@
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<title>Examples</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Example 1:</term>
|
||||
<term>IPv4 Example 1:</term>
|
||||
|
||||
<listitem>
|
||||
<para>Drop Teredo packets from the net.</para>
|
||||
@@ -290,7 +287,28 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 2:</term>
|
||||
<term>IPv4 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>
|
||||
<para>Don't subject packets from 2001:DB8::/64 to the remaining
|
||||
@@ -306,6 +324,8 @@
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/blrules</para>
|
||||
|
||||
<para>/etc/shorewall6/blrules</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -317,12 +337,6 @@
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/conntrack</command>
|
||||
<command>/etc/shorewall[6]/conntrack</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<emphasis role="bold">conntrack</emphasis>.</para>
|
||||
|
||||
<para>The file supports three different column layouts: FORMAT 1, FORMAT
|
||||
2, and FORMAT 3, FORMAT 1 being the default. The three differ as
|
||||
2, and FORMAT 3 with FORMAT 1 being the default. The three differ as
|
||||
follows:</para>
|
||||
|
||||
<itemizedlist>
|
||||
@@ -311,9 +311,9 @@
|
||||
<listitem>
|
||||
<para><option>ULOG</option></para>
|
||||
|
||||
<para>Added in Shoreawll 4.6.0. Queues the packet to a backend
|
||||
logging daemon using the ULOG netfilter target with the
|
||||
specified <replaceable>ulog-parameters</replaceable>.</para>
|
||||
<para>IPv4 only. Added in Shoreawll 4.6.0. Queues the packet to
|
||||
a backend logging daemon using the ULOG netfilter target with
|
||||
the specified <replaceable>ulog-parameters</replaceable>.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
@@ -689,31 +689,57 @@
|
||||
<refsect1>
|
||||
<title>EXAMPLE</title>
|
||||
|
||||
<para>Example 1:</para>
|
||||
<para>IPv4 Example 1:</para>
|
||||
|
||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
||||
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
|
||||
|
||||
<para>Example 2 (Shorewall 4.5.10 or later):</para>
|
||||
<para>IPv4 Example 2 (Shorewall 4.5.10 or later):</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
|
||||
DROP all-:1.2.3.4 -
|
||||
DROP all 1.2.3.4</programlisting>
|
||||
|
||||
<para>or<programlisting>FORMAT 3
|
||||
<para>or<programlisting>?FORMAT 3
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
||||
DROP:P 1.2.3.4 -
|
||||
DROP:PO - 1.2.3.4
|
||||
</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>
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/conntrack</para>
|
||||
|
||||
<para>/etc/shorewall6/conntrack</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -722,14 +748,6 @@ DROP:PO - 1.2.3.4
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -25,8 +25,12 @@
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>IPv4 only.</para>
|
||||
|
||||
<para>Use this file to list the destinations for which you want to disable
|
||||
ECN (Explicit Congestion Notification).</para>
|
||||
ECN (Explicit Congestion Notification). Use of this file is deprecated in
|
||||
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>
|
||||
|
||||
@@ -65,14 +69,6 @@
|
||||
<refsect1>
|
||||
<title>See ALSO</title>
|
||||
|
||||
<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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -49,9 +49,10 @@
|
||||
|
||||
<para>Beginning in Shorewall 4.4.13, the second form of exclusion is
|
||||
allowed after <emphasis role="bold">all</emphasis> and <emphasis
|
||||
role="bold">any</emphasis> in the SOURCE and DEST columns of
|
||||
/etc/shorewall/rules. It allows you to omit arbitrary zones from the list
|
||||
generated by those key words.</para>
|
||||
role="bold">any</emphasis> in the SOURCE and DEST columns of <ulink
|
||||
url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(5). It allows
|
||||
you to omit arbitrary zones from the list generated by those key
|
||||
words.</para>
|
||||
|
||||
<warning>
|
||||
<para>If you omit a sub-zone and there is an explicit or explicit
|
||||
@@ -117,7 +118,7 @@ ACCEPT all!z2 net tcp 22</programlisting>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Example 1 - All IPv4 addresses except 192.168.3.4</term>
|
||||
<term>IPv4 Example 1 - All IPv4 addresses except 192.168.3.4</term>
|
||||
|
||||
<listitem>
|
||||
<para>!192.168.3.4</para>
|
||||
@@ -125,8 +126,8 @@ ACCEPT all!z2 net tcp 22</programlisting>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 2 - All IPv4 addresses except the network 192.168.1.0/24
|
||||
and the host 10.2.3.4</term>
|
||||
<term>IPv4 Example 2 - All IPv4 addresses except the network
|
||||
192.168.1.0/24 and the host 10.2.3.4</term>
|
||||
|
||||
<listitem>
|
||||
<para>!192.168.1.0/24,10.1.3.4</para>
|
||||
@@ -134,7 +135,7 @@ ACCEPT all!z2 net tcp 22</programlisting>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 3 - All IPv4 addresses except the range
|
||||
<term>IPv4 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>
|
||||
|
||||
<listitem>
|
||||
@@ -143,8 +144,8 @@ ACCEPT all!z2 net tcp 22</programlisting>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 4 - The network 192.168.1.0/24 except hosts 192.168.1.3
|
||||
and 192.168.1.9</term>
|
||||
<term>IPv4 Example 4 - The network 192.168.1.0/24 except hosts
|
||||
192.168.1.3 and 192.168.1.9</term>
|
||||
|
||||
<listitem>
|
||||
<para>192.168.1.0/24!192.168.1.3,192.168.1.9</para>
|
||||
@@ -176,14 +177,6 @@ ACCEPT all!z2 net tcp 22</programlisting>
|
||||
<refsect1>
|
||||
<title>See ALSO</title>
|
||||
|
||||
<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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/hosts</command>
|
||||
<command>/etc/shorewall[6]/hosts</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -270,6 +270,8 @@ vpn ppp+:192.168.3.0/24</programlisting></para>
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/hosts</para>
|
||||
|
||||
<para>/etc/shorewall6/hosts</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -278,14 +280,6 @@ vpn ppp+:192.168.3.0/24</programlisting></para>
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -165,14 +165,6 @@
|
||||
<refsect1>
|
||||
<title>See ALSO</title>
|
||||
|
||||
<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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/interfaces</command>
|
||||
<command>/etc/shorewall[6]/interfaces</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -199,11 +199,12 @@ loc eth2 -</programlisting>
|
||||
<term><emphasis role="bold">arp_filter[={0|1}]</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>If specified, this interface will only respond to ARP
|
||||
who-has requests for IP addresses configured on the interface.
|
||||
If not specified, the interface can respond to ARP who-has
|
||||
requests for IP addresses on any of the firewall's interface.
|
||||
The interface must be up when Shorewall is started.</para>
|
||||
<para>IPv4 only. If specified, this interface will only
|
||||
respond to ARP who-has requests for IP addresses configured on
|
||||
the interface. If not specified, the interface can respond to
|
||||
ARP who-has requests for IP addresses on any of the firewall's
|
||||
interface. The interface must be up when Shorewall is
|
||||
started.</para>
|
||||
|
||||
<para>Only those interfaces with the
|
||||
<option>arp_filter</option> option will have their setting
|
||||
@@ -225,8 +226,8 @@ loc eth2 -</programlisting>
|
||||
role="bold">arp_ignore</emphasis>[=<emphasis>number</emphasis>]</term>
|
||||
|
||||
<listitem>
|
||||
<para>If specified, this interface will respond to arp
|
||||
requests based on the value of <emphasis>number</emphasis>
|
||||
<para>IPv4 only. If specified, this interface will respond to
|
||||
arp requests based on the value of <emphasis>number</emphasis>
|
||||
(defaults to 1).</para>
|
||||
|
||||
<para>1 - reply only if the target IP address is local address
|
||||
@@ -257,7 +258,7 @@ loc eth2 -</programlisting>
|
||||
<warning>
|
||||
<para>Do not specify <emphasis
|
||||
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>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -303,6 +304,12 @@ loc eth2 -</programlisting>
|
||||
<para>Designates the interface as a bridge. Beginning with
|
||||
Shorewall 4.4.7, setting this option also sets
|
||||
<option>routeback</option>.</para>
|
||||
|
||||
<note>
|
||||
<para>If you have a bridge that you don't intend to define
|
||||
bport zones on, then it is best to omit this option and
|
||||
simply specify <option>routeback</option>.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -317,7 +324,7 @@ loc eth2 -</programlisting>
|
||||
and/or destination address is to be compared against the
|
||||
ipset-based dynamic blacklist (DYNAMIC_BLACKLIST=ipset... in
|
||||
<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
|
||||
DYNAMIC_BLACKLIST:</para>
|
||||
|
||||
@@ -405,13 +412,13 @@ loc eth2 -</programlisting>
|
||||
|
||||
<listitem>
|
||||
<para>the interface is a <ulink
|
||||
url="../SimpleBridge.html">simple bridge</ulink> with a
|
||||
DHCP server on one port and DHCP clients on another
|
||||
url="/SimpleBridge.html">simple bridge</ulink> with a DHCP
|
||||
server on one port and DHCP clients on another
|
||||
port.</para>
|
||||
|
||||
<note>
|
||||
<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
|
||||
DHCP-specific rules in <ulink
|
||||
url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(5).
|
||||
@@ -461,15 +468,15 @@ loc eth2 -</programlisting>
|
||||
role="bold">logmartians[={0|1}]</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Turn on kernel martian logging (logging of packets with
|
||||
impossible source addresses. It is strongly suggested that if
|
||||
you set <emphasis role="bold">routefilter</emphasis> on an
|
||||
interface that you also set <emphasis
|
||||
role="bold">logmartians</emphasis>. Even if you do not specify
|
||||
the <option>routefilter</option> option, it is a good idea to
|
||||
specify <option>logmartians</option> because your distribution
|
||||
may have enabled route filtering without you knowing
|
||||
it.</para>
|
||||
<para>IPv4 only. Turn on kernel martian logging (logging of
|
||||
packets with impossible source addresses. It is strongly
|
||||
suggested that if you set <emphasis
|
||||
role="bold">routefilter</emphasis> on an interface that you
|
||||
also set <emphasis role="bold">logmartians</emphasis>. Even if
|
||||
you do not specify the <option>routefilter</option> option, it
|
||||
is a good idea to specify <option>logmartians</option> because
|
||||
your distribution may have enabled route filtering without you
|
||||
knowing it.</para>
|
||||
|
||||
<para>Only those interfaces with the
|
||||
<option>logmartians</option> option will have their setting
|
||||
@@ -570,8 +577,8 @@ loc eth2 -</programlisting>
|
||||
<term><emphasis role="bold">nosmurfs</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Filter packets for smurfs (packets with a broadcast
|
||||
address as the source).</para>
|
||||
<para>IPv4 only. Filter packets for smurfs (packets with a
|
||||
broadcast address as the source).</para>
|
||||
|
||||
<para>Smurfs will be optionally logged based on the setting of
|
||||
SMURF_LOG_LEVEL in <ulink
|
||||
@@ -590,9 +597,9 @@ loc eth2 -</programlisting>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>a <filename
|
||||
class="directory">/proc/sys/net/ipv4/conf/</filename>
|
||||
class="directory">/proc/sys/net/ipv[46]/conf/</filename>
|
||||
entry for the interface cannot be modified (including for
|
||||
proxy ARP).</para>
|
||||
proxy ARP or proxy NDP).</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
@@ -632,7 +639,7 @@ loc eth2 -</programlisting>
|
||||
<term><emphasis role="bold">proxyarp[={0|1}]</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Sets
|
||||
<para>IPv4 only. Sets
|
||||
/proc/sys/net/ipv4/conf/<emphasis>interface</emphasis>/proxy_arp.
|
||||
Do NOT use this option if you are employing Proxy ARP through
|
||||
entries in <ulink
|
||||
@@ -653,6 +660,24 @@ loc eth2 -</programlisting>
|
||||
</listitem>
|
||||
</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>
|
||||
<term><emphasis role="bold">required</emphasis></term>
|
||||
|
||||
@@ -694,8 +719,8 @@ loc eth2 -</programlisting>
|
||||
role="bold">routefilter[={0|1|2}]</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Turn on kernel route filtering for this interface
|
||||
(anti-spoofing measure).</para>
|
||||
<para>IPv4 only. Turn on kernel route filtering for this
|
||||
interface (anti-spoofing measure).</para>
|
||||
|
||||
<para>Only those interfaces with the
|
||||
<option>routefilter</option> option will have their setting
|
||||
@@ -762,6 +787,13 @@ loc eth2 -</programlisting>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</note>
|
||||
|
||||
<para>Beginning with Shorewall 5.1.1, when
|
||||
<option>routefilter</option> is set to a non-zero value, the
|
||||
<option>logmartians</option> option is also implicitly set. If
|
||||
you actually want route filtering without logging, then you
|
||||
must also specify <option>logmartians=0</option> after
|
||||
<option>routefilter</option>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -873,10 +905,13 @@ loc eth2 -</programlisting>
|
||||
role="bold">routefilter</emphasis></member>
|
||||
|
||||
<member><emphasis
|
||||
role="bold">sourceroute</emphasis></member>
|
||||
role="bold">proxyarp</emphasis></member>
|
||||
|
||||
<member><emphasis
|
||||
role="bold">proxyndp</emphasis></member>
|
||||
role="bold">proxyudp</emphasis></member>
|
||||
|
||||
<member><emphasis
|
||||
role="bold">sourceroute</emphasis></member>
|
||||
</simplelist>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@@ -889,7 +924,9 @@ loc eth2 -</programlisting>
|
||||
<listitem>
|
||||
<para>Incoming requests from this interface may be remapped
|
||||
via UPNP (upnpd). See <ulink
|
||||
url="/UPnP.html">http://www.shorewall.net/UPnP.html</ulink>.</para>
|
||||
url="/UPnP.html">http://www.shorewall.net/UPnP.html</ulink>.
|
||||
Supported in IPv4 and in IPv6 in Shorewall 5.1.4 and
|
||||
later.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -903,7 +940,8 @@ loc eth2 -</programlisting>
|
||||
causes Shorewall to detect the default gateway through the
|
||||
interface and to accept UDP packets from that gateway. Note
|
||||
that, like all aspects of UPnP, this is a security hole so use
|
||||
this option at your own risk.</para>
|
||||
this option at your own risk. Supported in IPv4 and in IPv6 in
|
||||
Shorewall 5.1.4 and later.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -930,7 +968,7 @@ loc eth2 -</programlisting>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Example 1:</term>
|
||||
<term>IPv4 Example 1:</term>
|
||||
|
||||
<listitem>
|
||||
<para>Suppose you have eth0 connected to a DSL modem and eth1
|
||||
@@ -943,7 +981,7 @@ loc eth2 -</programlisting>
|
||||
|
||||
<para>Your entries for this setup would look like:</para>
|
||||
|
||||
<programlisting>FORMAT 1
|
||||
<programlisting>?FORMAT 1
|
||||
#ZONE INTERFACE BROADCAST OPTIONS
|
||||
net eth0 206.191.149.223 dhcp
|
||||
loc eth1 192.168.1.255
|
||||
@@ -958,7 +996,7 @@ dmz eth2 192.168.2.255</programlisting>
|
||||
<para>The same configuration without specifying broadcast addresses
|
||||
is:</para>
|
||||
|
||||
<programlisting>FORMAT 2
|
||||
<programlisting>?FORMAT 2
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 dhcp
|
||||
loc eth1
|
||||
@@ -973,7 +1011,7 @@ dmz eth2</programlisting>
|
||||
<para>You have a simple dial-in system with no Ethernet
|
||||
connections.</para>
|
||||
|
||||
<programlisting>FORMAT 2
|
||||
<programlisting>?FORMAT 2
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net ppp0 -</programlisting>
|
||||
</listitem>
|
||||
@@ -986,7 +1024,7 @@ net ppp0 -</programlisting>
|
||||
<para>You have a bridge with no IP address and you want to allow
|
||||
traffic through the bridge.</para>
|
||||
|
||||
<programlisting>FORMAT 2
|
||||
<programlisting>?FORMAT 2
|
||||
#ZONE INTERFACE OPTIONS
|
||||
- br0 bridge</programlisting>
|
||||
</listitem>
|
||||
@@ -998,6 +1036,8 @@ net ppp0 -</programlisting>
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/interfaces</para>
|
||||
|
||||
<para>/etc/shorewall6/interfaces</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -1006,13 +1046,6 @@ net ppp0 -</programlisting>
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -103,7 +103,7 @@
|
||||
|
||||
<important>
|
||||
<para>These additional match options are not available in <ulink
|
||||
url="shorewall-tcfilters.html">shorewall-tcfilters(5)</ulink>.</para>
|
||||
url="/manpages/shorewall-tcfilters.html">shorewall-tcfilters(5)</ulink>.</para>
|
||||
</important>
|
||||
|
||||
<para>Available options are:</para>
|
||||
@@ -251,34 +251,44 @@
|
||||
|
||||
<para>/etc/shorewall/accounting</para>
|
||||
|
||||
<para>/etc/shorewall6/accounting</para>
|
||||
|
||||
<para>/etc/shorewall/blrules</para>
|
||||
|
||||
<para>/etc/shorewall6/blrules</para>
|
||||
|
||||
<para>/etc/shorewall/hosts -- <emphasis role="bold">Note:</emphasis>
|
||||
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>
|
||||
Multiple matches enclosed in +[...] may not be used in this file.</para>
|
||||
|
||||
<para>/etc/shorewall/masq</para>
|
||||
<para>/etc/shorewall6/maclist -- <emphasis role="bold">Note:</emphasis>
|
||||
Multiple matches enclosed in +[...] may not be used in this file.</para>
|
||||
|
||||
<para>/etc/shorewall/rules</para>
|
||||
|
||||
<para>/etc/shorewall6/rules</para>
|
||||
|
||||
<para>/etc/shorewall/secmarks</para>
|
||||
|
||||
<para>/etc/shorewall6/secmarks</para>
|
||||
|
||||
<para>/etc/shorewall/mangle</para>
|
||||
|
||||
<para>/etc/shorewall6/mangle</para>
|
||||
|
||||
<para>/etc/shorewall/snat</para>
|
||||
|
||||
<para>/etc/shorewall6/snat</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See ALSO</title>
|
||||
|
||||
<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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/maclist</command>
|
||||
<command>/etc/shorewall[6]/maclist</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -97,6 +97,8 @@
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/maclist</para>
|
||||
|
||||
<para>/etc/shorewall6/maclist</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -108,14 +110,6 @@
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,31 +18,17 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/mangle</command>
|
||||
<command>/etc/shorewall[6]/mangle</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>This file was introduced in Shorewall 4.6.0 and is intended to
|
||||
replace <ulink
|
||||
<para>This file was introduced in Shorewall 4.6.0 and replaces <ulink
|
||||
url="/manpages/shorewall-tcrules.html">shorewall-tcrules(5)</ulink>. This
|
||||
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
|
||||
classifying them for traffic control or policy routing.</para>
|
||||
|
||||
@@ -117,9 +103,7 @@
|
||||
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.
|
||||
Additionally, a <replaceable>chain-designator</replaceable> may not
|
||||
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>
|
||||
be specified in an action body.</para>
|
||||
|
||||
<para>Where a command takes parameters, those parameters are
|
||||
enclosed in parentheses ("(....)") and separated by commas.</para>
|
||||
@@ -299,7 +283,7 @@
|
||||
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>,
|
||||
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
|
||||
TProxy 1 - - lo - tproxy</programlisting>
|
||||
@@ -365,8 +349,9 @@ DIVERTHA - - tcp</programlisting>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.0.6 as an alternative to entries in
|
||||
<ulink url="shorewall-ecn.html">shorewall-ecn(5)</ulink>. If a
|
||||
PROTO is specified, it must be 'tcp' (6). If no PROTO is
|
||||
<ulink
|
||||
url="/manpages/shorewall-ecn.html">shorewall-ecn(5)</ulink>.
|
||||
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
|
||||
the TCP header to be cleared.</para>
|
||||
</listitem>
|
||||
@@ -788,7 +773,7 @@ Normal-Service => 0x00</programlisting>
|
||||
<listitem>
|
||||
<para>where <replaceable>interface</replaceable> is the
|
||||
logical name of an interface defined in <ulink
|
||||
url="shorewall-interfaces.html">shorewall-interfaces</ulink>(5).
|
||||
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5).
|
||||
Matches packets entering the firewall from the named
|
||||
interface. May not be used in CLASSIFY rules or in rules using
|
||||
the :T chain qualifier.</para>
|
||||
@@ -864,7 +849,7 @@ Normal-Service => 0x00</programlisting>
|
||||
on the firewall and whose source IP address matches one of the
|
||||
listed addresses and does not match any address listed in the
|
||||
<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>
|
||||
</varlistentry>
|
||||
|
||||
@@ -911,11 +896,12 @@ Normal-Service => 0x00</programlisting>
|
||||
<listitem>
|
||||
<para>where <replaceable>interface</replaceable> is the
|
||||
logical name of an interface defined in <ulink
|
||||
url="shorewall-interfaces.html">shorewall-interfaces</ulink>(5).
|
||||
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5).
|
||||
Matches packets leaving the firewall through the named
|
||||
interface. May not be used in the PREROUTING chain (:P in the
|
||||
mark column or no chain qualifier and MARK_IN_FORWARD_CHAIN=No
|
||||
in <ulink url="manpages/shorewall.conf">shorewall.conf</ulink>
|
||||
in <ulink
|
||||
url="/manpages/shorewall.conf">shorewall.conf</ulink>
|
||||
(5)).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -952,7 +938,7 @@ Normal-Service => 0x00</programlisting>
|
||||
when both the outgoing interface and destination IP address
|
||||
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
|
||||
<ulink url="manpages/shorewall.conf">shorewall.conf</ulink>
|
||||
<ulink url="/manpages/shorewall.conf">shorewall.conf</ulink>
|
||||
(5)).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -967,7 +953,7 @@ Normal-Service => 0x00</programlisting>
|
||||
<replaceable>exclusion</replaceable>. May not be used in the
|
||||
PREROUTING chain (:P in the mark column or no chain qualifier
|
||||
and MARK_IN_FORWARD_CHAIN=No in <ulink
|
||||
url="manpages/shorewall.conf">shorewall.conf</ulink>
|
||||
url="/manpages/shorewall.conf">shorewall.conf</ulink>
|
||||
(5)).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -1028,15 +1014,16 @@ Normal-Service => 0x00</programlisting>
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">PROTO</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:udp</emphasis>|<emphasis
|
||||
role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis
|
||||
role="bold">all}[,...]}</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Protocol - <emphasis role="bold">ipp2p</emphasis> requires
|
||||
ipp2p match support in your kernel and iptables.</para>
|
||||
<para>See <ulink
|
||||
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink> for
|
||||
details.</para>
|
||||
|
||||
<para>Beginning with Shorewall 4.5.12, this column can accept a
|
||||
comma-separated list of protocols.</para>
|
||||
@@ -1542,7 +1529,7 @@ Normal-Service => 0x00</programlisting>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Example 1:</term>
|
||||
<term>IPv4 Example 1:</term>
|
||||
|
||||
<listitem>
|
||||
<para>Mark all ICMP echo traffic with packet mark 1. Mark all peer
|
||||
@@ -1571,7 +1558,7 @@ Normal-Service => 0x00</programlisting>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 2:</term>
|
||||
<term>IPv4 Example 2:</term>
|
||||
|
||||
<listitem>
|
||||
<para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in
|
||||
@@ -1583,12 +1570,41 @@ Normal-Service => 0x00</programlisting>
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
|
||||
CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW
|
||||
|
||||
/etc/shorewall/masq:
|
||||
/etc/shorewall/snat:
|
||||
|
||||
#INTERFACE SOURCE ADDRESS ...
|
||||
eth0 192.168.1.0/24 1.1.1.1 ; mark=1:C
|
||||
eth0 192.168.1.0/24 1.1.1.3 ; mark=2:C
|
||||
eth0 192.168.1.0/24 1.1.1.4 ; mark=3:C</programlisting>
|
||||
#ACTION SOURCE DEST ...
|
||||
SNAT(1.1.1.1) eth0:192.168.1.0/24 - { mark=1:C }
|
||||
SNAT(1.1.1.3) eth0:192.168.1.0/24 - { mark=2:C }
|
||||
SNAT(1.1.1.4) eth0:192.168.1.0/24 - { 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>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
@@ -1598,6 +1614,8 @@ Normal-Service => 0x00</programlisting>
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/mangle</para>
|
||||
|
||||
<para>/etc/shorewall6/mangle</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -1615,14 +1633,6 @@ Normal-Service => 0x00</programlisting>
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/etc/shorewall/masq</command>
|
||||
<command>/etc/shorewall[6]/masq</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -579,7 +579,7 @@
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Example 1:</term>
|
||||
<term>IPv4 Example 1:</term>
|
||||
|
||||
<listitem>
|
||||
<para>You have a simple masquerading setup where eth0 connects to a
|
||||
@@ -594,7 +594,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 2:</term>
|
||||
<term>IPv4 Example 2:</term>
|
||||
|
||||
<listitem>
|
||||
<para>You add a router to your local network to connect subnet
|
||||
@@ -607,7 +607,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 3:</term>
|
||||
<term>IPv4 Example 3:</term>
|
||||
|
||||
<listitem>
|
||||
<para>You have an IPSEC tunnel through ipsec0 and you want to
|
||||
@@ -620,7 +620,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 4:</term>
|
||||
<term>IPv4 Example 4:</term>
|
||||
|
||||
<listitem>
|
||||
<para>You want all outgoing traffic from 192.168.1.0/24 through eth0
|
||||
@@ -634,7 +634,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 5:</term>
|
||||
<term>IPv4 Example 5:</term>
|
||||
|
||||
<listitem>
|
||||
<para>You want all outgoing SMTP traffic entering the firewall from
|
||||
@@ -654,7 +654,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 6:</term>
|
||||
<term>IPv4 Example 6:</term>
|
||||
|
||||
<listitem>
|
||||
<para>Connections leaving on eth0 and destined to any host defined
|
||||
@@ -667,7 +667,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 7:</term>
|
||||
<term>IPv4 Example 7:</term>
|
||||
|
||||
<listitem>
|
||||
<para>SNAT outgoing connections on eth0 from 192.168.1.0/24 in
|
||||
@@ -689,7 +689,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Example 8:</term>
|
||||
<term>IPv4 Example 8:</term>
|
||||
|
||||
<listitem>
|
||||
<para>Your eth1 has two public IP addresses: 70.90.191.121 and
|
||||
@@ -716,6 +716,49 @@
|
||||
</programlisting>
|
||||
</listitem>
|
||||
</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>
|
||||
</refsect1>
|
||||
|
||||
@@ -723,6 +766,8 @@
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/masq</para>
|
||||
|
||||
<para>/etc/shorewall6/masq</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -731,14 +776,6 @@
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,11 +18,11 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>/usr/share/shorewall/modules</command>
|
||||
<command>/usr/share/shorewall[6]/modules</command>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>/usr/share/shorewall/helpers</command>
|
||||
<command>/usr/share/shorewall[6]/helpers</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -82,19 +82,19 @@
|
||||
<para>/etc/shorewall/modules</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>
|
||||
<title>See ALSO</title>
|
||||
|
||||
<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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -34,6 +34,8 @@
|
||||
url="/FAQ.htm#faq1">http://www.shorewall.net/FAQ.htm#faq1</ulink>. Also,
|
||||
in many cases, Proxy ARP (<ulink
|
||||
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>
|
||||
</warning>
|
||||
|
||||
@@ -199,7 +201,7 @@ all all REJECT info
|
||||
|
||||
<listitem>
|
||||
<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>
|
||||
</orderedlist>
|
||||
</refsect1>
|
||||
@@ -208,6 +210,8 @@ all all REJECT info
|
||||
<title>FILES</title>
|
||||
|
||||
<para>/etc/shorewall/nat</para>
|
||||
|
||||
<para>/etc/shorewall6/nat</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -219,14 +223,6 @@ all all REJECT info
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></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>
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -200,6 +200,16 @@
|
||||
<para>/etc/shorewall/policy</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>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user