Previously posted on blog.labrat.info on April 22, 2010

I’ve been looking all over the internet for a simple example of an IP Filter configuration but all I keep finding is some high end stuff. I have a web server I want to protect and that is it. Ok, yes, it runs SSH as well so there’s that as well but, basically, all I want is all outside ports to be blocked except port 22 and 80. Seems most people do way more but I just don’t need that kind of complexity.

After much search and trimming this is the content of my /etc/ipf/ipf.conf file:

block in log quick all with short

block in from any to any
pass out quick all keep state

pass in quick log port tcp from any to any port = 22 keep state
pass in quick log port tcp from any to any port = 80 keep state

block in quick from any to any

Very simple but lets go though it anyway.

Once I figured all of this out I really don’t understand why so many examples online are so complicated. Seems simple enough to build something simple.