Deleted Added
full compact
rc.firewall (181762) rc.firewall (200028)
1#!/bin/sh -
2# Copyright (c) 1996 Poul-Henning Kamp
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24# SUCH DAMAGE.
25#
1#!/bin/sh -
2# Copyright (c) 1996 Poul-Henning Kamp
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24# SUCH DAMAGE.
25#
26# $FreeBSD: head/etc/rc.firewall 181762 2008-08-15 19:20:59Z jhb $
26# $FreeBSD: head/etc/rc.firewall 200028 2009-12-02 15:05:26Z ume $
27#
28
29#
30# Setup system for ipfw(4) firewall service.
31#
32
33# Suck in the configuration variables.
34if [ -z "${source_rc_confs_defined}" ]; then

--- 45 unchanged lines hidden (view full) ---

80
81setup_loopback () {
82 ############
83 # Only in rare cases do you want to change these rules
84 #
85 ${fwcmd} add 100 pass all from any to any via lo0
86 ${fwcmd} add 200 deny all from any to 127.0.0.0/8
87 ${fwcmd} add 300 deny ip from 127.0.0.0/8 to any
27#
28
29#
30# Setup system for ipfw(4) firewall service.
31#
32
33# Suck in the configuration variables.
34if [ -z "${source_rc_confs_defined}" ]; then

--- 45 unchanged lines hidden (view full) ---

80
81setup_loopback () {
82 ############
83 # Only in rare cases do you want to change these rules
84 #
85 ${fwcmd} add 100 pass all from any to any via lo0
86 ${fwcmd} add 200 deny all from any to 127.0.0.0/8
87 ${fwcmd} add 300 deny ip from 127.0.0.0/8 to any
88 if [ $ipv6_available -eq 0 ]; then
89 ${fwcmd} add 400 deny all from any to ::1
90 ${fwcmd} add 500 deny all from ::1 to any
91 fi
88}
89
92}
93
94setup_ipv6_mandatory () {
95 [ $ipv6_available -eq 0 ] || return 0
96
97 ############
98 # Only in rare cases do you want to change these rules
99 #
100 # ND
101 #
102 # DAD
103 ${fwcmd} add pass ipv6-icmp from :: to ff02::/16
104 # RS, RA, NS, NA, redirect...
105 ${fwcmd} add pass ipv6-icmp from fe80::/10 to fe80::/10
106 ${fwcmd} add pass ipv6-icmp from fe80::/10 to ff02::/16
107
108 # Allow ICMPv6 destination unreach
109 ${fwcmd} add pass ipv6-icmp from any to any icmp6types 1
110
111 # Allow NS/NA/toobig (don't filter it out)
112 ${fwcmd} add pass ipv6-icmp from any to any icmp6types 2,135,136
113}
114
90if [ -n "${1}" ]; then
91 firewall_type="${1}"
92fi
93
115if [ -n "${1}" ]; then
116 firewall_type="${1}"
117fi
118
119. /etc/rc.subr
120. /etc/network.subr
121afexists inet6
122ipv6_available=$?
123
94############
95# Set quiet mode if requested
96#
97case ${firewall_quiet} in
98[Yy][Ee][Ss])
99 fwcmd="/sbin/ipfw -q"
100 ;;
101*)
102 fwcmd="/sbin/ipfw"
103 ;;
104esac
105
106############
107# Flush out the list before we begin.
108#
109${fwcmd} -f flush
110
111setup_loopback
124############
125# Set quiet mode if requested
126#
127case ${firewall_quiet} in
128[Yy][Ee][Ss])
129 fwcmd="/sbin/ipfw -q"
130 ;;
131*)
132 fwcmd="/sbin/ipfw"
133 ;;
134esac
135
136############
137# Flush out the list before we begin.
138#
139${fwcmd} -f flush
140
141setup_loopback
142setup_ipv6_mandatory
112
113############
114# Network Address Translation. All packets are passed to natd(8)
115# before they encounter your remaining rules. The firewall rules
116# will then be run again on each packet after translation by natd
117# starting at the rule number following the divert rule.
118#
119# For ``simple'' firewall type the divert rule should be put to a

--- 41 unchanged lines hidden (view full) ---

