2017-07-01 20:24:20 +02:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
|
|
|
<article>
|
2020-04-25 23:48:45 +02:00
|
|
|
<!--$Id$-->
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
<articleinfo>
|
|
|
|
<title>Shared Shorewall and Shorewall6 Configuration</title>
|
|
|
|
|
|
|
|
<authorgroup>
|
|
|
|
<author>
|
|
|
|
<firstname>Tom</firstname>
|
|
|
|
|
|
|
|
<surname>Eastep</surname>
|
|
|
|
</author>
|
|
|
|
</authorgroup>
|
|
|
|
|
|
|
|
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
|
|
|
|
|
|
|
<copyright>
|
|
|
|
<year>2017</year>
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
<year>2020</year>
|
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
<holder>Thomas M. Eastep</holder>
|
|
|
|
</copyright>
|
|
|
|
|
|
|
|
<legalnotice>
|
|
|
|
<para>Permission is granted to copy, distribute and/or modify this
|
|
|
|
document under the terms of the GNU Free Documentation License, Version
|
|
|
|
1.2 or any later version published by the Free Software Foundation; with
|
|
|
|
no Invariant Sections, with no Front-Cover, and with no Back-Cover
|
|
|
|
Texts. A copy of the license is included in the section entitled
|
|
|
|
<quote><ulink url="GnuCopyright.htm">GNU Free Documentation
|
|
|
|
License</ulink></quote>.</para>
|
|
|
|
</legalnotice>
|
|
|
|
</articleinfo>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Introduction</title>
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
<para>Iptables separates management of IPv4 and IPv6 configurations. Each
|
2017-07-01 20:24:20 +02:00
|
|
|
address family has its own utility (iptables and ip6tables), and changes
|
|
|
|
made to the configuration of one address family do not affect the other.
|
|
|
|
While Shorewall also separates the address families in this way, it is
|
|
|
|
possible for Shorewall and Shorewall6 to share almost all of the
|
|
|
|
configuration files. This article gives an example.</para>
|
2017-07-10 01:17:16 +02:00
|
|
|
|
|
|
|
<caution>
|
|
|
|
<para>What is shown here currently works best with Debian and
|
|
|
|
derivatives, or when the tarball installer is used and the SPARSE option
|
|
|
|
is enabled when running configure[.pl].</para>
|
|
|
|
</caution>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Environment</title>
|
|
|
|
|
|
|
|
<para>In this example, each address family has two Internet interfaces.
|
|
|
|
Both address families share a fast uplink (eth0) that has a single public
|
|
|
|
IPv4 address, but can delegate IPv6 subnets to the Shorewall-based router.
|
|
|
|
Both address families also have a production uplink. For IPv4, Ethernet is
|
|
|
|
used (eth1) and supports the public IPv4 subnet 70.90.191.120/29. For
|
|
|
|
IPv6, a Hurricane Electric 6in4 tunnel is used (sit1), which provides the
|
|
|
|
public IPv6 subnet 2001:470:b:227::/64. The router also has two bridges. A
|
|
|
|
DMZ bridge (br0) provides access to containers running a web server, a
|
|
|
|
mail exchanger, and an IMAPS mail access server. The second bridge (br1)
|
|
|
|
provides access to a container running irssi under screen, allowing
|
|
|
|
constant access to and monitoring of IRC channels.</para>
|
2017-11-09 03:47:23 +01:00
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<para>The firewall's local ethernet interface (eth2) is connected to a
|
|
|
|
Netgear GS108E smart switch with two vlans:</para>
|
|
|
|
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>VLAN 1 (eth2.1) is connected to a wireless access point
|
|
|
|
supporting both IPv4 (172.20.1.0/24) and IPv6
|
|
|
|
(2601:601:a000:16f2::/64).</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>VLAN 2 (eth2.2) is connected to devices located in my office
|
|
|
|
supporting both IPv4 (172.20.1.0/24) and IPv6
|
|
|
|
(2601:601:a000:16f2::/64).</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
|
|
|
<para>The switch's management interface is accessed via eth2
|
|
|
|
(192.168.0.0/24).</para>
|
|
|
|
|
|
|
|
<note>
|
|
|
|
<para>The GS108E does not currently support restricting the management
|
|
|
|
interface to a particular VLAN -- it is accessible from any connected
|
|
|
|
host whose IP configuration allows unrouted access to the switch's IP
|
|
|
|
address.</para>
|
|
|
|
</note>
|
|
|
|
|
2017-11-09 03:47:23 +01:00
|
|
|
<para>Here is a diagram of this installation:</para>
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
<graphic fileref="images/Network2020.png"/>
|
2020-07-05 00:25:03 +02:00
|
|
|
|
|
|
|
<para>The boxes in the diagram represent the six shorewall zones (The
|
|
|
|
firewall and IPSec vpn zone are not shown).</para>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Configuration</title>
|
|
|
|
|
|
|
|
<para>Here are the contents of /etc/shorewall/ and /etc/shorewal6/:</para>
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
<programlisting>root@gateway:~# ls -l /etc/shorewall
|
2020-07-05 00:25:03 +02:00
|
|
|
total 132
|
|
|
|
-rw-r--r-- 1 root root 1152 May 18 10:51 action.NotSyn
|
|
|
|
-rw-r--r-- 1 root root 180 Jun 27 09:24 actions
|
|
|
|
-rw-r--r-- 1 root root 60 May 31 17:55 action.SSHLIMIT
|
2020-04-25 23:48:45 +02:00
|
|
|
-rw-r--r-- 1 root root 82 Oct 5 2018 arprules
|
2020-07-05 00:25:03 +02:00
|
|
|
-rw-r--r-- 1 root root 528 May 25 15:39 blrules
|
2020-04-25 23:48:45 +02:00
|
|
|
-rw-r--r-- 1 root root 1797 Sep 16 2019 capabilities
|
2020-07-05 00:25:03 +02:00
|
|
|
-rw-r--r-- 1 root root 722 Jul 2 13:49 conntrack
|
2020-04-25 23:48:45 +02:00
|
|
|
-rw-r--r-- 1 root root 104 Oct 13 2017 hosts
|
2020-07-05 00:25:03 +02:00
|
|
|
-rw-r--r-- 1 root root 1119 Jul 4 14:02 interfaces
|
2020-04-25 23:48:45 +02:00
|
|
|
-rw-r--r-- 1 root root 107 Jun 29 2017 isusable
|
|
|
|
-rw-r--r-- 1 root root 240 Oct 13 2017 macro.FTP
|
2020-07-05 00:25:03 +02:00
|
|
|
-rw-r--r-- 1 root root 773 Jul 2 15:04 mangle
|
|
|
|
-rw-r--r-- 1 root root 3108 Jul 3 15:51 params
|
|
|
|
-rw-r--r-- 1 root root 1108 Jul 3 16:25 policy
|
2020-04-25 23:48:45 +02:00
|
|
|
-rw-r--r-- 1 root root 2098 Apr 23 17:19 providers
|
2017-10-16 04:15:13 +02:00
|
|
|
-rw-r--r-- 1 root root 398 Mar 18 2017 proxyarp
|
2020-04-25 23:48:45 +02:00
|
|
|
-rw-r--r-- 1 root root 726 Oct 24 2018 routes
|
|
|
|
-rw-r--r-- 1 root root 729 Mar 1 11:08 rtrules
|
2020-07-05 00:25:03 +02:00
|
|
|
-rw-r--r-- 1 root root 8589 Jul 4 09:34 rules
|
|
|
|
-rw-r--r-- 1 root root 5503 Jun 5 17:29 shorewall.conf
|
|
|
|
-rw-r--r-- 1 root root 1090 Jul 2 14:32 snat
|
2020-04-25 23:48:45 +02:00
|
|
|
-rw-r--r-- 1 root root 180 Jan 30 2018 started
|
2020-07-05 00:25:03 +02:00
|
|
|
-rw-r--r-- 1 root root 468 Apr 25 14:42 stoppedrules
|
2020-04-25 23:48:45 +02:00
|
|
|
-rw-r--r-- 1 root root 435 Oct 13 2017 tunnels
|
2020-07-05 00:25:03 +02:00
|
|
|
-rw-r--r-- 1 root root 978 Jul 3 12:28 zones
|
2020-04-25 23:48:45 +02:00
|
|
|
root@gateway:~# ls -l /etc/shorewall6
|
|
|
|
total 12
|
|
|
|
-rw-r--r-- 1 root root 1786 Sep 16 2019 capabilities
|
|
|
|
lrwxrwxrwx 1 root root 19 Jul 6 2017 params -> ../shorewall/params
|
2020-07-05 00:25:03 +02:00
|
|
|
-rw-r--r-- 1 root root 5338 Jun 7 16:40 shorewall6.conf
|
|
|
|
</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
<para>The various configuration files are described in the sections that
|
|
|
|
follow. Note that in all cases, these files use the <ulink
|
|
|
|
url="/configuration_file_basics.htm#Pairs">alternate format for column
|
|
|
|
specification</ulink>.</para>
|
|
|
|
|
2017-10-16 04:15:13 +02:00
|
|
|
<section>
|
|
|
|
<title>/usr/share/shorewall/shorewallrc</title>
|
|
|
|
|
|
|
|
<para>The key setting here is SPARSE=Very</para>
|
|
|
|
|
|
|
|
<programlisting>#
|
|
|
|
# Created by Shorewall Core version 5.0.12-RC1 configure.pl - Sep 25 2016 09:30:55
|
|
|
|
# rc file: shorewallrc.debian.systemd
|
|
|
|
#
|
|
|
|
HOST=debian
|
|
|
|
PREFIX=/usr
|
|
|
|
SHAREDIR=${PREFIX}/share
|
|
|
|
LIBEXECDIR=${PREFIX}/share
|
|
|
|
PERLLIBDIR=${PREFIX}/share/shorewall
|
|
|
|
CONFDIR=/etc
|
|
|
|
SBINDIR=/sbin
|
|
|
|
MANDIR=${PREFIX}/share/man
|
|
|
|
INITDIR=
|
|
|
|
INITSOURCE=init.debian.sh
|
|
|
|
INITFILE=
|
|
|
|
AUXINITSOURCE=
|
|
|
|
AUXINITFILE=
|
|
|
|
SERVICEDIR=/lib/systemd/system
|
|
|
|
SERVICEFILE=$PRODUCT.service.debian
|
|
|
|
SYSCONFFILE=default.debian
|
|
|
|
SYSCONFDIR=/etc/default
|
|
|
|
SPARSE=Very
|
|
|
|
ANNOTATED=
|
|
|
|
VARLIB=/var/lib
|
|
|
|
VARDIR=${VARLIB}/$PRODUCT
|
|
|
|
DEFAULT_PAGER=/usr/bin/less
|
|
|
|
</programlisting>
|
|
|
|
</section>
|
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
<section>
|
|
|
|
<title>shorewall.conf and shorewall6.conf</title>
|
|
|
|
|
|
|
|
<para>These are the only files that are not shared between the two
|
|
|
|
address families. The key setting is CONFIG_PATH in
|
|
|
|
shorewall6.conf:</para>
|
|
|
|
|
2017-10-16 04:15:13 +02:00
|
|
|
<programlisting>CONFIG_PATH="<emphasis role="bold">${CONFDIR}/shorewall6:${CONFDIR}/shorewall:</emphasis>/usr/share/shorewall6:${SHAREDIR}/shorewall"</programlisting>
|
2017-07-10 01:17:16 +02:00
|
|
|
|
|
|
|
<para><filename>/etc/shorewall6/</filename> is only used for processing
|
|
|
|
the <filename>params</filename> and <filename>shorewall6.conf</filename>
|
2017-10-16 04:15:13 +02:00
|
|
|
files.</para>
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>shorewall.conf</title>
|
|
|
|
|
|
|
|
<para>The contents of /etc/shorewall/shorewall.conf are as
|
|
|
|
follows:</para>
|
|
|
|
|
|
|
|
<programlisting>###############################################################################
|
2017-10-16 04:15:13 +02:00
|
|
|
#
|
|
|
|
# Shorewall Version 5 -- /etc/shorewall/shorewall.conf
|
|
|
|
#
|
|
|
|
# For information about the settings in this file, type "man shorewall.conf"
|
|
|
|
#
|
2020-04-25 23:48:45 +02:00
|
|
|
# Manpage also online at http://www.shorewall.net/manpages/shorewall.conf.html
|
2017-10-16 04:15:13 +02:00
|
|
|
###############################################################################
|
2017-07-01 20:24:20 +02:00
|
|
|
# S T A R T U P E N A B L E D
|
|
|
|
###############################################################################
|
|
|
|
STARTUP_ENABLED=Yes
|
|
|
|
###############################################################################
|
|
|
|
# V E R B O S I T Y
|
|
|
|
###############################################################################
|
|
|
|
VERBOSITY=1
|
|
|
|
###############################################################################
|
|
|
|
# P A G E R
|
|
|
|
###############################################################################
|
|
|
|
PAGER=pager
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# F I R E W A L L
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
FIREWALL=
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# L O G G I N G
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
LOG_LEVEL="NFLOG(0,64,1)"
|
|
|
|
BLACKLIST_LOG_LEVEL="none"
|
|
|
|
INVALID_LOG_LEVEL=
|
|
|
|
LOG_BACKEND=netlink
|
|
|
|
LOG_MARTIANS=Yes
|
|
|
|
LOG_VERBOSITY=1
|
2020-04-25 23:48:45 +02:00
|
|
|
LOG_ZONE=Src
|
2017-07-01 20:24:20 +02:00
|
|
|
LOGALLNEW=
|
|
|
|
LOGFILE=/var/log/ulogd/ulogd.syslogemu.log
|
2020-04-25 23:48:45 +02:00
|
|
|
LOGFORMAT="%s %s"
|
2017-07-01 20:24:20 +02:00
|
|
|
LOGTAGONLY=Yes
|
|
|
|
LOGLIMIT="s:5/min"
|
|
|
|
MACLIST_LOG_LEVEL="$LOG_LEVEL"
|
2020-07-06 17:56:31 +02:00
|
|
|
RELATED_LOG_LEVEL="$LOG_LEVEL:"
|
|
|
|
RPFILTER_LOG_LEVEL="$LOG_LEVEL:"
|
2017-07-01 20:24:20 +02:00
|
|
|
SFILTER_LOG_LEVEL="$LOG_LEVEL"
|
|
|
|
SMURF_LOG_LEVEL="$LOG_LEVEL"
|
|
|
|
STARTUP_LOG=/var/log/shorewall-init.log
|
|
|
|
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
|
|
|
|
UNTRACKED_LOG_LEVEL=
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
ARPTABLES=
|
|
|
|
CONFIG_PATH="/etc/shorewall:/usr/share/shorewall:/usr/share/shorewall/Shorewall"
|
|
|
|
GEOIPDIR=/usr/share/xt_geoip/LE
|
|
|
|
IPTABLES=/sbin/iptables
|
|
|
|
IP=/sbin/ip
|
|
|
|
IPSET=
|
|
|
|
LOCKFILE=/var/lib/shorewall/lock
|
|
|
|
MODULESDIR="+extra/RTPENGINE"
|
|
|
|
NFACCT=
|
|
|
|
PATH="/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin"
|
|
|
|
PERL=/usr/bin/perl
|
|
|
|
RESTOREFILE=
|
|
|
|
SHOREWALL_SHELL=/bin/sh
|
|
|
|
SUBSYSLOCK=
|
|
|
|
TC=
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# D E F A U L T A C T I O N S / M A C R O S
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
ACCEPT_DEFAULT="none"
|
|
|
|
BLACKLIST_DEFAULT="NotSyn(DROP):$LOG_LEVEL"
|
|
|
|
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
|
|
|
NFQUEUE_DEFAULT="none"
|
|
|
|
QUEUE_DEFAULT="none"
|
|
|
|
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# R S H / R C P C O M M A N D S
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
|
|
|
|
RSH_COMMAND='ssh ${root}@${system} ${command}'
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# F I R E W A L L O P T I O N S
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
ACCOUNTING=Yes
|
2020-04-25 23:48:45 +02:00
|
|
|
ACCOUNTING_TABLE=filter
|
2017-07-01 20:24:20 +02:00
|
|
|
ADD_IP_ALIASES=No
|
|
|
|
ADD_SNAT_ALIASES=No
|
|
|
|
ADMINISABSENTMINDED=Yes
|
|
|
|
AUTOCOMMENT=Yes
|
|
|
|
AUTOHELPERS=No
|
|
|
|
AUTOMAKE=Yes
|
|
|
|
BALANCE_PROVIDERS=No
|
|
|
|
BASIC_FILTERS=No
|
|
|
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
2020-04-25 23:48:45 +02:00
|
|
|
CLAMPMSS=No
|
2017-07-01 20:24:20 +02:00
|
|
|
CLEAR_TC=Yes
|
|
|
|
COMPLETE=No
|
|
|
|
DEFER_DNS_RESOLUTION=No
|
|
|
|
DELETE_THEN_ADD=No
|
|
|
|
DETECT_DNAT_IPADDRS=No
|
|
|
|
DISABLE_IPV6=No
|
|
|
|
DOCKER=No
|
|
|
|
DONT_LOAD="nf_nat_sip,nf_conntrack_sip,nf_conntrack_h323,nf_nat_h323"
|
2020-07-05 00:25:03 +02:00
|
|
|
DYNAMIC_BLACKLIST="ipset-only,disconnect,timeout=7200,log,noupdate"
|
2020-04-25 23:48:45 +02:00
|
|
|
EXPAND_POLICIES=No
|
2017-07-01 20:24:20 +02:00
|
|
|
EXPORTMODULES=Yes
|
|
|
|
FASTACCEPT=Yes
|
2017-10-16 04:15:13 +02:00
|
|
|
FORWARD_CLEAR_MARK=No
|
2017-07-01 20:24:20 +02:00
|
|
|
HELPERS="ftp,irc"
|
|
|
|
IGNOREUNKNOWNVARIABLES=No
|
|
|
|
IMPLICIT_CONTINUE=No
|
|
|
|
IPSET_WARNINGS=Yes
|
|
|
|
IP_FORWARDING=Yes
|
|
|
|
KEEP_RT_TABLES=Yes
|
|
|
|
MACLIST_TABLE=filter
|
|
|
|
MACLIST_TTL=60
|
|
|
|
MANGLE_ENABLED=Yes
|
|
|
|
MARK_IN_FORWARD_CHAIN=No
|
2017-10-16 04:15:13 +02:00
|
|
|
MINIUPNPD=No
|
2017-07-01 20:24:20 +02:00
|
|
|
MULTICAST=No
|
|
|
|
MUTEX_TIMEOUT=60
|
|
|
|
NULL_ROUTE_RFC1918=unreachable
|
|
|
|
OPTIMIZE=All
|
|
|
|
OPTIMIZE_ACCOUNTING=No
|
|
|
|
PERL_HASH_SEED=12345
|
|
|
|
REJECT_ACTION=
|
2020-04-25 23:48:45 +02:00
|
|
|
RENAME_COMBINED=No
|
2017-07-01 20:24:20 +02:00
|
|
|
REQUIRE_INTERFACE=No
|
|
|
|
RESTART=restart
|
|
|
|
RESTORE_DEFAULT_ROUTE=No
|
|
|
|
RESTORE_ROUTEMARKS=Yes
|
|
|
|
RETAIN_ALIASES=No
|
|
|
|
ROUTE_FILTER=No
|
|
|
|
SAVE_ARPTABLES=No
|
|
|
|
SAVE_IPSETS=ipv4
|
|
|
|
TC_ENABLED=No
|
|
|
|
TC_EXPERT=No
|
|
|
|
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
|
|
|
|
TRACK_PROVIDERS=Yes
|
|
|
|
TRACK_RULES=No
|
|
|
|
USE_DEFAULT_RT=Yes
|
2017-10-16 04:15:13 +02:00
|
|
|
USE_NFLOG_SIZE=Yes
|
2017-07-01 20:24:20 +02:00
|
|
|
USE_PHYSICAL_NAMES=Yes
|
|
|
|
USE_RT_NAMES=Yes
|
|
|
|
VERBOSE_MESSAGES=No
|
|
|
|
WARNOLDCAPVERSION=Yes
|
|
|
|
WORKAROUNDS=No
|
2017-10-16 04:15:13 +02:00
|
|
|
ZERO_MARKS=No
|
2017-07-01 20:24:20 +02:00
|
|
|
ZONE2ZONE=-
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# P A C K E T D I S P O S I T I O N
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
BLACKLIST_DISPOSITION=DROP
|
|
|
|
INVALID_DISPOSITION=CONTINUE
|
|
|
|
MACLIST_DISPOSITION=ACCEPT
|
|
|
|
RELATED_DISPOSITION=REJECT
|
|
|
|
RPFILTER_DISPOSITION=DROP
|
|
|
|
SMURF_DISPOSITION=DROP
|
|
|
|
SFILTER_DISPOSITION=DROP
|
|
|
|
TCP_FLAGS_DISPOSITION=DROP
|
|
|
|
UNTRACKED_DISPOSITION=DROP
|
|
|
|
################################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# P A C K E T M A R K L A Y O U T
|
2017-07-01 20:24:20 +02:00
|
|
|
################################################################################
|
|
|
|
TC_BITS=8
|
|
|
|
PROVIDER_BITS=2
|
|
|
|
PROVIDER_OFFSET=16
|
|
|
|
MASK_BITS=8
|
2020-04-25 23:48:45 +02:00
|
|
|
ZONE_BITS=0</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>shorewall6.conf</title>
|
|
|
|
|
|
|
|
<para>The contents of /etc/shorewall6/shorewall6.conf are:</para>
|
|
|
|
|
|
|
|
<programlisting>###############################################################################
|
2017-10-16 04:15:13 +02:00
|
|
|
#
|
|
|
|
# Shorewall Version 5 -- /etc/shorewall6/shorewall6.conf
|
|
|
|
#
|
|
|
|
# For information about the settings in this file, type "man shorewall6.conf"
|
|
|
|
#
|
|
|
|
# Manpage also online at
|
2020-04-25 23:48:45 +02:00
|
|
|
# http://www.shorewall.net/manpages6/shorewall6.conf.html
|
2017-10-16 04:15:13 +02:00
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# S T A R T U P E N A B L E D
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
STARTUP_ENABLED=Yes
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# V E R B O S I T Y
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
VERBOSITY=1
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# P A G E R
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
PAGER=pager
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# F I R E W A L L
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
FIREWALL=
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# L O G G I N G
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
LOG_LEVEL="NFLOG(0,64,1)"
|
|
|
|
BLACKLIST_LOG_LEVEL="none"
|
|
|
|
INVALID_LOG_LEVEL=
|
|
|
|
LOG_BACKEND=netlink
|
|
|
|
LOG_VERBOSITY=2
|
2020-04-25 23:48:45 +02:00
|
|
|
LOG_ZONE=Src
|
2017-07-01 20:24:20 +02:00
|
|
|
LOGALLNEW=
|
|
|
|
LOGFILE=/var/log/ulogd/ulogd.syslogemu.log
|
2020-04-25 23:48:45 +02:00
|
|
|
LOGFORMAT="%s %s"
|
2017-07-01 20:24:20 +02:00
|
|
|
LOGLIMIT="s:5/min"
|
|
|
|
LOGTAGONLY=Yes
|
|
|
|
MACLIST_LOG_LEVEL="$LOG_LEVEL"
|
2020-07-06 17:56:31 +02:00
|
|
|
RELATED_LOG_LEVEL="$LOG_LEVEL"
|
2017-07-01 20:24:20 +02:00
|
|
|
RPFILTER_LOG_LEVEL="$LOG_LEVEL"
|
|
|
|
SFILTER_LOG_LEVEL="$LOG_LEVEL"
|
|
|
|
SMURF_LOG_LEVEL="$LOG_LEVEL"
|
|
|
|
STARTUP_LOG=/var/log/shorewall6-init.log
|
|
|
|
TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
|
|
|
|
UNTRACKED_LOG_LEVEL=
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
2017-10-16 04:15:13 +02:00
|
|
|
CONFIG_PATH="${CONFDIR}/shorewall6:${CONFDIR}/shorewall:/usr/share/shorewall6:${SHAREDIR}/shorewall"
|
2017-07-01 20:24:20 +02:00
|
|
|
GEOIPDIR=/usr/share/xt_geoip/LE
|
|
|
|
IP6TABLES=
|
|
|
|
IP=
|
|
|
|
IPSET=
|
|
|
|
LOCKFILE=
|
|
|
|
MODULESDIR="+extra/RTPENGINE"
|
|
|
|
NFACCT=
|
|
|
|
PERL=/usr/bin/perl
|
|
|
|
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin"
|
|
|
|
RESTOREFILE=restore
|
|
|
|
SHOREWALL_SHELL=/bin/sh
|
|
|
|
SUBSYSLOCK=/var/lock/subsys/shorewall6
|
|
|
|
TC=
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# D E F A U L T A C T I O N S / M A C R O S
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
ACCEPT_DEFAULT="none"
|
2020-07-05 00:25:03 +02:00
|
|
|
BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),NotSyn(DROP):$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
|
2017-07-01 20:24:20 +02:00
|
|
|
DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
|
|
|
|
NFQUEUE_DEFAULT="none"
|
|
|
|
QUEUE_DEFAULT="none"
|
|
|
|
REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# R S H / R C P C O M M A N D S
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
|
|
|
|
RSH_COMMAND='ssh ${root}@${system} ${command}'
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# F I R E W A L L O P T I O N S
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
ACCOUNTING=Yes
|
|
|
|
ACCOUNTING_TABLE=mangle
|
|
|
|
ADMINISABSENTMINDED=Yes
|
|
|
|
AUTOCOMMENT=Yes
|
2017-10-16 04:15:13 +02:00
|
|
|
AUTOHELPERS=No
|
2017-07-01 20:24:20 +02:00
|
|
|
AUTOMAKE=Yes
|
|
|
|
BALANCE_PROVIDERS=No
|
|
|
|
BASIC_FILTERS=No
|
|
|
|
BLACKLIST="NEW,INVALID,UNTRACKED"
|
|
|
|
CLAMPMSS=Yes
|
|
|
|
CLEAR_TC=No
|
|
|
|
COMPLETE=No
|
|
|
|
DEFER_DNS_RESOLUTION=Yes
|
|
|
|
DELETE_THEN_ADD=No
|
|
|
|
DONT_LOAD=
|
2020-07-05 00:25:03 +02:00
|
|
|
DYNAMIC_BLACKLIST="ipset-only,disconnect,timeout=7200,log,noupdate"
|
|
|
|
EXPAND_POLICIES=No
|
2017-07-01 20:24:20 +02:00
|
|
|
EXPORTMODULES=Yes
|
|
|
|
FASTACCEPT=Yes
|
2017-10-16 04:15:13 +02:00
|
|
|
FORWARD_CLEAR_MARK=No
|
|
|
|
HELPERS=ftp
|
2017-07-01 20:24:20 +02:00
|
|
|
IGNOREUNKNOWNVARIABLES=No
|
|
|
|
IMPLICIT_CONTINUE=No
|
|
|
|
IPSET_WARNINGS=Yes
|
|
|
|
IP_FORWARDING=Keep
|
|
|
|
KEEP_RT_TABLES=Yes
|
|
|
|
MACLIST_TABLE=filter
|
|
|
|
MACLIST_TTL=
|
|
|
|
MANGLE_ENABLED=Yes
|
|
|
|
MARK_IN_FORWARD_CHAIN=No
|
2017-10-16 04:15:13 +02:00
|
|
|
MINIUPNPD=No
|
2017-07-01 20:24:20 +02:00
|
|
|
MUTEX_TIMEOUT=60
|
|
|
|
OPTIMIZE=All
|
|
|
|
OPTIMIZE_ACCOUNTING=No
|
|
|
|
PERL_HASH_SEED=0
|
|
|
|
REJECT_ACTION=
|
2020-04-25 23:48:45 +02:00
|
|
|
RENAME_COMBINED=No
|
2017-07-01 20:24:20 +02:00
|
|
|
REQUIRE_INTERFACE=No
|
|
|
|
RESTART=restart
|
2017-10-16 04:15:13 +02:00
|
|
|
RESTORE_DEFAULT_ROUTE=No
|
2017-07-01 20:24:20 +02:00
|
|
|
RESTORE_ROUTEMARKS=Yes
|
|
|
|
SAVE_IPSETS=No
|
|
|
|
TC_ENABLED=Shared
|
|
|
|
TC_EXPERT=No
|
|
|
|
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
|
|
|
|
TRACK_PROVIDERS=Yes
|
|
|
|
TRACK_RULES=No
|
|
|
|
USE_DEFAULT_RT=Yes
|
2017-10-16 04:15:13 +02:00
|
|
|
USE_NFLOG_SIZE=Yes
|
2020-04-25 23:48:45 +02:00
|
|
|
USE_PHYSICAL_NAMES=Yes
|
2017-07-01 20:24:20 +02:00
|
|
|
USE_RT_NAMES=No
|
2017-10-16 04:15:13 +02:00
|
|
|
VERBOSE_MESSAGES=No
|
2017-07-01 20:24:20 +02:00
|
|
|
WARNOLDCAPVERSION=Yes
|
|
|
|
WORKAROUNDS=No
|
|
|
|
ZERO_MARKS=No
|
|
|
|
ZONE2ZONE=-
|
|
|
|
###############################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# P A C K E T D I S P O S I T I O N
|
2017-07-01 20:24:20 +02:00
|
|
|
###############################################################################
|
|
|
|
BLACKLIST_DISPOSITION=DROP
|
|
|
|
INVALID_DISPOSITION=CONTINUE
|
|
|
|
MACLIST_DISPOSITION=REJECT
|
|
|
|
RELATED_DISPOSITION=REJECT
|
|
|
|
SFILTER_DISPOSITION=DROP
|
|
|
|
RPFILTER_DISPOSITION=DROP
|
|
|
|
SMURF_DISPOSITION=DROP
|
|
|
|
TCP_FLAGS_DISPOSITION=DROP
|
|
|
|
UNTRACKED_DISPOSITION=DROP
|
|
|
|
################################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# P A C K E T M A R K L A Y O U T
|
2017-07-01 20:24:20 +02:00
|
|
|
################################################################################
|
|
|
|
TC_BITS=8
|
|
|
|
PROVIDER_BITS=2
|
|
|
|
PROVIDER_OFFSET=8
|
|
|
|
MASK_BITS=8
|
|
|
|
ZONE_BITS=0
|
|
|
|
</programlisting>
|
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>params</title>
|
|
|
|
|
|
|
|
<para>Because addresses and interfaces are different between the two
|
|
|
|
address families, they cannot be hard-coded in the configuration files.
|
2017-07-10 01:17:16 +02:00
|
|
|
<filename>/etc/shorewall/params</filename> is used to set shell
|
|
|
|
variables whose contents will vary between Shorewall and Shorewall6. In
|
|
|
|
the <filename>params</filename> file and in run-time extension files,
|
|
|
|
the shell variable <emphasis role="bold">g_family</emphasis> can be used
|
|
|
|
to determine which address family to use; if IPv4, then $g_family will
|
|
|
|
expand to 4 and if IPv6, $g_family will expand to 6.</para>
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
<para>The contents of /etc/shorewall/params is as follows:</para>
|
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<programlisting>#
|
2017-07-01 20:24:20 +02:00
|
|
|
# Set compile-time variables depending on the address family
|
|
|
|
#
|
|
|
|
if [ $g_family = 4 ]; then
|
|
|
|
#
|
|
|
|
# IPv4 compilation
|
|
|
|
#
|
2020-04-25 23:48:45 +02:00
|
|
|
FALLBACK=Yes # Make FAST_IF the primary and PROD_IF the fallback interface
|
2017-07-01 20:24:20 +02:00
|
|
|
# See /etc/shorewall/providers
|
2020-07-05 00:25:03 +02:00
|
|
|
STATISTICAL= # Use statistical load balancing
|
|
|
|
LISTS=70.90.191.124 # IP address of lists.shorewall.net (MX)
|
|
|
|
MAIL=70.90.191.122 # IP address of mail.shorewall.net (IMAPS)
|
2020-04-25 23:48:45 +02:00
|
|
|
SERVER=70.90.191.125 # IP address of www.shorewall.org
|
2020-07-05 00:25:03 +02:00
|
|
|
IRSSIEXT=10.2.10.2 # External address of irssi.shorewall.net
|
2020-04-25 23:48:45 +02:00
|
|
|
IRSSIINT=172.20.2.44 # Internal IP address of irssi.shorewall.net
|
2020-07-05 00:25:03 +02:00
|
|
|
PROXY=Yes # Use TPROXY for local web access
|
|
|
|
ALL=0.0.0.0/0 # Entire address space
|
2017-07-01 20:24:20 +02:00
|
|
|
LOC_ADDR=172.20.1.253 # IP address of the local LAN interface
|
|
|
|
FAST_GATEWAY=10.2.10.1 # Default gateway through the IF_FAST interface
|
2020-07-05 00:25:03 +02:00
|
|
|
FAST_MARK=0x20000 # Multi-ISP mark setting for IF_FAST
|
2017-10-16 04:15:13 +02:00
|
|
|
IPSECMSS=1460
|
2020-07-05 00:25:03 +02:00
|
|
|
DBL_SET=SW_DBL4
|
2017-07-01 20:24:20 +02:00
|
|
|
#
|
|
|
|
# Interface Options
|
|
|
|
#
|
2020-07-06 17:56:31 +02:00
|
|
|
LOC_OPTIONS=dhcp,ignore=1,wait=5,routefilter,tcpflags=0,nodbl,physical=eth2.2
|
|
|
|
WLAN_OPTIONS=dhcp,ignore=1,wait=5,routefilter,tcpflags=0,nodbl,physical=eth2.1
|
2020-04-25 23:48:45 +02:00
|
|
|
FAST_OPTIONS=optional,dhcp,tcpflags,nosmurfs,sourceroute=0,arp_ignore=1,proxyarp=0,nosmurfs,rpfilter,physical=eth0
|
|
|
|
PROD_OPTIONS=optional,dhcp,tcpflags,nosmurfs,sourceroute=0,arp_ignore=1,proxyarp=0,nosmurfs,rpfilter,physical=eth1
|
|
|
|
DMZ_OPTIONS=routeback,proxyarp=1,required,wait=30,nets=70.90.191.120/29,nodbl,physical=br0
|
2017-07-01 20:24:20 +02:00
|
|
|
IRC_OPTIONS=routeback,proxyarp=1,required,wait=30,nets=172.20.2.0/24,dhcp,nodbl,physical=br1
|
2020-07-05 00:25:03 +02:00
|
|
|
SWCH_OPTIONS=dhcp,tcpflags=0,nodbl,physical=eth2
|
2017-07-01 20:24:20 +02:00
|
|
|
else
|
|
|
|
#
|
|
|
|
# IPv6 compilation
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
FALLBACK=Yes # Make FAST_IF the primary and PROD_IF the fallback interface
|
|
|
|
# See /etc/shorewall/providers
|
|
|
|
STATISTICAL=No # Don't use statistical load balancing
|
|
|
|
LISTS=[2001:470:b:227::42] # IP address of lists.shorewall.net (MX and HTTPS)
|
|
|
|
MAIL=[2001:470:b:227::45] # IP address of mail.shorewall.net (IMAPS and HTTPS)
|
|
|
|
SERVER=[2001:470:b:227::43] # IP address of server.shorewall.net(FTP)
|
|
|
|
IRSSI=[2601:601:a000:16f1::]/64 # IP address of irssi.shorewall.net
|
|
|
|
PROXY=Yes # Use TPROXY for local web access
|
|
|
|
ALL=[::]/0 # Entire address space
|
|
|
|
LOC_ADDR=[2601:601:a000:16f0::1] # IP address of the local LAN interface
|
2020-04-25 23:48:45 +02:00
|
|
|
FAST_GATEWAY=2601:601:a000:1600:22e5:2aff:feb7:f2cf
|
2020-07-05 00:25:03 +02:00
|
|
|
FAST_MARK=0x100 # Multi-ISP mark setting for IF_FAST
|
2017-10-16 04:15:13 +02:00
|
|
|
IPSECMSS=1440
|
2020-07-05 00:25:03 +02:00
|
|
|
DBL_SET=SW_DBL6
|
2017-07-01 20:24:20 +02:00
|
|
|
#
|
|
|
|
# Interface Options
|
|
|
|
#
|
2020-04-25 23:48:45 +02:00
|
|
|
PROD_OPTIONS=forward=1,optional,rpfilter,routeback,physical=sit1
|
|
|
|
FAST_OPTIONS=forward=1,optional,dhcp,rpfilter,physical=eth0
|
2020-07-05 00:25:03 +02:00
|
|
|
LOC_OPTIONS=forward=1,nodbl,routeback,physical=eth2.2
|
2017-07-01 20:24:20 +02:00
|
|
|
DMZ_OPTIONS=routeback,forward=1,required,wait=30,nodbl,physical=br0
|
|
|
|
IRC_OPTIONS=routeback,forward=1,required,wait=30,nodbl,physical=br1
|
2020-07-05 00:25:03 +02:00
|
|
|
WLAN_OPTIONS=forward=1,nodbl,routeback,physical=eth2.1
|
2017-10-16 04:15:13 +02:00
|
|
|
fi</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>zones</title>
|
|
|
|
|
|
|
|
<para>Here is the /etc/shorewall/zones file:</para>
|
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<programlisting>#ZONE TYPE OPTIONS IN OUT
|
2017-07-01 20:24:20 +02:00
|
|
|
# OPTIONS OPTIONS
|
2020-07-05 00:25:03 +02:00
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
#
|
|
|
|
# By using the 'ip' type, both Shorewall and Shorewall6 can share this file
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
fw { TYPE=firewall }
|
|
|
|
net { TYPE=ip }
|
|
|
|
loc { TYPE=ip }
|
|
|
|
dmz { TYPE=ip }
|
|
|
|
apps { TYPE=ip }
|
2017-10-16 04:15:13 +02:00
|
|
|
vpn { TYPE=ipsec, OPTIONS=mode=tunnel,proto=esp,mss=$IPSECMSS }
|
2020-07-05 00:25:03 +02:00
|
|
|
wlan { TYPE=ip }
|
|
|
|
?if __IPV4
|
2020-07-06 17:56:31 +02:00
|
|
|
swch { TYPE=local }
|
2020-07-05 00:25:03 +02:00
|
|
|
?endif</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>interfaces</title>
|
|
|
|
|
|
|
|
<para>/etc/shorewall/interfaces makes heavy use of variables set in
|
|
|
|
/etc/shorewall/params:</para>
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
<programlisting>?FORMAT 2
|
|
|
|
###############################################################################
|
|
|
|
#ZONE INTERFACE OPTIONS
|
|
|
|
|
|
|
|
#
|
2017-10-16 04:15:13 +02:00
|
|
|
# The two address families use different production interfaces and different
|
|
|
|
#
|
2017-07-01 20:24:20 +02:00
|
|
|
# LOC_IF is the local LAN for both families
|
|
|
|
# FAST_IF is a Comcast IPv6 beta uplink which is used for internet access from the local lan for both families
|
|
|
|
# PROD_IF is the interface used by shorewall.org servers
|
|
|
|
# For IPv4, it is eth1
|
|
|
|
# For IPv6, it is sit1 (Hurricane Electric 6in4 link)
|
|
|
|
# DMZ_IF is a bridge to the production containers
|
|
|
|
# IRC_IF is a bridge to a container that currently runs irssi under screen
|
2020-07-05 00:25:03 +02:00
|
|
|
# WLAN_IF is a vlan interface that connects to the wireless networks
|
|
|
|
# SWCH_IF is the vlan trunk interface used for switch management
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
loc { INTERFACE=LOC_IF, OPTIONS=$LOC_OPTIONS }
|
2020-07-05 00:25:03 +02:00
|
|
|
wlan { INTERFACE=WLAN_IF, OPTIONS=$WLAN_OPTIONS }
|
2017-07-01 20:24:20 +02:00
|
|
|
net { INTERFACE=FAST_IF, OPTIONS=$FAST_OPTIONS }
|
|
|
|
net { INTERFACE=PROD_IF, OPTIONS=$PROD_OPTIONS }
|
|
|
|
dmz { INTERFACE=DMZ_IF, OPTIONS=$DMZ_OPTIONS }
|
2020-07-05 00:25:03 +02:00
|
|
|
apps { INTERFACE=IRC_IF, OPTIONS=$IRC_OPTIONS }
|
|
|
|
?if __IPV4
|
|
|
|
swch { INTERFACE=SWCH_IF, OPTIONS=$SWCH_OPTIONS }
|
|
|
|
?endif</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>hosts</title>
|
|
|
|
|
|
|
|
<para>/etc/shorewall/hosts is used to define the vpn zone:</para>
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
<programlisting>##ZONE HOSTS OPTIONS
|
2017-10-18 01:51:35 +02:00
|
|
|
vpn { HOSTS=PROD_IF:$ALL }
|
|
|
|
vpn { HOSTS=FAST_IF:$ALL }
|
2020-04-25 23:48:45 +02:00
|
|
|
vpn { HOSTS=LOC_IF:$ALL }</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>policy</title>
|
|
|
|
|
|
|
|
<para>The same set of policies apply to both address families:</para>
|
|
|
|
|
2020-07-06 17:56:31 +02:00
|
|
|
<programlisting>SOURCE DEST POLICY LOGLEVEL RATE
|
2017-10-16 04:15:13 +02:00
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
$FW { DEST=dmz,net, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
2017-10-16 04:15:13 +02:00
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
?if __IPV4
|
2020-07-05 00:25:03 +02:00
|
|
|
$FW { DEST=all, POLICY=ACCEPT:Broadcast(ACCEPT),Multicast(ACCEPT), LOGLEVEL=$LOG_LEVEL }
|
2020-04-25 23:48:45 +02:00
|
|
|
?else
|
2020-07-05 00:25:03 +02:00
|
|
|
$FW { DEST=all, POLICY=ACCEPT:AllowICMPs,Broadcast(ACCEPT),Multicast(ACCEPT) LOGLEVEL=$LOG_LEVEL }
|
2020-04-25 23:48:45 +02:00
|
|
|
?endif
|
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
loc,apps,wlan { DEST=net, POLICY=ACCEPT }
|
|
|
|
loc,vpn,apps { DEST=loc,vpn,apps POLICY=ACCEPT }
|
|
|
|
loc { DEST=fw, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
2017-10-16 04:15:13 +02:00
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
?if __IPV4
|
2020-07-05 00:25:03 +02:00
|
|
|
net { DEST=net, POLICY=NONE }
|
2020-04-25 23:48:45 +02:00
|
|
|
?else
|
2020-07-05 00:25:03 +02:00
|
|
|
net { DEST=net, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
2020-04-25 23:48:45 +02:00
|
|
|
?endif
|
2020-07-05 00:25:03 +02:00
|
|
|
net { DEST=fw, POLICY=BLACKLIST:+Broadcast(DROP),Multicast(DROP),DropDNSrep:$LOG_LEVEL, LOGLEVEL=$LOG_LEVEL, RATE=8/sec:30 }
|
|
|
|
net { DEST=all, POLICY=BLACKLIST:+DropDNSrep:$LOG_LEVEL, LOGLEVEL=$LOG_LEVEL, RATE=8/sec:30 }
|
2017-10-16 04:15:13 +02:00
|
|
|
|
2020-07-06 17:56:31 +02:00
|
|
|
dmz { DEST=fw, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
|
|
|
dmz { DEST=dmz, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
|
|
|
all { DEST=all, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>providers</title>
|
|
|
|
|
|
|
|
<para>The providers file is set up to allow for three different
|
|
|
|
configurations:</para>
|
|
|
|
|
|
|
|
<orderedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>FALLBACK -- FAST_IF is the primary interface and PROD_IF is
|
|
|
|
the fallback</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>STATISTICAL -- Statistical load balancing between FAST_IF and
|
|
|
|
PROD_IF</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>IPv4 only -- balance between FAST_IF and PROD_IF</para>
|
|
|
|
</listitem>
|
|
|
|
</orderedlist>
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
<programlisting>#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY
|
|
|
|
|
|
|
|
#
|
2017-07-01 20:24:20 +02:00
|
|
|
# This could be cleaned up a bit, but I'm leaving it as is for now
|
|
|
|
#
|
|
|
|
# - The two address families use different fw mark geometry
|
|
|
|
# - The two address families use different fallback interfaces
|
|
|
|
# - The 'balance' option doesn't work as expected in IPv6 so I have no balance configuration for Shorewall6
|
|
|
|
# - IPv4 uses the 'loose' option on PROD_IF
|
|
|
|
#
|
|
|
|
?if $FALLBACK
|
|
|
|
# FAST_IF is primary, PROD_IF is fallback
|
|
|
|
#
|
2020-04-25 23:48:45 +02:00
|
|
|
?if $VERBOSITY > 0
|
|
|
|
?info Compiling with FALLBACK
|
|
|
|
?endif
|
2017-10-16 04:15:13 +02:00
|
|
|
IPv6Beta { NUMBER=1, MARK=$FAST_MARK, INTERFACE=FAST_IF, GATEWAY=$FAST_GATEWAY, OPTIONS=loose,primary,persistent,noautosrc }
|
2017-07-01 20:24:20 +02:00
|
|
|
?if __IPV4
|
|
|
|
ComcastB { NUMBER=4, MARK=0x10000, INTERFACE=PROD_IF, GATEWAY=10.1.10.1, OPTIONS=loose,fallback,persistent }
|
|
|
|
?else
|
|
|
|
HE { NUMBER=2, MARK=0x200, INTERFACE=PROD_IF, OPTIONS=fallback,persistent }
|
|
|
|
?endif
|
|
|
|
?elsif $STATISTICAL
|
|
|
|
# Statistically balance traffic between FAST_IF and PROD_IF
|
2020-04-25 23:48:45 +02:00
|
|
|
?if $VERBOSITY > 0
|
|
|
|
?info Compiling with STATISTICAL
|
|
|
|
?endif
|
2017-07-01 20:24:20 +02:00
|
|
|
?if __IPV4
|
2020-04-25 23:48:45 +02:00
|
|
|
IPv6Beta { NUMBER=1, MARK=0x20000, INTERFACE=FAST_IF, GATEWAY=$FAST_GATEWAY, OPTIONS=loose,load=0.66666667,primary,persistent }
|
|
|
|
ComcastB { NUMBER=4, MARK=0x10000, INTERFACE=PROD_IF, GATEWAY=10.1.10.1, OPTIONS=loose,load=0.33333333,fallback,persistent }
|
2017-07-01 20:24:20 +02:00
|
|
|
?else
|
|
|
|
HE { NUMBER=2, MARK=0x200, INTERFACE=PROD_IF, OPTIONS=track,load=0.33333333,persistent }
|
|
|
|
?endif
|
|
|
|
?else
|
2020-04-25 23:48:45 +02:00
|
|
|
?if $VERBOSITY > 0
|
|
|
|
?info Compiling with BALANCE
|
|
|
|
?endif
|
|
|
|
IPv6Beta { NUMBER=1, MARK=$FAST_MARK, INTERFACE=FAST_IF, GATEWAY=$FAST_GATEWAY, OPTIONS=track,balance=2,loose,persistent }
|
2017-07-01 20:24:20 +02:00
|
|
|
?if __IPV4
|
2020-04-25 23:48:45 +02:00
|
|
|
ComcastB { NUMBER=4, MARK=0x10000, INTERFACE=PROD_IF, GATEWAY=10.1.10.1, OPTIONS=nohostroute,loose,balance,persistent }
|
2017-07-01 20:24:20 +02:00
|
|
|
?else
|
2017-10-16 04:15:13 +02:00
|
|
|
?warning No BALANCE IPv6 configuration
|
2017-07-01 20:24:20 +02:00
|
|
|
HE { NUMBER=2, MARK=0x200, INTERFACE=PROD_IF, OPTIONS=fallback,persistent }
|
2017-10-16 04:15:13 +02:00
|
|
|
?endif
|
2017-07-01 20:24:20 +02:00
|
|
|
?endif
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
Tproxy { NUMBER=3, INTERFACE=lo, OPTIONS=tproxy }</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>rtrules</title>
|
|
|
|
|
|
|
|
<para>The routing rules are quite dependent on the address
|
|
|
|
family:</para>
|
|
|
|
|
|
|
|
<programlisting>#SOURCE DEST PROVIDER PRIORITY
|
|
|
|
|
|
|
|
#
|
|
|
|
# This file ensures that the DMZ is routed out of the IF_PROD interface
|
2017-10-16 04:15:13 +02:00
|
|
|
# and that the IPv6 subnets delegated by the Beta router are routed out
|
2017-07-01 20:24:20 +02:00
|
|
|
# of the IF_FAST interface.
|
|
|
|
#
|
|
|
|
?if __IPV4
|
2017-10-16 04:15:13 +02:00
|
|
|
{ SOURCE=70.90.191.121,70.90.191.123,10.1.10.1 PROVIDER=ComcastB, PRIORITY=1000! }
|
|
|
|
{ SOURCE=&FAST_IF, PROVIDER=IPv6Beta, PRIORITY=1000! }
|
|
|
|
{ SOURCE=br0, PROVIDER=ComcastB, PRIORITY=11000 }
|
2017-07-01 20:24:20 +02:00
|
|
|
?else
|
2017-11-08 18:44:40 +01:00
|
|
|
{ SOURCE=2601:601:a000:1600::/64 PROVIDER=IPv6Beta, PRIORITY=1000! }
|
|
|
|
{ SOURCE=2001:470:B:227::/64, PROVIDER=HE, PRIORITY=1000! }
|
2017-10-16 04:15:13 +02:00
|
|
|
{ SOURCE=2601:601:a000:16f0::/60 PROVIDER=IPv6Beta, PRIORITY=11000 }
|
|
|
|
?endif</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
2017-11-08 18:44:40 +01:00
|
|
|
<section>
|
|
|
|
<title>routes</title>
|
|
|
|
|
|
|
|
<para>This file is used only for IPv6:</para>
|
|
|
|
|
|
|
|
<programlisting>#PROVIDER DEST GATEWAY DEVICE OPTIONS
|
|
|
|
?if __IPV6
|
|
|
|
#
|
|
|
|
# In my version of FOOLSM (1.0.10), the 'sourceip' option doesn't work.
|
|
|
|
# As a result, routing rules that specify the source IPv6 address are
|
|
|
|
# not effective in routing the 'ping' request packets out of FAST_IF.
|
|
|
|
# The following route solves that problem.
|
|
|
|
#
|
2020-04-25 23:48:45 +02:00
|
|
|
{ PROVIDER=main, DEST=2001:558:4082:d3::1/128, GATEWAY=$FAST_GATEWAY, DEVICE=FAST_IF, OPTIONS=persistent }
|
2017-11-08 18:44:40 +01:00
|
|
|
?endif</programlisting>
|
|
|
|
</section>
|
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
<section>
|
|
|
|
<title>actions</title>
|
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<para>/etc/shorewall/actions defines a single action:</para>
|
|
|
|
|
|
|
|
<programlisting>#ACTION OPTIONS COMMENT
|
|
|
|
SSHLIMIT proto=tcp,\ # Blacklist overzealous SSHers
|
2020-07-06 17:56:31 +02:00
|
|
|
dport=ssh</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<para>/etc/shorewall/action.SSHLIMIT:</para>
|
2017-07-01 20:24:20 +02:00
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<programlisting>ACCEPT { RATE=s:3/min:3 }
|
|
|
|
BLACKLIST:$LOG_LEVEL:net_SSHLIMIT</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
2017-10-16 04:15:13 +02:00
|
|
|
<section>
|
|
|
|
<title>Macros</title>
|
|
|
|
|
|
|
|
<para>/etc/shorewall/macro.FTP:</para>
|
|
|
|
|
|
|
|
<programlisting>###############################################################################
|
|
|
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
|
|
|
PARAM - - tcp 21
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
<para>This is just the normal Shorewall FTP macro without the helper
|
|
|
|
logic -- we take care of that in the conntrack file below.</para>
|
|
|
|
</section>
|
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
<section>
|
|
|
|
<title>conntrack</title>
|
|
|
|
|
|
|
|
<para>In addition to invoking the FTP helper on TCP port 21, this file
|
|
|
|
notracks some IPv4 traffic:</para>
|
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<programlisting>?FORMAT 3
|
|
|
|
######################################################################################################
|
|
|
|
#ACTION SOURCE DEST PROTO DPORT SPORT USER SWITCH
|
2017-07-01 20:24:20 +02:00
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
CT:helper:ftp:P { PROTO=tcp, DPORT=21 }
|
|
|
|
CT:helper:ftp:O { PROTO=tcp, DPORT=21 }
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
?if __IPV4
|
|
|
|
#
|
|
|
|
# Don't track IPv4 broadcasts
|
|
|
|
#
|
|
|
|
NOTRACK:P { SOURCE=LOC_IF, DEST=172.20.1.255, PROTO=udp }
|
|
|
|
NOTRACK:P { DEST=255.255.255.255, PROTO=udp }
|
|
|
|
NOTRACK:O { DEST=255.255.255.255, PROTO=udp }
|
2020-07-05 00:25:03 +02:00
|
|
|
NOTRACK:O { DEST=LOC_IF:172.20.0.255, PROTO=udp }
|
|
|
|
NOTRACK:O { DEST=LOC_IF:172.20.1.255, PROTO=udp }
|
|
|
|
NOTRACK:O { DEST=PROD_IF:70.90.191.127, PROTO=udp }
|
|
|
|
?endif</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>rules</title>
|
|
|
|
|
|
|
|
<para>/etc/shorewall/rules has only a couple of rules that are
|
|
|
|
conditional based on address family:</para>
|
|
|
|
|
2020-07-06 17:56:31 +02:00
|
|
|
<programlisting>##############################################################################################################################################################
|
|
|
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
?SECTION ALL
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
Ping(ACCEPT) { SOURCE=net, DEST=all, RATE=d:ping(1024,65536):2/sec:10 }
|
|
|
|
Trcrt(ACCEPT) { SOURCE=net, DEST=all, RATE=d:ping(1024,65536):2/sec:10 }
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
?SECTION ESTABLISHED
|
|
|
|
|
|
|
|
?SECTION RELATED
|
|
|
|
|
|
|
|
ACCEPT { SOURCE=all, DEST=dmz:$SERVER, PROTO=tcp, DPORT=61001:62000, helper=ftp }
|
|
|
|
ACCEPT { SOURCE=dmz, DEST=all, PROTO=tcp, helper=ftp }
|
|
|
|
ACCEPT { SOURCE=all, DEST=net, PROTO=tcp, helper=ftp }
|
2017-10-16 04:15:13 +02:00
|
|
|
ACCEPT { SOURCE=$FW, DEST=loc, PROTO=tcp, helper=ftp }
|
|
|
|
ACCEPT { SOURCE=loc, DEST=$FW, PROTO=tcp, helper=ftp }
|
2017-07-01 20:24:20 +02:00
|
|
|
ACCEPT { SOURCE=all, DEST=all, PROTO=icmp }
|
|
|
|
RST(ACCEPT) { SOURCE=all, DEST=all }
|
|
|
|
ACCEPT { SOURCE=dmz, DEST=dmz }
|
2020-07-06 17:56:31 +02:00
|
|
|
ACCEPT { SOURCE=$FW, DEST=$FW, PROTO=icmp }
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
?SECTION INVALID
|
|
|
|
|
|
|
|
RST(ACCEPT) { SOURCE=all, DEST=all }
|
2020-04-25 23:48:45 +02:00
|
|
|
FIN(ACCEPT) { SOURCE=all, DEST=all }
|
2017-07-01 20:24:20 +02:00
|
|
|
DROP { SOURCE=net, DEST=all }
|
|
|
|
|
|
|
|
?SECTION UNTRACKED
|
|
|
|
|
|
|
|
?if __IPV4
|
|
|
|
Broadcast(ACCEPT) { SOURCE=all, DEST=$FW }
|
|
|
|
ACCEPT { SOURCE=all, DEST=$FW, PROTO=udp }
|
|
|
|
CONTINUE { SOURCE=loc, DEST=$FW }
|
|
|
|
CONTINUE { SOURCE=$FW, DEST=all }
|
|
|
|
?endif
|
|
|
|
|
|
|
|
?SECTION NEW
|
|
|
|
|
|
|
|
######################################################################################################
|
|
|
|
# Stop certain outgoing traffic to the net
|
|
|
|
#
|
2017-10-16 04:15:13 +02:00
|
|
|
REJECT:$LOG_LEVEL { SOURCE=loc,vpn,apps DEST=net, PROTO=tcp, DPORT=25 } #Stop direct loc->net SMTP (Comcast uses submission).
|
2020-04-25 23:48:45 +02:00
|
|
|
#REJECT:$LOG_LEVEL { SOURCE=loc,vpn,apps DEST=net, PROTO=udp, DPORT=1025:1031 } #MS Messaging
|
2017-07-01 20:24:20 +02:00
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
REJECT { SOURCE=all!dmz,apps, DEST=net, PROTO=tcp, DPORT=137,445, comment="Stop NETBIOS Crap" }
|
|
|
|
REJECT { SOURCE=all!dmz,apps, DEST=net, PROTO=udp, DPORT=137:139, comment="Stop NETBIOS Crap" }
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
REJECT { SOURCE=all, DEST=net, PROTO=tcp, DPORT=3333, comment="Disallow port 3333" }
|
|
|
|
|
|
|
|
REJECT { SOURCE=all, DEST=net, PROTO=udp, DPORT=3544, comment="Stop Teredo" }
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
?if __IPV6
|
|
|
|
DROP { SOURCE=net:PROD_IF, DEST=net:PROD_IF }
|
|
|
|
?endif
|
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
?COMMENT
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
######################################################################################################
|
|
|
|
# SACK
|
|
|
|
#
|
|
|
|
DROP:$LOG_LEVEL { SOURCE=net, DEST=all } ;;+ -p tcp -m tcpmss --mss 1:535
|
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
######################################################################################################
|
|
|
|
# 6in4
|
|
|
|
#
|
|
|
|
?if __IPV4
|
|
|
|
ACCEPT { SOURCE=net:216.218.226.238, DEST=$FW, PROTO=41 }
|
|
|
|
ACCEPT { SOURCE=$FW, DEST=net:216.218.226.238, PROTO=41 }
|
|
|
|
?endif
|
|
|
|
######################################################################################################
|
|
|
|
# Ping
|
|
|
|
#
|
2020-07-06 17:56:31 +02:00
|
|
|
Ping(ACCEPT) { SOURCE=all!net, DEST=all }
|
2020-04-25 23:48:45 +02:00
|
|
|
Ping(ACCEPT) { SOURCE=dmz, DEST=dmz }
|
2020-07-06 17:56:31 +02:00
|
|
|
?if __IPV4
|
|
|
|
Ping(ACCEPT) { source=$FW, DEST=swch }
|
|
|
|
?endif
|
2017-07-01 20:24:20 +02:00
|
|
|
######################################################################################################
|
2020-07-05 00:25:03 +02:00
|
|
|
# Logging
|
|
|
|
#
|
|
|
|
Syslog(ACCEPT) { SOURCE=dmz, DEST=$FW }
|
|
|
|
######################################################################################################
|
2017-07-01 20:24:20 +02:00
|
|
|
# SSH
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
SSH(DROP) { SOURCE=net, DEST=dmz:$SERVER }
|
|
|
|
SSHLIMIT { SOURCE=net, DEST=all }
|
2017-07-01 20:24:20 +02:00
|
|
|
?if __IPV4
|
2020-07-06 17:56:31 +02:00
|
|
|
SSH(ACCEPT) { SOURCE=all+!swch, DEST=all+ }
|
2017-07-01 20:24:20 +02:00
|
|
|
SSH(DNAT-) { SOURCE=net, DEST=172.20.2.44, PROTO=tcp, DPORT=ssh, ORIGDEST=70.90.191.123 }
|
2020-07-06 17:56:31 +02:00
|
|
|
?else
|
|
|
|
SSH(ACCEPT) { SOURCE=all+, DEST=all+ }
|
2017-07-01 20:24:20 +02:00
|
|
|
?endif
|
|
|
|
######################################################################################################
|
|
|
|
# DNS
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
DNS(ACCEPT) { SOURCE=loc,dmz,vpn,apps,wlan, DEST=$FW }
|
|
|
|
DNS(ACCEPT) { SOURCE=$FW, DEST=net }
|
2020-04-25 23:48:45 +02:00
|
|
|
?if $TEST
|
|
|
|
DNS(REDIRECT) loc 53 - 53 - !&LOC_IF
|
|
|
|
DNS(REDIRECT) fw 53 - 53 - !::1
|
|
|
|
?endif
|
|
|
|
DropDNSrep { SOURCE=net, DEST=all }
|
2017-07-01 20:24:20 +02:00
|
|
|
######################################################################################################
|
|
|
|
# Traceroute
|
|
|
|
#
|
|
|
|
Trcrt(ACCEPT) { SOURCE=all, DEST=net }
|
|
|
|
Trcrt(ACCEPT) { SOURCE=net, DEST=$FW,dmz }
|
|
|
|
######################################################################################################
|
|
|
|
# Email
|
|
|
|
#
|
|
|
|
SMTP(ACCEPT) { SOURCE=net,$FW, DEST=dmz:$LISTS }
|
|
|
|
SMTP(ACCEPT) { SOURCE=dmz:$LISTS, DEST=net:PROD_IF }
|
2020-04-25 23:48:45 +02:00
|
|
|
SMTP(ACCEPT) { SOURCE=dmz, DEST=dmz:$LISTS }
|
2017-07-01 20:24:20 +02:00
|
|
|
SMTP(REJECT) { SOURCE=dmz:$LISTS, DEST=net }
|
|
|
|
IMAPS(ACCEPT) { SOURCE=all, DEST=dmz:$MAIL }
|
|
|
|
Submission(ACCEPT) { SOURCE=all, DEST=dmz:$LISTS }
|
|
|
|
SMTPS(ACCEPT) { SOURCE=all, DEST=dmz:$LISTS }
|
2020-07-05 00:25:03 +02:00
|
|
|
IMAP(REJECT) { SOURCE=net, DEST=all }
|
2017-07-01 20:24:20 +02:00
|
|
|
######################################################################################################
|
|
|
|
# NTP
|
|
|
|
#
|
|
|
|
NTP(ACCEPT) { SOURCE=all, DEST=net }
|
2017-10-16 04:15:13 +02:00
|
|
|
######################################################################################################
|
|
|
|
# Squid
|
2020-07-05 00:25:03 +02:00
|
|
|
ACCEPT { SOURCE=loc,vpn,wlan, DEST=$FW, PROTO=tcp, DPORT=3128 }
|
2017-07-01 20:24:20 +02:00
|
|
|
######################################################################################################
|
|
|
|
# HTTP/HTTPS
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
Web(ACCEPT) { SOURCE=loc,vpn,wlan DEST=$FW }
|
2017-07-01 20:24:20 +02:00
|
|
|
Web(ACCEPT) { SOURCE=$FW, DEST=net, USER=proxy }
|
|
|
|
Web(DROP) { SOURCE=net, DEST=fw, PROTO=tcp, comment="Do not blacklist web crawlers" }
|
2020-07-05 00:25:03 +02:00
|
|
|
HTTP(ACCEPT) { SOURCE=net,loc,vpn,wlan,$FW DEST=dmz:$SERVER,$LISTS,$MAIL }
|
|
|
|
HTTPS(ACCEPT) { SOURCE=net,loc,vpn,wlan,$FW DEST=dmz:$SERVER,$LISTS,$MAIL }
|
|
|
|
Web(ACCEPT) { SOURCE=dmz,apps,loc,wlan, DEST=net,$FW }
|
2017-07-01 20:24:20 +02:00
|
|
|
Web(ACCEPT) { SOURCE=$FW, DEST=net, USER=root }
|
|
|
|
Web(ACCEPT) { SOURCE=$FW, DEST=net, USER=teastep }
|
2020-07-05 00:25:03 +02:00
|
|
|
?if __IPV4
|
|
|
|
Web(ACCEPT) { SOURCE=$FW, DEST=swch, USER=teastep }
|
|
|
|
?endif
|
2017-10-16 04:15:13 +02:00
|
|
|
Web(ACCEPT) { SOURCE=$FW, DEST=net, USER=_apt }
|
2017-07-01 20:24:20 +02:00
|
|
|
######################################################################################################
|
|
|
|
# FTP
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
FTP(ACCEPT) { SOURCE=dmz, DEST=net }
|
|
|
|
FTP(ACCEPT) { SOURCE=$FW, DEST=net, USER=root }
|
|
|
|
FTP(ACCEPT) { SOURCE=all, DEST=dmz:$SERVER }
|
2017-07-01 20:24:20 +02:00
|
|
|
#
|
|
|
|
# Some FTP clients seem prone to sending the PORT command split over two packets.
|
2020-04-25 23:48:45 +02:00
|
|
|
# This prevents the FTP connection tracking code from processing the command and setting
|
2017-07-01 20:24:20 +02:00
|
|
|
# up the proper expectation.
|
|
|
|
#
|
|
|
|
# The following rule allows active FTP to work in these cases
|
|
|
|
# but logs the connection so I can keep an eye on this potential security hole.
|
|
|
|
#
|
|
|
|
ACCEPT:$LOG_LEVEL { SOURCE=dmz, DEST=net, PROTO=tcp, DPORT=1024:, SPORT=20 }
|
|
|
|
######################################################################################################
|
2020-04-25 23:48:45 +02:00
|
|
|
# Git
|
|
|
|
#
|
|
|
|
Git(ACCEPT) { source=all, DEST=dmz:$SERVER }
|
|
|
|
######################################################################################################
|
2017-07-01 20:24:20 +02:00
|
|
|
# whois
|
|
|
|
#
|
|
|
|
Whois(ACCEPT) { SOURCE=all, DEST=net }
|
|
|
|
######################################################################################################
|
|
|
|
# SMB
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
SMBBI(ACCEPT) { SOURCE=loc,wlan, DEST=$FW }
|
|
|
|
SMBBI(ACCEPT) { SOURCE=vpn, DEST=$FW }
|
2017-07-01 20:24:20 +02:00
|
|
|
######################################################################################################
|
|
|
|
# IRC
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
SetEvent(IRC) { SOURCE=loc,apps,wlan, DEST=net, PROTO=tcp, DPORT=6667 }
|
|
|
|
IfEvent(IRC,ACCEPT,10,1,dst,reset) { SOURCE=net, DEST=loc,apps,wlan, PROTO=tcp, DPORT=113 }
|
2020-04-25 23:48:45 +02:00
|
|
|
######################################################################################################
|
|
|
|
# AUTH
|
|
|
|
Auth(REJECT) { SOURCE=net, DEST=all }
|
2017-07-01 20:24:20 +02:00
|
|
|
######################################################################################################
|
2020-04-25 23:48:45 +02:00
|
|
|
# IPSEC
|
|
|
|
#
|
|
|
|
?if __IPV4
|
2020-07-05 00:25:03 +02:00
|
|
|
DNAT { SOURCE=loc,net,wlan, DEST=apps:172.20.2.44, PROTO=udp, DPORT=500,4500, ORIGDEST=70.90.191.123 }
|
2020-04-25 23:48:45 +02:00
|
|
|
?else
|
2020-07-05 00:25:03 +02:00
|
|
|
ACCEPT { SOURCE=loc,net,wlan, DEST=apps, PROTO=udp, DPORT=500,4500 }
|
|
|
|
ACCEPT { SOURCE=loc,net,wlan, DEST=apps, PROTO=esp }
|
2020-04-25 23:48:45 +02:00
|
|
|
?endif
|
|
|
|
ACCEPT { SOURCE=$FW, DEST=net, PROTO=udp, SPORT=4500 }
|
|
|
|
######################################################################################################
|
|
|
|
# VNC
|
|
|
|
ACCEPT { SOURCE=loc, DEST=$FW, PROTO=tcp, DPORT=5900 }
|
|
|
|
######################################################################################################
|
|
|
|
# FIN & RST
|
|
|
|
RST(ACCEPT) { SOURCE=all, DEST=all }
|
|
|
|
FIN(ACCEPT) { SOURCE=all, DEST=all }
|
|
|
|
######################################################################################################
|
|
|
|
# Multicast
|
|
|
|
?if __IPV4
|
|
|
|
Multicast(ACCEPT) { SOURCE=all, DEST=$FW }
|
2020-07-05 00:25:03 +02:00
|
|
|
?endif
|
|
|
|
######################################################################################################
|
|
|
|
?if __IPV4
|
|
|
|
ACCEPT { SOURCE=fw, DEST=all, PROTO=icmp, DPORT=host-unreachable }
|
2020-04-25 23:48:45 +02:00
|
|
|
?endif</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>mangle</title>
|
|
|
|
|
|
|
|
<para>Note that TPROXY can be enabled/disabled via a shell variable
|
|
|
|
setting in /etc/shorewall/params:</para>
|
|
|
|
|
|
|
|
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP
|
|
|
|
|
2020-04-25 23:48:45 +02:00
|
|
|
?if $VERSION >= 50109
|
|
|
|
TCPMSS(pmtu,none) { PROTO=tcp }
|
|
|
|
?endif
|
|
|
|
|
2017-07-01 20:24:20 +02:00
|
|
|
?if __IPV4
|
|
|
|
#
|
|
|
|
# I've had a checksum issue with certain IPv4 UDP packets
|
|
|
|
#
|
|
|
|
CHECKSUM:T { DEST=FAST_IF, PROTO=udp }
|
|
|
|
CHECKSUM:T { DEST=DMZ_IF, PROTO=udp }
|
|
|
|
?endif
|
|
|
|
|
|
|
|
?if $PROXY
|
|
|
|
#
|
2020-07-05 00:25:03 +02:00
|
|
|
# Use TPROXY for web access from the local LAN
|
2017-07-01 20:24:20 +02:00
|
|
|
#
|
|
|
|
DIVERT:R { PROTO=tcp, SPORT=80 }
|
|
|
|
DIVERT:R { PROTO=tcp, DPORT=80 }
|
2020-07-05 00:25:03 +02:00
|
|
|
TPROXY(3129,$LOC_ADDR) { SOURCE=LOC_IF, PROTO=tcp, DPORT=80 }
|
|
|
|
TPROXY(3129,$LOC_ADDR) { SOURCE=WLAN_IF, PROTO=tcp, DPORT=80 }
|
|
|
|
# DIVERT:R { PROTO=tcp, SPORT=443 }
|
|
|
|
# DIVERT:R { PROTO=tcp, DPORT=443 }
|
|
|
|
# TPROXY(3129,$LOC_ADDR) { SOURCE=LOC_IF, PROTO=tcp, DPORT=443 }
|
2020-04-25 23:48:45 +02:00
|
|
|
?endif</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>snat</title>
|
|
|
|
|
|
|
|
<para>NAT entries are quite dependent on the address family:</para>
|
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<programlisting>#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
?if __IPV4
|
2020-07-05 00:25:03 +02:00
|
|
|
MASQUERADE { SOURCE=172.20.0.0/22, DEST=FAST_IF }
|
2020-04-25 23:48:45 +02:00
|
|
|
MASQUERADE { SOURCE=70.90.191.120/29, DEST=FAST_IF }
|
|
|
|
SNAT(70.90.191.121) { SOURCE=!70.90.191.120/29, DEST=PROD_IF, PROBABILITY=0.50, COMMENT="Masquerade Local Network" }
|
|
|
|
SNAT(70.90.191.123) { SOURCE=!70.90.191.120/29, DEST=PROD_IF, COMMENT="Masquerade Local Network" }
|
|
|
|
SNAT(172.20.1.253) { SOURCE=!172.20.1.0/24, DEST=LOC_IF:172.20.1.100 }
|
2017-07-01 20:24:20 +02:00
|
|
|
?else
|
2020-04-25 23:48:45 +02:00
|
|
|
SNAT(&PROD_IF) { SOURCE=2601:601:a000:16f0::/60, DEST=PROD_IF }
|
|
|
|
SNAT(&FAST_IF) { SOURCE=2001:470:b:227::/64,2001:470:a:227::2, DEST=FAST_IF }
|
|
|
|
?endif</programlisting>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>tunnels</title>
|
|
|
|
|
2018-02-09 20:20:22 +01:00
|
|
|
<para>Both address families define IPsec tunnels:</para>
|
2017-07-01 20:24:20 +02:00
|
|
|
|
|
|
|
<programlisting>#TYPE ZONE GATEWAY GATEWAY_ZONE
|
2017-10-18 01:51:35 +02:00
|
|
|
ipsecnat {ZONE=net, GATEWAY=$ALL, GATEWAY_ZONE=vpn }
|
|
|
|
ipsecnat {ZONE=loc, GATEWAY=$ALL, GATEWAY_ZONE=vpn }
|
2017-07-01 20:24:20 +02:00
|
|
|
</programlisting>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>proxyarp</title>
|
|
|
|
|
|
|
|
<programlisting>#ADDRESS INTERFACE EXTERNAL HAVEROUTE PERSISTENT
|
|
|
|
|
|
|
|
70.90.191.122 { INTERFACE=br0, EXTERNAL=eth1, HAVEROUTE=yes, PERSISTENT=no }
|
|
|
|
</programlisting>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>isuable</title>
|
|
|
|
|
|
|
|
<para>This is just the standard Shorewall isusable extension
|
|
|
|
script:</para>
|
|
|
|
|
|
|
|
<programlisting>local status
|
|
|
|
status=0
|
|
|
|
|
|
|
|
[ -f ${VARDIR}/${1}.status ] && status=$(cat ${VARDIR}/${1}.status)
|
|
|
|
|
|
|
|
return $status
|
|
|
|
</programlisting>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>started</title>
|
|
|
|
|
|
|
|
<para>/etc/shorewall/started only does something in the IPv4
|
|
|
|
configuration, although it gets compiled into both scripts:</para>
|
|
|
|
|
|
|
|
<programlisting>if [ $g_family = 4 ]; then
|
|
|
|
qt $IP -4 route replace 70.90.191.122 dev br0
|
|
|
|
qt $IP -4 route replace 70.90.191.124 dev br0
|
|
|
|
qt $IP -4 route replace 70.90.191.125 dev br0
|
|
|
|
fi
|
|
|
|
</programlisting>
|
|
|
|
</section>
|
2020-04-25 23:48:45 +02:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>stoppedrules</title>
|
|
|
|
|
|
|
|
<para>/etc/shorewall/stoppedrules allow SSH connections into the
|
|
|
|
firewall system when Shorewall[6] is in the stopped state.</para>
|
|
|
|
|
2020-07-05 00:25:03 +02:00
|
|
|
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT
|
|
|
|
ACCEPT - $FW tcp 22
|
|
|
|
</programlisting>
|
2020-04-25 23:48:45 +02:00
|
|
|
</section>
|
2017-07-01 20:24:20 +02:00
|
|
|
</section>
|
|
|
|
</article>
|