# PF CONFIGURATION - v.3.1 - 100507 @ 2330 $ STILLMAN
# MACROS
# INTERFACES
ext_if = "hme0"
int_if = "hme1"
dmz_if = "xl0"
# TRAFFIC MACROS
tcp_services = "{ www, https, ftp-data, ftp, ssh, domain, pop3, pop3s, \
smtp, auth, nntp, cvspserver, 446, 1863, 2628, 8000, \
8080 }"
udp_services = "{ domain, ntp }"
udp_voip = "{ 5060:5061, 16384, 16482 }"
torrents = "{ 15566:15600 }"
icmp_types = "echoreq"
# TABLES
# LAN IP MANAGEMENT
table <lan_net> persist { 10.0.0.0/8 }
table <cary_n1> persist { 10.10.11.1 }
# UNDESIRED TRAFFIC - SCANNERS, SPAMMERS, PROBES, ETC.
table <scanners> persist file "/etc/scanners"
table <spammers> persist file "/etc/spammers"
# OPTIONS
#set block-policy drop
set loginterface $ext_if
set skip on lo
scrub in all no-df
scrub in all random-id
# QUEUEING
altq on ext_if bandwidth 485Kb hfsc(linkshare 485Kb) queue { q_ext, \
q_def, q_crit }
queue q_ext bandwidth 128Kb priority 7 hfsc(linkshare 128Kb) \
{ q1_httpd, q1_ftp }
queue q1_httpd bandwidth 64Kb qlimit 100 hfsc\
(realtime 48Kb linkshare 64Kb)
queue q1_ftp bandwidth 64Kb qlimit 100 hfsc\
(realtime 48Kb linkshare 64Kb)
queue q_def bandwidth 165Kb priority 8 hfsc(linkshare 165Kb) \
{ q1_trnt_a }
queue q1_trnt_a bandwidth 165Kb qlimit 20 hfsc\
(realtime 128Kb linkshare 165Kb)
queue q_crit bandwidth 192Kb priority 9 hfsc(linkshare 192Kb) \
{ q1_voip, q1_wan, q1_ack }
queue q1_voip bandwidth 0Kb qlimit 500 hfsc\
(realtime 80Kb)
queue q1_wan bandwidth 64Kb qlimit 150 hfsc\
(realtime 48Kb linkshare 64Kb)
queue q1_ack bandwidth 128Kb qlimit 500 hfsc\
(realtime 92Kb linkshare 128Kb)
# NAT
nat on $ext_if from !($ext_if) to any -> ($ext_if)
nat-anchor "ftp-proxy/*"
rdr-anchor "ftp-proxy/*"
# TRAFFIC REDIRECTION
rdr pass on $int_if proto tcp to port ftp -> 127.0.0.1 port 8021
rdr on $ext_if proto udp from any to any port $udp_voip -> 10.10.4.1
rdr on $ext_if proto tcp from any to any port 80 -> <cary_n1>
rdr on $ext_if proto tcp from any to any port 8080 -> <cary_n1> port 8080
rdr on $ext_if proto tcp from any to any port 25 -> <cary_n1> port 25
#rdr on $int_if proto tcp from any to any port 25 -> <cary_n1> port 25
#rdr on $ext_if proto tcp from any to any port $torrents -> 10.0.108.253
rdr on $ext_if proto tcp from any to any port $torrents -> 10.0.100.100
# FILTER RULES
# DEFAULT DENY RULES
block in log all
block out log all
# PASS TRAFFIC TO AND FROM FIREWALL
pass in on $int_if from <lan_net> to $int_if keep state
pass in on $int_if from <lan_net> to ! <lan_net> keep state
pass out on $int_if from $int_if to <lan_net>
pass out on $int_if proto tcp from ! <lan_net> to <lan_net> port \
$tcp_services flags S/SA
pass out on $int_if proto tcp from ! <lan_net> to <lan_net> port \
$torrents flags S/SA
# DEFAULT TRAFFIC OUT
pass out on $ext_if proto { tcp, udp, icmp } from ($ext_if) to any \
keep state
# ALLOW SPECIFIED PORT TRAFFIC IN
pass in on $ext_if inet proto tcp from any to ($ext_if) \
port $tcp_services flags S/SA keep state
# ALLOW SPECIFIED REDIRECTS
pass in on $ext_if inet proto tcp from any to <cary_n1> port 80 \
flags S/SA synproxy state
pass in on $ext_if inet proto tcp from any to <cary_n1> port 8080 \
flags S/SA
pass in on $ext_if inet proto tcp from any to <cary_n1> port 25 \
flags S/SA
#pass in quick on $ext_if inet proto tcp from any to 10.0.108.253 \
port $torrents flags S/SA
pass in quick on $ext_if inet proto tcp from any to 10.0.100.100 \
port $torrents flags S/SA
pass in on $ext_if proto udp from any to 10.10.4.1 port $udp_voip
pass out on $ext_if proto udp from $ext_if port $udp_voip to ! <lan_net> \
keep state queue(voip_out)
# ALLOW PING
pass in inet proto icmp all icmp-type $icmp_types keep state
anchor "ftp-proxy/*"
#antispoof for { $int_if }