Compare commits

..

99 Commits

Author SHA1 Message Date
Tom Eastep
2778e8c6b5 Restore debian service file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-01-05 10:56:00 -08:00
Tom Eastep
ee6a1dadbb Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2016-01-05 10:48:48 -08:00
Tuomo Soini
da93669245 Revert "shorewall6*.service: make sure shorewall and shorewall6 won't start at same time"
This reverts commit ff821e57c2.

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2016-01-05 20:18:25 +02:00
Tom Eastep
2f59ea5ca3 Implement the WAIT_OPTION capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-01-05 09:28:24 -08:00
Tuomo Soini
ff821e57c2 shorewall6*.service: make sure shorewall and shorewall6 won't start at same time
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2016-01-05 12:04:46 +02:00
Tuomo Soini
c447ddd03e systemd service: rename pre214 systemd versions to pre214 and remove separeate 214 variants 2016-01-05 12:01:21 +02:00
Tom Eastep
0c66e5f1b2 More Openwrt support in Shorewall-init from Matt Darfeuille
- Also, various cleanup in install/uninstall scripts

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-01-04 15:45:21 -08:00
Tom Eastep
e695e08009 A couple of corrections to the IP[6]TABLE transparency change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-01-04 14:13:58 -08:00
Tom Eastep
c91b78a875 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2016-01-04 13:10:48 -08:00
Tom Eastep
70a9240de6 Make IP[6]TABLES transparent
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-01-04 13:10:03 -08:00
Tom Eastep
06dd5dc38f Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2016-01-02 12:37:43 -08:00
Tom Eastep
fad41e262a Support the DROP command in the mangle file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-01-02 12:36:38 -08:00
Tom Eastep
89d91d37a1 Add Shorewall-init installer support for OpenWRT
- Supply sysconfig files for all products

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-27 16:47:31 -08:00
Tom Eastep
c9f57ad9c9 Update manpages for ADD timeout
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-24 09:20:42 -08:00
Tom Eastep
694dc64900 Allow comma in disposition when LOGTAGONLY=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-23 09:06:43 -08:00
Tom Eastep
54b6488113 Allow a timeout to be specified in ADD rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-23 08:24:00 -08:00
Tom Eastep
fc426923b1 Accept host=debian.* in the configure scripts (Matt Darfeuille)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-12 08:10:34 -08:00
Tom Eastep
af6fc399e5 Update the configuration basics document
- Reflect the change in column headings in 5.0.3

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-11 14:47:18 -08:00
Tom Eastep
5bc471ff03 Another fix to configure.pl from Matt Darfeuille
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-11 14:37:52 -08:00
Tom Eastep
532d5c7e50 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-12-08 08:06:39 -08:00
Tom Eastep
8429f68897 Handle MAC addresses in IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-07 15:15:28 -08:00
Tom Eastep
3ddc2a8f8b Add parentheses for readability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-07 08:02:35 -08:00
Tom Eastep
0bc250ba11 More configure/install/uninstall fixes from Matt Darfeuille
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-06 12:04:34 -08:00
Tom Eastep
1d79cbc54e Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code
# Conflicts:
#	Shorewall-init/install.sh
2015-12-06 11:55:03 -08:00
Tom Eastep
4b893b2fd6 Install/uninstall fixes from Matt Darfeuille
Signed-off-by: Tom Eastep <teastep@shorewall.net>

Conflicts:
	Shorewall-init/install.sh
2015-12-05 11:56:16 -08:00
Tom Eastep
09af9130df Correct syntax error in lib.cli
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-05 08:42:34 -08:00
Tom Eastep
4139c932a4 More configure/install/uninstall fixes from Matt Darfeuille
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-05 08:31:22 -08:00
Tom Eastep
8e7f001f7e Update manpages for column renaming
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-04 14:53:26 -08:00
Tom Eastep
98b4ab5ceb Add missing columns in the masq file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-03 19:51:21 -08:00
Tom Eastep
592de3e6fc Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-12-03 15:35:35 -08:00
Tom Eastep
46434e45b6 Change to IP_FORWARDING=keep in shorewall6.conf files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-12-02 11:28:04 -08:00
Tom Eastep
f4fef3a931 Configure script corrections for Debian
- Matt Darfeuille and Tom Eastep

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-29 09:06:39 -08:00
Tom Eastep
2c1786422e Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-11-28 09:04:46 -08:00
Tom Eastep
b087cee7f0 Redefine MODULESDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-28 08:36:12 -08:00
Tuomo Soini
948175124b accounting: there must be more room for ACTION, SOURCE, and DEST
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-11-27 22:33:03 +02:00
Tom Eastep
7b479d3569 Merge branch '5.0.2' 2015-11-21 13:05:43 -08:00
Tom Eastep
178a7f83bc Install/uninstall fixes from Matt Darfeuille
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-21 12:53:24 -08:00
Tom Eastep
42db58c4d6 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-11-16 15:04:07 -08:00
Tom Eastep
211a00da86 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-11-16 15:03:18 -08:00
Tom Eastep
dab780368f Use netstat if ss isn't installed
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-16 15:02:47 -08:00
Tuomo Soini
b25a8e4b2d shorewall: use real field names in config file headers
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-11-16 18:16:17 +02:00
Tom Eastep
7b54e5e1a6 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-11-10 07:50:33 -08:00
Tom Eastep
355d3e2dec Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-11-09 19:00:24 -08:00
Tuomo Soini
d0d34568d1 Shorewall6: reduce number of lines on config headers
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-11-09 23:09:37 +02:00
Tuomo Soini
9460458fd5 Shorewall: reduce number of lines on config headers
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-11-09 23:04:00 +02:00
Tom Eastep
2994808e83 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-11-09 07:37:08 -08:00
Tom Eastep
7fb00e0dfe Remove the routestopped files and their manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-09 07:28:46 -08:00
Tom Eastep
27c1cd3d6e Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-11-09 07:24:52 -08:00
Tuomo Soini
e989fa1d49 configfiles/routestopped: add install path
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-11-09 10:27:07 +02:00
Tuomo Soini
f095e6f31d configfiles: unified configuration file formatting
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-11-09 10:24:20 +02:00
Tuomo Soini
8aefb3a998 Shorewall6: upgrade conntrack to ?VERSION 3
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-11-09 09:44:31 +02:00
Tom Eastep
65a0c62b0d Update the 'Build' and 'Install' files for 5.0
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-08 13:33:25 -08:00
Tom Eastep
8ae6e3ff57 A couple more OpenWRT fixes
- Detect OpenWRT in the configure script
- Fix the Shorewall6-lite uninstaller
2015-11-07 07:20:44 -08:00
Tom Eastep
ec1c9bd991 Delete shorewallrc from Shorewall-core
- Inadvertently added during OpenWRT testing

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-06 14:12:28 -08:00
Tom Eastep
6f560bda38 More OpenWRT tweaks from Matt Darfeuille
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-06 14:01:02 -08:00
Tom Eastep
d2d3748af9 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-11-05 18:09:29 -08:00
Tom Eastep
e75c88219f Start optional interfaces when there are no providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-05 18:07:31 -08:00
Tom Eastep
7cce2e4ed5 Fix mkdir command in mutex_on()
- Also support 'lock' utility on openWRT

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-05 12:38:54 -08:00
Tom Eastep
3d4cde76aa OpenWRT support in the installers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-04 13:29:59 -08:00
Tom Eastep
ca0ac0473c Another tweak to syslog_circular_buffer()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-03 18:59:10 -08:00
Tom Eastep
3890a5c1fd Correct syslog_circular_buffer()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-02 14:29:06 -08:00
Tuomo Soini
e74ff0ecd9 more cleanup to config files. 2015-11-02 00:03:38 +02:00
Tuomo Soini
85df53841b Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-11-02 00:02:56 +02:00
Tom Eastep
1c29240eb9 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-11-01 11:31:53 -08:00
Tom Eastep
2b733b610c Return proper exit status from the remote-* commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-01 07:53:31 -08:00
Tom Eastep
332f636d29 Adjust LOGFILE if circular log buffer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-11-01 07:25:34 -08:00
Tom Eastep
d1bad364e9 Correct syntax error in installers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 17:54:20 -07:00
Tom Eastep
1358ec2d87 Remove ${SYSCONFDIR}/$PRODUCT in the -lite uninstallers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 13:37:08 -07:00
Tom Eastep
5807d44733 Allow HOST=default in the configure scripts
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 13:29:02 -07:00
Tom Eastep
209d5d0766 Make the -lite uninstallers work on OpenWRT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 13:23:19 -07:00
Tom Eastep
aa680d8472 Avoid double slashes in pathnames within the installers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 12:57:33 -07:00
Tom Eastep
3d06a75768 Remove more %_b instances
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 12:43:22 -07:00
Tom Eastep
073b2992cc Require the 'install' utility in the installers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 12:43:01 -07:00
Tom Eastep
27d94c8921 Improve check for circular log buffer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 08:31:46 -07:00
Tom Eastep
460f4bc5b7 Correct defect in processing the 'persistent' route option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 08:15:10 -07:00
Tom Eastep
f90567abf1 Add support for OpenWRT BB and later
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-31 08:08:17 -07:00
Tuomo Soini
0c481b4c30 shorewall: use consitent headers on config files
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-10-31 08:18:50 +02:00
Tom Eastep
74a839b12e Mention lib.cli-user in the extension script article.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-30 09:09:53 -07:00
Tom Eastep
c83536767e Move get_config() into the overloadable part of the file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-30 08:54:07 -07:00
Tom Eastep
6209616766 Add lib.cli-user support to the full products
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-30 08:47:16 -07:00
Tom Eastep
1848c3fa45 Add lib.cli-user support to the -lite products
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-30 08:47:01 -07:00
Tom Eastep
5a3589b9a6 Add some comments in get_params()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-30 08:18:45 -07:00
Tom Eastep
3973cdf0da Merge branch '5.0.1' 2015-10-28 14:35:27 -07:00
Tom Eastep
e39d405e86 More tweaks to params processing and exporting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-28 14:33:55 -07:00
Tom Eastep
239560be8d Add Cygwin-specific code in get_params()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-28 13:47:40 -07:00
Tom Eastep
3873ebe06a More param handling fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-28 09:37:52 -07:00
Tuomo Soini
31cdd6dbcb Shorewall6/configfiles/stoppedrules: use standard description
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-10-28 10:48:48 +02:00
Tuomo Soini
e987a11614 Shorewall/configfiles/stoppedrules: use standard description
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-10-28 10:48:27 +02:00
Tom Eastep
081cf30447 Don't export variables with parentheses in their names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-27 17:45:22 -07:00
Tuomo Soini
8133de1695 Shorewall6/configfiles/conntrack: fix config file header to common format
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-10-27 22:08:38 +02:00
Tuomo Soini
74180f83b9 Shorewall6/configfiles: remove empty lines and fix blrules header to common format
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-10-27 22:04:49 +02:00
Tuomo Soini
d614081d55 Shorewall/configfiles: remove empty lines and fix blrules header to common format
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-10-27 22:03:28 +02:00
Tom Eastep
35b90c2709 Update documentation for 'remote-' vs. 'remote_'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-27 08:16:06 -07:00
Tom Eastep
79a145bf83 Correct "remote-" commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-27 07:18:54 -07:00
Tom Eastep
6535bb94c5 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-10-27 07:18:06 -07:00
Tom Eastep
38049fd0df Correct "remote-" commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-26 20:06:10 -07:00
Tom Eastep
c2768a2d64 Correct error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-26 13:08:09 -07:00
Tom Eastep
4f4358d4db Correct error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-26 13:07:40 -07:00
Tom Eastep
f822afef99 Issue warning if a persistent provider isn't optional
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-26 13:07:28 -07:00
172 changed files with 1868 additions and 3243 deletions

View File

@@ -91,6 +91,8 @@ for p in $@; do
fi
done
cd $(dirname $0)
vendor=${params[HOST]}
if [ -z "$vendor" ]; then
@@ -102,7 +104,7 @@ if [ -z "$vendor" ]; then
vendor=redhat
;;
debian|ubuntu)
ls -l /sbin/init |fgrep -q systemd | vendor=debian.systemd | vendor=debian.sysvinit
vendor=debian
;;
opensuse)
vendor=suse
@@ -122,7 +124,6 @@ if [ -z "$vendor" ]; then
params[HOST]=apple
rcfile=shorewallrc.apple
;;
cygwin*|CYGWIN*)
params[HOST]=cygwin
rcfile=shorewallrc.cygwin
@@ -130,7 +131,7 @@ if [ -z "$vendor" ]; then
*)
if [ -f /etc/debian_version ]; then
params[HOST]=debian
rcfile=shorewallrc.debian.sysvinit
ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit
elif [ -f /etc/redhat-release ]; then
params[HOST]=redhat
rcfile=shorewallrc.redhat
@@ -143,28 +144,41 @@ if [ -z "$vendor" ]; then
elif [ -f /etc/arch-release ] ; then
params[HOST]=archlinux
rcfile=shorewallrc.archlinux
elif [ -f /etc/openwrt_release ]; then
params[HOST]=openwrt
rcfile=shorewallrc.openwrt
else
params[HOST]=linux
rcfile=shorewallrc.default
fi
;;
esac
vendor=${params[HOST]}
elif [ $vendor = linux ]; then
rcfile=shorewallrc.default;
else
rcfile=shorewallrc.$vendor
if [ $vendor = linux ]; then
rcfile=shorewallrc.default;
elif [ $vendor = debian -a -f /etc/debian_version ]; then
ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit
else
rcfile=shorewallrc.$vendor
fi
if [ ! -f $rcfile ]; then
echo "ERROR: $vendor is not a recognized host type" >&2
exit 1
elif [ $vendor = default ]; then
params[HOST]=linux
vendor=linux
elif [[ $vendor == debian.* ]]; then
params[HOST]=debian
vendor=debian
fi
fi
if [ $vendor = linux ]; then
echo "INFO: Creating a generic Linux installation - " `date`;
else
echo "INFO: Creating a ${vendor}-specific installation - " `date`;
echo "INFO: Creating a ${params[HOST]}-specific installation - " `date`;
fi
echo
@@ -177,6 +191,7 @@ done
echo '#' > shorewallrc
echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc
echo "# rc file: $rcfile" >> shorewallrc
echo '#' >> shorewallrc
if [ $# -gt 0 ]; then

View File

@@ -52,6 +52,9 @@ for ( @ARGV ) {
$params{$pn} = $pv;
}
use File::Basename;
chdir dirname($0);
my $vendor = $params{HOST};
my $rcfile;
my $rcfilename;
@@ -81,12 +84,39 @@ unless ( defined $vendor ) {
}
if ( defined $vendor ) {
$rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor;
die qq("ERROR: $vendor" is not a recognized host type) unless -f $rcfilename;
if ( $vendor eq 'debian' && -f '/etc/debian_version' ) {
if ( -l '/sbin/init' ) {
if ( readlink('/sbin/init') =~ /systemd/ ) {
$rcfilename = 'shorewallrc.debian.systemd';
} else {
$rcfilename = 'shorewallrc.debian.sysvinit';
}
} else {
$rcfilename = 'shorewallrc.debian.sysvinit';
}
} else {
$rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor;
}
unless ( -f $rcfilename ) {
die qq("ERROR: $vendor" is not a recognized host type);
} elsif ( $vendor eq 'default' ) {
$params{HOST} = $vendor = 'linux';
} elsif ( $vendor =~ /^debian\./ ) {
$params{HOST} = $vendor = 'debian';
}
} else {
if ( -f '/etc/debian_version' ) {
$vendor = 'debian';
$rcfilename = 'shorewallrc.debian.sysvinit';
if ( -l '/sbin/init' ) {
if ( readlink( '/sbin/init' ) =~ /systemd/ ) {
$rcfilename = 'shorewallrc.debian.systemd';
} else {
$rcfilename = 'shorewallrc.debian.sysvinit';
}
} else {
$rcfilename = 'shorewallrc.debian.sysvinit';
}
} elsif ( -f '/etc/redhat-release' ){
$vendor = 'redhat';
$rcfilename = 'shorewallrc.redhat';
@@ -143,7 +173,8 @@ my $outfile;
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n#\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
print $outfile "# rc file: $rcfilename\n#\n";
print $outfile "# Input: @ARGV\n#\n" if @ARGV;

View File

@@ -24,6 +24,9 @@
VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall-core
Product="Shorewall Core"
usage() # $1 = exit status
{
ME=$(basename $0)
@@ -66,15 +69,6 @@ mywhich() {
return 2
}
run_install()
{
if ! install $*; then
echo
echo "ERROR: Failed to install $*" >&2
exit 1
fi
}
cant_autostart()
{
echo
@@ -88,7 +82,20 @@ delete_file() # $1 = file to delete
install_file() # $1 = source $2 = target $3 = mode
{
run_install $T $OWNERSHIP -m $3 $1 ${2}
if cp -f $1 $2; then
if chmod $3 $2; then
if [ -n "$OWNER" ]; then
if chown $OWNER:$GROUP $2; then
return
fi
else
return 0
fi
fi
fi
echo "ERROR: Failed to install $2" >&2
exit 1
}
require()
@@ -96,6 +103,9 @@ require()
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
#
@@ -181,10 +191,6 @@ done
[ "${INITFILE}" != 'none/' ] && require INITSOURCE && require INITDIR
T="-T"
INSTALLD='-D'
if [ -z "$BUILD" ]; then
case $(uname) in
cygwin*|CYGWIN*)
@@ -226,6 +232,8 @@ if [ -z "$BUILD" ]; then
BUILD=suse
elif [ -f /etc/arch-release ] ; then
BUILD=archlinux
elif [ -f ${CONFDIR}/openwrt_release ] ; then
BUILD=openwrt
else
BUILD=linux
fi
@@ -252,17 +260,15 @@ case $BUILD in
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=wheel
INSTALLD=
T=
;;
*)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
if [ $(id -u) -eq 0 ]; then
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
fi
;;
esac
OWNERSHIP="-o $OWNER -g $GROUP"
#
# Determine where to install the firewall script
#
@@ -276,7 +282,7 @@ case "$HOST" in
apple)
echo "Installing Mac-specific configuration...";
;;
debian|gentoo|redhat|slackware|archlinux|linux|suse)
debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt)
;;
*)
echo "ERROR: Unknown HOST \"$HOST\"" >&2
@@ -305,7 +311,6 @@ if [ -n "$DESTDIR" ]; then
if [ $BUILD != cygwin ]; then
if [ `id -u` != 0 ] ; then
echo "Not setting file owner/group permissions, not running as root."
OWNERSHIP=""
fi
fi
fi
@@ -341,8 +346,10 @@ fi
mkdir -p ${DESTDIR}${SBINDIR}
chmod 755 ${DESTDIR}${SBINDIR}
mkdir -p ${DESTDIR}${MANDIR}
chmod 755 ${DESTDIR}${MANDIR}
if [ -n "${MANDIR}" ]; then
mkdir -p ${DESTDIR}${MANDIR}
chmod 755 ${DESTDIR}${MANDIR}
fi
if [ -n "${INITFILE}" ]; then
mkdir -p ${DESTDIR}${INITDIR}
@@ -407,9 +414,9 @@ fi
if [ ${SHAREDIR} != /usr/share ]; then
for f in lib.*; do
if [ $BUILD != apple ]; then
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/shorewall/$f
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
else
eval sed -i \'\' -e \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/shorewall/$f
eval sed -i \'\' -e \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
fi
done
fi

