There's a big problem with blocking services by the port: sometimes they move. RPC
based programs are terrible about this, lockd, statd, even nfsd listens places other than
2049. It's awfully hard to predict, and even worse to automate adjusting all the time.
What if you miss a service? Instead of dealing with all that hassle, lets start over with
a clean slate. The current ruleset looks like this:
Yes, we really are starting over. The first rule we're going to use is this:
block in all
No network traffic gets through. None. Not a peep. You're rather secure with this setup. Not terribly useful, but quite secure. The great thing is that it doesn't take much more to make your box rather secure, yet useful too. Lets say the machine this is running on is a web server, nothing more, nothing less. It doesn't even do DNS lookups. It just wants to take connections on 80/tcp and that's it. We can do that. We can do that with a second rule, and you already know how:
block in on tun0 all
pass in quick on tun0 proto tcp from any to 126.96.36.199/32 port = 80
This machine will pass in port 80 traffic for 188.8.131.52, and deny everything else. For basic firewalling, this is all one needs.