SHOREWALL6-CONNTRAC(5) | Configuration Files | SHOREWALL6-CONNTRAC(5) |
conntrack - shorewall conntrack file
/etc/shorewall[6]/conntrack
The original intent of the notrack file was to exempt certain traffic from Netfilter connection tracking. Traffic matching entries in the file were not to be tracked.
The role of the file was expanded in Shorewall 4.4.27 to include all rules that can be added in the Netfilter raw table. In 4.5.7, the file's name was changed to conntrack.
The file supports three different column layouts: FORMAT 1, FORMAT 2, and FORMAT 3 with FORMAT 1 being the default. The three differ as follows:
When an entry in the following form is encountered, the format of the following entries are assumed to be of the specified format.
where format is either 1,2 or 3.
Format 3 was introduced in Shorewall 4.5.10.
Comments may be attached to Netfilter rules generated from entries in this file through the use of ?COMMENT lines. These lines begin with ?COMMENT; the remainder of the line is treated as a comment which is attached to subsequent rules until another ?COMMENT line is found or until the end of the file is reached. To stop adding comments to rules, use a line containing only ?COMMENT.
The columns in the file are as follows (where the column name is followed by a different name in parentheses, the different name is used in the alternate specification syntax).
ACTION - {NOTRACK|CT:helper:name[(arg=val[,...])|CT:ctevents:event[,...]|CT:expevents:new|CT:notrack|DROP|LOG|ULOG(ulog-parameters):NFLOG(nflog-parameters)|IP[6]TABLES(target)}[log-level[:log-tag]][:chain-designator]
Disables connection tracking for this packet. If a log-level is specified, the packet will also be logged at that level.
Attach the helper identified by the name to this connection. This is more flexible than loading the conntrack helper with preset ports. If a log-level is specified, the packet will also be logged at that level. Beginning with Shorewall 4.6.10, the helper name is optional
At this writing, the available helpers are:
amanda
ftp
irc
netbios-ns
RAS and Q.931
pptp
sane
sip
snmp
tftp
May be followed by an option list of arg=val pairs in parentheses:
Only generate the specified conntrack events for this connection. Possible event types are: new, related, destroy, reply, assured, protoinfo, helper, mark (this is connection mark, not packet mark), natseqinfo, and secmark. If more than one event is listed, the event list must be enclosed in parentheses (e.g., ctevents=(new,related)).
Only generate a new expectation events for this connection.
Added in Shorewall 4.6.10. Only generate the specified conntrack events for this connection. Possible event types are: new, related, destroy, reply, assured, protoinfo, helper, mark (this is connection mark, not packet mark), natseqinfo, and secmark.
Added in Shorewall 4.6.10. Only generate new expectation events for this connection.
Added in Shorewall 4.5.10. Silently discard the packet. If a log-level is specified, the packet will also be logged at that level.
IPv6 only.
Added in Shorewall 4.6.0. Allows you to specify any iptables target with target options (e.g., "IP6TABLES(AUDIT --type drop)"). If the target is not one recognized by Shorewall, the following error message will be issued:
IPv4 only.
Added in Shorewall 4.6.0. Allows you to specify any iptables target with target options (e.g., "IPTABLES(AUDIT --type drop)"). If the target is not one recognized by Shorewall, the following error message will be issued:
Added in Shoreawll 4.6.0. Logs the packet using the specified log-level and log-tag (if any). If no log-level is specified, then 'info' is assumed.
Added in Shoreawll 4.6.0. Queues the packet to a backend logging daemon using the NFLOG netfilter target with the specified nflog-parameters.
IPv4 only. Added in Shoreawll 4.6.0. Queues the packet to a backend logging daemon using the ULOG netfilter target with the specified ulog-parameters.
When FORMAT = 1, this column is not present and the rule is processed as if NOTRACK had been entered in this column.
Beginning with Shorewall 4.5.10, when FORMAT = 3, this column can end with a colon followed by a chain-designator. The chain-designator can be one of the following:
P
O
PO or OP
SOURCE (formats 1 and 2) – {zone[:interface][:address-list]}
Beginning with Shorewall 4.5.7, all can be used as the zone name to mean all zones.
Beginning with Shorewall 4.5.10, all- can be used as the zone name to mean all off-firewall zones.
SOURCE (format 3 prior to Shorewall 5.1.0) – {-|interface[:address-list]|address-list}
SOURCE (format 3 on Shorewall 5.1.0 and later) - {-|[source-spec[,...]]}
interface
address[,...][exclusion]
exclusion is described in shorewall-exclusion[2](5).
interface:address[,...][exclusion]
exclusion
Beginning with Shorewall 5.1.0, multiple source-specs separated by commas may be specified provided that the following alternative forms are used: (address[,...][exclusion])
interface:(address[,...][exclusion])
(exclusion)
DEST (Prior to Shorewall 5.1.0) – {-|interface[:address-list]|address-list}
DEST (Shorewall 5.1.0 and later) - {-|dest-spec[,...]}
interface
address[,...][exclusion]
exclusion is described in shorewall-exclusion[2](5).
interface:address[,...][exclusion]
exclusion
Beginning with Shorewall 5.1.0, multiple source-specs separated by commas may be specified provided that the following alternative forms are used: (address[,...][exclusion])
interface:(address[,...][exclusion])
(exclusion)
PROTO – protocol-name-or-number[,...]
Beginning with Shorewall 4.5.12, this column can accept a comma-separated list of protocols and either proto or protos is accepted in the alternate input format.
Beginning with Shorewall 5.1.11, when tcp or 6 is specified and the ACTION is CT, the compiler will default to :syn. If you wish the rule to match packets with any valid combination of TCP flags, you may specify tcp:all or 6:all.
DPORT - port-number/service-name-list
This column was formerly labelled DEST PORT(S).
SPORT - port-number/service-name-list
Beginning with Shorewall 4.5.15, you may place '=' in this column, provided that the DPORT column is non-empty. This causes the rule to match when either the source port or the destination port in a packet matches one of the ports specified in DPORT. Use of '=' requires multi-port match in your iptables and kernel.
This column was formerly labelled SOURCE PORT(S).
USER – [user][:group]
SWITCH - [!]switch-name[={0|1}]
The rule is enabled if the value stored in /proc/net/nf_condition/switch-name is 1. The rule is disabled if that file contains 0 (the default). If '!' is supplied, the test is inverted such that the rule is enabled if the file contains 0.
Within the switch-name, '@0' and '@{0}' are replaced by the name of the chain to which the rule is a added. The switch-name (after '...' expansion) must begin with a letter and be composed of letters, decimal digits, underscores or hyphens. Switch names must be 30 characters or less in length.
Switches are normally off. To turn a switch on:
When the switch-name is followed by =0 or =1, then the switch is initialized to off or on respectively by the start command. Other commands do not affect the switch setting.
IPv4 Example 1:
#ACTION SOURCE DEST PROTO DPORT SPORT USER CT:helper:ftp(expevents=new) fw - tcp 21
IPv4 Example 2 (Shorewall 4.5.10 or later):
Drop traffic to/from all zones to IP address 1.2.3.4
?FORMAT 2 #ACTION SOURCE DEST PROTO DPORT SPORT USER DROP all-:1.2.3.4 - DROP all 1.2.3.4
or
?FORMAT 3 #ACTION SOURCE DEST PROTO DPORT SPORT USER DROP:P 1.2.3.4 - DROP:PO - 1.2.3.4
IPv6 Example 1:
Use the FTP helper for TCP port 21 connections from the firewall itself.
FORMAT 2 #ACTION SOURCE DEST PROTO DPORT SPORT USER CT:helper:ftp(expevents=new) fw - tcp 21
IPv6 Example 2 (Shorewall 4.5.10 or later):
Drop traffic to/from all zones to IP address 2001:1.2.3::4
FORMAT 2 #ACTION SOURCE DEST PROTO DPORT SPORT USER DROP all-:2001:1.2.3::4 - DROP all 2001:1.2.3::4
or
FORMAT 3 #ACTION SOURCE DEST PROTO DPORT SPORT USER DROP:P 2001:1.2.3::4 - DROP:PO - 2001:1.2.3::4
/etc/shorewall/conntrack
/etc/shorewall6/conntrack
https://shorewall.org/configuration_file_basics.htm#Pairs[5]
09/24/2020 | Configuration Files |