From owner-freebsd-ipfw@FreeBSD.ORG Sun Jul 15 13:50:33 2012 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1251A1065670 for ; Sun, 15 Jul 2012 13:50:33 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) by mx1.freebsd.org (Postfix) with ESMTP id 82D7F8FC0C for ; Sun, 15 Jul 2012 13:50:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id q6FDoUkp086011; Sun, 15 Jul 2012 23:50:30 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sun, 15 Jul 2012 23:50:30 +1000 (EST) From: Ian Smith To: Chris Rees In-Reply-To: Message-ID: <20120715232828.T81219@sola.nimnet.asn.au> References: <201207141614.q6EGEi7P024139@freefall.freebsd.org> <20120715025005.I74353@sola.nimnet.asn.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-ipfw@freebsd.org Subject: Re: kern/165939: [ipw] security bug: incomplete firewall rules loaded if tables are used in ipfw.conf X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2012 13:50:33 -0000 On Sat, 14 Jul 2012 18:59:54 +0100, Chris Rees wrote: > On 14 Jul 2012 18:49, "Ian Smith" wrote: > > > > On Sat, 14 Jul 2012, crees@freebsd.org wrote: > > > http://www.freebsd.org/cgi/query-pr.cgi?pr=165939 [..] > > > Description > > > If user has tables used in /etc/ipfw.conf for example: > > > > > > table 1 add 64.6.108.239 > > > > > > then firewall restart: > > > > > > /etc/rc.d/ipfw start > > > > > > fails with: > > > Line 8: setsockopt(IP_FW_TABLE_ADD): File exists > > > Firewall rules loaded. > > > > > > and incomplete ruleset is loaded. This is serious security problem. I've likely said more than enough while awaiting team response, but does this still fail if in /etc/rc.conf you set either (should come to the same for your custom firewall_type=/etc/ipfw.conf via rc.firewall) of: firewall_quiet="YES" firewall_flags="-q" Just that ipfw(8) reckons, noting the last sentence: -q Be quiet when executing the add, nat, zero, resetlog or flush commands; (implies -f). This is useful when updating rulesets by executing multiple ipfw commands in a script (e.g., `sh /etc/rc.firewall'), or by processing a file with many ipfw rules across a remote login session. It also stops a table add or delete from failing if the entry already exists or is not present. ie, with -q on table add commands, you shouldn't need to flush tables. cheers, Ian