161 ;;
162
163[Cc][Ll][Ii][Ee][Nn][Tt])
164 ############
165 # This is a prototype setup that will protect your system somewhat
166 # against people from outside your own network.
167 #
168 # Configuration:
143
144############
145# Network Address Translation. All packets are passed to natd(8)
146# before they encounter your remaining rules. The firewall rules
147# will then be run again on each packet after translation by natd
148# starting at the rule number following the divert rule.
149#
150# For ``simple'' firewall type the divert rule should be put to a

--- 41 unchanged lines hidden (view full) ---

192 ;;
193
194[Cc][Ll][Ii][Ee][Nn][Tt])
195 ############
196 # This is a prototype setup that will protect your system somewhat
197 # against people from outside your own network.
198 #
199 # Configuration:
169 # firewall_client_net: Network address of local network.
200 # firewall_client_net: Network address of local IPv4 network.
201 # firewall_client_net_ipv6: Network address of local IPv6 network.
170 ############
171
172 # set this to your local network
173 net="$firewall_client_net"
202 ############
203
204 # set this to your local network
205 net="$firewall_client_net"
206 net6="$firewall_client_net_ipv6"
174
175 # Allow limited broadcast traffic from my own net.
176 ${fwcmd} add pass all from ${net} to 255.255.255.255
177
178 # Allow any traffic to or from my own net.
179 ${fwcmd} add pass all from me to ${net}
180 ${fwcmd} add pass all from ${net} to me
207
208 # Allow limited broadcast traffic from my own net.
209 ${fwcmd} add pass all from ${net} to 255.255.255.255
210
211 # Allow any traffic to or from my own net.
212 ${fwcmd} add pass all from me to ${net}
213 ${fwcmd} add pass all from ${net} to me
214 if [ -n "$net6" ]; then
215 ${fwcmd} add pass all from me6 to ${net6}
216 ${fwcmd} add pass all from ${net6} to me6
217 fi
181
218
219 if [ -n "$net6" ]; then
220 # Allow any link-local multicast traffic
221 ${fwcmd} add pass all from fe80::/10 to ff02::/16
222 ${fwcmd} add pass all from ${net6} to ff02::/16
223 fi
224
182 # Allow TCP through if setup succeeded
183 ${fwcmd} add pass tcp from any to any established
184
185 # Allow IP fragments to pass through
186 ${fwcmd} add pass all from any to any frag
187
188 # Allow setup of incoming email
189 ${fwcmd} add pass tcp from any to me 25 setup

--- 17 unchanged lines hidden (view full) ---

207
208[Ss][Ii][Mm][Pp][Ll][Ee])
209 ############
210 # This is a prototype setup for a simple firewall. Configure this
211 # machine as a DNS and NTP server, and point all the machines
212 # on the inside at this machine for those services.
213 #
214 # Configuration:
225 # Allow TCP through if setup succeeded
226 ${fwcmd} add pass tcp from any to any established
227
228 # Allow IP fragments to pass through
229 ${fwcmd} add pass all from any to any frag
230
231 # Allow setup of incoming email
232 ${fwcmd} add pass tcp from any to me 25 setup

--- 17 unchanged lines hidden (view full) ---

