View Single Post
  #2   (View Single Post)  
Old 5th February 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

This is a simple pf.conf to block everything, except the ports mentioned in the TCPservices and UDPservices definitions.

Code:
EXT=re0

TCPservices = "{ www https domain }"
UDPservices = "{ domain }"

set skip on lo0

block log all

pass out quick on $EXT inet proto tcp from any to any port $TCPservices
pass out quick on $EXT inet proto udp from any to any port $UDPservices
This will load as
Code:
# pfctl -vvnf block-all.pf
EXT = "re0"
TCPservices = "{ www https domain }"
UDPservices = "{ domain }"
set skip on { lo0 }
@0 block drop log all
@1 pass out quick on re0 inet proto tcp from any to any port = www flags S/SA keep state
@2 pass out quick on re0 inet proto tcp from any to any port = https flags S/SA keep state
@3 pass out quick on re0 inet proto tcp from any to any port = domain flags S/SA keep state
@4 pass out quick on re0 inet proto udp from any to any port = domain keep state
EDIT: This is of course for a box with a single network interface, but I hope you get the idea
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote