From owner-freebsd-questions@freebsd.org Tue Apr 11 20:51:48 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBA96D3A4C3 for ; Tue, 11 Apr 2017 20:51:48 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mailrelay11.qsc.de (mailrelay11.qsc.de [212.99.187.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.antispameurope.com", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 725977CC for ; Tue, 11 Apr 2017 20:51:47 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de ([213.148.129.14]) by mailrelay11.qsc.de; Tue, 11 Apr 2017 22:51:38 +0200 Received: from r56.edvax.de (port-92-195-127-117.dynamic.qsc.de [92.195.127.117]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id E2C953CBF9; Tue, 11 Apr 2017 22:51:37 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id v3BKpbtS002110; Tue, 11 Apr 2017 22:51:37 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Tue, 11 Apr 2017 22:51:37 +0200 From: Polytropon To: Miha Smrekar Cc: freebsd-questions@freebsd.org Subject: Re: FreeBSD firewall configuration Message-Id: <20170411225137.074040d3.freebsd@edvax.de> In-Reply-To: References: <20170407210017.0c2c2cbb.freebsd@edvax.de> <20170410213747.c22fffa7.freebsd@edvax.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-cloud-security-sender: freebsd@edvax.de X-cloud-security-recipient: freebsd-questions@freebsd.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mailrelay11.qsc.de with 2AA786A3585 X-cloud-security-connect: mx01.qsc.de[213.148.129.14], TLS=1, IP=213.148.129.14 X-cloud-security: scantime:.1330 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2017 20:51:49 -0000 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, ...