View File

@@ -25,7 +25,7 @@
# loaded after this one and replaces some of the functions declared here.
#
SHOREWALL_CAPVERSION=40609
SHOREWALL_CAPVERSION=50004
[ -n "${g_program:=shorewall}" ]
@@ -143,29 +143,63 @@ timed_read ()
}
#
# Determine if 'syslog -C' is running
# Determine if 'syslogd -C' or logd -S is running
#
syslog_circular_buffer() {
local pid
local tty
local flags
local cputime
local time
local path
local args
local arg
ps ax 2> /dev/null | while read pid tty flags cputime path args; do
case $path in
syslogd|*/syslogd)
for arg in $args; do
if [ x$arg = x-C ]; then
echo Yes
return
fi
done
;;
esac
done
ps w 2> /dev/null | (
while read pid tty stat time path args; do
case $path in
syslogd|*/syslogd)
for arg in $args; do
case $arg in
-C*)
return 0
;;
esac
done
;;
logd|*/logd)
for arg in $args; do
case $arg in
-S*)
return 0
;;
esac
done
;;
esac
done
return 1 )
}
setup_logread() {
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages
if syslog_circular_buffer; then
LOGFILE=logread
if qt mywhich tac; then
g_logread="logread | tac"
else
g_logread="logread"
fi
elif [ -r $LOGFILE ]; then
if qt mywhich tac; then
g_logread="tac $LOGFILE"
else
g_logread="cat $LOGFILE"
fi
else
fatal_error "LOGFILE ($LOGFILE) does not exist or is not readable!"
fi
}
#
@@ -173,31 +207,59 @@ syslog_circular_buffer() {
#
packet_log() # $1 = number of messages
{
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
if [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
if qt mywhich tac; then
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
if [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed -r 's/ kernel://; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
elif [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed -r 's/ kernel://; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed -r 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
elif [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed -r 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
if [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | tail -n$1 | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | tail -n$1 | sed -r 's/ kernel://; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
elif [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | tail -n$1 | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | tail -n$1 | sed -r 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
fi
}
search_log() # $1 = IP address to search for
{
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
if [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
if qt mywhich tac; then
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
if [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed -r 's/ kernel://; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
elif [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed -r 's/ kernel://; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed -r 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
elif [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed -r 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
if [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | sed -r 's/ kernel://; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
elif [ $g_family -eq 4 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | sed -r 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi
fi
}
@@ -280,17 +342,7 @@ show_bl() {
logwatch() # $1 = timeout -- if negative, prompt each time that
# an 'interesting' packet count changes
{
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
fatal_error "LOGFILE ($LOGFILE) does not exist!"
fi
fi
setup_logread
host=$(echo $g_hostname | sed 's/\..*$//')
oldrejects=$($g_tool -L -v -n | grep 'LOG')
@@ -1000,11 +1052,13 @@ show_command() {
conntrack -f ipv6 -L $@ | show_connections_filter
else
[ $# -gt 1 ] && usage 1
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
echo "$g_product $SHOREWALL_VERSION Connections ($count of $max) at $g_hostname - $(date)"
echo
grep '^ipv6' /proc/net/nf_conntrack | sed -r 's/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | show_connections_filter
if [ -f /proc/sys/net/netfilter/nf_conntrack_count -a -f /proc/sys/net/nf_conntrack ]; then
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
echo "$g_product $SHOREWALL_VERSION Connections ($count of $max) at $g_hostname - $(date)"
echo
grep '^ipv6' /proc/net/nf_conntrack | sed -r 's/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | show_connections_filter
fi
fi
;;
nat)
@@ -1038,17 +1092,7 @@ show_command() {
log)
[ $# -gt 2 ] && usage 1
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
fatal_error "LOGFILE ($LOGFILE) does not exist!"
fi
fi
setup_logread
echo "$g_product $SHOREWALL_VERSION Log ($LOGFILE) at $g_hostname - $(date)"
echo
@@ -1427,17 +1471,7 @@ do_dump_command() {
esac
done
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
fatal_error "LOGFILE ($LOGFILE) does not exist! - See http://www.shorewall.net/shorewall_logging.html"
fi
fi
setup_logread
g_ipt_options="$g_ipt_options $g_ipt_options1"
@@ -1592,7 +1626,7 @@ do_dump_command() {
echo
ss -${g_family}tunap
qt mywhich ss && ss -${g_family}tunap || { qt mywhich netstat && netatat -tunap; }
if [ -n "$TC_ENABLED" ]; then
heading "Traffic Control"
@@ -2559,6 +2593,7 @@ determine_capabilities() {
TARPIT_TARGET=
IFACE_MATCH=
TCPMSS_TARGET=
WAIT_OPTION=
AMANDA_HELPER=
FTP_HELPER=
@@ -2582,6 +2617,11 @@ determine_capabilities() {
qt $arptables -L OUT && ARPTABLESJF=Yes
fi
if qt $g_tool --wait -t filter -L INPUT -n -v; then
WAIT_OPTION=Yes
tool="$tool --wait"
fi
chain=fooX$$
if [ -n "$NAT_ENABLED" ]; then
@@ -3040,8 +3080,10 @@ report_capabilities_unsorted() {
if [ $g_family -eq 4 ]; then
report_capability "iptables -S (IPTABLES_S)" $IPTABLES_S
report_capability "iptables --wait option (WAIT_OPTION)" $WAIT_OPTION
else
report_capability "ip6tables -S (IPTABLES_S)" $IPTABLES_S
report_capability "ip6tables --wait option (WAIT_OPTION)" $WAIT_OPTION
fi
report_capability "Basic Filter (BASIC_FILTER)" $BASIC_FILTER
@@ -3151,6 +3193,7 @@ report_capabilities_unsorted1() {
report_capability1 TARPIT_TARGET
report_capability1 IFACE_MATCH
report_capability1 TCPMSS_TARGET
report_capability1 WAIT_OPTION
report_capability1 AMANDA_HELPER
report_capability1 FTP_HELPER
@@ -3495,10 +3538,34 @@ noiptrace_command() {
fatal_error "$g_product is not started"
fi
}
#
# Set the configuration variables from shorewall-lite.conf
# Verify that we have a compiled firewall script
#
verify_firewall_script() {
if [ ! -f $g_firewall ]; then
echo " ERROR: $g_product is not properly installed" >&2
if [ -L $g_firewall ]; then
echo " $g_firewall is a symbolic link to a" >&2
echo " non-existant file" >&2
else
echo " The file $g_firewall does not exist" >&2
fi
exit 2
fi
}
################################################################################
# The remaining functions are used by the Lite cli - they are overloaded by
# the Standard CLI by loading lib.cli-std
################################################################################
#
# Set the configuration variables from shorewall[6]-lite.conf.
#
get_config() {
local config
local lib
ensure_config_path
@@ -3520,15 +3587,7 @@ get_config() {
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages
if ( ps ax 2> /dev/null | grep -v grep | qt grep 'syslogd.*-C' ) ; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
fatal_error "LOGFILE ($LOGFILE) does not exist!"
fi
setup_logread
#
# See if we have a real version of "tail" -- use separate redirection so
# that ash (aka /bin/sh on LRP) doesn't crap
@@ -3636,29 +3695,11 @@ get_config() {
g_loopback=$(find_loopback_interfaces)
lib=$(find_file lib.cli-user)
[ -f $lib ] && . $lib
}
#
# Verify that we have a compiled firewall script
#
verify_firewall_script() {
if [ ! -f $g_firewall ]; then
echo " ERROR: $g_product is not properly installed" >&2
if [ -L $g_firewall ]; then
echo " $g_firewall is a symbolic link to a" >&2
echo " non-existant file" >&2
else
echo " The file $g_firewall does not exist" >&2
fi
exit 2
fi
}
################################################################################
# The remaining functions are used by the Lite cli - they are overloaded by
# the Standard CLI by loading lib.cli-std
################################################################################
#
# Start Command Executor
#
@@ -3885,6 +3926,13 @@ usage() # $1 = exit status
ecko " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]"
echo " reject <address> ..."
ecko " reload [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
if [ -z "$g_lite" ]; then
echo " remote-reload [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " remote-restart [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " remote-start [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
fi
echo " reset [ <chain> ... ]"
if [ -n "$g_lite" ]; then

View File

@@ -33,7 +33,7 @@ startup_error() # $* = Error Message
echo " ERROR: $@: Firewall state not changed" >&2
if [ $LOG_VERBOSITY -ge 0 ]; then
timestamp="$(date +'%_b %d %T') "
timestamp="$(date +'%b %d %T') "
echo "${timestamp} ERROR: $@" >> $STARTUP_LOG
fi
@@ -50,7 +50,7 @@ startup_error() # $* = Error Message
esac
if [ $LOG_VERBOSITY -ge 0 ]; then
timestamp="$(date +'%_b %d %T') "
timestamp="$(date +'%b %d %T') "
case $COMMAND in
start)
@@ -316,6 +316,7 @@ reload_kernel_modules() {
local moduleloader
moduleloader=modprobe
local uname
local extras
if ! qt mywhich modprobe; then
moduleloader=insmod
@@ -323,9 +324,25 @@ reload_kernel_modules() {
[ -n "${MODULE_SUFFIX:=ko ko.gz ko.xz o o.gz o.xz gz xz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
if [ -n "$MODULESDIR" ]; then
case "$MODULESDIR" in
+*)
extras="$MODULESDIR"
extras=${extras#+}
MODULESDIR=
;;
esac
fi
if [ -z "$MODULESDIR" ]; then
uname=$(uname -r)
MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
if [ -n "$extras" ]; then
for directory in $(split "$extras"); do
MODULESDIR="$MODULESDIR:/lib/modules/$uname/$directory"
done
fi
fi
[ -d /sys/module/ ] || MODULES=$(lsmod | cut -d ' ' -f1)
@@ -355,6 +372,7 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
local savemoduleinfo
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
local uname
local extras
if ! qt mywhich modprobe; then
moduleloader=insmod
@@ -362,9 +380,25 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
[ -n "${MODULE_SUFFIX:=o gz xz ko o.gz o.xz ko.gz ko.xz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
if [ -n "$MODULESDIR" ]; then
case "$MODULESDIR" in
+*)
extras="$MODULESDIR"
extras=${extras#+}
MODULESDIR=
;;
esac
fi
if [ -z "$MODULESDIR" ]; then
uname=$(uname -r)
MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
if [ -n "$extras" ]; then
for directory in $(split "$extras"); do
MODULESDIR="$MODULESDIR:/lib/modules/$uname/$directory"
done
fi
fi
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
@@ -709,12 +743,15 @@ mutex_on()
local lockf
lockf=${LOCKFILE:=${VARDIR}/lock}
local lockpid
local lockd
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
if [ $MUTEX_TIMEOUT -gt 0 ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
lockd=$(dirname $LOCKFILE)
[ -d "$lockd" ] || mkdir -p "$lockd"
if [ -f $lockf ]; then
lockpid=`cat ${lockf} 2> /dev/null`
@@ -734,6 +771,11 @@ mutex_on()
chmod u+w ${lockf}
echo $$ > ${lockf}
chmod u-w ${lockf}
elif qt mywhich lock; then
lock -${MUTEX_TIMEOUT} -r1 ${lockf}
chmod u+w ${lockf}
echo $$ > ${lockf}
chmod u-w ${lockf}
else
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
sleep 1

View File

@@ -0,0 +1,23 @@
#
# Created by Shorewall Core version 5.0.2-RC1 configure - Fri, Nov 06, 2015 10:02:03 AM
#
# Input: host=openwrt
#
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
CONFDIR=/etc #Directory where subsystem configurations are installed
SBINDIR=/sbin #Directory where system administration programs are installed
MANDIR= #Directory where manpages are installed.
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
INITFILE=$PRODUCT #Name of the product's installed SysV init script
INITSOURCE=init.openwrt.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed
SYSCONFDIR=${CONFDIR}/sysconfig #Directory where SysV init parameter files are installed
SYSCONFFILE=sysconfig #Name of the distributed file to be installed in $SYSCONFDIR
SERVICEDIR= #Directory where .service files are installed (systems running systemd only)
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
VARLIB=/lib #Directory where product variable data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.

View File

@@ -27,7 +27,9 @@
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version
PRODUCT="shorewall-core"
Product="Shorewall Core"
usage() # $1 = exit status
{
ME=$(basename $0)
@@ -66,6 +68,11 @@ remove_file() # $1 = file to restore
fi
}
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
#
# Read the RC file
#

View File

@@ -0,0 +1,131 @@
#!/bin/sh /etc/rc.common
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.0
#
# (c) 2010,2012-2014 - Tom Eastep (teastep@shorewall.net)
# (c) 2016 - Matt Darfeuille (matdarf@gmail.com)
#
# On most distributions, this file should be called /etc/init.d/shorewall-init.
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#
# arg1 of init script is arg2 when rc.common is sourced
case "$action" in
start|stop|boot)
if [ "$(id -u)" != "0" ]
then
echo "You must be root to start, stop or restart \"Shorewall \"."
exit 1
fi
# check if shorewall-init is configured or not
if [ -f "/etc/sysconfig/shorewall-init" ]
then
. /etc/sysconfig/shorewall-init
if [ -z "$PRODUCTS" ]
then
exit 0
fi
else
exit 0
fi
;;
enable|disable|enabled)
# Openwrt related
# start and stop runlevel variable
START=19
STOP=91
;;
*)
echo "Usage: /etc/init.d/shorewall-init {start|stop}"
exit 1
esac
#
# The installer may alter this
#
. /usr/share/shorewall/shorewallrc
# Locate the current PRODUCT's statedir
setstatedir() {
local statedir
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . ${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT ${OPTIONS} compile $STATEDIR/firewall
else
return 0
fi
}
# Initialize the firewall
start () {
local PRODUCT
local STATEDIR
echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop
fi
fi
fi
done
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
ipset -R < "$SAVE_IPSETS"
fi
}
boot () {
start
}
# Clear the firewall
stop () {
local PRODUCT
local STATEDIR
echo -n "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear
fi
fi
done
if [ -n "$SAVE_IPSETS" ]; then
mkdir -p $(dirname "$SAVE_IPSETS")
if ipset -S > "${SAVE_IPSETS}.tmp"; then
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
fi
fi
}

View File

@@ -28,6 +28,8 @@
#
VERSION=xxx #The Build script inserts the actual version.
PRODUCT=shorewall-init
Product="Shorewall Init"
usage() # $1 = exit status
{
@@ -71,39 +73,50 @@ mywhich() {
return 2
}
run_install()
{
if ! install $*; then
echo
echo "ERROR: Failed to install $*" >&2
exit 1
fi
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure shorewall init to start automatically at boot" >&2
}
install_file() # $1 = source $2 = target $3 = mode
{
if cp -f $1 $2; then
if chmod $3 $2; then
if [ -n "$OWNER" ]; then
if chown $OWNER:$GROUP $2; then
return
fi
else
return 0
fi
fi
fi
echo "ERROR: Failed to install $2" >&2
exit 1
}
make_directory() # $1 = directory , $2 = mode
{
mkdir -p $1
chmod 0755 $1
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
install_file() # $1 = source $2 = target $3 = mode
{
run_install $T $OWNERSHIP -m $3 $1 ${2}
}
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
PRODUCT=shorewall-init
#
# Parse the run line
#
T='-T'
finished=0
configure=1
@@ -230,6 +243,8 @@ if [ -z "$BUILD" ]; then
BUILD=slackware
elif [ -f /etc/arch-release ] ; then
BUILD=archlinux
elif [ -f ${CONFDIR}/openwrt_release ]; then
BUILD=openwrt
else
BUILD=linux
fi
@@ -237,22 +252,24 @@ if [ -z "$BUILD" ]; then
esac
fi
[ -n "$OWNER" ] || OWNER=$(id -un)
[ -n "$GROUP" ] || GROUP=$(id -gn)
case $BUILD in
apple)
T=
;;
debian|gentoo|redhat|suse|slackware|archlinux)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=wheel
;;
cygwin*|CYGWIN*)
OWNER=$(id -un)
GROUP=$(id -gn)
;;
*)
[ -n "$BUILD" ] && echo "ERROR: Unknown BUILD environment ($BUILD)" >&2 || echo "ERROR: Unknown BUILD environment"
exit 1
if [ $(id -u) -eq 0 ]; then
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
fi
;;
esac
OWNERSHIP="-o $OWNER -g $GROUP"
[ -n "$OWNER" ] && OWNERSHIP="$OWNER:$GROUP"
[ -n "$HOST" ] || HOST=$BUILD
@@ -277,6 +294,9 @@ case "$HOST" in
suse)
echo "Installing SuSE-specific configuration..."
;;
openwrt)
echo "Installing Openwrt-specific configuration..."
;;
linux)
echo "ERROR: Shorewall-init is not supported on this system" >&2
exit 1
@@ -290,12 +310,12 @@ esac
[ -z "$TARGET" ] && TARGET=$HOST
if [ -n "$DESTDIR" ]; then
if [ `id -u` != 0 ] ; then
if [ $(id -u) != 0 ] ; then
echo "Not setting file owner/group permissions, not running as root."
OWNERSHIP=""
fi
install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
make_directory ${DESTDIR}${INITDIR} 0755
fi
echo "Installing Shorewall Init Version $VERSION"
@@ -311,7 +331,7 @@ fi
if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
chmod 0755 ${DESTDIR}${CONFDIR}/logrotate.d
fi
#
@@ -339,14 +359,14 @@ fi
if [ -n "$SERVICEDIR" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR}
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
if [ -n "$DESTDIR" -o $configure -eq 0 ]; then
mkdir -p ${DESTDIR}${SBINDIR}
chmod 755 ${DESTDIR}${SBINDIR}
chmod 0755 ${DESTDIR}${SBINDIR}
fi
run_install $OWNERSHIP -m 700 shorewall-init ${DESTDIR}${SBINDIR}/shorewall-init
install_file shorewall-init ${DESTDIR}${SBINDIR}/shorewall-init 0700
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/shorewall-init
echo "CLI installed as ${DESTDIR}${SBINDIR}/shorewall-init"
fi
@@ -355,13 +375,13 @@ fi
# Create /usr/share/shorewall-init if needed
#
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall-init
chmod 755 ${DESTDIR}${SHAREDIR}/shorewall-init
chmod 0755 ${DESTDIR}${SHAREDIR}/shorewall-init
#
# Install logrotate file
#
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT
install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 0644
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
fi
@@ -369,7 +389,7 @@ fi
# Create the version file
#
echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/shorewall-init/version
chmod 644 ${DESTDIR}${SHAREDIR}/shorewall-init/version
chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall-init/version
#
# Remove and create the symbolic link to the init script
@@ -397,6 +417,7 @@ if [ $HOST = debian ]; then
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default
install_file sysconfig ${DESTDIR}${ETC}/default/shorewall-init 0644
echo "sysconfig file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
fi
IFUPDOWN=ifupdown.debian.sh
@@ -411,6 +432,9 @@ else
elif [ $HOST = gentoo ]; then
# Gentoo does not support if-{up,down}.d
/bin/true
elif [ $HOST = openwrt ]; then
# Not implemented on openwrt
/bin/true
else
mkdir -p ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d
fi
@@ -418,8 +442,8 @@ else
fi
if [ -n "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT
echo "$SYSCONFFILE installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT 0644
echo "${SYSCONFFILE} file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
fi
[ $HOST = suse ] && IFUPDOWN=ifupdown.suse.sh || IFUPDOWN=ifupdown.fedora.sh
@@ -429,13 +453,15 @@ fi
# Install the ifupdown script
#
cp $IFUPDOWN ifupdown
if [ $HOST != openwrt ]; then
cp $IFUPDOWN ifupdown
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
fi
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/
@@ -488,9 +514,13 @@ case $HOST in
esac
if [ -z "$DESTDIR" ]; then
if [ $configure -eq 1 -a -n "$first_install" ]; then
if [ $configure -eq 1 -a -n "first_install" ]; then
if [ $HOST = debian ]; then
if mywhich insserv; then
if [ -n "$SERVICEDIR" ]; then
if systemctl enable ${PRODUCT}.service; then
echo "Shorewall Init will start automatically at boot"
fi
elif mywhich insserv; then
if insserv ${INITDIR}/shorewall-init; then
echo "Shorewall Init will start automatically at boot"
else
@@ -506,6 +536,13 @@ if [ -z "$DESTDIR" ]; then
else
cant_autostart
fi
elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then
/etc/init.d/$PRODUCT enable
if /etc/init.d/$PRODUCT enabled; then
echo "$Product will start automatically at boot"
else
cant_autostart
fi
elif [ $HOST = gentoo ]; then
# On Gentoo, a service must be enabled manually by the user,
# not by the installer
@@ -534,6 +571,13 @@ if [ -z "$DESTDIR" ]; then
else
cant_autostart
fi
elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then
/etc/init.d/shorewall-inir enable
if /etc/init.d/shorewall-init enabled; then
echo "Shorrewall Init will start automatically at boot"
else
cant_autostart
fi
else
cant_autostart
fi
@@ -554,7 +598,7 @@ fi
[ -z "${DESTDIR}" ] && [ ! -f ~/.shorewallrc ] && cp ${SHAREDIR}/shorewall/shorewallrc .
if [ -f ${DESTDIR}/etc/ppp ]; then
if [ -d ${DESTDIR}/etc/ppp ]; then
case $HOST in
debian|suse)
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do

View File

@@ -5,7 +5,8 @@
#
[Unit]
Description=Shorewall firewall (bootup security)
Before=network.target
Before=network-pre.target
Wants=network-pre.target
[Service]
Type=oneshot

View File

@@ -1,20 +0,0 @@
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
#
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
#
[Unit]
Description=Shorewall firewall (bootup security)
Before=network-pre.target
Wants=network-pre.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/shorewall-init
StandardOutput=syslog
ExecStart=/sbin/shorewall-init start
ExecStop=/sbin/shorewall-init stop
[Install]
WantedBy=basic.target

View File

@@ -1,21 +0,0 @@
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
#
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
# Copyright 2015 Tom Eastep <teastep@shorewall.net>
#
[Unit]
Description=Shorewall firewall (bootup security)
Before=network-pre.target
Wants=network-pre.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/default/shorewall-init
StandardOutput=syslog
ExecStart=/sbin/shorewall-init start
ExecStop=/sbin/shorewall-init stop
[Install]
WantedBy=basic.target

View File

@@ -27,6 +27,8 @@
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall-init
Product="Shorewall Init"
usage() # $1 = exit status
{
@@ -75,6 +77,11 @@ remove_file() # $1 = file to restore
fi
}
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
finished=0
configure=1
@@ -162,7 +169,11 @@ INITSCRIPT=${CONFDIR}/init.d/shorewall-init
if [ -f "$INITSCRIPT" ]; then
if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then
if [ $HOST = openwrt ]; then
if /etc/init.d/shorewall-init enabled; then
/etc/init.d/shorewall-init disable
fi
elif mywhich updaterc.d ; then
updaterc.d shorewall-init remove
elif mywhich insserv ; then
insserv -r $INITSCRIPT
@@ -174,13 +185,22 @@ if [ -f "$INITSCRIPT" ]; then
remove_file $INITSCRIPT
fi
if [ -n "$SYSTEMD" ]; then
[ $configure -eq 1 ] && systemctl disable shorewall-init.service
rm -f $SYSTEMD/shorewall-init.service
if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD"
fi
[ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
[ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable shorewall-init.service
rm -f $SERVICEDIR/shorewall-init.service
fi
if [ $HOST = openwrt ]; then
[ "$(readlink -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
[ "$(readlink -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local
else
[ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
[ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local
fi
remove_file ${CONFDIR}/default/shorewall-init
remove_file ${CONFDIR}/sysconfig/shorewall-init
@@ -194,16 +214,16 @@ remove_file ${CONFDIR}/network/if-post-down.d/shorewall
remove_file ${CONFDIR}/sysconfig/network/if-up.d/shorewall
remove_file ${CONFDIR}/sysconfig/network/if-down.d/shorewall
[ -n "$SYSTEMD" ] && remove_file ${SYSTEMD}/shorewall.service
if [ -d ${CONFDIR}/ppp ]; then
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
remove_file ${CONFDIR}/ppp/$directory/shorewall
done
for file in if-up.local if-down.local; do
if grep -qF Shorewall-based ${CONFDIR}/ppp/$FILE; then
remove_file ${CONFDIR}/ppp/$FILE
if [ -f ${CONFDIR}/ppp/$file ]; then
if grep -qF Shorewall-based ${CONFDIR}/ppp/$FILE; then
remove_file ${CONFDIR}/ppp/$FILE
fi
fi
done
fi

97
Shorewall-lite/init.openwrt.sh Executable file
View File

@@ -0,0 +1,97 @@
#!/bin/sh /etc/rc.common
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
#
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012,2014 - Tom Eastep (teastep@shorewall.net)
# (c) 2015 - Matt Darfeuille - (matdarf@gmail.com)
#
# On most distributions, this file should be called /etc/init.d/shorewall.
#
# Complete documentation is available at http://shorewall.net
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# If an error occurs while starting or restarting the firewall, the
# firewall is automatically stopped.
#
# Commands are:
#
# shorewall-lite start Starts the firewall
# shorewall-lite restart Restarts the firewall
# shorewall-lite reload Reload the firewall
# shorewall-lite stop Stops the firewall
# shorewall-lite status Displays firewall status
#
# description: Packet filtering firewall
# Product name variable
PRODUCT=shorewall-lite
+
# Openwrt related
# start and stop runlevel variable
START=50
STOP=89
# variable to display what the status command do when /etc/init.d/shorewall-lite is invoke without argument
EXTRA_COMMANDS="status"
EXTRA_HELP="status displays shorewall status"
################################################################################
# Get startup options (override default)
################################################################################
OPTIONS=
#
# The installer may alter this
#
. /usr/share/shorewall/shorewallrc
if [ -f ${SYSCONFDIR}/$PRODUCT ]; then
. ${SYSCONFDIR}/$PRODUCT
fi
SHOREWALL_INIT_SCRIPT=1
################################################################################
# E X E C U T I O N B E G I N S H E R E #
################################################################################
# arg1 of init script is arg2 when rc.common is sourced; set to action variable
command="$action"
start() {
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $STARTOPTIONS
}
boot() {
local command="start"
start
}
restart() {
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $RESTARTOPTIONS
}
reload() {
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $RELOADOPTION
}
stop() {
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $STOPOPTIONS
}
status() {
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $STATUSOPTIONS
}

View File

@@ -67,15 +67,6 @@ mywhich() {
return 2
}
run_install()
{
if ! install $*; then
echo
echo "ERROR: Failed to install $*" >&2
exit 1
fi
}
cant_autostart()
{
echo
@@ -89,7 +80,28 @@ delete_file() # $1 = file to delete
install_file() # $1 = source $2 = target $3 = mode
{
run_install $T $OWNERSHIP -m $3 $1 ${2}
if cp -f $1 $2; then
if chmod $3 $2; then
if [ -n "$OWNER" ]; then
if chown $OWNER:$GROUP $2; then
return
fi
else
return 0
fi
fi
fi
echo "ERROR: Failed to install $2" >&2
exit 1
}
make_directory() # $1 = directory , $2 = mode
{
mkdir -p $1
chmod 755 $1
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}
require()
@@ -187,7 +199,7 @@ elif [ -z "${VARDIR}" ]; then
VARDIR=${VARLIB}/${PRODUCT}
fi
for var in SHAREDIR LIBEXECDIRDIRDIR CONFDIR SBINDIR VARLIB VARDIR; do
for var in SHAREDIR LIBEXECDIR CONFDIR SBINDIR VARLIB VARDIR; do
require $var
done
@@ -201,8 +213,6 @@ PATH=${SBINDIR}:/bin:/usr${SBINDIR}:/usr/bin:/usr/local/bin:/usr/local${SBINDIR}
# Determine where to install the firewall script
#
cygwin=
INSTALLD='-D'
T='-T'
if [ -z "$BUILD" ]; then
case $(uname) in
@@ -245,6 +255,8 @@ if [ -z "$BUILD" ]; then
BUILD=slackware
elif [ -f ${CONFDIR}/arch-release ] ; then
BUILD=archlinux
elif [ -f ${CONFDIR}/openwrt_release ]; then
BUILD=openwrt
else
BUILD=linux
fi
@@ -260,16 +272,16 @@ case $BUILD in
apple)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=wheel
INSTALLD=
T=
;;
*)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
if [ $(id -u) -eq 0 ]; then
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
fi
;;
esac
OWNERSHIP="-o $OWNER -g $GROUP"
[ -n "$OWNER" ] && OWNERSHIP="$OWNER:$GROUP"
[ -n "$HOST" ] || HOST=$BUILD
@@ -300,6 +312,9 @@ case "$HOST" in
suse)
echo "Installing Suse-specific configuration..."
;;
openwrt)
echo "Installing OpenWRT-specific configuration..."
;;
linux)
;;
*)
@@ -316,8 +331,9 @@ if [ -n "$DESTDIR" ]; then
OWNERSHIP=""
fi
install -d $OWNERSHIP -m 755 ${DESTDIR}/${SBINDIR}
install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
make_directory ${DESTDIR}${SBINDIR} 755
make_directory ${DESTDIR}${INITDIR} 755
else
if [ ! -f ${SHAREDIR}/shorewall/coreversion ]; then
echo "$PRODUCT $VERSION requires Shorewall Core which does not appear to be installed" >&2
@@ -357,7 +373,7 @@ fi
delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules
install_file $PRODUCT ${DESTDIR}${SBINDIR}/$PRODUCT 0544
[ -n "${INITFILE}" ] && install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
[ -n "${INITFILE}" ] && make_directory ${DESTDIR}${INITDIR} 755
echo "$Product control program installed in ${DESTDIR}${SBINDIR}/$PRODUCT"
@@ -399,7 +415,7 @@ fi
if [ -n "$SERVICEDIR" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR}
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 644
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
fi
@@ -421,9 +437,9 @@ fi
#
# Install the Makefile
#
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}${CONFDIR}/$PRODUCT
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile
[ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile
install_file Makefile ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile 0600
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile
[ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile
echo "Makefile installed as ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile"
#
@@ -438,7 +454,7 @@ echo "Default config path file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/confi
for f in lib.* ; do
if [ -f $f ]; then
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
echo "Library ${f#*.} file installed as ${DESTDIR}/${SHAREDIR}/$PRODUCT/$f"
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
fi
done
@@ -451,7 +467,7 @@ echo "Common functions linked through ${DESTDIR}${SHAREDIR}/$PRODUCT/functions"
#
install_file shorecap ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap 0755
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${LIBEXECDIR}/$PRODUCT/shorecap
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap
echo
echo "Capability file builder installed in ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap"
@@ -461,17 +477,17 @@ echo "Capability file builder installed in ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shor
#
if [ -f modules ]; then
run_install $OWNERSHIP -m 0600 modules ${DESTDIR}${SHAREDIR}/$PRODUCT
install_file modules ${DESTDIR}${SHAREDIR}/$PRODUCT/modules 0600
echo "Modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/modules"
fi
if [ -f helpers ]; then
run_install $OWNERSHIP -m 0600 helpers ${DESTDIR}${SHAREDIR}/$PRODUCT
install_file helpers ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers 600
echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers"
fi
for f in modules.*; do
run_install $OWNERSHIP -m 0644 $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 644
echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
done
@@ -482,17 +498,17 @@ done
if [ -d manpages ]; then
cd manpages
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man5/ ${DESTDIR}${MANDIR}/man8/
mkdir -p ${DESTDIR}${MANDIR}/man5/ ${DESTDIR}${MANDIR}/man8/
for f in *.5; do
gzip -c $f > $f.gz
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz
install_file $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz 644
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz"
done
for f in *.8; do
gzip -c $f > $f.gz
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 644
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
done
@@ -502,7 +518,7 @@ if [ -d manpages ]; then
fi
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT
install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 644
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
fi
@@ -533,13 +549,13 @@ if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PR
chmod 755 ${DESTDIR}${SYSCONFDIR}
fi
run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT}
install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640
echo "$SYSCONFFILE installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
fi
if [ ${SHAREDIR} != /usr/share ]; then
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/${PRODUCT}/lib.base
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SBINDIR}/$PRODUCT
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.base
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/$PRODUCT
fi
if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
@@ -587,6 +603,13 @@ if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${
else
cant_autostart
fi
elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then
/etc/init.d/$PRODUCT enable
if /etc/init.d/$PRODUCT enabled; then
echo "$PRODUCT will start automatically at boot"
else
cant_autostart
fi
elif [ "$INITFILE" != rc.${PRODUCT} ]; then #Slackware starts this automatically
cant_autostart
fi

View File

@@ -1,21 +0,0 @@
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
#
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
#
[Unit]
Description=Shorewall IPv4 firewall (lite)
Wants=network-online.target
After=network-online.target
Conflicts=iptables.service firewalld.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/shorewall-lite
StandardOutput=syslog
ExecStart=/sbin/shorewall-lite $OPTIONS start $STARTOPTIONS
ExecStop=/sbin/shorewall-lite $OPTIONS stop
[Install]
WantedBy=basic.target

25
Shorewall-lite/sysconfig Normal file
View File

@@ -0,0 +1,25 @@
# sysV init file script configuration(/etc/sysconfdir/shorewall-lite)
# startup option(default "-vvv")
OPTIONS=
# change default start run level(if none empty; /etc/init.d/shorewall-lite enable)
START=50
# change default stop run level(if none empty; /etc/init.d/shorewall-lite enable)
STOP=
# option to pass when shorewall start is executed
STARTOPTIONS=
# option to pass when shorewall restart is executed
RESTARTOPTIONS=
# option to pass when shorewall reload is executed
RELOADOPTIONS=
# option to pass when shorewall stop is executed
STOPOPTIONS=
# option to pass when shorewall status is executed
STATUSOPTIONS=

View File

@@ -28,6 +28,7 @@
VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall-lite
Product="Shorewall Lite"
usage() # $1 = exit status
{
@@ -168,7 +169,15 @@ if [ $configure -eq 1 ]; then
fi
if [ -L ${SHAREDIR}/shorewall-lite/init ]; then
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall-lite/init)
if [ $HOST = openwrt ]; then
if [ $configure -eq 1 ] && /etc/init.d/shorewall-lite enabled; then
/etc/init.d/shorewall-lite disable
fi
FIREWALL=$(readlink ${SHAREDIR}/shorewall-lite/init)
else
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall-lite/init)
fi
elif [ -n "$INITFILE" ]; then
FIREWALL=${INITDIR}/${INITFILE}
fi
@@ -187,21 +196,26 @@ if [ -f "$FIREWALL" ]; then
remove_file $FIREWALL
fi
if [ -n "$SYSTEMD" ]; then
[ -z "$SERVICEDIR" ] && SERVICEDIR="$SYSTEMD"
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
rm -f $SYSTEMD/shorewall-lite.service
rm -f $SERVICEDIR/shorewall-lite.service
fi
rm -f ${SBINDIR}/shorewall-lite
rm -rf ${CONFDIR}/shorewall-lite
rm -rf ${VARDIR}/shorewall-lite
rm -rf ${VARDIR}
rm -rf ${SHAREDIR}/shorewall-lite
rm -rf ${LIBEXECDIR}/shorewall-lite
rm -f ${CONFDIR}/logrotate.d/shorewall-lite
rm -f ${SYSCONFDIR}/shorewall-lite
rm -f ${MANDIR}/man5/shorewall-lite*
rm -f ${MANDIR}/man8/shorewall-lite*
if [ -n "${MANDIR}" ]; then
rm -f ${MANDIR}/man5/shorewall-lite*
rm -f ${MANDIR}/man8/shorewall-lite*
fi
echo "Shorewall Lite Uninstalled"

View File

@@ -291,7 +291,8 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
'' ,
$target ,
'' ,
$disposition ,
$disposition ,
'' ,
'' );
}
}
@@ -386,6 +387,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
$target ,
'' ,
$disposition ,
'' ,
'' ;
if ( $rule2 || $jump ) {
@@ -414,7 +416,8 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
'' ,
'' ,
'' ,
'' ,
'' ,
'' ,
'' );
}

View File

@@ -6242,7 +6242,7 @@ sub log_rule_limit( $$$$$$$$ ) {
if ( $tag =~ /^,/ ) {
( $disposition = $tag ) =~ s/,//;
} elsif ( $tag =~ /,/ ) {
( $chain, $disposition ) = split ',', $tag;
( $chain, $disposition ) = split ',', $tag, 2;
} else {
$chain = $tag;
}
@@ -6336,7 +6336,7 @@ sub log_irule_limit( $$$$$$$@ ) {
if ( $tag =~ /^,/ ) {
( $disposition = $tag ) =~ s/,//;
} elsif ( $tag =~ /,/ ) {
( $chain, $disposition ) = split ',', $tag;
( $chain, $disposition ) = split ',', $tag, 2;
} else {
$chain = $tag;
}
@@ -6562,6 +6562,8 @@ sub set_chain_variables() {
emit( 'g_tool=$IP6TABLES' );
}
emit 'g_tool="$g_tool --wait"' if have_capability 'WAIT_OPTION';
if ( $config{IP} ) {
emit( qq(IP="$config{IP}") ,
'[ -x "$IP" ] || startup_error "IP=$IP does not exist or is not executable"'
@@ -7031,7 +7033,7 @@ sub isolate_source_interface( $ ) {
$inets = $2;
} elsif ( $source =~ /^(.+?):\[(.+)\]\s*$/ ||
$source =~ /^(.+?):(!?\+.+)$/ ||
$source =~ /^(.+?):(!?[&%].+)$/ ||
$source =~ /^(.+?):(!?[&%~].+)$/ ||
$source =~ /^(.+?):(\[.+\]\/(?:\d+))\s*$/
) {
$iiface = $1;
@@ -7428,7 +7430,7 @@ sub handle_exclusion( $$$$$$$$$$$$$$$$$$$$$ ) {
#
# Returns the destination interface specified in the rule, if any.
#
sub expand_rule( $$$$$$$$$$$;$ )
sub expand_rule( $$$$$$$$$$$$;$ )
{
my ($chainref , # Chain
$restriction, # Determines what to do with interface names in the SOURCE or DEST
@@ -7441,6 +7443,7 @@ sub expand_rule( $$$$$$$$$$$;$ )
$loglevel , # Log level (and tag)
$disposition, # Primtive part of the target (RETURN, ACCEPT, ...)
$exceptionrule,# Caller's matches used in exclusion case
$usergenerated,# Rule came from the IP[6]TABLES target
$logname, # Name of chain to name in log messages
) = @_;
@@ -7490,7 +7493,7 @@ sub expand_rule( $$$$$$$$$$$;$ )
$loglevel = validate_level( $loglevel );
$logtag = '' unless defined $logtag;
}
} elsif ( $disposition eq 'LOG' ) {
} elsif ( $disposition eq 'LOG' && ! $usergenerated ) {
fatal_error "LOG requires a level";
}
#
@@ -7605,9 +7608,9 @@ sub expand_rule( $$$$$$$$$$$;$ )
my $cond3 = conditional_rule( $chainref, $dnet );
if ( $loglevel eq '' ) {
if ( $loglevel eq '' || $usergenerated ) {
#
# No logging -- add the target rule with matches to the rule chain
# No logging or user-specified logging -- add the target rule with matches to the rule chain
#
if ( $targetref ) {
add_expanded_jump( $chainref, $targetref , 0, $matches );

View File

@@ -396,6 +396,7 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
TARPIT_TARGET => 'TARPIT Target',
IFACE_MATCH => 'Iface Match',
TCPMSS_TARGET => 'TCPMSS Target',
WAIT_OPTION => 'iptables --wait option',
AMANDA_HELPER => 'Amanda Helper',
FTP_HELPER => 'FTP Helper',
@@ -714,7 +715,7 @@ sub initialize( $;$$) {
EXPORT => 0,
KLUDGEFREE => '',
VERSION => "5.0.1",
CAPVERSION => 40609 ,
CAPVERSION => 50004 ,
BLACKLIST_LOG_TAG => '',
RELATED_LOG_TAG => '',
MACLIST_LOG_TAG => '',
@@ -989,6 +990,7 @@ sub initialize( $;$$) {
TARPIT_TARGET => undef,
IFACE_MATCH => undef,
TCPMSS_TARGET => undef,
WAIT_OPTION => undef,
AMANDA_HELPER => undef,
FTP_HELPER => undef,
@@ -2212,7 +2214,10 @@ sub split_line2( $$;$$$ ) {
$pairs = '';
}
fatal_error "Shorewall Configuration file entries may not contain double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/;
unless ( $currline =~ /^\s*IP6?TABLES\(.*\)/ ) {
fatal_error "Shorewall Configuration file entries may not contain double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/;
}
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
my @line = split_columns( $columns );
@@ -2245,7 +2250,7 @@ sub split_line2( $$;$$$ ) {
for ( @pairs ) {
fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/;
my ( $column, $value ) = ( lc $1, $2 );
my ( $column, $value ) = ( lc( $1 ), $2 );
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
$column = $columnsref->{$column};
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
@@ -3963,7 +3968,7 @@ sub Udpliteredirect() {
sub Mangle_Enabled() {
if ( qt1( "$iptables $iptablesw -t mangle -L -n" ) ) {
system( "$iptables -t mangle -N $sillyname" ) == 0 || fatal_error "Cannot Create Mangle chain $sillyname";
system( "$iptables $iptablesw -t mangle -N $sillyname" ) == 0 || fatal_error "Cannot Create Mangle chain $sillyname";
}
}
@@ -4605,7 +4610,8 @@ sub determine_capabilities() {
my $pid = $$;
$capabilities{CAPVERSION} = $globals{CAPVERSION};
$capabilities{CAPVERSION} = $globals{CAPVERSION};
$capabilities{WAIT_OPTION} = $iptablesw;
determine_kernelversion;
@@ -5083,6 +5089,8 @@ sub read_capabilities() {
$globals{KLUDGEFREE} = $capabilities{KLUDGEFREE};
$iptablesw = '-w' if $capabilities{WAIT_OPTION};
}
#
@@ -5147,6 +5155,7 @@ sub unsupported_yes_no_warning( $ ) {
#
sub get_params( $ ) {
my $export = $_[0];
my $cygwin = ( $shorewallrc{HOST} eq 'cygwin' );
my $fn = find_file 'params';
@@ -5188,14 +5197,16 @@ sub get_params( $ ) {
$shell = BASH;
for ( @params ) {
if ( /^declare -x (.*?)="(.*[^\\])"$/ ) {
chomp;
if ( $cygwin && /^declare -x (.*?)="(.*)"$/ ) {
$params{$1} = $2 unless $1 eq '_';
} elsif ( /^declare -x (.*?)="(.*[^\\])"$/ ) {
$params{$1} = $2 unless $1 eq '_';
} elsif ( /^declare -x (.*?)="(.*)$/ ) {
$params{$variable=$1} = $2 eq '"' ? '' : "${2}\n";
} elsif ( /^declare -x (.*)\s+$/ || /^declare -x (.*)=""$/ ) {
$params{$1} = '';
} else {
chomp;
if ($variable) {
s/"$//;
$params{$variable} .= $_;
@@ -5216,14 +5227,16 @@ sub get_params( $ ) {
$shell = OLDBASH;
for ( @params ) {
if ( /^export (.*?)="(.*[^\\])"$/ ) {
chomp;
if ( $cygwin && /^export (.*?)="(.*)"$/ ) {
$params{$1} = $2 unless $1 eq '_';
} elsif ( /^export (.*?)="(.*[^\\])"$/ ) {
$params{$1} = $2 unless $1 eq '_';
} elsif ( /^export (.*?)="(.*)$/ ) {
$params{$variable=$1} = $2 eq '"' ? '' : "${2}\n";
} elsif ( /^export ([^\s=]+)\s*$/ || /^export (.*)=""$/ ) {
$params{$1} = '';
} else {
chomp;
if ($variable) {
s/"$//;
$params{$variable} .= $_;
@@ -5243,6 +5256,7 @@ sub get_params( $ ) {
$shell = ASH;
for ( @params ) {
chomp;
if ( /^export (.*?)='(.*'"'"')$/ ) {
$params{$variable=$1}="${2}\n";
} elsif ( /^export (.*?)='(.*)'$/ ) {
@@ -5250,7 +5264,6 @@ sub get_params( $ ) {
} elsif ( /^export (.*?)='(.*)$/ ) {
$params{$variable=$1}="${2}\n";
} else {
chomp;
if ($variable) {
s/'$//;
$params{$variable} .= $_;
@@ -5262,9 +5275,23 @@ sub get_params( $ ) {
}
for ( keys %params ) {
unless ( $_ eq 'SHOREWALL_INIT_SCRIPT' ) {
fatal_error "The variable name $_ is reserved and may not be set in the params file"
if /^SW_/ || /^SHOREWALL_/ || ( exists $config{$_} && ! exists $ENV{$_} ) || exists $reserved{$_};
if ( /[^\w]/ ) {
#
# Useless variable with special characters in its name
#
delete $params{$_};
} elsif ( /^(?:SHLVL|OLDPWD)$/ ) {
#
# The shell running getparams generates those
#
delete $params{$_};
} else {
unless ( $_ eq 'SHOREWALL_INIT_SCRIPT' ) {
fatal_error "The variable name $_ is reserved and may not be set in the params file"
if /^SW_/ || /^SHOREWALL_/ || ( exists $config{$_} && ! exists $ENV{$_} ) || exists $reserved{$_};
}
$params{$_} = '' unless defined $params{$_};
}
}
@@ -5314,6 +5341,8 @@ sub export_params() {
next if exists $compiler_params{$param};
my $value = $params{$param};
chomp $value;
#
# Values in %params are generated from the output of 'export -p'.
# The different shells have different conventions for delimiting
@@ -5324,19 +5353,27 @@ sub export_params() {
$value =~ s/\\"/"/g;
} elsif ( $shell == OLDBASH ) {
$value =~ s/\\'/'/g;
$value =~ s/\\"/"/g;
$value =~ s/\\\\/\\/g;
} else {
$value =~ s/'"'"'/'/g;
}
#
# Don't export pairs from %ENV
#
next if defined $ENV{$param} && $value eq $ENV{$param};
if ( defined $ENV{$param} ) {
next if $value eq $ENV{$param};
} elsif ( exists $ENV{$param} ) {
next unless supplied $value;
}
emit "#\n# From the params file\n#" unless $count++;
#
# We will use double quotes and escape embedded quotes with \.
#
if ( $value =~ /[\s()['"]/ ) {
if ( $value =~ /^"[^"]*"$/ ) {
emit "$param=$value";
} elsif ( $value =~ /[\s()['"]/ ) {
$value =~ s/"/\\"/g;
emit "$param='$value'";
} else {

View File

@@ -614,7 +614,8 @@ sub process_stoppedrules() {
$target,
'',
$disposition,
do_proto( $proto, '-', '-' ) );
do_proto( $proto, '-', '-' ),
'');
}
} else {
warning_message "Redundant OUTPUT rule ignored because ADMINISABSENTMINDED=Yes";

View File

@@ -345,7 +345,8 @@ sub process_one_masq1( $$$$$$$$$$$ )
$target ,
'' ,
'' ,
$exceptionrule )
$exceptionrule ,
'' )
unless unreachable_warning( 0, $chainref );
conditional_rule_end( $chainref ) if $detectaddress || $conditional;
@@ -795,7 +796,8 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
$target ,
$loglevel ,
$log_action ,
$serverport ? do_proto( $proto, '', '' ) : '',
$serverport ? do_proto( $proto, '', '' ) : '' ,
'' ,
)
unless unreachable_warning( $wildcard, $chainref );
@@ -867,6 +869,7 @@ sub handle_nonat_rule( $$$$$$$$$$$ ) {
$loglevel,
$log_action,
'',
'',
dnat_chain( $sourcezone ) )
unless unreachable_warning( $wildcard, $chn );
@@ -888,6 +891,7 @@ sub handle_nonat_rule( $$$$$$$$$$$ ) {
$loglevel ,
$log_action ,
'',
'',
)
unless unreachable_warning( $wildcard, $nonat_chain );
}

View File

@@ -661,6 +661,10 @@ sub process_a_provider( $ ) {
fatal_error 'A non-empty COPY column requires that a routing table be specified in the DUPLICATE column' unless $copy eq 'none';
}
if ( $persistent ) {
warning_message( "Provider $table is not optional -- the 'persistent' option is ignored" ), $persistent = 0 unless $optional;
}
$providers{$table} = { provider => $table,
number => $number ,
id => $config{USE_RT_NAMES} ? $table : $number,
@@ -702,7 +706,7 @@ sub process_a_provider( $ ) {
if ( $track ) {
if ( $routemarked_interfaces{$interface} ) {
fatal_error "Interface $interface is tracked through an earlier provider" if $routemarked_interfaces{$interface} == ROUTEMARKED_UNSHARED;
fatal_error "Multiple providers through the same interface must their IP address specified in the INTERFACES" unless $shared;
fatal_error "Multiple providers through the same interface must have their IP address specified in the INTERFACES column" unless $shared;
} else {
$routemarked_interfaces{$interface} = $shared ? ROUTEMARKED_SHARED : ROUTEMARKED_UNSHARED;
push @routemarked_interfaces, $interface;
@@ -1346,7 +1350,7 @@ sub add_a_route( ) {
my $persistent;
if ( $options != '-' ) {
if ( $options ne '-' ) {
for ( split_list1( 'option', $options ) ) {
my ( $option, $value ) = split /=/, $options;
@@ -1764,6 +1768,7 @@ sub map_provider_to_interface() {
sub setup_providers() {
our $providers;
our $pseudoproviders;
if ( $providers ) {
if ( $maxload ) {
@@ -1798,6 +1803,11 @@ sub setup_providers() {
push_indent;
if ( $pseudoproviders ) {
emit '';
emit "start_$providers{$_}->{what}_$_" for @providers;
}
emit "\nundo_routing";
emit "restore_default_route $config{USE_DEFAULT_RT}";

View File

@@ -98,6 +98,8 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
$action = join( ":" , 'LOG', $action );
}
my $usergenerated;
if ( $action eq 'NOTRACK' ) {
#
# A patch that deimplements the NOTRACK target has been posted on the
@@ -204,7 +206,8 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
$action ,
$level || '' ,
$disposition ,
$exception_rule );
$exception_rule ,
$usergenerated && ! $level );
progress_message " Conntrack rule \"$currentline\" $done";
}
@@ -247,6 +250,7 @@ sub handle_helper_rule( $$$$$$$$$$$ ) {
$action_target ,
'',
'CT' ,
'' ,
'' );
} else {
expand_rule( ensure_raw_chain( notrack_chain( $sourceref->{name} ) ) ,
@@ -261,6 +265,7 @@ sub handle_helper_rule( $$$$$$$$$$$ ) {
$action_target ,
'' ,
'CT' ,
'' ,
'' );
}
}

View File

@@ -2264,6 +2264,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
my $matches = $rule;
my $raw_matches = '';
my $exceptionrule = '';
my $usergenerated;
if ( $inchain = defined $chainref ) {
( $inaction, undef, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 4 if $chainref->{action};
@@ -2287,6 +2288,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
fatal_error "Unknown ACTION ($action)" unless $actiontype;
$usergenerated = $actiontype & IPTABLES;
if ( $actiontype == MACRO ) {
#
# process_macro() will call process_rule() recursively for each rule in the macro body
@@ -2333,15 +2336,16 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
$param = $param eq '' ? 'drop' : $param;
fatal_error "Invalid AUDIT type ($param) -- must be 'accept', 'drop' or 'reject'" unless $param =~ /^(?:accept|drop|reject)$/;
$actiontype = STANDARD;
} elsif ( $actiontype & NFLOG ) {
validate_level( $action );
$loglevel = supplied $loglevel ? join( ':', $action, $loglevel ) : $action;
$action = 'LOG';
} elsif ( ! ( $actiontype & (ACTION | INLINE | IPTABLES | TARPIT ) ) ) {
fatal_error "'builtin' actions may only be used in INLINE rules" if $actiontype == USERBUILTIN;
fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq '';
} elsif ( ! $usergenerated ) {
if ( $actiontype & NFLOG ) {
validate_level( $action );
$loglevel = supplied $loglevel ? join( ':', $action, $loglevel ) : $action;
$action = 'LOG';
} elsif ( ! ( $actiontype & (ACTION | INLINE | IPTABLES | TARPIT ) ) ) {
fatal_error "'builtin' actions may only be used in INLINE rules" if $actiontype == USERBUILTIN;
fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq '';
}
}
#
# We can now dispense with the postfix character
#
@@ -2477,13 +2481,21 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
$actiontype |= HELPER;
} elsif ( $actiontype & SET ) {
my %xlate = ( ADD => 'add-set' , DEL => 'del-set' );
my ( $setname, $flags, $timeout, $rest ) = split ':', $param, 4;
my ( $setname, $flags, $rest ) = split ':', $param, 3;
fatal_error "Invalid ADD/DEL parameter ($param)" if $rest;
$setname =~ s/^\+//;
fatal_error "Expected ipset name ($setname)" unless $setname =~ /^(6_)?[a-zA-Z][-\w]*$/;
fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/;
fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/;
$action = join( ' ', 'SET --' . $xlate{$basictarget} , $setname , $flags );
if ( supplied $timeout ) {
fatal_error "A timeout may only be supplied in an ADD rule" unless $basictarget eq 'ADD';
fatal_error "Invalid Timeout ($timeout)" unless $timeout && $timeout =~ /^\d+$/;
$action .= " --timeout $timeout";
}
}
}
#
@@ -2901,7 +2913,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
$action ,
$loglevel ,
$log_action ,
$exceptionrule )
$exceptionrule ,
$usergenerated && ! $loglevel )
unless unreachable_warning( $wildcard || $section == DEFAULTACTION_SECTION, $chainref );
}

View File

@@ -227,6 +227,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
our $designator;
our $ttl = 0;
my $fw = firewall_zone;
my $usergenerated;
sub handle_mark_param( $$ ) {
my ( $option, $marktype ) = @_;
@@ -290,7 +291,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
"$target $option " . join( '/', in_hex( $markval ) , $mask ) ,
'',
$target ,
$exceptionrule );
$exceptionrule ,
'' );
}
$done = 1;
@@ -452,6 +454,16 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
},
},
DROP => {
defaultchain => 0,
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
minparams => 0,
maxparams => 0,
function => sub() {
$target = 'DROP';
}
},
DSCP => {
defaultchain => 0,
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
@@ -524,7 +536,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
my $target_type = $builtin_target{$tgt};
fatal_error "Unknown target ($tgt)" unless $target_type;
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
$target = $params;
$target = $params;
$usergenerated = 1;
},
},
@@ -539,7 +552,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
my $target_type = $builtin_target{$tgt};
fatal_error "Unknown target ($tgt)" unless $target_type;
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
$target = $params;
$target = $params;
$usergenerated = 1;
},
},
@@ -850,7 +864,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
$target,
'' ,
$target ,
$exceptionrule ) )
$exceptionrule ,
$usergenerated ) )
&& $device ) {
#
# expand_rule() returns destination device if any
@@ -3118,6 +3133,7 @@ sub process_secmark_rule1( $$$$$$$$$ ) {
$target ,
'' ,
$disposition,
'' ,
'' );
progress_message "Secmarks rule \"$currentline\" $done";

View File

@@ -1,11 +1,10 @@
#
# Shorewall - Accounting File
# Shorewall -- /etc/shorewall/accounting
#
# For information about entries in this file, type "man shorewall-accounting"
#
# Please see http://shorewall.net/Accounting.html for examples and
# additional information about how to use this file.
#
#################################################################################################################
#ACTION CHAIN SOURCE DESTINATION PROTO DEST SOURCE USER/ MARK IPSEC
# PORT(S) PORT(S) GROUP
#####################################################################################################
#ACTION CHAIN SOURCE DEST PROTO DPORT SPORT USER MARK IPSEC

View File

@@ -1,12 +1,12 @@
#
# Shorewall - Actions File
#
# /etc/shorewall/actions
# Shorewall -- /etc/shorewall/actions
#
# For information about entries in this file, type "man shorewall-actions"
#
# Please see http://shorewall.net/Actions.html for additional information.
#
########################################################################################
#ACTION OPTIONS COMMENT (place '# ' below the 'C' in comment followed by
# v a comment describing the action)
# Place '# ' below the 'C' in COMMENT followed by a comment describing
# the action.
#
###############################################################################
#ACTION OPTIONS COMMENT

View File

@@ -1,8 +1,7 @@
#
# Shorewall - arprules File
# Shorewall -- /etc/shorewall/arprules
#
# For information about entries in this file, type "man shorewall-arprules"
#
##############################################################################################################
#ACTION SOURCE DEST ARP
# OPCODE
###############################################################################
#ACTION SOURCE DEST OPCODE

View File

@@ -1,12 +1,10 @@
#
# Shorewall - Blacklist Rules File
# Shorewall -- /etc/shorewall/blrules
#
# For information about entries in this file, type "man shorewall-blrules"
#
# Please see http://shorewall.net/blacklisting_support.htm for additional
# information.
#
################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
# PORT PORT(S) DEST LIMIT GROUP
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER

View File

@@ -1,7 +1,5 @@
#
# Shorewall - clear File
#
# /etc/shorewall/clear
# Shorewall -- /etc/shorewall/clear
#
# Add commands below that you want to be executed after Shorewall has
# processed the 'clear' command.

View File

@@ -1,12 +1,12 @@
#
# Shorewall - conntrack File
# Shorewall -- /etc/shorewall/conntrack
#
# For information about entries in this file, type "man shorewall-conntrack"
#
##############################################################################################################
?FORMAT 3
#ACTION SOURCE DESTINATION PROTO DEST SOURCE USER/ SWITCH
# PORT(S) PORT(S) GROUP
######################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT USER SWITCH
?if $AUTOHELPERS && __CT_TARGET
?if __AMANDA_HELPER

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Ecn File
# Shorewall -- /etc/shorewall/ecn
#
# For information about entries in this file, type "man shorewall-ecn"
#
@@ -7,4 +7,4 @@
# http://www.shorewall.net/manpages/shorewall-ecn.html
#
###############################################################################
#INTERFACE HOST(S)
#INTERFACE HOSTS

View File

@@ -1,7 +1,5 @@
#
# Shorewall - Findgw File
#
# /etc/shorewall/findgw
# Shorewall -- /etc/shorewall/findgw
#
# The code in this file is executed when Shorewall is trying to detect the
# gateway through an interface in /etc/shorewall/providers that has GATEWAY

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Hosts file
# Shorewall -- /etc/shorewall/hosts
#
# For information about entries in this file, type "man shorewall-hosts"
#
@@ -7,4 +7,4 @@
# http://www.shorewall.net/manpages/shorewall-hosts.html
#
###############################################################################
#ZONE HOST(S) OPTIONS
#ZONE HOSTS OPTIONS

View File

@@ -1,10 +1,8 @@
#
# Shorewall - Init File
# Shorewall -- /etc/shorewall/init
#
# /etc/shorewall/init
#
# Add commands below that you want to be executed at the beginning of
# a "shorewall start", "shorewall-reload" or "shorewall restart" command.
# Add commands below that you want to be executed at the beginning of
# a "shorewall start", "shorewall-reload" or "shorewall restart" command.
#
# For additional information, see
# http://shorewall.net/shorewall_extension_scripts.htm

View File

@@ -1,12 +1,10 @@
#
# Shorewall - Initdone File
# Shorewall -- /etc/shorewall/initdone
#
# /etc/shorewall/initdone
#
# Add commands below that you want to be executed during
# "shorewall start", "shorewall reload" or "shorewall restart" commands
# at the point where Shorewall has not yet added any permanent rules to
# the builtin chains.
# Add commands below that you want to be executed during
# "shorewall start", "shorewall reload" or "shorewall restart" commands
# at the point where Shorewall has not yet added any permanent rules to
# the builtin chains.
#
# For additional information, see
# http://shorewall.net/shorewall_extension_scripts.htm

View File

@@ -1,12 +1,11 @@
#
# Shorewall - Interfaces File
# Shorewall -- /etc/shorewall/interfaces
#
# For information about entries in this file, type "man shorewall-interfaces"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-interfaces.html
#
###############################################################################
?FORMAT 2
###############################################################################
#ZONE INTERFACE OPTIONS

View File

@@ -1,20 +1,19 @@
#
# Shorewall - isusable File
# Shorewall -- /etc/shorewall/isusable
#
# /etc/shorewall/isusable
# This script is called when Shorewall is attempting to determine
# if an interface named in /etc/shorewall/providers is usable.
#
# This script is called when Shorewall is attempting to determine
# if an interface named in /etc/shorewall/providers is usable.
#
# The script is invoked inside a function that accepts an interface
# name as a single argument. The file below is designed to work with
# both swping and lsm as described at
# http://www.shorewall.net/MultiISP.html
# The script is invoked inside a function that accepts an interface
# name as a single argument. The file below is designed to work with
# both swping and lsm as described at
# http://www.shorewall.net/MultiISP.html
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.
#
###############################################################################
local status
status=0

View File

@@ -1,7 +1,5 @@
#
# Shorewall - lib.private File
#
# /etc/shorewall/lib.private
# Shorewall -- /etc/shorewall/lib.private
#
# Use this file to declare shell functions to be called in the other
# run-time extension scripts. The file will be copied into the generated

View File

@@ -1,9 +1,9 @@
#
# Shorewall - Maclist file
# Shorewall -- /etc/shorewall/maclist
#
# For information about entries in this file, type "man shorewall-maclist"
#
# For additional information, see http://shorewall.net/MAC_Validation.html
#
###############################################################################
#DISPOSITION INTERFACE MAC IP ADDRESSES (Optional)
#DISPOSITION INTERFACE MAC ADDRESSES

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Mangle File
# Shorewall -- /etc/shorewall/mangle
#
# For information about entries in this file, type "man shorewall-mangle"
#
@@ -9,6 +9,6 @@
#
# See http://shorewall.net/PacketMarking.html for a detailed description of
# the Netfilter/Shorewall packet marking mechanism.
#
####################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP
# PORT(S) PORT(S)
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Masq file
# Shorewall -- /etc/shorewall/masq
#
# For information about entries in this file, type "man shorewall-masq"
#
@@ -7,5 +7,4 @@
# http://www.shorewall.net/manpages/shorewall-masq.html
#
###################################################################################################################################
#INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL PROBABILITY
# GROUP DEST
#INTERFACE SOURCE ADDRESS PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY

View File

@@ -1,10 +1,9 @@
#
# Shorewall - Nat File
# Shorewall -- /etc/shorewall/nat
#
# For information about entries in this file, type "man shorewall-nat"
#
# For additional information, see http://shorewall.net/NAT.htm
#
###############################################################################
#EXTERNAL INTERFACE INTERNAL ALL LOCAL
# INTERFACES
#EXTERNAL INTERFACE INTERNAL ALLINTS LOCAL

View File

@@ -1,11 +1,10 @@
#
# Shorewall - Netmap File
# Shorewall -- /etc/shorewall/netmap
#
# For information about entries in this file, type "man shorewall-netmap"
#
# See http://shorewall.net/netmap.html for an example and usage
# information.
#
##############################################################################################
#TYPE NET1 INTERFACE NET2 NET3 PROTO DEST SOURCE
# PORT(S) PORT(S)
#############################################################################################
#TYPE NET1 INTERFACE NET2 NET3 PROTO DPORT SPORT

View File

@@ -1,28 +1,24 @@
#
# Shorewall - Params File
# Shorewall -- /etc/shorewall/params
#
# /etc/shorewall/params
# Assign any variables that you need here.
#
# Assign any variables that you need here.
# It is suggested that variable names begin with an upper case letter
# to distinguish them from variables used internally within the
# Shorewall programs
#
# It is suggested that variable names begin with an upper case letter
# to distinguish them from variables used internally within the
# Shorewall programs
# Example:
#
# Example:
# NET_IF=eth0
# NET_BCAST=130.252.100.255
# NET_OPTIONS=routefilter,norfc1918
#
# NET_IF=eth0
# NET_BCAST=130.252.100.255
# NET_OPTIONS=routefilter,norfc1918
# Example (/etc/shorewall/interfaces record):
#
# Example (/etc/shorewall/interfaces record):
# net $NET_IF $NET_BCAST $NET_OPTIONS
#
# net $NET_IF $NET_BCAST $NET_OPTIONS
# The result will be the same as if the record had been written
#
# The result will be the same as if the record had been written
#
# net eth0 130.252.100.255 routefilter,norfc1918
# net eth0 130.252.100.255 routefilter,norfc1918
#
###############################################################################
#LAST LINE -- DO NOT REMOVE

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Policy File
# Shorewall -- /etc/shorewall/policy
#
# For information about entries in this file, type "man shorewall-policy"
#
@@ -7,5 +7,4 @@
# http://www.shorewall.net/manpages/shorewall-policy.html
#
###############################################################################
#SOURCE DEST POLICY LOG LIMIT: CONNLIMIT:
# LEVEL BURST MASK
#SOURCE DEST POLICY LOGLEVEL LIMIT CONNLIMIT

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Providers File
# Shorewall -- /etc/shorewall/providers
#
# For information about entries in this file, type "man shorewall-providers"
#

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Proxyarp File
# Shorewall -- /etc/shorewall/proxyarp
#
# For information about entries in this file, type "man shorewall-proxyarp"
#

View File

@@ -1,7 +1,5 @@
#
# Shorewall - refresh File
#
# /etc/shorewall/refresh
# Shorewall -- /etc/shorewall/refresh
#
# Add commands below that you want to be executed before Shorewall
# has processed the 'refresh' command.

View File

@@ -1,7 +1,5 @@
#
# Shorewall - refreshed File
#
# /etc/shorewall/refreshed
# Shorewall -- /etc/shorewall/refreshed
#
# Add commands below that you want to be executed after Shorewall has
# processed the 'refresh' command.

View File

@@ -1,10 +1,8 @@
#
# Shorewall - Restored File
# Shorewall -- /etc/shorewall/restored
#
# /etc/shorewall/restored
#
# Add commands below that you want to be executed after shorewall has
# completed a 'restore' command.
# Add commands below that you want to be executed after shorewall has
# completed a 'restore' command.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -1,9 +1,9 @@
#
# Shorewall - routes File
# Shorewall -- /etc/shorewall/routes
#
# For information about entries in this file, type "man shorewall-routes"
#
# For additional information, see http://www.shorewall.net/MultiISP.html
#
###############################################################################
#PROVIDER DEST GATEWAY DEVICE OPTIONS

View File

@@ -1,16 +0,0 @@
#
# Shorewall - Routestopped File
#
# This file is deprecated in favor of the stoppedrules file
#
# For information about entries in this file, type "man shorewall-routestopped"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-routestopped.html
#
# See http://shorewall.net/starting_and_stopping_shorewall.htm for additional
# information.
#
###############################################################################
#INTERFACE HOST(S) OPTIONS PROTO DEST SOURCE
# PORT(S) PORT(S)

View File

@@ -1,8 +1,9 @@
#
# Shorewall - route rules File
# Shorewall -- /etc/shorewall/rtrules
#
# For information about entries in this file, type "man shorewall-rtrules"
#
# For additional information, see http://www.shorewall.net/MultiISP.html
#
####################################################################################
#SOURCE DEST PROVIDER PRIORITY MASK

View File

@@ -1,14 +1,14 @@
#
# Shorewall - Rules File
# Shorewall -- /etc/shorewall/rules
#
# For information on the settings in this file, type "man shorewall-rules"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-rules.html
#
######################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT(S) PORT(S) DEST LIMIT GROUP
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
?SECTION ALL
?SECTION ESTABLISHED
?SECTION RELATED

View File

@@ -1,7 +1,5 @@
#
# Shorewall - Show Connections Filter
#
# /etc/shorewall/scfilter
# Shorewall -- /etc/shorewall/scfilter
#
# Replace the 'cat' command below to filter the output of
# 'show connections'.
@@ -10,4 +8,5 @@
# information.
#
###############################################################################
cat -

View File

@@ -1,13 +1,7 @@
#
# Shorewall - Secmarks File
# Shorewall -- /etc/shorewall/secmarks
#
# For information about entries in this file, type "man shorewall-secmarks"
#
############################################################################################################
#SECMARK CHAIN: SOURCE DEST PROTO DEST SOURCE USER/ MARK
# STATE PORT(S) PORT(S) GROUP
############################################################################################
#SECMARK CHAIN SOURCE DEST PROTO DPORT SPORT USER MARK

View File

@@ -1,13 +1,12 @@
#
# Shorewall - Start File
# Shorewall -- /etc/shorewall/start
#
# /etc/shorewall/start
#
# Add commands below that you want to be executed after shorewall has
# been started, reloaded or restarted.
# Add commands below that you want to be executed after shorewall has
# been started, reloaded or restarted.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.
#
###############################################################################
return 0

View File

@@ -1,17 +1,15 @@
#
# Shorewall - Started File
# Shorewall -- /etc/shorewall/started
#
# /etc/shorewall/started
# Add commands below that you want to be executed after shorewall has
# been completely started, reloaded or restarted. The difference between
# this extension script and /etc/shorewall/start is that this one is
# invoked after the 'shorewall' chain has been created (thus
# signaling that the firewall is completely up).
#
# Add commands below that you want to be executed after shorewall has
# been completely started, reloaded or restarted. The difference between
# this extension script and /etc/shorewall/start is that this one is
# invoked after the 'shorewall' chain has been created (thus
# signaling that the firewall is completely up).
#
# This script should not change the firewall configuration directly but
# may do so indirectly by running /sbin/shorewall with the 'nolock'
# option.
# This script should not change the firewall configuration directly but
# may do so indirectly by running /sbin/shorewall with the 'nolock'
# option.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -1,10 +1,8 @@
#
# Shorewall - Stop File
# Shorewall -- /etc/shorewall/stop
#
# /etc/shorewall/stop
#
# Add commands below that you want to be executed at the beginning of a
# "shorewall stop" command.
# Add commands below that you want to be executed at the beginning of a
# "shorewall stop" command.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -1,10 +1,8 @@
#
# Shorewall - Stopped File
# Shorewall -- /etc/shorewall/stopped
#
# /etc/shorewall/stopped
#
# Add commands below that you want to be executed at the completion of a
# "shorewall stop" command.
# Add commands below that you want to be executed at the completion of a
# "shorewall stop" command.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Stopped Rules File
# Shorewall -- /etc/shorewall/stoppedrules
#
# For information about entries in this file, type "man shorewall-stoppedrules"
#
@@ -10,5 +10,4 @@
# information.
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE
# PORT(S) PORT(S)
#ACTION SOURCE DEST PROTO DPORT SPORT

View File

@@ -1,10 +1,9 @@
#
# Shorewall - Tcclasses File
# Shorewall -- /etc/shorewall/tcclasses
#
# For information about entries in this file, type "man shorewall-tcclasses"
#
# See http://shorewall.net/traffic_shaping.htm for additional information.
#
###############################################################################
#INTERFACE:CLASS MARK RATE: CEIL PRIORITY OPTIONS
# DMAX:UMAX
#INTERFACE MARK RATE CEIL PRIO OPTIONS

View File

@@ -1,7 +1,5 @@
#
# Shorewall - tcclear File
#
# /etc/shorewall/tcclear
# Shorewall -- /etc/shorewall/tcclear
#
# Add commands below that you want to be executed before Shorewall clears
# the traffic shaping configuration.

View File

@@ -1,10 +1,9 @@
#
# Shorewall - Tcdevices File
# Shorewall -- /etc/shorewall/tcdevices
#
# For information about entries in this file, type "man shorewall-tcdevices"
#
# See http://shorewall.net/traffic_shaping.htm for additional information.
#
###############################################################################
#NUMBER: IN-BANDWITH OUT-BANDWIDTH OPTIONS REDIRECTED
#INTERFACE INTERFACES
#INTERFACE IN_BANDWITH OUT_BANDWIDTH OPTIONS REDIRECT

View File

@@ -1,10 +1,9 @@
#
# Shorewall - Tcfilters File
# Shorewall -- /etc/shorewall/tcfilters
#
# For information about entries in this file, type "man shorewall-tcfilters"
#
# See http://shorewall.net/traffic_shaping.htm for additional information.
#
########################################################################################################
#INTERFACE: SOURCE DEST PROTO DEST SOURCE TOS LENGTH PRIORITY
#CLASS PORT(S) PORT(S)
######################################################################################
#CLASS SOURCE DEST PROTO DPORT SPORT TOS LENGTH

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Tcinterfaces File
# Shorewall -- /etc/shorewall/tcinterfaces
#
# For information about entries in this file, type "man shorewall-tcinterfaces"
#
@@ -7,4 +7,4 @@
# information.
#
###############################################################################
#INTERFACE TYPE IN-BANDWIDTH OUT-BANDWIDTH
#INTERFACE TYPE IN_BANDWIDTH OUT_BANDWIDTH

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Tcpri File
# Shorewall -- /etc/shorewall/tcpri
#
# For information about entries in this file, type "man shorewall-tcpri"
#
@@ -7,7 +7,4 @@
# information.
#
###############################################################################
#BAND PROTO PORT(S) ADDRESS IN-INTERFACE HELPER
#BAND PROTO PORT ADDRESS INTERFACE HELPER

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Tunnels File
# Shorewall -- /etc/shorewall/tunnels
#
# For information about entries in this file, type "man shorewall-tunnels"
#
@@ -7,5 +7,4 @@
# http://www.shorewall.net/manpages/shorewall-tunnels.html
#
###############################################################################
#TYPE ZONE GATEWAY(S) GATEWAY
# ZONE(S)
#TYPE ZONE GATEWAY GATEWAY_ZONE

View File

@@ -1,5 +1,5 @@
#
# Shorewall - Zones File
# Shorewall -- /etc/shorewall/zones
#
# For information about this file, type "man shorewall-zones"
#
@@ -7,6 +7,6 @@
# http://www.shorewall.net/manpages/shorewall-zones.html
#
###############################################################################
#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
#ZONE TYPE OPTIONS IN_OPTIONS OUT_OPTIONS
fw firewall

View File

@@ -389,7 +389,7 @@ if [ -z "${DESTDIR}" -a $PRODUCT = shorewall -a ! -f ${SHAREDIR}/$PRODUCT/coreve
fi
install_file $PRODUCT ${DESTDIR}${SBINDIR}/$PRODUCT 0755
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SBINDIR}/${PRODUCT}
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/${PRODUCT}
echo "$PRODUCT control program installed in ${DESTDIR}${SBINDIR}/$PRODUCT"
#
@@ -468,16 +468,16 @@ if [ -z "$first_install" ]; then
#
# Delete obsolete config files and manpages
#
delete_file ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/tos
delete_file ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/tcrules
delete_file ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/stoppedrules
delete_file ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/notrack
delete_file ${DESTDIR}/${SHAREDIR}/$PRODUCT/configfiles/blacklist
delete_file ${DESTDIR}/${MANDIR}/man5/$PRODUCT/${PRODUCT}-tos
delete_file ${DESTDIR}/${MANDIR}/man5/$PRODUCT/${PRODUCT}-tcrules
delete_file ${DESTDIR}/${MANDIR}/man5/$PRODUCT/${PRODUCT}-stoppedrules
delete_file ${DESTDIR}/${MANDIR}/man5/$PRODUCT/${PRODUCT}-notrack
delete_file ${DESTDIR}/${MANDIR}/man5/$PRODUCT/${PRODUCT}-blacklist
delete_file ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/tos
delete_file ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/tcrules
delete_file ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/stoppedrules
delete_file ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/notrack
delete_file ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles/blacklist
delete_file ${DESTDIR}${MANDIR}/man5/$PRODUCT/${PRODUCT}-tos
delete_file ${DESTDIR}${MANDIR}/man5/$PRODUCT/${PRODUCT}-tcrules
delete_file ${DESTDIR}${MANDIR}/man5/$PRODUCT/${PRODUCT}-stoppedrules
delete_file ${DESTDIR}${MANDIR}/man5/$PRODUCT/${PRODUCT}-notrack
delete_file ${DESTDIR}${MANDIR}/man5/$PRODUCT/${PRODUCT}-blacklist
fi
#
@@ -1082,7 +1082,7 @@ if [ $PRODUCT = shorewall6 ]; then
# Symbolically link 'functions' to lib.base
#
ln -sf lib.base ${DESTDIR}${SHAREDIR}/$PRODUCT/functions
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/${PRODUCT}/lib.base
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.base
fi
if [ -d Perl ]; then

View File

@@ -31,6 +31,7 @@
#
get_config() {
local prog
local lib
ensure_config_path
@@ -70,15 +71,7 @@ get_config() {
# This block is avoided for compile for export and when the user isn't root
#
if [ "$3" = Yes ]; then
if [ -n "$LOGFILE" ]; then
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
fatal_error "LOGFILE ($LOGFILE) does not exist!"
fi
fi
setup_logread
fi
if [ $g_family -eq 4 ]; then
@@ -322,6 +315,10 @@ get_config() {
fi
g_loopback=$(find_loopback_interfaces)
lib=$(find_file lib.cli-user)
[ -f $lib ] && . $lib
}
#
@@ -1394,6 +1391,7 @@ remote_reload_command() # $* = original arguments less the command.
local sharedir
sharedir=${SHAREDIR}
local litedir
local exitstatus
while [ $finished -eq 0 -a $# -gt 0 ]; do
option=$1
@@ -1510,32 +1508,60 @@ remote_reload_command() # $* = original arguments less the command.
g_file="$g_shorewalldir/firewall"
if compiler $g_debugging compiler "$g_file" && \
progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..." && \
rcp_command "$g_shorewalldir/firewall $g_shorewalldir/firewall.conf" ${litedir}
then
save=$(find_file save);
exitstatus=0
[ -f $save ] && progress_message3 "Copying $save to ${system}:${confdir}/${g_program}-lite/" && rcp_command $save ${confdir}/shorewall-lite/
if compiler $g_debugging compiler "$g_file"; then
progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..."
if rcp_command "$g_shorewalldir/firewall $g_shorewalldir/firewall.conf" ${litedir}; then
save=$(find_file save);
progress_message3 "Copy complete"
if [ -f $save ]; then
progress_message3 "Copying $save to ${system}:${confdir}/${g_program}-lite/"
rcp_command $save ${confdir}/shorewall-lite/
exitstatus=$?
fi
if [ $COMMAND = remote-reload ]; then
rsh_command "${sbindir}/${g_program}-lite $g_debugging $verbose $timestamp reload" && \
progress_message3 "System $system reloaded" || saveit=
elif [ $COMMAND = remote-restart ]; then
rsh_command "${sbindir}/${g_program}-lite $g_debugging $verbose $timestamp restart" && \
progress_message3 "System $system restarted" || saveit=
if [ $exitstatus -eq 0 ]; then
progress_message3 "Copy complete"
if [ $COMMAND = remote-reload ]; then
if rsh_command "${sbindir}/${g_program}-lite $g_debugging $verbose $timestamp reload"; then
progress_message3 "System $system reloaded"
else
exitstatus=$?
savit=
fi
elif [ $COMMAND = remote-restart ]; then
if rsh_command "${sbindir}/${g_program}-lite $g_debugging $verbose $timestamp restart"; then
progress_message3 "System $system restarted"
else
exitstatus=$?
saveit=
fi
elif rsh_command "${sbindir}/${g_program}-lite $g_debugging $verbose $timestamp start"; then
progress_message3 "System $system started"
else
exitstatus=$?
saveit=
fi
if [ -n "$saveit" ]; then
if rsh_command "${sbindir}/${g_program}-lite $g_debugging $verbose $timestamp save"; then
progress_message3 "Configuration on system $system saved"
else
exitstatus=$?
fi
fi
fi
else
rsh_command "${sbindir}/${g_program}-lite $g_debugging $verbose $timestamp start" && \
progress_message3 "System $system started" || saveit=
fi
if [ -n "$saveit" ]; then
rsh_command "${sbindir}/${g_program}-lite $g_debugging $verbose $timestamp save" && \
progress_message3 "Configuration on system $system saved"
exitstatus=$?
fi
else
exitstatus=$?
fi
return $exitstatus
}
#
@@ -1645,7 +1671,7 @@ compiler_command() {
shift
update_command $@
;;
remote-start|remote-reload-reload|remote-restart)
remote-start|remote-reload|remote-restart)
shift
remote_reload_command $@
;;

View File

@@ -403,13 +403,15 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DESTINATION</emphasis> (dest) - {<emphasis
<term><emphasis role="bold">DEST</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis
role="bold">any</emphasis>|<emphasis
role="bold">all</emphasis>|<emphasis>interface</emphasis>|<emphasis>interface</emphasis><emphasis
role="bold">:</emphasis><emphasis>address</emphasis>|<emphasis>address</emphasis>}</term>
<listitem>
<para>This column was formerly named DESTINATION.</para>
<para>Packet Destination.</para>
<para>Format same as <emphasis role="bold">SOURCE</emphasis>
@@ -418,7 +420,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">PROTOCOL (proto)</emphasis> - {<emphasis
<term><emphasis role="bold">PROTO</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis
role="bold">{any</emphasis>|<emphasis
role="bold">all</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis
@@ -428,6 +430,8 @@
role="bold">all</emphasis>}]}[,...]}</term>
<listitem>
<para>This column was formerly named PROTOCOL</para>
<para>A <emphasis>protocol-name</emphasis> (from protocols(5)), a
<emphasis>protocol-number</emphasis>, <emphasis
role="bold">ipp2p</emphasis>, <emphasis
@@ -440,8 +444,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DEST PORT(S)</emphasis> (dport) -
{<emphasis role="bold">-</emphasis>|<emphasis
<term><emphasis role="bold">DPORT</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis
role="bold">any</emphasis>|<emphasis
role="bold">all</emphasis>|<emphasis>ipp2p-option</emphasis>|<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...}</term>
@@ -460,12 +464,14 @@
("iptables -m ipp2p --help") without the leading "--". If no option
is given in this column, <emphasis role="bold">ipp2p</emphasis> is
assumed.</para>
<para>This column was formerly named DEST PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SOURCE PORT(S)</emphasis> (sport)-
{<emphasis role="bold">-</emphasis>|<emphasis
<term><emphasis role="bold">SPORT</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis
role="bold">any</emphasis>|<emphasis
role="bold">all</emphasis>|<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...}</term>
@@ -482,20 +488,22 @@
column, provided that the DEST PORT(S) 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
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
and kernel.</para>
DPORT. Use of '=' requires multi-port match in your iptables and
kernel.</para>
<para>This column was formerly labelled SOURCE PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">USER/GROUP</emphasis> (user) - [<emphasis
<term><emphasis role="bold">USER</emphasis> - [<emphasis
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
<listitem>
<para>This column may only be non-empty if the <emphasis
role="bold">CHAIN</emphasis> is <emphasis
<para>This column was formerly named USER/GROUP and may only be
non-empty if the <emphasis role="bold">CHAIN</emphasis> is <emphasis
role="bold">OUTPUT</emphasis>.</para>
<para>When this column is non-empty, the rule applies only if the

View File

@@ -273,7 +273,7 @@
</varlistentry>
<varlistentry>
<term>ARP OPCODE - [[!]<replaceable>opcode</replaceable>]</term>
<term>OPCODE - [[!]<replaceable>opcode</replaceable>]</term>
<listitem>
<para>Optional. Describes the type of frame. Possible

View File

@@ -424,7 +424,7 @@
</varlistentry>
<varlistentry>
<term>DEST PORT(S) (dport) - port-number/service-name-list</term>
<term>DPORT - port-number/service-name-list</term>
<listitem>
<para>A comma-separated list of port numbers and/or service names
@@ -432,11 +432,13 @@
ranges of the form
<replaceable>low-port</replaceable>:<replaceable>high-port</replaceable>
if your kernel and iptables include port range support.</para>
<para>This column was formerly labelled DEST PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>SOURCE PORT(S) (sport) - port-number/service-name-list</term>
<term>SPORT - port-number/service-name-list</term>
<listitem>
<para>A comma-separated list of port numbers and/or service names
@@ -446,22 +448,24 @@
if your kernel and iptables include port range support.</para>
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
column, provided that the DEST PORT(S) 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
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
and kernel.</para>
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.</para>
<para>This column was formerly labelled SOURCE PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>USER/GROUP (user)
<term>USER
[<replaceable>user</replaceable>][:<replaceable>group</replaceable>]</term>
<listitem>
<para>May only be specified if the SOURCE
<replaceable>zone</replaceable> is $FW. Specifies the effective user
id and or group id of the process sending the traffic.</para>
<para>This column was formerly named USER/GROUP and may only be
specified if the SOURCE <replaceable>zone</replaceable> is $FW.
Specifies the effective user id and or group id of the process
sending the traffic.</para>
</listitem>
</varlistentry>
@@ -520,8 +524,7 @@
<para>Example 1:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST SOURCE USER/GROUP
# PORT(S) PORT(S)
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
<para>Example 2 (Shorewall 4.5.10 or later):</para>
@@ -529,14 +532,12 @@ CT:helper:ftp(expevents=new) fw - tcp
<para>Drop traffic to/from all zones to IP address 1.2.3.4</para>
<programlisting>FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE USER/GROUP
# PORT(S) PORT(S)
#ACTION SOURCE DEST PROTO DPORT SPORT USER
DROP all-:1.2.3.4 -
DROP all 1.2.3.4</programlisting>
<para>or<programlisting>FORMAT 3
#ACTION SOURCE DEST PROTO DEST SOURCE USER/GROUP
# PORT(S) PORT(S)
#ACTION SOURCE DEST PROTO DPORT SPORT USER
DROP:P 1.2.3.4 -
DROP:PO - 1.2.3.4
</programlisting></para>

View File

@@ -76,8 +76,7 @@ z2 net REJECT</programlisting>
<para>/etc/shorewall/rules:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST
# PORT(S)
<programlisting>#ACTION SOURCE DEST PROTO DPORT
ACCEPT all!z2 net tcp 22</programlisting>
<para>In this case, SSH connections from <emphasis

View File

@@ -57,7 +57,7 @@
<option>dst</option>. Example: myset[src,dst].</member>
</simplelist>
<para>In a SOURCE or SOURCE PORT(S) column, the following pairs are
<para>In a SOURCE or SPORT column, the following pairs are
equivalent:</para>
<itemizedlist>
@@ -66,7 +66,7 @@
</listitem>
</itemizedlist>
<para>In a DEST or DEST PORT(S) column, the following pairs are
<para>In a DEST or DPORT column, the following pairs are
equivalent:</para>
<itemizedlist>

View File

@@ -570,8 +570,7 @@ INLINE eth0 - ; -p tcp -j MARK --set
that problem. SAME may be used in the PREROUTING and OUTPUT
chains. When used in PREROUTING, it causes matching
connections from an individual local system to all use the
same provider. For example: <programlisting>#ACTION SOURCE DEST PROTO DEST
# PORT(S)
same provider. For example: <programlisting>#ACTION SOURCE DEST PROTO DPORT
SAME:P 192.168.1.0/24 0.0.0.0/0 tcp 80,443</programlisting>
If a host in 192.168.1.0/24 attempts a connection on TCP port
80 or 443 and it has sent a packet on either of those ports in
@@ -581,8 +580,7 @@ SAME:P 192.168.1.0/24 0.0.0.0/0 tcp 80,443</programlisting>
<para>When used in the OUTPUT chain, it causes all matching
connections to an individual remote system to all use the same
provider. For example:<programlisting>#ACTION SOURCE DEST PROTO DEST
# PORT(S)
provider. For example:<programlisting>#ACTION SOURCE DEST PROTO DPORT
SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>The
optional <replaceable>timeout</replaceable> parameter was
added in Shorewall 4.6.7 and specifies a number of seconds .
@@ -835,7 +833,7 @@ Normal-Service =&gt; 0x00</programlisting>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">PORT(S)</emphasis> (dport) - {<emphasis
<term><emphasis role="bold">DPORT</emphasis>- {<emphasis
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
@@ -863,12 +861,13 @@ Normal-Service =&gt; 0x00</programlisting>
<replaceable>ipset</replaceable> name can be specified in this
column. This is intended to be used with
<firstterm>bitmap:port</firstterm> ipsets.</para>
<para>This column was formerly named DEST PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SOURCE PORT(S)</emphasis> (sport) -
{<emphasis
<term><emphasis role="bold">SPORT</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
@@ -882,16 +881,17 @@ Normal-Service =&gt; 0x00</programlisting>
the following fields is supplied.</para>
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
column, provided that the DEST PORT(S) 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
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
and kernel.</para>
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 DEST PORTS(S). Use of
'=' requires multi-port match in your iptables and kernel.</para>
<para>Beginning with Shorewall 4.6.0, an
<replaceable>ipset</replaceable> name can be specified in this
column. This is intended to be used with
<firstterm>bitmap:port</firstterm> ipsets.</para>
<para>This column was formerly labelled SOURCE PORT(S).</para>
</listitem>
</varlistentry>
@@ -1097,8 +1097,7 @@ Normal-Service =&gt; 0x00</programlisting>
by the named helper module.</para>
<para>Example: Mark all FTP data connections with mark
4:<programlisting>#ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST LENGTH TOS CONNBYTES HELPER
# PORT(S)
4:<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST LENGTH TOS CONNBYTES HELPER
4:T 0.0.0.0/0 0.0.0.0/0 TCP - - - - - - - ftp</programlisting></para>
</listitem>
</varlistentry>
@@ -1287,8 +1286,7 @@ Normal-Service =&gt; 0x00</programlisting>
<para>We assume packet/connection mark 0 means unclassified.</para>
<programlisting> #ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
# PORT(S)
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
MARK(1):T 0.0.0.0/0 0.0.0.0/0 icmp echo-request
MARK(1):T 0.0.0.0/0 0.0.0.0/0 icmp echo-reply
RESTORE:T 0.0.0.0/0 0.0.0.0/0 all - - - 0
@@ -1313,8 +1311,7 @@ Normal-Service =&gt; 0x00</programlisting>
<programlisting>/etc/shorewall/tcrules:
#ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
# PORT(S)
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW
/etc/shorewall/masq:

View File

@@ -249,7 +249,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">PORT(S)</emphasis> (Optional) -
<term><emphasis role="bold">PORT</emphasis> (Optional) -
{-|[!]<emphasis>port-name-or-number</emphasis>[,<emphasis>port-name-or-number</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
<listitem>
@@ -429,13 +429,14 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">USER/GROUP</emphasis> (Optional) -
[<emphasis
<term><emphasis role="bold">USER</emphasis> (Optional) - [<emphasis
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][<emphasis
role="bold">+</emphasis><emphasis>program-name</emphasis>]</term>
<listitem>
<para>This column was formerly labelled USER/GROUP.</para>
<para>Only locally-generated connections will match if this column
is non-empty.</para>
@@ -538,8 +539,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ORIGINAL DEST</emphasis> (origdest) -
[<emphasis
<term><emphasis role="bold">ORIGDEST</emphasis> - [<emphasis
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...[<emphasis>exclusion</emphasis>]|<emphasis>exclusion</emphasis>]</term>
<listitem>
@@ -550,6 +550,8 @@
original destination address matches one of the listed addresses. It
is useful for specifying that SNAT should occur only for connections
that were acted on by a DNAT when they entered the firewall.</para>
<para>This column was formerly labelled ORIGINAL DEST.</para>
</listitem>
</varlistentry>
@@ -639,7 +641,7 @@
172.20.1.0/29 to be sent from eth0 with source IP address
206.124.146.176.</para>
<programlisting> #INTERFACE SOURCE ADDRESS PROTO PORT(S)
<programlisting> #INTERFACE SOURCE ADDRESS PROTO DPORT
eth0 172.20.1.0/29 206.124.146.177 tcp smtp
eth0 172.20.1.0/29 206.124.146.176</programlisting>
@@ -672,8 +674,7 @@
<programlisting>/etc/shorewall/tcrules:
#ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
# PORT(S)
#ACTION SOURCE DEST PROTO DPORT SPORT USER TEST
1-3:CF 192.168.1.0/24 eth0 ; state=NEW
/etc/shorewall/masq:

View File

@@ -106,15 +106,16 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ALL INTERFACES</emphasis> (allints) -
[<emphasis role="bold">Yes</emphasis>|<emphasis
role="bold">No</emphasis>]</term>
<term><emphasis role="bold">ALLINTS</emphasis> - [<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
<listitem>
<para>If Yes or yes, NAT will be effective from all hosts. If No or
no (or left empty) then NAT will be effective only through the
interface named in the <emphasis role="bold">INTERFACE</emphasis>
column.</para>
<para>This column was formerly labelled ALL INTERFACES.</para>
</listitem>
</varlistentry>
@@ -160,8 +161,7 @@ smc eth0:10.1.10.0/24</programlisting>
<para><filename>/etc/shorewall/nat</filename>:</para>
<programlisting>#EXTERNAL INTERFACE INTERNAL ALL LOCAL
# INTERFACES
<programlisting>#EXTERNAL INTERFACE INTERNAL ALLINTS LOCAL
10.1.10.100 eth0 172.20.1.100
</programlisting>
@@ -170,8 +170,7 @@ smc eth0:10.1.10.0/24</programlisting>
<para><filename>/etc/shorewall/rules</filename>:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT PORT(S) DEST LIMIT GROUP
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
?SECTION ALL
?SECTION ESTABLISHED
?SECTION RELATED

View File

@@ -82,7 +82,7 @@
<para>Partial <filename>/etc/shorewall/rules</filename>:</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST PORT(S)
<programlisting> #ACTION SOURCE DEST PROTO DPORT
...
DNAT sam loc:192.168.1.3 tcp ssh
DNAT net loc:192.168.1.5 tcp www
@@ -100,7 +100,7 @@
Because of the way that Netfilter is constructed, this requires two rules
as follows:</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST PORT(S)
<programlisting> #ACTION SOURCE DEST PROTO DPORT
...
ACCEPT+ sam $FW tcp ssh
DNAT net loc:192.168.1.3 tcp ssh
@@ -143,8 +143,7 @@
</itemizedlist>
<para>As a consequence, the following rules will have unexpected
behavior:<programlisting> #ACTION SOURCE DEST PROTO DEST
# PORT(S)
behavior:<programlisting> #ACTION SOURCE DEST PROTO DPORT
ACCEPT net dmz tcp 80
REDIRECT loc 3128 tcp 80</programlisting></para>
@@ -173,8 +172,7 @@
<para>When using other Shorewall versions, another way is to rewrite the
DNAT rule (assume that the local zone is entirely within
192.168.2.0/23):<programlisting> #ACTION SOURCE DEST PROTO DEST
# PORT(S)
192.168.2.0/23):<programlisting> #ACTION SOURCE DEST PROTO DPORT
ACCEPT net dmz tcp 80
REDIRECT loc:192.168.2.0/23 3128 tcp 80</programlisting></para>

View File

@@ -137,7 +137,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DEST PORT(S) (dport)</emphasis> -
<term><emphasis role="bold">DPORT</emphasis> -
<emphasis>port-number-or-name-list</emphasis></term>
<listitem>
@@ -160,11 +160,13 @@
<para>An entry in this field requires that the PROTO column specify
icmp (1), tcp (6), udp (17), sctp (132) or udplite (136). Use '-' if
any of the following field is supplied.</para>
<para>This column was formerly labelled DEST PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SOURCE PORT(S) (sport)</emphasis> -
<term><emphasis role="bold">SPORT</emphasis> -
<emphasis>port-number-or-name-list</emphasis></term>
<listitem>
@@ -176,6 +178,8 @@
<para>An entry in this field requires that the PROTO column specify
tcp (6), udp (17), sctp (132) or udplite (136). Use '-' if any of
the following fields is supplied.</para>
<para>This column was formerly labelled SOURCE PORT(S).</para>
</listitem>
</varlistentry>
</variablelist>

View File

@@ -1,237 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<refentry>
<refmeta>
<refentrytitle>shorewall-routestopped</refentrytitle>
<manvolnum>5</manvolnum>
<refmiscinfo>Configuration Files</refmiscinfo>
</refmeta>
<refnamediv>
<refname>routestopped</refname>
<refpurpose>The Shorewall file that governs what traffic flows through the
firewall while it is in the 'stopped' state.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>/etc/shorewall/routestopped</command>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>This file is deprecated in favor of the <ulink
url="/manpages/shorewall-stoppedrules.html">shorewall-stoppedrules</ulink>(5)
file.</para>
<para>This file is used to define the hosts that are accessible when the
firewall is stopped or is being stopped.</para>
<warning>
<para>Changes to this file do not take effect until after the next
<command>shorewall start</command> or <command>shorewall
restart</command> command.</para>
</warning>
<para>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).</para>
<variablelist>
<varlistentry>
<term><emphasis role="bold">INTERFACE</emphasis> -
<emphasis>interface</emphasis></term>
<listitem>
<para>Interface through which host(s) communicate with the
firewall</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">HOST(S)</emphasis> (hosts) - [<emphasis
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...]</term>
<listitem>
<para>Optional. Comma-separated list of IP/subnet addresses. If your
kernel and iptables include iprange match support, IP address ranges
are also allowed.</para>
<para>If left empty or supplied as "-", 0.0.0.0/0 is assumed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">OPTIONS</emphasis> - [<emphasis
role="bold">-</emphasis>|<emphasis>option</emphasis>[<emphasis
role="bold">,</emphasis><emphasis>option</emphasis>]...]</term>
<listitem>
<para>Optional. A comma-separated list of options. The order of the
options is not important but the list can contain no embedded
white-space. The currently-supported options are:</para>
<variablelist>
<varlistentry>
<term><emphasis role="bold">routeback</emphasis></term>
<listitem>
<para>Set up a rule to ACCEPT traffic from these hosts back to
themselves. Beginning with Shorewall 4.4.9, this option is
automatically set if <emphasis
role="bold">routeback</emphasis> is specified in <ulink
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>
(5) or if the rules compiler detects that the interface is a
bridge.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">source</emphasis></term>
<listitem>
<para>Allow traffic from these hosts to ANY destination.
Without this option or the <emphasis
role="bold">dest</emphasis> option, only traffic from this
host to other listed hosts (and the firewall) is allowed. If
<emphasis role="bold">source</emphasis> is specified then
<emphasis role="bold">routeback</emphasis> is
redundant.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">dest</emphasis></term>
<listitem>
<para>Allow traffic to these hosts from ANY source. Without
this option or the <emphasis role="bold">source</emphasis>
option, only traffic from this host to other listed hosts (and
the firewall) is allowed. If <emphasis
role="bold">dest</emphasis> is specified then <emphasis
role="bold">routeback</emphasis> is redundant.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">notrack</emphasis></term>
<listitem>
<para>The traffic will be exempted from connection
tracking.</para>
</listitem>
</varlistentry>
</variablelist>
<note>
<para>The <emphasis role="bold">source</emphasis> and <emphasis
role="bold">dest</emphasis> options work best when used in
conjunction with ADMINISABSENTMINDED=Yes in <ulink
url="shorewall6.conf.html">shorewall6.conf</ulink>(5).</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term>PROTO (Optional)
<replaceable>protocol-name-or-number</replaceable></term>
<listitem>
<para>Protocol.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DEST PORT(S) (dport)
<replaceable>service-name/port-number-list</replaceable></term>
<listitem>
<para>Optional. A comma-separated list of port numbers and/or
service names from <filename>/etc/services</filename>. May also
include port ranges of the form
<replaceable>low-port</replaceable>:<replaceable>high-port</replaceable>
if your kernel and iptables include port range support.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>SOURCE PORT(S) (sport)
<replaceable>service-name/port-number-list</replaceable></term>
<listitem>
<para>Optional. A comma-separated list of port numbers and/or
service names from <filename>/etc/services</filename>. May also
include port ranges of the form
<replaceable>low-port</replaceable>:<replaceable>high-port</replaceable>
if your kernel and iptables include port range support.</para>
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
column, provided that the DEST PORT(S) 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
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
and kernel.</para>
</listitem>
</varlistentry>
</variablelist>
<note>
<para>The <emphasis role="bold">source</emphasis> and <emphasis
role="bold">dest</emphasis> options work best when used in conjunction
with ADMINISABSENTMINDED=Yes in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para>
</note>
</refsect1>
<refsect1>
<title>Example</title>
<variablelist>
<varlistentry>
<term>Example 1:</term>
<listitem>
<programlisting> #INTERFACE HOST(S) OPTIONS PROTO DEST SOURCE
# PORT(S) PORT(S)
eth2 192.168.1.0/24
eth0 192.0.2.44
br0 - routeback
eth3 - source
eth4 - notrack 41</programlisting>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>FILES</title>
<para>/etc/shorewall/routestopped</para>
</refsect1>
<refsect1>
<title>See ALSO</title>
<para><ulink
url="/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink></para>
<para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-ipsets(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-rtrules(5), shorewall-rules(5), shorewall.conf(5),
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1>
</refentry>

View File

@@ -173,9 +173,9 @@
<listitem>
<para>The remaining columns specify characteristics of the packet
before rewriting. In particular, the ORIGINAL DEST column gives the
original destination IP address of the packet and the DEST PORT(S)
column give the original destination port(s).</para>
before rewriting. In particular, the ORIGDEST column gives the
original destination IP address of the packet and the DPORT column
give the original destination port(s).</para>
</listitem>
</itemizedlist>
@@ -241,7 +241,7 @@
<varlistentry>
<term><emphasis
role="bold">ADD(<replaceable>ipset</replaceable>:<replaceable>flags</replaceable>)</emphasis></term>
role="bold">ADD(<replaceable>ipset</replaceable>:<replaceable>flags</replaceable>[:<replaceable>timeout</replaceable>])</emphasis></term>
<listitem>
<para>Added in Shorewall 4.4.12. Causes addresses and/or port
@@ -256,6 +256,12 @@
role="bold">dst</emphasis> respectively (see the -A command in
ipset (8)).</para>
<para>Beginning with Shorewall 5.0.3, an optional
<replaceable>timeout</replaceable> can be specified. This is
the number of seconds that the new entry in the ipset is to
remain valid and overrides any timeout specified when the
ipset was created.</para>
<para>ADD is non-terminating. Even if a packet matches the
rule, it is passed on to the next rule.</para>
</listitem>
@@ -1201,8 +1207,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DEST PORT(S) (dport)</emphasis> -
{<emphasis
<term><emphasis role="bold">DPORT</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
@@ -1234,7 +1239,7 @@
<para>If your kernel contains multi-port match support, then only a
single Netfilter rule will be generated if in this list and the
<emphasis role="bold">CLIENT PORT(S)</emphasis> list below:</para>
<emphasis role="bold">SPORT</emphasis> list below:</para>
<para>1. There are 15 or less ports listed.</para>
@@ -1245,12 +1250,13 @@
<replaceable>ipset</replaceable> name can be specified in this
column. This is intended to be used with
<firstterm>bitmap:port</firstterm> ipsets.</para>
<para>This column was formerly labelled DEST PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SOURCE PORT(S)</emphasis> (sport) -
{<emphasis
<term><emphasis role="bold">SPORT</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...|+<replaceable>ipset</replaceable>}</term>
@@ -1260,11 +1266,10 @@
names, port numbers or port ranges.</para>
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
column, provided that the DEST PORT(S) 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
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
and kernel.</para>
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 DEST PORTS(S). Use of
'=' requires multi-port match in your iptables and kernel.</para>
<warning>
<para>Unless you really understand IP, you should leave this
@@ -1274,12 +1279,12 @@
</warning>
<para>If you don't want to restrict client ports but need to specify
an <emphasis role="bold">ORIGINAL DEST</emphasis> in the next
column, then place "-" in this column.</para>
an <emphasis role="bold">ORIGDEST</emphasis> in the next column,
then place "-" in this column.</para>
<para>If your kernel contains multi-port match support, then only a
single Netfilter rule will be generated if in this list and the
<emphasis role="bold">DEST PORT(S)</emphasis> list above:</para>
<emphasis role="bold">DPORT</emphasis> list above:</para>
<para>1. There are 15 or less ports listed.</para>
@@ -1290,12 +1295,13 @@
<replaceable>ipset</replaceable> name can be specified in this
column. This is intended to be used with
<firstterm>bitmap:port</firstterm> ipsets.</para>
<para>This column was formerly labelled SOURCE PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ORIGINAL DEST</emphasis> (origdest) -
[<emphasis
<term><emphasis role="bold">ORIGDEST</emphasis> - [<emphasis
role="bold">-</emphasis>|<emphasis>address</emphasis>[,<emphasis>address</emphasis>]...[<emphasis>exclusion</emphasis>]|<emphasis>exclusion</emphasis>]</term>
<listitem>
@@ -1344,11 +1350,13 @@
url="/PortKnocking.html">http://www.shorewall.net/PortKnocking.html</ulink>
for an example of using an entry in this column with a user-defined
action rule.</para>
<para>This column was formerly labelled ORIGINAL DEST.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">RATE LIMIT</emphasis> (rate) -
<term><emphasis role="bold">RATE</emphasis> -
<replaceable>limit</replaceable></term>
<listitem>
@@ -1413,11 +1421,13 @@
enforce the per-source limit and the compiler will pick a unique
name for the hash table that tracks the per-destination
limit.</para>
<para>This column was formerly labelled RATE LIMIT.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">USER/GROUP</emphasis> (user) - [<emphasis
<term><emphasis role="bold">USER</emphasis> - [<emphasis
role="bold">!</emphasis>][<emphasis>user-name-or-number</emphasis>][<emphasis
role="bold">:</emphasis><emphasis>group-name-or-number</emphasis>][,...]</term>
@@ -1471,6 +1481,8 @@
</listitem>
</varlistentry>
</variablelist>
<para>This column was formerly labelled USER/GROUP.</para>
</listitem>
</varlistentry>
@@ -1626,6 +1638,8 @@
<listitem>
<para>where <replaceable>dd</replaceable> is an ordinal day of
the month</para>
<para/>
</listitem>
</varlistentry>
@@ -1767,9 +1781,8 @@
<listitem>
<para>Accept SMTP requests from the DMZ to the internet</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
# PORT PORT(S) DEST
ACCEPT dmz net tcp smtp</programlisting>
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
ACCEPT dmz net tcp smtp</programlisting>
</listitem>
</varlistentry>
@@ -1780,8 +1793,7 @@
<para>Forward all ssh and http connection requests from the internet
to local system 192.168.1.3</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
# PORT PORT(S) DEST
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
DNAT net loc:192.168.1.3 tcp ssh,http</programlisting>
</listitem>
</varlistentry>
@@ -1792,9 +1804,8 @@
<listitem>
<para>Forward all http connection requests from the internet to
local system 192.168.1.3 with a limit of 3 per second and a maximum
burst of 10<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE
# PORT PORT(S) DEST LIMIT
DNAT net loc:192.168.1.3 tcp http - - 3/sec:10</programlisting></para>
burst of 10<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE
DNAT net loc:192.168.1.3 tcp http - - 3/sec:10</programlisting></para>
</listitem>
</varlistentry>
@@ -1806,8 +1817,7 @@
port 3128 on the firewall (Squid running on the firewall system)
except when the destination address is 192.168.2.2</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
# PORT PORT(S) DEST
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
REDIRECT loc 3128 tcp www - !192.168.2.2</programlisting>
</listitem>
</varlistentry>
@@ -1819,8 +1829,7 @@
<para>All http requests from the internet to address 130.252.100.69
are to be forwarded to 192.168.1.3</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
# PORT PORT(S) DEST
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
DNAT net loc:192.168.1.3 tcp 80 - 130.252.100.69</programlisting>
</listitem>
</varlistentry>
@@ -1832,10 +1841,9 @@
<para>You want to accept SSH connections to your firewall only from
internet IP addresses 130.252.100.69 and 130.252.100.70</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
# PORT PORT(S) DEST
ACCEPT net:130.252.100.69,130.252.100.70 $FW \
tcp 22</programlisting>
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
ACCEPT net:130.252.100.69,130.252.100.70 \
$FW tcp 22</programlisting>
</listitem>
</varlistentry>
@@ -1847,8 +1855,7 @@
firewall on port 2222 and you want to forward them to local system
192.168.1.3, port 22</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
# PORT PORT(S) DEST
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
DNAT net loc:192.168.1.3:22 tcp 2222</programlisting>
</listitem>
</varlistentry>
@@ -1860,8 +1867,7 @@
<para>You want to redirect connection requests to port 80 randomly
to the port range 81-90.</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL
# PORT PORT(S) DEST
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
REDIRECT net $FW::81-90:random tcp www</programlisting>
</listitem>
</varlistentry>
@@ -1897,8 +1903,7 @@
<para>rules:</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST
# PORT(S)
<programlisting> #ACTION SOURCE DEST PROTO DPORT
REDIRECT loc 3128 tcp 80 </programlisting>
<simpara>Note that it would have been tempting to simply define the
@@ -1926,8 +1931,7 @@
<para>Add the tuple (source IP, dest port, dest IP) of an incoming
SSH connection to the ipset S:</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST
# PORT(S)
<programlisting> #ACTION SOURCE DEST PROTO DPORT
ADD(+S:dst,src,dst) net fw tcp 22</programlisting>
</listitem>
</varlistentry>
@@ -1939,8 +1943,7 @@
<para>You wish to limit SSH connections from remote systems to 1/min
with a burst of three (to allow for limited retry):</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE
# PORT(S) PORT(S) DEST LIMIT
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE
SSH(ACCEPT) net all - - - - s:1/min:3</programlisting>
</listitem>
</varlistentry>
@@ -1952,8 +1955,7 @@
<para>Forward port 80 to dmz host $BACKUP if switch 'primary_down'
is on.</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
# PORT(S) PORT(S) DEST LIMIT GROUP
<programlisting> #ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH
DNAT net dmz:$BACKUP tcp 80 - - - - - - - - primary_down</programlisting>
</listitem>
</varlistentry>
@@ -1965,8 +1967,7 @@
<para>Drop all email from the <emphasis>Anonymous Proxy</emphasis>
and <emphasis>Satellite Provider</emphasis> address ranges:</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST
# PORT(S)
<programlisting> #ACTION SOURCE DEST PROTO DPORT
DROP net:^A1,A2 fw tcp 25</programlisting>
</listitem>
</varlistentry>
@@ -1978,8 +1979,7 @@
<para>You want to generate your own rule involving iptables targets
and matches not supported by Shorewall.</para>
<programlisting> #ACTION SOURCE DEST PROTO DEST
# PORT(S)
<programlisting> #ACTION SOURCE DEST PROTO DPORT
INLINE $FW net ; -p 6 -m mickey-mouse --name test -m set --match-set set1 src -m mickey-mouse --name test2 -j SECCTX --name test3</programlisting>
<para>The above will generate the following iptables-restore

View File

@@ -93,7 +93,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">CHAIN:STATE (chain) -
<term><emphasis role="bold">CHAIN -
{P|I|F|O|T}[:{N|I|U|IU|NI|NU|NIU|NUI:E|ER}]</emphasis></term>
<listitem>
@@ -140,6 +140,8 @@
<member>:NIU - NEW, INVALID or UNTRACKED connection.</member>
</simplelist>
<para>This column was formerly labelled CHAIN:STATE.</para>
</listitem>
</varlistentry>
</variablelist>
@@ -236,7 +238,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">PORT(S)</emphasis> (dport) - [<emphasis
<term><emphasis role="bold">DPORT</emphasis> - [<emphasis
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...]</term>
@@ -259,12 +261,13 @@
<para>This column is ignored if PROTOCOL = all but must be entered
if any of the following field is supplied. In that case, it is
suggested that this field contain "-"</para>
<para>This column was formerly labelled DEST PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SOURCE PORT(S)</emphasis> (sport) -
[<emphasis
<term><emphasis role="bold">SPORT</emphasis> - [<emphasis
role="bold">-</emphasis>|<emphasis>port-name-number-or-range</emphasis>[<emphasis
role="bold">,</emphasis><emphasis>port-name-number-or-range</emphasis>]...]</term>
@@ -272,6 +275,8 @@
<para>Optional source port(s). If omitted, any source port is
acceptable. Specified as a comma-separated list of port names, port
numbers or port ranges.</para>
<para>This column was formerly labelled SOURCE PORT(S).</para>
</listitem>
</varlistentry>
@@ -388,8 +393,7 @@
<para><filename>/etc/shorewall/secmarks</filename>:</para>
<programlisting>#SECMARK CHAIN: SOURCE DEST PROTO DEST SOURCE USER/ MARK
# STATE PORT(S) PORT(S) GROUP
<programlisting>#SECMARK CHAIN SOURCE DEST PROTO DPORT SPORT USER MARK
system_u:object_r:mysqld_packet_t:s0 I:N lo 127.0.0.1 tcp 3306
SAVE I:N lo 127.0.0.1 tcp 3306
RESTORE I:ER</programlisting>

View File

@@ -112,7 +112,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DEST PORT(S) (dport)</emphasis>
<term><emphasis role="bold">DPORT</emphasis>
<replaceable>service-name/port-number-list</replaceable></term>
<listitem>
@@ -121,11 +121,13 @@
include port ranges of the form
<replaceable>low-port</replaceable>:<replaceable>high-port</replaceable>
if your kernel and iptables include port range support.</para>
<para>This column was formerly labelled DEST PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SOURCE PORT(S) (sport)</emphasis>
<term><emphasis role="bold">SPORT</emphasis>
<replaceable>service-name/port-number-list</replaceable></term>
<listitem>
@@ -136,11 +138,12 @@
if your kernel and iptables include port range support.</para>
<para>Beginning with Shorewall 4.5.15, you may place '=' in this
column, provided that the DEST PORT(S) 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
DEST PORTS(S). Use of '=' requires multi-port match in your iptables
and kernel.</para>
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 DEST PORTS(S). Use of
'=' requires multi-port match in your iptables and kernel.</para>
<para>This column was formerly labelled SOURCE PORT(S).</para>
</listitem>
</varlistentry>
</variablelist>

View File

@@ -135,7 +135,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DEST PORT</emphasis> (dport) - [<emphasis
<term><emphasis role="bold">DPORT</emphasis> - [<emphasis
role="bold">-</emphasis>|<emphasis>port-name-or-number</emphasis>]</term>
<listitem>
@@ -143,16 +143,19 @@
a <emphasis>port number</emphasis>; if the protocol is <emphasis
role="bold">icmp</emphasis>, this column is interpreted as the
destination icmp-type(s).</para>
<para>This column was previously labelled DEST PORT(S).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SOURCE PORT</emphasis> (sport) -
[<emphasis
<term><emphasis role="bold">SPORT</emphasis> - [<emphasis
role="bold">-</emphasis>|<emphasis>port-name-or-number</emphasis>]</term>
<listitem>
<para>Optional source port.</para>
<para>This column was previously labelled SOURCE PORT(S).</para>
</listitem>
</varlistentry>
@@ -292,8 +295,7 @@
ALL cannot be used because IPv4 ICMP and IPv6 ICMP are two different
protocols.</para>
<programlisting> #CLASS SOURCE DEST PROTO DEST
# PORT
<programlisting> #CLASS SOURCE DEST PROTO DPORT
IPV4
@@ -314,8 +316,7 @@
<para>Add two filters with priority 10 (Shorewall 4.5.8 or
later).</para>
<programlisting> #CLASS SOURCE DEST PROTO DEST PRIORITY
# PORT
<programlisting> #CLASS SOURCE DEST PROTO DPORT PRIORITY
IPV4

View File

@@ -1625,11 +1625,11 @@ LOG:info:,bar net fw</programlisting>
<listitem>
<para>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.</para>
empty, Shorewall will supply the value
"/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset"
where <emphasis role="bold">uname</emphasis> holds the output of
'<command>uname -r</command>' and <emphasis
role="bold">g_family</emphasis> holds '4'. </para>
</listitem>
</varlistentry>

View File

@@ -424,7 +424,7 @@
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>remote_start</option></arg>
<arg choice="plain"><option>remote-start</option></arg>
<arg><option>-s</option></arg>
@@ -448,7 +448,7 @@
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>remote_reload</option></arg>
<arg choice="plain"><option>remote-reload</option></arg>
<arg><option>-s</option></arg>
@@ -472,7 +472,7 @@
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>remote_restart</option></arg>
<arg choice="plain"><option>remote-restart</option></arg>
<arg><option>-s</option></arg>
@@ -1522,7 +1522,7 @@
<listitem>
<para>This command was re-implemented in Shorewall 5.0.0. The
pre-5.0.0 <command>reload</command> command is now called
<command>remote_restart</command> (see below).</para>
<command>remote-restart</command> (see below).</para>
<para>Reload is similar to <emphasis role="bold">shorewall
start</emphasis> except that it assumes that the firewall is already
@@ -1575,7 +1575,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">remote_start</emphasis>
<term><emphasis role="bold">remote-start</emphasis>
[-<option>s</option>] [-<option>c</option>] [-<option>r</option>
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
[-<option>i</option>] [ <replaceable>directory</replaceable> ]
@@ -1637,7 +1637,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">remote_reload
<term><emphasis role="bold">remote-reload
</emphasis>[-<option>s</option>] [-<option>c</option>]
[-<option>r</option> <replaceable>root-user-name</replaceable>]
[-<option>T</option>] [-<option>i</option>] [
@@ -1699,7 +1699,7 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">remote_restart
<term><emphasis role="bold">remote-restart
</emphasis>[-<option>s</option>] [-<option>c</option>]
[-<option>r</option> <replaceable>root-user-name</replaceable>]
[-<option>T</option>] [-<option>i</option>] [

View File

@@ -1,22 +0,0 @@
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
#
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
#
[Unit]
Description=Shorewall IPv4 firewall
Wants=network-online.target
After=network-online.target
Conflicts=iptables.service firewalld.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/shorewall
StandardOutput=syslog
ExecStart=/sbin/shorewall $OPTIONS start $STARTOPTIONS
ExecStop=/sbin/shorewall $OPTIONS stop
ExecReload=/sbin/shorewall $OPTIONS reload $RELOADOPTIONS
[Install]
WantedBy=basic.target

25
Shorewall/sysconfig Normal file
View File

@@ -0,0 +1,25 @@
# sysV init file script configuration(/etc/sysconfdir/shorewall-lite)
# startup option(default "-vvv")
OPTIONS=
# change default start run level(if none empty; /etc/init.d/shorewall-lite enable)
START=50
# change default stop run level(if none empty; /etc/init.d/shorewall-lite enable)
STOP=
# option to pass when shorewall start is executed
STARTOPTIONS=
# option to pass when shorewall restart is executed
RESTARTOPTIONS=
# option to pass when shorewall reload is executed
RELOADOPTIONS=
# option to pass when shorewall stop is executed
STOPOPTIONS=
# option to pass when shorewall status is executed
STATUSOPTIONS=

View File

@@ -80,6 +80,11 @@ remove_file() # $1 = file to restore
fi
}
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
finished=0
configure=1
@@ -168,8 +173,8 @@ fi
rm -f ${SBINDIR}/shorewall
if [ -L ${SHAREDIR}/shorewall6/init ]; then
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall6/init)
if [ -L ${SHAREDIR}/shorewall/init ]; then
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall/init)
elif [ -n "$INITFILE" ]; then
FIREWALL=${INITDIR}/${INITFILE}
fi
@@ -188,17 +193,19 @@ if [ -f "$FIREWALL" ]; then
remove_file $FIREWALL
fi
if [ -n "$SYSTEMD" ]; then
if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD"
fi
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
rm -f $SYSTEMD/shorewall.service
rm -f $SERVICEDIR/shorewall.service
fi
rm -rf ${SHAREDIR}/shorewall/version
rm -rf ${CONFDIR}/shorewall
if [ -n "$SYSCONFDIR" ]; then
[ -n "$SYSCONFFILE" ] || SYSCONFFILE=${PRODUCT};
rm -f ${SYSCONFDIR}/${SYSCONFFILE}
[ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT}
fi
rm -rf ${VARDIR}/shorewall

95
Shorewall6-lite/init.openwrt.sh Executable file
View File

@@ -0,0 +1,95 @@
#!/bin/sh /etc/rc.common
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
#
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012,2014 - Tom Eastep (teastep@shorewall.net)
# (c) 2015 - Matt Darfeuille - (matdarf@gmail.com)
#
# On most distributions, this file should be called /etc/init.d/shorewall.
#
# Complete documentation is available at http://shorewall.net
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# If an error occurs while starting or restarting the firewall, the
# firewall is automatically stopped.
#
# Commands are:
#
# shorewall6-lite start Starts the firewall
# shorewall6-lite restart Restarts the firewall
# shorewall6-lite reload Reload the firewall
# (same as restart)
# shorewall6-lite stop Stops the firewall
# shorewall6-lite status Displays firewall status
#
# description: Packet filtering firewall
# openwrt stuph
# start and stop runlevel variable
START=50
STOP=89
# variable to display what the status command do when /etc/init.d/shorewall6-lite is invoke without argument
EXTRA_COMMANDS="status"
EXTRA_HELP="status displays shorewall status"
################################################################################
# Get startup options (override default)
################################################################################
OPTIONS=
#
# The installer may alter this
#
. /usr/share/shorewall/shorewallrc
if [ -f ${SYSCONFDIR}/$PRODUCT ]; then
. ${SYSCONFDIR}/$PRODUCT
fi
SHOREWALL_INIT_SCRIPT=1
################################################################################
# E X E C U T I O N B E G I N S H E R E #
################################################################################
# arg1 of init script is arg2 when rc.common is sourced; set to action variable
command="$action"
start() {
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $STARTOPTIONS
}
boot() {
local command="start"
start
}
restart() {
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $RESTARTOPTIONS
}
reload() {
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $RELOADOPTION
}
stop() {
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $STOPOPTIONS
}
status() {
exec ${SBINDIR}/shorewall6-lite $OPTIONS $command $STATUSOPTIONS
}

View File

@@ -1,21 +0,0 @@
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
#
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
#
[Unit]
Description=Shorewall IPv6 firewall (lite)
Wants=network-online.target
After=network-online.target
Conflicts=ip6tables.service firewalld.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/shorewall6-lite
StandardOutput=syslog
ExecStart=/sbin/shorewall6-lite $OPTIONS start
ExecStop=/sbin/shorewall6-lite $OPTIONS stop
[Install]
WantedBy=basic.target

25
Shorewall6-lite/sysconfig Normal file
View File

@@ -0,0 +1,25 @@
# sysV init file script configuration(/etc/sysconfdir/shorewall-lite)
# startup option(default "-vvv")
OPTIONS=
# change default start run level(if none empty; /etc/init.d/shorewall-lite enable)
START=50
# change default stop run level(if none empty; /etc/init.d/shorewall-lite enable)
STOP=
# option to pass when shorewall start is executed
STARTOPTIONS=
# option to pass when shorewall restart is executed
RESTARTOPTIONS=
# option to pass when shorewall reload is executed
RELOADOPTIONS=
# option to pass when shorewall stop is executed
STOPOPTIONS=
# option to pass when shorewall status is executed
STATUSOPTIONS=

View File

@@ -28,6 +28,7 @@
VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall6-lite
Product="Shorewall6 Lite"
usage() # $1 = exit status
{
@@ -76,6 +77,11 @@ remove_file() # $1 = file to restore
fi
}
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
finished=0
configure=1
@@ -144,16 +150,16 @@ fi
if [ -f ${SHAREDIR}/shorewall6-lite/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall6-lite/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Lite Version $INSTALLED_VERSION is installed"
echo "WARNING: Shorewall6 Lite Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION"
fi
else
echo "WARNING: Shorewall Lite Version $VERSION is not installed"
echo "WARNING: Shorewall6 Lite Version $VERSION is not installed"
VERSION=""
fi
echo "Uninstalling Shorewall Lite $VERSION"
echo "Uninstalling Shorewall6 Lite $VERSION"
[ -n "$SANDBOX" ] && configure=0
@@ -164,7 +170,15 @@ if [ $configure -eq 1 ]; then
fi
if [ -f ${SHAREDIR}/shorewall6-lite/init ]; then
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall6-lite/init)
if [ $HOST = openwrt ]; then
if [ $configure -eq 1 ] && /etc/init.d/shorewall6-lite enabled; then
/etc/init.d/shorewall6-lite disable
fi
FIREWALL=$(readlink ${SHAREDIR}/shorewall6-lite/init)
else
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall6-lite/init)
fi
elif [ -n "$INITFILE" ]; then
FIREWALL=${INITDIR}/${INITFILE}
fi
@@ -185,20 +199,24 @@ if [ -f "$FIREWALL" ]; then
remove_file $FIREWALL
fi
if [ -n "$SYSTEMD" ]; then
[ -z "$SERVICEDIR" ] && SERVICEDIR="$SYSTEMD"
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
rm -f $SYSTEMD/shorewall6-lite.service
rm -f $SERVICEDIR/shorewall6-lite.service
fi
rm -f ${SBINDIR}/shorewall6-lite
rm -rf ${CONFDIR}/shorewall6-lite
rm -rf ${VARDIR}/shorewall6-lite
rm -rf ${VARDIR}
rm -rf ${SHAREDIR}/shorewall6-lite
rm -rf ${LIBEXECDIR}/shorewall6-lite
rm -f ${CONFDIR}/logrotate.d/shorewall6-lite
[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/shorewall6-lite.service
rm -f ${SYSCONFDIR}/shorewall6-lite
rm -f ${MANDIR}/man5/shorewall6-lite*
rm -f ${MANDIR}/man8/shorewall6-lite*
if [ -n "${MANDIR}" ]; then
rm -f ${MANDIR}/man5/shorewall6-lite*
rm -f ${MANDIR}/man8/shorewall6-lite*
fi
echo "Shorewall6 Lite Uninstalled"

View File

@@ -159,7 +159,7 @@ INLINE_MATCHES=Yes
IPSET_WARNINGS=Yes
IP_FORWARDING=Off
IP_FORWARDING=keep
KEEP_RT_TABLES=Yes

View File

@@ -160,7 +160,7 @@ INLINE_MATCHES=Yes
IPSET_WARNINGS=Yes
IP_FORWARDING=Off
IP_FORWARDING=keep
KEEP_RT_TABLES=Yes

Some files were not shown because too many files have changed in this diff Show More