250
251[Ss][Ii][Mm][Pp][Ll][Ee])
252 ############
253 # This is a prototype setup for a simple firewall. Configure this
254 # machine as a DNS and NTP server, and point all the machines
255 # on the inside at this machine for those services.
256 #
257 # Configuration:
215 # firewall_simple_iif: Inside network interface.
216 # firewall_simple_inet: Inside network address.
217 # firewall_simple_oif: Outside network interface.
218 # firewall_simple_onet: Outside network address.
258 # firewall_simple_iif: Inside IPv4 network interface.
259 # firewall_simple_inet: Inside IPv4 network address.
260 # firewall_simple_oif: Outside IPv4 network interface.
261 # firewall_simple_onet: Outside IPv4 network address.
262 # firewall_simple_iif_ipv6: Inside IPv6 network interface.
263 # firewall_simple_inet_ipv6: Inside IPv6 network prefix.
264 # firewall_simple_oif_ipv6: Outside IPv6 network interface.
265 # firewall_simple_onet_ipv6: Outside IPv6 network prefix.
219 ############
220
221 # set these to your outside interface network
222 oif="$firewall_simple_oif"
223 onet="$firewall_simple_onet"
266 ############
267
268 # set these to your outside interface network
269 oif="$firewall_simple_oif"
270 onet="$firewall_simple_onet"
271 oif6="${firewall_simple_oif_ipv6:-$firewall_simple_oif}"
272 onet6="$firewall_simple_onet_ipv6"
224
225 # set these to your inside interface network
226 iif="$firewall_simple_iif"
227 inet="$firewall_simple_inet"
273
274 # set these to your inside interface network
275 iif="$firewall_simple_iif"
276 inet="$firewall_simple_inet"
277 iif6="${firewall_simple_iif_ipv6:-$firewall_simple_iif}"
278 inet6="$firewall_simple_inet_ipv6"
228
229 # Stop spoofing
230 ${fwcmd} add deny all from ${inet} to any in via ${oif}
231 ${fwcmd} add deny all from ${onet} to any in via ${iif}
279
280 # Stop spoofing
281 ${fwcmd} add deny all from ${inet} to any in via ${oif}
282 ${fwcmd} add deny all from ${onet} to any in via ${iif}
283 if [ -n "$inet6" ]; then
284 ${fwcmd} add deny all from ${inet6} to any in via ${oif6}
285 if [ -n "$onet6" ]; then
286 ${fwcmd} add deny all from ${onet6} to any in \
287 via ${iif6}
288 fi
289 fi
232
233 # Stop RFC1918 nets on the outside interface
234 ${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif}
235 ${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif}
236 ${fwcmd} add deny all from any to 192.168.0.0/16 via ${oif}
237
238 # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
239 # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)

--- 9 unchanged lines hidden (view full) ---

249 # rules. If for example one of your internal LAN machines had its IP
250 # address set to 192.0.2.1 then an incoming packet for it after being
251 # translated by natd(8) would match the `deny' rule above. Similarly
252 # an outgoing packet originated from it before being translated would
253 # match the `deny' rule below.
254 case ${natd_enable} in
255 [Yy][Ee][Ss])
256 if [ -n "${natd_interface}" ]; then
290
291 # Stop RFC1918 nets on the outside interface
292 ${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif}
293 ${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif}
294 ${fwcmd} add deny all from any to 192.168.0.0/16 via ${oif}
295
296 # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
297 # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)

--- 9 unchanged lines hidden (view full) ---

