ipfw rule deletion

Paul Schmehl pauls at utdallas.edu
Sun Jul 18 11:46:15 PDT 2004


--On Sunday, July 18, 2004 11:43 AM -0600 Aaron Dalton 
<acdalton at 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 at utdallas.edu)
Adjunct Information Security Officer
The University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu


More information about the freebsd-questions mailing list