diff --git a/Lrp/etc/init.d/shorewall b/Lrp/etc/init.d/shorewall
index 9c18802d7..be028befd 100755
--- a/Lrp/etc/init.d/shorewall
+++ b/Lrp/etc/init.d/shorewall
@@ -1565,7 +1565,13 @@ add_nat_rule() {
# Replace destination port by the new destination port
- [ -n "$servport" ] && dports="--dport ${servport#*:}"
+ if [ -n "$servport" ]; then
+ if [ -z "$multiport" ]; then
+ dports="--dport ${servport#*:}"
+ else
+ dports="--dports ${servport#*:}"
+ fi
+ fi
# Handle SNAT
@@ -1650,18 +1656,21 @@ add_a_rule()
case $proto in
tcp|udp|TCP|UDP|6|17)
if [ -n "$port" -a "x${port}" != "x-" ]; then
- [ -n "$multioption" ] && \
- [ "$port" != "${port%,*}" ] && \
+ dports="--dport"
+ if [ -n "$multioption" -a "$port" != "${port%,*}" ]; then
multiport="$multioption"
- dports="--dport $port"
+ dports="--dports"
+ fi
+ dports="$dports $ports"
fi
if [ -n "$cport" -a "x${cport}" != "x-" ]; then
- [ -n "$multioption" ] && \
- [ -z "$multiport" ] && \
- [ "$cport" != "${cport%,*}" ] && \
+ sports="--sport"
+ if [ -n "$multioption" -a "$cport" != "${cport%,*}" ]; then
multiport="$multioption"
- sports="--sport $cport"
+ sports="--sports"
+ fi
+ sports="$sports $cport"
fi
;;
icmp|ICMP|1)
@@ -2428,7 +2437,7 @@ setup_masq()
if [ -n "$address" -a -n "$ADD_SNAT_ALIASES" ]; then
list_search $address $aliases_to_add || \
- aliases_to_add="$aliases_to_add $external $address"
+ aliases_to_add="$aliases_to_add $address $interface"
fi
destination=$destnet
@@ -2778,7 +2787,8 @@ add_common_rules() {
logoptions="$LOGPARAMS --log-prefix Shorewall:badpkt:DROP:"
logoptions="$logoptions --log-level $LOGUNCLEAN --log-ip-options"
run_iptables -A badpkt -p tcp -j LOG $logoptions --log-tcp-options
- run_iptables -A badpkt -p !tcp -j LOG $logoptions
+ run_iptables -A badpkt -p tcp -j DROP # Workaround for iptables 1.2.7
+ run_iptables -A badpkt -j LOG $logoptions
fi
run_iptables -A badpkt -j DROP
@@ -2803,7 +2813,8 @@ add_common_rules() {
logoptions="$LOGPARAMS --log-prefix Shorewall:logpkt:LOG:"
logoptions="$logoptions --log-level $LOGUNCLEAN --log-ip-options"
run_iptables -A logpkt -p tcp -j LOG $logoptions --log-tcp-options
- run_iptables -A logpkt -p !tcp -j LOG $logoptions
+ run_iptables -A logpkt -p tcp -j RETURN # Workaround for iptables 1.2.7
+ run_iptables -A logpkt -j LOG $logoptions
echo "Mangled/Invalid Packet Logging enabled on:"
@@ -2814,16 +2825,15 @@ add_common_rules() {
echo " $interface"
done
fi
+ ###########################################################################
+ # PING
+ #
+ [ -n "$FORWARDPING" ] && \
+ run_iptables -A common -p icmp --icmp-type echo-request -j ACCEPT
############################################################################
# Common ICMP rules
#
- icmpdef=`find_file icmpdef`
-
- if [ -f $icmpdef ]; then
- . $icmpdef
- else
- . `find_file icmp.def`
- fi
+ run_user_exit icmpdef
############################################################################
# Common rules in each chain
#
@@ -2838,7 +2848,6 @@ add_common_rules() {
# BROADCASTS
#
drop_broadcasts `find_broadcasts`
-
###########################################################################
# RFC 1918
#
@@ -3400,6 +3409,7 @@ do_initialize() {
MERGE_HOSTS=
MUTEX_TIMEOUT=
LOGNEWNOTSYN=
+ FORWARDPING=
stopping=
have_mutex=
masq_seq=1
@@ -3476,6 +3486,7 @@ do_initialize() {
MULTIPORT=`added_param_value_no MULTIPORT $MULTIPORT`
DETECT_DNAT_IPADDRS=`added_param_value_no DETECT_DNAT_IPADDRS $DETECT_DNAT_IPADDRS`
MERGE_HOSTS=`added_param_value_no MERGE_HOSTS $MERGE_HOSTS`
+ FORWARDPING=`added_param_value_no FORWARDPING $FORWARDPING`
}
################################################################################
diff --git a/Lrp/etc/shorewall/common.def b/Lrp/etc/shorewall/common.def
index e070a3101..cde58a555 100644
--- a/Lrp/etc/shorewall/common.def
+++ b/Lrp/etc/shorewall/common.def
@@ -8,7 +8,7 @@
#
# Do not modify this file -- if you wish to change these rules, create
# /etc/shorewall/common to replace it. It is suggested that you include
-# the command "source /etc/shorewall/common.def" in your
+# the command ". /etc/shorewall/common.def" in your
# /etc/shorewall/common file so that you will continue to get the
# advantage of new releases of this file.
#
@@ -18,13 +18,6 @@ run_iptables -A common -p icmp -j icmpdef
#
run_iptables -A common -m state -p tcp --state INVALID -j DROP
############################################################################
-# accept ACKs and RSTs that aren't related to any session so that the
-# protocol stack can handle them and so the ACKs can create connection
-# tracking entries.
-#
-run_iptables -A common -p tcp --tcp-flags ACK ACK -j ACCEPT
-run_iptables -A common -p tcp --tcp-flags RST RST -j ACCEPT
-############################################################################
# NETBIOS chatter
#
run_iptables -A common -p udp --dport 137:139 -j REJECT
diff --git a/Lrp/etc/shorewall/icmp.def b/Lrp/etc/shorewall/icmp.def
index 629b724d9..b6b39510b 100644
--- a/Lrp/etc/shorewall/icmp.def
+++ b/Lrp/etc/shorewall/icmp.def
@@ -1,22 +1,6 @@
##############################################################################
# Shorewall 1.3 /etc/shorewall/icmp.def
#
-# This file defines the default rules for accepting ICMP packets.
+# This file is obsolete and is included for compatibility with existing
+# icmpdef extension scripts that source it.
#
-# Do not modify this file -- if you wish to change these rules, create
-# /etc/shorewall/icmpdef to replace it. It is suggested that you include
-# the command "source /etc/shorewall/icmp.def" in your
-# /etc/shorewall/icmpdef file so that you will continue to get the
-# advantage of new releases of this file.
-#
-# For example, if you want to accept 'ping' everywhere then create
-# /etc/shorewall/icmpdef with the following two lines:
-#
-# source /etc/shorewall/icmp.def
-# run_iptables -A icmpdef -p ICMP --icmp-type echo-request -j ACCEPT
-#
-run_iptables -A icmpdef -p ICMP --icmp-type echo-reply -j ACCEPT
-run_iptables -A icmpdef -p ICMP --icmp-type source-quench -j ACCEPT
-run_iptables -A icmpdef -p ICMP --icmp-type destination-unreachable -j ACCEPT
-run_iptables -A icmpdef -p ICMP --icmp-type time-exceeded -j ACCEPT
-run_iptables -A icmpdef -p ICMP --icmp-type parameter-problem -j ACCEPT
diff --git a/Lrp/etc/shorewall/interfaces b/Lrp/etc/shorewall/interfaces
index fb99fcf4e..eb20f46cd 100644
--- a/Lrp/etc/shorewall/interfaces
+++ b/Lrp/etc/shorewall/interfaces
@@ -12,20 +12,24 @@
# of a zone defined in /etc/shorewall/zones.
#
# If the interface serves multiple zones that will be
-# defined in the /etc/shorewall/hosts file, you may
+# defined in the /etc/shorewall/hosts file, you should
# place "-" in this column.
#
-# INTERFACE Name of interface
+# INTERFACE Name of interface. Each interface may be listed only
+# once in this file.
#
# BROADCAST The broadcast address for the subnetwork to which the
# interface belongs. For P-T-P interfaces, this
-# column is left black.
+# column is left black.If the interface has multiple
+# addresses on multiple subnets then list the broadcast
+# addresses as a comma-separated list.
#
# If you use the special value "detect", the firewall
# will detect the broadcast address for you. If you
# select this option, the interface must be up before
-# the firewall is started and you must have iproute
-# installed.
+# the firewall is started, you must have iproute
+# installed and the interface must only be associated
+# with a single subnet.
#
# If you don't want to give a value for this column but
# you want to enter a value in the OPTIONS column, enter
diff --git a/Lrp/etc/shorewall/policy b/Lrp/etc/shorewall/policy
index abee2aa0c..4b144d54e 100644
--- a/Lrp/etc/shorewall/policy
+++ b/Lrp/etc/shorewall/policy
@@ -18,7 +18,7 @@
# in /etc/shorewall/zones, $FW or "all"
#
# POLICY Policy if no match from the rules file is found. Must
-# be "ACCEPT", "DENY", "REJECT" or "CONTINUE"
+# be "ACCEPT", "DROP", "REJECT" or "CONTINUE"
#
# LOG LEVEL If supplied, each connection handled under the default
# POLICY is logged at that level. If not supplied, no
diff --git a/Lrp/etc/shorewall/rfc1918 b/Lrp/etc/shorewall/rfc1918
index d3ef5954a..a2e066f49 100644
--- a/Lrp/etc/shorewall/rfc1918
+++ b/Lrp/etc/shorewall/rfc1918
@@ -45,13 +45,13 @@
42.0.0.0/8 logdrop # Reserved
58.0.0.0/7 logdrop # Reserved
60.0.0.0/8 logdrop # Reserved
-69.0.0.0/8 logdrop # Reserved
70.0.0.0/7 logdrop # Reserved
72.0.0.0/5 logdrop # Reserved
82.0.0.0/7 logdrop # Reserved
84.0.0.0/6 logdrop # Reserved
88.0.0.0/5 logdrop # Reserved
96.0.0.0/3 logdrop # Reserved
+127.0.0.0/8 logdrop # Loopback
197.0.0.0/8 logdrop # Reserved
222.0.0.0/7 logdrop # Reserved
240.0.0.0/4 logdrop # Reserved
diff --git a/Lrp/etc/shorewall/shorewall.conf b/Lrp/etc/shorewall/shorewall.conf
index 5648b8642..1d84039ed 100644
--- a/Lrp/etc/shorewall/shorewall.conf
+++ b/Lrp/etc/shorewall/shorewall.conf
@@ -350,4 +350,12 @@ MUTEX_TIMEOUT=60
LOGNEWNOTSYN=
+#
+# Forward "Ping"
+#
+# If FORWARDPING is set to "Yes" then Echo Request ("Ping") packets are
+# forwarded by the firewall.
+
+FORWARDPING=Yes
+
#LAST LINE -- DO NOT REMOVE
diff --git a/Lrp/var/lib/shorewall/version b/Lrp/var/lib/shorewall/version
index 95b25aee2..3336003dc 100644
--- a/Lrp/var/lib/shorewall/version
+++ b/Lrp/var/lib/shorewall/version
@@ -1 +1 @@
-1.3.6
+1.3.7
diff --git a/STABLE/changelog.txt b/STABLE/changelog.txt
index cbd7403b1..9efc392c8 100644
--- a/STABLE/changelog.txt
+++ b/STABLE/changelog.txt
@@ -1,15 +1,26 @@
-Changes since 1.3.5
+Changes since 1.3.6
-1. REDIRECT rules are now working again.
+1. Comments in the common.def file have been updated.
-2. proxyarp option now works.
+2. icmp.def deimplemented
+
+3. FORWARDPING implemented.
+
+4. Made MULTIPORT work with iptables 1.2.7
+
+5. Corrected ADD_SNAT_ALIASES
+
+6. Work around iptables 1.2.7 protocol match bug.
+
+7. Remove themes from documentation and web site.
+
+8. Comments in the interfaces file improved.
+
+9. Typo in the policy file corrected.
+
+10. Loopback class A added to rfc1918.
-3. It is once again possible to specify a host list in an
- /etc/shorewall/hosts entry.
-4. The lock file is now removed when the firewall script is killed by a
- signal.
-5. Implemented "new not SYN" dropping.
diff --git a/STABLE/common.def b/STABLE/common.def
index 50edd3471..cde58a555 100644
--- a/STABLE/common.def
+++ b/STABLE/common.def
@@ -8,7 +8,7 @@
#
# Do not modify this file -- if you wish to change these rules, create
# /etc/shorewall/common to replace it. It is suggested that you include
-# the command "source /etc/shorewall/common.def" in your
+# the command ". /etc/shorewall/common.def" in your
# /etc/shorewall/common file so that you will continue to get the
# advantage of new releases of this file.
#
diff --git a/STABLE/documentation/Documentation.htm b/STABLE/documentation/Documentation.htm
index cf5ee7eaf..8964733a5 100644
--- a/STABLE/documentation/Documentation.htm
+++ b/STABLE/documentation/Documentation.htm
@@ -9,103 +9,112 @@
+ Shorewall 1.3 Reference+ |
+
Shorewall consists of the following components:
-![]() |
+
|
![]() |
+ that is used to set several firewall parameters.
+ |
![]() |
+ a network partitioning into "zones"
+ |
![]() |
+establishes overall firewall policy.
+ |
![]() | blacklist -- a parameter file installed in /etc/shorewall and used - to list blacklisted IP/subnet/MAC addresses. |
![]() |
+ policies established in /etc/shorewall/policy.
+ |
![]() |
+ and in /var/lib/shorewall in later versions.
+ |
![]() |
+ load the modules specified in this file.
+ |
![]() |
+ specify how the Type of Service (TOS) field in packets is to be set.
+ |
![]() | common.def -- a parameter file installed in
+ DROP or REJECT.
+ |
![]() |
+ DROP or REJECT policy is applied.
+ |
![]() |
+ used to describe the interfaces on the firewall system.
+ |
![]() |
+ to describe individual hosts or subnetworks in zones.
+ |
![]() | firewall -- a shell program that reads the configuration files in
+ and is installed in /etc/shorewall.
+ |
![]() |
+ later) is a symbolic link to this program.
+ |
![]() |
+ .
+ |
![]() | routestopped -- a parameter file in
+ .
+ |
![]() | tcrules -- a parameter file in /etc/shorewall used to define rules for
+ Shorewall is stopped.
+ |
![]() |
+ Shaping/Control.
+ |
![]() |
+IPSec tunnels.
+ |
![]() |
+(the install.sh script and the rpm install this file in /sbin).
+ |
You may use the file /etc/shorewall/params file to set shell variables that you can then use in some of the other @@ -117,90 +126,72 @@ Shorewall programs
Example:
--- -NET_IF=eth0
-
- NET_BCAST=130.252.100.255
- NET_OPTIONS=noping,norfc1918
- Example (/etc/shorewall/interfaces record):
-- - - -net $NET_IF $NET_BCAST $NET_OPTIONS
-
The result will be the same as if the record had been written
- - - --- - - -net eth0 130.252.100.255 noping,norfc1918
-
Variables may be used anywhere in the +
NET_IF=eth0 + NET_BCAST=130.252.100.255 + NET_OPTIONS=noping,norfc1918+
Example (/etc/shorewall/interfaces record):
+net $NET_IF $NET_BCAST $NET_OPTIONS+
The result will be the same as if the record had been written
+net eth0 130.252.100.255 noping,norfc1918+
Variables may be used anywhere in the other configuration files.
-This file is used to define the network zones. There is one entry in /etc/shorewall/zones for each zone; Columns in an entry are:
-![]() |
+
|
![]() | - DISPLAY - The name of the zone as displayed during Shorewall startup. |
![]() |
+are three characters or less in length. The name "all" may not be used as
+ a zone name nor may the zone name assigned to the firewall itself via the FW
+ variable in /etc/shorewall/shorewall.conf.
+ |
The /etc/shorewall/zones file released with Shorewall is as follows:
-- ZONE | -- DISPLAY | -- COMMENTS | ++ ZONE | ++ DISPLAY | ++ COMMENTS |
net | -Net | -Internet | +net | +Net | +Internet |
loc | -Local | -Local networks | +loc | +Local | +Local networks |
dmz | -DMZ | -Demilitarized zone | +dmz | +DMZ | +Demilitarized zone |
You may add, delete and modify entries in the /etc/shorewall/zones file as desired so long as you have at least one zone defined.
@@ -214,30 +205,35 @@ rather than "shorewall restart". order of entries in the /etc/shorewall/zones file is significant in some cases. -This file is used to tell the firewall which of your firewall's network interfaces are connected to which zone. There will be one entry in /etc/shorewall/interfaces for each of your interfaces. Columns in an entry are:
-![]() |
+
|
![]() | - INTERFACE - the name of the interface (examples: eth0, ppp0, ipsec+) |
![]() | - BROADCAST - the broadcast address for the sub-network attached to the - interface. This should be left empty for P-T-P interfaces (ppp*, ippp*); - if you need to specify options for such an interface, enter "-" in -this column. If you supply the special value "detect" in this column, -the firewall will automatically determine the broadcast address. Note -that to use this feature, you must have iproute installed and the interface - must be up before you start your firewall. |
![]() |
+ file to define the zones accessed via this interface.
+
blacklist - This option causes incoming packets on this @@ -350,8 +346,8 @@ appropriate forwarding rule. not set this option if you are implementing Proxy ARP through entries in /etc/shorewall/proxyarp. - |
Example 1: You have a conventional firewall setup in which eth0 connects to a @@ -361,65 +357,91 @@ Cable or DSL modem and eth1 connects to your local network and eth0 gets against the black list. Your /etc/shorewall/interfaces file would be as follows:
-
- ZONE | -- INTERFACE | -- BROADCAST | -- OPTIONS | ++ ZONE | ++ INTERFACE | ++ BROADCAST | ++ OPTIONS |
net | -eth0 | -detect | -dhcp,noping,norfc1918,blacklist | +net | +eth0 | +detect | +dhcp,noping,norfc1918,blacklist |
loc | -eth1 | -detect | -routestopped | +loc | +eth1 | +detect | +
Example 2: You have a standalone dialup GNU/Linux System. Your /etc/shorewall/interfaces file would be:
--+
+
- - ZONE -- INTERFACE -- BROADCAST -- OPTIONS ++ ZONE ++ INTERFACE ++ BROADCAST ++ OPTIONS - -net -ppp0 +net +ppp0 -- + +
Example 3: You have local interface eth1 with two IP + addresses - 192.168.1.1/24 and 192.168.12.1/24
+ +++ ++
++ ++ ZONE ++ INTERFACE ++ BROADCAST ++ OPTIONS ++ + +loc +eth1 + +192.168.1.255,192.168.12.255 ++
For most applications, specifying zones entirely in terms of network interfaces is sufficient. There may be times though @@ -438,14 +460,14 @@ Cable or DSL modem and eth1 connects to your local network and eth0 gets file are:
-![]() |
+
|
![]() |
+ file.
+ |
@@ -464,11 +486,11 @@ file are:-
![]() |
+
|
@@ -506,43 +528,43 @@ able to access without adding additional rules. groups of local hosts that you want to make into separate zones: -
![]() | 192.168.1.0/25 |
![]() | 192.168.1.128/25 |
Your /etc/shorewall/interfaces file might look like:
-
- ZONE | -- INTERFACE | -- BROADCAST | -- OPTIONS | ++ ZONE | ++ INTERFACE | ++ BROADCAST | ++ OPTIONS |
net | -eth0 | -detect | -dhcp,noping,norfc1918 | +net | +eth0 | +detect | +dhcp,noping,norfc1918 |
- | -eth1 | -detect | -+ | - | +eth1 | +detect | +
The '-' in the ZONE column for eth1 tells Shorewall that eth1 interfaces @@ -552,41 +574,41 @@ able to access without adding additional rules.
Your /etc/shorewall/hosts file might look like:-+
+
- - ZONE -- HOST(S) -- OPTIONS ++ ZONE ++ HOST(S) ++ OPTIONS - loc1 -eth1:192.168.1.0/25 +loc1 +eth1:192.168.1.0/25 -+ - -loc2 -eth1:192.168.1.128/25 -routestopped +loc2 +eth1:192.168.1.128/25 +routestopped
Hosts in 'loc2' can communicate with the firewall while Shorewall is stopped -- those in 'loc1' cannot.
-The /etc/shorewall/interfaces and /etc/shorewall/hosts file allow you @@ -603,8 +625,8 @@ one zone may be managed by the rules of all of those zones. This is done throug use of the special CONTINUE policy described below.
-This file is used to describe the firewall policy regarding establishment of connections. Connection establishment @@ -621,20 +643,20 @@ applies to a particular connection request then the policy from /etc/shorewal
Four policies are defined:
-![]() | - ACCEPT - The connection is allowed. |
![]() | - DROP - The connection request is ignored. |
![]() |
+
|
![]() |
+ packet being returned to the client.
+ |
For each policy specified in /etc/shorewall/policy, you can indicate @@ -690,60 +712,60 @@ zones. The policy file installed by default is as follows:
-
SOURCE | -DEST | -- POLICY | -- LOG LEVEL | -LIMIT:BURST | +SOURCE | +DEST | ++ POLICY | ++ LOG LEVEL | +LIMIT:BURST |
loc | -net | -ACCEPT | +loc | +net | +ACCEPT | -+ | - | + | |
net | -all | -DROP | -info | -+ | net | +all | +DROP | +info | +|
all | -all | -REJECT | -info | -+ | all | +all | +REJECT | +info | +
This table may be interpreted as follows:
-![]() | All connection requests from the local network to hosts on the internet - are accepted. |
![]() | All connection requests originating from the internet are ignored and - logged at level KERNEL.INFO. |
![]() | All other connection requests are rejected and logged. |
WARNING:
@@ -753,45 +775,45 @@ from top to bottom and uses the first applicable policy that it finds. connections would be ACCEPT as specified in the first entry even though the third entry in the file specifies REJECT.
-
Where zones are nested or overlapping , the CONTINUE policy allows hosts that are within multiple zones to be @@ -799,98 +821,98 @@ managed under the rules of all of these zones. Let's look at an example:
/etc/shorewall/zones:
-+
+
- - ZONE -- DISPLAY -- COMMENTS ++ ZONE ++ DISPLAY ++ COMMENTS - sam -Sam -Sam's system at home +sam +Sam +Sam's system at home - net -Internet -The Internet +net +Internet +The Internet - -loc -Loc -Local Network +loc +Loc +Local Network
/etc/shorewall/interfaces:
-+
+
- - ZONE -- INTERFACE -- BROADCAST -- OPTIONS ++ ZONE ++ INTERFACE ++ BROADCAST ++ OPTIONS - - -eth0 -detect -dhcp,noping,norfc1918 +- +eth0 +detect +dhcp,noping,norfc1918 - -loc -eth1 -detect -routestopped +loc +eth1 +detect +routestopped
/etc/shorewall/hosts:
-+
+
- - ZONE -- HOST(S) -- OPTIONS ++ ZONE ++ HOST(S) ++ OPTIONS - net -eth0:0.0.0.0/0 +net +eth0:0.0.0.0/0 -+ - -sam -eth0:206.191.149.197 -routestopped +sam +eth0:206.191.149.197 +routestopped
Note that Sam's home system is a member of both the sam zone and the net zone and @@ -899,51 +921,51 @@ the net zone and +
- SOURCE | -- DEST | -- POLICY | -- LOG LEVEL | ++ SOURCE | ++ DEST | ++ POLICY | ++ LOG LEVEL |
loc | -net | -ACCEPT | +loc | +net | +ACCEPT | -+ | |
sam | -all | -CONTINUE | +sam | +all | +CONTINUE | -+ | |
net | -all | -DROP | -info | +net | +all | +DROP | +info |
all | -all | -REJECT | -info | +all | +all | +REJECT | +info |
The second entry above says that when Sam is the client, connection requests should first be process under rules where the source zone is sam and @@ -953,66 +975,66 @@ if there is no match then the connection request should be treated under
Partial /etc/shorewall/rules:
-
ACTION | -SOURCE | -DEST | -- PROTO | -DEST - PORT(S) |
- SOURCE - PORT(S) |
- ORIGINAL - DEST |
+ ACTION | +SOURCE | +DEST | ++ PROTO | +DEST + PORT(S) |
+ SOURCE + PORT(S) |
+ ORIGINAL + DEST |
... | +... | -- | - | - | - | - | + | + | + | + | + | + | |
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 | +- | +|
... | -- | - | - | - | - | + | ... | ++ | + | + | + | + |
Given these two rules, Sam can connect to the firewall's internet interface with ssh and the connection request will be forwarded to 192.168.1.3. Like @@ -1031,72 +1053,72 @@ if there is no match then the connection request should be treated under
-
ACTION | -SOURCE | -DEST | -- PROTO | -DEST - PORT(S) |
- SOURCE - PORT(S) |
- ORIGINAL - DEST |
+ ACTION | +SOURCE | +DEST | ++ PROTO | +DEST + PORT(S) |
+ SOURCE + PORT(S) |
+ ORIGINAL + DEST |
- | - | - | - | - | - | + | + | + | + | + | + | + | |
... | +... | -- | - | - | - | - | + | + | + | + | + | + | |
DNAT | -sam | -fw | -tcp | -ssh | -- | -+ | DNAT | +sam | +fw | +tcp | +ssh | +- | +|
DNAT | -net!sam | -loc:192.168.1.3 | -tcp | -ssh | -- | -+ | DNAT | +net!sam | +loc:192.168.1.3 | +tcp | +ssh | +- | +|
... | -- | - | - | - | - | + | ... | ++ | + | + | + | + |
The first rule allows Sam SSH @@ -1113,8 +1135,8 @@ if there is no match then the connection request should be treated under the ACTION is REDIRECT.
-The /etc/shorewall/rules file @@ -1124,24 +1146,24 @@ if there is no match then the connection request should be treated under
Entries in the file have the following columns:
-![]() | ACTION
The ACTION may optionally be followed by
":" and a syslogd log level (example: REJECT:info). This causes the
packet to be logged at the specified level prior to being processed according
to the specified ACTION. | ||||||||
![]() | SOURCE - Describes the source hosts to which the rule applies.. The contents of this field must begin
+
+
| ||||||||
![]() | DEST - Describes the destination host(s) to which the rule applies. May take any of the forms described
+
| ||||||||
![]() |
+ listening on the specified port.
+
+
+ | ||||||||
![]() |
+ blank.
+ | ||||||||
![]() |
+ from /etc/services.
+ | ||||||||
![]() | ORIGINAL DEST - This column may only be non-empty if the ACTION is DNAT
+ either integers or service names from /etc/services.
+ @@ -1231,8 +1253,8 @@ with the client(s) and server(s) specified in this rule. When "related" If SNAT is not used (no ":" and second IP address), the original source address is used. If you want any destination address to match the rule but want to specify SNAT, simply use a colon followed by the SNAT - address. |
@@ -1242,38 +1264,38 @@ with the client(s) and server(s) specified in this rule. When "related" internet to local system 192.168.1.3.
-
ACTION | -SOURCE | -DEST | -- PROTO | -DEST - PORT(S) |
- SOURCE - PORT(S) |
- ORIGINAL - DEST |
+ ACTION | +SOURCE | +DEST | ++ PROTO | +DEST + PORT(S) |
+ SOURCE + PORT(S) |
+ ORIGINAL + DEST |
DNAT | -net | -loc:192.168.1.3 | -tcp | -ssh | -- | + | DNAT | +net | +loc:192.168.1.3 | +tcp | +ssh | ++ |
Example 2. You want to redirect all local www connection requests EXCEPT @@ -1290,47 +1312,47 @@ with the client(s) and server(s) specified in this rule. When "related" redirected to local port 3128.
-+
+
- ACTION -SOURCE -DEST -- PROTO -DEST -
- PORT(S)SOURCE -
- PORT(S)ORIGINAL +
- DESTACTION +SOURCE +DEST ++ PROTO +DEST +
+ PORT(S)SOURCE +
+ PORT(S)ORIGINAL
+ DEST- REDIRECT -loc -3128 -tcp -www -- !206.124.146.177 +REDIRECT +loc +3128 +tcp +www ++ !206.124.146.177 - -ACCEPT -fw -net -tcp -www -- + ACCEPT +fw +net +tcp +www ++
Example 3. You want to run a web server at 155.186.235.222 in your @@ -1338,49 +1360,49 @@ DMZ and have it accessible remotely and locally. the DMZ is managed by Proxy ARP or by classical sub-netting.
-+
+
- ACTION -SOURCE -DEST -- PROTO -DEST -
- PORT(S)SOURCE -
- PORT(S)ORIGINAL +
- DESTACTION +SOURCE +DEST ++ PROTO +DEST +
+ PORT(S)SOURCE +
+ PORT(S)ORIGINAL
+ DEST- ACCEPT -net -dmz:155.186.235.222 -tcp -www -- +ACCEPT +net +dmz:155.186.235.222 +tcp +www +- -+ - -ACCEPT -loc -dmz:155.186.235.222 -tcp -www -- + ACCEPT +loc +dmz:155.186.235.222 +tcp +www ++
Example 4. You want to run wu-ftpd on 192.168.2.2 in your masqueraded @@ -1406,49 +1428,49 @@ Proxy ARP or by classical sub-netting.
-+
+
- ACTION -SOURCE -DEST -- PROTO -DEST -
- PORT(S)SOURCE -
- PORT(S)ORIGINAL +
- DESTACTION +SOURCE +DEST ++ PROTO +DEST +
+ PORT(S)SOURCE +
+ PORT(S)ORIGINAL
+ DEST- DNAT -net -dmz:192.168.2.2 -tcp -ftp -- + DNAT +net +dmz:192.168.2.2 +tcp +ftp ++ - -DNAT -loc:192.168.1.0/24 -dmz:192.168.2.2 -tcp -ftp +DNAT +loc:192.168.1.0/24 +dmz:192.168.2.2 +tcp +ftp -- +- -155.186.235.151 +155.186.235.151
If you are running @@ -1482,34 +1504,34 @@ is unique and will not overlap with any usage on the firewall system.
-@@ -1518,8 +1540,8 @@ is unique and will not overlap with any usage on the firewall system. -+
+
- ACTION -SOURCE -DEST -- PROTO -DEST -
- PORT(S)SOURCE -
- PORT(S)ORIGINAL +
- DESTACTION +SOURCE +DEST ++ PROTO +DEST +
+ PORT(S)SOURCE +
+ PORT(S)ORIGINAL
+ DEST- -ACCEPT -loc:~02-00-08-E3-FA-55 -dmz -all -- - + ACCEPT +loc:~02-00-08-E3-FA-55 +dmz +all ++ +
Shorewall allows @@ -1554,8 +1576,8 @@ is unique and will not overlap with any usage on the firewall system.
stopped. -The /etc/shorewall/masq @@ -1566,13 +1588,13 @@ use of this feature, you must have NAT enabled
Columns are:
-![]() |
+
|
![]() |
+ is added, only packets addressed to that host or subnet will be masqueraded.
+ The subnet may be optionally followed by "!' and a comma-separated list of addresses and/or subnets that are to be - excluded from masquerading. |
![]() | ADDRESS - The source address to be used
+ excluded from masquerading.
+ |
Example 1: You have eth0 connected to a cable modem and eth1 connected @@ -1595,26 +1617,26 @@ use of this feature, you must have NAT enabled would look like:
-
- INTERFACE | -- SUBNET | -ADDRESS | ++ INTERFACE | ++ SUBNET | +ADDRESS |
eth0 | -192.168.9.0/24 | -+ | eth0 | +192.168.9.0/24 | +
Example 2: You have a number of IPSEC tunnels through ipsec0 and @@ -1622,26 +1644,26 @@ you want to masquerade traffic from your 192.168.9.0/24 subnet to the remote subnet 10.1.0.0/16 only.
-+
+
- - INTERFACE -- SUBNET -ADDRESS ++ INTERFACE ++ SUBNET +ADDRESS - -ipsec0:10.1.0.0/16 -192.168.9.0/24 -+ ipsec0:10.1.0.0/16 +192.168.9.0/24 +
Example 3: You have a DSL line connected on eth0 and a local network @@ -1653,22 +1675,22 @@ remote subnet 10.1.0.0/16 only.
206.124.146.176.-+
+
- - INTERFACE -- SUBNET -ADDRESS ++ INTERFACE ++ SUBNET +ADDRESS - -eth0 -192.168.10.0/24 -206.124.146.176 +eth0 +192.168.10.0/24 +206.124.146.176
Example 4: @@ -1681,26 +1703,26 @@ remote subnet 10.1.0.0/16 only.
--+
+
- - INTERFACE -- SUBNET -ADDRESS ++ INTERFACE ++ SUBNET +ADDRESS - -eth0 -192.168.10.0/24!192.168.10.44,192.168.10.45 -206.124.146.176 +eth0 +192.168.10.0/24!192.168.10.44,192.168.10.45 +206.124.146.176
If you want to @@ -1740,16 +1762,16 @@ remote subnet 10.1.0.0/16 only.
this file for each system using proxy ARP. Columns are: -![]() | - ADDRESS - address of the system. |
![]() |
+
|
![]() |
+is obvious from the subnetting, you may enter "-" in this column.
+ |
![]() | HAVEROUTE - If
+ for the ADDRESS specified in the first column.
+ |
Note: After you have made a change to the /etc/shorewall/proxyarp file, you may need to flush the ARP cache of all routers on the LAN segment connected to the interface specified in the EXTERNAL @@ -1787,11 +1809,11 @@ is obvious from the subnetting, you may enter "-" in this column.
![]() | eth0 - 155.186.235.1 (internet connection) |
![]() | eth1 - 192.168.9.0/24 (masqueraded local systems) |
![]() | eth2 - 192.168.10.1 (interface to your DMZ) |
In your DMZ, you want to install a Web/FTP server with public address @@ -1800,29 +1822,29 @@ and you configure 155.186.235.1 as the default gateway. In your /etc/shorewa file, you will have:
-
- ADDRESS | -- INTERFACE | -- EXTERNAL | -HAVEROUTE | ++ ADDRESS | ++ INTERFACE | ++ EXTERNAL | +HAVEROUTE |
155.186.235.4 | -eth2 | -eth0 | -No | +155.186.235.4 | +eth2 | +eth0 | +No |
Note: You may want to configure the servers in your DMZ with a subnet @@ -1847,8 +1869,8 @@ ARP Subnet Mini HOWTO ( - /etc/shorewall/nat
+The /etc/shorewall/nat @@ -1890,16 +1912,16 @@ use of this feature, you must have NAT enabled
Columns in an entry are:
-![]() |
+
|
![]() |
+ address of the interface named in the next column.
+ |
![]() | - INTERNAL - Internal IP address. |
![]() | ALL
+ on.
+ |
![]() | LOCAL - If Yes or yes and the ALL INTERFACES column contains Yes
+ /etc/shorewall/interface entry for that interface.
+ |
Look here for additional information and an example.
-The /etc/shorewall/tunnels file allows you to define IPSec, GRE and IPIP tunnels @@ -1957,13 +1979,19 @@ a development snapshot as patching with version 1.9 results in kernel compilat tunnels under Shorewall.
-This file is used to set the following firewall parameters:
-![]() | LOGNEWNOTSYN - Added in Version 1.3.6 +
| ||||||||||||||||||||||||||||||||
![]() | MERGE_HOSTS - Added in Version 1.3.5 + + Prior to 1.3.5, when the /etc/shorewall/hosts file included an entry for a zone then the entire zone had to be defined in the /etc/shorewall/hosts file and any associations between the zone and @@ -1988,61 +2016,61 @@ a development snapshot as patching with version 1.9 results in kernel compilat Example: Interfaces File: -
| ||||||||||||||||||||||||||||||||
![]() | MULTIPORT - Added in Version 1.3.2 + + If set to "Yes" or "yes", Shorewall will use the Netfilter multiport facility. In order to use this facility, your kernel must have multiport support (CONFIG_IP_NF_MATCH_MULTIPORT). When this support is used, Shorewall will generate a single rule from each record in the /etc/shorewall/rules file that meets these criteria: -
Rules not meeting those criteria will continue to generate an individual - rule for each listed port or port range. | ||||||||||||||||||||||||||||||||
![]() | NAT_BEFORE_RULES + rule for each listed port or port range. + If set to "No" or "no", port forwarding rules can override the contents of the /etc/shorewall/nat file. If set to "Yes" or "yes", port forwarding rules cannot override static NAT. If not set or set to an - empty value, "Yes" is assumed. | ||||||||||||||||||||||||||||||||
![]() | FW + empty value, "Yes" is assumed. + This parameter specifies the @@ -2053,8 +2081,8 @@ a development snapshot as patching with version 1.9 results in kernel compilat empty string, the value "fw" - is assumed. | ||||||||||||||||||||||||||||||||
![]() | SUBSYSLOCK + is assumed. + This parameter should be set to the name of a file that the firewall should create if it starts successfully and remove when it stops. Creating and removing this file allows Shorewall to work with your distribution's @@ -2062,8 +2090,8 @@ a development snapshot as patching with version 1.9 results in kernel compilat For Debian, the value is /var/state/shorewall and in LEAF it is /var/run/shorwall. Example: - SUBSYSLOCK=/var/lock/subsys/shorewall. | ||||||||||||||||||||||||||||||||
![]() |
+ SUBSYSLOCK=/var/lock/subsys/shorewall.
+ This parameter specifies the name of a directory where Shorewall stores state information. If the directory doesn't exist when Shorewall @@ -2071,20 +2099,23 @@ starts, it will create the directory. Example: STATEDIR=/tmp/shorewall. NOTE: If you change the STATEDIR variable while the firewall is running, create the new directory if necessary then copy the contents of the - old directory to the new directory. | ||||||||||||||||||||||||||||||||
![]() |
+ old directory to the new directory.
+ This parameter must be assigned the value "Yes" ("yes") or "No" ("no") and specifies whether Shorewall allows connection requests that are related to an already allowed connection. If you say "No" ("no"), you can still override this setting by including "related" rules in - /etc/shorewall/rules ("related" given as the protocol). | ||||||||||||||||||||||||||||||||
![]() |
+ /etc/shorewall/rules ("related" given as the protocol). If you specify
+ ALLOWRELATED=No, you will need to include rules in
+ /etc/shorewall/icmpdef to
+ handle common ICMP packet types.
+ This parameter specifies the directory where your kernel netfilter modules may be found. If you leave the variable empty, Shorewall will - supply the value "/lib/modules/`uname -r`/kernel/net/ipv4/netfilter. | ||||||||||||||||||||||||||||||||
![]() |
+ supply the value "/lib/modules/`uname -r`/kernel/net/ipv4/netfilter.
+ These parameters set the match rate and initial burst size for logged packets. Please see the iptables man page for a description of the behavior @@ -2095,8 +2126,8 @@ you can still override this setting by including "related" rules in Example: LOGRATE=10/minute LOGBURST=5 - | ||||||||||||||||||||||||||||||||
![]() | LOGFILE + + This parameter tells the /sbin/shorewall @@ -2117,8 +2148,8 @@ you can still override this setting by including "related" rules in an empty value, /var/log/messages - is assumed. | ||||||||||||||||||||||||||||||||
![]() | NAT_ENABLED + is assumed. + This parameter determines whether Shorewall supports NAT operations. NAT operations include: @@ -2131,8 +2162,8 @@ you can still override this setting by including "related" rules in then NAT is enabled. If the parameter has a value of "no" or "No" then NAT is disabled. - | ||||||||||||||||||||||||||||||||
![]() |
+
+ This parameter determines if packet mangling is enabled. If the parameter has no value or has a value of "Yes" or "yes" than @@ -2140,8 +2171,8 @@ parameter has no value or has a value of "Yes" or "yes" than or "No" then packet mangling is disabled. If packet mangling is disabled, the /etc/shorewall/tos file is ignored. - | ||||||||||||||||||||||||||||||||
![]() |
+
+ This parameter determines whether Shorewall enables or disables IPV4 Packet Forwarding (/proc/sys/net/ipv4/ip_forward). Possible values @@ -2155,8 +2186,8 @@ IPV4 Packet Forwarding (/proc/sys/net/ipv4/ip_forward). Possible values If this variable is not set or is given an empty value (IP_FORWARD="") then IP_FORWARD=On is assumed. - | ||||||||||||||||||||||||||||||||
![]() | ADD_IP_ALIASES + + This parameter determines whether Shorewall automatically adds the external address(es) in /etc/shorewall/nat @@ -2166,8 +2197,8 @@ these aliases yourself using your distribution's network configuration tools. If this variable is not set or is given an empty value (ADD_IP_ALIASES="") - then ADD_IP_ALIASES=Yes is assumed. | ||||||||||||||||||||||||||||||||
![]() | ADD_SNAT_ALIASES + then ADD_IP_ALIASES=Yes is assumed. + This parameter determines whether Shorewall automatically adds the SNAT ADDRESS in /etc/shorewall/masq. If the variable is set to "Yes" or "yes" then Shorewall automatically adds these addresses. If @@ -2176,8 +2207,8 @@ tools. If this variable is not set or is given an empty value (ADD_SNAT_ALIASES="") then ADD_SNAT_ALIASES=No is assumed. - | ||||||||||||||||||||||||||||||||
![]() | LOGUNCLEAN + + This parameter determines the logging level @@ -2208,8 +2239,8 @@ tools. the specified level (Example: - LOGUNCLEAN=debug). | ||||||||||||||||||||||||||||||||
![]() | BLACKLIST_DISPOSITION + LOGUNCLEAN=debug). + This parameter determines the disposition of @@ -2234,8 +2265,8 @@ tools. you assign an empty value then DROP is - assumed. | ||||||||||||||||||||||||||||||||
![]() | BLACKLIST_LOGLEVEL + assumed. + This paremter determines if packets from @@ -2260,8 +2291,8 @@ tools. from blacklisted hosts are not - logged. | ||||||||||||||||||||||||||||||||
![]() | CLAMPMSS + logged. + This parameter enables the TCP Clamp MSS @@ -2292,17 +2323,17 @@ tools. requires CONFIG_IP_NF_TARGET_TCPMSS in - your kernel. | ||||||||||||||||||||||||||||||||
![]() | ROUTE_FILTER + your kernel. + If this parameter is given the value "Yes" or "yes" then route filtering (anti-spoofing) is - enabled on all network interfaces. The default value is "no". |
The file @@ -2403,8 +2434,8 @@ so, then the following command is executed:
-![]() |
+
|
![]() |
+ source.
+ |
![]() |
+ any destination.
+ |
![]() |
+ number.
+ |
![]() |
+ a hyphen ("-") in this column.
+ |
![]() | - TOS -- The type of service. Must be one of the following: |
@@ -2468,65 +2499,65 @@ by Shorewall, you must have mangle support enabled-
SOURCE | -DEST | -PROTOCOL | -SOURCE - PORT(S) |
- DEST PORT(S) | -TOS | +SOURCE | +DEST | +PROTOCOL | +SOURCE + PORT(S) |
+ DEST PORT(S) | +TOS |
all | -all | -tcp | -- | -ssh | -16 | +all | +all | +tcp | +- | +ssh | +16 |
all | -all | -tcp | -ssh | -- | -16 | +all | +all | +tcp | +ssh | +- | +16 |
all | -all | -tcp | -- | -ftp | -16 | +all | +all | +tcp | +- | +ftp | +16 |
all | -all | -tcp | -ftp | -- | -16 | +all | +all | +tcp | +ftp | +- | +16 |
all | -all | -tcp | -- | -ftp-data | -8 | +all | +all | +tcp | +- | +ftp-data | +8 |
all | -all | -tcp | -ftp-data | -- | -8 | +all | +all | +tcp | +ftp-data | +- | +8 |
WARNING: Users have reported that odd routing problems result from adding the ESP and AH protocols to the /etc/shorewall/tos file.
-Each line @@ -2555,8 +2586,8 @@ by Shorewall, you must have mangle support enabled -
130.252.100.69 - 206.124.146.0/24+
130.252.100.69 + 206.124.146.0/24
Packets from @@ -2604,7 +2635,7 @@ by Shorewall, you must have mangle support enabled/etc/shorewall/rfc1918 (Added in Version 1.3.1) +
![]() | SUBNET - The subnet using VLSM notation (e.g., 192.168.0.0/16). | ||||||
![]() | TARGET - What to do with packets to/from the SUBNET:
|
![]() | INTERFACE - The firewall interface through which the host(s) comminicate with the firewall. |
![]() | HOST(S) - (Optional) - A comma-separated list of IP/Subnet addresses. If not supplied or supplied as "-" then 0.0.0.0/0 is assumed. |
INTERFACE | -HOST(S) | +INTERFACE | +HOST(S) |
eth2 | -192.168.1.0/24 | +eth2 | +192.168.1.0/24 |
eth1 | -- | +eth1 | +- |
- Updated 8/6/2002 - Tom + Updated 8/22/2002 - Tom Eastep
@@ -2678,4 +2709,4 @@ Eastep - \ No newline at end of file +