Date: Tue, 11 Apr 2017 22:51:37 +0200 From: Polytropon <freebsd@edvax.de> To: Miha Smrekar <smrekar.miha@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: FreeBSD firewall configuration Message-ID: <20170411225137.074040d3.freebsd@edvax.de> In-Reply-To: <CAOVvEHXF6zN4FYHeXqAm8hRRgf9DgUZkQESkP8098PBFKA5QsA@mail.gmail.com> References: <CAOVvEHXi2V89bF1iD-718v7V=thFfR4c-h1KDxoctoe207qwLQ@mail.gmail.com> <20170407210017.0c2c2cbb.freebsd@edvax.de> <CAOVvEHVukRGa1kfGW=MNp2DRfzE3voOe880LwZbH-MqUDsmTdg@mail.gmail.com> <20170410213747.c22fffa7.freebsd@edvax.de> <CAOVvEHXF6zN4FYHeXqAm8hRRgf9DgUZkQESkP8098PBFKA5QsA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 11 Apr 2017 09:44:12 +0200, Miha Smrekar wrote: > Hi, > > my pf.conf file looks like that now: > > > *wan_if="em1"lan_if="em0"* > > *block all* > > *pass in on $wan_if from $wan_if:network to $int_if:network port 1024 keep > state* > > *pass in on $wan_if from $wan_if:network to $int_if:network port 443 keep > state* > > *pass in on $wan_if from $wan_if:network to $int_if:network port 80 keep > state* > > *pass out on $int_if from $ext_if:network to $int_if:network keep state* Did your mailer add some stupid formatting characters? Are you maybe using some strange web mailer feature? Those asterisks look very strange... Allow me to re-format: wan_if="em1" lan_if="em0" block all pass in on $wan_if from $wan_if:network to $int_if:network port 1024 keep state pass in on $wan_if from $wan_if:network to $int_if:network port 443 keep state pass in on $wan_if from $wan_if:network to $int_if:network port 80 keep state pass out on $int_if from $ext_if:network to $int_if:network keep state First thing I've noticed: the last line contains $ext_if, but you are using $wan_if correctly in the previous lines; same for $lan_if and $int_if. Naming _must be_ consistent. Example: wan_if="em1" lan_if="em0" block all pass in on $wan_if from $wan_if:network to $lan_if:network port 1024 keep state pass in on $wan_if from $wan_if:network to $lan_if:network port 443 keep state pass in on $wan_if from $wan_if:network to $lan_if:network port 80 keep state pass out on $lan_if from $wan_if:network to $lan_if:network keep state I hope I didn't make a mistake here. :-) > I've configured it like that because I wanted to forward all the incoming > traffic (through ports 80, 443 and 1024) to other internal interface > (through any port). > But now I've tried to ping specific port and only port 1024 is accesible > and open. Yes, because the ruleset seems to be damaged (inconsistent). > Did I configure it right? Have a look at the maning convention for your settings and make it consistent. Everything else looks valid. Going with $wan_if and $lan_if is probably a good idea. By the way, this is a thing you quite often find when adapting an example to your specific needs - there are sometimes leftovers from the original wording. ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170411225137.074040d3.freebsd>