Extension Scripts

Extension scripts are user-provided scripts that are invoked at various points during firewall start, restart, stop and clear. The scripts are placed in /etc/shorewall and are processed using the Bourne shell "source" mechanism. The following scripts can be supplied:

You can also supply a script with the same name as any of the filter chains in the firewall and the script will be invoked after the /etc/shorewall/rules file has been processed but before the /etc/shorewall/policy file has been processed.

The /etc/shorewall/common file receives special treatment. If this file is present, the rules that it defines will totally replace the default rules in the common chain. These default rules are contained in the file /etc/shorewall/common.def which may be used as a starting point for making your own customized file.

Rather than running iptables directly, you should run it using the function run_iptables. Similarly, rather than running "ip" directly, you should use run_ip. These functions accept the same arguments as the underlying command but cause the firewall to be stopped if an error occurs during processing of the command.

If you decide to create /etc/shorewall/common it is a good idea to use the following technique

/etc/shorewall/common:

. /etc/shorewall/common.def
<add your rules here>

If you need to supercede a rule in the released common.def file, you can add the superceding rule before the '.' command. Using this technique allows you to add new rules while still getting the benefit of the latest common.def file.

Remember that /etc/shorewall/common defines rules that are only applied if the applicable policy is DROP or REJECT. These rules are NOT applied if the policy is ACCEPT or CONTINUE.

If you set ALLOWRELATED=No in shorewall.conf, then most ICMP packets will be rejected by the firewall. It is recommended with this setting that you create the file /etc/shorewall/icmpdef and in it place the following commands:

	run_iptables -A icmpdef -p ICMP --icmp-type echo-reply -j ACCEPT
	run_iptables -A icmpdef -p ICMP --icmp-type source-quench -j ACCEPT
	run_iptables -A icmpdef -p ICMP --icmp-type destination-unreachable -j ACCEPT
	run_iptables -A icmpdef -p ICMP --icmp-type time-exceeded -j ACCEPT
	run_iptables -A icmpdef -p ICMP --icmp-type parameter-problem -j ACCEPT

Last updated 8/22/2002 - Tom Eastep

Copyright 2002 Thomas M. Eastep