Upgrade make(1). 1/2
[dragonfly.git] / share / examples / pf / faq-example1
1 # $OpenBSD: faq-example1,v 1.3 2005/07/02 16:16:39 joel Exp $
2 # $DragonFly: src/share/examples/pf/faq-example1,v 1.1 2005/12/13 01:58:27 corecode Exp $
3
4 #
5 # Firewall for Home or Small Office
6 # http://www.openbsd.org/faq/pf/example1.html
7 #
8
9
10 # macros
11 int_if = "fxp0"
12 ext_if = "ep0"
13
14 tcp_services = "{ 22, 113 }"
15 icmp_types = "echoreq"
16
17 priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
18
19 comp3 = "192.168.0.3"
20
21 # options
22 set block-policy return
23 set loginterface $ext_if
24
25 # scrub
26 scrub in all
27
28 # nat/rdr
29 nat on $ext_if from $int_if:network to any -> ($ext_if)
30 rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 \
31    port 8021
32 rdr on $ext_if proto tcp from any to any port 80 -> $comp3
33
34 # filter rules
35 block all
36
37 pass quick on lo0 all
38
39 block drop in  quick on $ext_if from $priv_nets to any
40 block drop out quick on $ext_if from any to $priv_nets
41
42 pass in on $ext_if inet proto tcp from any to ($ext_if) \
43    port $tcp_services flags S/SA keep state
44
45 pass in on $ext_if proto tcp from any to $comp3 port 80 \
46    flags S/SA synproxy state
47
48 pass in on $ext_if inet proto tcp from port 20 to ($ext_if) \
49    user proxy flags S/SA keep state
50
51 pass in inet proto icmp all icmp-type $icmp_types keep state
52
53 pass in  on $int_if from $int_if:network to any keep state
54 pass out on $int_if from any to $int_if:network keep state
55
56 pass out on $ext_if proto tcp all modulate state flags S/SA
57 pass out on $ext_if proto { udp, icmp } all keep state