# macros
int_if = "rl0"
ext_if = "ng0"
flets_if = "ng1"
gif_if = "gif0"
tcp_services = "{ ssh, http }"
tcp6_services = "{ ssh, http }"
icmp_types = "{ echoreq, unreach, timex }"
icmp6_types = "{ echoreq, unreach, timex, toobig, neighbrsol, neighbradv }"
priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
v6_priv_nets = "{ fec0::/10, ::ffff:0.0.0.0/96, ::224.0.0.0/100, ::127.0.0.0/104,
::0.0.0.0/104, ::255.0.0.0/104, ::0.0.0.0/96 }" (←一行
v6_malicious_6to4 = "{ 2002:e000::/20, 2002:7f00::/24, 2002:0000::/24,
2002:ff00::/24, 2002:0a00::/24, 2002:ac10::/28, 2002:c0a8::/32, ff05::/16 }" (←一行
v6_mynet = "vvvv:vvvv:vvvv:vvvv::/64"
# DCC host and port
dcc_host = "xxx.xxx.xxx.xxx"
dcc_port = "yyyy"
# IPv6 tunnel host
gif_host = "zzz.zzz.zzz.zzz"
# options
set block-policy return
set loginterface $ext_if
# scrub
scrub in all
scrub out all random-id max-mss 1414
# nat
nat on $ext_if inet from $int_if:network to any -> ($ext_if)
nat on $flets_if inet from $int_if:network to any -> ($flets_if)
# rdr (for DCC)
rdr on $ext_if inet proto tcp from any to ($ext_if) port $dcc_port -> $dcc_host port $dcc_port
# filter rules
block log all
pass quick on lo0 all
block drop in quick on $ext_if inet from $priv_nets to any
block drop out quick on $ext_if inet from any to $priv_nets
block drop in quick on $gif_if inet6 from $v6_priv_nets to any
block drop out quick on $gif_if inet6 from any to $v6_priv_nets
block drop in quick on $gif_if inet6 from $v6_malicious_6to4 to any
block drop out quick on $gif_if inet6 from any to $v6_malicious_6to4
# 6to4 tunnel
pass on $ext_if inet proto 41 from $gif_host to ($ext_if)
pass on $ext_if inet proto 41 from ($ext_if) to $gif_host
# TCP outer to inner
pass in quick on $ext_if inet proto tcp from any to ($ext_if) \
port $tcp_services flags S/SA keep state
# IPv6 TCP outer to inner
pass in quick on $gif_if inet6 proto tcp from any to $v6_mynet \
port $tcp6_services flags S/SA keep state
# TCP outer to inner (for DCC)
pass in quick on $ext_if inet proto tcp from any to $dcc_host \
port $dcc_port keep state
# ICMP
pass in inet proto icmp all icmp-type $icmp_types keep state
# ICMP6
pass in inet6 proto icmp6 all icmp6-type $icmp6_types keep state
# IPv6 RIPng
pass in on $gif_if inet6 proto udp from fe80::/10 port 521 to ff02::9 port 521
pass in on $gif_if inet6 proto udp from fe80::/10 port 521 to fe80::/10 port 521
# keep state
pass in on $int_if inet from $int_if:network to any keep state
pass out on $int_if inet from any to $int_if:network keep state
pass on $int_if inet6 all keep state
pass out on $ext_if inet proto tcp all modulate state flags S/SA
pass out on $ext_if inet proto { udp, icmp } all keep state
pass out on $gif_if inet6 proto tcp all modulate state flags S/SA
pass out on $gif_if inet6 proto { udp, icmp6 } all keep state
# keep state (Flet's)
pass out on $flets_if inet proto tcp all modulate state flags S/SA
pass out on $flets_if inet proto { udp, icmp } all keep state