From owner-freebsd-ipfw@FreeBSD.ORG Sat Jul 14 17:49:28 2012 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C894D106566C; Sat, 14 Jul 2012 17:49:28 +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 4CDCD8FC0A; Sat, 14 Jul 2012 17:49:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id q6EHnJtA046403; Sun, 15 Jul 2012 03:49:20 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sun, 15 Jul 2012 03:49:19 +1000 (EST) From: Ian Smith To: crees@freebsd.org In-Reply-To: <201207141614.q6EGEi7P024139@freefall.freebsd.org> Message-ID: <20120715025005.I74353@sola.nimnet.asn.au> References: <201207141614.q6EGEi7P024139@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-ipfw@freebsd.org, freebsd-bugs@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: Sat, 14 Jul 2012 17:49:28 -0000 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. > > How-To-Repeat > Fix > in /etc/rc.firewall > > after ${fwcmd} -f flush > you need to flush tables too with command > > ipfw table all flush Yes, to such a ruleset you'd need to add 'table all flush' too. ipfw flush specifically does not flush tables. I've long relied upon that, using mostly static tables only reloaded from a file saved hourly by cron, when $firewall_script finds tables are not loaded - ie at boot. cheers, Ian