shorewall.conf 5 shorewall.conf Shorewall global configuration file /etc/shorewall/shorewall.conf Description This file sets options that apply to Shorewall as a whole. The file consists of Shell comments (lines beginning with '#'), blank lines and assignment statements (variable=value). Each variable's setting is preceded by comments that describe the variable and it's effect. OPTIONS Many options have as their value a log-level. Log levels are a method of describing to syslog (8) the importance of a message and a number of parameters in this file have log levels as their value. These levels are defined by syslog and are used to determine the destination of the messages through entries in /etc/syslog.conf (5). The syslog documentation refers to these as "priorities"; Netfilter calls them "levels" and Shorewall also uses that term. Valid levels are: 7 debug 6 info 5 notice 4 warning 3 err 2 crit 1 alert 0 emerg For most Shorewall logging, a level of 6 (info) is appropriate. Shorewall log messages are generated by NetFilter and are logged using facility 'kern' and the level that you specifify. If you are unsure of the level to choose, 6 (info) is a safe bet. You may specify levels by name or by number. If you have built your kernel with ULOG target support, you may also specify a log level of ULOG (must be all caps). Rather than log its messages to syslogd, Shorewall will direct netfilter to log the messages via the ULOG target which will send them to a process called 'ulogd'. ulogd is available with most Linux distributions (although it probably isn't installed by default). Ulogd is also available from http://www.gnumonks.org/projects/ulogd and can be configured to log all Shorewall message to their own log file The following options may be set in shorewall.conf. ACCEPT_DEFAULT={action|macro|none} DROP_DEFAULT={action|macro|none} REJECT_DEFAULT={action|macro|none} QUEUE_DEFAULT={action|macro|none} In earlier Shorewall versions, a "default action" for DROP and REJECT policies was specified in the file /usr/share/shorewall/actions.std. To allow for default rules to be applied when USE_ACTIONS=No, the DROP_DEFAULT, REJECT_DEFAULT, ACCEPT_DEFAULT and QUEUE_DEFAULT options have been added. DROP_DEFAULT describes the rules to be applied before a connection request is dropped by a DROP policy; REJECT_DEFAULT describes the rules to be applied if a connection request is rejected by a REJECT policy. The other two are similar for ACCEPT and QUEUE policies. The value applied to these may be: a) The name of an action. b) The name of a macro c) None or none The default values are: DROP_DEFAULT="Drop" REJECT_DEFAULT="Reject" ACCEPT_DEFAULT="none" QUEUE_DEFAULT="none" If USE_ACTIONS=Yes, then these values refer to action.Drop and action.Reject respectively. If USE_ACTIONS=No, then these values refer to macro.Drop and macro.Reject. If you set the value of either option to "None" then no default action will be used and the default action or macro must be specified in shorewall-policy(5). ADD_IP_ALIASES=[Yes|No] This parameter determines whether Shorewall automatically adds the external address(es) in shorewall.nat(5). If the variable is set to Yes or yes then Shorewall automatically adds these aliases. If it is set to No or no, you must add these aliases yourself using your distribution's network configuration tools. If this variable is not set or is given an empty value (ADD_IP_ALIASES="") then ADD_IP_ALIASES=Yes is assumed. Addresses added by ADD_IP_ALIASES=Yes are deleted and re-added during shorewall restart. As a consequence, connections using those addresses may be severed. ADD_SNAT_ALIASES=[Yes|No] This parameter determines whether Shorewall automatically adds the SNAT ADDRESS in /etc/shorewall/masq. If the variable is set to Yes or yes then Shorewall automatically adds these addresses. If it is set to No or no, you must add these addresses yourself using your distribution's network configuration tools. If this variable is not set or is given an empty value (ADD_SNAT_ALIASES="") then ADD_SNAT_ALIASES=No is assumed. Addresses added by ADD_SNAT_ALIASES=Yes are deleted and re-added during shorewall restart. As a consequence, connections using those addresses may be severed. ADMINISABSENTMINDED=[Yes|No] The value of this variable affects Shorewall's stopped state. When ADMINISABSENTMINDES=No, only traffic to/from those addresses listed in shorewall-routestopped(5) is accepted when Shorewall is stopped. When ADMINISABSENTMINDED=Yes, in addition to traffic to/from addresses in shorewall-routestopped(5), connections that were active when Shorewall stopped continue to work and all new connections from the firewall system itself are allowed. If this variable is not set or is given the empty value then ADMINISABSENTMINDED=No is assumed. BLACKLIST_DISPOSITION=[DROP|REJECT] This parameter determines the disposition of packets from blacklisted hosts. It may have the value DROP if the packets are to be dropped or REJECT if the packets are to be replied with an ICMP port unreachable reply or a TCP RST (tcp only). If you do not assign a value or if you assign an empty value then DROP is assumed. BLACKLIST_LOGLEVEL=[log-level] This parameter determines if packets from blacklisted hosts are logged and it determines the syslog level that they are to be logged at. Its value is a syslog level (Example: BLACKLIST_LOGLEVEL=debug). If you do not assign a value or if you assign an empty value then packets from blacklisted hosts are not logged. BRIDGING={Yes|No} When set to Yes or yes, enables Shorewall Bridging support. CLAMPMSS=[Yes|No|value] This parameter enables the TCP Clamp MSS to PMTU feature of Netfilter and is usually required when your internet connection is through PPPoE or PPTP. If set to Yes or yes, the feature is enabled. If left blank or set to No or no, the feature is not enabled. This option requires CONFIG_IP_NF_TARGET_TCPMSS in your kernel. You may also set CLAMPMSS to a numeric value (e.g., CLAMPMSS=1400). This will set the MSS field in TCP SYN packets going through the firewall to the value that you specify. CLEAR_TC=[Yes|No] If this option is set to No then Shorewall won't clear the current traffic control rules during [re]start. This setting is intended for use by people that prefer to configure traffic shaping when the network interfaces come up rather than when the firewall is started. If that is what you want to do, set TC_ENABLED=Yes and CLEAR_TC=No and do not supply an /etc/shorewall/tcstart file. That way, your traffic shaping rules can still use the “fwmark” classifier based on packet marking defined in shorewall-tcrules(5). If not specified, CLEAR_TC=Yes is assumed. CONFIG_PATH=[directory[:directory]...] Specifies where configuration files other than shorewall.conf may be found. CONFIG_PATH is specifies as a list of directory names separated by colons (":"). When looking for a configuration file other than shorewall.conf: If the command is "try" or if "-c <configuration directory>" was specified in the command then the directory given in the command is searched first. Next, each directory in the CONFIG_PATH setting is searched in sequence. If CONFIG_PATH is not given or if it is set to the empty value then the contents of /usr/share/shorewall/configpath are used. As released from shorewall.net, that file sets the CONFIG_PATH to /etc/shorewall:/usr/share/shorewall but your particular distribution may set it differently. See the output of shorewall show config for the default on your system. Note that the setting in /usr/share/shorewall/configpath is always used to locate shorewall.conf. DELAYBLACKLISTLOAD={Yes|No} Users with a large static black list (shorewall-blacklist(5)) may want to set the DELAYBLACKLISTLOAD option to Yes. When DELAYBLACKLISTLOAD=Yes, Shorewall will enable new connections before loading the blacklist rules. While this may allow connections from blacklisted hosts to slip by during construction of the blacklist, it can substantially reduce the time that all new connections are disabled during shorewall [re]start. DETECT_DNAT_ADDRS=[Yes|No] If set to Yes or yes, Shorewall will detect the first IP address of the interface to the source zone and will include this address in DNAT rules as the original destination IP address. If set to No or no, Shorewall will not detect this address and any destination IP address will match the DNAT rule. If not specified or empty, “DETECT_DNAT_ADDRS=Yes” is assumed. DYNAMIC_ZONES={Yes|No} When set to Yes or yes, enables dynamic zones. DYNAMIC_ZONES=Yes is not allowed in configurations that will run under Shorewall Lite. FASTACCEPT={Yes|No} Normally, Shorewall accepting ESTABLISHED/RELATED packets until these packets reach the chain in which the original connection was accepted. So for packets going from the 'loc' zone to the 'net' zone, ESTABLISHED/RELATED packets are ACCEPTED in the 'loc2net' chain. If you set FASTACCEPT=Yes, then ESTABLISHED/RELEATED packets are accepted early in the INPUT, FORWARD and OUTPUT chains. If you set FASTACCEPT=Yes then you may not include rules in the ESTABLISHED or RELATED sections of shorewall-rules(5). HIGH_ROUTE_MARKS={Yes|No} Prior to version 3.2.0, it was not possible to use connection marking in /etc/shorewall/tcrules if you have a multi-ISP configuration that uses the track option. Beginning with release 3.2.0, you may now set HIGH_ROUTE_MARKS=Yes in to effectively divide the packet mark and connection mark into two 8-byte mark fields. When you do this: The MARK field in the providers file must have a value that is less than 65536 and that is a multiple of 256 (using hex representation, the values are 0x0100-0xFF00 with the low-order 8 bits being zero). You may only set those mark values in the PREROUTING chain. Marks used for traffic shaping must still be in the range of 1-255 and may still not be set in the PREROUTING chain. When you SAVE or RESTORE in tcrules, only the TC mark value is saved or restored. Shorewall handles saving and restoring the routing (provider) marks. IMPLICIT_CONTINUE={Yes|No} When this option is set to Yes, it causes subzones to be treated differently with respect to policies. Subzones are defined by following their name with ":" and a list of parent zones (in /etc/shorewall/zones). Normally, you want to have a set of special rules for the subzone and if a connection doesn't match any of those subzone-specific rules then you want the parent zone rules and policies to be applied. With IMPLICIT_CONTINUE=Yes, that happens automatically. If IMPLICIT_CONTINUE=No or if IMPLICIT_CONTINUE is not set, then subzones are not subject to this special treatment. With IMPLICIT_CONTINUE=Yes, an implicit CONTINUE policy may be overridden by including an explicit policy (one that does not specify "all" in either the SOURCE or the DEST columns). IP_FORWARDING=[On|Off|Keep] This parameter determines whether Shorewall enables or disables IPV4 Packet Forwarding (/proc/sys/net/ipv4/ip_forward). Possible values are: On or on packet forwarding will be enabled. Off or off packet forwarding will be disabled. Keep or keep Shorewall will neither enable nor disable packet forwarding. If this variable is not set or is given an empty value (IP_FORWARD="") then IP_FORWARD=On is assumed. IPSECFILE={zones|ipsec} This should be set to zones for all new Shorewall installations. IPSECFILE=ipsec is only used for compatibility with pre-Shorewall-3.0 configurations. IPTABLES=[pathname] This parameter names the iptables executable to be used by Shorewall. If not specified or if specified as a null value, then the iptables executable located using the PATH option is used. LOG_MARTIANS=[Yes|No] If set to Yes or yes, sets /proc/sys/net/ipv4/conf/all/log_martians and /proc/sys/net/ipv4/conf/default/log_martians to 1. Default is No which sets both of the above to zero. If you do not enable martian logging for all interfaces, you may still enable it for individual interfaces using the logmartians interface option in shorewall-interfaces(5). LOGALLNEW=[log-level] When set to a log level, this option causes Shorewall to generate a logging rule as the first rule in each builtin chain. The table name is used as the chain name in the log prefix. The chain name is used as the target in the log prefix. For example, using the default LOGFORMAT, the log prefix for logging from the nat table's PREROUTING chain is: Shorewall:nat:PREROUTING There is no rate limiting on these logging rules so use LOGALLNEW at your own risk; it may cause high CPU and disk utilization and you may not be able to control your firewall after you enable this option. Do not use this option if the resulting log messages will be sent to another system. LOGFILE=[pathname] This parameter tells the /sbin/shorewall program where to look for Shorewall messages when processing the dump, logwatch, show log, and hits commands. If not assigned or if assigned an empty value, /var/log/messages is assumed. LOGFORMAT=["formattemplate"] The value of this variable generate the --log-prefix setting for Shorewall logging rules. It contains a “printf” formatting template which accepts three arguments (the chain name, logging rule number (optional) and the disposition). To use LOGFORMAT with fireparse, set it as: LOGFORMAT="fp=%s:%d a=%s " If the LOGFORMAT value contains the substring “%d” then the logging rule number is calculated and formatted in that position; if that substring is not included then the rule number is not included. If not supplied or supplied as empty (LOGFORMAT="") then “Shorewall:%s:%s:” is assumed. LOGBURST=[burst] LOGRATE=[rate/{minute|second}] These parameters set the match rate and initial burst size for logged packets. Please see the iptables man page for a description of the behavior of these parameters (the iptables option --limit is set by LOGRATE and --limit-burst is set by LOGBURST). If both parameters are set empty, no rate-limiting will occur. Example: LOGRATE=10/minute LOGBURST=5 For each logging rule, the first time the rule is reached, the packet will be logged; in fact, since the burst is 5, the first five packets will be logged. After this, it will be 6 seconds (1 minute divided by the rate of 10) before a message will be logged from the rule, regardless of how many packets reach it. Also, every 6 seconds which passes without matching a packet, one of the bursts will be regained; if no packets hit the rule for 30 seconds, the burst will be fully recharged; back where we started. MACLIST_DISPOSITION=[ACCEPT|DROP|REJECT] Determines the disposition of connections requests that fail MAC Verification and must have the value ACCEPT (accept the connection request anyway), REJECT (reject the connection request) or DROP (ignore the connection request). If not set or if set to the empty value (e.g., MACLIST_DISPOSITION="") then MACLIST_DISPOSITION=REJECT is assumed. MACLIST_LOG_LEVEL=[log-level] Determines the syslog level for logging connection requests that fail MAC Verification. The value must be a valid syslogd log level. If you don't want to log these connection requests, set to the empty value (e.g., MACLIST_LOG_LEVEL=""). MACLIST_TABLE=[filter|mangle] Normally, MAC verification occurs in the filter table (INPUT and FORWARD) chains. When forwarding a packet from an interface with MAC verification to a bridge interface, that doesn't work. This problem can be worked around by setting MACLIST_TABLE=mangle which will cause Mac verification to occur out of the PREROUTING chain. Because REJECT isn't available in that environment, you may not specify MACLIST_DISPOSITION=REJECT with MACLIST_TABLE=mangle. MACLIST_TTL=[number] The performance of configurations with a large numbers of entries in /etc/shorewall/maclist can be improved by setting the MACLIST_TTL variable in shorewall.conf(5). If your iptables and kernel support the "Recent Match" (see the output of "shorewall check" near the top), you can cache the results of a 'maclist' file lookup and thus reduce the overhead associated with MAC Verification. When a new connection arrives from a 'maclist' interface, the packet passes through then list of entries for that interface in shorewall-maclist(5). If there is a match then the source IP address is added to the 'Recent' set for that interface. Subsequent connection attempts from that IP address occurring within $MACLIST_TTL seconds will be accepted without having to scan all of the entries. After $MACLIST_TTL from the first accepted connection request from an IP address, the next connection request from that IP address will be checked against the entire list. If MACLIST_TTL is not specified or is specified as empty (e.g, MACLIST_TTL="" or is specified as zero then 'maclist' lookups will not be cached). MAPOLDACTIONS=[Yes|No] Previously, Shorewall included a large number of standard actions (AllowPing, AllowFTP, ...). These have been replaced with parameterized macros. For compatibility, Shorewall can map the old names into invocations of the new macros if you set MAPOLDACTIONS=Yes. If this option is not set or is set to the empty value (MAPOLDACTIONS="") then MAPOLDACTIONS=Yes is assumed MARK_IN_FORWARD_CHAIN=[Yes|No] If your kernel has a FORWARD chain in the mangle table, you may set MARK_IN_FORWARD_CHAIN=Yes to cause the marking specified in the tcrules file to occur in that chain rather than in the PREROUTING chain. This permits you to mark inbound traffic based on its destination address when SNAT or Masquerading are in use. To determine if your kernel has a FORWARD chain in the mangle table, use the /sbin/shorewall show mangle command; if a FORWARD chain is displayed then your kernel will support this option. If this option is not specified or if it is given the empty value (e.g., MARK_IN_FORWARD_CHAIN="") then MARK_IN_FORWARD_CHAIN=No is assumed. MODULE_SUFFIX=["extension ..."] The value of this option determines the possible file extensions of kernel modules. The default value is "o gz ko o.gz". MODULESDIR=[pathname[:pathname]...] This parameter specifies the directory/directories where your kernel netfilter modules may be found. If you leave the variable empty, Shorewall will supply the value "/lib/modules/`uname -r`/kernel/net/ipv4/netfilter" in versions of Shorewall prior to 3.2.4 and "/lib/modules/`uname -r`/kernel/net/ipv4/netfilter:/lib/modules/`uname -r`/kernel/net/ipv4/netfilter" in later versions. MUTEX_TIMEOUT=[seconds] The value of this variable determines the number of seconds that programs will wait for exclusive access to the Shorewall lock file. After the number of seconds corresponding to the value of this variable, programs will assume that the last program to hold the lock died without releasing the lock. If not set or set to the empty value, a value of 60 (60 seconds) is assumed. An appropriate value for this parameter would be twice the length of time that it takes your firewall system to process a shorewall restart command. OPTIMIZE=[0|1] Traditionally, Shorewall has created rules for the complete matrix of Networks defined by the zones, interfaces and hosts files. Any traffic that didn't correspond to an element of that matrix was rejected in one of the built-in changes. When the matrix is sparse, this results in lots of largely useless rules. These extra rules can be eliminated by setting OPTIMIZE=1. The OPTIMIZE setting also controls the suppression of redundant wildcard rules (those specifying "all" in the SOURCE or DEST column). A wildcard rule is considered to be redundant when it has the same ACTION and Log Level as the applicable policy. PATH=pathname[:pathname]... Determines the order in which Shorewall searches directories for executable files. PKTTYPE={Yes|No} Normally Shorewall attempts to use the iptables packet type match extension to determine broadcast and multicast packets. This can cause a message to appear during shorewall start (modprobe: cant locate module ipt_pkttype). Some users have found problems with the packet match extension with the result that their firewall log is flooded with messages relating to broadcast packets. If you are experiencing either of these problems, setting PKTTYPE=No will prevent Shorewall from trying to use the packet type match extension and to use IP address matching to determine which packets are broadcasts or multicasts. RESTOREFILE=filename Specifies the simple name of a file in /var/lib/shorewall to be used as the default restore script in the shorewall save, shorewall restore, shorewall forget and shorewall -f start commands. RETAIN_ALIASES={Yes|No} During shorewall start, IP addresses to be added as a consequence of ADD_IP_ALIASES=Yes and ADD_SNAT_ALIASES=Yes are quietly deleted when shorewall-nat(5) and shorewall-masq(5) are processed then are re-added later. This is done to help ensure that the addresses can be added with the specified labels but can have the undesirable side effect of causing routes to be quietly deleted. When RETAIN_ALIASES is set to Yes, existing addresses will not be deleted. Regardless of the setting of RETAIN_ALIASES, addresses added during shorewall start are still deleted at a subsequent shorewall stop or shorewall restart. RFC1918_LOG_LEVEL=[log-level] This parameter determines the level at which packets logged under the norfc1918 mechanism are logged. The value must be a valid syslog level and if no level is given, then info is assumed. RFC1918_STRICT=[Yes|No] Traditionally, the RETURN target in the 'rfc1918' file has caused norfc1918 processing to cease for a packet if the packet's source IP address matches the rule. Thus, if you have this entry in /etc/shorewall/rfc1918: #SUBNETS TARGET 192.168.1.0/24 RETURN then traffic from 192.168.1.4 to 10.0.3.9 will be accepted even though you also have: #SUBNETS TARGET 10.0.0.0/8 logdrop Setting RFC1918_STRICT=Yes in shorewall.conf will cause such traffic to be logged and dropped since while the packet's source matches the RETURN rule, the packet's destination matches the 'logdrop' rule. If not specified or specified as empty (e.g., RFC1918_STRICT="") then RFC1918_STRICT=No is assumed. RFC1918_STRICT=Yes requires that your kernel and iptables support 'Connection Tracking' match. ROUTE_FILTER=[Yes|No] If this parameter is given the value Yes or yes then route filtering (anti-spoofing) is enabled on all network interfaces which are brought up while Shorewall is in the started state. The default value is no. SAVE_IPSETS={Yes|No} If SAVE_IPSETS=Yes, then the current contents of your ipsets will be saved by the shorewall save command. Regardless of the setting of SAVE_IPSETS, if saved ipset contents are available then they will be restored by shorewall restore. SHOREWALL_SHELL=[pathname] This option is used to specify the shell program to be used to run the Shorewall compiler and to interpret the compiled script. If not specified or specified as a null value, /bin/sh is assumed. Using a light-weight shell such as ash or dash can significantly improve performance. SMURF_LOG_LEVEL=[log-level] Specifies the logging level for smurf packets (see the nosmurfs option in /etc/shorewall/interfaces). If set to the empty value ( SMURF_LOG_LEVEL="" ) then smurfs are not logged. STARTUP_ENABLED={Yes|No} Determines if Shorewall is allowed to start. As released from shorewall.net, this option is set to No. When set to Yes or yes, Shorewall may be started. Used as a guard against Shorewall being accidentally started before it has been configured. SUBSYSLOCK=[pathname] This parameter should be set to the name of a file that the firewall should create if it starts successfully and remove when it stops. Creating and removing this file allows Shorewall to work with your distribution's initscripts. For RedHat, this should be set to /var/lock/subsys/shorewall. For Debian, the value is /var/state/shorewall and in LEAF it is /var/run/shorwall. TC_ENABLED=[Yes|No|Internal] If you say Yes or yes here, Shorewall will use a script that you supply to configure traffic shaping. The script must be named 'tcstart' and must be placed in a directory on your CONFIG_PATH. If you say No or no then traffic shaping is not enabled. If you set TC_ENABLED=Internal or internal or leave the option empty then Shorewall will use its builtin traffic shaper (tc4shorewall written by Arne Bernin. TC_EXPERT={Yes|No} Normally, Shorewall tries to protect users from themselves by preventing PREROUTING and OUTPUT tcrules from being applied to packets that have been marked by the 'track' option in shorewall-providers(5). If you know what you are doing, you can set TC_EXPERT=Yes and Shorewall will not include these cautionary checks. TCP_FLAGS_DISPOSITION=[ACCEPT|DROP|REJECT] Determines the disposition of TCP packets that fail the checks enabled by the tcpflags interface option (see shorewall-interfaces(5)) and must have a value of ACCEPT (accept the packet), REJECT (send an RST response) or DROP (ignore the packet). If not set or if set to the empty value (e.g., TCP_FLAGS_DISPOSITION="") then TCP_FLAGS_DISPOSITION=DROP is assumed. TCP_FLAGS_LOG_LEVEL=[log-level] Determines the syslog level for logging packets that fail the checks enabled by the tcpflags interface option. The value must be a valid syslogd log level. If you don't want to log these packets, set to the empty value (e.g., TCP_FLAGS_LOG_LEVEL=""). USE_ACTIONS={Yes|No} While Shorewall Actions can be very useful, they also require a sizable amount of code to implement. By setting USE_ACTIONS=No, embedded Shorewall installations can omit the large library /usr/share/shorewall/lib.actions. VERBOSITY=[number] Shorewall has traditionally been very noisy (produced lots of output). You may set the default level of verbosity using the VERBOSITY OPTION. Values are: 0 — Silent. You may make it more verbose using the -v option 1 — Major progress messages displayed 2 — All progress messages displayed (old default behavior) If not specified, then 2 is assumed. FILES /etc/shorewall/shorewall.conf See ALSO shorewall(8), shorewall-accounting(5), shorewall-actions(5), shorewall-blacklist(5), shorewall-hosts(5), shorewall-interfaces(5), shorewall-ipsec(5), shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5), shorewall-params(5), shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5), shorewall-route_rules(5), shorewall-routestopped(5), shorewall-rules(5), shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-tcrules(5), shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)