User-defined Actions

Tom Eastep

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

2003-01-29


Prior to Shorewall version 1.4.9, rules in /etc/shorewall/rules were limited to those defined by Netfilter (ACCEPT, DROP, REJECT, etc.). Beginning with Shorewall version 1.4.9, users may use sequences of these elementary operations to define more complex actions.

To define a new action:

  1. Add a line to /etc/shorewall/actions that names your new action. Action names must be valid shell variable names as well as valid Netfilter chain names. It is recommended that the name you select for a new action begins with with a capital letter; that way, the name won't conflict with a Shorewall-defined chain name.

  2. Once you have defined your new action name (ActionName), then copy /etc/shorewall/action.template to /etc/shorewall/action.ActionName (for example, if your new action name is “Foo” then copy /etc/shorewall/action.template to /etc/shorewall/action.Foo).

  3. Now modify the new file to define the new action.

Columns in the action.template file are as follows:

Example:

/etc/shorewall/actions:

     LogAndAccept

/etc/shorewall/action.LogAndAccept

     LOG:info
     ACCEPT