307 # rules. If for example one of your internal LAN machines had its IP
308 # address set to 192.0.2.1 then an incoming packet for it after being
309 # translated by natd(8) would match the `deny' rule above. Similarly
310 # an outgoing packet originated from it before being translated would
311 # match the `deny' rule below.
312 case ${natd_enable} in
313 [Yy][Ee][Ss])
314 if [ -n "${natd_interface}" ]; then
257 ${fwcmd} add divert natd all from any to any via ${natd_interface}
315 ${fwcmd} add divert natd ip4 from any to any via ${natd_interface}
258 fi
259 ;;
260 esac
261
262 # Stop RFC1918 nets on the outside interface
263 ${fwcmd} add deny all from 10.0.0.0/8 to any via ${oif}
264 ${fwcmd} add deny all from 172.16.0.0/12 to any via ${oif}
265 ${fwcmd} add deny all from 192.168.0.0/16 to any via ${oif}
266
267 # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
268 # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)
269 # on the outside interface
270 ${fwcmd} add deny all from 0.0.0.0/8 to any via ${oif}
271 ${fwcmd} add deny all from 169.254.0.0/16 to any via ${oif}
272 ${fwcmd} add deny all from 192.0.2.0/24 to any via ${oif}
273 ${fwcmd} add deny all from 224.0.0.0/4 to any via ${oif}
274 ${fwcmd} add deny all from 240.0.0.0/4 to any via ${oif}
275
316 fi
317 ;;
318 esac
319
320 # Stop RFC1918 nets on the outside interface
321 ${fwcmd} add deny all from 10.0.0.0/8 to any via ${oif}
322 ${fwcmd} add deny all from 172.16.0.0/12 to any via ${oif}
323 ${fwcmd} add deny all from 192.168.0.0/16 to any via ${oif}
324
325 # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
326 # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)
327 # on the outside interface
328 ${fwcmd} add deny all from 0.0.0.0/8 to any via ${oif}
329 ${fwcmd} add deny all from 169.254.0.0/16 to any via ${oif}
330 ${fwcmd} add deny all from 192.0.2.0/24 to any via ${oif}
331 ${fwcmd} add deny all from 224.0.0.0/4 to any via ${oif}
332 ${fwcmd} add deny all from 240.0.0.0/4 to any via ${oif}
333
334 if [ -n "$inet6" ]; then
335 # Stop unique local unicast address on the outside interface
336 ${fwcmd} add deny all from fc00::/7 to any via ${oif6}
337 ${fwcmd} add deny all from any to fc00::/7 via ${oif6}
338
339 # Stop site-local on the outside interface
340 ${fwcmd} add deny all from fec0::/10 to any via ${oif6}
341 ${fwcmd} add deny all from any to fec0::/10 via ${oif6}
342
343 # Disallow "internal" addresses to appear on the wire.
344 ${fwcmd} add deny all from ::ffff:0.0.0.0/96 to any \
345 via ${oif6}
346 ${fwcmd} add deny all from any to ::ffff:0.0.0.0/96 \
347 via ${oif6}
348
349 # Disallow packets to malicious IPv4 compatible prefix.
350 ${fwcmd} add deny all from ::224.0.0.0/100 to any via ${oif6}
351 ${fwcmd} add deny all from any to ::224.0.0.0/100 via ${oif6}
352 ${fwcmd} add deny all from ::127.0.0.0/104 to any via ${oif6}
353 ${fwcmd} add deny all from any to ::127.0.0.0/104 via ${oif6}
354 ${fwcmd} add deny all from ::0.0.0.0/104 to any via ${oif6}
355 ${fwcmd} add deny all from any to ::0.0.0.0/104 via ${oif6}
356 ${fwcmd} add deny all from ::255.0.0.0/104 to any via ${oif6}
357 ${fwcmd} add deny all from any to ::255.0.0.0/104 via ${oif6}
358
359 ${fwcmd} add deny all from ::0.0.0.0/96 to any via ${oif6}
360 ${fwcmd} add deny all from any to ::0.0.0.0/96 via ${oif6}
361
362 # Disallow packets to malicious 6to4 prefix.
363 ${fwcmd} add deny all from 2002:e000::/20 to any via ${oif6}
364 ${fwcmd} add deny all from any to 2002:e000::/20 via ${oif6}
365 ${fwcmd} add deny all from 2002:7f00::/24 to any via ${oif6}
366 ${fwcmd} add deny all from any to 2002:7f00::/24 via ${oif6}
367 ${fwcmd} add deny all from 2002:0000::/24 to any via ${oif6}
368 ${fwcmd} add deny all from any to 2002:0000::/24 via ${oif6}
369 ${fwcmd} add deny all from 2002:ff00::/24 to any via ${oif6}
370 ${fwcmd} add deny all from any to 2002:ff00::/24 via ${oif6}
371
372 ${fwcmd} add deny all from 2002:0a00::/24 to any via ${oif6}
373 ${fwcmd} add deny all from any to 2002:0a00::/24 via ${oif6}
374 ${fwcmd} add deny all from 2002:ac10::/28 to any via ${oif6}
375 ${fwcmd} add deny all from any to 2002:ac10::/28 via ${oif6}
376 ${fwcmd} add deny all from 2002:c0a8::/32 to any via ${oif6}
377 ${fwcmd} add deny all from any to 2002:c0a8::/32 via ${oif6}
378
379 ${fwcmd} add deny all from ff05::/16 to any via ${oif6}
380 ${fwcmd} add deny all from any to ff05::/16 via ${oif6}
381 fi
382
276 # Allow TCP through if setup succeeded
277 ${fwcmd} add pass tcp from any to any established
278
279 # Allow IP fragments to pass through
280 ${fwcmd} add pass all from any to any frag
281
282 # Allow setup of incoming email
283 ${fwcmd} add pass tcp from any to me 25 setup
284
285 # Allow access to our DNS
286 ${fwcmd} add pass tcp from any to me 53 setup
287 ${fwcmd} add pass udp from any to me 53
288 ${fwcmd} add pass udp from me 53 to any
289
290 # Allow access to our WWW
291 ${fwcmd} add pass tcp from any to me 80 setup
292
293 # Reject&Log all setup of incoming connections from the outside
383 # Allow TCP through if setup succeeded
384 ${fwcmd} add pass tcp from any to any established
385
386 # Allow IP fragments to pass through
387 ${fwcmd} add pass all from any to any frag
388
389 # Allow setup of incoming email
390 ${fwcmd} add pass tcp from any to me 25 setup
391
392 # Allow access to our DNS
393 ${fwcmd} add pass tcp from any to me 53 setup
394 ${fwcmd} add pass udp from any to me 53
395 ${fwcmd} add pass udp from me 53 to any
396
397 # Allow access to our WWW
398 ${fwcmd} add pass tcp from any to me 80 setup
399
400 # Reject&Log all setup of incoming connections from the outside
294 ${fwcmd} add deny log tcp from any to any in via ${oif} setup
401 ${fwcmd} add deny log ip4 from any to any in via ${oif} setup proto tcp
402 if [ -n "$inet6" ]; then
403 ${fwcmd} add deny log ip6 from any to any in via ${oif6} \
404 setup proto tcp
405 fi
295
296 # Allow setup of any other TCP connection
297 ${fwcmd} add pass tcp from any to any setup
298
299 # Allow DNS queries out in the world
300 ${fwcmd} add pass udp from me to any 53 keep-state
301
302 # Allow NTP queries out in the world

