# $OpenBSD: pf.conf,v 1.49 2009/09/17 06:39:03 jmc Exp $ # # See pf.conf(5) for syntax and examples. # Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1 # in /etc/sysctl.conf if packets are to be forwarded between interfaces. ####Macros#### #array of the IP's local to the proxy box LocalIP="{172.21.1.20, 192.168.10.1}" #what ip on the proxy box has access to the internet OutsideIP=172.21.1.20 # what IP do you want to map the wireless box through to # This is not strictly needed, but it does make it easier when you need to # look at the wireless router. WirelessOutside=172.21.1.21 # What is the ip of the wireless router WirelessIP=192.168.10.254 # DNS servers, so DNS queries can always go through dns_servers="{8.8.8.8, 8.8.4.4}" # Inside and outside interface names (from ifconfig) insideIF="em0" outsideIF="re0" set block-policy return set loginterface $outsideIF table set skip on lo # NAT outgoing packets from the inside network match out on $outsideIF from !(outsideIF:network) nat-to $OutsideIP # Static NAT for the AP pass quick from $WirelessIP to any binat-to $WirelessOutside # Redirect all web traffic to squid pass in quick on $insideIF inet proto tcp to !192.168.10.1 port www rdr-to 127.0.0.1 port 3128 # Block everything inbound other than the wireless block return in from !$WirelessIP # Allow all traffic from anyone who has accepted the agreement, but not to the router pass from {} to !192.168.10.1 keep state # Block access to our networks block return in log from !$WirelessIP to {172.0.0.0/8, 10.0.0.0/8} # Allow DNS traffic pass in quick proto {tcp,udp} from $dns_servers to any port 53 pass in quick proto {tcp,udp} to $dns_servers port 53 # Allow all access to the local web server- needed to serve up landing page pass in proto tcp from any to $LocalIP port {80,8080} # Allow SSH from outside only (our network, not wireless) block in proto tcp to $LocalIP port 22 pass in on $outsideIF proto tcp to $LocalIP port 22 # Allow the local machine to be pinged pass in inet proto icmp to $LocalIP #pass in from $WirelessIP # Allow all traffic out of the router. Just block inbound connections as above pass out # filter rules and anchor for ftp-proxy(8) #anchor "ftp-proxy/*" #pass in quick proto tcp to port ftp rdr-to 127.0.0.1 port 8021 # anchor for relayd(8) #anchor "relayd/*" #pass log # to establish keep-state # rules for spamd(8) #table persist #table persist file "/etc/mail/nospamd" #pass in on egress proto tcp from any to any port smtp \ # rdr-to 127.0.0.1 port spamd #pass in on egress proto tcp from to any port smtp #pass in log on egress proto tcp from to any port smtp #pass out log on egress proto tcp to any port smtp #block in quick from urpf-failed to any # use with care # By default, do not permit remote connections to X11 #block in on ! lo0 proto tcp to port 6000:6010