# PF configuration for Central de Vendas Informatica LTDA.
# admin@centralinf.com.br
### macros ###
ext_if = "xl0"
int_if = "re0"
int_odin = "192.168.1.134"
ext_odin = "201.12.35.52"
int_saint = "192.168.1.53"
ext_saint = "201.12.35.54"
range_saint = "200.230.207.0/24"
table <ti> { 192.168.1.120, 192.168.1.121, 192.168.1.122, 192.168.1.123 }
### options ###
set block-policy return
set loginterface $int_if
set skip on lo
### scrub ###
scrub all no-df fragment reassemble random-id
### nat ###
# nat for all network.
nat on $ext_if from $int_if:network to any -> $ext_if:0
nat-anchor "ftp-proxy/*"
# binat for odin.
binat on $ext_if from $int_odin to any -> $ext_odin
# binat for saint.
binat on $ext_if from $int_saint to $range_saint -> $ext_saint
### redirects ###
# ftp-proxy.
rdr-anchor "ftp-proxy/*"
rdr pass on $int_if proto tcp to port ftp -> 127.0.0.1 port 8021
# transparent proxy.
rdr on $int_if proto tcp from any to any port 80 -> 127.0.0.1 port 3128
### filter rules ###
# block everything.
block log all
# antispoof and ftp-proxy anchor.
antispoof for $int_if inet
anchor "ftp-proxy/*"
# allow all traffic on $int_if.
pass quick on $int_if
# block msn.
block drop inet proto tcp from any to any port 1863
# allow msn to priv_users ;).
pass out on $ext_if inet proto tcp from <ti> to any \
port 1863 modulate state flags S/SA
# allow ping.
pass in quick inet proto icmp all icmp-type echoreq keep state
# allow vpn (pptp) and tun interfaces.
pass in quick on $ext_if inet proto tcp from any to ($ext_if) \
port pptp modulate state flags S/SA
pass in quick on $ext_if inet proto gre from any to ($ext_if) \
keep state
pass quick on tun
# allow all tcp, udp and icmp pass out.
pass out quick on $ext_if inet proto tcp all modulate state flags S/SA
pass out quick on $ext_if inet proto { udp, icmp } all keep state