--- 5 unchanged lines hidden (view full) ---

308 ;;
309
310[Ww][Oo][Rr][Kk][Ss][Tt][Aa][Tt][Ii][Oo][Nn])
311 # Configuration:
312 # firewall_myservices: List of TCP ports on which this host
313 # offers services.
314 # firewall_allowservices: List of IPs which has access to
315 # $firewall_myservices.
406
407 # Allow setup of any other TCP connection
408 ${fwcmd} add pass tcp from any to any setup
409
410 # Allow DNS queries out in the world
411 ${fwcmd} add pass udp from me to any 53 keep-state
412
413 # Allow NTP queries out in the world

--- 5 unchanged lines hidden (view full) ---

419 ;;
420
421[Ww][Oo][Rr][Kk][Ss][Tt][Aa][Tt][Ii][Oo][Nn])
422 # Configuration:
423 # firewall_myservices: List of TCP ports on which this host
424 # offers services.
425 # firewall_allowservices: List of IPs which has access to
426 # $firewall_myservices.
316 # firewall_trusted: List of IPs which has full access
427 # firewall_trusted: List of IPv4s which has full access
317 # to this host. Be very carefull
318 # when setting this. This option can
319 # seriously degrade the level of
320 # protection provided by the firewall.
321 # firewall_logdeny: Boolean (YES/NO) specifying if the
322 # default denied packets should be
323 # logged (in /var/log/security).
324 # firewall_nologports: List of TCP/UDP ports for which
325 # denied incomming packets are not
326 # logged.
428 # to this host. Be very carefull
429 # when setting this. This option can
430 # seriously degrade the level of
431 # protection provided by the firewall.
432 # firewall_logdeny: Boolean (YES/NO) specifying if the
433 # default denied packets should be
434 # logged (in /var/log/security).
435 # firewall_nologports: List of TCP/UDP ports for which
436 # denied incomming packets are not
437 # logged.
327
438 # firewall_trusted_ipv6: List of IPv6s which has full access
439 # to this host. Be very carefull
440 # when setting this. This option can
441 # seriously degrade the level of
442 # protection provided by the firewall.
443
328 # Allow packets for which a state has been built.
329 ${fwcmd} add check-state
330
331 # For services permitted below.
332 ${fwcmd} add pass tcp from me to any established
444 # Allow packets for which a state has been built.
445 ${fwcmd} add check-state
446
447 # For services permitted below.
448 ${fwcmd} add pass tcp from me to any established
449 if [ $ipv6_available -eq 0 ]; then
450 ${fwcmd} add pass tcp from me6 to any established
451 fi
333
334 # Allow any connection out, adding state for each.
335 ${fwcmd} add pass tcp from me to any setup keep-state
336 ${fwcmd} add pass udp from me to any keep-state
337 ${fwcmd} add pass icmp from me to any keep-state
452
453 # Allow any connection out, adding state for each.
454 ${fwcmd} add pass tcp from me to any setup keep-state
455 ${fwcmd} add pass udp from me to any keep-state
456 ${fwcmd} add pass icmp from me to any keep-state
457 if [ $ipv6_available -eq 0 ]; then
458 ${fwcmd} add pass tcp from me6 to any setup keep-state
459 ${fwcmd} add pass udp from me6 to any keep-state
460 ${fwcmd} add pass ipv6-icmp from me6 to any keep-state
461 fi
338
339 # Allow DHCP.
340 ${fwcmd} add pass udp from 0.0.0.0 68 to 255.255.255.255 67 out
341 ${fwcmd} add pass udp from any 67 to me 68 in
342 ${fwcmd} add pass udp from any 67 to 255.255.255.255 68 in
462
463 # Allow DHCP.
464 ${fwcmd} add pass udp from 0.0.0.0 68 to 255.255.255.255 67 out
465 ${fwcmd} add pass udp from any 67 to me 68 in
466 ${fwcmd} add pass udp from any 67 to 255.255.255.255 68 in
467 if [ $ipv6_available -eq 0 ]; then
468 ${fwcmd} add pass udp from fe80::/10 to me6 546 in
469 fi
343 # Some servers will ping the IP while trying to decide if it's
344 # still in use.
345 ${fwcmd} add pass icmp from any to any icmptype 8
470 # Some servers will ping the IP while trying to decide if it's
471 # still in use.
472 ${fwcmd} add pass icmp from any to any icmptype 8
473 if [ $ipv6_available -eq 0 ]; then
474 ${fwcmd} add pass ipv6-icmp from any to any icmp6type 128,129
475 fi
346
347 # Allow "mandatory" ICMP in.
348 ${fwcmd} add pass icmp from any to any icmptype 3,4,11
349
350 # Add permits for this workstations published services below
351 # Only IPs and nets in firewall_allowservices is allowed in.
352 # If you really wish to let anyone use services on your
353 # workstation, then set "firewall_allowservices='any'" in /etc/rc.conf
354 #
355 # Note: We don't use keep-state as that would allow DoS of
356 # our statetable.
357 # You can add 'keep-state' to the lines for slightly
358 # better performance if you fell that DoS of your
359 # workstation won't be a problem.
360 #
361 for i in ${firewall_allowservices} ; do
362 for j in ${firewall_myservices} ; do
363 ${fwcmd} add pass tcp from $i to me $j
476
477 # Allow "mandatory" ICMP in.
478 ${fwcmd} add pass icmp from any to any icmptype 3,4,11
479
480 # Add permits for this workstations published services below
481 # Only IPs and nets in firewall_allowservices is allowed in.
482 # If you really wish to let anyone use services on your
483 # workstation, then set "firewall_allowservices='any'" in /etc/rc.conf
484 #
485 # Note: We don't use keep-state as that would allow DoS of
486 # our statetable.
487 # You can add 'keep-state' to the lines for slightly
488 # better performance if you fell that DoS of your
489 # workstation won't be a problem.
490 #
491 for i in ${firewall_allowservices} ; do
492 for j in ${firewall_myservices} ; do
493 ${fwcmd} add pass tcp from $i to me $j
494 if [ $ipv6_available -eq 0 ]; then
495 ${fwcmd} add pass tcp from $i to me6 $j
496 fi
364 done
365 done
366
367 # Allow all connections from trusted IPs.
368 # Playing with the content of firewall_trusted could seriously
369 # degrade the level of protection provided by the firewall.
370 for i in ${firewall_trusted} ; do
371 ${fwcmd} add pass ip from $i to me
372 done
497 done
498 done
499
500 # Allow all connections from trusted IPs.
501 # Playing with the content of firewall_trusted could seriously
502 # degrade the level of protection provided by the firewall.
503 for i in ${firewall_trusted} ; do
504 ${fwcmd} add pass ip from $i to me
505 done
373
506 for i in ${firewall_trusted_ipv6} ; do
507 ${fwcmd} add pass all from $i to me6
508 done
509
374 ${fwcmd} add 65000 count ip from any to any
375
376 # Drop packets to ports where we don't want logging
377 for i in ${firewall_nologports} ; do
378 ${fwcmd} add deny { tcp or udp } from any to any $i in
379 done
380
381 # Broadcasts and muticasts

--- 31 unchanged lines hidden ---
510 ${fwcmd} add 65000 count ip from any to any
511
512 # Drop packets to ports where we don't want logging
513 for i in ${firewall_nologports} ; do
514 ${fwcmd} add deny { tcp or udp } from any to any $i in
515 done
516
517 # Broadcasts and muticasts

--- 31 unchanged lines hidden ---