forked from extern/shorewall_code
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
299d323977 |
27
Shorewall-core/configure
vendored
27
Shorewall-core/configure
vendored
@@ -91,8 +91,6 @@ for p in $@; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
cd $(dirname $0)
|
|
||||||
|
|
||||||
vendor=${params[HOST]}
|
vendor=${params[HOST]}
|
||||||
|
|
||||||
if [ -z "$vendor" ]; then
|
if [ -z "$vendor" ]; then
|
||||||
@@ -104,7 +102,7 @@ if [ -z "$vendor" ]; then
|
|||||||
vendor=redhat
|
vendor=redhat
|
||||||
;;
|
;;
|
||||||
debian|ubuntu)
|
debian|ubuntu)
|
||||||
vendor=debian
|
ls -l /sbin/init |fgrep -q systemd | vendor=debian.systemd | vendor=debian.sysvinit
|
||||||
;;
|
;;
|
||||||
opensuse)
|
opensuse)
|
||||||
vendor=suse
|
vendor=suse
|
||||||
@@ -124,6 +122,7 @@ if [ -z "$vendor" ]; then
|
|||||||
params[HOST]=apple
|
params[HOST]=apple
|
||||||
rcfile=shorewallrc.apple
|
rcfile=shorewallrc.apple
|
||||||
;;
|
;;
|
||||||
|
|
||||||
cygwin*|CYGWIN*)
|
cygwin*|CYGWIN*)
|
||||||
params[HOST]=cygwin
|
params[HOST]=cygwin
|
||||||
rcfile=shorewallrc.cygwin
|
rcfile=shorewallrc.cygwin
|
||||||
@@ -131,7 +130,7 @@ if [ -z "$vendor" ]; then
|
|||||||
*)
|
*)
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
params[HOST]=debian
|
params[HOST]=debian
|
||||||
ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit
|
rcfile=shorewallrc.debian.sysvinit
|
||||||
elif [ -f /etc/redhat-release ]; then
|
elif [ -f /etc/redhat-release ]; then
|
||||||
params[HOST]=redhat
|
params[HOST]=redhat
|
||||||
rcfile=shorewallrc.redhat
|
rcfile=shorewallrc.redhat
|
||||||
@@ -153,32 +152,25 @@ if [ -z "$vendor" ]; then
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
vendor=${params[HOST]}
|
|
||||||
else
|
|
||||||
if [ $vendor = linux ]; then
|
|
||||||
rcfile=shorewallrc.default;
|
|
||||||
elif [ $vendor = debian -a -f /etc/debian_version ]; then
|
|
||||||
ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit
|
|
||||||
else
|
|
||||||
rcfile=shorewallrc.$vendor
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
vendor=${params[HOST]}
|
||||||
|
elif [ $vendor = linux ]; then
|
||||||
|
rcfile=shorewallrc.default;
|
||||||
|
else
|
||||||
|
rcfile=shorewallrc.$vendor
|
||||||
if [ ! -f $rcfile ]; then
|
if [ ! -f $rcfile ]; then
|
||||||
echo "ERROR: $vendor is not a recognized host type" >&2
|
echo "ERROR: $vendor is not a recognized host type" >&2
|
||||||
exit 1
|
exit 1
|
||||||
elif [ $vendor = default ]; then
|
elif [ $vendor = default ]; then
|
||||||
params[HOST]=linux
|
params[HOST]=linux
|
||||||
vendor=linux
|
vendor=linux
|
||||||
elif [[ $vendor == debian.* ]]; then
|
|
||||||
params[HOST]=debian
|
|
||||||
vendor=debian
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $vendor = linux ]; then
|
if [ $vendor = linux ]; then
|
||||||
echo "INFO: Creating a generic Linux installation - " `date`;
|
echo "INFO: Creating a generic Linux installation - " `date`;
|
||||||
else
|
else
|
||||||
echo "INFO: Creating a ${params[HOST]}-specific installation - " `date`;
|
echo "INFO: Creating a ${vendor}-specific installation - " `date`;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -191,7 +183,6 @@ done
|
|||||||
|
|
||||||
echo '#' > shorewallrc
|
echo '#' > shorewallrc
|
||||||
echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc
|
echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc
|
||||||
echo "# rc file: $rcfile" >> shorewallrc
|
|
||||||
echo '#' >> shorewallrc
|
echo '#' >> shorewallrc
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
|
@@ -52,9 +52,6 @@ for ( @ARGV ) {
|
|||||||
$params{$pn} = $pv;
|
$params{$pn} = $pv;
|
||||||
}
|
}
|
||||||
|
|
||||||
use File::Basename;
|
|
||||||
chdir dirname($0);
|
|
||||||
|
|
||||||
my $vendor = $params{HOST};
|
my $vendor = $params{HOST};
|
||||||
my $rcfile;
|
my $rcfile;
|
||||||
my $rcfilename;
|
my $rcfilename;
|
||||||
@@ -84,39 +81,16 @@ unless ( defined $vendor ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( defined $vendor ) {
|
if ( defined $vendor ) {
|
||||||
if ( $vendor eq 'debian' && -f '/etc/debian_version' ) {
|
|
||||||
if ( -l '/sbin/init' ) {
|
|
||||||
if ( readlink('/sbin/init') =~ /systemd/ ) {
|
|
||||||
$rcfilename = 'shorewallrc.debian.systemd';
|
|
||||||
} else {
|
|
||||||
$rcfilename = 'shorewallrc.debian.sysvinit';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$rcfilename = 'shorewallrc.debian.sysvinit';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor;
|
$rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor;
|
||||||
}
|
|
||||||
|
|
||||||
unless ( -f $rcfilename ) {
|
unless ( -f $rcfilename ) {
|
||||||
die qq("ERROR: $vendor" is not a recognized host type);
|
die qq("ERROR: $vendor" is not a recognized host type);
|
||||||
} elsif ( $vendor eq 'default' ) {
|
} elsif ( $vendor eq 'default' ) {
|
||||||
$params{HOST} = $vendor = 'linux';
|
$params{HOST} = $vendor = 'linux';
|
||||||
} elsif ( $vendor =~ /^debian\./ ) {
|
|
||||||
$params{HOST} = $vendor = 'debian';
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( -f '/etc/debian_version' ) {
|
if ( -f '/etc/debian_version' ) {
|
||||||
$vendor = 'debian';
|
$vendor = 'debian';
|
||||||
if ( -l '/sbin/init' ) {
|
|
||||||
if ( readlink( '/sbin/init' ) =~ /systemd/ ) {
|
|
||||||
$rcfilename = 'shorewallrc.debian.systemd';
|
|
||||||
} else {
|
|
||||||
$rcfilename = 'shorewallrc.debian.sysvinit';
|
$rcfilename = 'shorewallrc.debian.sysvinit';
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$rcfilename = 'shorewallrc.debian.sysvinit';
|
|
||||||
}
|
|
||||||
} elsif ( -f '/etc/redhat-release' ){
|
} elsif ( -f '/etc/redhat-release' ){
|
||||||
$vendor = 'redhat';
|
$vendor = 'redhat';
|
||||||
$rcfilename = 'shorewallrc.redhat';
|
$rcfilename = 'shorewallrc.redhat';
|
||||||
@@ -173,8 +147,7 @@ my $outfile;
|
|||||||
|
|
||||||
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
|
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
|
||||||
|
|
||||||
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
|
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n#\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;
|
print $outfile "# Input: @ARGV\n#\n" if @ARGV;
|
||||||
|
|
||||||
|
@@ -24,9 +24,6 @@
|
|||||||
|
|
||||||
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
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
ME=$(basename $0)
|
ME=$(basename $0)
|
||||||
@@ -103,9 +100,6 @@ require()
|
|||||||
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Change to the directory containing this script
|
|
||||||
#
|
|
||||||
cd "$(dirname $0)"
|
cd "$(dirname $0)"
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -346,10 +340,8 @@ fi
|
|||||||
mkdir -p ${DESTDIR}${SBINDIR}
|
mkdir -p ${DESTDIR}${SBINDIR}
|
||||||
chmod 755 ${DESTDIR}${SBINDIR}
|
chmod 755 ${DESTDIR}${SBINDIR}
|
||||||
|
|
||||||
if [ -n "${MANDIR}" ]; then
|
mkdir -p ${DESTDIR}${MANDIR}
|
||||||
mkdir -p ${DESTDIR}${MANDIR}
|
chmod 755 ${DESTDIR}${MANDIR}
|
||||||
chmod 755 ${DESTDIR}${MANDIR}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${INITFILE}" ]; then
|
if [ -n "${INITFILE}" ]; then
|
||||||
mkdir -p ${DESTDIR}${INITDIR}
|
mkdir -p ${DESTDIR}${INITDIR}
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
# loaded after this one and replaces some of the functions declared here.
|
# loaded after this one and replaces some of the functions declared here.
|
||||||
#
|
#
|
||||||
|
|
||||||
SHOREWALL_CAPVERSION=50004
|
SHOREWALL_CAPVERSION=40609
|
||||||
|
|
||||||
[ -n "${g_program:=shorewall}" ]
|
[ -n "${g_program:=shorewall}" ]
|
||||||
|
|
||||||
@@ -908,26 +908,6 @@ show_events() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
show_actions() {
|
|
||||||
echo "A_ACCEPT # Audit and accept the connection"
|
|
||||||
echo "A_DROP # Audit and drop the connection"
|
|
||||||
echo "A_REJECT # Audit and reject the connection "
|
|
||||||
echo "allowBcast # Silently Allow Broadcast/multicast"
|
|
||||||
echo "allowInvalid # Accept packets that are in the INVALID conntrack state."
|
|
||||||
echo "allowinUPnP # Allow UPnP inbound (to firewall) traffic"
|
|
||||||
echo "allowoutUPnP # Allow traffic from local command 'upnpd' (does not work with kernels after 2.6.13)"
|
|
||||||
echo "dropBcast # Silently Drop Broadcast/multicast"
|
|
||||||
echo "dropInvalid # Silently Drop packets that are in the INVALID conntrack state"
|
|
||||||
echo "dropNotSyn # Silently Drop Non-syn TCP packets"
|
|
||||||
echo "forwardUPnP # Allow traffic that upnpd has redirected from"
|
|
||||||
echo "rejNotSyn # Silently Reject Non-syn TCP packets"
|
|
||||||
|
|
||||||
if [ -f ${g_confdir}/actions ]; then
|
|
||||||
cat ${g_sharedir}/actions.std ${g_confdir}/actions | grep -Ev '^\#|^$'
|
|
||||||
else
|
|
||||||
grep -Ev '^\#|^$' ${g_sharedir}/actions.std
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
#
|
#
|
||||||
# Show Command Executor
|
# Show Command Executor
|
||||||
#
|
#
|
||||||
@@ -1072,14 +1052,12 @@ show_command() {
|
|||||||
conntrack -f ipv6 -L $@ | show_connections_filter
|
conntrack -f ipv6 -L $@ | show_connections_filter
|
||||||
else
|
else
|
||||||
[ $# -gt 1 ] && usage 1
|
[ $# -gt 1 ] && usage 1
|
||||||
if [ -f /proc/sys/net/netfilter/nf_conntrack_count -a -f /proc/sys/net/nf_conntrack ]; then
|
|
||||||
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
|
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
|
||||||
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
|
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
|
||||||
echo "$g_product $SHOREWALL_VERSION Connections ($count of $max) at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION Connections ($count of $max) at $g_hostname - $(date)"
|
||||||
echo
|
echo
|
||||||
grep '^ipv6' /proc/net/nf_conntrack | sed -r 's/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | show_connections_filter
|
grep '^ipv6' /proc/net/nf_conntrack | sed -r 's/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | show_connections_filter
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
nat)
|
nat)
|
||||||
[ $# -gt 1 ] && usage 1
|
[ $# -gt 1 ] && usage 1
|
||||||
@@ -1297,7 +1275,25 @@ show_command() {
|
|||||||
case $1 in
|
case $1 in
|
||||||
actions)
|
actions)
|
||||||
[ $# -gt 1 ] && usage 1
|
[ $# -gt 1 ] && usage 1
|
||||||
show_actions | sort
|
echo "A_ACCEPT # Audit and accept the connection"
|
||||||
|
echo "A_DROP # Audit and drop the connection"
|
||||||
|
echo "A_REJECT # Audit and reject the connection "
|
||||||
|
echo "allowBcast # Silently Allow Broadcast/multicast"
|
||||||
|
echo "allowInvalid # Accept packets that are in the INVALID conntrack state."
|
||||||
|
echo "allowinUPnP # Allow UPnP inbound (to firewall) traffic"
|
||||||
|
echo "allowoutUPnP # Allow traffic from local command 'upnpd' (does not work with kernels after 2.6.13)"
|
||||||
|
echo "dropBcast # Silently Drop Broadcast/multicast"
|
||||||
|
echo "dropInvalid # Silently Drop packets that are in the INVALID conntrack state"
|
||||||
|
echo "dropNotSyn # Silently Drop Non-syn TCP packets"
|
||||||
|
echo "forwardUPnP # Allow traffic that upnpd has redirected from"
|
||||||
|
echo "rejNotSyn # Silently Reject Non-syn TCP packets"
|
||||||
|
|
||||||
|
if [ -f ${g_confdir}/actions ]; then
|
||||||
|
cat ${g_sharedir}/actions.std ${g_confdir}/actions | grep -Ev '^\#|^$'
|
||||||
|
else
|
||||||
|
grep -Ev '^\#|^$' ${g_sharedir}/actions.std
|
||||||
|
fi
|
||||||
|
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
macro)
|
macro)
|
||||||
@@ -1628,7 +1624,7 @@ do_dump_command() {
|
|||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
qt mywhich ss && ss -${g_family}tunap || { qt mywhich netstat && netatat -tunap; }
|
ss -${g_family}tunap
|
||||||
|
|
||||||
if [ -n "$TC_ENABLED" ]; then
|
if [ -n "$TC_ENABLED" ]; then
|
||||||
heading "Traffic Control"
|
heading "Traffic Control"
|
||||||
@@ -2595,7 +2591,6 @@ determine_capabilities() {
|
|||||||
TARPIT_TARGET=
|
TARPIT_TARGET=
|
||||||
IFACE_MATCH=
|
IFACE_MATCH=
|
||||||
TCPMSS_TARGET=
|
TCPMSS_TARGET=
|
||||||
WAIT_OPTION=
|
|
||||||
|
|
||||||
AMANDA_HELPER=
|
AMANDA_HELPER=
|
||||||
FTP_HELPER=
|
FTP_HELPER=
|
||||||
@@ -2619,11 +2614,6 @@ determine_capabilities() {
|
|||||||
qt $arptables -L OUT && ARPTABLESJF=Yes
|
qt $arptables -L OUT && ARPTABLESJF=Yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if qt $g_tool --wait -t filter -L INPUT -n -v; then
|
|
||||||
WAIT_OPTION=Yes
|
|
||||||
tool="$tool --wait"
|
|
||||||
fi
|
|
||||||
|
|
||||||
chain=fooX$$
|
chain=fooX$$
|
||||||
|
|
||||||
if [ -n "$NAT_ENABLED" ]; then
|
if [ -n "$NAT_ENABLED" ]; then
|
||||||
@@ -3082,10 +3072,8 @@ report_capabilities_unsorted() {
|
|||||||
|
|
||||||
if [ $g_family -eq 4 ]; then
|
if [ $g_family -eq 4 ]; then
|
||||||
report_capability "iptables -S (IPTABLES_S)" $IPTABLES_S
|
report_capability "iptables -S (IPTABLES_S)" $IPTABLES_S
|
||||||
report_capability "iptables --wait option (WAIT_OPTION)" $WAIT_OPTION
|
|
||||||
else
|
else
|
||||||
report_capability "ip6tables -S (IPTABLES_S)" $IPTABLES_S
|
report_capability "ip6tables -S (IPTABLES_S)" $IPTABLES_S
|
||||||
report_capability "ip6tables --wait option (WAIT_OPTION)" $WAIT_OPTION
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
report_capability "Basic Filter (BASIC_FILTER)" $BASIC_FILTER
|
report_capability "Basic Filter (BASIC_FILTER)" $BASIC_FILTER
|
||||||
@@ -3195,7 +3183,6 @@ report_capabilities_unsorted1() {
|
|||||||
report_capability1 TARPIT_TARGET
|
report_capability1 TARPIT_TARGET
|
||||||
report_capability1 IFACE_MATCH
|
report_capability1 IFACE_MATCH
|
||||||
report_capability1 TCPMSS_TARGET
|
report_capability1 TCPMSS_TARGET
|
||||||
report_capability1 WAIT_OPTION
|
|
||||||
|
|
||||||
report_capability1 AMANDA_HELPER
|
report_capability1 AMANDA_HELPER
|
||||||
report_capability1 FTP_HELPER
|
report_capability1 FTP_HELPER
|
||||||
@@ -3274,11 +3261,9 @@ show_interfaces() {
|
|||||||
local printed
|
local printed
|
||||||
|
|
||||||
for f in ${VARDIR}/*.status; do
|
for f in ${VARDIR}/*.status; do
|
||||||
if [ -f $f ]; then
|
|
||||||
interface=$(basename $f)
|
interface=$(basename $f)
|
||||||
echo " Interface ${interface%.status} is $(interface_status $f)"
|
echo " Interface ${interface%.status} is $(interface_status $f)"
|
||||||
printed=Yes
|
printed=Yes
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$printed" ] && echo
|
[ -n "$printed" ] && echo
|
||||||
|
@@ -316,7 +316,6 @@ reload_kernel_modules() {
|
|||||||
local moduleloader
|
local moduleloader
|
||||||
moduleloader=modprobe
|
moduleloader=modprobe
|
||||||
local uname
|
local uname
|
||||||
local extras
|
|
||||||
|
|
||||||
if ! qt mywhich modprobe; then
|
if ! qt mywhich modprobe; then
|
||||||
moduleloader=insmod
|
moduleloader=insmod
|
||||||
@@ -324,25 +323,9 @@ reload_kernel_modules() {
|
|||||||
|
|
||||||
[ -n "${MODULE_SUFFIX:=ko ko.gz ko.xz o o.gz o.xz gz xz}" ]
|
[ -n "${MODULE_SUFFIX:=ko ko.gz ko.xz o o.gz o.xz gz xz}" ]
|
||||||
|
|
||||||
if [ -n "$MODULESDIR" ]; then
|
[ -z "$MODULESDIR" ] && \
|
||||||
case "$MODULESDIR" in
|
uname=$(uname -r) && \
|
||||||
+*)
|
|
||||||
extras="$MODULESDIR"
|
|
||||||
extras=${extras#+}
|
|
||||||
MODULESDIR=
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$MODULESDIR" ]; then
|
|
||||||
uname=$(uname -r)
|
|
||||||
MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
|
MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
|
||||||
if [ -n "$extras" ]; then
|
|
||||||
for directory in $(split "$extras"); do
|
|
||||||
MODULESDIR="$MODULESDIR:/lib/modules/$uname/$directory"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -d /sys/module/ ] || MODULES=$(lsmod | cut -d ' ' -f1)
|
[ -d /sys/module/ ] || MODULES=$(lsmod | cut -d ' ' -f1)
|
||||||
|
|
||||||
@@ -372,7 +355,6 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
|
|||||||
local savemoduleinfo
|
local savemoduleinfo
|
||||||
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
|
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
|
||||||
local uname
|
local uname
|
||||||
local extras
|
|
||||||
|
|
||||||
if ! qt mywhich modprobe; then
|
if ! qt mywhich modprobe; then
|
||||||
moduleloader=insmod
|
moduleloader=insmod
|
||||||
@@ -380,25 +362,9 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
|
|||||||
|
|
||||||
[ -n "${MODULE_SUFFIX:=o gz xz ko o.gz o.xz ko.gz ko.xz}" ]
|
[ -n "${MODULE_SUFFIX:=o gz xz ko o.gz o.xz ko.gz ko.xz}" ]
|
||||||
|
|
||||||
if [ -n "$MODULESDIR" ]; then
|
[ -z "$MODULESDIR" ] && \
|
||||||
case "$MODULESDIR" in
|
uname=$(uname -r) && \
|
||||||
+*)
|
|
||||||
extras="$MODULESDIR"
|
|
||||||
extras=${extras#+}
|
|
||||||
MODULESDIR=
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$MODULESDIR" ]; then
|
|
||||||
uname=$(uname -r)
|
|
||||||
MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
|
MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
|
||||||
if [ -n "$extras" ]; then
|
|
||||||
for directory in $(split "$extras"); do
|
|
||||||
MODULESDIR="$MODULESDIR:/lib/modules/$uname/$directory"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
for directory in $(split $MODULESDIR); do
|
for directory in $(split $MODULESDIR); do
|
||||||
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
|
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
|
||||||
|
@@ -3,21 +3,24 @@
|
|||||||
#
|
#
|
||||||
# Input: host=openwrt
|
# Input: host=openwrt
|
||||||
#
|
#
|
||||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
HOST=openwrt
|
||||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
PREFIX=/usr
|
||||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
SHAREDIR=${PREFIX}/share
|
||||||
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
|
LIBEXECDIR=${PREFIX}/share
|
||||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
PERLLIBDIR=${PREFIX}/share/shorewall
|
||||||
SBINDIR=/sbin #Directory where system administration programs are installed
|
CONFDIR=/etc
|
||||||
MANDIR= #Directory where manpages are installed.
|
SBINDIR=/sbin
|
||||||
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
|
MANDIR=${PREFIX}/man
|
||||||
INITFILE=$PRODUCT #Name of the product's installed SysV init script
|
INITDIR=/etc/init.d
|
||||||
INITSOURCE=init.openwrt.sh #Name of the distributed file to be installed as the SysV init script
|
INITSOURCE=init.openwrt.sh
|
||||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
INITFILE=$PRODUCT
|
||||||
SYSCONFDIR=${CONFDIR}/sysconfig #Directory where SysV init parameter files are installed
|
AUXINITSOURCE=
|
||||||
SYSCONFFILE=sysconfig #Name of the distributed file to be installed in $SYSCONFDIR
|
AUXINITFILE=
|
||||||
SERVICEDIR= #Directory where .service files are installed (systems running systemd only)
|
SERVICEDIR=
|
||||||
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
|
SERVICEFILE=
|
||||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SYSCONFFILE=default.openwrt
|
||||||
VARLIB=/lib #Directory where product variable data is stored.
|
SYSCONFDIR=${CONFDIR}/sysconfig
|
||||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
SPARSE=
|
||||||
|
ANNOTATED=
|
||||||
|
VARLIB=/lib
|
||||||
|
VARDIR=${VARLIB}/$PRODUCT
|
||||||
|
@@ -27,8 +27,6 @@
|
|||||||
# shown below. Simply run this script to remove Shorewall Firewall
|
# shown below. Simply run this script to remove Shorewall Firewall
|
||||||
|
|
||||||
VERSION=xxx #The Build script inserts the actual version
|
VERSION=xxx #The Build script inserts the actual version
|
||||||
PRODUCT="shorewall-core"
|
|
||||||
Product="Shorewall Core"
|
|
||||||
|
|
||||||
usage() # $1 = exit status
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
@@ -68,11 +66,6 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Change to the directory containing this script
|
|
||||||
#
|
|
||||||
cd "$(dirname $0)"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the RC file
|
# Read the RC file
|
||||||
#
|
#
|
||||||
|
@@ -1,131 +0,0 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
|
||||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.0
|
|
||||||
#
|
|
||||||
# (c) 2010,2012-2014 - Tom Eastep (teastep@shorewall.net)
|
|
||||||
# (c) 2016 - Matt Darfeuille (matdarf@gmail.com)
|
|
||||||
#
|
|
||||||
# On most distributions, this file should be called /etc/init.d/shorewall-init.
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
# arg1 of init script is arg2 when rc.common is sourced
|
|
||||||
|
|
||||||
case "$action" in
|
|
||||||
start|stop|boot)
|
|
||||||
if [ "$(id -u)" != "0" ]
|
|
||||||
then
|
|
||||||
echo "You must be root to start, stop or restart \"Shorewall \"."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if shorewall-init is configured or not
|
|
||||||
if [ -f "/etc/sysconfig/shorewall-init" ]
|
|
||||||
then
|
|
||||||
. /etc/sysconfig/shorewall-init
|
|
||||||
if [ -z "$PRODUCTS" ]
|
|
||||||
then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
;;
|
|
||||||
enable|disable|enabled)
|
|
||||||
# Openwrt related
|
|
||||||
# start and stop runlevel variable
|
|
||||||
START=19
|
|
||||||
STOP=91
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: /etc/init.d/shorewall-init {start|stop}"
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
#
|
|
||||||
# The installer may alter this
|
|
||||||
#
|
|
||||||
. /usr/share/shorewall/shorewallrc
|
|
||||||
|
|
||||||
# Locate the current PRODUCT's statedir
|
|
||||||
setstatedir() {
|
|
||||||
local statedir
|
|
||||||
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
|
||||||
statedir=$( . ${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
|
||||||
${SBINDIR}/$PRODUCT ${OPTIONS} compile $STATEDIR/firewall
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Initialize the firewall
|
|
||||||
start () {
|
|
||||||
local PRODUCT
|
|
||||||
local STATEDIR
|
|
||||||
|
|
||||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
|
||||||
for PRODUCT in $PRODUCTS; do
|
|
||||||
if setstatedir; then
|
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
|
||||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
|
||||||
${STATEDIR}/firewall ${OPTIONS} stop
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
|
||||||
ipset -R < "$SAVE_IPSETS"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
boot () {
|
|
||||||
start
|
|
||||||
}
|
|
||||||
|
|
||||||
# Clear the firewall
|
|
||||||
stop () {
|
|
||||||
local PRODUCT
|
|
||||||
local STATEDIR
|
|
||||||
|
|
||||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
|
||||||
for PRODUCT in $PRODUCTS; do
|
|
||||||
if setstatedir; then
|
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -n "$SAVE_IPSETS" ]; then
|
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
@@ -28,8 +28,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
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
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
@@ -73,50 +71,39 @@ mywhich() {
|
|||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_install()
|
||||||
|
{
|
||||||
|
if ! install $*; then
|
||||||
|
echo
|
||||||
|
echo "ERROR: Failed to install $*" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cant_autostart()
|
cant_autostart()
|
||||||
{
|
{
|
||||||
echo
|
echo
|
||||||
echo "WARNING: Unable to configure shorewall init to start automatically at boot" >&2
|
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
|
|
||||||
if chmod $3 $2; then
|
|
||||||
if [ -n "$OWNER" ]; then
|
|
||||||
if chown $OWNER:$GROUP $2; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "ERROR: Failed to install $2" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
make_directory() # $1 = directory , $2 = mode
|
|
||||||
{
|
|
||||||
mkdir -p $1
|
|
||||||
chmod 0755 $1
|
|
||||||
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
|
|
||||||
}
|
|
||||||
|
|
||||||
require()
|
require()
|
||||||
{
|
{
|
||||||
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
install_file() # $1 = source $2 = target $3 = mode
|
||||||
# Change to the directory containing this script
|
{
|
||||||
#
|
run_install $T $OWNERSHIP -m $3 $1 ${2}
|
||||||
|
}
|
||||||
|
|
||||||
cd "$(dirname $0)"
|
cd "$(dirname $0)"
|
||||||
|
|
||||||
|
PRODUCT=shorewall-init
|
||||||
|
|
||||||
#
|
#
|
||||||
# Parse the run line
|
# Parse the run line
|
||||||
#
|
#
|
||||||
|
T='-T'
|
||||||
|
|
||||||
finished=0
|
finished=0
|
||||||
configure=1
|
configure=1
|
||||||
@@ -243,8 +230,6 @@ if [ -z "$BUILD" ]; then
|
|||||||
BUILD=slackware
|
BUILD=slackware
|
||||||
elif [ -f /etc/arch-release ] ; then
|
elif [ -f /etc/arch-release ] ; then
|
||||||
BUILD=archlinux
|
BUILD=archlinux
|
||||||
elif [ -f ${CONFDIR}/openwrt_release ]; then
|
|
||||||
BUILD=openwrt
|
|
||||||
else
|
else
|
||||||
BUILD=linux
|
BUILD=linux
|
||||||
fi
|
fi
|
||||||
@@ -252,24 +237,22 @@ if [ -z "$BUILD" ]; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -n "$OWNER" ] || OWNER=$(id -un)
|
||||||
|
[ -n "$GROUP" ] || GROUP=$(id -gn)
|
||||||
|
|
||||||
case $BUILD in
|
case $BUILD in
|
||||||
apple)
|
apple)
|
||||||
[ -z "$OWNER" ] && OWNER=root
|
T=
|
||||||
[ -z "$GROUP" ] && GROUP=wheel
|
|
||||||
;;
|
;;
|
||||||
cygwin*|CYGWIN*)
|
debian|gentoo|redhat|suse|slackware|archlinux)
|
||||||
OWNER=$(id -un)
|
|
||||||
GROUP=$(id -gn)
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ $(id -u) -eq 0 ]; then
|
[ -n "$BUILD" ] && echo "ERROR: Unknown BUILD environment ($BUILD)" >&2 || echo "ERROR: Unknown BUILD environment"
|
||||||
[ -z "$OWNER" ] && OWNER=root
|
exit 1
|
||||||
[ -z "$GROUP" ] && GROUP=root
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$OWNER" ] && OWNERSHIP="$OWNER:$GROUP"
|
OWNERSHIP="-o $OWNER -g $GROUP"
|
||||||
|
|
||||||
[ -n "$HOST" ] || HOST=$BUILD
|
[ -n "$HOST" ] || HOST=$BUILD
|
||||||
|
|
||||||
@@ -294,9 +277,6 @@ case "$HOST" in
|
|||||||
suse)
|
suse)
|
||||||
echo "Installing SuSE-specific configuration..."
|
echo "Installing SuSE-specific configuration..."
|
||||||
;;
|
;;
|
||||||
openwrt)
|
|
||||||
echo "Installing Openwrt-specific configuration..."
|
|
||||||
;;
|
|
||||||
linux)
|
linux)
|
||||||
echo "ERROR: Shorewall-init is not supported on this system" >&2
|
echo "ERROR: Shorewall-init is not supported on this system" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -310,12 +290,12 @@ esac
|
|||||||
[ -z "$TARGET" ] && TARGET=$HOST
|
[ -z "$TARGET" ] && TARGET=$HOST
|
||||||
|
|
||||||
if [ -n "$DESTDIR" ]; then
|
if [ -n "$DESTDIR" ]; then
|
||||||
if [ $(id -u) != 0 ] ; then
|
if [ `id -u` != 0 ] ; then
|
||||||
echo "Not setting file owner/group permissions, not running as root."
|
echo "Not setting file owner/group permissions, not running as root."
|
||||||
OWNERSHIP=""
|
OWNERSHIP=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make_directory ${DESTDIR}${INITDIR} 0755
|
install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing Shorewall Init Version $VERSION"
|
echo "Installing Shorewall Init Version $VERSION"
|
||||||
@@ -331,7 +311,7 @@ fi
|
|||||||
|
|
||||||
if [ -n "$DESTDIR" ]; then
|
if [ -n "$DESTDIR" ]; then
|
||||||
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
|
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
|
||||||
chmod 0755 ${DESTDIR}${CONFDIR}/logrotate.d
|
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -359,14 +339,14 @@ fi
|
|||||||
if [ -n "$SERVICEDIR" ]; then
|
if [ -n "$SERVICEDIR" ]; then
|
||||||
mkdir -p ${DESTDIR}${SERVICEDIR}
|
mkdir -p ${DESTDIR}${SERVICEDIR}
|
||||||
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
|
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
|
||||||
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644
|
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
|
||||||
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
|
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
|
||||||
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
|
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
|
||||||
if [ -n "$DESTDIR" -o $configure -eq 0 ]; then
|
if [ -n "$DESTDIR" -o $configure -eq 0 ]; then
|
||||||
mkdir -p ${DESTDIR}${SBINDIR}
|
mkdir -p ${DESTDIR}${SBINDIR}
|
||||||
chmod 0755 ${DESTDIR}${SBINDIR}
|
chmod 755 ${DESTDIR}${SBINDIR}
|
||||||
fi
|
fi
|
||||||
install_file shorewall-init ${DESTDIR}${SBINDIR}/shorewall-init 0700
|
run_install $OWNERSHIP -m 700 shorewall-init ${DESTDIR}${SBINDIR}/shorewall-init
|
||||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/shorewall-init
|
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/shorewall-init
|
||||||
echo "CLI installed as ${DESTDIR}${SBINDIR}/shorewall-init"
|
echo "CLI installed as ${DESTDIR}${SBINDIR}/shorewall-init"
|
||||||
fi
|
fi
|
||||||
@@ -375,13 +355,13 @@ fi
|
|||||||
# Create /usr/share/shorewall-init if needed
|
# Create /usr/share/shorewall-init if needed
|
||||||
#
|
#
|
||||||
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall-init
|
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall-init
|
||||||
chmod 0755 ${DESTDIR}${SHAREDIR}/shorewall-init
|
chmod 755 ${DESTDIR}${SHAREDIR}/shorewall-init
|
||||||
|
|
||||||
#
|
#
|
||||||
# Install logrotate file
|
# Install logrotate file
|
||||||
#
|
#
|
||||||
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
|
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
|
||||||
install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 0644
|
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT
|
||||||
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
|
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -389,7 +369,7 @@ fi
|
|||||||
# Create the version file
|
# Create the version file
|
||||||
#
|
#
|
||||||
echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/shorewall-init/version
|
echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/shorewall-init/version
|
||||||
chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall-init/version
|
chmod 644 ${DESTDIR}${SHAREDIR}/shorewall-init/version
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove and create the symbolic link to the init script
|
# Remove and create the symbolic link to the init script
|
||||||
@@ -432,9 +412,6 @@ else
|
|||||||
elif [ $HOST = gentoo ]; then
|
elif [ $HOST = gentoo ]; then
|
||||||
# Gentoo does not support if-{up,down}.d
|
# Gentoo does not support if-{up,down}.d
|
||||||
/bin/true
|
/bin/true
|
||||||
elif [ $HOST = openwrt ]; then
|
|
||||||
# Not implemented on openwrt
|
|
||||||
/bin/true
|
|
||||||
else
|
else
|
||||||
mkdir -p ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d
|
mkdir -p ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d
|
||||||
fi
|
fi
|
||||||
@@ -442,8 +419,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
|
if [ -n "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
|
||||||
install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT 0644
|
run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT
|
||||||
echo "${SYSCONFFILE} file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
echo "$SYSCONFFILE installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ $HOST = suse ] && IFUPDOWN=ifupdown.suse.sh || IFUPDOWN=ifupdown.fedora.sh
|
[ $HOST = suse ] && IFUPDOWN=ifupdown.suse.sh || IFUPDOWN=ifupdown.fedora.sh
|
||||||
@@ -453,15 +430,13 @@ fi
|
|||||||
# Install the ifupdown script
|
# Install the ifupdown script
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ $HOST != openwrt ]; then
|
cp $IFUPDOWN ifupdown
|
||||||
cp $IFUPDOWN ifupdown
|
|
||||||
|
|
||||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
|
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
|
||||||
|
|
||||||
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
|
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
|
||||||
|
|
||||||
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
|
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
|
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
|
||||||
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/
|
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/
|
||||||
@@ -514,11 +489,12 @@ case $HOST in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -z "$DESTDIR" ]; then
|
if [ -z "$DESTDIR" ]; then
|
||||||
if [ $configure -eq 1 -a -n "first_install" ]; then
|
if [ $configure -eq 1 -a -n "$first_install" ]; then
|
||||||
if [ $HOST = debian ]; then
|
if [ $HOST = debian ]; then
|
||||||
if [ -n "$SERVICEDIR" ]; then
|
if [ -n "$SERVICEDIR" ]; then
|
||||||
if systemctl enable ${PRODUCT}.service; then
|
if systemctl enable ${PRODUCT}.service; then
|
||||||
echo "Shorewall Init will start automatically at boot"
|
echo "Shorewall Init will start automatically at
|
||||||
|
boot"
|
||||||
fi
|
fi
|
||||||
elif mywhich insserv; then
|
elif mywhich insserv; then
|
||||||
if insserv ${INITDIR}/shorewall-init; then
|
if insserv ${INITDIR}/shorewall-init; then
|
||||||
@@ -536,13 +512,6 @@ if [ -z "$DESTDIR" ]; then
|
|||||||
else
|
else
|
||||||
cant_autostart
|
cant_autostart
|
||||||
fi
|
fi
|
||||||
elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then
|
|
||||||
/etc/init.d/$PRODUCT enable
|
|
||||||
if /etc/init.d/$PRODUCT enabled; then
|
|
||||||
echo "$Product will start automatically at boot"
|
|
||||||
else
|
|
||||||
cant_autostart
|
|
||||||
fi
|
|
||||||
elif [ $HOST = gentoo ]; then
|
elif [ $HOST = gentoo ]; then
|
||||||
# On Gentoo, a service must be enabled manually by the user,
|
# On Gentoo, a service must be enabled manually by the user,
|
||||||
# not by the installer
|
# not by the installer
|
||||||
@@ -571,13 +540,6 @@ if [ -z "$DESTDIR" ]; then
|
|||||||
else
|
else
|
||||||
cant_autostart
|
cant_autostart
|
||||||
fi
|
fi
|
||||||
elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then
|
|
||||||
/etc/init.d/shorewall-inir enable
|
|
||||||
if /etc/init.d/shorewall-init enabled; then
|
|
||||||
echo "Shorrewall Init will start automatically at boot"
|
|
||||||
else
|
|
||||||
cant_autostart
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
cant_autostart
|
cant_autostart
|
||||||
fi
|
fi
|
||||||
|
@@ -5,8 +5,7 @@
|
|||||||
#
|
#
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Shorewall firewall (bootup security)
|
Description=Shorewall firewall (bootup security)
|
||||||
Before=network-pre.target
|
Before=network.target
|
||||||
Wants=network-pre.target
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
20
Shorewall-init/shorewall-init.service.214
Normal file
20
Shorewall-init/shorewall-init.service.214
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#
|
||||||
|
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
|
||||||
|
#
|
||||||
|
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
|
||||||
|
#
|
||||||
|
[Unit]
|
||||||
|
Description=Shorewall firewall (bootup security)
|
||||||
|
Before=network-pre.target
|
||||||
|
Wants=network-pre.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
EnvironmentFile=-/etc/sysconfig/shorewall-init
|
||||||
|
StandardOutput=syslog
|
||||||
|
ExecStart=/sbin/shorewall-init start
|
||||||
|
ExecStop=/sbin/shorewall-init stop
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=basic.target
|
21
Shorewall-init/shorewall-init.service.214.debian
Normal file
21
Shorewall-init/shorewall-init.service.214.debian
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
|
||||||
|
#
|
||||||
|
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
|
||||||
|
# Copyright 2015 Tom Eastep <teastep@shorewall.net>
|
||||||
|
#
|
||||||
|
[Unit]
|
||||||
|
Description=Shorewall firewall (bootup security)
|
||||||
|
Before=network-pre.target
|
||||||
|
Wants=network-pre.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
EnvironmentFile=-/etc/default/shorewall-init
|
||||||
|
StandardOutput=syslog
|
||||||
|
ExecStart=/sbin/shorewall-init start
|
||||||
|
ExecStop=/sbin/shorewall-init stop
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=basic.target
|
@@ -27,8 +27,6 @@
|
|||||||
# shown below. Simply run this script to remove Shorewall Firewall
|
# shown below. Simply run this script to remove Shorewall Firewall
|
||||||
|
|
||||||
VERSION=xxx #The Build script inserts the actual version
|
VERSION=xxx #The Build script inserts the actual version
|
||||||
PRODUCT=shorewall-init
|
|
||||||
Product="Shorewall Init"
|
|
||||||
|
|
||||||
usage() # $1 = exit status
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
@@ -77,11 +75,6 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Change to the directory containing this script
|
|
||||||
#
|
|
||||||
cd "$(dirname $0)"
|
|
||||||
|
|
||||||
finished=0
|
finished=0
|
||||||
configure=1
|
configure=1
|
||||||
|
|
||||||
@@ -169,11 +162,7 @@ INITSCRIPT=${CONFDIR}/init.d/shorewall-init
|
|||||||
|
|
||||||
if [ -f "$INITSCRIPT" ]; then
|
if [ -f "$INITSCRIPT" ]; then
|
||||||
if [ $configure -eq 1 ]; then
|
if [ $configure -eq 1 ]; then
|
||||||
if [ $HOST = openwrt ]; then
|
if mywhich updaterc.d ; then
|
||||||
if /etc/init.d/shorewall-init enabled; then
|
|
||||||
/etc/init.d/shorewall-init disable
|
|
||||||
fi
|
|
||||||
elif mywhich updaterc.d ; then
|
|
||||||
updaterc.d shorewall-init remove
|
updaterc.d shorewall-init remove
|
||||||
elif mywhich insserv ; then
|
elif mywhich insserv ; then
|
||||||
insserv -r $INITSCRIPT
|
insserv -r $INITSCRIPT
|
||||||
@@ -194,13 +183,8 @@ if [ -n "$SERVICEDIR" ]; then
|
|||||||
rm -f $SERVICEDIR/shorewall-init.service
|
rm -f $SERVICEDIR/shorewall-init.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $HOST = openwrt ]; then
|
[ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
|
||||||
[ "$(readlink -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 -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && 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
|
|
||||||
fi
|
|
||||||
|
|
||||||
remove_file ${CONFDIR}/default/shorewall-init
|
remove_file ${CONFDIR}/default/shorewall-init
|
||||||
remove_file ${CONFDIR}/sysconfig/shorewall-init
|
remove_file ${CONFDIR}/sysconfig/shorewall-init
|
||||||
@@ -214,6 +198,8 @@ remove_file ${CONFDIR}/network/if-post-down.d/shorewall
|
|||||||
remove_file ${CONFDIR}/sysconfig/network/if-up.d/shorewall
|
remove_file ${CONFDIR}/sysconfig/network/if-up.d/shorewall
|
||||||
remove_file ${CONFDIR}/sysconfig/network/if-down.d/shorewall
|
remove_file ${CONFDIR}/sysconfig/network/if-down.d/shorewall
|
||||||
|
|
||||||
|
[ -n "$SYSTEMD" ] && remove_file ${SYSTEMD}/shorewall.service
|
||||||
|
|
||||||
if [ -d ${CONFDIR}/ppp ]; then
|
if [ -d ${CONFDIR}/ppp ]; then
|
||||||
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
|
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
|
||||||
remove_file ${CONFDIR}/ppp/$directory/shorewall
|
remove_file ${CONFDIR}/ppp/$directory/shorewall
|
||||||
|
25
Shorewall-lite/default.openwrt
Normal file
25
Shorewall-lite/default.openwrt
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# sysV init file script configuration(/etc/sysconfdir/shorewall-lite)
|
||||||
|
|
||||||
|
# startup option(default "-vvv")
|
||||||
|
OPTIONS=
|
||||||
|
|
||||||
|
# change default start run level(if none empty; /etc/init.d/shorewall-lite enable)
|
||||||
|
START=50
|
||||||
|
|
||||||
|
# change default stop run level(if none empty; /etc/init.d/shorewall-lite enable)
|
||||||
|
STOP=
|
||||||
|
|
||||||
|
# option to pass when shorewall start is executed
|
||||||
|
STARTOPTIONS=
|
||||||
|
|
||||||
|
# option to pass when shorewall restart is executed
|
||||||
|
RESTARTOPTIONS=
|
||||||
|
|
||||||
|
# option to pass when shorewall reload is executed
|
||||||
|
RELOADOPTIONS=
|
||||||
|
|
||||||
|
# option to pass when shorewall stop is executed
|
||||||
|
STOPOPTIONS=
|
||||||
|
|
||||||
|
# option to pass when shorewall status is executed
|
||||||
|
STATUSOPTIONS=
|
@@ -32,24 +32,25 @@
|
|||||||
# shorewall-lite start Starts the firewall
|
# shorewall-lite start Starts the firewall
|
||||||
# shorewall-lite restart Restarts the firewall
|
# shorewall-lite restart Restarts the firewall
|
||||||
# shorewall-lite reload Reload the firewall
|
# shorewall-lite reload Reload the firewall
|
||||||
|
# (same as restart)
|
||||||
# shorewall-lite stop Stops the firewall
|
# shorewall-lite stop Stops the firewall
|
||||||
# shorewall-lite status Displays firewall status
|
# shorewall-lite status Displays firewall status
|
||||||
#
|
#
|
||||||
|
|
||||||
# description: Packet filtering firewall
|
# description: Packet filtering firewall
|
||||||
|
|
||||||
# Openwrt related
|
# openwrt stuph
|
||||||
# Start and stop runlevel variable
|
# start and stop runlevel variable
|
||||||
START=50
|
#START=21
|
||||||
STOP=89
|
#STOP=91
|
||||||
# Displays the status command
|
# variable to display what the status command do when /etc/init.d/shorewall-lite is invoke without argument
|
||||||
EXTRA_COMMANDS="status"
|
EXTRA_COMMANDS="status"
|
||||||
EXTRA_HELP=" status Displays firewall status"
|
EXTRA_HELP="Displays shorewall status"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Get startup options (override default)
|
# Get startup options (override default)
|
||||||
################################################################################
|
################################################################################
|
||||||
OPTIONS=
|
OPTIONS="-vvv"
|
||||||
|
|
||||||
#
|
#
|
||||||
# The installer may alter this
|
# The installer may alter this
|
||||||
@@ -60,35 +61,38 @@ if [ -f ${SYSCONFDIR}/shorewall-lite ]; then
|
|||||||
. ${SYSCONFDIR}/shorewall-lite
|
. ${SYSCONFDIR}/shorewall-lite
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
START=${START:-21}
|
||||||
|
STOP=${STOP:-91}
|
||||||
|
|
||||||
SHOREWALL_INIT_SCRIPT=1
|
SHOREWALL_INIT_SCRIPT=1
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# E X E C U T I O N B E G I N S H E R E #
|
# E X E C U T I O N B E G I N S H E R E #
|
||||||
################################################################################
|
################################################################################
|
||||||
# Arg1 of init script is arg2 when rc.common is sourced; set to action variable
|
# arg1 of init script is arg2 when rc.common is sourced; set to action variable
|
||||||
command="$action"
|
command="$action"
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $STARTOPTIONS
|
exec ${SBINDIR}/shorewall-lite $OPTIONS $command ${STARTOPTIONS:-$@}
|
||||||
}
|
}
|
||||||
|
|
||||||
boot() {
|
boot() {
|
||||||
local command="start"
|
local command="start"
|
||||||
start
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $RESTARTOPTIONS
|
exec ${SBINDIR}/shorewall-lite $OPTIONS $command ${RESTARTOPTIONS:-$@}
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $RELOADOPTION
|
exec ${SBINDIR}/shorewall-lite $OPTIONS $command ${RELOADOPTION:-$@}
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $STOPOPTIONS
|
exec ${SBINDIR}/shorewall-lite $OPTIONS $command ${STOPOPTIONS:-$@}
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $@
|
exec ${SBINDIR}/shorewall-lite $OPTIONS $command ${STATUSOPTIONS:-$@}
|
||||||
}
|
}
|
||||||
|
21
Shorewall-lite/shorewall-lite.service.214
Normal file
21
Shorewall-lite/shorewall-lite.service.214
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
|
||||||
|
#
|
||||||
|
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
|
||||||
|
#
|
||||||
|
[Unit]
|
||||||
|
Description=Shorewall IPv4 firewall (lite)
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
Conflicts=iptables.service firewalld.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
EnvironmentFile=-/etc/sysconfig/shorewall-lite
|
||||||
|
StandardOutput=syslog
|
||||||
|
ExecStart=/sbin/shorewall-lite $OPTIONS start $STARTOPTIONS
|
||||||
|
ExecStop=/sbin/shorewall-lite $OPTIONS stop
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=basic.target
|
@@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# Global start/restart/reload/stop options
|
|
||||||
#
|
|
||||||
OPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start options
|
|
||||||
#
|
|
||||||
STARTOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Restart options
|
|
||||||
#
|
|
||||||
RESTARTOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Reload options
|
|
||||||
#
|
|
||||||
RELOADOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Stop options
|
|
||||||
#
|
|
||||||
STOPOPTIONS=""
|
|
||||||
|
|
||||||
# EOF
|
|
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
VERSION=xxx #The Build script inserts the actual version
|
VERSION=xxx #The Build script inserts the actual version
|
||||||
PRODUCT=shorewall-lite
|
PRODUCT=shorewall-lite
|
||||||
Product="Shorewall Lite"
|
|
||||||
|
|
||||||
usage() # $1 = exit status
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
@@ -154,7 +153,7 @@ if [ -f ${SHAREDIR}/shorewall-lite/version ]; then
|
|||||||
VERSION="$INSTALLED_VERSION"
|
VERSION="$INSTALLED_VERSION"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "WARNING: Shorewall Lite Version $VERSION is not installed"
|
echo "WARNING: Shorewal Lite Version $VERSION is not installed"
|
||||||
VERSION=""
|
VERSION=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -196,26 +195,22 @@ if [ -f "$FIREWALL" ]; then
|
|||||||
remove_file $FIREWALL
|
remove_file $FIREWALL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$SERVICEDIR" ] && SERVICEDIR="$SYSTEMD"
|
if [ -n "$SYSTEMD" ]; then
|
||||||
|
|
||||||
if [ -n "$SERVICEDIR" ]; then
|
|
||||||
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
|
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
|
||||||
rm -f $SERVICEDIR/shorewall-lite.service
|
rm -f $SYSTEMD/shorewall-lite.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${SBINDIR}/shorewall-lite
|
rm -f ${SBINDIR}/shorewall-lite
|
||||||
|
|
||||||
rm -rf ${CONFDIR}/shorewall-lite
|
rm -rf ${CONFDIR}/shorewall-lite
|
||||||
rm -rf ${VARDIR}
|
rm -rf ${VARDIR}/shorewall-lite
|
||||||
rm -rf ${SHAREDIR}/shorewall-lite
|
rm -rf ${SHAREDIR}/shorewall-lite
|
||||||
rm -rf ${LIBEXECDIR}/shorewall-lite
|
rm -rf ${LIBEXECDIR}/shorewall-lite
|
||||||
rm -f ${CONFDIR}/logrotate.d/shorewall-lite
|
rm -f ${CONFDIR}/logrotate.d/shorewall-lite
|
||||||
rm -f ${SYSCONFDIR}/shorewall-lite
|
rm -f ${SYSCONFDIR}/shorewall-lite
|
||||||
|
|
||||||
if [ -n "${MANDIR}" ]; then
|
rm -f ${MANDIR}/man5/shorewall-lite*
|
||||||
rm -f ${MANDIR}/man5/shorewall-lite*
|
rm -f ${MANDIR}/man8/shorewall-lite*
|
||||||
rm -f ${MANDIR}/man8/shorewall-lite*
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Shorewall Lite Uninstalled"
|
echo "Shorewall Lite Uninstalled"
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/ARP.pm
|
# Shorewall 4.5 -- /usr/share/shorewall/Shorewall/ARP.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Accounting.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Accounting.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -292,7 +292,6 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
$target ,
|
$target ,
|
||||||
'' ,
|
'' ,
|
||||||
$disposition ,
|
$disposition ,
|
||||||
'' ,
|
|
||||||
'' );
|
'' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,7 +386,6 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
$target ,
|
$target ,
|
||||||
'' ,
|
'' ,
|
||||||
$disposition ,
|
$disposition ,
|
||||||
'' ,
|
|
||||||
'' ;
|
'' ;
|
||||||
|
|
||||||
if ( $rule2 || $jump ) {
|
if ( $rule2 || $jump ) {
|
||||||
@@ -417,7 +415,6 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
'' ,
|
'' ,
|
||||||
'' ,
|
'' ,
|
||||||
'' ,
|
'' ,
|
||||||
'' ,
|
|
||||||
'' );
|
'' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Chains.pm
|
# Shorewall 4.5 -- /usr/share/shorewall/Shorewall/Chains.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -47,7 +47,6 @@ our @EXPORT = ( qw(
|
|||||||
add_irule
|
add_irule
|
||||||
add_jump
|
add_jump
|
||||||
add_ijump
|
add_ijump
|
||||||
add_ijump_extended
|
|
||||||
insert_rule
|
insert_rule
|
||||||
insert_irule
|
insert_irule
|
||||||
clone_irule
|
clone_irule
|
||||||
@@ -623,12 +622,9 @@ our %ipset_exists;
|
|||||||
# Omitted, if target is ''.
|
# Omitted, if target is ''.
|
||||||
# target => Rule target, if jump is 'j' or 'g'.
|
# target => Rule target, if jump is 'j' or 'g'.
|
||||||
# targetopts => Target options. Only included if non-empty
|
# targetopts => Target options. Only included if non-empty
|
||||||
# matches => List of matches in the rule
|
|
||||||
# <option> => iptables/ip6tables -A options (e.g., i => eth0)
|
# <option> => iptables/ip6tables -A options (e.g., i => eth0)
|
||||||
# <match> => iptables match. Value may be a scalar or array.
|
# <match> => iptables match. Value may be a scalar or array.
|
||||||
# if an array, multiple "-m <match>"s will be generated
|
# if an array, multiple "-m <match>"s will be generated
|
||||||
# <origin> => configuration file and line number that generated the rule
|
|
||||||
# May be empty.
|
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# The following constants and hash are used to classify keys in a rule hash
|
# The following constants and hash are used to classify keys in a rule hash
|
||||||
@@ -646,7 +642,6 @@ use constant { UNIQUE => 1,
|
|||||||
|
|
||||||
our %opttype = ( rule => CONTROL,
|
our %opttype = ( rule => CONTROL,
|
||||||
cmd => CONTROL,
|
cmd => CONTROL,
|
||||||
origin => CONTROL,
|
|
||||||
|
|
||||||
dhcp => CONTROL,
|
dhcp => CONTROL,
|
||||||
|
|
||||||
@@ -922,7 +917,7 @@ sub set_rule_option( $$$ ) {
|
|||||||
|
|
||||||
sub transform_rule( $;\$ ) {
|
sub transform_rule( $;\$ ) {
|
||||||
my ( $input, $completeref ) = @_;
|
my ( $input, $completeref ) = @_;
|
||||||
my $ruleref = { mode => CAT_MODE, matches => [], target => '' , origin => shortlineinfo( '' ) };
|
my $ruleref = { mode => CAT_MODE, matches => [], target => '' };
|
||||||
my $simple = 1;
|
my $simple = 1;
|
||||||
my $target = '';
|
my $target = '';
|
||||||
my $jump = '';
|
my $jump = '';
|
||||||
@@ -1191,8 +1186,6 @@ sub merge_rules( $$$ ) {
|
|||||||
$toref->{comment} = $fromref->{comment} if exists $fromref->{comment};
|
$toref->{comment} = $fromref->{comment} if exists $fromref->{comment};
|
||||||
}
|
}
|
||||||
|
|
||||||
$toref->{origin} = $fromref->{origin} if $fromref->{origin};
|
|
||||||
|
|
||||||
$toref->{target} = $target;
|
$toref->{target} = $target;
|
||||||
|
|
||||||
if ( my $targetref = $tableref->{$target} ) {
|
if ( my $targetref = $tableref->{$target} ) {
|
||||||
@@ -1248,23 +1241,6 @@ sub add_commands ( $$;@ ) {
|
|||||||
$chainref->{optflags} |= ( DONT_OPTIMIZE | DONT_MOVE );
|
$chainref->{optflags} |= ( DONT_OPTIMIZE | DONT_MOVE );
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Set the comment member of an irule
|
|
||||||
#
|
|
||||||
sub set_irule_comment( $$ ) {
|
|
||||||
my ( $chainref, $ruleref ) = @_;
|
|
||||||
|
|
||||||
our $rule_comments;
|
|
||||||
|
|
||||||
$ruleref->{origin} ||= $chainref->{origin};
|
|
||||||
|
|
||||||
if ( $rule_comments ) {
|
|
||||||
$ruleref->{comment} = $ruleref->{origin} || $comment;
|
|
||||||
} else {
|
|
||||||
$ruleref->{comment} = $comment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Transform the passed rule and add it to the end of the passed chain's rule list.
|
# Transform the passed rule and add it to the end of the passed chain's rule list.
|
||||||
#
|
#
|
||||||
@@ -1276,8 +1252,7 @@ sub push_rule( $$ ) {
|
|||||||
my $complete = 0;
|
my $complete = 0;
|
||||||
my $ruleref = transform_rule( $_[1], $complete );
|
my $ruleref = transform_rule( $_[1], $complete );
|
||||||
|
|
||||||
set_irule_comment( $chainref, $ruleref );
|
$ruleref->{comment} = shortlineinfo($chainref->{origin}) || $comment;
|
||||||
|
|
||||||
$ruleref->{mode} = CMD_MODE if $ruleref->{cmdlevel} = $chainref->{cmdlevel};
|
$ruleref->{mode} = CMD_MODE if $ruleref->{cmdlevel} = $chainref->{cmdlevel};
|
||||||
|
|
||||||
push @{$chainref->{rules}}, $ruleref;
|
push @{$chainref->{rules}}, $ruleref;
|
||||||
@@ -1498,7 +1473,7 @@ sub create_irule( $$$;@ ) {
|
|||||||
|
|
||||||
( $target, my $targetopts ) = split ' ', $target, 2;
|
( $target, my $targetopts ) = split ' ', $target, 2;
|
||||||
|
|
||||||
my $ruleref = { matches => [] , origin => shortlineinfo( $chainref->{origin} ) };
|
my $ruleref = { matches => [] };
|
||||||
|
|
||||||
$ruleref->{mode} = ( $ruleref->{cmdlevel} = $chainref->{cmdlevel} ) ? CMD_MODE : CAT_MODE;
|
$ruleref->{mode} = ( $ruleref->{cmdlevel} = $chainref->{cmdlevel} ) ? CMD_MODE : CAT_MODE;
|
||||||
|
|
||||||
@@ -1511,7 +1486,7 @@ sub create_irule( $$$;@ ) {
|
|||||||
$ruleref->{target} = '';
|
$ruleref->{target} = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
set_irule_comment( $chainref, $ruleref );
|
$ruleref->{comment} = shortlineinfo($chainref->{origin}) || $ruleref->{comment} || $comment;
|
||||||
|
|
||||||
$iprangematch = 0;
|
$iprangematch = 0;
|
||||||
|
|
||||||
@@ -1667,7 +1642,7 @@ sub insert_rule1($$$)
|
|||||||
|
|
||||||
my $ruleref = transform_rule( $rule );
|
my $ruleref = transform_rule( $rule );
|
||||||
|
|
||||||
set_irule_comment( $chainref, $ruleref );
|
$ruleref->{comment} = shortlineinfo($chainref->{origin}) || $comment;
|
||||||
|
|
||||||
assert( ! ( $ruleref->{cmdlevel} = $chainref->{cmdlevel}) , $chainref->{name} );
|
assert( ! ( $ruleref->{cmdlevel} = $chainref->{cmdlevel}) , $chainref->{name} );
|
||||||
$ruleref->{mode} = CAT_MODE;
|
$ruleref->{mode} = CAT_MODE;
|
||||||
@@ -1693,7 +1668,7 @@ sub insert_irule( $$$$;@ ) {
|
|||||||
my ( $chainref, $jump, $target, $number, @matches ) = @_;
|
my ( $chainref, $jump, $target, $number, @matches ) = @_;
|
||||||
|
|
||||||
my $rulesref = $chainref->{rules};
|
my $rulesref = $chainref->{rules};
|
||||||
my $ruleref = { origin => shortlineinfo( $chainref->{origin} ) };
|
my $ruleref = {};
|
||||||
|
|
||||||
$ruleref->{mode} = ( $ruleref->{cmdlevel} = $chainref->{cmdlevel} ) ? CMD_MODE : CAT_MODE;
|
$ruleref->{mode} = ( $ruleref->{cmdlevel} = $chainref->{cmdlevel} ) ? CMD_MODE : CAT_MODE;
|
||||||
|
|
||||||
@@ -1709,7 +1684,8 @@ sub insert_irule( $$$$;@ ) {
|
|||||||
$chainref->{optflags} |= push_matches( $ruleref, @matches );
|
$chainref->{optflags} |= push_matches( $ruleref, @matches );
|
||||||
}
|
}
|
||||||
|
|
||||||
set_irule_comment( $chainref, $ruleref );
|
|
||||||
|
$ruleref->{comment} = shortlineinfo( $chainref->{origin} ) || $ruleref->{comment} || $comment;
|
||||||
|
|
||||||
if ( $number >= @$rulesref ) {
|
if ( $number >= @$rulesref ) {
|
||||||
#
|
#
|
||||||
@@ -2324,7 +2300,6 @@ sub new_chain($$)
|
|||||||
references => {},
|
references => {},
|
||||||
filtered => 0,
|
filtered => 0,
|
||||||
optflags => 0,
|
optflags => 0,
|
||||||
origin => shortlineinfo( '' ),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
trace( $chainref, 'N', undef, '' ) if $debug;
|
trace( $chainref, 'N', undef, '' ) if $debug;
|
||||||
@@ -2413,12 +2388,12 @@ sub add_expanded_jump( $$$$ ) {
|
|||||||
add_reference( $chainref, $toref ) while --$splitcount > 0;
|
add_reference( $chainref, $toref ) while --$splitcount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub add_ijump_internal( $$$$$;@ ) {
|
sub add_ijump_internal( $$$$;@ ) {
|
||||||
my ( $fromref, $jump, $to, $expandports, $origin, @matches ) = @_;
|
my ( $fromref, $jump, $to, $expandports, @matches ) = @_;
|
||||||
|
|
||||||
return $dummyrule if $fromref->{complete};
|
return $dummyrule if $fromref->{complete};
|
||||||
|
|
||||||
our ( $splitcount, $file_comments, $rule_comments );
|
our $splitcount;
|
||||||
|
|
||||||
my $toref;
|
my $toref;
|
||||||
my $ruleref;
|
my $ruleref;
|
||||||
@@ -2435,7 +2410,6 @@ sub add_ijump_internal( $$$$$;@ ) {
|
|||||||
my ( $target ) = split ' ', $to;
|
my ( $target ) = split ' ', $to;
|
||||||
$toref = $chain_table{$fromref->{table}}{$target};
|
$toref = $chain_table{$fromref->{table}}{$target};
|
||||||
fatal_error "Unknown rule target ($to)" unless $toref || $builtin_target{$target};
|
fatal_error "Unknown rule target ($to)" unless $toref || $builtin_target{$target};
|
||||||
$origin ||= $fromref->{origin} if $file_comments || $rule_comments;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2445,7 +2419,6 @@ sub add_ijump_internal( $$$$$;@ ) {
|
|||||||
$toref->{referenced} = 1;
|
$toref->{referenced} = 1;
|
||||||
add_reference $fromref, $toref;
|
add_reference $fromref, $toref;
|
||||||
$jump = 'j' unless have_capability 'GOTO_TARGET';
|
$jump = 'j' unless have_capability 'GOTO_TARGET';
|
||||||
$origin ||= $toref->{origin} if $file_comments || $rule_comments;
|
|
||||||
$ruleref = create_irule ($fromref, $jump => $to, @matches );
|
$ruleref = create_irule ($fromref, $jump => $to, @matches );
|
||||||
} else {
|
} else {
|
||||||
$ruleref = create_irule( $fromref, 'j' => $to, @matches );
|
$ruleref = create_irule( $fromref, 'j' => $to, @matches );
|
||||||
@@ -2455,19 +2428,12 @@ sub add_ijump_internal( $$$$$;@ ) {
|
|||||||
$fromref->{complete} = 1 if $jump eq 'g' || $terminating{$to};
|
$fromref->{complete} = 1 if $jump eq 'g' || $terminating{$to};
|
||||||
}
|
}
|
||||||
|
|
||||||
$ruleref->{origin} = $origin if $origin;
|
|
||||||
|
|
||||||
$expandports ? handle_port_ilist( $fromref, $ruleref, 1 ) : push_irule( $fromref, $ruleref );
|
$expandports ? handle_port_ilist( $fromref, $ruleref, 1 ) : push_irule( $fromref, $ruleref );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub add_ijump( $$$;@ ) {
|
sub add_ijump( $$$;@ ) {
|
||||||
my ( $fromref, $jump, $to, @matches ) = @_;
|
my ( $fromref, $jump, $to, @matches ) = @_;
|
||||||
add_ijump_internal( $fromref, $jump, $to, 0, '', @matches );
|
add_ijump_internal( $fromref, $jump, $to, 0, @matches );
|
||||||
}
|
|
||||||
|
|
||||||
sub add_ijump_extended( $$$$;@ ) {
|
|
||||||
my ( $fromref, $jump, $to, $origin, @matches ) = @_;
|
|
||||||
add_ijump_internal( $fromref, $jump, $to, 0, $origin, @matches );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub insert_ijump( $$$$;@ ) {
|
sub insert_ijump( $$$$;@ ) {
|
||||||
@@ -2761,7 +2727,7 @@ sub ensure_manual_chain($) {
|
|||||||
$chainref;
|
$chainref;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub log_irule_limit( $$$$$$$$@ );
|
sub log_irule_limit( $$$$$$$@ );
|
||||||
|
|
||||||
sub ensure_blacklog_chain( $$$$$ ) {
|
sub ensure_blacklog_chain( $$$$$ ) {
|
||||||
my ( $target, $disposition, $level, $tag, $audit ) = @_;
|
my ( $target, $disposition, $level, $tag, $audit ) = @_;
|
||||||
@@ -2772,7 +2738,7 @@ sub ensure_blacklog_chain( $$$$$ ) {
|
|||||||
$target =~ s/A_//;
|
$target =~ s/A_//;
|
||||||
$target = 'reject' if $target eq 'REJECT';
|
$target = 'reject' if $target eq 'REJECT';
|
||||||
|
|
||||||
log_irule_limit( $level , $logchainref , 'blacklst' , $disposition , $globals{LOGILIMIT} , $tag, 'add', '' );
|
log_irule_limit( $level , $logchainref , 'blacklst' , $disposition , $globals{LOGILIMIT} , $tag, 'add' );
|
||||||
|
|
||||||
add_ijump( $logchainref, j => 'AUDIT', targetopts => '--type ' . lc $target ) if $audit;
|
add_ijump( $logchainref, j => 'AUDIT', targetopts => '--type ' . lc $target ) if $audit;
|
||||||
add_ijump( $logchainref, g => $target );
|
add_ijump( $logchainref, g => $target );
|
||||||
@@ -2787,7 +2753,7 @@ sub ensure_audit_blacklog_chain( $$$ ) {
|
|||||||
unless ( $filter_table->{A_blacklog} ) {
|
unless ( $filter_table->{A_blacklog} ) {
|
||||||
my $logchainref = new_manual_chain 'A_blacklog';
|
my $logchainref = new_manual_chain 'A_blacklog';
|
||||||
|
|
||||||
log_irule_limit( $level , $logchainref , 'blacklst' , $disposition , $globals{LOGILIMIT} , '', 'add' , '' );
|
log_irule_limit( $level , $logchainref , 'blacklst' , $disposition , $globals{LOGILIMIT} , '', 'add' );
|
||||||
|
|
||||||
add_ijump( $logchainref, j => 'AUDIT', targetopts => '--type ' . lc $target );
|
add_ijump( $logchainref, j => 'AUDIT', targetopts => '--type ' . lc $target );
|
||||||
|
|
||||||
@@ -3001,9 +2967,6 @@ sub initialize_chain_table($) {
|
|||||||
$globals{iLOGLIMIT} =
|
$globals{iLOGLIMIT} =
|
||||||
( $ruleref->{hashlimit} ? [ hashlimit => $ruleref->{hashlimit} ] :
|
( $ruleref->{hashlimit} ? [ hashlimit => $ruleref->{hashlimit} ] :
|
||||||
$ruleref->{limit} ? [ limit => $ruleref->{limit} ] : [] );
|
$ruleref->{limit} ? [ limit => $ruleref->{limit} ] : [] );
|
||||||
|
|
||||||
our $file_comments = $config{TRACK_RULES} eq 'File';
|
|
||||||
our $rule_comments = $config{TRACK_RULES} eq 'Yes';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -3108,8 +3071,8 @@ sub calculate_digest( $ ) {
|
|||||||
#
|
#
|
||||||
# Replace jumps to the passed chain with jumps to the passed target
|
# Replace jumps to the passed chain with jumps to the passed target
|
||||||
#
|
#
|
||||||
sub replace_references( $$$$$;$ ) {
|
sub replace_references( $$$$;$ ) {
|
||||||
my ( $chainref, $target, $targetopts, $comment, $origin, $digest ) = @_;
|
my ( $chainref, $target, $targetopts, $comment, $digest ) = @_;
|
||||||
my $tableref = $chain_table{$chainref->{table}};
|
my $tableref = $chain_table{$chainref->{table}};
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
my $name = $chainref->{name};
|
my $name = $chainref->{name};
|
||||||
@@ -3127,7 +3090,6 @@ sub replace_references( $$$$$;$ ) {
|
|||||||
$_->{target} = $target;
|
$_->{target} = $target;
|
||||||
$_->{targetopts} = $targetopts if $targetopts;
|
$_->{targetopts} = $targetopts if $targetopts;
|
||||||
$_->{comment} = $comment unless $_->{comment};
|
$_->{comment} = $comment unless $_->{comment};
|
||||||
$_->{origin} = $origin if $origin;
|
|
||||||
|
|
||||||
if ( $targetref ) {
|
if ( $targetref ) {
|
||||||
add_reference ( $fromref, $targetref );
|
add_reference ( $fromref, $targetref );
|
||||||
@@ -3378,8 +3340,7 @@ sub optimize_level4( $$ ) {
|
|||||||
replace_references( $chainref,
|
replace_references( $chainref,
|
||||||
$firstrule->{target},
|
$firstrule->{target},
|
||||||
$firstrule->{targetopts},
|
$firstrule->{targetopts},
|
||||||
$firstrule->{comment},
|
$firstrule->{comment} );
|
||||||
$firstrule->{origin} );
|
|
||||||
$progress = 1;
|
$progress = 1;
|
||||||
}
|
}
|
||||||
} elsif ( $firstrule->{target} ) {
|
} elsif ( $firstrule->{target} ) {
|
||||||
@@ -3599,7 +3560,7 @@ sub optimize_level8( $$$ ) {
|
|||||||
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
||||||
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
||||||
$progress = 1;
|
$progress = 1;
|
||||||
replace_references $chainref1, $chainref->{name}, undef, '', '', 1;
|
replace_references $chainref1, $chainref->{name}, undef, '', 1;
|
||||||
|
|
||||||
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
||||||
#
|
#
|
||||||
@@ -3733,12 +3694,10 @@ sub get_multi_sports( $ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return an array of keys for the passed rule. 'dport', 'comment', and 'origin' are omitted;
|
# Return an array of keys for the passed rule. 'dport' and 'comment' are omitted;
|
||||||
#
|
#
|
||||||
sub get_keys( $ ) {
|
sub get_keys( $ ) {
|
||||||
my %skip = ( dport => 1, comment => 1, origin => 1 );
|
sort grep $_ ne 'dport' && $_ ne 'comment', keys %{$_[0]};
|
||||||
|
|
||||||
sort grep ! $skip{$_}, keys %{$_[0]};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -3772,8 +3731,6 @@ sub combine_dports {
|
|||||||
my $comment = $baseref->{comment} || '';
|
my $comment = $baseref->{comment} || '';
|
||||||
my $lastcomment = $comment;
|
my $lastcomment = $comment;
|
||||||
my $multi_sports = get_multi_sports( $baseref );
|
my $multi_sports = get_multi_sports( $baseref );
|
||||||
my $origin = $baseref->{origin} || '';
|
|
||||||
my $lastorigin = $origin;
|
|
||||||
|
|
||||||
RULE:
|
RULE:
|
||||||
|
|
||||||
@@ -3787,7 +3744,6 @@ sub combine_dports {
|
|||||||
# We have a candidate
|
# We have a candidate
|
||||||
#
|
#
|
||||||
my $comment2 = $ruleref->{comment} || '';
|
my $comment2 = $ruleref->{comment} || '';
|
||||||
my $origin2 = $ruleref->{origin} || '';
|
|
||||||
|
|
||||||
last if $comment2 ne $lastcomment && length( $comment ) + length( $comment2 ) > 253;
|
last if $comment2 ne $lastcomment && length( $comment ) + length( $comment2 ) > 253;
|
||||||
|
|
||||||
@@ -3828,25 +3784,6 @@ sub combine_dports {
|
|||||||
$lastcomment = $comment2;
|
$lastcomment = $comment2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $origin2 ) {
|
|
||||||
if ( $origin ) {
|
|
||||||
$origin .= ", $origin2" unless $origin2 eq $lastorigin;
|
|
||||||
} else {
|
|
||||||
$origin = 'Others and ';
|
|
||||||
$origin .= $origin2;
|
|
||||||
}
|
|
||||||
|
|
||||||
$lastorigin = $origin2;
|
|
||||||
} else {
|
|
||||||
if ( $origin ) {
|
|
||||||
unless ( ( $origin2 = ' and others' ) eq $lastorigin ) {
|
|
||||||
$origin .= $origin2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$lastorigin = $origin2;
|
|
||||||
}
|
|
||||||
|
|
||||||
push @ports, split ',', $ports2;
|
push @ports, split ',', $ports2;
|
||||||
|
|
||||||
trace( $chainref, 'D', $rulenum, $ruleref ) if $debug;
|
trace( $chainref, 'D', $rulenum, $ruleref ) if $debug;
|
||||||
@@ -3880,7 +3817,6 @@ sub combine_dports {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$baseref->{comment} = $comment if $comment;
|
$baseref->{comment} = $comment if $comment;
|
||||||
$baseref->{origin} = $origin if $origin;
|
|
||||||
|
|
||||||
trace ( $chainref, 'R', $basenum, $baseref ) if $debug;
|
trace ( $chainref, 'R', $basenum, $baseref ) if $debug;
|
||||||
}
|
}
|
||||||
@@ -3919,7 +3855,6 @@ sub delete_duplicates {
|
|||||||
my $lastrule = @_;
|
my $lastrule = @_;
|
||||||
my $baseref = pop;
|
my $baseref = pop;
|
||||||
my $ruleref;
|
my $ruleref;
|
||||||
my %skip = ( comment => 1, origin => 1 );
|
|
||||||
|
|
||||||
while ( @_ ) {
|
while ( @_ ) {
|
||||||
my $docheck;
|
my $docheck;
|
||||||
@@ -3927,7 +3862,7 @@ sub delete_duplicates {
|
|||||||
|
|
||||||
if ( $baseref->{mode} == CAT_MODE ) {
|
if ( $baseref->{mode} == CAT_MODE ) {
|
||||||
my $ports1;
|
my $ports1;
|
||||||
my @keys1 = sort( grep ! $skip{$_}, keys( %$baseref ) );
|
my @keys1 = sort( grep $_ ne 'comment', keys( %$baseref ) );
|
||||||
my $rulenum = @_;
|
my $rulenum = @_;
|
||||||
my $adjacent = 1;
|
my $adjacent = 1;
|
||||||
|
|
||||||
@@ -3939,7 +3874,7 @@ sub delete_duplicates {
|
|||||||
|
|
||||||
last unless $ruleref->{mode} == CAT_MODE;
|
last unless $ruleref->{mode} == CAT_MODE;
|
||||||
|
|
||||||
my @keys2 = sort(grep ! $skip{$_}, keys( %$ruleref ) );
|
my @keys2 = sort(grep $_ ne 'comment', keys( %$ruleref ) );
|
||||||
|
|
||||||
next unless @keys1 == @keys2 ;
|
next unless @keys1 == @keys2 ;
|
||||||
|
|
||||||
@@ -4011,12 +3946,10 @@ sub get_conntrack( $ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return an array of keys for the passed rule. 'conntrack', 'comment' & origin are omitted;
|
# Return an array of keys for the passed rule. 'conntrack' and 'comment' are omitted;
|
||||||
#
|
#
|
||||||
sub get_keys1( $ ) {
|
sub get_keys1( $ ) {
|
||||||
my %skip = ( comment => 1, origin => 1 , 'conntrack --ctstate' => 1 );
|
sort grep $_ ne 'conntrack --ctstate' && $_ ne 'comment', keys %{$_[0]};
|
||||||
|
|
||||||
sort grep ! $skip{$_}, keys %{$_[0]};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -4302,8 +4235,7 @@ sub logchain( $$$$$$ ) {
|
|||||||
$disposition ,
|
$disposition ,
|
||||||
[] ,
|
[] ,
|
||||||
$logtag,
|
$logtag,
|
||||||
'add',
|
'add' );
|
||||||
'' );
|
|
||||||
add_jump( $logchainref, $target, 0, $exceptionrule );
|
add_jump( $logchainref, $target, 0, $exceptionrule );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5821,6 +5753,8 @@ sub match_source_net( $;$\$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
||||||
|
fatal_error "A countrycode list may not be used in this context" if $restriction & ( OUTPUT_RESTRICT | POSTROUTE_RESTRICT );
|
||||||
|
|
||||||
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
||||||
|
|
||||||
load_isocodes unless %isocodes;
|
load_isocodes unless %isocodes;
|
||||||
@@ -5908,6 +5842,8 @@ sub imatch_source_net( $;$\$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
||||||
|
fatal_error "A countrycode list may not be used in this context" if $restriction & ( OUTPUT_RESTRICT | POSTROUTE_RESTRICT );
|
||||||
|
|
||||||
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
||||||
|
|
||||||
load_isocodes unless %isocodes;
|
load_isocodes unless %isocodes;
|
||||||
@@ -5992,6 +5928,8 @@ sub match_dest_net( $;$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
||||||
|
fatal_error "A countrycode list may not be used in this context" if $restriction & (PREROUTE_RESTRICT | INPUT_RESTRICT );
|
||||||
|
|
||||||
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
||||||
|
|
||||||
load_isocodes unless %isocodes;
|
load_isocodes unless %isocodes;
|
||||||
@@ -6073,6 +6011,8 @@ sub imatch_dest_net( $;$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
||||||
|
fatal_error "A countrycode list may not be used in this context" if $restriction & (PREROUTE_RESTRICT | INPUT_RESTRICT );
|
||||||
|
|
||||||
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
||||||
|
|
||||||
load_isocodes unless %isocodes;
|
load_isocodes unless %isocodes;
|
||||||
@@ -6262,22 +6202,20 @@ sub do_ipsec($$) {
|
|||||||
#
|
#
|
||||||
# Generate a log message
|
# Generate a log message
|
||||||
#
|
#
|
||||||
sub log_rule_limit( $$$$$$$$;$ ) {
|
sub log_rule_limit( $$$$$$$$ ) {
|
||||||
my ($level, $chainref, $chn, $dispo, $limit, $tag, $command, $matches, $origin ) = @_;
|
my ($level, $chainref, $chn, $dispo, $limit, $tag, $command, $matches ) = @_;
|
||||||
|
|
||||||
my $prefix = '';
|
my $prefix = '';
|
||||||
my $chain = get_action_chain_name || $chn;
|
my $chain = get_action_chain_name || $chn;
|
||||||
my $disposition = get_action_disposition || $dispo;
|
my $disposition = get_action_disposition || $dispo;
|
||||||
my $original_matches = $matches;
|
|
||||||
my $ruleref;
|
|
||||||
|
|
||||||
$level = validate_level $level; # Do this here again because this function can be called directly from user exits.
|
$level = validate_level $level; # Do this here again because this function can be called directly from user exits.
|
||||||
|
|
||||||
return $dummyrule if $level eq '';
|
return 1 if $level eq '';
|
||||||
|
|
||||||
$matches .= ' ' if $matches && substr( $matches, -1, 1 ) ne ' ';
|
$matches .= ' ' if $matches && substr( $matches, -1, 1 ) ne ' ';
|
||||||
|
|
||||||
unless ( $matches =~ /-m (?:limit|hashlimit) / ) {
|
unless ( $matches =~ /-m limit / ) {
|
||||||
$limit = $globals{LOGLIMIT} unless $limit && $limit ne '-';
|
$limit = $globals{LOGLIMIT} unless $limit && $limit ne '-';
|
||||||
$matches .= $limit if $limit;
|
$matches .= $limit if $limit;
|
||||||
}
|
}
|
||||||
@@ -6304,7 +6242,7 @@ sub log_rule_limit( $$$$$$$$;$ ) {
|
|||||||
if ( $tag =~ /^,/ ) {
|
if ( $tag =~ /^,/ ) {
|
||||||
( $disposition = $tag ) =~ s/,//;
|
( $disposition = $tag ) =~ s/,//;
|
||||||
} elsif ( $tag =~ /,/ ) {
|
} elsif ( $tag =~ /,/ ) {
|
||||||
( $chain, $disposition ) = split ',', $tag, 2;
|
( $chain, $disposition ) = split ',', $tag;
|
||||||
} else {
|
} else {
|
||||||
$chain = $tag;
|
$chain = $tag;
|
||||||
}
|
}
|
||||||
@@ -6351,24 +6289,19 @@ sub log_rule_limit( $$$$$$$$;$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $command eq 'add' ) {
|
if ( $command eq 'add' ) {
|
||||||
$ruleref = add_rule ( $chainref, $matches . $prefix , $original_matches );
|
add_rule ( $chainref, $matches . $prefix , 1 );
|
||||||
} else {
|
} else {
|
||||||
$ruleref = insert_rule1 ( $chainref , 0 , $matches . $prefix );
|
insert_rule1 ( $chainref , 0 , $matches . $prefix );
|
||||||
}
|
}
|
||||||
|
|
||||||
$ruleref->{origin} = $origin if reftype( $ruleref ) && $origin;
|
|
||||||
|
|
||||||
$ruleref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub log_irule_limit( $$$$$$$$@ ) {
|
sub log_irule_limit( $$$$$$$@ ) {
|
||||||
my ($level, $chainref, $chn, $dispo, $limit, $tag, $command, $origin, @matches ) = @_;
|
my ($level, $chainref, $chn, $dispo, $limit, $tag, $command, @matches ) = @_;
|
||||||
|
|
||||||
my $prefix = '';
|
my $prefix = '';
|
||||||
my %matches;
|
my %matches;
|
||||||
my $chain = get_action_chain_name || $chn;
|
my $chain = get_action_chain_name || $chn;
|
||||||
my $disposition = get_action_disposition || $dispo;
|
my $disposition = get_action_disposition || $dispo;
|
||||||
my $original_matches = @matches;
|
|
||||||
|
|
||||||
$level = validate_level $level; # Do this here again because this function can be called directly from user exits.
|
$level = validate_level $level; # Do this here again because this function can be called directly from user exits.
|
||||||
|
|
||||||
@@ -6403,7 +6336,7 @@ sub log_irule_limit( $$$$$$$$@ ) {
|
|||||||
if ( $tag =~ /^,/ ) {
|
if ( $tag =~ /^,/ ) {
|
||||||
( $disposition = $tag ) =~ s/,//;
|
( $disposition = $tag ) =~ s/,//;
|
||||||
} elsif ( $tag =~ /,/ ) {
|
} elsif ( $tag =~ /,/ ) {
|
||||||
( $chain, $disposition ) = split ',', $tag, 2;
|
( $chain, $disposition ) = split ',', $tag;
|
||||||
} else {
|
} else {
|
||||||
$chain = $tag;
|
$chain = $tag;
|
||||||
}
|
}
|
||||||
@@ -6450,7 +6383,7 @@ sub log_irule_limit( $$$$$$$$@ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $command eq 'add' ) {
|
if ( $command eq 'add' ) {
|
||||||
add_ijump_internal ( $chainref, j => $prefix , $original_matches, $origin, @matches );
|
add_ijump_internal ( $chainref, j => $prefix , 1, @matches );
|
||||||
} else {
|
} else {
|
||||||
insert_ijump ( $chainref, j => $prefix, 0 , @matches );
|
insert_ijump ( $chainref, j => $prefix, 0 , @matches );
|
||||||
}
|
}
|
||||||
@@ -6465,7 +6398,7 @@ sub log_rule( $$$$ ) {
|
|||||||
sub log_irule( $$$;@ ) {
|
sub log_irule( $$$;@ ) {
|
||||||
my ( $level, $chainref, $disposition, @matches ) = @_;
|
my ( $level, $chainref, $disposition, @matches ) = @_;
|
||||||
|
|
||||||
log_irule_limit $level, $chainref, $chainref->{name} , $disposition, $globals{LOGILIMIT} , '', 'add', '', @matches;
|
log_irule_limit $level, $chainref, $chainref->{name} , $disposition, $globals{LOGILIMIT} , '', 'add', @matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -6629,8 +6562,6 @@ sub set_chain_variables() {
|
|||||||
emit( 'g_tool=$IP6TABLES' );
|
emit( 'g_tool=$IP6TABLES' );
|
||||||
}
|
}
|
||||||
|
|
||||||
emit 'g_tool="$g_tool --wait"' if have_capability 'WAIT_OPTION';
|
|
||||||
|
|
||||||
if ( $config{IP} ) {
|
if ( $config{IP} ) {
|
||||||
emit( qq(IP="$config{IP}") ,
|
emit( qq(IP="$config{IP}") ,
|
||||||
'[ -x "$IP" ] || startup_error "IP=$IP does not exist or is not executable"'
|
'[ -x "$IP" ] || startup_error "IP=$IP does not exist or is not executable"'
|
||||||
@@ -7100,7 +7031,7 @@ sub isolate_source_interface( $ ) {
|
|||||||
$inets = $2;
|
$inets = $2;
|
||||||
} elsif ( $source =~ /^(.+?):\[(.+)\]\s*$/ ||
|
} elsif ( $source =~ /^(.+?):\[(.+)\]\s*$/ ||
|
||||||
$source =~ /^(.+?):(!?\+.+)$/ ||
|
$source =~ /^(.+?):(!?\+.+)$/ ||
|
||||||
$source =~ /^(.+?):(!?[&%~].+)$/ ||
|
$source =~ /^(.+?):(!?[&%].+)$/ ||
|
||||||
$source =~ /^(.+?):(\[.+\]\/(?:\d+))\s*$/
|
$source =~ /^(.+?):(\[.+\]\/(?:\d+))\s*$/
|
||||||
) {
|
) {
|
||||||
$iiface = $1;
|
$iiface = $1;
|
||||||
@@ -7475,8 +7406,7 @@ sub handle_exclusion( $$$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$actparms{disposition} || ( $disposition eq 'reject' ? 'REJECT' : $disposition ),
|
$actparms{disposition} || ( $disposition eq 'reject' ? 'REJECT' : $disposition ),
|
||||||
[] ,
|
[] ,
|
||||||
$logtag ,
|
$logtag ,
|
||||||
'add' ,
|
'add' )
|
||||||
'' )
|
|
||||||
if $loglevel;
|
if $loglevel;
|
||||||
#
|
#
|
||||||
# Generate Final Rule
|
# Generate Final Rule
|
||||||
@@ -7498,7 +7428,7 @@ sub handle_exclusion( $$$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Returns the destination interface specified in the rule, if any.
|
# Returns the destination interface specified in the rule, if any.
|
||||||
#
|
#
|
||||||
sub expand_rule( $$$$$$$$$$$$;$ )
|
sub expand_rule( $$$$$$$$$$$;$ )
|
||||||
{
|
{
|
||||||
my ($chainref , # Chain
|
my ($chainref , # Chain
|
||||||
$restriction, # Determines what to do with interface names in the SOURCE or DEST
|
$restriction, # Determines what to do with interface names in the SOURCE or DEST
|
||||||
@@ -7511,7 +7441,6 @@ sub expand_rule( $$$$$$$$$$$$;$ )
|
|||||||
$loglevel , # Log level (and tag)
|
$loglevel , # Log level (and tag)
|
||||||
$disposition, # Primtive part of the target (RETURN, ACCEPT, ...)
|
$disposition, # Primtive part of the target (RETURN, ACCEPT, ...)
|
||||||
$exceptionrule,# Caller's matches used in exclusion case
|
$exceptionrule,# Caller's matches used in exclusion case
|
||||||
$usergenerated,# Rule came from the IP[6]TABLES target
|
|
||||||
$logname, # Name of chain to name in log messages
|
$logname, # Name of chain to name in log messages
|
||||||
) = @_;
|
) = @_;
|
||||||
|
|
||||||
@@ -7561,7 +7490,7 @@ sub expand_rule( $$$$$$$$$$$$;$ )
|
|||||||
$loglevel = validate_level( $loglevel );
|
$loglevel = validate_level( $loglevel );
|
||||||
$logtag = '' unless defined $logtag;
|
$logtag = '' unless defined $logtag;
|
||||||
}
|
}
|
||||||
} elsif ( $disposition eq 'LOG' && ! $usergenerated ) {
|
} elsif ( $disposition eq 'LOG' ) {
|
||||||
fatal_error "LOG requires a level";
|
fatal_error "LOG requires a level";
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
@@ -7676,9 +7605,9 @@ sub expand_rule( $$$$$$$$$$$$;$ )
|
|||||||
|
|
||||||
my $cond3 = conditional_rule( $chainref, $dnet );
|
my $cond3 = conditional_rule( $chainref, $dnet );
|
||||||
|
|
||||||
if ( $loglevel eq '' || $usergenerated ) {
|
if ( $loglevel eq '' ) {
|
||||||
#
|
#
|
||||||
# No logging or user-specified logging -- add the target rule with matches to the rule chain
|
# No logging -- add the target rule with matches to the rule chain
|
||||||
#
|
#
|
||||||
if ( $targetref ) {
|
if ( $targetref ) {
|
||||||
add_expanded_jump( $chainref, $targetref , 0, $matches );
|
add_expanded_jump( $chainref, $targetref , 0, $matches );
|
||||||
@@ -7851,10 +7780,9 @@ sub add_interface_options( $ ) {
|
|||||||
} else {
|
} else {
|
||||||
for my $interface ( @input_interfaces ) {
|
for my $interface ( @input_interfaces ) {
|
||||||
$chain1ref = $input_chains{$interface};
|
$chain1ref = $input_chains{$interface};
|
||||||
add_ijump_extended ( $chainref ,
|
add_ijump ( $chainref ,
|
||||||
j => $chain1ref->{name},
|
j => $chain1ref->{name},
|
||||||
interface_origin( $interface ) ,
|
@input_interfaces > 1 ? imatch_source_dev( $interface ) : () )->{comment} = interface_origin( $interface ) if @{$chain1ref->{rules}};
|
||||||
@input_interfaces > 1 ? imatch_source_dev( $interface ) : () );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -7867,10 +7795,7 @@ sub add_interface_options( $ ) {
|
|||||||
} else {
|
} else {
|
||||||
for my $interface ( @forward_interfaces ) {
|
for my $interface ( @forward_interfaces ) {
|
||||||
$chain1ref = $forward_chains{$interface};
|
$chain1ref = $forward_chains{$interface};
|
||||||
add_ijump_extended( $chainref ,
|
add_ijump ( $chainref , j => $chain1ref->{name}, @forward_interfaces > 1 ? imatch_source_dev( $interface ) : () )->{comment} = interface_origin( $interface ) if @{$chain1ref->{rules}};
|
||||||
j => $chain1ref->{name},
|
|
||||||
interface_origin( $interface ) ,
|
|
||||||
@forward_interfaces > 1 ? imatch_source_dev( $interface ) : () );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7959,8 +7884,6 @@ sub enter_cmd_mode() {
|
|||||||
sub emitr( $$ ) {
|
sub emitr( $$ ) {
|
||||||
my ( $chainref, $ruleref ) = @_;
|
my ( $chainref, $ruleref ) = @_;
|
||||||
|
|
||||||
our $file_comments;
|
|
||||||
|
|
||||||
assert( $chainref );
|
assert( $chainref );
|
||||||
|
|
||||||
if ( $ruleref ) {
|
if ( $ruleref ) {
|
||||||
@@ -7969,11 +7892,6 @@ sub emitr( $$ ) {
|
|||||||
# A rule
|
# A rule
|
||||||
#
|
#
|
||||||
enter_cat_mode unless $mode == CAT_MODE;
|
enter_cat_mode unless $mode == CAT_MODE;
|
||||||
|
|
||||||
if ( $file_comments && ( my $origin = $ruleref->{origin} ) ) {
|
|
||||||
emit_unindented '# ' . $origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit_unindented format_rule( $chainref, $ruleref );
|
emit_unindented format_rule( $chainref, $ruleref );
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
@@ -7984,9 +7902,6 @@ sub emitr( $$ ) {
|
|||||||
if ( exists $ruleref->{cmd} ) {
|
if ( exists $ruleref->{cmd} ) {
|
||||||
emit join( '', ' ' x $ruleref->{cmdlevel}, $ruleref->{cmd} );
|
emit join( '', ' ' x $ruleref->{cmdlevel}, $ruleref->{cmd} );
|
||||||
} else {
|
} else {
|
||||||
if ( $file_comments && ( my $origin = $ruleref->{origin} ) ) {
|
|
||||||
emit join( '', ' ' x $ruleref->{cmdlevel} , '# ' , $origin );
|
|
||||||
}
|
|
||||||
#
|
#
|
||||||
# Must preserve quotes in the rule
|
# Must preserve quotes in the rule
|
||||||
#
|
#
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
#
|
#
|
||||||
# The Shoreline Firewall Packet Filtering Firewall Compiler - V5.0
|
# The Shoreline Firewall Packet Filtering Firewall Compiler - V4.5
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Config.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Config.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -174,7 +174,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
|||||||
$comment
|
$comment
|
||||||
|
|
||||||
%config
|
%config
|
||||||
%origin
|
|
||||||
%globals
|
%globals
|
||||||
%config_files
|
%config_files
|
||||||
%shorewallrc
|
%shorewallrc
|
||||||
@@ -187,9 +186,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
|||||||
|
|
||||||
%actparms
|
%actparms
|
||||||
|
|
||||||
PARMSMODIFIED
|
|
||||||
USEDCALLER
|
|
||||||
|
|
||||||
F_IPV4
|
F_IPV4
|
||||||
F_IPV6
|
F_IPV6
|
||||||
|
|
||||||
@@ -298,10 +294,6 @@ our %globals;
|
|||||||
#
|
#
|
||||||
our %config;
|
our %config;
|
||||||
#
|
#
|
||||||
# Linenumber in shorewall[6].conf where each option was specified
|
|
||||||
#
|
|
||||||
our %origin;
|
|
||||||
#
|
|
||||||
# Entries in shorewall.conf that have been renamed
|
# Entries in shorewall.conf that have been renamed
|
||||||
#
|
#
|
||||||
our %renamed = ( AUTO_COMMENT => 'AUTOCOMMENT', BLACKLIST_LOGLEVEL => 'BLACKLIST_LOG_LEVEL' );
|
our %renamed = ( AUTO_COMMENT => 'AUTOCOMMENT', BLACKLIST_LOGLEVEL => 'BLACKLIST_LOG_LEVEL' );
|
||||||
@@ -404,7 +396,6 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
|
|||||||
TARPIT_TARGET => 'TARPIT Target',
|
TARPIT_TARGET => 'TARPIT Target',
|
||||||
IFACE_MATCH => 'Iface Match',
|
IFACE_MATCH => 'Iface Match',
|
||||||
TCPMSS_TARGET => 'TCPMSS Target',
|
TCPMSS_TARGET => 'TCPMSS Target',
|
||||||
WAIT_OPTION => 'iptables --wait option',
|
|
||||||
|
|
||||||
AMANDA_HELPER => 'Amanda Helper',
|
AMANDA_HELPER => 'Amanda Helper',
|
||||||
FTP_HELPER => 'FTP Helper',
|
FTP_HELPER => 'FTP Helper',
|
||||||
@@ -554,7 +545,6 @@ our %compiler_params;
|
|||||||
#
|
#
|
||||||
our %actparms;
|
our %actparms;
|
||||||
our $parmsmodified;
|
our $parmsmodified;
|
||||||
our $usedcaller;
|
|
||||||
our $inline_matches;
|
our $inline_matches;
|
||||||
|
|
||||||
our $currentline; # Current config file line image
|
our $currentline; # Current config file line image
|
||||||
@@ -605,9 +595,6 @@ use constant { MIN_VERBOSITY => -1,
|
|||||||
F_IPV6 => 6,
|
F_IPV6 => 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
use constant { PARMSMODIFIED => 1,
|
|
||||||
USEDCALLER => 2 };
|
|
||||||
|
|
||||||
our %validlevels; # Valid log levels.
|
our %validlevels; # Valid log levels.
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -727,7 +714,7 @@ sub initialize( $;$$) {
|
|||||||
EXPORT => 0,
|
EXPORT => 0,
|
||||||
KLUDGEFREE => '',
|
KLUDGEFREE => '',
|
||||||
VERSION => "5.0.1",
|
VERSION => "5.0.1",
|
||||||
CAPVERSION => 50004 ,
|
CAPVERSION => 40609 ,
|
||||||
BLACKLIST_LOG_TAG => '',
|
BLACKLIST_LOG_TAG => '',
|
||||||
RELATED_LOG_TAG => '',
|
RELATED_LOG_TAG => '',
|
||||||
MACLIST_LOG_TAG => '',
|
MACLIST_LOG_TAG => '',
|
||||||
@@ -896,10 +883,7 @@ sub initialize( $;$$) {
|
|||||||
ZONE_BITS => undef,
|
ZONE_BITS => undef,
|
||||||
);
|
);
|
||||||
|
|
||||||
#
|
|
||||||
# Line numbers in shorewall6.conf where options are specified
|
|
||||||
#
|
|
||||||
%origin = ();
|
|
||||||
#
|
#
|
||||||
# Valid log levels
|
# Valid log levels
|
||||||
#
|
#
|
||||||
@@ -1005,7 +989,6 @@ sub initialize( $;$$) {
|
|||||||
TARPIT_TARGET => undef,
|
TARPIT_TARGET => undef,
|
||||||
IFACE_MATCH => undef,
|
IFACE_MATCH => undef,
|
||||||
TCPMSS_TARGET => undef,
|
TCPMSS_TARGET => undef,
|
||||||
WAIT_OPTION => undef,
|
|
||||||
|
|
||||||
AMANDA_HELPER => undef,
|
AMANDA_HELPER => undef,
|
||||||
FTP_HELPER => undef,
|
FTP_HELPER => undef,
|
||||||
@@ -1060,7 +1043,6 @@ sub initialize( $;$$) {
|
|||||||
|
|
||||||
%actparms = ( 0 => 0, loglevel => '', logtag => '', chain => '', disposition => '', caller => '' );
|
%actparms = ( 0 => 0, loglevel => '', logtag => '', chain => '', disposition => '', caller => '' );
|
||||||
$parmsmodified = 0;
|
$parmsmodified = 0;
|
||||||
$usedcaller = 0;
|
|
||||||
|
|
||||||
%helpers_enabled = (
|
%helpers_enabled = (
|
||||||
amanda => 1,
|
amanda => 1,
|
||||||
@@ -1200,33 +1182,19 @@ sub currentlineinfo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub shortlineinfo2() {
|
|
||||||
if ( $currentfile ) {
|
|
||||||
join( ':', $currentfilename, $currentlinenumber );
|
|
||||||
} else {
|
|
||||||
''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub shortlineinfo( $ ) {
|
sub shortlineinfo( $ ) {
|
||||||
if ( my $track = $config{TRACK_RULES} ) {
|
if ( $config{TRACK_RULES} ) {
|
||||||
if ( $currentfile ) {
|
if ( $currentfile ) {
|
||||||
if ( $track eq 'Yes' ) {
|
|
||||||
my $comment = '@@@ '. join( ':', $currentfilename, $currentlinenumber ) . ' @@@';
|
my $comment = '@@@ '. join( ':', $currentfilename, $currentlinenumber ) . ' @@@';
|
||||||
$comment = '@@@ ' . join( ':' , basename($currentfilename), $currentlinenumber) . ' @@@' if length $comment > 255;
|
$comment = '@@@ ' . join( ':' , basename($currentfilename), $currentlinenumber) . ' @@@' if length $comment > 255;
|
||||||
$comment = '@@@ Filename Too Long @@@' if length $comment > 255;
|
$comment = '@@@ Filename Too Long @@@' if length $comment > 255;
|
||||||
$comment;
|
$comment;
|
||||||
} else {
|
|
||||||
join( ':', $currentfilename, $currentlinenumber );
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
# Alternate lineinfo may have been passed
|
# Alternate lineinfo may have been passed
|
||||||
#
|
#
|
||||||
$_[0] || ''
|
$_[0] || ''
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2244,10 +2212,7 @@ sub split_line2( $$;$$$ ) {
|
|||||||
$pairs = '';
|
$pairs = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
unless ( $currline =~ /^\s*IP6?TABLES\(.*\)/ ) {
|
|
||||||
fatal_error "Shorewall Configuration file entries may not contain double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/;
|
fatal_error "Shorewall Configuration file entries may not contain double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/;
|
||||||
}
|
|
||||||
|
|
||||||
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
||||||
|
|
||||||
my @line = split_columns( $columns );
|
my @line = split_columns( $columns );
|
||||||
@@ -2280,7 +2245,7 @@ sub split_line2( $$;$$$ ) {
|
|||||||
|
|
||||||
for ( @pairs ) {
|
for ( @pairs ) {
|
||||||
fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/;
|
fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/;
|
||||||
my ( $column, $value ) = ( lc( $1 ), $2 );
|
my ( $column, $value ) = ( lc $1, $2 );
|
||||||
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
|
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
|
||||||
$column = $columnsref->{$column};
|
$column = $columnsref->{$column};
|
||||||
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
||||||
@@ -2532,7 +2497,7 @@ sub evaluate_expression( $$$ ) {
|
|||||||
my ( $first, $var, $rest ) = ( $1, $3, $4);
|
my ( $first, $var, $rest ) = ( $1, $3, $4);
|
||||||
$var = numeric_value( $var ) if $var =~ /^\d/;
|
$var = numeric_value( $var ) if $var =~ /^\d/;
|
||||||
$val = $var ? $actparms{$var} : $chain;
|
$val = $var ? $actparms{$var} : $chain;
|
||||||
$usedcaller = USEDCALLER if $var eq 'caller';
|
$parmsmodified ||= $var eq 'caller';
|
||||||
$expression = join_parts( $first, $val, $rest );
|
$expression = join_parts( $first, $val, $rest );
|
||||||
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
|
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
|
||||||
}
|
}
|
||||||
@@ -2669,7 +2634,7 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
my $val = $actparms{$var} = evaluate_expression ( $expression,
|
my $val = $actparms{$var} = evaluate_expression ( $expression,
|
||||||
$filename,
|
$filename,
|
||||||
$linenumber );
|
$linenumber );
|
||||||
$parmsmodified = PARMSMODIFIED;
|
$parmsmodified = 1;
|
||||||
} else {
|
} else {
|
||||||
$variables{$2} = evaluate_expression( $expression,
|
$variables{$2} = evaluate_expression( $expression,
|
||||||
$filename,
|
$filename,
|
||||||
@@ -3205,12 +3170,10 @@ sub push_action_params( $$$$$$ ) {
|
|||||||
my @parms = ( undef , split_list3( $parms , 'parameter' ) );
|
my @parms = ( undef , split_list3( $parms , 'parameter' ) );
|
||||||
|
|
||||||
$actparms{modified} = $parmsmodified;
|
$actparms{modified} = $parmsmodified;
|
||||||
$actparms{usedcaller} = $usedcaller;
|
|
||||||
|
|
||||||
my %oldparms = %actparms;
|
my %oldparms = %actparms;
|
||||||
|
|
||||||
$parmsmodified = 0;
|
$parmsmodified = 0;
|
||||||
$usedcaller = 0;
|
|
||||||
|
|
||||||
%actparms = ();
|
%actparms = ();
|
||||||
|
|
||||||
@@ -3236,16 +3199,13 @@ sub push_action_params( $$$$$$ ) {
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Pop the action parameters using the passed hash reference
|
# Pop the action parameters using the passed hash reference
|
||||||
# Return:
|
# Return true of the popped parameters were modified
|
||||||
# 1 if the popped parameters were modified
|
|
||||||
# 2 if the action used @CALLER
|
|
||||||
#
|
#
|
||||||
sub pop_action_params( $ ) {
|
sub pop_action_params( $ ) {
|
||||||
my $oldparms = shift;
|
my $oldparms = shift;
|
||||||
%actparms = %$oldparms;
|
%actparms = %$oldparms;
|
||||||
my $return = $parmsmodified | $usedcaller;
|
my $return = $parmsmodified;
|
||||||
( $parmsmodified ) = delete $actparms{modified} || 0;
|
( $parmsmodified ) = delete $actparms{modified};
|
||||||
( $usedcaller ) = delete $actparms{usedcaller} || 0;
|
|
||||||
$return;
|
$return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3340,7 +3300,6 @@ sub expand_variables( \$ ) {
|
|||||||
$val = $variables{$var};
|
$val = $variables{$var};
|
||||||
} elsif ( exists $actparms{$var} ) {
|
} elsif ( exists $actparms{$var} ) {
|
||||||
$val = $actparms{$var};
|
$val = $actparms{$var};
|
||||||
$usedcaller = USEDCALLER if $var eq 'caller';
|
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Undefined shell variable (\$$var)" unless $config{IGNOREUNKNOWNVARIABLES} || exists $config{$var};
|
fatal_error "Undefined shell variable (\$$var)" unless $config{IGNOREUNKNOWNVARIABLES} || exists $config{$var};
|
||||||
}
|
}
|
||||||
@@ -3359,7 +3318,6 @@ sub expand_variables( \$ ) {
|
|||||||
while ( $$lineref =~ m( ^(.*?) \@({)? (\d+|[a-zA-Z_]\w*) (?(2)}) (.*)$ )x ) {
|
while ( $$lineref =~ m( ^(.*?) \@({)? (\d+|[a-zA-Z_]\w*) (?(2)}) (.*)$ )x ) {
|
||||||
my ( $first, $var, $rest ) = ( $1, $3, $4);
|
my ( $first, $var, $rest ) = ( $1, $3, $4);
|
||||||
my $val = $var ? $actparms{$var} : $actparms{chain};
|
my $val = $var ? $actparms{$var} : $actparms{chain};
|
||||||
$usedcaller = USEDCALLER if $var eq 'caller';
|
|
||||||
$val = '' unless defined $val;
|
$val = '' unless defined $val;
|
||||||
$$lineref = join( '', $first , $val , $rest );
|
$$lineref = join( '', $first , $val , $rest );
|
||||||
fatal_error "Variable Expansion Loop" if ++$count > 100;
|
fatal_error "Variable Expansion Loop" if ++$count > 100;
|
||||||
@@ -4005,7 +3963,7 @@ sub Udpliteredirect() {
|
|||||||
|
|
||||||
sub Mangle_Enabled() {
|
sub Mangle_Enabled() {
|
||||||
if ( qt1( "$iptables $iptablesw -t mangle -L -n" ) ) {
|
if ( qt1( "$iptables $iptablesw -t mangle -L -n" ) ) {
|
||||||
system( "$iptables $iptablesw -t mangle -N $sillyname" ) == 0 || fatal_error "Cannot Create Mangle chain $sillyname";
|
system( "$iptables -t mangle -N $sillyname" ) == 0 || fatal_error "Cannot Create Mangle chain $sillyname";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4648,7 +4606,6 @@ sub determine_capabilities() {
|
|||||||
my $pid = $$;
|
my $pid = $$;
|
||||||
|
|
||||||
$capabilities{CAPVERSION} = $globals{CAPVERSION};
|
$capabilities{CAPVERSION} = $globals{CAPVERSION};
|
||||||
$capabilities{WAIT_OPTION} = $iptablesw;
|
|
||||||
|
|
||||||
determine_kernelversion;
|
determine_kernelversion;
|
||||||
|
|
||||||
@@ -5059,8 +5016,6 @@ sub process_shorewall_conf( $$ ) {
|
|||||||
|
|
||||||
warning_message "Option $var=$val is deprecated"
|
warning_message "Option $var=$val is deprecated"
|
||||||
if $deprecated{$var} && supplied $val && lc $config{$var} ne $deprecated{$var};
|
if $deprecated{$var} && supplied $val && lc $config{$var} ne $deprecated{$var};
|
||||||
|
|
||||||
$origin{$var} = shortlineinfo2;
|
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Unrecognized $product.conf entry";
|
fatal_error "Unrecognized $product.conf entry";
|
||||||
}
|
}
|
||||||
@@ -5128,8 +5083,6 @@ sub read_capabilities() {
|
|||||||
|
|
||||||
$globals{KLUDGEFREE} = $capabilities{KLUDGEFREE};
|
$globals{KLUDGEFREE} = $capabilities{KLUDGEFREE};
|
||||||
|
|
||||||
$iptablesw = '-w' if $capabilities{WAIT_OPTION};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -5835,25 +5788,7 @@ sub get_configuration( $$$$ ) {
|
|||||||
default_yes_no 'MULTICAST' , '';
|
default_yes_no 'MULTICAST' , '';
|
||||||
default_yes_no 'MARK_IN_FORWARD_CHAIN' , '';
|
default_yes_no 'MARK_IN_FORWARD_CHAIN' , '';
|
||||||
default_yes_no 'CHAIN_SCRIPTS' , 'Yes';
|
default_yes_no 'CHAIN_SCRIPTS' , 'Yes';
|
||||||
|
|
||||||
if ( supplied ( $val = $config{TRACK_RULES} ) ) {
|
|
||||||
if ( lc( $val ) eq 'file' ) {
|
|
||||||
$config{TRACK_RULES} = 'File';
|
|
||||||
} else {
|
|
||||||
default_yes_no 'TRACK_RULES' , '';
|
default_yes_no 'TRACK_RULES' , '';
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$config{TRACK_RULES} = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
%origin = () unless $config{TRACK_RULES} eq 'File';
|
|
||||||
#
|
|
||||||
# Ensure that all members of %origin have defined values
|
|
||||||
#
|
|
||||||
for ( keys %config ) {
|
|
||||||
$origin{$_} ||= '';
|
|
||||||
}
|
|
||||||
|
|
||||||
default_yes_no 'INLINE_MATCHES' , '';
|
default_yes_no 'INLINE_MATCHES' , '';
|
||||||
default_yes_no 'BASIC_FILTERS' , '';
|
default_yes_no 'BASIC_FILTERS' , '';
|
||||||
default_yes_no 'WORKAROUNDS' , 'Yes';
|
default_yes_no 'WORKAROUNDS' , 'Yes';
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/IPAddrs.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/IPAddrs.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2015 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Misc.pm
|
# Shorewall 4.5 -- /usr/share/shorewall/Shorewall/Misc.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -107,15 +107,13 @@ sub setup_ecn()
|
|||||||
fatal_error 'INTERFACE must be specified' if $interface eq '-';
|
fatal_error 'INTERFACE must be specified' if $interface eq '-';
|
||||||
fatal_error "Unknown interface ($interface)" unless known_interface $interface;
|
fatal_error "Unknown interface ($interface)" unless known_interface $interface;
|
||||||
|
|
||||||
my $lineinfo = shortlineinfo( '' );
|
$interfaces{$interface} = 1;
|
||||||
|
|
||||||
$interfaces{$interface} ||= $lineinfo;
|
|
||||||
|
|
||||||
$hosts = ALLIP if $hosts eq '-';
|
$hosts = ALLIP if $hosts eq '-';
|
||||||
|
|
||||||
for my $host( split_list $hosts, 'address' ) {
|
for my $host( split_list $hosts, 'address' ) {
|
||||||
validate_host( $host , 1 );
|
validate_host( $host , 1 );
|
||||||
push @hosts, [ $interface, $lineinfo, $host ];
|
push @hosts, [ $interface, $host ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,12 +125,12 @@ sub setup_ecn()
|
|||||||
for my $interface ( @interfaces ) {
|
for my $interface ( @interfaces ) {
|
||||||
my $chainref = ensure_chain 'mangle', ecn_chain( $interface );
|
my $chainref = ensure_chain 'mangle', ecn_chain( $interface );
|
||||||
|
|
||||||
add_ijump_extended $mangle_table->{POSTROUTING} , j => $chainref, $interfaces{$interface}, p => 'tcp', imatch_dest_dev( $interface ) if have_capability 'MANGLE_FORWARD';
|
add_ijump $mangle_table->{POSTROUTING} , j => $chainref, p => 'tcp', imatch_dest_dev( $interface ) if have_capability 'MANGLE_FORWARD';
|
||||||
add_ijump_extended $mangle_table->{OUTPUT}, j => $chainref, $interfaces{$interface}, p => 'tcp', imatch_dest_dev( $interface );
|
add_ijump $mangle_table->{OUTPUT}, j => $chainref, p => 'tcp', imatch_dest_dev( $interface );
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $host ( @hosts ) {
|
for my $host ( @hosts ) {
|
||||||
add_ijump_extended( $mangle_table->{ecn_chain $host->[0]}, j => 'ECN', $host=>[1], targetopts => '--ecn-tcp-remove', p => 'tcp', imatch_dest_net( $host->[2] ) );
|
add_ijump( $mangle_table->{ecn_chain $host->[0]}, j => 'ECN', targetopts => '--ecn-tcp-remove', p => 'tcp', imatch_dest_net( $host->[1] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -616,8 +614,7 @@ sub process_stoppedrules() {
|
|||||||
$target,
|
$target,
|
||||||
'',
|
'',
|
||||||
$disposition,
|
$disposition,
|
||||||
do_proto( $proto, '-', '-' ),
|
do_proto( $proto, '-', '-' ) );
|
||||||
'');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warning_message "Redundant OUTPUT rule ignored because ADMINISABSENTMINDED=Yes";
|
warning_message "Redundant OUTPUT rule ignored because ADMINISABSENTMINDED=Yes";
|
||||||
@@ -657,7 +654,7 @@ sub add_common_rules ( $ ) {
|
|||||||
setup_mss;
|
setup_mss;
|
||||||
|
|
||||||
if ( $config{FASTACCEPT} ) {
|
if ( $config{FASTACCEPT} ) {
|
||||||
add_ijump_extended( $filter_table->{OUTPUT} , j => 'ACCEPT', $origin{FASTACCEPT}, state_imatch $faststate )
|
add_ijump( $filter_table->{OUTPUT} , j => 'ACCEPT', state_imatch $faststate )
|
||||||
}
|
}
|
||||||
|
|
||||||
my $policy = $config{SFILTER_DISPOSITION};
|
my $policy = $config{SFILTER_DISPOSITION};
|
||||||
@@ -665,7 +662,6 @@ sub add_common_rules ( $ ) {
|
|||||||
$tag = $config{SFILTER_LOG_TAG};
|
$tag = $config{SFILTER_LOG_TAG};
|
||||||
my $audit = $policy =~ s/^A_//;
|
my $audit = $policy =~ s/^A_//;
|
||||||
my @ipsec = have_ipsec ? ( policy => '--pol none --dir in' ) : ();
|
my @ipsec = have_ipsec ? ( policy => '--pol none --dir in' ) : ();
|
||||||
my $origin = $origin{SFILTER_DISPOSITION};
|
|
||||||
|
|
||||||
if ( $level || $audit ) {
|
if ( $level || $audit ) {
|
||||||
#
|
#
|
||||||
@@ -680,12 +676,11 @@ sub add_common_rules ( $ ) {
|
|||||||
$globals{LOGLIMIT},
|
$globals{LOGLIMIT},
|
||||||
$tag,
|
$tag,
|
||||||
'add',
|
'add',
|
||||||
'',
|
'' ) if $level ne '';
|
||||||
$origin{SFILTER_LOG_LEVEL} ) if $level ne '';
|
|
||||||
|
|
||||||
add_ijump_extended( $chainref, j => 'AUDIT', $origin, targetopts => '--type ' . lc $policy ) if $audit;
|
add_ijump( $chainref, j => 'AUDIT', targetopts => '--type ' . lc $policy ) if $audit;
|
||||||
|
|
||||||
add_ijump_extended( $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy, $origin );
|
add_ijump $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy;
|
||||||
|
|
||||||
$target = 'sfilter';
|
$target = 'sfilter';
|
||||||
} else {
|
} else {
|
||||||
@@ -701,20 +696,11 @@ sub add_common_rules ( $ ) {
|
|||||||
$chainref = new_standard_chain 'sfilter1';
|
$chainref = new_standard_chain 'sfilter1';
|
||||||
|
|
||||||
add_ijump ( $chainref, j => 'RETURN', policy => '--pol ipsec --dir out' );
|
add_ijump ( $chainref, j => 'RETURN', policy => '--pol ipsec --dir out' );
|
||||||
|
log_rule $level , $chainref , $policy , '' if $level ne '';
|
||||||
|
|
||||||
log_rule_limit( $level,
|
add_ijump( $chainref, j => 'AUDIT', targetopts => '--type ' . lc $policy ) if $audit;
|
||||||
$chainref,
|
|
||||||
$chainref->{name},
|
|
||||||
$policy,
|
|
||||||
$globals{LOGLIMIT},
|
|
||||||
$tag,
|
|
||||||
'add',
|
|
||||||
'' ,
|
|
||||||
$origin ) if $level ne '';
|
|
||||||
|
|
||||||
add_ijump_extended( $chainref, j => 'AUDIT', $origin{SFILTER_DISPOSITION}, targetopts => '--type ' . lc $policy ) if $audit;
|
add_ijump $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy;
|
||||||
|
|
||||||
add_ijump_extended( $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy, $origin );
|
|
||||||
|
|
||||||
$target1 = 'sfilter1';
|
$target1 = 'sfilter1';
|
||||||
} else {
|
} else {
|
||||||
@@ -734,14 +720,13 @@ sub add_common_rules ( $ ) {
|
|||||||
unless ( $interfaceref->{options}{ignore} & NO_SFILTER || $interfaceref->{options}{rpfilter} ) {
|
unless ( $interfaceref->{options}{ignore} & NO_SFILTER || $interfaceref->{options}{rpfilter} ) {
|
||||||
|
|
||||||
my @filters = @{$interfaceref->{filter}};
|
my @filters = @{$interfaceref->{filter}};
|
||||||
my $origin = $interfaceref->{origin};
|
|
||||||
|
|
||||||
$chainref = $filter_table->{forward_option_chain $interface};
|
$chainref = $filter_table->{forward_option_chain $interface};
|
||||||
|
|
||||||
if ( @filters ) {
|
if ( @filters ) {
|
||||||
add_ijump_extended( $chainref , @ipsec ? 'j' : 'g' => $target1, $origin, imatch_source_net( $_ ), @ipsec ), $chainref->{filtered}++ for @filters;
|
add_ijump( $chainref , @ipsec ? 'j' : 'g' => $target1, imatch_source_net( $_ ), @ipsec ), $chainref->{filtered}++ for @filters;
|
||||||
} elsif ( $interfaceref->{bridge} eq $interface ) {
|
} elsif ( $interfaceref->{bridge} eq $interface ) {
|
||||||
add_ijump_extended( $chainref , @ipsec ? 'j' : 'g' => $target1, $origin, imatch_dest_dev( $interface ), @ipsec ), $chainref->{filtered}++
|
add_ijump( $chainref , @ipsec ? 'j' : 'g' => $target1, imatch_dest_dev( $interface ), @ipsec ), $chainref->{filtered}++
|
||||||
unless( $config{ROUTE_FILTER} eq 'on' ||
|
unless( $config{ROUTE_FILTER} eq 'on' ||
|
||||||
$interfaceref->{options}{routeback} ||
|
$interfaceref->{options}{routeback} ||
|
||||||
$interfaceref->{options}{routefilter} ||
|
$interfaceref->{options}{routefilter} ||
|
||||||
@@ -751,13 +736,13 @@ sub add_common_rules ( $ ) {
|
|||||||
|
|
||||||
if ( @filters ) {
|
if ( @filters ) {
|
||||||
$chainref = $filter_table->{input_option_chain $interface};
|
$chainref = $filter_table->{input_option_chain $interface};
|
||||||
add_ijump_extended( $chainref , g => $target, $origin, imatch_source_net( $_ ), @ipsec ), $chainref->{filtered}++ for @filters;
|
add_ijump( $chainref , g => $target, imatch_source_net( $_ ), @ipsec ), $chainref->{filtered}++ for @filters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( option_chains( $interface ) ) {
|
for ( option_chains( $interface ) ) {
|
||||||
add_ijump_extended( $filter_table->{$_}, j => $dynamicref, $origin{DYNAMIC_BLACKLIST}, @state ) if $dynamicref;
|
add_ijump( $filter_table->{$_}, j => $dynamicref, @state ) if $dynamicref;
|
||||||
add_ijump_extended( $filter_table->{$_}, j => 'ACCEPT', $origin{FASTACCEPT}, state_imatch $faststate )->{comment} = '' if $config{FASTACCEPT};
|
add_ijump( $filter_table->{$_}, j => 'ACCEPT', state_imatch $faststate )->{comment} = '' if $config{FASTACCEPT};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -778,8 +763,6 @@ sub add_common_rules ( $ ) {
|
|||||||
$level = $config{RPFILTER_LOG_LEVEL};
|
$level = $config{RPFILTER_LOG_LEVEL};
|
||||||
$tag = $globals{RPFILTER_LOG_TAG};
|
$tag = $globals{RPFILTER_LOG_TAG};
|
||||||
$audit = $policy =~ s/^A_//;
|
$audit = $policy =~ s/^A_//;
|
||||||
my $origin
|
|
||||||
= $origin{RPFILTER_DISPOSITION};
|
|
||||||
|
|
||||||
if ( $level || $audit ) {
|
if ( $level || $audit ) {
|
||||||
#
|
#
|
||||||
@@ -794,12 +777,11 @@ sub add_common_rules ( $ ) {
|
|||||||
$globals{LOGLIMIT},
|
$globals{LOGLIMIT},
|
||||||
$tag,
|
$tag,
|
||||||
'add',
|
'add',
|
||||||
'',
|
'' ) if $level ne '';
|
||||||
$origin{RPFILTER_LOG_LEVEL} );
|
|
||||||
|
|
||||||
add_ijump_extended( $chainref, j => 'AUDIT', $origin, targetopts => '--type ' . lc $policy ) if $audit;
|
add_ijump( $chainref, j => 'AUDIT', targetopts => '--type ' . lc $policy ) if $audit;
|
||||||
|
|
||||||
add_ijump_extended( $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy, $origin );
|
add_ijump $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy;
|
||||||
|
|
||||||
$target = 'rplog';
|
$target = 'rplog';
|
||||||
} else {
|
} else {
|
||||||
@@ -811,9 +793,8 @@ sub add_common_rules ( $ ) {
|
|||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
for $interface ( @$list ) {
|
for $interface ( @$list ) {
|
||||||
if ( get_interface_option( $interface, 'dhcp' ) ) {
|
if ( get_interface_option( $interface, 'dhcp' ) ) {
|
||||||
add_ijump_extended( $rpfilterref,
|
add_ijump( $rpfilterref,
|
||||||
j => 'RETURN',
|
j => 'RETURN',
|
||||||
get_interface_origin( $interface ),
|
|
||||||
s => NILIPv4,
|
s => NILIPv4,
|
||||||
p => UDP,
|
p => UDP,
|
||||||
dport => 67,
|
dport => 67,
|
||||||
@@ -824,9 +805,8 @@ sub add_common_rules ( $ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_ijump_extended( $rpfilterref,
|
add_ijump( $rpfilterref,
|
||||||
j => $target,
|
j => $target,
|
||||||
$origin,
|
|
||||||
rpfilter => '--validmark --invert',
|
rpfilter => '--validmark --invert',
|
||||||
state_imatch 'NEW,RELATED,INVALID',
|
state_imatch 'NEW,RELATED,INVALID',
|
||||||
@ipsec
|
@ipsec
|
||||||
@@ -849,7 +829,6 @@ sub add_common_rules ( $ ) {
|
|||||||
$chainref = new_standard_chain 'smurfs';
|
$chainref = new_standard_chain 'smurfs';
|
||||||
|
|
||||||
my $smurfdest = $config{SMURF_DISPOSITION};
|
my $smurfdest = $config{SMURF_DISPOSITION};
|
||||||
my $origin = $origin{SMURF_DISPOSITION};
|
|
||||||
|
|
||||||
if ( supplied $config{SMURF_LOG_LEVEL} ) {
|
if ( supplied $config{SMURF_LOG_LEVEL} ) {
|
||||||
my $smurfref = new_chain( 'filter', 'smurflog' );
|
my $smurfref = new_chain( 'filter', 'smurflog' );
|
||||||
@@ -860,12 +839,9 @@ sub add_common_rules ( $ ) {
|
|||||||
'DROP',
|
'DROP',
|
||||||
$globals{LOGILIMIT},
|
$globals{LOGILIMIT},
|
||||||
$globals{SMURF_LOG_TAG},
|
$globals{SMURF_LOG_TAG},
|
||||||
'add',
|
'add' );
|
||||||
$origin{SMURF_LOG_LEVEL} );
|
add_ijump( $smurfref, j => 'AUDIT', targetopts => '--type drop' ) if $smurfdest eq 'A_DROP';
|
||||||
|
add_ijump( $smurfref, j => 'DROP' );
|
||||||
add_ijump_extended( $smurfref, j => 'AUDIT', $origin, targetopts => '--type drop' ) if $smurfdest eq 'A_DROP';
|
|
||||||
|
|
||||||
add_ijump_extended( $smurfref, j => 'DROP' , $origin );
|
|
||||||
|
|
||||||
$smurfdest = 'smurflog';
|
$smurfdest = 'smurflog';
|
||||||
} else {
|
} else {
|
||||||
@@ -879,7 +855,7 @@ sub add_common_rules ( $ ) {
|
|||||||
add_ijump $chainref , j => 'RETURN', s => '::';
|
add_ijump $chainref , j => 'RETURN', s => '::';
|
||||||
}
|
}
|
||||||
|
|
||||||
add_ijump_extended( $chainref, g => $smurfdest, $origin, addrtype => '--src-type BROADCAST' ) ;
|
add_ijump( $chainref, g => $smurfdest, addrtype => '--src-type BROADCAST' ) ;
|
||||||
} else {
|
} else {
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
add_commands $chainref, 'for address in $ALL_BCASTS; do';
|
add_commands $chainref, 'for address in $ALL_BCASTS; do';
|
||||||
@@ -888,15 +864,15 @@ sub add_common_rules ( $ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
incr_cmd_level $chainref;
|
incr_cmd_level $chainref;
|
||||||
add_ijump_extended( $chainref, g => $smurfdest, $origin, s => '$address' );
|
add_ijump( $chainref, g => $smurfdest, s => '$address' );
|
||||||
decr_cmd_level $chainref;
|
decr_cmd_level $chainref;
|
||||||
add_commands $chainref, 'done';
|
add_commands $chainref, 'done';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
add_ijump_extended( $chainref, g => $smurfdest, $origin, s => '224.0.0.0/4' );
|
add_ijump( $chainref, g => $smurfdest, s => '224.0.0.0/4' );
|
||||||
} else {
|
} else {
|
||||||
add_ijump_extended( $chainref, g => $smurfdest, $origin, s => IPv6_MULTICAST );
|
add_ijump( $chainref, g => $smurfdest, s => IPv6_MULTICAST );
|
||||||
}
|
}
|
||||||
|
|
||||||
my @state = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,INVALID,UNTRACKED' : state_imatch 'NEW,INVALID';
|
my @state = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,INVALID,UNTRACKED' : state_imatch 'NEW,INVALID';
|
||||||
@@ -904,13 +880,11 @@ sub add_common_rules ( $ ) {
|
|||||||
for my $hostref ( @$list ) {
|
for my $hostref ( @$list ) {
|
||||||
$interface = $hostref->[0];
|
$interface = $hostref->[0];
|
||||||
my $ipsec = $hostref->[1];
|
my $ipsec = $hostref->[1];
|
||||||
my $net = $hostref->[2];
|
|
||||||
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
||||||
my $target = source_exclusion( $hostref->[3], $chainref );
|
my $target = source_exclusion( $hostref->[3], $chainref );
|
||||||
my $origin = $hostref->[5];
|
|
||||||
|
|
||||||
for $chain ( option_chains $interface ) {
|
for $chain ( option_chains $interface ) {
|
||||||
add_ijump_extended( $filter_table->{$chain} , j => $target, $origin, @state, imatch_source_net( $net ), @policy );
|
add_ijump( $filter_table->{$chain} , j => $target, @state, imatch_source_net( $hostref->[2] ), @policy );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -963,25 +937,19 @@ sub add_common_rules ( $ ) {
|
|||||||
my $ports = $family == F_IPV4 ? '67:68' : '546:547';
|
my $ports = $family == F_IPV4 ? '67:68' : '546:547';
|
||||||
|
|
||||||
for $interface ( @$list ) {
|
for $interface ( @$list ) {
|
||||||
my $origin = get_interface_origin($interface);
|
set_rule_option( add_ijump( $filter_table->{$_} , j => 'ACCEPT', p => "udp --dport $ports" ) ,
|
||||||
set_rule_option( add_ijump_extended( $filter_table->{$_} ,
|
|
||||||
j => 'ACCEPT',
|
|
||||||
$origin,
|
|
||||||
p => "udp --dport $ports" ) ,
|
|
||||||
'dhcp',
|
'dhcp',
|
||||||
1 ) for input_option_chain( $interface ), output_option_chain( $interface );
|
1 ) for input_option_chain( $interface ), output_option_chain( $interface );
|
||||||
|
|
||||||
add_ijump_extended( $filter_table->{forward_option_chain $interface} ,
|
add_ijump( $filter_table->{forward_option_chain $interface} ,
|
||||||
j => 'ACCEPT',
|
j => 'ACCEPT',
|
||||||
$origin,
|
|
||||||
p => "udp --dport $ports" ,
|
p => "udp --dport $ports" ,
|
||||||
imatch_dest_dev( $interface ) )
|
imatch_dest_dev( $interface ) )
|
||||||
if get_interface_option( $interface, 'bridge' );
|
if get_interface_option( $interface, 'bridge' );
|
||||||
|
|
||||||
unless ( $family == F_IPV6 || get_interface_option( $interface, 'allip' ) ) {
|
unless ( $family == F_IPV6 || get_interface_option( $interface, 'allip' ) ) {
|
||||||
add_ijump_extended( $filter_table->{input_chain( $interface ) } ,
|
add_ijump( $filter_table->{input_chain( $interface ) } ,
|
||||||
j => 'ACCEPT' ,
|
j => 'ACCEPT' ,
|
||||||
$origin ,
|
|
||||||
p => "udp --dport $ports" ,
|
p => "udp --dport $ports" ,
|
||||||
s => NILIPv4 . '/' . VLSMv4 );
|
s => NILIPv4 . '/' . VLSMv4 );
|
||||||
}
|
}
|
||||||
@@ -995,7 +963,6 @@ sub add_common_rules ( $ ) {
|
|||||||
my $tag = $globals{TCP_FLAGS_LOG_TAG};
|
my $tag = $globals{TCP_FLAGS_LOG_TAG};
|
||||||
my $disposition = $config{TCP_FLAGS_DISPOSITION};
|
my $disposition = $config{TCP_FLAGS_DISPOSITION};
|
||||||
my $audit = $disposition =~ /^A_/;
|
my $audit = $disposition =~ /^A_/;
|
||||||
my $origin = $origin{TCP_FLAGS_DISPOSITION};
|
|
||||||
|
|
||||||
progress_message2 "$doing TCP Flags filtering...";
|
progress_message2 "$doing TCP Flags filtering...";
|
||||||
|
|
||||||
@@ -1015,20 +982,20 @@ sub add_common_rules ( $ ) {
|
|||||||
$globals{LOGLIMIT},
|
$globals{LOGLIMIT},
|
||||||
$tag,
|
$tag,
|
||||||
'add',
|
'add',
|
||||||
'' ,
|
''
|
||||||
$origin{TCP_FLAGS_LOG_LEVEL} );
|
);
|
||||||
|
|
||||||
$globals{LOGPARMS} = $savelogparms;
|
$globals{LOGPARMS} = $savelogparms;
|
||||||
|
|
||||||
if ( $audit ) {
|
if ( $audit ) {
|
||||||
$disposition =~ s/^A_//;
|
$disposition =~ s/^A_//;
|
||||||
add_ijump_extended( $logflagsref, j => 'AUDIT', $origin, targetopts => '--type ' . lc $disposition );
|
add_ijump( $logflagsref, j => 'AUDIT', targetopts => '--type ' . lc $disposition );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $disposition eq 'REJECT' ) {
|
if ( $disposition eq 'REJECT' ) {
|
||||||
add_ijump_extended $logflagsref , j => 'REJECT', $origin, targetopts => '--reject-with tcp-reset', p => 6;
|
add_ijump $logflagsref , j => 'REJECT', targetopts => '--reject-with tcp-reset', p => 6;
|
||||||
} else {
|
} else {
|
||||||
add_ijump_extended $logflagsref , j => $disposition, $origin;
|
add_ijump $logflagsref , j => $disposition;
|
||||||
}
|
}
|
||||||
|
|
||||||
$disposition = 'logflags';
|
$disposition = 'logflags';
|
||||||
@@ -1050,10 +1017,9 @@ sub add_common_rules ( $ ) {
|
|||||||
my $target = source_exclusion( $hostref->[3], $chainref );
|
my $target = source_exclusion( $hostref->[3], $chainref );
|
||||||
my $ipsec = $hostref->[1];
|
my $ipsec = $hostref->[1];
|
||||||
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
||||||
my $origin = $hostref->[5];
|
|
||||||
|
|
||||||
for $chain ( option_chains $interface ) {
|
for $chain ( option_chains $interface ) {
|
||||||
add_ijump_extended( $filter_table->{$chain} , j => $target, $origin, p => 'tcp', imatch_source_net( $hostref->[2] ), @policy );
|
add_ijump( $filter_table->{$chain} , j => $target, p => 'tcp', imatch_source_net( $hostref->[2] ), @policy );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1073,7 +1039,7 @@ sub add_common_rules ( $ ) {
|
|||||||
$announced = 1;
|
$announced = 1;
|
||||||
|
|
||||||
for $interface ( @$list ) {
|
for $interface ( @$list ) {
|
||||||
add_ijump_extended $nat_table->{PREROUTING} , j => 'UPnP', get_interface_origin($interface), imatch_source_dev ( $interface );
|
add_ijump $nat_table->{PREROUTING} , j => 'UPnP', imatch_source_dev ( $interface );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1087,17 +1053,16 @@ sub add_common_rules ( $ ) {
|
|||||||
my $base = uc var_base get_physical $interface;
|
my $base = uc var_base get_physical $interface;
|
||||||
my $optional = interface_is_optional( $interface );
|
my $optional = interface_is_optional( $interface );
|
||||||
my $variable = get_interface_gateway( $interface, ! $optional );
|
my $variable = get_interface_gateway( $interface, ! $optional );
|
||||||
my $origin = get_interface_origin( $interface );
|
|
||||||
|
|
||||||
if ( $optional ) {
|
if ( $optional ) {
|
||||||
add_commands( $chainref,
|
add_commands( $chainref,
|
||||||
qq(if [ -n "SW_\$${base}_IS_USABLE" -a -n "$variable" ]; then) );
|
qq(if [ -n "SW_\$${base}_IS_USABLE" -a -n "$variable" ]; then) );
|
||||||
incr_cmd_level( $chainref );
|
incr_cmd_level( $chainref );
|
||||||
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
|
add_ijump( $chainref, j => 'ACCEPT', imatch_source_dev( $interface ), s => $variable, p => 'udp' );
|
||||||
decr_cmd_level( $chainref );
|
decr_cmd_level( $chainref );
|
||||||
add_commands( $chainref, 'fi' );
|
add_commands( $chainref, 'fi' );
|
||||||
} else {
|
} else {
|
||||||
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
|
add_ijump( $chainref, j => 'ACCEPT', imatch_source_dev( $interface ), s => $variable, p => 'udp' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1225,7 +1190,6 @@ sub setup_mac_lists( $ ) {
|
|||||||
my $ipsec = $hostref->[1];
|
my $ipsec = $hostref->[1];
|
||||||
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
||||||
my @source = imatch_source_net $hostref->[2];
|
my @source = imatch_source_net $hostref->[2];
|
||||||
my $origin = $hostref->[5];
|
|
||||||
|
|
||||||
my @state = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,UNTRACKED' : state_imatch 'NEW';
|
my @state = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,UNTRACKED' : state_imatch 'NEW';
|
||||||
|
|
||||||
@@ -1233,11 +1197,11 @@ sub setup_mac_lists( $ ) {
|
|||||||
my $chainref = source_exclusion( $hostref->[3], $filter_table->{mac_chain $interface} );
|
my $chainref = source_exclusion( $hostref->[3], $filter_table->{mac_chain $interface} );
|
||||||
|
|
||||||
for my $chain ( option_chains $interface ) {
|
for my $chain ( option_chains $interface ) {
|
||||||
add_ijump_extended $filter_table->{$chain} , j => $chainref, $origin, @source, @state, @policy;
|
add_ijump $filter_table->{$chain} , j => $chainref, @source, @state, @policy;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
my $chainref = source_exclusion( $hostref->[3], $mangle_table->{mac_chain $interface} );
|
my $chainref = source_exclusion( $hostref->[3], $mangle_table->{mac_chain $interface} );
|
||||||
add_ijump_extended $mangle_table->{PREROUTING}, j => $chainref, $origin, imatch_source_dev( $interface ), @source, @state, @policy;
|
add_ijump $mangle_table->{PREROUTING}, j => $chainref, imatch_source_dev( $interface ), @source, @state, @policy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1293,7 +1257,7 @@ sub setup_mac_lists( $ ) {
|
|||||||
|
|
||||||
run_user_exit2( 'maclog', $chainref );
|
run_user_exit2( 'maclog', $chainref );
|
||||||
|
|
||||||
log_irule_limit $level, $chainref , $chain , $disposition, [], $tag, 'add', '' if $level ne '';
|
log_irule_limit $level, $chainref , $chain , $disposition, [], $tag, 'add' if $level ne '';
|
||||||
add_ijump $chainref, j => $target;
|
add_ijump $chainref, j => $target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1328,8 +1292,8 @@ sub rules_target( $$ ) {
|
|||||||
#
|
#
|
||||||
# Generate rules for one destination zone
|
# Generate rules for one destination zone
|
||||||
#
|
#
|
||||||
sub generate_dest_rules( $$$$;@ ) {
|
sub generate_dest_rules( $$$;@ ) {
|
||||||
my ( $chainref, $chain, $z2, $origin, @matches ) = @_;
|
my ( $chainref, $chain, $z2, @matches ) = @_;
|
||||||
|
|
||||||
my $z2ref = find_zone( $z2 );
|
my $z2ref = find_zone( $z2 );
|
||||||
my $type2 = $z2ref->{type};
|
my $type2 = $z2ref->{type};
|
||||||
@@ -1337,18 +1301,16 @@ sub generate_dest_rules( $$$$;@ ) {
|
|||||||
if ( $type2 & VSERVER ) {
|
if ( $type2 & VSERVER ) {
|
||||||
for my $hostref ( @{$z2ref->{hosts}{ip}{'%vserver%'}} ) {
|
for my $hostref ( @{$z2ref->{hosts}{ip}{'%vserver%'}} ) {
|
||||||
my $exclusion = dest_exclusion( $hostref->{exclusions}, $chain);
|
my $exclusion = dest_exclusion( $hostref->{exclusions}, $chain);
|
||||||
my $origin = $hostref->{origin};
|
|
||||||
|
|
||||||
for my $net ( @{$hostref->{hosts}} ) {
|
for my $net ( @{$hostref->{hosts}} ) {
|
||||||
add_ijump_extended( $chainref,
|
add_ijump( $chainref,
|
||||||
j => $exclusion ,
|
j => $exclusion ,
|
||||||
$origin,
|
|
||||||
imatch_dest_net ( $net ),
|
imatch_dest_net ( $net ),
|
||||||
@matches );
|
@matches );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
add_ijump_extended( $chainref, j => $chain, $origin, @matches );
|
add_ijump( $chainref, j => $chain, @matches );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1366,13 +1328,11 @@ sub generate_source_rules( $$$;@ ) {
|
|||||||
for my $hostref ( @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
|
for my $hostref ( @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
|
||||||
my @ipsec_match = match_ipsec_in $z1 , $hostref;
|
my @ipsec_match = match_ipsec_in $z1 , $hostref;
|
||||||
my $exclusion = source_exclusion( $hostref->{exclusions}, $chain);
|
my $exclusion = source_exclusion( $hostref->{exclusions}, $chain);
|
||||||
my $origin = $hostref->{origin};
|
|
||||||
|
|
||||||
for my $net ( @{$hostref->{hosts}} ) {
|
for my $net ( @{$hostref->{hosts}} ) {
|
||||||
generate_dest_rules( $outchainref,
|
generate_dest_rules( $outchainref,
|
||||||
$exclusion,
|
$exclusion,
|
||||||
$z2,
|
$z2,
|
||||||
$origin,
|
|
||||||
imatch_source_net( $net ),
|
imatch_source_net( $net ),
|
||||||
@matches ,
|
@matches ,
|
||||||
@ipsec_match
|
@ipsec_match
|
||||||
@@ -1441,7 +1401,7 @@ sub handle_loopback_traffic() {
|
|||||||
next if $z1 eq $z2 && ( $loopback || $unmanaged );
|
next if $z1 eq $z2 && ( $loopback || $unmanaged );
|
||||||
|
|
||||||
my $chain = rules_target( $z1, $z2 );
|
my $chain = rules_target( $z1, $z2 );
|
||||||
generate_dest_rules( $outchainref, $chain, $z2, '', @rule ) if $chain;
|
generate_dest_rules( $outchainref, $chain, $z2, @rule ) if $chain;
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# Handle conntrack
|
# Handle conntrack
|
||||||
@@ -1680,12 +1640,10 @@ sub handle_complex_zone( $$ ) {
|
|||||||
#
|
#
|
||||||
for my $hostref ( @{$arrayref} ) {
|
for my $hostref ( @{$arrayref} ) {
|
||||||
my @ipsec_match = match_ipsec_in $zone , $hostref;
|
my @ipsec_match = match_ipsec_in $zone , $hostref;
|
||||||
my $origin = $hostref->{origin};
|
|
||||||
for my $net ( @{$hostref->{hosts}} ) {
|
for my $net ( @{$hostref->{hosts}} ) {
|
||||||
add_ijump_extended(
|
add_ijump(
|
||||||
$sourcechainref,
|
$sourcechainref,
|
||||||
@{$zoneref->{parents}} ? 'j' : 'g' => source_exclusion( $hostref->{exclusions}, $frwd_ref ),
|
@{$zoneref->{parents}} ? 'j' : 'g' => source_exclusion( $hostref->{exclusions}, $frwd_ref ),
|
||||||
$origin,
|
|
||||||
@interfacematch ,
|
@interfacematch ,
|
||||||
imatch_source_net( $net ),
|
imatch_source_net( $net ),
|
||||||
@ipsec_match
|
@ipsec_match
|
||||||
@@ -1744,8 +1702,8 @@ sub handle_nested_zone( $$ ) {
|
|||||||
#
|
#
|
||||||
# Add output jump to the passed zone:interface:hostref:net
|
# Add output jump to the passed zone:interface:hostref:net
|
||||||
#
|
#
|
||||||
sub add_output_jumps( $$$$$$$$ ) {
|
sub add_output_jumps( $$$$$$$ ) {
|
||||||
my ( $zone, $interface, $hostref, $net, $exclusions, $isport, $bridge, $origin ) = @_;
|
my ( $zone, $interface, $hostref, $net, $exclusions, $isport, $bridge, ) = @_;
|
||||||
|
|
||||||
our @vservers;
|
our @vservers;
|
||||||
our %output_jump_added;
|
our %output_jump_added;
|
||||||
@@ -1774,16 +1732,15 @@ sub add_output_jumps( $$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# It is a bridge port zone -- use the bridges output chain and match the physdev
|
# It is a bridge port zone -- use the bridges output chain and match the physdev
|
||||||
#
|
#
|
||||||
add_ijump_extended( $filter_table->{ output_chain $bridge },
|
add_ijump( $filter_table->{ output_chain $bridge },
|
||||||
j => $outputref ,
|
j => $outputref ,
|
||||||
$origin ,
|
|
||||||
imatch_dest_dev( $interface, 1 ) )
|
imatch_dest_dev( $interface, 1 ) )
|
||||||
unless $output_jump_added{$interface}++;
|
unless $output_jump_added{$interface}++;
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
# Not a bridge -- match the input interface
|
# Not a bridge -- match the input interface
|
||||||
#
|
#
|
||||||
add_ijump_extended $filter_table->{OUTPUT}, j => $outputref, $origin, imatch_dest_dev( $interface ) unless $output_jump_added{$interface}++;
|
add_ijump $filter_table->{OUTPUT}, j => $outputref, imatch_dest_dev( $interface ) unless $output_jump_added{$interface}++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$use_output = 1;
|
$use_output = 1;
|
||||||
@@ -1812,11 +1769,11 @@ sub add_output_jumps( $$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Add the jump
|
# Add the jump
|
||||||
#
|
#
|
||||||
add_ijump_extended $outputref , j => $nextchain, $origin, @interfacematch, @dest, @ipsec_out_match;
|
add_ijump $outputref , j => $nextchain, @interfacematch, @dest, @ipsec_out_match;
|
||||||
#
|
#
|
||||||
# Add jump for broadcast
|
# Add jump for broadcast
|
||||||
#
|
#
|
||||||
add_ijump_extended( $outputref , j => $nextchain, get_interface_origin( $interface ), @interfacematch, d => '255.255.255.255' , @ipsec_out_match )
|
add_ijump( $outputref , j => $nextchain, @interfacematch, d => '255.255.255.255' , @ipsec_out_match )
|
||||||
if $family == F_IPV4 && $hostref->{options}{broadcast};
|
if $family == F_IPV4 && $hostref->{options}{broadcast};
|
||||||
#
|
#
|
||||||
# Move the rules from the interface output chain if we didn't use it
|
# Move the rules from the interface output chain if we didn't use it
|
||||||
@@ -1827,8 +1784,8 @@ sub add_output_jumps( $$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Add prerouting jumps from the passed zone:interface:hostref:net
|
# Add prerouting jumps from the passed zone:interface:hostref:net
|
||||||
#
|
#
|
||||||
sub add_prerouting_jumps( $$$$$$$$$ ) {
|
sub add_prerouting_jumps( $$$$$$$$ ) {
|
||||||
my ( $zone, $interface, $hostref, $net, $exclusions, $nested, $parenthasnat, $parenthasnotrack , $origin ) = @_;
|
my ( $zone, $interface, $hostref, $net, $exclusions, $nested, $parenthasnat, $parenthasnotrack ) = @_;
|
||||||
|
|
||||||
my $dnatref = $nat_table->{dnat_chain( $zone )};
|
my $dnatref = $nat_table->{dnat_chain( $zone )};
|
||||||
my $preroutingref = $nat_table->{PREROUTING};
|
my $preroutingref = $nat_table->{PREROUTING};
|
||||||
@@ -1843,9 +1800,8 @@ sub add_prerouting_jumps( $$$$$$$$$ ) {
|
|||||||
# There are DNAT/REDIRECT rules with this zone as the source.
|
# There are DNAT/REDIRECT rules with this zone as the source.
|
||||||
# Add a jump from this source network to this zone's DNAT/REDIRECT chain
|
# Add a jump from this source network to this zone's DNAT/REDIRECT chain
|
||||||
#
|
#
|
||||||
add_ijump_extended( $preroutingref,
|
add_ijump( $preroutingref,
|
||||||
j => source_exclusion( $exclusions, $dnatref),
|
j => source_exclusion( $exclusions, $dnatref),
|
||||||
$origin,
|
|
||||||
imatch_source_dev( $interface),
|
imatch_source_dev( $interface),
|
||||||
@source,
|
@source,
|
||||||
@ipsec_in_match );
|
@ipsec_in_match );
|
||||||
@@ -1866,7 +1822,7 @@ sub add_prerouting_jumps( $$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
if ( $nested ) {
|
if ( $nested ) {
|
||||||
if ( $parenthasnat ) {
|
if ( $parenthasnat ) {
|
||||||
add_ijump_extended $preroutingref, j => 'RETURN', $origin, imatch_source_dev( $interface), @source, @ipsec_in_match;
|
add_ijump $preroutingref, j => 'RETURN', imatch_source_dev( $interface), @source, @ipsec_in_match;
|
||||||
}
|
}
|
||||||
if ( $parenthasnotrack ) {
|
if ( $parenthasnotrack ) {
|
||||||
my $rawref = $raw_table->{PREROUTING};
|
my $rawref = $raw_table->{PREROUTING};
|
||||||
@@ -1878,8 +1834,8 @@ sub add_prerouting_jumps( $$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Add input jump from the passed zone:interface:hostref:net
|
# Add input jump from the passed zone:interface:hostref:net
|
||||||
#
|
#
|
||||||
sub add_input_jumps( $$$$$$$$$ ) {
|
sub add_input_jumps( $$$$$$$$ ) {
|
||||||
my ( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge, $origin ) = @_;
|
my ( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge ) = @_;
|
||||||
|
|
||||||
our @vservers;
|
our @vservers;
|
||||||
our %input_jump_added;
|
our %input_jump_added;
|
||||||
@@ -1908,16 +1864,15 @@ sub add_input_jumps( $$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
||||||
#
|
#
|
||||||
add_ijump_extended( $filter_table->{ input_chain $bridge },
|
add_ijump( $filter_table->{ input_chain $bridge },
|
||||||
j => $inputchainref ,
|
j => $inputchainref ,
|
||||||
$origin ,
|
|
||||||
imatch_source_dev($interface, 1) )
|
imatch_source_dev($interface, 1) )
|
||||||
unless $input_jump_added{$interface}++;
|
unless $input_jump_added{$interface}++;
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
# Not a bridge -- match the input interface
|
# Not a bridge -- match the input interface
|
||||||
#
|
#
|
||||||
add_ijump_extended $filter_table->{INPUT}, j => $inputchainref, $origin, imatch_source_dev($interface) unless $input_jump_added{$interface}++;
|
add_ijump $filter_table->{INPUT}, j => $inputchainref, imatch_source_dev($interface) unless $input_jump_added{$interface}++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$use_input = 1;
|
$use_input = 1;
|
||||||
@@ -1928,7 +1883,7 @@ sub add_input_jumps( $$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
for my $vzone ( @vservers ) {
|
for my $vzone ( @vservers ) {
|
||||||
my $target = rules_target( $zone, $vzone );
|
my $target = rules_target( $zone, $vzone );
|
||||||
generate_dest_rules( $inputchainref, $target, $vzone, $origin, @source, @ipsec_in_match ) if $target;
|
generate_dest_rules( $inputchainref, $target, $vzone, @source, @ipsec_in_match ) if $target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elsif ( $isport ) {
|
} elsif ( $isport ) {
|
||||||
@@ -1949,7 +1904,7 @@ sub add_input_jumps( $$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Add the jump from the input chain to the rules chain
|
# Add the jump from the input chain to the rules chain
|
||||||
#
|
#
|
||||||
add_ijump_extended $inputchainref, j => source_exclusion( $exclusions, $chain2 ), $origin, @interfacematch, @source, @ipsec_in_match;
|
add_ijump $inputchainref, j => source_exclusion( $exclusions, $chain2 ), @interfacematch, @source, @ipsec_in_match;
|
||||||
move_rules( $interfacechainref , $chain2ref ) unless $use_input;
|
move_rules( $interfacechainref , $chain2ref ) unless $use_input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1957,8 +1912,8 @@ sub add_input_jumps( $$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# This function is called when there is forwarding and this net isn't IPSEC protected. It adds the jump for this net to the zone forwarding chain.
|
# This function is called when there is forwarding and this net isn't IPSEC protected. It adds the jump for this net to the zone forwarding chain.
|
||||||
#
|
#
|
||||||
sub add_forward_jump( $$$$$$$$$ ) {
|
sub add_forward_jump( $$$$$$$$ ) {
|
||||||
my ( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge, $origin ) = @_;
|
my ( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge ) = @_;
|
||||||
|
|
||||||
our %forward_jump_added;
|
our %forward_jump_added;
|
||||||
|
|
||||||
@@ -1972,31 +1927,29 @@ sub add_forward_jump( $$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# We must use the interface forwarding chain -- add the jump from the interface forward chain to the zone forward chain.
|
# We must use the interface forwarding chain -- add the jump from the interface forward chain to the zone forward chain.
|
||||||
#
|
#
|
||||||
add_ijump_extended $forwardref , j => $ref, $origin, @source, @ipsec_in_match;
|
add_ijump $forwardref , j => $ref, @source, @ipsec_in_match;
|
||||||
|
|
||||||
if ( $isport ) {
|
if ( $isport ) {
|
||||||
#
|
#
|
||||||
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
||||||
#
|
#
|
||||||
add_ijump_extended( $filter_table->{ forward_chain $bridge } ,
|
add_ijump( $filter_table->{ forward_chain $bridge } ,
|
||||||
j => $forwardref ,
|
j => $forwardref ,
|
||||||
$origin ,
|
|
||||||
imatch_source_dev( $interface , 1 ) )
|
imatch_source_dev( $interface , 1 ) )
|
||||||
unless $forward_jump_added{$interface}++;
|
unless $forward_jump_added{$interface}++;
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
# Not a bridge -- match the input interface
|
# Not a bridge -- match the input interface
|
||||||
#
|
#
|
||||||
add_ijump_extended $filter_table->{FORWARD} , j => $forwardref, $origin, imatch_source_dev( $interface ) unless $forward_jump_added{$interface}++;
|
add_ijump $filter_table->{FORWARD} , j => $forwardref, imatch_source_dev( $interface ) unless $forward_jump_added{$interface}++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( $isport ) {
|
if ( $isport ) {
|
||||||
#
|
#
|
||||||
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
||||||
#
|
#
|
||||||
add_ijump_extended( $filter_table->{ forward_chain $bridge } ,
|
add_ijump( $filter_table->{ forward_chain $bridge } ,
|
||||||
j => $ref ,
|
j => $ref ,
|
||||||
$origin ,
|
|
||||||
imatch_source_dev( $interface, 1 ) ,
|
imatch_source_dev( $interface, 1 ) ,
|
||||||
@source,
|
@source,
|
||||||
@ipsec_in_match );
|
@ipsec_in_match );
|
||||||
@@ -2004,7 +1957,7 @@ sub add_forward_jump( $$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Not a bridge -- match the input interface
|
# Not a bridge -- match the input interface
|
||||||
#
|
#
|
||||||
add_ijump_extended $filter_table->{FORWARD} , j => $ref, $origin, imatch_source_dev( $interface ) , @source, @ipsec_in_match;
|
add_ijump $filter_table->{FORWARD} , j => $ref, imatch_source_dev( $interface ) , @source, @ipsec_in_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
move_rules ( $forwardref , $frwd_ref );
|
move_rules ( $forwardref , $frwd_ref );
|
||||||
@@ -2145,7 +2098,6 @@ sub generate_matrix() {
|
|||||||
|
|
||||||
for my $hostref ( @{$typeref->{$interface}} ) {
|
for my $hostref ( @{$typeref->{$interface}} ) {
|
||||||
my $exclusions = $hostref->{exclusions};
|
my $exclusions = $hostref->{exclusions};
|
||||||
my $origin = $hostref->{origin};
|
|
||||||
|
|
||||||
for my $net ( @{$hostref->{hosts}} ) {
|
for my $net ( @{$hostref->{hosts}} ) {
|
||||||
#
|
#
|
||||||
@@ -2155,7 +2107,7 @@ sub generate_matrix() {
|
|||||||
#
|
#
|
||||||
# Policy from the firewall to this zone is not 'CONTINUE' and this isn't a bport zone
|
# Policy from the firewall to this zone is not 'CONTINUE' and this isn't a bport zone
|
||||||
#
|
#
|
||||||
add_output_jumps( $zone, $interface, $hostref, $net, $exclusions, $isport, $bridge, $origin );
|
add_output_jumps( $zone, $interface, $hostref, $net, $exclusions, $isport, $bridge );
|
||||||
}
|
}
|
||||||
|
|
||||||
clearrule;
|
clearrule;
|
||||||
@@ -2164,15 +2116,15 @@ sub generate_matrix() {
|
|||||||
#
|
#
|
||||||
# PREROUTING
|
# PREROUTING
|
||||||
#
|
#
|
||||||
add_prerouting_jumps( $zone, $interface, $hostref, $net, $exclusions, $nested, $parenthasnat, $parenthasnotrack , $origin );
|
add_prerouting_jumps( $zone, $interface, $hostref, $net, $exclusions, $nested, $parenthasnat, $parenthasnotrack );
|
||||||
#
|
#
|
||||||
# INPUT
|
# INPUT
|
||||||
#
|
#
|
||||||
add_input_jumps( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge , $origin );
|
add_input_jumps( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge );
|
||||||
#
|
#
|
||||||
# FORWARDING Jump for non-IPSEC host group
|
# FORWARDING Jump for non-IPSEC host group
|
||||||
#
|
#
|
||||||
add_forward_jump( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge, $origin ) if $frwd_ref && $hostref->{ipsec} ne 'ipsec';
|
add_forward_jump( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge ) if $frwd_ref && $hostref->{ipsec} ne 'ipsec';
|
||||||
}
|
}
|
||||||
} # Subnet Loop
|
} # Subnet Loop
|
||||||
} # Hostref Loop
|
} # Hostref Loop
|
||||||
@@ -2224,9 +2176,8 @@ sub generate_matrix() {
|
|||||||
if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) {
|
if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) {
|
||||||
my @ipsec_out_match = match_ipsec_out $zone1 , $hostref;
|
my @ipsec_out_match = match_ipsec_out $zone1 , $hostref;
|
||||||
my $dest_exclusion = dest_exclusion( $hostref->{exclusions}, $chain);
|
my $dest_exclusion = dest_exclusion( $hostref->{exclusions}, $chain);
|
||||||
my $origin = $hostref->{origin};
|
|
||||||
for my $net ( @{$hostref->{hosts}} ) {
|
for my $net ( @{$hostref->{hosts}} ) {
|
||||||
add_ijump_extended $frwd_ref, j => $dest_exclusion, $origin, imatch_dest_dev( $interface) , imatch_dest_net($net), @ipsec_out_match;
|
add_ijump $frwd_ref, j => $dest_exclusion, imatch_dest_dev( $interface) , imatch_dest_net($net), @ipsec_out_match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2268,19 +2219,17 @@ sub generate_matrix() {
|
|||||||
nat=> [ qw/PREROUTING OUTPUT POSTROUTING/ ] ,
|
nat=> [ qw/PREROUTING OUTPUT POSTROUTING/ ] ,
|
||||||
filter=> [ qw/INPUT FORWARD OUTPUT/ ] );
|
filter=> [ qw/INPUT FORWARD OUTPUT/ ] );
|
||||||
|
|
||||||
my $origin = $origin{LOGALLNEW};
|
|
||||||
|
|
||||||
for my $table ( qw/mangle nat filter/ ) {
|
for my $table ( qw/mangle nat filter/ ) {
|
||||||
for my $chain ( @{$builtins{$table}} ) {
|
for my $chain ( @{$builtins{$table}} ) {
|
||||||
log_rule_limit( $config{LOGALLNEW} ,
|
log_rule_limit
|
||||||
|
$config{LOGALLNEW} ,
|
||||||
$chain_table{$table}{$chain} ,
|
$chain_table{$table}{$chain} ,
|
||||||
$table ,
|
$table ,
|
||||||
$chain ,
|
$chain ,
|
||||||
'' ,
|
'' ,
|
||||||
'' ,
|
'' ,
|
||||||
'insert' ,
|
'insert' ,
|
||||||
state_match('NEW') ,
|
state_match('NEW');
|
||||||
$origin );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Nat.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Nat.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -69,6 +69,7 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
my $destnets = '';
|
my $destnets = '';
|
||||||
my $baserule = '';
|
my $baserule = '';
|
||||||
my $inlinematches = '';
|
my $inlinematches = '';
|
||||||
|
|
||||||
#
|
#
|
||||||
# Leading '+'
|
# Leading '+'
|
||||||
#
|
#
|
||||||
@@ -344,8 +345,7 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
$target ,
|
$target ,
|
||||||
'' ,
|
'' ,
|
||||||
'' ,
|
'' ,
|
||||||
$exceptionrule ,
|
$exceptionrule )
|
||||||
'' )
|
|
||||||
unless unreachable_warning( 0, $chainref );
|
unless unreachable_warning( 0, $chainref );
|
||||||
|
|
||||||
conditional_rule_end( $chainref ) if $detectaddress || $conditional;
|
conditional_rule_end( $chainref ) if $detectaddress || $conditional;
|
||||||
@@ -795,8 +795,7 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
|
|||||||
$target ,
|
$target ,
|
||||||
$loglevel ,
|
$loglevel ,
|
||||||
$log_action ,
|
$log_action ,
|
||||||
$serverport ? do_proto( $proto, '', '' ) : '' ,
|
$serverport ? do_proto( $proto, '', '' ) : '',
|
||||||
'' ,
|
|
||||||
)
|
)
|
||||||
unless unreachable_warning( $wildcard, $chainref );
|
unless unreachable_warning( $wildcard, $chainref );
|
||||||
|
|
||||||
@@ -868,7 +867,6 @@ sub handle_nonat_rule( $$$$$$$$$$$ ) {
|
|||||||
$loglevel,
|
$loglevel,
|
||||||
$log_action,
|
$log_action,
|
||||||
'',
|
'',
|
||||||
'',
|
|
||||||
dnat_chain( $sourcezone ) )
|
dnat_chain( $sourcezone ) )
|
||||||
unless unreachable_warning( $wildcard, $chn );
|
unless unreachable_warning( $wildcard, $chn );
|
||||||
|
|
||||||
@@ -890,7 +888,6 @@ sub handle_nonat_rule( $$$$$$$$$$$ ) {
|
|||||||
$loglevel ,
|
$loglevel ,
|
||||||
$log_action ,
|
$log_action ,
|
||||||
'',
|
'',
|
||||||
'',
|
|
||||||
)
|
)
|
||||||
unless unreachable_warning( $wildcard, $nonat_chain );
|
unless unreachable_warning( $wildcard, $nonat_chain );
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Proc.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Proc.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Providers.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Providers.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010.2011,2012 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -144,21 +144,20 @@ sub setup_route_marking() {
|
|||||||
my $interface = $providerref->{interface};
|
my $interface = $providerref->{interface};
|
||||||
my $physical = $providerref->{physical};
|
my $physical = $providerref->{physical};
|
||||||
my $mark = $providerref->{mark};
|
my $mark = $providerref->{mark};
|
||||||
my $origin = $providerref->{origin};
|
|
||||||
|
|
||||||
unless ( $marked_interfaces{$interface} ) {
|
unless ( $marked_interfaces{$interface} ) {
|
||||||
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref, $origin, i => $physical, mark => "--mark 0/$mask";
|
add_ijump $mangle_table->{PREROUTING} , j => $chainref, i => $physical, mark => "--mark 0/$mask";
|
||||||
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref1, $origin, i => "! $physical", mark => "--mark $mark/$mask";
|
add_ijump $mangle_table->{PREROUTING} , j => $chainref1, i => "! $physical", mark => "--mark $mark/$mask";
|
||||||
add_ijump_extended $mangle_table->{OUTPUT} , j => $chainref2, $origin, mark => "--mark $mark/$mask";
|
add_ijump $mangle_table->{OUTPUT} , j => $chainref2, mark => "--mark $mark/$mask";
|
||||||
$marked_interfaces{$interface} = 1;
|
$marked_interfaces{$interface} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $providerref->{shared} ) {
|
if ( $providerref->{shared} ) {
|
||||||
add_commands( $chainref, qq(if [ -n "$providerref->{mac}" ]; then) ), incr_cmd_level( $chainref ) if $providerref->{optional};
|
add_commands( $chainref, qq(if [ -n "$providerref->{mac}" ]; then) ), incr_cmd_level( $chainref ) if $providerref->{optional};
|
||||||
add_ijump_extended $chainref, j => 'MARK', $origin, targetopts => "--set-mark $providerref->{mark}${exmask}", imatch_source_dev( $interface ), mac => "--mac-source $providerref->{mac}";
|
add_ijump $chainref, j => 'MARK', targetopts => "--set-mark $providerref->{mark}${exmask}", imatch_source_dev( $interface ), mac => "--mac-source $providerref->{mac}";
|
||||||
decr_cmd_level( $chainref ), add_commands( $chainref, "fi\n" ) if $providerref->{optional};
|
decr_cmd_level( $chainref ), add_commands( $chainref, "fi\n" ) if $providerref->{optional};
|
||||||
} else {
|
} else {
|
||||||
add_ijump_extended $chainref, j => 'MARK', $origin, targetopts => "--set-mark $providerref->{mark}${exmask}", imatch_source_dev( $interface );
|
add_ijump $chainref, j => 'MARK', targetopts => "--set-mark $providerref->{mark}${exmask}", imatch_source_dev( $interface );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,7 +650,7 @@ sub process_a_provider( $ ) {
|
|||||||
|
|
||||||
$balance = $default_balance unless $balance;
|
$balance = $default_balance unless $balance;
|
||||||
|
|
||||||
fatal_error "Interface $interface is already associated with non-shared provider $provider_interfaces{$interface}" if $provider_interfaces{$interface};
|
fatal_error "Interface $interface is already associated with non-shared provider $provider_interfaces{$interface}" if $provider_interfaces{$table};
|
||||||
|
|
||||||
if ( $duplicate ne '-' ) {
|
if ( $duplicate ne '-' ) {
|
||||||
fatal_error "The DUPLICATE column must be empty when USE_DEFAULT_RT=Yes" if $config{USE_DEFAULT_RT};
|
fatal_error "The DUPLICATE column must be empty when USE_DEFAULT_RT=Yes" if $config{USE_DEFAULT_RT};
|
||||||
@@ -700,7 +699,6 @@ sub process_a_provider( $ ) {
|
|||||||
persistent_routes => [],
|
persistent_routes => [],
|
||||||
routedests => {} ,
|
routedests => {} ,
|
||||||
persistent => $persistent,
|
persistent => $persistent,
|
||||||
origin => shortlineinfo( '' ),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$provider_interfaces{$interface} = $table unless $shared;
|
$provider_interfaces{$interface} = $table unless $shared;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Proxyarp.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Proxyarp.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2011,2011 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Raw.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Raw.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2009-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -36,7 +36,7 @@ use strict;
|
|||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw( setup_conntrack );
|
our @EXPORT = qw( setup_conntrack );
|
||||||
our @EXPORT_OK = qw( handle_helper_rule );
|
our @EXPORT_OK = qw( handle_helper_rule );
|
||||||
our $VERSION = 'MODULEVERSION';
|
our $VERSION = '4.6_10';
|
||||||
|
|
||||||
our %valid_ctevent = ( new => 1,
|
our %valid_ctevent = ( new => 1,
|
||||||
related => 1,
|
related => 1,
|
||||||
@@ -98,8 +98,6 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
|||||||
$action = join( ":" , 'LOG', $action );
|
$action = join( ":" , 'LOG', $action );
|
||||||
}
|
}
|
||||||
|
|
||||||
my $usergenerated;
|
|
||||||
|
|
||||||
if ( $action eq 'NOTRACK' ) {
|
if ( $action eq 'NOTRACK' ) {
|
||||||
#
|
#
|
||||||
# A patch that deimplements the NOTRACK target has been posted on the
|
# A patch that deimplements the NOTRACK target has been posted on the
|
||||||
@@ -206,8 +204,7 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
|||||||
$action ,
|
$action ,
|
||||||
$level || '' ,
|
$level || '' ,
|
||||||
$disposition ,
|
$disposition ,
|
||||||
$exception_rule ,
|
$exception_rule );
|
||||||
$usergenerated && ! $level );
|
|
||||||
|
|
||||||
progress_message " Conntrack rule \"$currentline\" $done";
|
progress_message " Conntrack rule \"$currentline\" $done";
|
||||||
}
|
}
|
||||||
@@ -250,7 +247,6 @@ sub handle_helper_rule( $$$$$$$$$$$ ) {
|
|||||||
$action_target ,
|
$action_target ,
|
||||||
'',
|
'',
|
||||||
'CT' ,
|
'CT' ,
|
||||||
'' ,
|
|
||||||
'' );
|
'' );
|
||||||
} else {
|
} else {
|
||||||
expand_rule( ensure_raw_chain( notrack_chain( $sourceref->{name} ) ) ,
|
expand_rule( ensure_raw_chain( notrack_chain( $sourceref->{name} ) ) ,
|
||||||
@@ -265,7 +261,6 @@ sub handle_helper_rule( $$$$$$$$$$$ ) {
|
|||||||
$action_target ,
|
$action_target ,
|
||||||
'' ,
|
'' ,
|
||||||
'CT' ,
|
'CT' ,
|
||||||
'' ,
|
|
||||||
'' );
|
'' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Rules.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Rules.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -79,10 +79,6 @@ use constant { NULL_SECTION => 0x00,
|
|||||||
NEW_SECTION => 0x40,
|
NEW_SECTION => 0x40,
|
||||||
DEFAULTACTION_SECTION => 0x80 };
|
DEFAULTACTION_SECTION => 0x80 };
|
||||||
#
|
#
|
||||||
# Number of elements in the action tuple
|
|
||||||
#
|
|
||||||
use constant { ACTION_TUPLE_ELEMENTS => 5 };
|
|
||||||
#
|
|
||||||
# Section => name function
|
# Section => name function
|
||||||
#
|
#
|
||||||
our %section_functions = ( ALL_SECTION , \&rules_chain,
|
our %section_functions = ( ALL_SECTION , \&rules_chain,
|
||||||
@@ -428,7 +424,6 @@ sub print_policy($$$$) {
|
|||||||
sub use_policy_action( $$ );
|
sub use_policy_action( $$ );
|
||||||
sub normalize_action( $$$ );
|
sub normalize_action( $$$ );
|
||||||
sub normalize_action_name( $ );
|
sub normalize_action_name( $ );
|
||||||
sub normalize_single_action( $ );
|
|
||||||
|
|
||||||
sub process_default_action( $$$$ ) {
|
sub process_default_action( $$$$ ) {
|
||||||
my ( $originalpolicy, $policy, $default, $level ) = @_;
|
my ( $originalpolicy, $policy, $default, $level ) = @_;
|
||||||
@@ -446,7 +441,7 @@ sub process_default_action( $$$$ ) {
|
|||||||
if ( "\L$default" eq 'none' ) {
|
if ( "\L$default" eq 'none' ) {
|
||||||
if ( supplied $param || ( supplied $level && $level ne 'none' ) ) {
|
if ( supplied $param || ( supplied $level && $level ne 'none' ) ) {
|
||||||
if ( $default_option ) {
|
if ( $default_option ) {
|
||||||
fatal_error "Invalid setting ($originalpolicy) for $policy";
|
fatal_error "Invalid setting (originalpolicy) for $policy";
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Invalid policy ($originalpolicy)";
|
fatal_error "Invalid policy ($originalpolicy)";
|
||||||
}
|
}
|
||||||
@@ -565,7 +560,7 @@ sub process_a_policy() {
|
|||||||
|
|
||||||
require_capability 'AUDIT_TARGET', ":audit", "s" if $audit;
|
require_capability 'AUDIT_TARGET', ":audit", "s" if $audit;
|
||||||
|
|
||||||
my ( $policy, $default, $level, undef, $remainder ) = split( /:/, $originalpolicy, ACTION_TUPLE_ELEMENTS );
|
my ( $policy, $default, $level, $remainder ) = split( /:/, $originalpolicy, 4 );
|
||||||
|
|
||||||
fatal_error "Invalid or missing POLICY ($originalpolicy)" unless $policy;
|
fatal_error "Invalid or missing POLICY ($originalpolicy)" unless $policy;
|
||||||
|
|
||||||
@@ -949,7 +944,7 @@ sub complete_standard_chain ( $$$$ ) {
|
|||||||
( $policy, $loglevel, $defaultaction ) = @{$policychainref}{'policy', 'loglevel', 'default' };
|
( $policy, $loglevel, $defaultaction ) = @{$policychainref}{'policy', 'loglevel', 'default' };
|
||||||
$stdchainref->{origin} = $policychainref->{origin};
|
$stdchainref->{origin} = $policychainref->{origin};
|
||||||
} elsif ( $defaultaction !~ /:/ ) {
|
} elsif ( $defaultaction !~ /:/ ) {
|
||||||
$defaultaction = normalize_single_action( $defaultaction );
|
$defaultaction = join(":", $defaultaction, 'none', '', '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -975,8 +970,7 @@ sub setup_syn_flood_chains() {
|
|||||||
'DROP',
|
'DROP',
|
||||||
@{$globals{LOGILIMIT}} ? $globals{LOGILIMIT} : [ limit => "--limit 5/min --limit-burst 5" ] ,
|
@{$globals{LOGILIMIT}} ? $globals{LOGILIMIT} : [ limit => "--limit 5/min --limit-burst 5" ] ,
|
||||||
'' ,
|
'' ,
|
||||||
'add',
|
'add' )
|
||||||
'' )
|
|
||||||
if $level ne '';
|
if $level ne '';
|
||||||
add_ijump $synchainref, j => 'DROP';
|
add_ijump $synchainref, j => 'DROP';
|
||||||
}
|
}
|
||||||
@@ -1028,7 +1022,7 @@ sub finish_chain_section ($$$) {
|
|||||||
|
|
||||||
for ( qw( ESTABLISHED RELATED INVALID UNTRACKED ) ) {
|
for ( qw( ESTABLISHED RELATED INVALID UNTRACKED ) ) {
|
||||||
if ( $state{$_} ) {
|
if ( $state{$_} ) {
|
||||||
my ( $char, $level, $tag, $target , $origin, $level_origin ) = @{$statetable{$_}};
|
my ( $char, $level, $tag, $target ) = @{$statetable{$_}};
|
||||||
my $twochains = substr( $chainref->{name}, 0, 1 ) eq $char;
|
my $twochains = substr( $chainref->{name}, 0, 1 ) eq $char;
|
||||||
|
|
||||||
if ( $twochains || $level || $target ne 'ACCEPT' ) {
|
if ( $twochains || $level || $target ne 'ACCEPT' ) {
|
||||||
@@ -1048,18 +1042,17 @@ sub finish_chain_section ($$$) {
|
|||||||
$globals{LOGLIMIT},
|
$globals{LOGLIMIT},
|
||||||
$tag ,
|
$tag ,
|
||||||
'add' ,
|
'add' ,
|
||||||
'',
|
'');
|
||||||
$level_origin );
|
|
||||||
|
|
||||||
$target = ensure_audit_chain( $target ) if ( $targets{$target} || 0 ) & AUDIT;
|
$target = ensure_audit_chain( $target ) if ( $targets{$target} || 0 ) & AUDIT;
|
||||||
|
|
||||||
add_ijump_extended( $chain2ref, g => $target , $origin ) if $target;
|
add_ijump( $chain2ref, g => $target ) if $target;
|
||||||
|
|
||||||
$target = $chain2ref->{name} unless $twochains;
|
$target = $chain2ref->{name} unless $twochains;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $twochains ) {
|
if ( $twochains ) {
|
||||||
add_ijump_extended $chainref, g => $target , $origin if $target;
|
add_ijump $chainref, g => $target if $target;
|
||||||
delete $state{$_};
|
delete $state{$_};
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
@@ -1074,7 +1067,7 @@ sub finish_chain_section ($$$) {
|
|||||||
delete $state{ESTABLISHED};
|
delete $state{ESTABLISHED};
|
||||||
}
|
}
|
||||||
|
|
||||||
add_ijump_extended( $chainref, j => $target, $origin, state_imatch $_ );
|
add_ijump( $chainref, j => $target, state_imatch $_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete $state{$_};
|
delete $state{$_};
|
||||||
@@ -1176,15 +1169,14 @@ sub finish_section ( $ ) {
|
|||||||
#
|
#
|
||||||
# Create a normalized action name from the passed pieces.
|
# Create a normalized action name from the passed pieces.
|
||||||
#
|
#
|
||||||
# Internally, action invocations are uniquely identified by a 5-tuple that
|
# Internally, action invocations are uniquely identified by a 4-tuple that
|
||||||
# includes the action name, log level, log tag, calling chain and params.
|
# includes the action name, log level, log tag and params. The pieces of the tuple
|
||||||
# The pieces of the tuple are separated by ":".
|
# are separated by ":".
|
||||||
#
|
#
|
||||||
sub normalize_action( $$$ ) {
|
sub normalize_action( $$$ ) {
|
||||||
my $action = shift;
|
my $action = shift;
|
||||||
my $level = shift;
|
my $level = shift;
|
||||||
my $param = shift;
|
my $param = shift;
|
||||||
my $caller = ''; #We assume that the function doesn't use @CALLER
|
|
||||||
|
|
||||||
( $level, my $tag ) = split ':', $level;
|
( $level, my $tag ) = split ':', $level;
|
||||||
|
|
||||||
@@ -1193,23 +1185,13 @@ sub normalize_action( $$$ ) {
|
|||||||
$param = '' unless defined $param;
|
$param = '' unless defined $param;
|
||||||
$param = '' if $param eq '-';
|
$param = '' if $param eq '-';
|
||||||
|
|
||||||
join( ':', $action, $level, $tag, $caller, $param );
|
join( ':', $action, $level, $tag, $param );
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Add the actual caller into an existing normalised name
|
|
||||||
#
|
|
||||||
sub insert_caller($$) {
|
|
||||||
my ( $normalized, $caller ) = @_;
|
|
||||||
|
|
||||||
my ( $action, $level, $tag, undef, $param ) = split /:/, $normalized;
|
|
||||||
|
|
||||||
join( ':', $action, $level, $tag, $caller, $param );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Accepts a rule target and returns a normalized tuple
|
# Accepts a rule target and returns a normalized tuple
|
||||||
#
|
#
|
||||||
|
|
||||||
sub normalize_action_name( $ ) {
|
sub normalize_action_name( $ ) {
|
||||||
my $target = shift;
|
my $target = shift;
|
||||||
my ( $action, $loglevel) = split_action $target;
|
my ( $action, $loglevel) = split_action $target;
|
||||||
@@ -1217,18 +1199,11 @@ sub normalize_action_name( $ ) {
|
|||||||
normalize_action( $action, $loglevel, '' );
|
normalize_action( $action, $loglevel, '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Create an action tuple from a single target name
|
|
||||||
#
|
|
||||||
sub normalize_single_action( $ ) {
|
|
||||||
join(":", $_[0], 'none', '', '', '' );
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Produce a recognizable target from a normalized action
|
# Produce a recognizable target from a normalized action
|
||||||
#
|
#
|
||||||
sub external_name( $ ) {
|
sub external_name( $ ) {
|
||||||
my ( $target, $level, $tag, undef, $params ) = split /:/, shift, ACTION_TUPLE_ELEMENTS;
|
my ( $target, $level, $tag, $params ) = split /:/, shift, 4;
|
||||||
|
|
||||||
$target = join( '', $target, '(', $params , ')' ) if $params;
|
$target = join( '', $target, '(', $params , ')' ) if $params;
|
||||||
$target .= ":$level" if $level && $level ne 'none';
|
$target .= ":$level" if $level && $level ne 'none';
|
||||||
@@ -1358,7 +1333,7 @@ sub createsimpleactionchain( $ ) {
|
|||||||
sub createactionchain( $ ) {
|
sub createactionchain( $ ) {
|
||||||
my $normalized = shift;
|
my $normalized = shift;
|
||||||
|
|
||||||
my ( $target, $level, $tag, $caller, $param ) = split /:/, $normalized, ACTION_TUPLE_ELEMENTS;
|
my ( $target, $level, $tag, $param ) = split /:/, $normalized, 4;
|
||||||
|
|
||||||
assert( defined $param );
|
assert( defined $param );
|
||||||
|
|
||||||
@@ -1549,11 +1524,11 @@ sub dropBcast( $$$$ ) {
|
|||||||
|
|
||||||
if ( have_capability( 'ADDRTYPE' ) ) {
|
if ( have_capability( 'ADDRTYPE' ) ) {
|
||||||
if ( $level ne '' ) {
|
if ( $level ne '' ) {
|
||||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', addrtype => '--dst-type BROADCAST' );
|
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', addrtype => '--dst-type BROADCAST' );
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '224.0.0.0/4' );
|
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => '224.0.0.0/4' );
|
||||||
} else {
|
} else {
|
||||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => IPv6_MULTICAST );
|
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => IPv6_MULTICAST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1566,17 +1541,17 @@ sub dropBcast( $$$$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
incr_cmd_level $chainref;
|
incr_cmd_level $chainref;
|
||||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '$address' ) if $level ne '';
|
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => '$address' ) if $level ne '';
|
||||||
add_ijump $chainref, j => $target, d => '$address';
|
add_ijump $chainref, j => $target, d => '$address';
|
||||||
decr_cmd_level $chainref;
|
decr_cmd_level $chainref;
|
||||||
add_commands $chainref, 'done';
|
add_commands $chainref, 'done';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
log_irule_limit $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '224.0.0.0/4' if $level ne '';
|
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';
|
add_ijump $chainref, j => $target, d => '224.0.0.0/4';
|
||||||
} else {
|
} else {
|
||||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => IPv6_MULTICAST ) if $level ne '';
|
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => IPv6_MULTICAST ) if $level ne '';
|
||||||
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
|
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1588,8 +1563,8 @@ sub allowBcast( $$$$ ) {
|
|||||||
|
|
||||||
if ( $family == F_IPV4 && have_capability( 'ADDRTYPE' ) ) {
|
if ( $family == F_IPV4 && have_capability( 'ADDRTYPE' ) ) {
|
||||||
if ( $level ne '' ) {
|
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', addrtype => '--dst-type BROADCAST' );
|
||||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', ''. d => '224.0.0.0/4' );
|
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', d => '224.0.0.0/4' );
|
||||||
}
|
}
|
||||||
|
|
||||||
add_ijump $chainref, j => $target, addrtype => '--dst-type BROADCAST';
|
add_ijump $chainref, j => $target, addrtype => '--dst-type BROADCAST';
|
||||||
@@ -1601,17 +1576,17 @@ sub allowBcast( $$$$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
incr_cmd_level $chainref;
|
incr_cmd_level $chainref;
|
||||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', d => '$address' ) if $level ne '';
|
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', d => '$address' ) if $level ne '';
|
||||||
add_ijump $chainref, j => $target, d => '$address';
|
add_ijump $chainref, j => $target, d => '$address';
|
||||||
decr_cmd_level $chainref;
|
decr_cmd_level $chainref;
|
||||||
add_commands $chainref, 'done';
|
add_commands $chainref, 'done';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', d => '224.0.0.0/4' ) if $level ne '';
|
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';
|
add_ijump $chainref, j => $target, d => '224.0.0.0/4';
|
||||||
} else {
|
} else {
|
||||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', '', d => IPv6_MULTICAST ) if $level ne '';
|
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', d => IPv6_MULTICAST ) if $level ne '';
|
||||||
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
|
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1621,7 +1596,7 @@ sub dropNotSyn ( $$$$ ) {
|
|||||||
|
|
||||||
my $target = require_audit( 'DROP', $audit );
|
my $target = require_audit( 'DROP', $audit );
|
||||||
|
|
||||||
log_irule_limit( $level, $chainref, 'dropNotSyn' , 'DROP', [], $tag, 'add', '', p => '6 ! --syn' ) if $level ne '';
|
log_irule_limit( $level, $chainref, 'dropNotSyn' , 'DROP', [], $tag, 'add', p => '6 ! --syn' ) if $level ne '';
|
||||||
add_ijump $chainref , j => $target, p => '6 ! --syn';
|
add_ijump $chainref , j => $target, p => '6 ! --syn';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1636,7 +1611,7 @@ sub rejNotSyn ( $$$$ ) {
|
|||||||
$target = require_audit( 'REJECT' , $audit );
|
$target = require_audit( 'REJECT' , $audit );
|
||||||
}
|
}
|
||||||
|
|
||||||
log_irule_limit( $level, $chainref, 'rejNotSyn' , 'REJECT', [], $tag, 'add', '', p => '6 ! --syn' ) if $level ne '';
|
log_irule_limit( $level, $chainref, 'rejNotSyn' , 'REJECT', [], $tag, 'add', p => '6 ! --syn' ) if $level ne '';
|
||||||
add_ijump $chainref , j => $target, p => '6 ! --syn';
|
add_ijump $chainref , j => $target, p => '6 ! --syn';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1652,8 +1627,8 @@ sub allowinUPnP ( $$$$ ) {
|
|||||||
my $target = require_audit( 'ACCEPT', $audit );
|
my $target = require_audit( 'ACCEPT', $audit );
|
||||||
|
|
||||||
if ( $level ne '' ) {
|
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 => '17 --dport 1900' );
|
||||||
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', '', p => '6 --dport 49152' );
|
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 => '17 --dport 1900';
|
||||||
@@ -1690,7 +1665,7 @@ sub Limit( $$$$ ) {
|
|||||||
|
|
||||||
if ( $level ne '' ) {
|
if ( $level ne '' ) {
|
||||||
my $xchainref = new_chain 'filter' , "$chainref->{name}%";
|
my $xchainref = new_chain 'filter' , "$chainref->{name}%";
|
||||||
log_irule_limit( $level, $xchainref, $param[0], 'DROP', [], $tag, 'add' , '' );
|
log_irule_limit( $level, $xchainref, $param[0], 'DROP', [], $tag, 'add' );
|
||||||
add_ijump $xchainref, j => 'DROP';
|
add_ijump $xchainref, j => 'DROP';
|
||||||
add_ijump $chainref, j => $xchainref, recent => "--name $set --update --seconds $param[2] --hitcount $count";
|
add_ijump $chainref, j => $xchainref, recent => "--name $set --update --seconds $param[2] --hitcount $count";
|
||||||
} else {
|
} else {
|
||||||
@@ -1715,14 +1690,10 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ );
|
|||||||
# Populate an action invocation chain. As new action tuples are encountered,
|
# Populate an action invocation chain. As new action tuples are encountered,
|
||||||
# the function will be called recursively by process_rule().
|
# the function will be called recursively by process_rule().
|
||||||
#
|
#
|
||||||
# Note that the first two parameters are passed by reference and may be
|
sub process_action($$) {
|
||||||
# modified by this function.
|
my ( $chainref, $caller ) = @_;
|
||||||
#
|
my $wholeaction = $chainref->{action};
|
||||||
sub process_action(\$\$$) {
|
my ( $action, $level, $tag, $param ) = split /:/, $wholeaction, 4;
|
||||||
my ( $wholeactionref, $chainrefref, $caller ) = @_;
|
|
||||||
my $wholeaction = ${$wholeactionref};
|
|
||||||
my $chainref = ${$chainrefref};
|
|
||||||
my ( $action, $level, $tag, undef, $param ) = split /:/, $wholeaction, ACTION_TUPLE_ELEMENTS;
|
|
||||||
|
|
||||||
if ( $targets{$action} & BUILTIN ) {
|
if ( $targets{$action} & BUILTIN ) {
|
||||||
$level = '' if $level =~ /none!?/;
|
$level = '' if $level =~ /none!?/;
|
||||||
@@ -1800,48 +1771,10 @@ sub process_action(\$\$$) {
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Pop the action parameters
|
# Pop the action parameters
|
||||||
|
# Caller should delete record of this chain if the action parameters
|
||||||
|
# were modified (and this function returns true
|
||||||
#
|
#
|
||||||
if ( ( my $result = pop_action_params( $oldparms ) ) & PARMSMODIFIED ) {
|
pop_action_params( $oldparms );
|
||||||
#
|
|
||||||
# The action modified its parameters -- delete it from %usedactions
|
|
||||||
#
|
|
||||||
delete $usedactions{$wholeaction};
|
|
||||||
} elsif ( $result & USEDCALLER ) {
|
|
||||||
#
|
|
||||||
# The chain uses @CALLER but doesn't modify the action parameters.
|
|
||||||
# We need to see if this caller has already invoked this action
|
|
||||||
#
|
|
||||||
my $renormalized_action = insert_caller( $wholeaction, $caller );
|
|
||||||
my $chain1ref = $usedactions{$renormalized_action};
|
|
||||||
|
|
||||||
if ( $chain1ref ) {
|
|
||||||
#
|
|
||||||
# It has -- use the prior chain
|
|
||||||
#
|
|
||||||
${$chainrefref} = $chain1ref;
|
|
||||||
#
|
|
||||||
# We leave the new chain in place but delete it from %usedactions below
|
|
||||||
# The optimizer will drop it from the final ruleset.
|
|
||||||
#
|
|
||||||
} else {
|
|
||||||
#
|
|
||||||
# This is the first time that the current chain has invoked this action
|
|
||||||
#
|
|
||||||
$usedactions{$renormalized_action} = $chainref;
|
|
||||||
#
|
|
||||||
# Update the action member
|
|
||||||
#
|
|
||||||
$chainref->{action} = $renormalized_action;
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# Delete the usedactions entry with the original normalized key
|
|
||||||
#
|
|
||||||
delete $usedactions{$wholeaction};
|
|
||||||
#
|
|
||||||
# New normalized target
|
|
||||||
#
|
|
||||||
${$wholeactionref} = $renormalized_action;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1974,14 +1907,11 @@ sub process_actions() {
|
|||||||
# Create a policy action if it doesn't already exist
|
# Create a policy action if it doesn't already exist
|
||||||
#
|
#
|
||||||
sub use_policy_action( $$ ) {
|
sub use_policy_action( $$ ) {
|
||||||
my ( $normalized_target, $caller ) = @_;
|
my $ref = use_action( $_[0] );
|
||||||
|
|
||||||
my $ref = use_action( $normalized_target );
|
|
||||||
|
|
||||||
if ( $ref ) {
|
if ( $ref ) {
|
||||||
process_action( $normalized_target, $ref, $caller );
|
delete $usedactions{$ref->{action}} if process_action( $ref, $_[1] );
|
||||||
} else {
|
} else {
|
||||||
$ref = $usedactions{$normalized_target};
|
$ref = $usedactions{$_[0]};
|
||||||
}
|
}
|
||||||
|
|
||||||
$ref;
|
$ref;
|
||||||
@@ -2334,7 +2264,6 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
my $matches = $rule;
|
my $matches = $rule;
|
||||||
my $raw_matches = '';
|
my $raw_matches = '';
|
||||||
my $exceptionrule = '';
|
my $exceptionrule = '';
|
||||||
my $usergenerated;
|
|
||||||
|
|
||||||
if ( $inchain = defined $chainref ) {
|
if ( $inchain = defined $chainref ) {
|
||||||
( $inaction, undef, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 4 if $chainref->{action};
|
( $inaction, undef, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 4 if $chainref->{action};
|
||||||
@@ -2358,8 +2287,6 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
|
|
||||||
fatal_error "Unknown ACTION ($action)" unless $actiontype;
|
fatal_error "Unknown ACTION ($action)" unless $actiontype;
|
||||||
|
|
||||||
$usergenerated = $actiontype & IPTABLES;
|
|
||||||
|
|
||||||
if ( $actiontype == MACRO ) {
|
if ( $actiontype == MACRO ) {
|
||||||
#
|
#
|
||||||
# process_macro() will call process_rule() recursively for each rule in the macro body
|
# process_macro() will call process_rule() recursively for each rule in the macro body
|
||||||
@@ -2406,8 +2333,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$param = $param eq '' ? 'drop' : $param;
|
$param = $param eq '' ? 'drop' : $param;
|
||||||
fatal_error "Invalid AUDIT type ($param) -- must be 'accept', 'drop' or 'reject'" unless $param =~ /^(?:accept|drop|reject)$/;
|
fatal_error "Invalid AUDIT type ($param) -- must be 'accept', 'drop' or 'reject'" unless $param =~ /^(?:accept|drop|reject)$/;
|
||||||
$actiontype = STANDARD;
|
$actiontype = STANDARD;
|
||||||
} elsif ( ! $usergenerated ) {
|
} elsif ( $actiontype & NFLOG ) {
|
||||||
if ( $actiontype & NFLOG ) {
|
|
||||||
validate_level( $action );
|
validate_level( $action );
|
||||||
$loglevel = supplied $loglevel ? join( ':', $action, $loglevel ) : $action;
|
$loglevel = supplied $loglevel ? join( ':', $action, $loglevel ) : $action;
|
||||||
$action = 'LOG';
|
$action = 'LOG';
|
||||||
@@ -2415,7 +2341,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
fatal_error "'builtin' actions may only be used in INLINE rules" if $actiontype == USERBUILTIN;
|
fatal_error "'builtin' actions may only be used in INLINE rules" if $actiontype == USERBUILTIN;
|
||||||
fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq '';
|
fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq '';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#
|
#
|
||||||
# We can now dispense with the postfix character
|
# We can now dispense with the postfix character
|
||||||
#
|
#
|
||||||
@@ -2551,21 +2477,13 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$actiontype |= HELPER;
|
$actiontype |= HELPER;
|
||||||
} elsif ( $actiontype & SET ) {
|
} elsif ( $actiontype & SET ) {
|
||||||
my %xlate = ( ADD => 'add-set' , DEL => 'del-set' );
|
my %xlate = ( ADD => 'add-set' , DEL => 'del-set' );
|
||||||
my ( $setname, $flags, $timeout, $rest ) = split ':', $param, 4;
|
|
||||||
|
|
||||||
|
my ( $setname, $flags, $rest ) = split ':', $param, 3;
|
||||||
fatal_error "Invalid ADD/DEL parameter ($param)" if $rest;
|
fatal_error "Invalid ADD/DEL parameter ($param)" if $rest;
|
||||||
$setname =~ s/^\+//;
|
$setname =~ s/^\+//;
|
||||||
fatal_error "Expected ipset name ($setname)" unless $setname =~ /^(6_)?[a-zA-Z][-\w]*$/;
|
fatal_error "Expected ipset name ($setname)" unless $setname =~ /^(6_)?[a-zA-Z][-\w]*$/;
|
||||||
fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/;
|
fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/;
|
||||||
|
|
||||||
$action = join( ' ', 'SET --' . $xlate{$basictarget} , $setname , $flags );
|
$action = join( ' ', 'SET --' . $xlate{$basictarget} , $setname , $flags );
|
||||||
|
|
||||||
if ( supplied $timeout ) {
|
|
||||||
fatal_error "A timeout may only be supplied in an ADD rule" unless $basictarget eq 'ADD';
|
|
||||||
fatal_error "Invalid Timeout ($timeout)" unless $timeout && $timeout =~ /^\d+$/;
|
|
||||||
|
|
||||||
$action .= " --timeout $timeout";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
@@ -2731,7 +2649,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Handle actions
|
# Handle actions
|
||||||
#
|
#
|
||||||
my $actionchain; #Name of the action chain
|
my $delete_action;
|
||||||
|
|
||||||
if ( $actiontype & ACTION ) {
|
if ( $actiontype & ACTION ) {
|
||||||
#
|
#
|
||||||
@@ -2747,29 +2665,18 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
my $savestatematch = $statematch;
|
my $savestatematch = $statematch;
|
||||||
$statematch = '';
|
$statematch = '';
|
||||||
#
|
|
||||||
# process_action may modify both $normalized_target and $ref!!!
|
$delete_action = process_action( $ref, $chain );
|
||||||
#
|
|
||||||
process_action( $normalized_target, $ref, $chain );
|
|
||||||
#
|
|
||||||
# Capture the name of the action chain
|
|
||||||
#
|
|
||||||
$actionchain = $ref->{name};
|
|
||||||
#
|
#
|
||||||
# Processing the action may determine that the action or one of it's dependents does NAT or HELPER, so:
|
# Processing the action may determine that the action or one of it's dependents does NAT or HELPER, so:
|
||||||
#
|
#
|
||||||
# - Refresh $actiontype
|
# - Refresh $actiontype
|
||||||
# - Create the associated nat and/or table chain if appropriate.
|
# - Create the associated nat and/or table chain if appropriate.
|
||||||
#
|
#
|
||||||
ensure_chain( 'nat', $actionchain ) if ( $actiontype = $targets{$basictarget} ) & NATRULE;
|
ensure_chain( 'nat', $ref->{name} ) if ( $actiontype = $targets{$basictarget} ) & NATRULE;
|
||||||
ensure_chain( 'raw', $actionchain ) if ( $actiontype & HELPER );
|
ensure_chain( 'raw', $ref->{name} ) if ( $actiontype & HELPER );
|
||||||
|
|
||||||
$statematch = $savestatematch;
|
$statematch = $savestatematch;
|
||||||
} else {
|
|
||||||
#
|
|
||||||
# We've seen this tuple before
|
|
||||||
#
|
|
||||||
$actionchain = $usedactions{$normalized_target}->{name};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = $basictarget; # Remove params, if any, from $action.
|
$action = $basictarget; # Remove params, if any, from $action.
|
||||||
@@ -2889,7 +2796,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$ports,
|
$ports,
|
||||||
$sports,
|
$sports,
|
||||||
$sourceref,
|
$sourceref,
|
||||||
( $actiontype & ACTION ) ? $actionchain : '',
|
( $actiontype & ACTION ) ? $usedactions{$normalized_target}->{name} : '',
|
||||||
$inchain ? $chain : '' ,
|
$inchain ? $chain : '' ,
|
||||||
$user ,
|
$user ,
|
||||||
$rule ,
|
$rule ,
|
||||||
@@ -2911,7 +2818,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$proto,
|
$proto,
|
||||||
$ports,
|
$ports,
|
||||||
$origdest,
|
$origdest,
|
||||||
( $actiontype & ACTION ) ? $actionchain : '',
|
( $actiontype & ACTION ) ? $usedactions{$normalized_target}->{name} : '',
|
||||||
$action,
|
$action,
|
||||||
$sourceref,
|
$sourceref,
|
||||||
$inaction ? $chain : '',
|
$inaction ? $chain : '',
|
||||||
@@ -2968,7 +2875,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
unless ( $actiontype & NATONLY ) {
|
unless ( $actiontype & NATONLY ) {
|
||||||
|
|
||||||
if ( $actiontype & ACTION ) {
|
if ( $actiontype & ACTION ) {
|
||||||
$action = $actionchain;
|
$action = $usedactions{$normalized_target}{name};
|
||||||
$loglevel = '';
|
$loglevel = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2994,11 +2901,12 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$action ,
|
$action ,
|
||||||
$loglevel ,
|
$loglevel ,
|
||||||
$log_action ,
|
$log_action ,
|
||||||
$exceptionrule ,
|
$exceptionrule )
|
||||||
$usergenerated && ! $loglevel )
|
|
||||||
unless unreachable_warning( $wildcard || $section == DEFAULTACTION_SECTION, $chainref );
|
unless unreachable_warning( $wildcard || $section == DEFAULTACTION_SECTION, $chainref );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete $usedactions{$normalized_target} if $delete_action;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3455,9 +3363,9 @@ sub process_rules() {
|
|||||||
# Populate the state table
|
# Populate the state table
|
||||||
#
|
#
|
||||||
%statetable = ( ESTABLISHED => [ '^', '', '', 'ACCEPT' ] ,
|
%statetable = ( ESTABLISHED => [ '^', '', '', 'ACCEPT' ] ,
|
||||||
RELATED => [ '+', $config{RELATED_LOG_LEVEL}, $globals{RELATED_LOG_TAG}, $globals{RELATED_TARGET} , $origin{RELATED_DISPOSITION} , $origin{RELATED_LOG_LEVEL} ] ,
|
RELATED => [ '+', $config{RELATED_LOG_LEVEL}, $globals{RELATED_LOG_TAG}, $globals{RELATED_TARGET} ] ,
|
||||||
INVALID => [ '_', $config{INVALID_LOG_LEVEL}, $globals{INVALID_LOG_TAG}, $globals{INVALID_TARGET} , $origin{INVALID_DISPOSITION} , $origin{INVALID_LOG_LEVEL} ] ,
|
INVALID => [ '_', $config{INVALID_LOG_LEVEL}, $globals{INVALID_LOG_TAG}, $globals{INVALID_TARGET} ] ,
|
||||||
UNTRACKED => [ '&', $config{UNTRACKED_LOG_LEVEL}, $globals{UNTRACKED_LOG_TAG}, $globals{UNTRACKED_TARGET} , $origin{UNTRACKED_DISPOSITION} , $origin{UNTRACKED_LOG_LEVEL} ] ,
|
UNTRACKED => [ '&', $config{UNTRACKED_LOG_LEVEL}, $globals{UNTRACKED_LOG_TAG}, $globals{UNTRACKED_TARGET} ] ,
|
||||||
);
|
);
|
||||||
%section_states = ( BLACKLIST_SECTION , $globals{BLACKLIST_STATES},
|
%section_states = ( BLACKLIST_SECTION , $globals{BLACKLIST_STATES},
|
||||||
ESTABLISHED_SECTION, 'ESTABLISHED',
|
ESTABLISHED_SECTION, 'ESTABLISHED',
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Tc.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Tc.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Traffic Control is from tc4shorewall Version 0.5
|
# Traffic Control is from tc4shorewall Version 0.5
|
||||||
# (c) 2005 Arne Bernin <arne@ucbering.de>
|
# (c) 2005 Arne Bernin <arne@ucbering.de>
|
||||||
@@ -227,7 +227,6 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
our $designator;
|
our $designator;
|
||||||
our $ttl = 0;
|
our $ttl = 0;
|
||||||
my $fw = firewall_zone;
|
my $fw = firewall_zone;
|
||||||
my $usergenerated;
|
|
||||||
|
|
||||||
sub handle_mark_param( $$ ) {
|
sub handle_mark_param( $$ ) {
|
||||||
my ( $option, $marktype ) = @_;
|
my ( $option, $marktype ) = @_;
|
||||||
@@ -291,8 +290,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
"$target $option " . join( '/', in_hex( $markval ) , $mask ) ,
|
"$target $option " . join( '/', in_hex( $markval ) , $mask ) ,
|
||||||
'',
|
'',
|
||||||
$target ,
|
$target ,
|
||||||
$exceptionrule ,
|
$exceptionrule );
|
||||||
'' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$done = 1;
|
$done = 1;
|
||||||
@@ -454,37 +452,6 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
DIVERTHA => {
|
|
||||||
defaultchain => REALPREROUTING,
|
|
||||||
allowedchains => PREROUTING | REALPREROUTING,
|
|
||||||
minparams => 0,
|
|
||||||
maxparams => 0,
|
|
||||||
function => sub () {
|
|
||||||
fatal_error 'DIVERTHA is only allowed in the PREROUTING chain' if $designator && $designator != PREROUTING;
|
|
||||||
my $mark = in_hex( $globals{TPROXY_MARK} ) . '/' . in_hex( $globals{TPROXY_MARK} );
|
|
||||||
|
|
||||||
unless ( $divertref ) {
|
|
||||||
$divertref = new_chain( 'mangle', 'divert' );
|
|
||||||
add_ijump( $divertref , j => 'MARK', targetopts => "--set-mark $mark" );
|
|
||||||
add_ijump( $divertref , j => 'ACCEPT' );
|
|
||||||
}
|
|
||||||
|
|
||||||
$target = 'divert';
|
|
||||||
|
|
||||||
$matches = '-m socket ';
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
DROP => {
|
|
||||||
defaultchain => 0,
|
|
||||||
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
|
|
||||||
minparams => 0,
|
|
||||||
maxparams => 0,
|
|
||||||
function => sub() {
|
|
||||||
$target = 'DROP';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
DSCP => {
|
DSCP => {
|
||||||
defaultchain => 0,
|
defaultchain => 0,
|
||||||
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
|
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
|
||||||
@@ -558,7 +525,6 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
fatal_error "Unknown target ($tgt)" unless $target_type;
|
||||||
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
|
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
|
||||||
$target = $params;
|
$target = $params;
|
||||||
$usergenerated = 1;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -574,7 +540,6 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
fatal_error "Unknown target ($tgt)" unless $target_type;
|
||||||
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
|
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
|
||||||
$target = $params;
|
$target = $params;
|
||||||
$usergenerated = 1;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -885,8 +850,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
$target,
|
$target,
|
||||||
'' ,
|
'' ,
|
||||||
$target ,
|
$target ,
|
||||||
$exceptionrule ,
|
$exceptionrule ) )
|
||||||
$usergenerated ) )
|
|
||||||
&& $device ) {
|
&& $device ) {
|
||||||
#
|
#
|
||||||
# expand_rule() returns destination device if any
|
# expand_rule() returns destination device if any
|
||||||
@@ -2954,9 +2918,7 @@ sub process_traffic_shaping() {
|
|||||||
|
|
||||||
my ( $options, $redopts ) = ( '', $tcref->{redopts} );
|
my ( $options, $redopts ) = ( '', $tcref->{redopts} );
|
||||||
|
|
||||||
for my $option ( sort keys %validredoptions ) {
|
while ( my ( $option, $type ) = each %validredoptions ) {
|
||||||
my $type = $validredoptions{$option};
|
|
||||||
|
|
||||||
if ( my $value = $redopts->{$option} ) {
|
if ( my $value = $redopts->{$option} ) {
|
||||||
if ( $type == RED_NONE ) {
|
if ( $type == RED_NONE ) {
|
||||||
$options = join( ' ', $options, $option ) if $value;
|
$options = join( ' ', $options, $option ) if $value;
|
||||||
@@ -2973,9 +2935,7 @@ sub process_traffic_shaping() {
|
|||||||
|
|
||||||
my ( $options, $codelopts ) = ( '', $tcref->{codelopts} );
|
my ( $options, $codelopts ) = ( '', $tcref->{codelopts} );
|
||||||
|
|
||||||
for my $option ( sort keys %validcodeloptions ) {
|
while ( my ( $option, $type ) = each %validcodeloptions ) {
|
||||||
my $type = $validcodeloptions{$option};
|
|
||||||
|
|
||||||
if ( my $value = $codelopts->{$option} ) {
|
if ( my $value = $codelopts->{$option} ) {
|
||||||
if ( $type == CODEL_NONE ) {
|
if ( $type == CODEL_NONE ) {
|
||||||
$options = join( ' ', $options, $option );
|
$options = join( ' ', $options, $option );
|
||||||
@@ -3158,7 +3118,6 @@ sub process_secmark_rule1( $$$$$$$$$ ) {
|
|||||||
$target ,
|
$target ,
|
||||||
'' ,
|
'' ,
|
||||||
$disposition,
|
$disposition,
|
||||||
'' ,
|
|
||||||
'' );
|
'' );
|
||||||
|
|
||||||
progress_message "Secmarks rule \"$currentline\" $done";
|
progress_message "Secmarks rule \"$currentline\" $done";
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Tunnels.pm
|
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Tunnels.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -91,7 +91,6 @@ our @EXPORT = ( qw( NOTHING
|
|||||||
find_interfaces_by_option
|
find_interfaces_by_option
|
||||||
find_interfaces_by_option1
|
find_interfaces_by_option1
|
||||||
get_interface_option
|
get_interface_option
|
||||||
get_interface_origin
|
|
||||||
interface_has_option
|
interface_has_option
|
||||||
set_interface_option
|
set_interface_option
|
||||||
set_interface_provider
|
set_interface_provider
|
||||||
@@ -150,7 +149,6 @@ use constant { IN_OUT => 1,
|
|||||||
# }
|
# }
|
||||||
# hosts => [ <net1> , <net2> , ... ]
|
# hosts => [ <net1> , <net2> , ... ]
|
||||||
# exclusions => [ <net1>, <net2>, ... ]
|
# exclusions => [ <net1>, <net2>, ... ]
|
||||||
# origin => <where defined>
|
|
||||||
# }
|
# }
|
||||||
# <interface2> => ...
|
# <interface2> => ...
|
||||||
# }
|
# }
|
||||||
@@ -198,7 +196,6 @@ our %reservedName = ( all => 1,
|
|||||||
# provider => <Provider Name, if interface is associated with a provider>
|
# provider => <Provider Name, if interface is associated with a provider>
|
||||||
# wildcard => undef|1 # Wildcard Name
|
# wildcard => undef|1 # Wildcard Name
|
||||||
# zones => { zone1 => 1, ... }
|
# zones => { zone1 => 1, ... }
|
||||||
# origin => <where defined>
|
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
@@ -893,9 +890,7 @@ sub add_group_to_zone($$$$$$)
|
|||||||
push @{$interfaceref}, { options => $options,
|
push @{$interfaceref}, { options => $options,
|
||||||
hosts => \@newnetworks,
|
hosts => \@newnetworks,
|
||||||
ipsec => $type & IPSEC ? 'ipsec' : 'none' ,
|
ipsec => $type & IPSEC ? 'ipsec' : 'none' ,
|
||||||
exclusions => \@exclusions ,
|
exclusions => \@exclusions };
|
||||||
origin => shortlineinfo( '' ) ,
|
|
||||||
};
|
|
||||||
|
|
||||||
if ( $type != IPSEC ) {
|
if ( $type != IPSEC ) {
|
||||||
my $optref = $interfaces{$interface}{options};
|
my $optref = $interfaces{$interface}{options};
|
||||||
@@ -1397,7 +1392,7 @@ sub process_interface( $$ ) {
|
|||||||
physical => $physical ,
|
physical => $physical ,
|
||||||
base => var_base( $physical ),
|
base => var_base( $physical ),
|
||||||
zones => {},
|
zones => {},
|
||||||
origin => shortlineinfo( '' ),
|
origin => shortlineinfo(''),
|
||||||
wildcard => $wildcard,
|
wildcard => $wildcard,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1863,22 +1858,6 @@ sub interface_has_option( $$\$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the origin for an interface
|
|
||||||
#
|
|
||||||
sub get_interface_origin( $ ) {
|
|
||||||
my ( $interface ) = @_;
|
|
||||||
|
|
||||||
my $ref = $interfaces{$interface};
|
|
||||||
|
|
||||||
return $ref->{origin} if $ref;
|
|
||||||
|
|
||||||
assert( $ref = known_interface( $interface ) );
|
|
||||||
|
|
||||||
$ref->{origin};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
##
|
|
||||||
# Set an option for an interface
|
# Set an option for an interface
|
||||||
#
|
#
|
||||||
sub set_interface_option( $$$ ) {
|
sub set_interface_option( $$$ ) {
|
||||||
@@ -2204,11 +2183,10 @@ sub find_hosts_by_option( $ ) {
|
|||||||
my $arrayref = $interfaceref->{$interface};
|
my $arrayref = $interfaceref->{$interface};
|
||||||
for my $host ( @{$arrayref} ) {
|
for my $host ( @{$arrayref} ) {
|
||||||
my $ipsec = $host->{ipsec};
|
my $ipsec = $host->{ipsec};
|
||||||
my $origin = $host->{origin};
|
|
||||||
unless ( $done{$interface} ) {
|
unless ( $done{$interface} ) {
|
||||||
if ( my $value = $host->{options}{$option} ) {
|
if ( my $value = $host->{options}{$option} ) {
|
||||||
for my $net ( @{$host->{hosts}} ) {
|
for my $net ( @{$host->{hosts}} ) {
|
||||||
push @hosts, [ $interface, $ipsec , $net , $host->{exclusions}, $value, $origin ];
|
push @hosts, [ $interface, $ipsec , $net , $host->{exclusions}, $value ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2235,7 +2213,7 @@ sub find_zone_hosts_by_option( $$ ) {
|
|||||||
for my $host ( @{$arrayref} ) {
|
for my $host ( @{$arrayref} ) {
|
||||||
if ( my $value = $host->{options}{$option} ) {
|
if ( my $value = $host->{options}{$option} ) {
|
||||||
for my $net ( @{$host->{hosts}} ) {
|
for my $net ( @{$host->{hosts}} ) {
|
||||||
push @hosts, [ $interface, $host->{ipsec} , $net , $host->{exclusions}, $value, $host->{origin} ];
|
push @hosts, [ $interface, $host->{ipsec} , $net , $host->{exclusions}, $value ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,5 +6,6 @@
|
|||||||
# Please see http://shorewall.net/Accounting.html for examples and
|
# Please see http://shorewall.net/Accounting.html for examples and
|
||||||
# additional information about how to use this file.
|
# additional information about how to use this file.
|
||||||
#
|
#
|
||||||
#####################################################################################################
|
#################################################################################################################
|
||||||
#ACTION CHAIN SOURCE DEST PROTO DPORT SPORT USER MARK IPSEC
|
#ACTION CHAIN SOURCE DESTINATION PROTO DEST SOURCE USER/ MARK IPSEC
|
||||||
|
# PORT(S) PORT(S) GROUP
|
||||||
|
@@ -5,8 +5,6 @@
|
|||||||
#
|
#
|
||||||
# Please see http://shorewall.net/Actions.html for additional information.
|
# Please see http://shorewall.net/Actions.html for additional information.
|
||||||
#
|
#
|
||||||
# Place '# ' below the 'C' in COMMENT followed by a comment describing
|
########################################################################################
|
||||||
# the action.
|
#ACTION OPTIONS COMMENT (place '# ' below the 'C' in comment followed by
|
||||||
#
|
# v a comment describing the action)
|
||||||
###############################################################################
|
|
||||||
#ACTION OPTIONS COMMENT
|
|
||||||
|
@@ -3,5 +3,6 @@
|
|||||||
#
|
#
|
||||||
# For information about entries in this file, type "man shorewall-arprules"
|
# For information about entries in this file, type "man shorewall-arprules"
|
||||||
#
|
#
|
||||||
###############################################################################
|
##############################################################################################################
|
||||||
#ACTION SOURCE DEST OPCODE
|
#ACTION SOURCE DEST ARP
|
||||||
|
# OPCODE
|
||||||
|
@@ -6,5 +6,6 @@
|
|||||||
# Please see http://shorewall.net/blacklisting_support.htm for additional
|
# Please see http://shorewall.net/blacklisting_support.htm for additional
|
||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
##############################################################################################################################################################
|
################################################################################################################################################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
|
||||||
|
# PORT PORT(S) DEST LIMIT GROUP
|
||||||
|
@@ -3,10 +3,11 @@
|
|||||||
#
|
#
|
||||||
# For information about entries in this file, type "man shorewall-conntrack"
|
# For information about entries in this file, type "man shorewall-conntrack"
|
||||||
#
|
#
|
||||||
|
##############################################################################################################
|
||||||
?FORMAT 3
|
?FORMAT 3
|
||||||
######################################################################################################
|
##############################################################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER SWITCH
|
#ACTION SOURCE DESTINATION PROTO DEST SOURCE USER/ SWITCH
|
||||||
|
# PORT(S) PORT(S) GROUP
|
||||||
?if $AUTOHELPERS && __CT_TARGET
|
?if $AUTOHELPERS && __CT_TARGET
|
||||||
|
|
||||||
?if __AMANDA_HELPER
|
?if __AMANDA_HELPER
|
||||||
|
@@ -7,4 +7,4 @@
|
|||||||
# http://www.shorewall.net/manpages/shorewall-ecn.html
|
# http://www.shorewall.net/manpages/shorewall-ecn.html
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#INTERFACE HOSTS
|
#INTERFACE HOST(S)
|
||||||
|
@@ -7,4 +7,4 @@
|
|||||||
# http://www.shorewall.net/manpages/shorewall-hosts.html
|
# http://www.shorewall.net/manpages/shorewall-hosts.html
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ZONE HOSTS OPTIONS
|
#ZONE HOST(S) OPTIONS
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
# The manpage is also online at
|
# The manpage is also online at
|
||||||
# http://www.shorewall.net/manpages/shorewall-interfaces.html
|
# http://www.shorewall.net/manpages/shorewall-interfaces.html
|
||||||
#
|
#
|
||||||
|
###############################################################################
|
||||||
?FORMAT 2
|
?FORMAT 2
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ZONE INTERFACE OPTIONS
|
#ZONE INTERFACE OPTIONS
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
local status
|
local status
|
||||||
status=0
|
status=0
|
||||||
|
|
||||||
|
@@ -6,4 +6,4 @@
|
|||||||
# For additional information, see http://shorewall.net/MAC_Validation.html
|
# For additional information, see http://shorewall.net/MAC_Validation.html
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#DISPOSITION INTERFACE MAC ADDRESSES
|
#DISPOSITION INTERFACE MAC IP ADDRESSES (Optional)
|
||||||
|
@@ -11,4 +11,5 @@
|
|||||||
# the Netfilter/Shorewall packet marking mechanism.
|
# the Netfilter/Shorewall packet marking mechanism.
|
||||||
#
|
#
|
||||||
####################################################################################################################################################
|
####################################################################################################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP
|
#ACTION SOURCE DEST PROTO DEST SOURCE USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP
|
||||||
|
# PORT(S) PORT(S)
|
||||||
|
@@ -7,4 +7,5 @@
|
|||||||
# http://www.shorewall.net/manpages/shorewall-masq.html
|
# http://www.shorewall.net/manpages/shorewall-masq.html
|
||||||
#
|
#
|
||||||
###################################################################################################################################
|
###################################################################################################################################
|
||||||
#INTERFACE SOURCE ADDRESS PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
#INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL PROBABILITY
|
||||||
|
# GROUP DEST
|
||||||
|
@@ -6,4 +6,5 @@
|
|||||||
# For additional information, see http://shorewall.net/NAT.htm
|
# For additional information, see http://shorewall.net/NAT.htm
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#EXTERNAL INTERFACE INTERNAL ALLINTS LOCAL
|
#EXTERNAL INTERFACE INTERNAL ALL LOCAL
|
||||||
|
# INTERFACES
|
||||||
|
@@ -6,5 +6,6 @@
|
|||||||
# See http://shorewall.net/netmap.html for an example and usage
|
# See http://shorewall.net/netmap.html for an example and usage
|
||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
#############################################################################################
|
##############################################################################################
|
||||||
#TYPE NET1 INTERFACE NET2 NET3 PROTO DPORT SPORT
|
#TYPE NET1 INTERFACE NET2 NET3 PROTO DEST SOURCE
|
||||||
|
# PORT(S) PORT(S)
|
||||||
|
@@ -22,3 +22,5 @@
|
|||||||
# net eth0 130.252.100.255 routefilter,norfc1918
|
# net eth0 130.252.100.255 routefilter,norfc1918
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
#LAST LINE -- DO NOT REMOVE
|
||||||
|
@@ -7,4 +7,5 @@
|
|||||||
# http://www.shorewall.net/manpages/shorewall-policy.html
|
# http://www.shorewall.net/manpages/shorewall-policy.html
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#SOURCE DEST POLICY LOGLEVEL LIMIT CONNLIMIT
|
#SOURCE DEST POLICY LOG LIMIT: CONNLIMIT:
|
||||||
|
# LEVEL BURST MASK
|
||||||
|
@@ -6,9 +6,9 @@
|
|||||||
# The manpage is also online at
|
# The manpage is also online at
|
||||||
# http://www.shorewall.net/manpages/shorewall-rules.html
|
# http://www.shorewall.net/manpages/shorewall-rules.html
|
||||||
#
|
#
|
||||||
##############################################################################################################################################################
|
######################################################################################################################################################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||||
|
# PORT(S) PORT(S) DEST LIMIT GROUP
|
||||||
?SECTION ALL
|
?SECTION ALL
|
||||||
?SECTION ESTABLISHED
|
?SECTION ESTABLISHED
|
||||||
?SECTION RELATED
|
?SECTION RELATED
|
||||||
|
@@ -8,5 +8,4 @@
|
|||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
cat -
|
cat -
|
||||||
|
@@ -3,5 +3,6 @@
|
|||||||
#
|
#
|
||||||
# For information about entries in this file, type "man shorewall-secmarks"
|
# For information about entries in this file, type "man shorewall-secmarks"
|
||||||
#
|
#
|
||||||
############################################################################################
|
############################################################################################################
|
||||||
#SECMARK CHAIN SOURCE DEST PROTO DPORT SPORT USER MARK
|
#SECMARK CHAIN: SOURCE DEST PROTO DEST SOURCE USER/ MARK
|
||||||
|
# STATE PORT(S) PORT(S) GROUP
|
||||||
|
@@ -8,5 +8,4 @@
|
|||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@@ -10,4 +10,5 @@
|
|||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT
|
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||||
|
# PORT(S) PORT(S)
|
||||||
|
@@ -6,4 +6,5 @@
|
|||||||
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#INTERFACE MARK RATE CEIL PRIO OPTIONS
|
#INTERFACE:CLASS MARK RATE: CEIL PRIORITY OPTIONS
|
||||||
|
# DMAX:UMAX
|
||||||
|
@@ -6,4 +6,5 @@
|
|||||||
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#INTERFACE IN_BANDWITH OUT_BANDWIDTH OPTIONS REDIRECT
|
#NUMBER: IN-BANDWITH OUT-BANDWIDTH OPTIONS REDIRECTED
|
||||||
|
#INTERFACE INTERFACES
|
||||||
|
@@ -5,5 +5,6 @@
|
|||||||
#
|
#
|
||||||
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
||||||
#
|
#
|
||||||
######################################################################################
|
########################################################################################################
|
||||||
#CLASS SOURCE DEST PROTO DPORT SPORT TOS LENGTH
|
#INTERFACE: SOURCE DEST PROTO DEST SOURCE TOS LENGTH PRIORITY
|
||||||
|
#CLASS PORT(S) PORT(S)
|
||||||
|
@@ -7,4 +7,4 @@
|
|||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#INTERFACE TYPE IN_BANDWIDTH OUT_BANDWIDTH
|
#INTERFACE TYPE IN-BANDWIDTH OUT-BANDWIDTH
|
||||||
|
@@ -7,4 +7,4 @@
|
|||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#BAND PROTO PORT ADDRESS INTERFACE HELPER
|
#BAND PROTO PORT(S) ADDRESS IN-INTERFACE HELPER
|
||||||
|
@@ -7,4 +7,5 @@
|
|||||||
# http://www.shorewall.net/manpages/shorewall-tunnels.html
|
# http://www.shorewall.net/manpages/shorewall-tunnels.html
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#TYPE ZONE GATEWAY GATEWAY_ZONE
|
#TYPE ZONE GATEWAY(S) GATEWAY
|
||||||
|
# ZONE(S)
|
||||||
|
@@ -7,6 +7,6 @@
|
|||||||
# http://www.shorewall.net/manpages/shorewall-zones.html
|
# http://www.shorewall.net/manpages/shorewall-zones.html
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ZONE TYPE OPTIONS IN_OPTIONS OUT_OPTIONS
|
#ZONE TYPE OPTIONS IN OUT
|
||||||
|
# OPTIONS OPTIONS
|
||||||
fw firewall
|
fw firewall
|
||||||
|
@@ -322,9 +322,6 @@ if [ $PRODUCT = shorewall ]; then
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -af Perl/Shorewall/Chains.pm Perl/Shorewall/Chains.pm.bak
|
|
||||||
cp -af Perl/Shorewall/Config.pm Perl/Shorewall/Config.pm.bak
|
|
||||||
|
|
||||||
eval sed -i \'s/Digest::SHA/Digest::$DIGEST/\' Perl/Shorewall/Chains.pm
|
eval sed -i \'s/Digest::SHA/Digest::$DIGEST/\' Perl/Shorewall/Chains.pm
|
||||||
eval sed -i \'s/Digest::SHA/Digest::$DIGEST/\' Perl/Shorewall/Config.pm
|
eval sed -i \'s/Digest::SHA/Digest::$DIGEST/\' Perl/Shorewall/Config.pm
|
||||||
fi
|
fi
|
||||||
@@ -335,9 +332,6 @@ if [ $PRODUCT = shorewall ]; then
|
|||||||
DIGEST=SHA
|
DIGEST=SHA
|
||||||
if ! perl -e 'use Digest::SHA;' 2> /dev/null ; then
|
if ! perl -e 'use Digest::SHA;' 2> /dev/null ; then
|
||||||
if perl -e 'use Digest::SHA1;' 2> /dev/null ; then
|
if perl -e 'use Digest::SHA1;' 2> /dev/null ; then
|
||||||
cp -af Perl/Shorewall/Chains.pm Perl/Shorewall/Chains.pm.bak
|
|
||||||
cp -af Perl/Shorewall/Config.pm Perl/Shorewall/Config.pm.bak
|
|
||||||
|
|
||||||
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Chains.pm
|
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Chains.pm
|
||||||
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm
|
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm
|
||||||
DIGEST=SHA1
|
DIGEST=SHA1
|
||||||
@@ -1121,10 +1115,6 @@ if [ -d Perl ]; then
|
|||||||
install_file $f ${DESTDIR}${PERLLIBDIR}/$f 0644
|
install_file $f ${DESTDIR}${PERLLIBDIR}/$f 0644
|
||||||
echo "Module ${f%.*} installed as ${DESTDIR}${PERLLIBDIR}/$f"
|
echo "Module ${f%.*} installed as ${DESTDIR}${PERLLIBDIR}/$f"
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -f Perl/Shorewall/Chains.pm.bak ] && mv Perl/Shorewall/Chains.pm.bak Perl/Shorewall/Chains.pm
|
|
||||||
[ -f Perl/Shorewall/Config.pm.bak ] && mv Perl/Shorewall/Config.pm.bak Perl/Shorewall/Config.pm
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Install the program skeleton files
|
# Install the program skeleton files
|
||||||
#
|
#
|
||||||
|
@@ -403,15 +403,13 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DEST</emphasis> - {<emphasis
|
<term><emphasis role="bold">DESTINATION</emphasis> (dest) - {<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis
|
role="bold">-</emphasis>|<emphasis
|
||||||
role="bold">any</emphasis>|<emphasis
|
role="bold">any</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis>interface</emphasis>|<emphasis>interface</emphasis><emphasis
|
role="bold">all</emphasis>|<emphasis>interface</emphasis>|<emphasis>interface</emphasis><emphasis
|
||||||
role="bold">:</emphasis><emphasis>address</emphasis>|<emphasis>address</emphasis>}</term>
|
role="bold">:</emphasis><emphasis>address</emphasis>|<emphasis>address</emphasis>}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This column was formerly named DESTINATION.</para>
|
|
||||||
|
|
||||||
<para>Packet Destination.</para>
|
<para>Packet Destination.</para>
|
||||||
|
|
||||||
<para>Format same as <emphasis role="bold">SOURCE</emphasis>
|
<para>Format same as <emphasis role="bold">SOURCE</emphasis>
|
||||||
@@ -420,7 +418,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">PROTO</emphasis> - {<emphasis
|
<term><emphasis role="bold">PROTOCOL (proto)</emphasis> - {<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis
|
role="bold">-</emphasis>|<emphasis
|
||||||
role="bold">{any</emphasis>|<emphasis
|
role="bold">{any</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis
|
||||||
@@ -430,8 +428,6 @@
|
|||||||
role="bold">all</emphasis>}]}[,...]}</term>
|
role="bold">all</emphasis>}]}[,...]}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This column was formerly named PROTOCOL</para>
|
|
||||||
|
|
||||||
<para>A <emphasis>protocol-name</emphasis> (from protocols(5)), a
|
<para>A <emphasis>protocol-name</emphasis> (from protocols(5)), a
|
||||||
<emphasis>protocol-number</emphasis>, <emphasis
|
<emphasis>protocol-number</emphasis>, <emphasis
|
||||||
role="bold">ipp2p</emphasis>, <emphasis
|
role="bold">ipp2p</emphasis>, <emphasis
|
||||||
@@ -444,8 +440,8 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DPORT</emphasis> - {<emphasis
|
<term><emphasis role="bold">DEST PORT(S)</emphasis> (dport) -
|
||||||
role="bold">-</emphasis>|<emphasis
|
{<emphasis role="bold">-</emphasis>|<emphasis
|
||||||
role="bold">any</emphasis>|<emphasis
|
role="bold">any</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis>ipp2p-option</emphasis>|<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...}</term>
|
role="bold">all</emphasis>|<emphasis>ipp2p-option</emphasis>|<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...}</term>
|
||||||
|
|
||||||
@@ -464,14 +460,12 @@
|
|||||||
("iptables -m ipp2p --help") without the leading "--". If no option
|
("iptables -m ipp2p --help") without the leading "--". If no option
|
||||||
is given in this column, <emphasis role="bold">ipp2p</emphasis> is
|
is given in this column, <emphasis role="bold">ipp2p</emphasis> is
|
||||||
assumed.</para>
|
assumed.</para>
|
||||||
|
|
||||||
<para>This column was formerly named DEST PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SPORT</emphasis> - {<emphasis
|
<term><emphasis role="bold">SOURCE PORT(S)</emphasis> (sport)-
|
||||||
role="bold">-</emphasis>|<emphasis
|
{<emphasis role="bold">-</emphasis>|<emphasis
|
||||||
role="bold">any</emphasis>|<emphasis
|
role="bold">any</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...}</term>
|
role="bold">all</emphasis>|<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...}</term>
|
||||||
|
|
||||||
@@ -488,22 +482,20 @@
|
|||||||
column, provided that the DEST PORT(S) column is non-empty. This
|
column, provided that the DEST PORT(S) column is non-empty. This
|
||||||
causes the rule to match when either the source port or the
|
causes the rule to match when either the source port or the
|
||||||
destination port in a packet matches one of the ports specified in
|
destination port in a packet matches one of the ports specified in
|
||||||
DPORT. Use of '=' requires multi-port match in your iptables and
|
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
|
||||||
kernel.</para>
|
and kernel.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled SOURCE PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">USER</emphasis> - [<emphasis
|
<term><emphasis role="bold">USER/GROUP</emphasis> (user) - [<emphasis
|
||||||
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
|
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
|
||||||
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis
|
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis
|
||||||
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
|
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This column was formerly named USER/GROUP and may only be
|
<para>This column may only be non-empty if the <emphasis
|
||||||
non-empty if the <emphasis role="bold">CHAIN</emphasis> is <emphasis
|
role="bold">CHAIN</emphasis> is <emphasis
|
||||||
role="bold">OUTPUT</emphasis>.</para>
|
role="bold">OUTPUT</emphasis>.</para>
|
||||||
|
|
||||||
<para>When this column is non-empty, the rule applies only if the
|
<para>When this column is non-empty, the rule applies only if the
|
||||||
|
@@ -273,7 +273,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>OPCODE - [[!]<replaceable>opcode</replaceable>]</term>
|
<term>ARP OPCODE - [[!]<replaceable>opcode</replaceable>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Optional. Describes the type of frame. Possible
|
<para>Optional. Describes the type of frame. Possible
|
||||||
|
@@ -424,7 +424,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>DPORT - port-number/service-name-list</term>
|
<term>DEST PORT(S) (dport) - port-number/service-name-list</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>A comma-separated list of port numbers and/or service names
|
<para>A comma-separated list of port numbers and/or service names
|
||||||
@@ -432,13 +432,11 @@
|
|||||||
ranges of the form
|
ranges of the form
|
||||||
<replaceable>low-port</replaceable>:<replaceable>high-port</replaceable>
|
<replaceable>low-port</replaceable>:<replaceable>high-port</replaceable>
|
||||||
if your kernel and iptables include port range support.</para>
|
if your kernel and iptables include port range support.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled DEST PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>SPORT - port-number/service-name-list</term>
|
<term>SOURCE PORT(S) (sport) - port-number/service-name-list</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>A comma-separated list of port numbers and/or service names
|
<para>A comma-separated list of port numbers and/or service names
|
||||||
@@ -448,24 +446,22 @@
|
|||||||
if your kernel and iptables include port range support.</para>
|
if your kernel and iptables include port range support.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
|
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
|
||||||
column, provided that the DPORT column is non-empty. This causes the
|
column, provided that the DEST PORT(S) column is non-empty. This
|
||||||
rule to match when either the source port or the destination port in
|
causes the rule to match when either the source port or the
|
||||||
a packet matches one of the ports specified in DPORT. Use of '='
|
destination port in a packet matches one of the ports specified in
|
||||||
requires multi-port match in your iptables and kernel.</para>
|
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
|
||||||
|
and kernel.</para>
|
||||||
<para>This column was formerly labelled SOURCE PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>USER ‒
|
<term>USER/GROUP (user) ‒
|
||||||
[<replaceable>user</replaceable>][:<replaceable>group</replaceable>]</term>
|
[<replaceable>user</replaceable>][:<replaceable>group</replaceable>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This column was formerly named USER/GROUP and may only be
|
<para>May only be specified if the SOURCE
|
||||||
specified if the SOURCE <replaceable>zone</replaceable> is $FW.
|
<replaceable>zone</replaceable> is $FW. Specifies the effective user
|
||||||
Specifies the effective user id and or group id of the process
|
id and or group id of the process sending the traffic.</para>
|
||||||
sending the traffic.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -524,7 +520,8 @@
|
|||||||
|
|
||||||
<para>Example 1:</para>
|
<para>Example 1:</para>
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
<programlisting>#ACTION SOURCE DEST PROTO DEST SOURCE USER/GROUP
|
||||||
|
# PORT(S) PORT(S)
|
||||||
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
|
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
|
||||||
|
|
||||||
<para>Example 2 (Shorewall 4.5.10 or later):</para>
|
<para>Example 2 (Shorewall 4.5.10 or later):</para>
|
||||||
@@ -532,12 +529,14 @@ CT:helper:ftp(expevents=new) fw - tcp
|
|||||||
<para>Drop traffic to/from all zones to IP address 1.2.3.4</para>
|
<para>Drop traffic to/from all zones to IP address 1.2.3.4</para>
|
||||||
|
|
||||||
<programlisting>FORMAT 2
|
<programlisting>FORMAT 2
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
#ACTION SOURCE DEST PROTO DEST SOURCE USER/GROUP
|
||||||
|
# PORT(S) PORT(S)
|
||||||
DROP all-:1.2.3.4 -
|
DROP all-:1.2.3.4 -
|
||||||
DROP all 1.2.3.4</programlisting>
|
DROP all 1.2.3.4</programlisting>
|
||||||
|
|
||||||
<para>or<programlisting>FORMAT 3
|
<para>or<programlisting>FORMAT 3
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
#ACTION SOURCE DEST PROTO DEST SOURCE USER/GROUP
|
||||||
|
# PORT(S) PORT(S)
|
||||||
DROP:P 1.2.3.4 -
|
DROP:P 1.2.3.4 -
|
||||||
DROP:PO - 1.2.3.4
|
DROP:PO - 1.2.3.4
|
||||||
</programlisting></para>
|
</programlisting></para>
|
||||||
|
@@ -76,7 +76,8 @@ z2 net REJECT</programlisting>
|
|||||||
|
|
||||||
<para>/etc/shorewall/rules:</para>
|
<para>/etc/shorewall/rules:</para>
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT
|
<programlisting>#ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
ACCEPT all!z2 net tcp 22</programlisting>
|
ACCEPT all!z2 net tcp 22</programlisting>
|
||||||
|
|
||||||
<para>In this case, SSH connections from <emphasis
|
<para>In this case, SSH connections from <emphasis
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
<option>dst</option>. Example: myset[src,dst].</member>
|
<option>dst</option>. Example: myset[src,dst].</member>
|
||||||
</simplelist>
|
</simplelist>
|
||||||
|
|
||||||
<para>In a SOURCE or SPORT column, the following pairs are
|
<para>In a SOURCE or SOURCE PORT(S) column, the following pairs are
|
||||||
equivalent:</para>
|
equivalent:</para>
|
||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<para>In a DEST or DPORT column, the following pairs are
|
<para>In a DEST or DEST PORT(S) column, the following pairs are
|
||||||
equivalent:</para>
|
equivalent:</para>
|
||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
|
@@ -271,26 +271,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">DIVERTHA</emphasis></term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Added in Shorewall 5.0.4. To setup the HAProxy
|
|
||||||
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>
|
|
||||||
|
|
||||||
<programlisting>#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY
|
|
||||||
TProxy 1 - - lo - tproxy</programlisting>
|
|
||||||
|
|
||||||
<para>and use this DIVERTHA entry:</para>
|
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP
|
|
||||||
DIVERTHA - - tcp</programlisting>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DROP</emphasis></term>
|
<term><emphasis role="bold">DROP</emphasis></term>
|
||||||
|
|
||||||
@@ -590,7 +570,8 @@ INLINE eth0 - ; -p tcp -j MARK --set
|
|||||||
that problem. SAME may be used in the PREROUTING and OUTPUT
|
that problem. SAME may be used in the PREROUTING and OUTPUT
|
||||||
chains. When used in PREROUTING, it causes matching
|
chains. When used in PREROUTING, it causes matching
|
||||||
connections from an individual local system to all use the
|
connections from an individual local system to all use the
|
||||||
same provider. For example: <programlisting>#ACTION SOURCE DEST PROTO DPORT
|
same provider. For example: <programlisting>#ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
SAME:P 192.168.1.0/24 0.0.0.0/0 tcp 80,443</programlisting>
|
SAME:P 192.168.1.0/24 0.0.0.0/0 tcp 80,443</programlisting>
|
||||||
If a host in 192.168.1.0/24 attempts a connection on TCP port
|
If a host in 192.168.1.0/24 attempts a connection on TCP port
|
||||||
80 or 443 and it has sent a packet on either of those ports in
|
80 or 443 and it has sent a packet on either of those ports in
|
||||||
@@ -600,7 +581,8 @@ SAME:P 192.168.1.0/24 0.0.0.0/0 tcp 80,443</programlisting>
|
|||||||
|
|
||||||
<para>When used in the OUTPUT chain, it causes all matching
|
<para>When used in the OUTPUT chain, it causes all matching
|
||||||
connections to an individual remote system to all use the same
|
connections to an individual remote system to all use the same
|
||||||
provider. For example:<programlisting>#ACTION SOURCE DEST PROTO DPORT
|
provider. For example:<programlisting>#ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>The
|
SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>The
|
||||||
optional <replaceable>timeout</replaceable> parameter was
|
optional <replaceable>timeout</replaceable> parameter was
|
||||||
added in Shorewall 4.6.7 and specifies a number of seconds .
|
added in Shorewall 4.6.7 and specifies a number of seconds .
|
||||||
@@ -853,7 +835,7 @@ Normal-Service => 0x00</programlisting>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DPORT</emphasis>- {<emphasis
|
<term><emphasis role="bold">PORT(S)</emphasis> (dport) - {<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
||||||
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
||||||
|
|
||||||
@@ -881,13 +863,12 @@ Normal-Service => 0x00</programlisting>
|
|||||||
<replaceable>ipset</replaceable> name can be specified in this
|
<replaceable>ipset</replaceable> name can be specified in this
|
||||||
column. This is intended to be used with
|
column. This is intended to be used with
|
||||||
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
||||||
|
|
||||||
<para>This column was formerly named DEST PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SPORT</emphasis> - {<emphasis
|
<term><emphasis role="bold">SOURCE PORT(S)</emphasis> (sport) -
|
||||||
|
{<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
||||||
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
||||||
|
|
||||||
@@ -901,17 +882,16 @@ Normal-Service => 0x00</programlisting>
|
|||||||
the following fields is supplied.</para>
|
the following fields is supplied.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
|
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
|
||||||
column, provided that the DPORT column is non-empty. This causes the
|
column, provided that the DEST PORT(S) column is non-empty. This
|
||||||
rule to match when either the source port or the destination port in
|
causes the rule to match when either the source port or the
|
||||||
a packet matches one of the ports specified in DEST PORTS(S). Use of
|
destination port in a packet matches one of the ports specified in
|
||||||
'=' requires multi-port match in your iptables and kernel.</para>
|
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
|
||||||
|
and kernel.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.6.0, an
|
<para>Beginning with Shorewall 4.6.0, an
|
||||||
<replaceable>ipset</replaceable> name can be specified in this
|
<replaceable>ipset</replaceable> name can be specified in this
|
||||||
column. This is intended to be used with
|
column. This is intended to be used with
|
||||||
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled SOURCE PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1117,7 +1097,8 @@ Normal-Service => 0x00</programlisting>
|
|||||||
by the named helper module.</para>
|
by the named helper module.</para>
|
||||||
|
|
||||||
<para>Example: Mark all FTP data connections with mark
|
<para>Example: Mark all FTP data connections with mark
|
||||||
4:<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER
|
4:<programlisting>#ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST LENGTH TOS CONNBYTES HELPER
|
||||||
|
# PORT(S)
|
||||||
4:T 0.0.0.0/0 0.0.0.0/0 TCP - - - - - - - ftp</programlisting></para>
|
4:T 0.0.0.0/0 0.0.0.0/0 TCP - - - - - - - ftp</programlisting></para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1306,7 +1287,8 @@ Normal-Service => 0x00</programlisting>
|
|||||||
|
|
||||||
<para>We assume packet/connection mark 0 means unclassified.</para>
|
<para>We assume packet/connection mark 0 means unclassified.</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
|
<programlisting> #ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
|
||||||
|
# PORT(S)
|
||||||
MARK(1):T 0.0.0.0/0 0.0.0.0/0 icmp echo-request
|
MARK(1):T 0.0.0.0/0 0.0.0.0/0 icmp echo-request
|
||||||
MARK(1):T 0.0.0.0/0 0.0.0.0/0 icmp echo-reply
|
MARK(1):T 0.0.0.0/0 0.0.0.0/0 icmp echo-reply
|
||||||
RESTORE:T 0.0.0.0/0 0.0.0.0/0 all - - - 0
|
RESTORE:T 0.0.0.0/0 0.0.0.0/0 all - - - 0
|
||||||
@@ -1331,7 +1313,8 @@ Normal-Service => 0x00</programlisting>
|
|||||||
|
|
||||||
<programlisting>/etc/shorewall/tcrules:
|
<programlisting>/etc/shorewall/tcrules:
|
||||||
|
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
|
#ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
|
||||||
|
# PORT(S)
|
||||||
CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW
|
CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW
|
||||||
|
|
||||||
/etc/shorewall/masq:
|
/etc/shorewall/masq:
|
||||||
|
@@ -249,7 +249,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">PORT</emphasis> (Optional) -
|
<term><emphasis role="bold">PORT(S)</emphasis> (Optional) -
|
||||||
{-|[!]<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
{-|[!]<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -429,14 +429,13 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">USER</emphasis> (Optional) - [<emphasis
|
<term><emphasis role="bold">USER/GROUP</emphasis> (Optional) -
|
||||||
|
[<emphasis
|
||||||
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
|
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
|
||||||
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis
|
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis
|
||||||
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
|
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This column was formerly labelled USER/GROUP.</para>
|
|
||||||
|
|
||||||
<para>Only locally-generated connections will match if this column
|
<para>Only locally-generated connections will match if this column
|
||||||
is non-empty.</para>
|
is non-empty.</para>
|
||||||
|
|
||||||
@@ -539,7 +538,8 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">ORIGDEST</emphasis> - [<emphasis
|
<term><emphasis role="bold">ORIGINAL DEST</emphasis> (origdest) -
|
||||||
|
[<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...[<emphasis>exclusion</emphasis>]|<emphasis>exclusion</emphasis>]</term>
|
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...[<emphasis>exclusion</emphasis>]|<emphasis>exclusion</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -550,8 +550,6 @@
|
|||||||
original destination address matches one of the listed addresses. It
|
original destination address matches one of the listed addresses. It
|
||||||
is useful for specifying that SNAT should occur only for connections
|
is useful for specifying that SNAT should occur only for connections
|
||||||
that were acted on by a DNAT when they entered the firewall.</para>
|
that were acted on by a DNAT when they entered the firewall.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled ORIGINAL DEST.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -641,7 +639,7 @@
|
|||||||
172.20.1.0/29 to be sent from eth0 with source IP address
|
172.20.1.0/29 to be sent from eth0 with source IP address
|
||||||
206.124.146.176.</para>
|
206.124.146.176.</para>
|
||||||
|
|
||||||
<programlisting> #INTERFACE SOURCE ADDRESS PROTO DPORT
|
<programlisting> #INTERFACE SOURCE ADDRESS PROTO PORT(S)
|
||||||
eth0 172.20.1.0/29 206.124.146.177 tcp smtp
|
eth0 172.20.1.0/29 206.124.146.177 tcp smtp
|
||||||
eth0 172.20.1.0/29 206.124.146.176</programlisting>
|
eth0 172.20.1.0/29 206.124.146.176</programlisting>
|
||||||
|
|
||||||
@@ -674,7 +672,8 @@
|
|||||||
|
|
||||||
<programlisting>/etc/shorewall/tcrules:
|
<programlisting>/etc/shorewall/tcrules:
|
||||||
|
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
|
#ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
|
||||||
|
# PORT(S)
|
||||||
1-3:CF 192.168.1.0/24 eth0 ; state=NEW
|
1-3:CF 192.168.1.0/24 eth0 ; state=NEW
|
||||||
|
|
||||||
/etc/shorewall/masq:
|
/etc/shorewall/masq:
|
||||||
|
@@ -106,16 +106,15 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">ALLINTS</emphasis> - [<emphasis
|
<term><emphasis role="bold">ALL INTERFACES</emphasis> (allints) -
|
||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
|
[<emphasis role="bold">Yes</emphasis>|<emphasis
|
||||||
|
role="bold">No</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>If Yes or yes, NAT will be effective from all hosts. If No or
|
<para>If Yes or yes, NAT will be effective from all hosts. If No or
|
||||||
no (or left empty) then NAT will be effective only through the
|
no (or left empty) then NAT will be effective only through the
|
||||||
interface named in the <emphasis role="bold">INTERFACE</emphasis>
|
interface named in the <emphasis role="bold">INTERFACE</emphasis>
|
||||||
column.</para>
|
column.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled ALL INTERFACES.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -161,7 +160,8 @@ smc eth0:10.1.10.0/24</programlisting>
|
|||||||
|
|
||||||
<para><filename>/etc/shorewall/nat</filename>:</para>
|
<para><filename>/etc/shorewall/nat</filename>:</para>
|
||||||
|
|
||||||
<programlisting>#EXTERNAL INTERFACE INTERNAL ALLINTS LOCAL
|
<programlisting>#EXTERNAL INTERFACE INTERNAL ALL LOCAL
|
||||||
|
# INTERFACES
|
||||||
10.1.10.100 eth0 172.20.1.100
|
10.1.10.100 eth0 172.20.1.100
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
@@ -170,7 +170,8 @@ smc eth0:10.1.10.0/24</programlisting>
|
|||||||
|
|
||||||
<para><filename>/etc/shorewall/rules</filename>:</para>
|
<para><filename>/etc/shorewall/rules</filename>:</para>
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
<programlisting>#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||||
|
# PORT PORT(S) DEST LIMIT GROUP
|
||||||
?SECTION ALL
|
?SECTION ALL
|
||||||
?SECTION ESTABLISHED
|
?SECTION ESTABLISHED
|
||||||
?SECTION RELATED
|
?SECTION RELATED
|
||||||
|
@@ -82,7 +82,7 @@
|
|||||||
|
|
||||||
<para>Partial <filename>/etc/shorewall/rules</filename>:</para>
|
<para>Partial <filename>/etc/shorewall/rules</filename>:</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT
|
<programlisting> #ACTION SOURCE DEST PROTO DEST PORT(S)
|
||||||
...
|
...
|
||||||
DNAT sam loc:192.168.1.3 tcp ssh
|
DNAT sam loc:192.168.1.3 tcp ssh
|
||||||
DNAT net loc:192.168.1.5 tcp www
|
DNAT net loc:192.168.1.5 tcp www
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
Because of the way that Netfilter is constructed, this requires two rules
|
Because of the way that Netfilter is constructed, this requires two rules
|
||||||
as follows:</para>
|
as follows:</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT
|
<programlisting> #ACTION SOURCE DEST PROTO DEST PORT(S)
|
||||||
...
|
...
|
||||||
ACCEPT+ sam $FW tcp ssh
|
ACCEPT+ sam $FW tcp ssh
|
||||||
DNAT net loc:192.168.1.3 tcp ssh
|
DNAT net loc:192.168.1.3 tcp ssh
|
||||||
@@ -143,7 +143,8 @@
|
|||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<para>As a consequence, the following rules will have unexpected
|
<para>As a consequence, the following rules will have unexpected
|
||||||
behavior:<programlisting> #ACTION SOURCE DEST PROTO DPORT
|
behavior:<programlisting> #ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
ACCEPT net dmz tcp 80
|
ACCEPT net dmz tcp 80
|
||||||
REDIRECT loc 3128 tcp 80</programlisting></para>
|
REDIRECT loc 3128 tcp 80</programlisting></para>
|
||||||
|
|
||||||
@@ -172,7 +173,8 @@
|
|||||||
|
|
||||||
<para>When using other Shorewall versions, another way is to rewrite the
|
<para>When using other Shorewall versions, another way is to rewrite the
|
||||||
DNAT rule (assume that the local zone is entirely within
|
DNAT rule (assume that the local zone is entirely within
|
||||||
192.168.2.0/23):<programlisting> #ACTION SOURCE DEST PROTO DPORT
|
192.168.2.0/23):<programlisting> #ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
ACCEPT net dmz tcp 80
|
ACCEPT net dmz tcp 80
|
||||||
REDIRECT loc:192.168.2.0/23 3128 tcp 80</programlisting></para>
|
REDIRECT loc:192.168.2.0/23 3128 tcp 80</programlisting></para>
|
||||||
|
|
||||||
|
@@ -137,7 +137,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DPORT</emphasis> -
|
<term><emphasis role="bold">DEST PORT(S) (dport)</emphasis> -
|
||||||
<emphasis>port-number-or-name-list</emphasis></term>
|
<emphasis>port-number-or-name-list</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -160,13 +160,11 @@
|
|||||||
<para>An entry in this field requires that the PROTO column specify
|
<para>An entry in this field requires that the PROTO column specify
|
||||||
icmp (1), tcp (6), udp (17), sctp (132) or udplite (136). Use '-' if
|
icmp (1), tcp (6), udp (17), sctp (132) or udplite (136). Use '-' if
|
||||||
any of the following field is supplied.</para>
|
any of the following field is supplied.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled DEST PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SPORT</emphasis> -
|
<term><emphasis role="bold">SOURCE PORT(S) (sport)</emphasis> -
|
||||||
<emphasis>port-number-or-name-list</emphasis></term>
|
<emphasis>port-number-or-name-list</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -178,8 +176,6 @@
|
|||||||
<para>An entry in this field requires that the PROTO column specify
|
<para>An entry in this field requires that the PROTO column specify
|
||||||
tcp (6), udp (17), sctp (132) or udplite (136). Use '-' if any of
|
tcp (6), udp (17), sctp (132) or udplite (136). Use '-' if any of
|
||||||
the following fields is supplied.</para>
|
the following fields is supplied.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled SOURCE PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
@@ -173,9 +173,9 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>The remaining columns specify characteristics of the packet
|
<para>The remaining columns specify characteristics of the packet
|
||||||
before rewriting. In particular, the ORIGDEST column gives the
|
before rewriting. In particular, the ORIGINAL DEST column gives the
|
||||||
original destination IP address of the packet and the DPORT column
|
original destination IP address of the packet and the DEST PORT(S)
|
||||||
give the original destination port(s).</para>
|
column give the original destination port(s).</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">ADD(<replaceable>ipset</replaceable>:<replaceable>flags</replaceable>[:<replaceable>timeout</replaceable>])</emphasis></term>
|
role="bold">ADD(<replaceable>ipset</replaceable>:<replaceable>flags</replaceable>)</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.12. Causes addresses and/or port
|
<para>Added in Shorewall 4.4.12. Causes addresses and/or port
|
||||||
@@ -256,12 +256,6 @@
|
|||||||
role="bold">dst</emphasis> respectively (see the -A command in
|
role="bold">dst</emphasis> respectively (see the -A command in
|
||||||
ipset (8)).</para>
|
ipset (8)).</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.3, an optional
|
|
||||||
<replaceable>timeout</replaceable> can be specified. This is
|
|
||||||
the number of seconds that the new entry in the ipset is to
|
|
||||||
remain valid and overrides any timeout specified when the
|
|
||||||
ipset was created.</para>
|
|
||||||
|
|
||||||
<para>ADD is non-terminating. Even if a packet matches the
|
<para>ADD is non-terminating. Even if a packet matches the
|
||||||
rule, it is passed on to the next rule.</para>
|
rule, it is passed on to the next rule.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -1207,7 +1201,8 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DPORT</emphasis> - {<emphasis
|
<term><emphasis role="bold">DEST PORT(S) (dport)</emphasis> -
|
||||||
|
{<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
||||||
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
||||||
|
|
||||||
@@ -1239,7 +1234,7 @@
|
|||||||
|
|
||||||
<para>If your kernel contains multi-port match support, then only a
|
<para>If your kernel contains multi-port match support, then only a
|
||||||
single Netfilter rule will be generated if in this list and the
|
single Netfilter rule will be generated if in this list and the
|
||||||
<emphasis role="bold">SPORT</emphasis> list below:</para>
|
<emphasis role="bold">CLIENT PORT(S)</emphasis> list below:</para>
|
||||||
|
|
||||||
<para>1. There are 15 or less ports listed.</para>
|
<para>1. There are 15 or less ports listed.</para>
|
||||||
|
|
||||||
@@ -1250,13 +1245,12 @@
|
|||||||
<replaceable>ipset</replaceable> name can be specified in this
|
<replaceable>ipset</replaceable> name can be specified in this
|
||||||
column. This is intended to be used with
|
column. This is intended to be used with
|
||||||
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled DEST PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SPORT</emphasis> - {<emphasis
|
<term><emphasis role="bold">SOURCE PORT(S)</emphasis> (sport) -
|
||||||
|
{<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
||||||
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
|
||||||
|
|
||||||
@@ -1266,10 +1260,11 @@
|
|||||||
names, port numbers or port ranges.</para>
|
names, port numbers or port ranges.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
|
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
|
||||||
column, provided that the DPORT column is non-empty. This causes the
|
column, provided that the DEST PORT(S) column is non-empty. This
|
||||||
rule to match when either the source port or the destination port in
|
causes the rule to match when either the source port or the
|
||||||
a packet matches one of the ports specified in DEST PORTS(S). Use of
|
destination port in a packet matches one of the ports specified in
|
||||||
'=' requires multi-port match in your iptables and kernel.</para>
|
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
|
||||||
|
and kernel.</para>
|
||||||
|
|
||||||
<warning>
|
<warning>
|
||||||
<para>Unless you really understand IP, you should leave this
|
<para>Unless you really understand IP, you should leave this
|
||||||
@@ -1279,12 +1274,12 @@
|
|||||||
</warning>
|
</warning>
|
||||||
|
|
||||||
<para>If you don't want to restrict client ports but need to specify
|
<para>If you don't want to restrict client ports but need to specify
|
||||||
an <emphasis role="bold">ORIGDEST</emphasis> in the next column,
|
an <emphasis role="bold">ORIGINAL DEST</emphasis> in the next
|
||||||
then place "-" in this column.</para>
|
column, then place "-" in this column.</para>
|
||||||
|
|
||||||
<para>If your kernel contains multi-port match support, then only a
|
<para>If your kernel contains multi-port match support, then only a
|
||||||
single Netfilter rule will be generated if in this list and the
|
single Netfilter rule will be generated if in this list and the
|
||||||
<emphasis role="bold">DPORT</emphasis> list above:</para>
|
<emphasis role="bold">DEST PORT(S)</emphasis> list above:</para>
|
||||||
|
|
||||||
<para>1. There are 15 or less ports listed.</para>
|
<para>1. There are 15 or less ports listed.</para>
|
||||||
|
|
||||||
@@ -1295,13 +1290,12 @@
|
|||||||
<replaceable>ipset</replaceable> name can be specified in this
|
<replaceable>ipset</replaceable> name can be specified in this
|
||||||
column. This is intended to be used with
|
column. This is intended to be used with
|
||||||
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
<firstterm>bitmap:port</firstterm> ipsets.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled SOURCE PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">ORIGDEST</emphasis> - [<emphasis
|
<term><emphasis role="bold">ORIGINAL DEST</emphasis> (origdest) -
|
||||||
|
[<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...[<emphasis>exclusion</emphasis>]|<emphasis>exclusion</emphasis>]</term>
|
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...[<emphasis>exclusion</emphasis>]|<emphasis>exclusion</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -1350,13 +1344,11 @@
|
|||||||
url="/PortKnocking.html">http://www.shorewall.net/PortKnocking.html</ulink>
|
url="/PortKnocking.html">http://www.shorewall.net/PortKnocking.html</ulink>
|
||||||
for an example of using an entry in this column with a user-defined
|
for an example of using an entry in this column with a user-defined
|
||||||
action rule.</para>
|
action rule.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled ORIGINAL DEST.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">RATE</emphasis> -
|
<term><emphasis role="bold">RATE LIMIT</emphasis> (rate) -
|
||||||
<replaceable>limit</replaceable></term>
|
<replaceable>limit</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -1421,13 +1413,11 @@
|
|||||||
enforce the per-source limit and the compiler will pick a unique
|
enforce the per-source limit and the compiler will pick a unique
|
||||||
name for the hash table that tracks the per-destination
|
name for the hash table that tracks the per-destination
|
||||||
limit.</para>
|
limit.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled RATE LIMIT.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">USER</emphasis> - [<emphasis
|
<term><emphasis role="bold">USER/GROUP</emphasis> (user) - [<emphasis
|
||||||
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
|
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
|
||||||
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][,...]</term>
|
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][,...]</term>
|
||||||
|
|
||||||
@@ -1481,8 +1471,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
<para>This column was formerly labelled USER/GROUP.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1638,8 +1626,6 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>where <replaceable>dd</replaceable> is an ordinal day of
|
<para>where <replaceable>dd</replaceable> is an ordinal day of
|
||||||
the month</para>
|
the month</para>
|
||||||
|
|
||||||
<para/>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1781,7 +1767,8 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Accept SMTP requests from the DMZ to the internet</para>
|
<para>Accept SMTP requests from the DMZ to the internet</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
|
||||||
|
# PORT PORT(S) DEST
|
||||||
ACCEPT dmz net tcp smtp</programlisting>
|
ACCEPT dmz net tcp smtp</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1793,7 +1780,8 @@
|
|||||||
<para>Forward all ssh and http connection requests from the internet
|
<para>Forward all ssh and http connection requests from the internet
|
||||||
to local system 192.168.1.3</para>
|
to local system 192.168.1.3</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
|
||||||
|
# PORT PORT(S) DEST
|
||||||
DNAT net loc:192.168.1.3 tcp ssh,http</programlisting>
|
DNAT net loc:192.168.1.3 tcp ssh,http</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1804,7 +1792,8 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Forward all http connection requests from the internet to
|
<para>Forward all http connection requests from the internet to
|
||||||
local system 192.168.1.3 with a limit of 3 per second and a maximum
|
local system 192.168.1.3 with a limit of 3 per second and a maximum
|
||||||
burst of 10<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE
|
burst of 10<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE
|
||||||
|
# PORT PORT(S) DEST LIMIT
|
||||||
DNAT net loc:192.168.1.3 tcp http - - 3/sec:10</programlisting></para>
|
DNAT net loc:192.168.1.3 tcp http - - 3/sec:10</programlisting></para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1817,7 +1806,8 @@
|
|||||||
port 3128 on the firewall (Squid running on the firewall system)
|
port 3128 on the firewall (Squid running on the firewall system)
|
||||||
except when the destination address is 192.168.2.2</para>
|
except when the destination address is 192.168.2.2</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
|
||||||
|
# PORT PORT(S) DEST
|
||||||
REDIRECT loc 3128 tcp www - !192.168.2.2</programlisting>
|
REDIRECT loc 3128 tcp www - !192.168.2.2</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1829,7 +1819,8 @@
|
|||||||
<para>All http requests from the internet to address 130.252.100.69
|
<para>All http requests from the internet to address 130.252.100.69
|
||||||
are to be forwarded to 192.168.1.3</para>
|
are to be forwarded to 192.168.1.3</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
|
||||||
|
# PORT PORT(S) DEST
|
||||||
DNAT net loc:192.168.1.3 tcp 80 - 130.252.100.69</programlisting>
|
DNAT net loc:192.168.1.3 tcp 80 - 130.252.100.69</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1841,9 +1832,10 @@
|
|||||||
<para>You want to accept SSH connections to your firewall only from
|
<para>You want to accept SSH connections to your firewall only from
|
||||||
internet IP addresses 130.252.100.69 and 130.252.100.70</para>
|
internet IP addresses 130.252.100.69 and 130.252.100.70</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
|
||||||
ACCEPT net:130.252.100.69,130.252.100.70 \
|
# PORT PORT(S) DEST
|
||||||
$FW tcp 22</programlisting>
|
ACCEPT net:130.252.100.69,130.252.100.70 $FW \
|
||||||
|
tcp 22</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1855,7 +1847,8 @@
|
|||||||
firewall on port 2222 and you want to forward them to local system
|
firewall on port 2222 and you want to forward them to local system
|
||||||
192.168.1.3, port 22</para>
|
192.168.1.3, port 22</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
|
||||||
|
# PORT PORT(S) DEST
|
||||||
DNAT net loc:192.168.1.3:22 tcp 2222</programlisting>
|
DNAT net loc:192.168.1.3:22 tcp 2222</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1867,7 +1860,8 @@
|
|||||||
<para>You want to redirect connection requests to port 80 randomly
|
<para>You want to redirect connection requests to port 80 randomly
|
||||||
to the port range 81-90.</para>
|
to the port range 81-90.</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
|
||||||
|
# PORT PORT(S) DEST
|
||||||
REDIRECT net $FW::81-90:random tcp www</programlisting>
|
REDIRECT net $FW::81-90:random tcp www</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1903,7 +1897,8 @@
|
|||||||
|
|
||||||
<para>rules:</para>
|
<para>rules:</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT
|
<programlisting> #ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
REDIRECT loc 3128 tcp 80 </programlisting>
|
REDIRECT loc 3128 tcp 80 </programlisting>
|
||||||
|
|
||||||
<simpara>Note that it would have been tempting to simply define the
|
<simpara>Note that it would have been tempting to simply define the
|
||||||
@@ -1931,7 +1926,8 @@
|
|||||||
<para>Add the tuple (source IP, dest port, dest IP) of an incoming
|
<para>Add the tuple (source IP, dest port, dest IP) of an incoming
|
||||||
SSH connection to the ipset S:</para>
|
SSH connection to the ipset S:</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT
|
<programlisting> #ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
ADD(+S:dst,src,dst) net fw tcp 22</programlisting>
|
ADD(+S:dst,src,dst) net fw tcp 22</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1943,7 +1939,8 @@
|
|||||||
<para>You wish to limit SSH connections from remote systems to 1/min
|
<para>You wish to limit SSH connections from remote systems to 1/min
|
||||||
with a burst of three (to allow for limited retry):</para>
|
with a burst of three (to allow for limited retry):</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE
|
||||||
|
# PORT(S) PORT(S) DEST LIMIT
|
||||||
SSH(ACCEPT) net all - - - - s:1/min:3</programlisting>
|
SSH(ACCEPT) net all - - - - s:1/min:3</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1955,7 +1952,8 @@
|
|||||||
<para>Forward port 80 to dmz host $BACKUP if switch 'primary_down'
|
<para>Forward port 80 to dmz host $BACKUP if switch 'primary_down'
|
||||||
is on.</para>
|
is on.</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH
|
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
|
||||||
|
# PORT(S) PORT(S) DEST LIMIT GROUP
|
||||||
DNAT net dmz:$BACKUP tcp 80 - - - - - - - - primary_down</programlisting>
|
DNAT net dmz:$BACKUP tcp 80 - - - - - - - - primary_down</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1967,7 +1965,8 @@
|
|||||||
<para>Drop all email from the <emphasis>Anonymous Proxy</emphasis>
|
<para>Drop all email from the <emphasis>Anonymous Proxy</emphasis>
|
||||||
and <emphasis>Satellite Provider</emphasis> address ranges:</para>
|
and <emphasis>Satellite Provider</emphasis> address ranges:</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT
|
<programlisting> #ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
DROP net:^A1,A2 fw tcp 25</programlisting>
|
DROP net:^A1,A2 fw tcp 25</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1979,7 +1978,8 @@
|
|||||||
<para>You want to generate your own rule involving iptables targets
|
<para>You want to generate your own rule involving iptables targets
|
||||||
and matches not supported by Shorewall.</para>
|
and matches not supported by Shorewall.</para>
|
||||||
|
|
||||||
<programlisting> #ACTION SOURCE DEST PROTO DPORT
|
<programlisting> #ACTION SOURCE DEST PROTO DEST
|
||||||
|
# PORT(S)
|
||||||
INLINE $FW net ; -p 6 -m mickey-mouse --name test -m set --match-set set1 src -m mickey-mouse --name test2 -j SECCTX --name test3</programlisting>
|
INLINE $FW net ; -p 6 -m mickey-mouse --name test -m set --match-set set1 src -m mickey-mouse --name test2 -j SECCTX --name test3</programlisting>
|
||||||
|
|
||||||
<para>The above will generate the following iptables-restore
|
<para>The above will generate the following iptables-restore
|
||||||
|
@@ -93,7 +93,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">CHAIN -
|
<term><emphasis role="bold">CHAIN:STATE (chain) -
|
||||||
{P|I|F|O|T}[:{N|I|U|IU|NI|NU|NIU|NUI:E|ER}]</emphasis></term>
|
{P|I|F|O|T}[:{N|I|U|IU|NI|NU|NIU|NUI:E|ER}]</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -140,8 +140,6 @@
|
|||||||
|
|
||||||
<member>:NIU - NEW, INVALID or UNTRACKED connection.</member>
|
<member>:NIU - NEW, INVALID or UNTRACKED connection.</member>
|
||||||
</simplelist>
|
</simplelist>
|
||||||
|
|
||||||
<para>This column was formerly labelled CHAIN:STATE.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
@@ -238,7 +236,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DPORT</emphasis> - [<emphasis
|
<term><emphasis role="bold">PORT(S)</emphasis> (dport) - [<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
||||||
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...]</term>
|
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...]</term>
|
||||||
|
|
||||||
@@ -261,13 +259,12 @@
|
|||||||
<para>This column is ignored if PROTOCOL = all but must be entered
|
<para>This column is ignored if PROTOCOL = all but must be entered
|
||||||
if any of the following field is supplied. In that case, it is
|
if any of the following field is supplied. In that case, it is
|
||||||
suggested that this field contain "-"</para>
|
suggested that this field contain "-"</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled DEST PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SPORT</emphasis> - [<emphasis
|
<term><emphasis role="bold">SOURCE PORT(S)</emphasis> (sport) -
|
||||||
|
[<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
|
||||||
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...]</term>
|
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...]</term>
|
||||||
|
|
||||||
@@ -275,8 +272,6 @@
|
|||||||
<para>Optional source port(s). If omitted, any source port is
|
<para>Optional source port(s). If omitted, any source port is
|
||||||
acceptable. Specified as a comma-separated list of port names, port
|
acceptable. Specified as a comma-separated list of port names, port
|
||||||
numbers or port ranges.</para>
|
numbers or port ranges.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled SOURCE PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -393,7 +388,8 @@
|
|||||||
|
|
||||||
<para><filename>/etc/shorewall/secmarks</filename>:</para>
|
<para><filename>/etc/shorewall/secmarks</filename>:</para>
|
||||||
|
|
||||||
<programlisting>#SECMARK CHAIN SOURCE DEST PROTO DPORT SPORT USER MARK
|
<programlisting>#SECMARK CHAIN: SOURCE DEST PROTO DEST SOURCE USER/ MARK
|
||||||
|
# STATE PORT(S) PORT(S) GROUP
|
||||||
system_u:object_r:mysqld_packet_t:s0 I:N lo 127.0.0.1 tcp 3306
|
system_u:object_r:mysqld_packet_t:s0 I:N lo 127.0.0.1 tcp 3306
|
||||||
SAVE I:N lo 127.0.0.1 tcp 3306
|
SAVE I:N lo 127.0.0.1 tcp 3306
|
||||||
RESTORE I:ER</programlisting>
|
RESTORE I:ER</programlisting>
|
||||||
|
@@ -112,7 +112,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DPORT</emphasis> ‒
|
<term><emphasis role="bold">DEST PORT(S) (dport)</emphasis> ‒
|
||||||
<replaceable>service-name/port-number-list</replaceable></term>
|
<replaceable>service-name/port-number-list</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -121,13 +121,11 @@
|
|||||||
include port ranges of the form
|
include port ranges of the form
|
||||||
<replaceable>low-port</replaceable>:<replaceable>high-port</replaceable>
|
<replaceable>low-port</replaceable>:<replaceable>high-port</replaceable>
|
||||||
if your kernel and iptables include port range support.</para>
|
if your kernel and iptables include port range support.</para>
|
||||||
|
|
||||||
<para>This column was formerly labelled DEST PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SPORT</emphasis> ‒
|
<term><emphasis role="bold">SOURCE PORT(S) (sport)</emphasis> ‒
|
||||||
<replaceable>service-name/port-number-list</replaceable></term>
|
<replaceable>service-name/port-number-list</replaceable></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -138,12 +136,11 @@
|
|||||||
if your kernel and iptables include port range support.</para>
|
if your kernel and iptables include port range support.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
|
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
|
||||||
column, provided that the DPORT column is non-empty. This causes the
|
column, provided that the DEST PORT(S) column is non-empty. This
|
||||||
rule to match when either the source port or the destination port in
|
causes the rule to match when either the source port or the
|
||||||
a packet matches one of the ports specified in DEST PORTS(S). Use of
|
destination port in a packet matches one of the ports specified in
|
||||||
'=' requires multi-port match in your iptables and kernel.</para>
|
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
|
||||||
|
and kernel.</para>
|
||||||
<para>This column was formerly labelled SOURCE PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
@@ -135,7 +135,7 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DPORT</emphasis> - [<emphasis
|
<term><emphasis role="bold">DEST PORT</emphasis> (dport) - [<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>port-name-or-number</emphasis>]</term>
|
role="bold">-</emphasis>|<emphasis>port-name-or-number</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -143,19 +143,16 @@
|
|||||||
a <emphasis>port number</emphasis>; if the protocol is <emphasis
|
a <emphasis>port number</emphasis>; if the protocol is <emphasis
|
||||||
role="bold">icmp</emphasis>, this column is interpreted as the
|
role="bold">icmp</emphasis>, this column is interpreted as the
|
||||||
destination icmp-type(s).</para>
|
destination icmp-type(s).</para>
|
||||||
|
|
||||||
<para>This column was previously labelled DEST PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SPORT</emphasis> - [<emphasis
|
<term><emphasis role="bold">SOURCE PORT</emphasis> (sport) -
|
||||||
|
[<emphasis
|
||||||
role="bold">-</emphasis>|<emphasis>port-name-or-number</emphasis>]</term>
|
role="bold">-</emphasis>|<emphasis>port-name-or-number</emphasis>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Optional source port.</para>
|
<para>Optional source port.</para>
|
||||||
|
|
||||||
<para>This column was previously labelled SOURCE PORT(S).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -295,7 +292,8 @@
|
|||||||
ALL cannot be used because IPv4 ICMP and IPv6 ICMP are two different
|
ALL cannot be used because IPv4 ICMP and IPv6 ICMP are two different
|
||||||
protocols.</para>
|
protocols.</para>
|
||||||
|
|
||||||
<programlisting> #CLASS SOURCE DEST PROTO DPORT
|
<programlisting> #CLASS SOURCE DEST PROTO DEST
|
||||||
|
# PORT
|
||||||
|
|
||||||
IPV4
|
IPV4
|
||||||
|
|
||||||
@@ -316,7 +314,8 @@
|
|||||||
<para>Add two filters with priority 10 (Shorewall 4.5.8 or
|
<para>Add two filters with priority 10 (Shorewall 4.5.8 or
|
||||||
later).</para>
|
later).</para>
|
||||||
|
|
||||||
<programlisting> #CLASS SOURCE DEST PROTO DPORT PRIORITY
|
<programlisting> #CLASS SOURCE DEST PROTO DEST PRIORITY
|
||||||
|
# PORT
|
||||||
|
|
||||||
IPV4
|
IPV4
|
||||||
|
|
||||||
|
@@ -1625,11 +1625,11 @@ LOG:info:,bar net fw</programlisting>
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>This parameter specifies the directory/directories where your
|
<para>This parameter specifies the directory/directories where your
|
||||||
kernel netfilter modules may be found. If you leave the variable
|
kernel netfilter modules may be found. If you leave the variable
|
||||||
empty, Shorewall will supply the value
|
empty, Shorewall will supply the value "/lib/modules/`uname
|
||||||
"/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset"
|
-r`/kernel/net/ipv4/netfilter" in versions of Shorewall prior to
|
||||||
where <emphasis role="bold">uname</emphasis> holds the output of
|
3.2.4 and "/lib/modules/`uname
|
||||||
'<command>uname -r</command>' and <emphasis
|
-r`/kernel/net/ipv4/netfilter:/lib/modules/`uname
|
||||||
role="bold">g_family</emphasis> holds '4'.</para>
|
-r`/kernel/net/ipv4/netfilter" in later versions.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -2620,8 +2620,7 @@ INLINE - - - ; -j REJECT
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">TRACK_RULES=</emphasis>{<emphasis
|
<term><emphasis role="bold">TRACK_RULES=</emphasis>{<emphasis
|
||||||
role="bold">Yes</emphasis>|<emphasis
|
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||||
role="bold">No</emphasis>|File}</term>
|
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.5.20. If set to <emphasis
|
<para>Added in Shorewall 4.5.20. If set to <emphasis
|
||||||
@@ -2634,12 +2633,6 @@ INLINE - - - ; -j REJECT
|
|||||||
<para>Setting this option to <emphasis role="bold">Yes</emphasis>
|
<para>Setting this option to <emphasis role="bold">Yes</emphasis>
|
||||||
requires the <firstterm>Comments</firstterm> capability in iptables
|
requires the <firstterm>Comments</firstterm> capability in iptables
|
||||||
and kernel.</para>
|
and kernel.</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 5.0.5, the option may also be set to
|
|
||||||
<emphasis role="bold">File</emphasis>. That setting causes similar
|
|
||||||
comments to be added to the
|
|
||||||
<filename>.iptables-restore-input</filename> file, which is normally
|
|
||||||
created in <filename>/var/lib/shorewall</filename>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
22
Shorewall/shorewall.service.214
Normal file
22
Shorewall/shorewall.service.214
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
|
||||||
|
#
|
||||||
|
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
|
||||||
|
#
|
||||||
|
[Unit]
|
||||||
|
Description=Shorewall IPv4 firewall
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
Conflicts=iptables.service firewalld.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
EnvironmentFile=-/etc/sysconfig/shorewall
|
||||||
|
StandardOutput=syslog
|
||||||
|
ExecStart=/sbin/shorewall $OPTIONS start $STARTOPTIONS
|
||||||
|
ExecStop=/sbin/shorewall $OPTIONS stop
|
||||||
|
ExecReload=/sbin/shorewall $OPTIONS reload $RELOADOPTIONS
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=basic.target
|
@@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# Global start/restart/reload/stop options
|
|
||||||
#
|
|
||||||
OPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start options
|
|
||||||
#
|
|
||||||
STARTOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Restart options
|
|
||||||
#
|
|
||||||
RESTARTOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Reload options
|
|
||||||
#
|
|
||||||
RELOADOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Stop options
|
|
||||||
#
|
|
||||||
STOPOPTIONS=""
|
|
||||||
|
|
||||||
# EOF
|
|
@@ -80,11 +80,6 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Change to the directory containing this script
|
|
||||||
#
|
|
||||||
cd "$(dirname $0)"
|
|
||||||
|
|
||||||
finished=0
|
finished=0
|
||||||
configure=1
|
configure=1
|
||||||
|
|
||||||
|
25
Shorewall6-lite/default.openwrt
Normal file
25
Shorewall6-lite/default.openwrt
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# sysV init file script configuration(/etc/sysconfdir/shorewall-lite)
|
||||||
|
|
||||||
|
# startup option(default "-vvv")
|
||||||
|
OPTIONS=
|
||||||
|
|
||||||
|
# change default start run level(if none empty; /etc/init.d/shorewall-lite enable)
|
||||||
|
START=50
|
||||||
|
|
||||||
|
# change default stop run level(if none empty; /etc/init.d/shorewall-lite enable)
|
||||||
|
STOP=
|
||||||
|
|
||||||
|
# option to pass when shorewall start is executed
|
||||||
|
STARTOPTIONS=
|
||||||
|
|
||||||
|
# option to pass when shorewall restart is executed
|
||||||
|
RESTARTOPTIONS=
|
||||||
|
|
||||||
|
# option to pass when shorewall reload is executed
|
||||||
|
RELOADOPTIONS=
|
||||||
|
|
||||||
|
# option to pass when shorewall stop is executed
|
||||||
|
STOPOPTIONS=
|
||||||
|
|
||||||
|
# option to pass when shorewall status is executed
|
||||||
|
STATUSOPTIONS=
|
@@ -39,18 +39,18 @@
|
|||||||
|
|
||||||
# description: Packet filtering firewall
|
# description: Packet filtering firewall
|
||||||
|
|
||||||
# Openwrt related
|
# openwrt stuph
|
||||||
# Start and stop runlevel variable
|
# start and stop runlevel variable
|
||||||
START=50
|
#START=21
|
||||||
STOP=89
|
#STOP=91
|
||||||
# Displays the status command
|
# variable to display what the status command do when /etc/init.d/shorewall6-lite is invoke without argument
|
||||||
EXTRA_COMMANDS="status"
|
EXTRA_COMMANDS="status"
|
||||||
EXTRA_HELP=" status Displays firewall status"
|
EXTRA_HELP="Displays shorewall status"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Get startup options (override default)
|
# Get startup options (override default)
|
||||||
################################################################################
|
################################################################################
|
||||||
OPTIONS=
|
OPTIONS="-vvv"
|
||||||
|
|
||||||
#
|
#
|
||||||
# The installer may alter this
|
# The installer may alter this
|
||||||
@@ -61,35 +61,38 @@ if [ -f ${SYSCONFDIR}/shorewall6-lite ]; then
|
|||||||
. ${SYSCONFDIR}/shorewall6-lite
|
. ${SYSCONFDIR}/shorewall6-lite
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
START=${START:-21}
|
||||||
|
STOP=${STOP:-91}
|
||||||
|
|
||||||
SHOREWALL_INIT_SCRIPT=1
|
SHOREWALL_INIT_SCRIPT=1
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# E X E C U T I O N B E G I N S H E R E #
|
# E X E C U T I O N B E G I N S H E R E #
|
||||||
################################################################################
|
################################################################################
|
||||||
# Arg1 of init script is arg2 when rc.common is sourced; set to action variable
|
# arg1 of init script is arg2 when rc.common is sourced; set to action variable
|
||||||
command="$action"
|
command="$action"
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $STARTOPTIONS
|
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command ${STARTOPTIONS:-$@}
|
||||||
}
|
}
|
||||||
|
|
||||||
boot() {
|
boot() {
|
||||||
local command="start"
|
local command="start"
|
||||||
start
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $RESTARTOPTIONS
|
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command ${RESTARTOPTIONS:-$@}
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $RELOADOPTION
|
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command ${RELOADOPTION:-$@}
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $STOPOPTIONS
|
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command ${STOPOPTIONS:-$@}
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $@
|
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command ${STATUSOPTIONS:-$@}
|
||||||
}
|
}
|
||||||
|
21
Shorewall6-lite/shorewall6-lite.service.214
Normal file
21
Shorewall6-lite/shorewall6-lite.service.214
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
|
||||||
|
#
|
||||||
|
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
|
||||||
|
#
|
||||||
|
[Unit]
|
||||||
|
Description=Shorewall IPv6 firewall (lite)
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
Conflicts=ip6tables.service firewalld.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
EnvironmentFile=-/etc/sysconfig/shorewall6-lite
|
||||||
|
StandardOutput=syslog
|
||||||
|
ExecStart=/sbin/shorewall6-lite $OPTIONS start
|
||||||
|
ExecStop=/sbin/shorewall6-lite $OPTIONS stop
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=basic.target
|
@@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# Global start/restart/reload/stop options
|
|
||||||
#
|
|
||||||
OPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start options
|
|
||||||
#
|
|
||||||
STARTOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Restart options
|
|
||||||
#
|
|
||||||
RESTARTOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Reload options
|
|
||||||
#
|
|
||||||
RELOADOPTIONS=""
|
|
||||||
|
|
||||||
#
|
|
||||||
# Stop options
|
|
||||||
#
|
|
||||||
STOPOPTIONS=""
|
|
||||||
|
|
||||||
# EOF
|
|
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
VERSION=xxx #The Build script inserts the actual version
|
VERSION=xxx #The Build script inserts the actual version
|
||||||
PRODUCT=shorewall6-lite
|
PRODUCT=shorewall6-lite
|
||||||
Product="Shorewall6 Lite"
|
|
||||||
|
|
||||||
usage() # $1 = exit status
|
usage() # $1 = exit status
|
||||||
{
|
{
|
||||||
@@ -77,11 +76,6 @@ remove_file() # $1 = file to restore
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Change to the directory containing this script
|
|
||||||
#
|
|
||||||
cd "$(dirname $0)"
|
|
||||||
|
|
||||||
finished=0
|
finished=0
|
||||||
configure=1
|
configure=1
|
||||||
|
|
||||||
@@ -199,24 +193,21 @@ if [ -f "$FIREWALL" ]; then
|
|||||||
remove_file $FIREWALL
|
remove_file $FIREWALL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$SERVICEDIR" ] && SERVICEDIR="$SYSTEMD"
|
if [ -n "$SYSTEMD" ]; then
|
||||||
|
|
||||||
if [ -n "$SERVICEDIR" ]; then
|
|
||||||
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
|
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
|
||||||
rm -f $SERVICEDIR/shorewall6-lite.service
|
rm -f $SYSTEMD/shorewall6-lite.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${SBINDIR}/shorewall6-lite
|
rm -f ${SBINDIR}/shorewall6-lite
|
||||||
rm -rf ${CONFDIR}/shorewall6-lite
|
rm -rf ${CONFDIR}/shorewall6-lite
|
||||||
rm -rf ${VARDIR}
|
rm -rf ${VARDIR}/shorewall6-lite
|
||||||
rm -rf ${SHAREDIR}/shorewall6-lite
|
rm -rf ${SHAREDIR}/shorewall6-lite
|
||||||
rm -rf ${LIBEXECDIR}/shorewall6-lite
|
rm -rf ${LIBEXECDIR}/shorewall6-lite
|
||||||
rm -f ${CONFDIR}/logrotate.d/shorewall6-lite
|
rm -f ${CONFDIR}/logrotate.d/shorewall6-lite
|
||||||
rm -f ${SYSCONFDIR}/shorewall6-lite
|
rm -f ${SYSCONFDIR}/shorewall6-lite
|
||||||
|
[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/shorewall6-lite.service
|
||||||
|
|
||||||
if [ -n "${MANDIR}" ]; then
|
rm -f ${MANDIR}/man5/shorewall6-lite*
|
||||||
rm -f ${MANDIR}/man5/shorewall6-lite*
|
rm -f ${MANDIR}/man8/shorewall6-lite*
|
||||||
rm -f ${MANDIR}/man8/shorewall6-lite*
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Shorewall6 Lite Uninstalled"
|
echo "Shorewall6 Lite Uninstalled"
|
||||||
|
@@ -159,7 +159,7 @@ INLINE_MATCHES=Yes
|
|||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=keep
|
IP_FORWARDING=Off
|
||||||
|
|
||||||
KEEP_RT_TABLES=Yes
|
KEEP_RT_TABLES=Yes
|
||||||
|
|
||||||
|
@@ -160,7 +160,7 @@ INLINE_MATCHES=Yes
|
|||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=keep
|
IP_FORWARDING=Off
|
||||||
|
|
||||||
KEEP_RT_TABLES=Yes
|
KEEP_RT_TABLES=Yes
|
||||||
|
|
||||||
|
@@ -159,7 +159,7 @@ INLINE_MATCHES=Yes
|
|||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=keep
|
IP_FORWARDING=On
|
||||||
|
|
||||||
KEEP_RT_TABLES=Yes
|
KEEP_RT_TABLES=Yes
|
||||||
|
|
||||||
|
@@ -159,7 +159,7 @@ INLINE_MATCHES=Yes
|
|||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=keep
|
IP_FORWARDING=On
|
||||||
|
|
||||||
KEEP_RT_TABLES=Yes
|
KEEP_RT_TABLES=Yes
|
||||||
|
|
||||||
|
@@ -7,4 +7,5 @@
|
|||||||
# additional information about how to use this file.
|
# additional information about how to use this file.
|
||||||
#
|
#
|
||||||
###############################################################################################################
|
###############################################################################################################
|
||||||
#ACTION CHAIN SOURCE DEST PROTO DPORT SPORT USER MARK IPSEC HEADERS
|
#ACTION CHAIN SOURCE DESTINATION PROTO DEST SOURCE USER/ MARK IPSEC HEADERS
|
||||||
|
# PORT(S) PORT(S) GROUP
|
||||||
|
@@ -5,8 +5,6 @@
|
|||||||
#
|
#
|
||||||
# Please see http://shorewall.net/Actions.html for additional information.
|
# Please see http://shorewall.net/Actions.html for additional information.
|
||||||
#
|
#
|
||||||
# Place '# ' below the 'C' in COMMENT followed by a comment describing
|
########################################################################################
|
||||||
# the action.
|
#ACTION OPTIONS COMMENT (place '# ' below the 'C' in comment followed by
|
||||||
#
|
# v a comment describing the action)
|
||||||
###############################################################################
|
|
||||||
#ACTION OPTIONS COMMENT
|
|
||||||
|
@@ -6,5 +6,6 @@
|
|||||||
# Please see http://shorewall.net/blacklisting_support.htm for additional
|
# Please see http://shorewall.net/blacklisting_support.htm for additional
|
||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
##############################################################################################################################################################
|
########################################################################################################################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
|
||||||
|
# PORT PORT(S) DEST LIMIT GROUP
|
||||||
|
@@ -3,10 +3,11 @@
|
|||||||
#
|
#
|
||||||
# For information about entries in this file, type "man shorewall6-conntrack"
|
# For information about entries in this file, type "man shorewall6-conntrack"
|
||||||
#
|
#
|
||||||
|
##############################################################################################################
|
||||||
?FORMAT 3
|
?FORMAT 3
|
||||||
##############################################################################################
|
##############################################################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER SWITCH
|
#ACTION SOURCE DESTINATION PROTO DEST SOURCE USER/ SWITCH
|
||||||
|
# PORT(S) PORT(S) GROUP
|
||||||
?if $AUTOHELPERS && __CT_TARGET
|
?if $AUTOHELPERS && __CT_TARGET
|
||||||
|
|
||||||
?if __AMANDA_HELPER
|
?if __AMANDA_HELPER
|
||||||
|
@@ -7,4 +7,4 @@
|
|||||||
# http://www.shorewall.net/manpages6/shorewall6-hosts.html
|
# http://www.shorewall.net/manpages6/shorewall6-hosts.html
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ZONE HOSTS OPTIONS
|
#ZONE HOST(S) OPTIONS
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
# The manpage is also online at
|
# The manpage is also online at
|
||||||
# http://www.shorewall.net/manpages6/shorewall6-interfaces.html
|
# http://www.shorewall.net/manpages6/shorewall6-interfaces.html
|
||||||
#
|
#
|
||||||
|
###############################################################################
|
||||||
?FORMAT 2
|
?FORMAT 2
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ZONE INTERFACE OPTIONS
|
#ZONE INTERFACE OPTIONS
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
# information.
|
# information.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
local status
|
local status
|
||||||
status=0
|
status=0
|
||||||
|
|
||||||
|
@@ -6,4 +6,4 @@
|
|||||||
# For additional information, see http://shorewall.net/MAC_Validation.html
|
# For additional information, see http://shorewall.net/MAC_Validation.html
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#DISPOSITION INTERFACE MAC ADDRESSES
|
#DISPOSITION INTERFACE MAC IP ADDRESSES (Optional)
|
||||||
|
@@ -11,4 +11,5 @@
|
|||||||
# the Netfilter/Shorewall packet marking mechanism.
|
# the Netfilter/Shorewall packet marking mechanism.
|
||||||
#
|
#
|
||||||
############################################################################################################################################################
|
############################################################################################################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER HEADERS PROBABILITY DSCP
|
#ACTION SOURCE DEST PROTO DEST SOURCE USER TEST LENGTH TOS CONNBYTES HELPER HEADERS PROBABILITY DSCP
|
||||||
|
# PORT(S) PORT(S)
|
||||||
|
@@ -6,5 +6,6 @@
|
|||||||
# The manpage is also online at
|
# The manpage is also online at
|
||||||
# http://www.shorewall.net/manpages6/shorewall6-masq.html
|
# http://www.shorewall.net/manpages6/shorewall6-masq.html
|
||||||
#
|
#
|
||||||
######################################################################################################
|
########################################################################################################################
|
||||||
#INTERFACE SOURCE ADDRESS PROTO PORT IPSEC MARK USER SWITCH
|
#INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL
|
||||||
|
# GROUP DEST
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user