SHOREWALL-ACTIONS(5)
β¨ SHOREWALL-ACTIONS β¨
okay bestie, buckle up π this is the page from the Configuration Files manual section β shorewall-actions(5) β and it's literally the glow-up guide for your firewall's custom actions. no cap, it's giving main character energy for your packet filtering. let's go π¦
πΈ NAME πΈ
actions β the Shorewall action declaration file π
π SYNOPSIS π
/etc/shorewall[6]/actions
π DESCRIPTION π
So here's the vibe: this file is where you get to invent brand-new ACTIONS for use in rules (peep shorewall-rules(5)). You write the actual iptables rules that make up an ACTION over in /etc/shorewall/action.action-name. yes, one file per action, very demure, very mindful π§
The columns are:
π NAME π
The name of the action, periodt. ACTION names should start with an upper-case letter β that's how you tell them apart from the chain names Shorewall generates all on its own. And they should be made of letters, digits or numbers. One more thing: if you're planning to log from the action, then with the standard LOGFORMAT the name has to be no longer than 11 characters. that's the limit, bestie, no negotiating π
π OPTIONS π
Added in Shorewall 4.5.10. The options you can pick from are:
auditβ Added in Shorewall 5.0.7. With this one on, the action is expected to have at least two parameters: the first is a target, and the second is either'audit'or just... omitted. If that second one is'audit', then the first one must be an auditable target β that'sACCEPT,DROPorREJECT. no other options, sorry π«Άbuiltinβ Added in Shorewall 4.5.16. This defines the action as a rule target that youriptablessupports but Shorewall doesn't directly support. The action can then be used as the rule target in anINLINErule inshorewall-rules(5).
Starting with Shorewall 4.6.0, you can also say which Netfilter table(s) the builtin works in: filter, nat, mangle and raw. If you don't name any tables, filter is assumed. The table names come right after builtin, separated by commas β for example, "FOOBAR builtin,filter,mangle" would make FOOBAR a builtin target usable in the filter and mangle tables. iconic β¨
Starting with Shorewall 4.6.4, you may specify the terminating option along with builtin to tell the Shorewall optimizer that the action is terminating β meaning the current packet will not be passed to the next rule in the chain. π
inlineβ Makes the action body (defined inaction.action-name) get expanded in-line, like a macro, instead of living in its own chain. Fun fact: you can list Shorewall Standard Actions in this file to specify theinlineoption.
Caution π¨ Some of the Shorewall standard actions simply cannot be used in-line. If you try, you'll get a warning and the compiler will just ignoreinline: -DropSmurfs-IfEvent-Invalid(Prior to Shorewall 4.5.13) -NotSyn(Prior to Shorewall 4.5.13) -RST(Prior to Shorewall 4.5.13) -TCPFlags
logjumpβ Added in Shorewall 5.0.8. Does the exact same thing asnolog(down below π), except it also logs the jump to the action's chain if a log level is specified on the action invocation. For inline actions, this option is identical tonolog. same energy fr frmangleβ Added in Shorewall 5.0.7. Says this action is meant to be used inshorewall-mangle(5)rather thanshorewall-rules(5).natβ Added in Shorewall 5.0.13. Says this action is meant to be used inshorewall-snat(5)rather thanshorewall-rules(5). Heads up:mangleandnatare mutually exclusive β pick one, you cannot have both πnoinlineβ Makes any laterinlineoption for the same action get ignored, with a warning. bye bestie πnologβ Added in Shorewall 4.5.11. When you use this, the compiler stops automatically slapping the log level and/or tag from the action's invocation onto all the rules inside the action. Instead, it just sets the$_logleveland$_logtagshell variables, which you can use inside the action body to apply those logging options to only a subset of the rules. chef's kiss, so much control πproto=protocolβ Added in Shorewall 5.1.10. Says the action is only usable with the specified protocol (name or number). When the action is invoked with no protocol in thePROTOcolumn, or if the action is used as a Policy Action, then the named protocol gets assumed. But if a protocol is specified in thePROTOcolumn of an invocation, then it has to match the named protocol.
Also: the proto option has no effect if the inline or builtin option is specified. And you'll get a warning if proto shows up alongside builtin.
dport=portorserviceβ Added in Shorewall 5.2.6. Requires that theprotooption was already given, and says this action may only be applied to flows with the specified protocol andportorservice. Thatportorservicecan be a valid port number, or the name of a service defined in/etc/servicesthat's usable with the specified protocol. If a port or service is specified in theDPORTcolumn of an invocation, then it must match the namedportorservice.sectionβ Added in Shorewall 5.1.1. With this one on, the rules file section name plus a comma gets prepended to the parameters passed to the action (if there are any). Which means β plot twist β the first parameter passed to the action by the user is actually the second parameter to the action. And if the action is invoked out of theblrulesfile,'BLACKLIST'is used as the section name. π
Also, since neither the snat nor the mangle file is sectioned, this parameter has no effect when mangle or nat is specified.
state={UNTRACKED|NEW|ESTABLISHED|RELATED|INVALID}β Added in Shorewall 5.0.7. Reserved for use by Shorewall inactions.std. hands off, that one's not yours πterminatingβ Added in Shorewall 4.6.4. When used withbuiltin, it indicates that the built-in action is termiating (i.e., if the action is jumped to, the next rule in the chain is not evaluated). yes, the typo is canon, we don't touch it π
π¦ FILES π¦
/etc/shorewall/actions/etc/shorewall6/actions
π SEE ALSO π
π NOTES π
shorewall-rules(5)https://shorewall.org/manpages/shorewall-rules.htmlshorewall-mangle(5)https://shorewall.org/manpages/shorewall-mangle.htmlshorewall-snat(5)https://shorewall.org/manpages/shorewall-snat.htmlhttps://shorewall.org/Actions.htmlhttps://shorewall.org/Actions.html
okay that's the whole page, you ate it up π this came out of the Configuration Files section, dated 09/24/2020, and it's the SHOREWALL-ACTIONS(5) page β go write some iconic actions, bestie, i'm so proud of you πππ¦β¨π
π¦ where this page comes from
- alpine 3.22: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- alpine 3.23: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- alpine 3.24: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- debian bookworm: shorewall6 5.2.8-2 Β· GPL-2.0-or-later
- debian trixie: shorewall6 5.2.8-6 Β· GPL-2.0-or-later
- fedora 43: shorewall6 5.2.8-17.fc43 Β· GPL-2.0-or-later
- fedora 44: shorewall6 5.2.8-18.fc44 Β· GPL-2.0-or-later
- nixos 26.05: shorewall 5.2.8
- nixpkgs unstable: shorewall 5.2.8
- ubuntu noble: shorewall6 5.2.8-5 Β· GPL-2.0-or-later
- ubuntu questing: shorewall6 5.2.8-6
- ubuntu resolute: shorewall6 5.2.8-6build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms