Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jul 2004 13:46:15 -0500
From:      Paul Schmehl <pauls@utdallas.edu>
To:        Aaron Dalton <acdalton@ucalgary.ca>, freebsd-questions@freebsd.org
Subject:   Re: ipfw rule deletion
Message-ID:  <2147483647.1090158375@[192.168.2.102]>
In-Reply-To: <Pine.A41.4.44.0407181139490.22800-100000@acs1.acs.ucalgary.ca>
References:  <Pine.A41.4.44.0407181139490.22800-100000@acs1.acs.ucalgary.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
--On Sunday, July 18, 2004 11:43 AM -0600 Aaron Dalton 
<acdalton@ucalgary.ca> wrote:

> I am using Doorman (http://doorman.sourceforge.net)as a port knocking
> daemon and I need to write a short script that adds and deletes rules to
> the ipfw firewall.  I can add them just fine, but I can't find the best
> way to delete them.  Is the only way to specify the exact rule number?

Yes.

Just use awk to extract the number.  One way to handle it would be to write 
each add rule to a text file.  Then, when you want to delete the rule, you 
grab the IP address from the text file, and then use awk to find the right 
rule.  Something like this:

${fwcmd} delete `awk '/$IP/ {print $1}'`

Paul Schmehl (pauls@utdallas.edu)
Adjunct Information Security Officer
The University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu



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