Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jul 2006 13:06:14 +0200
From:      peter@bgnett.no (Peter N. M. Hansteen)
To:        freebsd-questions@freebsd.org
Subject:   Re: pf firewall for a server
Message-ID:  <87odvczkux.fsf@amidala.datadok.no>
In-Reply-To: <200607252030.46540.freebsd@dfwlp.com> (Jonathan Horne's message of "Tue, 25 Jul 2006 20:30:46 -0500")
References:  <200607252030.46540.freebsd@dfwlp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jonathan Horne <freebsd@dfwlp.com> writes:

> ive been googling for a while now this evening, but have
> unsuccesfully found any examples on how to firewall a server.  i do
> *not* want to build a router, and unfortunatly, every article i seem
> to find wants to tell me how to build a router!

The same principles apply everywhere - block everyting, allow the
traffic you need.  What traffic you need to pass depends on the
services you intend to make accessible.  For a host with a single
network interface, you can get away with a handful of lines, ie

localnet="xl0:network"
offered="{ ssh, netbios-ns, netbios-dgm, netbios-ssn, www, https }" 
needed="{ ssh, domain, ntp, whois }"

block all
pass proto { tcp, udp } from self to any port $needed keep state
pass proto { tcp, udp } from $localnet to self port $offered keep state

A lot of embellishment on this (untested, may contain nuts) is
possible, and you could probably do worse than spend a few moments
browsing the PF docs or for that matter my rather basic PF tutorial at
http://www.bgnett.no/~peter/pf/ to familiarize yourself with the
system.

-- 
Peter N. M. Hansteen, member of the first RFC 1149 implementation team
http://www.blug.linux.no/rfc1149/ http://www.datadok.no/ http://www.nuug.no/
"First, we kill all the spammers" The Usenet Bard, "Twice-forwarded tales"
20:11:56 delilah spamd[26905]: 146.151.48.74: disconnected after 36099 seconds




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87odvczkux.fsf>