Код: Выделить всё
# BORDER2 interfaces
inside_if="fxp0"
#pfsync_if="em0"
outside_if="xl0"
# some ports ranges
highports="xx:xx"
ftpports="xx:xx"
sslports="xx xx xx"
mailports="xx xx xx"
wwwports="xx xx xx"
# MAIL addresses
inside_ip="xx.xx.xx"
outside_gw="xx.xx.xx.xx"
outside_ip="xx.xx.xx.xx"
outside_ip_ftp="xx.xx.xx.xx"
outside_ip_vpn="xx.xx.xx.xx"
moscow_ip_vpn="xx.xx.xx.xx"
# SOME IPs
bank_client_local_ip="xx.xx.xx.xx"
bank_client_remote_ip="xx.xx.xx.xx"
bank_client_port="1723"
# Local Networks
table <admin_net> const { 192.168.18.0/24 }
table <inside_net> const { 10.4.0.0/16 }
table <outside_net> const { 212.98.167.88/29 }
table <ntp_servers> const { 194.149.67.130 }
table <badboys> const { 192.168.0.200 }
set timeout { interval 10, frag 30 }
set timeout { tcp.first 120, tcp.opening 30, tcp.established 86400 }
set timeout { tcp.closing 900, tcp.finwait 45, tcp.closed 90 }
set timeout { udp.first 60, udp.single 30, udp.multiple 60 }
set timeout { icmp.first 20, icmp.error 10 }
set timeout { other.first 60, other.single 30, other.multiple 60 }
set timeout { adaptive.start 0, adaptive.end 0 }
set limit { states 10000, frags 5000 }
set loginterface none
set optimization normal
set block-policy drop
set require-order yes
set fingerprints "/etc/pf.os"
set skip on lo0
scrub in all
nat on $outside_if proto tcp from $bank_client_local_ip to $bank_client_remote_ip port $bank_client_port -> $outside_ip
nat on $outside_if proto gre from $bank_client_local_ip to $bank_client_remote_ip -> $outside_ip
nat on $outside_if proto tcp from $admin_local_ip to any port { $admin_ports } -> $outside_ip
block drop in quick on ! $inside_if from { <inside_net> } to any
block drop in quick inet from $inside_ip to any
block drop in quick on ! $outside_if from { <outside_net> } to any
block drop in quick inet from $outside_ip to any
block drop in quick inet from $outside_ip_ftp to any
block drop in quick inet from $outside_ip_vpn to any
# Other packets will be blocked and logged
block log all
# Pass local traffic
pass quick on $inside_if all
# DNS requests to internal server
pass in on $outside_if reply-to ( $outside_if $outside_gw ) proto tcp from any port { 53, $highports } to $outside_ip port 53 keep s
pass in on $outside_if reply-to ( $outside_if $outside_gw ) proto udp from any port { 53, $highports } to $outside_ip port 53 keep s
# DNS requests to internet DNS servers
pass out on $outside_if proto tcp from $outside_ip port $highports to any port 53 keep state
pass out on $outside_if proto udp from $outside_ip port $highports to any port 53 keep state
# FTP requests to internal server
pass in on $outside_if reply-to ( $outside_if $outside_gw ) proto tcp from any port $highports to $outside_ip_ftp port 21 keep state
pass in on $outside_if reply-to ( $outside_if $outside_gw ) proto tcp from any port $highports to $outside_ip_ftp port 20 keep state
pass in on $outside_if reply-to ( $outside_if $outside_gw ) proto tcp from any port $highports to $outside_ip_ftp port $ftpports kee
# WWW requests to Internet
pass out on $outside_if proto tcp from $outside_ip port $highports to any port { $wwwports } keep state
# FTP requests to Internet
pass out on $outside_if proto tcp from $outside_ip port $highports to any port 21 keep state
pass out on $outside_if proto tcp from $outside_ip port $highports to any port 20 keep state
pass out on $outside_if proto tcp from $outside_ip port $highports to any port $highports keep state
# Mail requests from Internet
pass in on $outside_if reply-to ( $outside_if $outside_gw ) proto tcp from any port $highports to $outside_ip port { $mailports } ke
# WWW requests from Internet
pass in on $outside_if reply-to ( $outside_if $outside_gw ) proto tcp from any port $highports to $outside_ip port { $wwwports } kee
# SSL VPN
pass in on $outside_if reply-to ( $outside_if $outside_gw ) proto tcp from any port $highports to $outside_ip port { $sslports } kee
# Mail from Faberlic
pass out on $outside_if proto tcp from $outside_ip port $highports to any port 25 keep state
# Client bank
pass out on $outside_if proto gre from $outside_ip to $bank_client_remote_ip keep state
# NTP requests
pass out on $outside_if proto udp from $outside_ip port 123 to { <ntp_servers> } port 123 keep state
# Inside net out
#pass out on $outside_if proto tcp from $outside_ip port $highports to any port $highports keep state
pass in on $outside_if proto icmp from any to $outside_ip keep state
pass out on $outside_if proto icmp from $outside_ip to any keep state
# IPSEC
pass in on $outside_if proto udp from $moscow_ip_vpn port 500 to $outside_ip_vpn port 500
pass out on $outside_if proto udp from $outside_ip_vpn port 500 to $moscow_ip_vpn port 500
pass in on $outside_if proto esp from $moscow_ip_vpn to $outside_ip_vpn
pass out on $outside_if proto esp from $outside_ip_vpn to $moscow_ip_vpn