aboutsummaryrefslogtreecommitdiff
path: root/files/etc/pf.conf.freebsd
blob: 881fcea3f5b5a0d393e08acc5b5d7421358de16d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$(if [ -n "${pf_egress_interfaces:-}" ]; then
    printf 'egress = "{ %s }"\n' "$(join ', ' $pf_egress_interfaces)"
  else
    printf 'egress = "%s"\n' "$BOXCONF_DEFAULT_INTERFACE"
  fi)
allowed_tcp_ports = "{ $(join ', ' ${allowed_tcp_ports:-}) }"
allowed_udp_ports = "{ $(join ', ' ${allowed_udp_ports:-}) }"

$([ "${acme_standalone:-}" = true ] && cat <<EOF
acme_standalone_port = ${acme_standalone_port}
acme_standalone_user = $(id -u "$acme_user")
EOF
)
nfscbd_port = ${nfscbd_port}

set block-policy return
set skip on lo
$([ -n "${pf_skip_interfaces:-}" ] && printf \
  'set skip on %s\n' $pf_skip_interfaces)

scrub in on \$egress all fragment reassemble no-df

$([ "${acme_standalone:-}" = true ] && echo \
  'rdr on $egress inet proto tcp to port http -> ($egress) port $acme_standalone_port'

[ -n "${redirect_tcp_ports:-}" ] && printf \
  'rdr on $egress inet proto tcp to port %s -> ($egress) port %s\n' $redirect_tcp_ports

[ -n "${redirect_udp_ports:-}" ] && printf \
  'rdr on $egress inet proto udp to port %s -> ($egress) port %s\n' $redirect_udp_ports)

antispoof quick for \$egress

block all
pass out quick on \$egress inet
pass in quick on \$egress inet proto icmp all icmp-type { echoreq, unreach }

$([ "${acme_standalone:-}" = true ] && echo \
  'pass in quick on $egress inet proto tcp to port $acme_standalone_port user $acme_standalone_user'

[ -n "${allowed_tcp_ports:-}" ] && echo \
  'pass in quick on $egress inet proto tcp to port $allowed_tcp_ports'

[ -n "${allowed_udp_ports:-}" ] && echo \
  'pass in quick on $egress inet proto udp to port $allowed_udp_ports'

[ "$BOXCONF_VIRTUALIZATION_TYPE" == jail ] || echo \
  'pass in quick on $egress inet proto { tcp, udp } to port $nfscbd_port')