1SHOREWALL-POLICY(5) Configuration Files SHOREWALL-POLICY(5)
2
3
4
6 policy - Shorewall policy file
7
9 /etc/shorewall[6]/policy
10
12 This file defines the high-level policy for connections between zones
13 defined in shorewall-zones[1](5).
14
15 Important
16 The order of entries in this file is important
17
18 This file determines what to do with a new connection request if we
19 don't get a match from the shorewall-blrules[2](5) or
20 shorewall-rules[3](5) files. For each source/destination pair, the
21 file is processed in order until a match is found ("all" will match
22 any source or destination).
23
24 Important
25 Intra-zone policies are pre-defined
26
27 For $FW and for all of the zones defined in shorewall-zones[1](5),
28 the POLICY for connections from the zone to itself is ACCEPT (with
29 no logging or TCP connection rate limiting) but may be overridden
30 by an entry in this file. The overriding entry must be explicit
31 (specifying the zone name in both SOURCE and DEST) or it must use
32 "all+" (Shorewall 4.5.17 or later).
33
34 Similarly, if you have IMPLICIT_CONTINUE=Yes in
35 shorewall.conf[4](5), then the implicit policy to/from any sub-zone
36 is CONTINUE. These implicit CONTINUE policies may also be
37 overridden by an explicit entry in this file.
38
39 The columns in the file are as follows (where the column name is
40 followed by a different name in parentheses, the different name is used
41 in the alternate specification syntax).
42
43 SOURCE - zone[,...[+]]|$FW|all|all+
44 Source zone. Must be the name of a zone defined in
45 shorewall-zones[1](5), $FW, "all" or "all+".
46
47 Support for "all+" was added in Shorewall 4.5.17. "all" does not
48 override the implicit intra-zone ACCEPT policy while "all+" does.
49
50 Beginning with Shorewall 5.0.12, multiple zones may be listed
51 separated by commas. As above, if '+' is specified after two or
52 more zone names, then the policy overrides the implicit intra-zone
53 ACCEPT policy if the same zone appears in both the SOURCE and DEST
54 columns.
55
56 DEST - zone[,...[+]]|$FW|all|all+
57 Destination zone. Must be the name of a zone defined in
58 shorewall-zones[1](5), $FW, "all" or "all+". If the DEST is a bport
59 zone, then the SOURCE must be "all", "all+", another bport zone
60 associated with the same bridge, or it must be an ipv4 zone that is
61 associated with only the same bridge.
62
63 Support for "all+" was added in Shorewall 4.5.17. "all" does not
64 override the implicit intra-zone ACCEPT policy while "all+" does.
65
66 Beginning with Shorewall 5.0.12, multiple zones may be listed
67 separated by commas. As above, if '+' is specified after two or
68 more zone names, then the policy overrides the implicit intra-zone
69 ACCEPT policy if the same zone appears in both the SOURCE and DEST
70 columns.
71
72 POLICY -
73 {ACCEPT|DROP|REJECT|BLACKLIST|CONTINUE|QUEUE|NFQUEUE[(queuenumber1[:queuenumber2])]|NONE}[:{[+]policy-action[:level][,...]|None}]
74 Policy if no match from the rules file is found.
75
76 If the policy is neither CONTINUE nor NONE then the policy may be
77 followed by ":" and one of the following:
78
79 1. The word "None" or "none". This causes any default action
80 defined in shorewall.conf[4](5) to be omitted for this policy.
81
82 2. The name of an action with optional parameters enclosed in
83 parentheses. The action will be invoked before the policy is
84 enforced.
85
86 Actions can have parameters specified.
87
88 Beginning with Shorewall 4.5.10, the action name can be followed
89 optionally by a colon and a log level. The level will be applied to
90 each rule in the action or body that does not already have a log
91 level.
92
93 Beginning with Shorewall 5.1.2, multiple action[:level]
94 specification may be listeded, separated by commas. The actions are
95 invoked in the order listed. Also beginning with Shorewall 5.1.2,
96 the policy-action list can be prefixed with a plus sign ("+")
97 indicating that the listed actions are in addition to those listed
98 in the related _DEFAULT setting in shorewall.conf[4](5).
99
100 Possible policies are:
101
102 ACCEPT
103 Accept the connection.
104
105 DROP
106 Ignore the connection request.
107
108 REJECT
109 For TCP, send RST. For all other, send an "unreachable" ICMP.
110
111 BLACKLIST
112 Added in Shorewall 5.1.1 and requires that the
113 DYNAMIC_BLACKLIST setting in shorewall.conf[4](5) specifies
114 ipset-based dynamic blacklisting. The SOURCE IP address is
115 added to the blacklist ipset and the connection request is
116 ignored.
117
118 QUEUE
119 Queue the request for a user-space application such as
120 Snort-inline.
121
122 NFQUEUE
123 Queue the request for a user-space application using the
124 nfnetlink_queue mechanism. If a queuenumber1 is not given,
125 queue zero (0) is assumed. Beginning with Shorewall 4.6.10, a
126 second queue number (queuenumber2) may be given. This specifies
127 a range of queues to use. Packets are then balanced across the
128 given queues. This is useful for multicore systems: start
129 multiple instances of the userspace program on queues x, x+1,
130 .. x+n and use "x:x+n". Packets belonging to the same
131 connection are put into the same nfqueue.
132
133 CONTINUE
134 Pass the connection request past any other rules that it might
135 also match (where the source or destination zone in those rules
136 is a superset of the SOURCE or DEST in this policy). See
137 shorewall-nesting[5](5) for additional information.
138
139 NONE
140 Assume that there will never be any packets from this SOURCE to
141 this DEST. Shorewall will not create any infrastructure to
142 handle such packets and you may not have any rules with this
143 SOURCE and DEST in the /etc/shorewall/rules file. If such a
144 packet is received, the result is undefined. NONE may not be
145 used if the SOURCE or DEST columns contain the firewall zone
146 ($FW) or "all".
147
148 LOGLEVEL (loglevel) - [log-level|ULOG|NFLOG]
149 Optional - if supplied, each connection handled under the default
150 POLICY is logged at that level. If not supplied, no log message is
151 generated. See syslog.conf(5) for a description of log levels.
152
153 You may also specify ULOG or NFLOG (must be in upper case). This
154 will log to the ULOG or NFLOG target and will send to a separate
155 log through use of ulogd
156 (http://www.netfilter.org/projects/ulogd/index.html).
157
158 For a description of logging, see shorewall-logging(5)[6].
159
160 If you don't want to log but need to specify the following column,
161 place "-" here.
162
163 RATE (rate) - [-|limit]
164 where limit is one of:
165 [-|[{s|d}[/vlsm]:[[name][(ht-buckets,ht-max)]:]]]rate/{sec|min|hour|day}[:burst]
166 [name1:]rate1/{sec|min|hour|day}[:burst1],[name2:]rate2/{sec|min|hour|day}[:burst2]
167 If passed, specifies the maximum TCP connection rate and the size
168 of an acceptable burst. If not specified, TCP connections are not
169 limited. If the burst parameter is omitted, a value of 5 is
170 assumed.
171
172 When s: or d: is specified, the rate applies per source IP address
173 or per destination IP address respectively. The name may be chosen
174 by the user and specifies a hash table to be used to count matching
175 connections. If not give, the name shorewall is assumed. Where more
176 than one POLICY or rule specifies the same name, the connections
177 counts for the policies are aggregated and the individual rates
178 apply to the aggregated count. Beginning with Shorewall 5.2.1, the
179 s or d may be followed by a slash ("/") and an integer vlsm. When a
180 vlsm is specified, all source or destination addresses encountered
181 will be grouped according to the given prefix length and the
182 so-created subnet will be subject to the rate limit.
183
184 Beginning with Shorewall 4.6.5, two limits may be specified,
185 separated by a comma. In this case, the first limit (name1, rate1,
186 burst1) specifies the per-source IP limit and the second limit
187 specifies the per-destination IP limit.
188
189 Example: client:10/sec:20,:60/sec:100
190
191 Beginning with Shorewall 5.2.1, the table name, if any, may be
192 followed by two integers separated by commas and enclosed in
193 parentheses. The first integer (ht-buckets) specifies the number of
194 buckets in the generated hash table. The second integer (ht-max)
195 specifies the maximum number of entries in the hash table.
196
197 Example: s:client(1024,65536):10/sec
198
199 CONNLIMIT - limit[:mask]
200 May be used to limit the number of simultaneous connections from
201 each individual host to limit connections. While the limit is only
202 checked on connections to which this policy could apply, the number
203 of current connections is calculated over all current connections
204 from the SOURCE host. By default, the limit is applied to each host
205 individually but can be made to apply to networks of hosts by
206 specifying a mask. The mask specifies the width of a VLSM mask to
207 be applied to the source address; the number of current connections
208 is then taken over all hosts in the subnet source-address/mask.
209
211 1. All connections from the local network to the internet are allowed
212
213 2. All connections from the internet are ignored but logged at syslog
214 level KERNEL.INFO.
215
216 3. All other connection requests are rejected and logged at level
217 KERNEL.INFO.
218
219 #SOURCE DEST POLICY LOG BURST:LIMIT
220 # LEVEL
221 loc net ACCEPT
222 net all DROP info
223 #
224 # THE FOLLOWING POLICY MUST BE LAST
225 #
226 all all REJECT info
227
229 /etc/shorewall/policy
230
231 /etc/shorewall6/policy
232
234 http://www.shorewall.net/configuration_file_basics.htm#Pairs[7]
235
236 shorewall(8)
237
239 1. shorewall-zones
240 http://www.shorewall.net/manpages/shorewall-zones.html
241
242 2. shorewall-blrules
243 http://www.shorewall.net/manpages/shorewall-blrules.html
244
245 3. shorewall-rules
246 http://www.shorewall.net/manpages/shorewall-rules.html
247
248 4. shorewall.conf
249 http://www.shorewall.net/manpages/shorewall.conf.html
250
251 5. shorewall-nesting
252 http://www.shorewall.net/manpages/shorewall-nesting.html
253
254 6. shorewall-logging(5)
255 http://www.shorewall.net/shorewall_logging.html
256
257 7. http://www.shorewall.net/configuration_file_basics.htm#Pairs
258 http://www.shorewall.net/configuration_file_basics.htm#Pairs
259
260
261
262Configuration Files 01/17/2019 SHOREWALL-POLICY(5)