Compare commits

..

288 Commits

Author SHA1 Message Date
Tom Eastep
ec0ff7f305 Remove $OPTIONS from Shorewall-init service files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-12 14:38:48 -08:00
Tom Eastep
7100af5380 Correct .service files
- Make them match earlier versions

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-11 18:05:04 -08:00
Tom Eastep
f9932d2b08 Correct typos in the -lite manpages
- Remove redundant 'a specify'.
- Change reference to /etc/shorewall[6]/started.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-11 07:48:57 -08:00
Thomas D
2bf80ee3d9 Patches for shorewall manpage
Hi,

here is the patch set for the shorewall6-lite man page.

-Thomas

>From d3fc3bd79f6313e8c940f6df49ae6ea3e05fa590 Mon Sep 17 00:00:00 2001
From: Thomas D <whissi@whissi.de>
Date: Tue, 11 Nov 2014 01:23:44 +0100
Subject: [PATCH 2/2] Fixes for the "commands" section.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-11 07:41:18 -08:00
Tom Eastep
22ac37b51e Patches for Shorewall6 manpage from Thomas D
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-10 07:50:28 -08:00
Tom Eastep
c4171a92f6 Change spacing in shorewall[6] usage output
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-10 07:38:58 -08:00
Thomas D
a5b2886ae9 Patches for shorewall manpage
Hi,

I corrected some errors in the manpages. I started with "shorewall".

Tom, please tell me if you like this format and the patches at all.
If you like them, I can send you a similar patch set for shorewall6, too.

-Thomas

From 2aaeaa4f2da7aae92177ced0530f1deff86f44a9 Mon Sep 17 00:00:00 2001
From: Thomas D <whissi@whissi.de>
Date: Sun, 9 Nov 2014 15:45:29 +0100
Subject: [PATCH 11/14] The "-i" option from the "reload" command wasn't marked
 as an option.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-09 07:40:59 -08:00
Tom Eastep
9a6047b3c4 Correct reversed naming of SHA chains
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-06 08:18:52 -08:00
Tom Eastep
6f5de7ef3f Add now logging modules to the modules files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-05 16:19:30 -08:00
Tom Eastep
5b4e3bc07c Accomodate new module names for LOG_BACKEND
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-05 12:51:24 -08:00
Tom Eastep
dc3f163e71 Change the names of the sha1 chains for uniqueness
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-04 17:54:38 -08:00
Tom Eastep
2f545012a6 More documentation updates for -C
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-02 09:25:58 -08:00
Tom Eastep
c97226c46c Correct behavior of 'start -fC'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-02 09:25:23 -08:00
Tom Eastep
8c0c1bd1e0 Omit the 'shorewall' chain from .ip[6]tables-restore-input
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-02 08:16:47 -08:00
Tom Eastep
8b825c4c4c Avoid failure of ip[6]tables-restore.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-02 07:56:05 -08:00
Tom Eastep
4493b2ab6b Correct typo in 'rules' manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-02 06:50:40 -08:00
Tom Eastep
9598ac6fad Correct a couple of problems with -C
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-01 10:09:04 -07:00
Tom Eastep
8fb73026c8 Replace SAVE_COUNTERS with the -C command option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-11-01 09:37:57 -07:00
Tom Eastep
4546cbaff7 Use chains with names derived from a digest to identify ruleset
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-31 11:36:53 -07:00
Tom Eastep
a83c146636 Cleanup
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-30 20:27:06 -07:00
Tom Eastep
2ffc97867c Correct syntax error in the generated script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-30 19:59:20 -07:00
Tom Eastep
f08803e293 Preserve counts on 'restart' without compilation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-30 18:38:45 -07:00
Tom Eastep
b7ab82dba4 Implement -f option in the -lite products' start command
- Remove 'recover' command

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-30 10:42:39 -07:00
Tom Eastep
113f95c11e Provide STARTOPTIONS and RESTARTOPTIONS in all cases
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-30 10:22:39 -07:00
Tom Eastep
3454e10525 Add SAVE_COUNTERS option.
- Also implement recover command

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-30 08:57:56 -07:00
Tom Eastep
edc30fcc8d Process the params file with SHOREWALL_SHELL
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-29 12:22:00 -07:00
Tom Eastep
85e5669fc7 Rename function interface_up() to interface_enabled()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-27 18:38:22 -07:00
Tom Eastep
055fceb82f Update policy manpages for duel limits
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-22 12:27:27 -07:00
Tom Eastep
f5bdc9e7f4 Allow two limits in the RATE LIMIT columns
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-22 11:21:43 -07:00
Tom Eastep
54461a9a90 Correct indentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-20 12:29:45 -07:00
Tom Eastep
b60d6dd6e5 Avoid duplicate module loads
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-20 10:42:53 -07:00
Tom Eastep
4bc91e89db Remove debugging code from Shorewall-init installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-19 08:28:41 -07:00
Tom Eastep
2784e93307 Load xt_LOG in both helpers files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-19 08:28:36 -07:00
Tom Eastep
90d1e41dcb Correct IPv4 Helpers file
- Change xt_ULOG to ipt_ULOG

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-19 08:28:29 -07:00
Tom Eastep
20c8bf02b1 Correct Shorewall6 helpers file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-19 08:28:19 -07:00
Tom Eastep
38d4b1c5a9 Revert "Correct last patch"
This reverts commit b528625329.
2014-10-19 08:28:11 -07:00
Tom Eastep
e3a332ec27 Correct last patch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-19 08:28:00 -07:00
Tom Eastep
49218a4d28 ipt_LOG in helpers file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-15 18:07:09 -07:00
Tom Eastep
3236cd2660 Reinstate IPv6 DropSmurfs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-13 12:34:25 -07:00
Tom Eastep
e3b10343a5 Change SYSTEMDDIR to SERVICEDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-13 11:56:26 -07:00
Tom Eastep
286bc50bb3 Remove 'optional' from the Universal interfaces file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-13 08:07:14 -07:00
Tom Eastep
a5086f785f Avoid confusing output when 4.6.4 CLI executes a 'save'
- If a down-rev firewall is running, the savesets command produces
  confusing usage output

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-10 18:40:55 -07:00
Tom Eastep
19482ac197 Allow Shorewall-init installer to create SBINDIR if configure == 0
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-09 10:14:23 -07:00
Tom Eastep
42363da458 Add new .service files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-09 10:00:53 -07:00
Tom Eastep
c5074bddb2 Rename the .service files to .service.214
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-09 09:45:52 -07:00
Tom Eastep
4b9d8ad5f6 Merge branch '4.6.4'
Conflicts:
	Shorewall-init/shorewall-init.service
2014-10-08 18:26:42 -07:00
Tom Eastep
8e9d769723 Add iptables.service to Shorewall-init conflicts
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-08 18:24:53 -07:00
Tom Eastep
77015ebb4d Adjust the .service files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-08 17:33:33 -07:00
Tom Eastep
12458d111a Adjust the .service files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-08 17:28:22 -07:00
Tom Eastep
815e93e80c Rename SYSTEMD to SYSTEMDDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-07 16:46:16 -07:00
Tom Eastep
7771e5d48f More ipset article tweaks
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-07 13:37:56 -07:00
Tom Eastep
0cd694370e Add nat link from Shorewall6 manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-07 12:21:44 -07:00
Tom Eastep
5fd7c573fc Clarify Shorewall-init SAVE_IPSETS setting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-07 11:41:57 -07:00
Tom Eastep
80c024c4aa Amplify the 4.6.4 SAVE_IPSETS changes in the ipset article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-07 09:52:15 -07:00
Tom Eastep
3bae6e61cf Eliminate syntax errors in the generated script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-07 07:53:26 -07:00
Tom Eastep
5204cbc95f Suppress 'No ipsets were saved' warning when SAVE_IPSETS=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-07 07:50:12 -07:00
Tom Eastep
ea1b8ac63a Correct handling of empty LOG_BACKEND
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-07 07:34:55 -07:00
Tuomo Soini
a31fd20f22 Shorewall6/nat: clearly make it ipv6 specific 2014-10-07 12:42:57 +03:00
Tom Eastep
2c7ffb525d Updagte Shorewall6-nat manpage
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-05 20:09:18 -07:00
Tom Eastep
316866482b Add ipv6 nat file and manpage
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-05 19:54:19 -07:00
Tom Eastep
6c6a1d82d9 Make Debian installation work with SANDBOX
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-05 16:52:59 -07:00
Tom Eastep
a72a1ef7a6 Update the install document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-05 13:30:28 -07:00
Tom Eastep
4398fb23d1 Create INITDIR in the Shorewall init installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 18:49:55 -07:00
Tom Eastep
e3a7a4fc98 Fix typo in the -lite installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 17:48:20 -07:00
Tom Eastep
e36b34ce15 Fix -lite installer for MANDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 14:26:12 -07:00
Tom Eastep
178d1fbc26 Correct typo
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 14:19:48 -07:00
Tom Eastep
c9fd390782 Final cleanup of the uninstallers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 14:07:33 -07:00
Tom Eastep
3206021278 Another round of uninstall fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 13:50:39 -07:00
Tom Eastep
8571e0dca0 Another round of uninstall fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 13:29:51 -07:00
Tom Eastep
9dc2bba025 More uninstall corrections.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 09:39:03 -07:00
Tom Eastep
2fce05b3ab Correct a couple of errors
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 09:11:29 -07:00
Tom Eastep
70bb9147cd Correct Shorewall-init installer handling of SANDBOX
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 09:00:12 -07:00
Tom Eastep
00b0489047 Implement SANDBOX variable in the installers/uninstallers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-04 07:50:30 -07:00
Tom Eastep
f9a21bd90e Add -n option to the uninstallers.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-03 17:10:36 -07:00
Tom Eastep
5e81bdfe19 Another install script fix
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-03 17:07:03 -07:00
Tom Eastep
f2cc68b93b Correct -lite installer and uninstaller
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-03 16:41:27 -07:00
Tom Eastep
8a5e71a56f Implement the -n option in the installers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-03 07:59:41 -07:00
Tom Eastep
483ea3e437 Create INITDIR in -lite installs.
- Also don't link the init script if it isn't installed.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-02 17:42:08 -07:00
Tom Eastep
2ec3adcc44 Don't link the init script if SYSTEMD is set.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-02 16:23:26 -07:00
Tom Eastep
205dd6e250 Add FAQ 104
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-10-01 19:47:56 -07:00
Tom Eastep
770a505cd2 Delete DropSmurfs from IPv6 actions.std
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-30 16:16:53 -07:00
Tom Eastep
4071b9d337 Update SuSE shorewallrc for SBINDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-30 16:16:33 -07:00
Tom Eastep
820c769499 Correct silly bug in last change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-29 07:08:39 -07:00
Tom Eastep
e6b0666ac9 Save ipsets during normal stop (duh)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-28 18:43:11 -07:00
Tom Eastep
2a463e06aa More documentation changes regarding SAVE_IPSETS.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-28 17:10:45 -07:00
Tom Eastep
3174454300 Correct SAVE_IPSETS logic in Config.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-28 14:38:01 -07:00
Tom Eastep
ce1c367d1d Re-commit the fix that saves only the appropriate family
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-28 14:09:20 -07:00
Tom Eastep
3e2c903a41 Revert "Only save ipsets of the proper family"
This reverts commit b053cab630.
2014-09-28 13:32:32 -07:00
Tom Eastep
b053cab630 Only save ipsets of the proper family
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-28 12:58:52 -07:00
Tom Eastep
6f7d063921 Remove the target file before saving ipsets in the savesets command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-28 11:53:52 -07:00
Tom Eastep
cbcb1ff7e1 Add SAVE_IPSETS to shorewall6.conf.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-28 11:37:24 -07:00
Tom Eastep
3858683e94 Allow saving a specified list of ipsets
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-28 11:19:41 -07:00
Tom Eastep
38a18ac9ac Allow indefinite alternative to 'yes' and 'no'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-27 15:06:18 -07:00
Tom Eastep
a09484356c Support 'yes', 'no, <other> values for simple config options
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-27 07:57:46 -07:00
Tom Eastep
bc8588a68e Fix rule numbers in trace output
- Don't increment $number needlessly when not tracing

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-27 07:57:09 -07:00
Tom Eastep
10df9d31c4 Correct typo in the actions manpages (4.6.5 s/b 4.6.4).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-25 14:47:27 -07:00
Tom Eastep
4989f694cd Correct trace output
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-25 14:47:00 -07:00
Tom Eastep
b84a9e16e6 Correct typo in the config basics document
- SOURCE/DEST example had extra colon

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-25 10:59:18 -07:00
Tom Eastep
053df2a5fb Go back to original insert_irule() fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-25 09:21:20 -07:00
Tom Eastep
976a1f3deb Merge branch '4.6.3'
Conflicts:
	Shorewall/Perl/Shorewall/Misc.pm
2014-09-25 08:06:16 -07:00
Tom Eastep
ea40068c10 Fix ADMINISABSENTMINDED=No used with stoppedrules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-25 08:03:35 -07:00
Tom Eastep
56649e2183 Don't compile routestopped during check if there is stoppedrules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-24 19:24:13 -07:00
Tom Eastep
520d21c056 Another tweak to LOG_BACKEND
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-24 17:12:05 -07:00
Tom Eastep
540eff24aa Correctons to LOG_BACKEND implementation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-24 16:35:41 -07:00
Tom Eastep
580e00dabd Implement LOG_BACKEND option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-24 15:26:13 -07:00
Tom Eastep
4815f7eba3 Correct warning message in stoppedrules processing.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-24 11:05:15 -07:00
Tom Eastep
a7b57ad32c Clarify iptrace logging.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-24 09:14:38 -07:00
Tom Eastep
ba7f88c912 Re-apply 'terminating' changes to the actions manpages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-23 09:33:57 -07:00
Tom Eastep
7481514a97 Implement the 'terminating' action option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-23 09:29:13 -07:00
Tom Eastep
20c68dddf2 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-09-23 09:24:44 -07:00
Tom Eastep
35e60aa10c Fix actions manpage
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-23 09:24:32 -07:00
Tom Eastep
1f5439257a Revert "Implement the 'terminating' action option"
This reverts commit 6851744cb7.
2014-09-23 07:39:25 -07:00
Tom Eastep
4495ed687b Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2014-09-23 07:10:46 -07:00
Tom Eastep
d97d45f4ad Merge branch '4.6.3' 2014-09-23 07:10:17 -07:00
Tom Eastep
a69cec5228 Add link to Events article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-23 07:09:56 -07:00
Tuomo Soini
a03f00bf0f systemd services: multi-user is not same as old runlevel 3 so use basic
add conflicts to obviously conflicting services
remove old version number from init files
remove legacy syslog.target which is not needed on modern systems
fix formatting of email address onold Copyright text

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2014-09-23 16:44:03 +03:00
Tuomo Soini
8f05d0f16d install.sh: support install on centos7 and foobar7
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2014-09-23 13:19:09 +03:00
Tom Eastep
f9d98b74a2 Merge branch '4.6.2' into 4.6.3
Conflicts:
	Shorewall/Perl/Shorewall/Providers.pm

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-16 08:09:20 -07:00
Tom Eastep
0d23b9c542 Don't verify required interfaces during 'stop' or 'clear'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-14 09:29:04 -07:00
Tom Eastep
a7bdfcc47b Refine the rule reduction fix
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-11 20:58:01 -07:00
Tom Eastep
988ee64621 Eliminate Redundant Rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-11 10:17:01 -07:00
Tom Eastep
9947f4d968 Re-enable SECTION PREROUTING in the accounting file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-10 12:53:08 -07:00
Tom Eastep
feb747260d Add /etc/shorewall/params to the multi-ISP LSM example
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-03 06:59:37 -07:00
Tom Eastep
fc58dab66d Remove redundant 'run' command from help output
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-02 12:57:04 -07:00
Tom Eastep
9e039e30e5 Issue warning message when /etc/iproute2/rt_tables is not writeable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-02 08:11:33 -07:00
Tom Eastep
771e487b02 Merge branch '4.6.3' 2014-09-01 09:10:55 -07:00
Tom Eastep
0b66c475a7 Make <command> replacable in the run synopsis
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-01 09:10:03 -07:00
Tom Eastep
8727a6f1d8 Correct 'run' command synopsis in the shorewall[6] manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-01 08:52:09 -07:00
Tom Eastep
f9a62e1650 Correct builtin example in the actions manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-01 08:29:29 -07:00
Tom Eastep
6851744cb7 Implement the 'terminating' action option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-09-01 08:16:42 -07:00
Tom Eastep
f963adccf5 Correct silly typo in Chains.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-31 16:57:24 -07:00
Tom Eastep
48549b35ac Correct inaccuracy in default.debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-30 08:25:58 -07:00
Tom Eastep
9001643996 Merge branch 'master' into 4.6.3 2014-08-30 07:18:55 -07:00
Tom Eastep
4bacfced82 Another attempt to fix formatting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-24 11:59:51 -07:00
Tom Eastep
7c1bbd4dc7 Fix formatting in shorewall[6]-rules(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-24 11:29:44 -07:00
Tom Eastep
4347190f82 Clarify REJECT handling in IP[6]TABLE rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-24 09:10:10 -07:00
Tom Eastep
fa8c3b3b6c Correct typo in error messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-24 08:34:33 -07:00
Tom Eastep
045d5ac048 Correct typo in error messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-24 08:34:04 -07:00
Tom Eastep
e4a8cb31ba Clean up the Goto Meeting macro a bit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-24 08:16:11 -07:00
Tom Eastep
9e6fffc231 Goto-Meeting Macro from Eric Teeter
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-23 16:05:38 -07:00
Tom Eastep
aaa561c831 Mention shell variable rules in the extension script article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-21 16:00:58 -07:00
Tom Eastep
3030219740 Tighten the check for DNSAmp
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-21 10:36:44 -07:00
Tom Eastep
602ecad712 Cleaner code in expand_variables()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-20 11:25:49 -07:00
Tom Eastep
96102623ee Apply Thomas D's patch for SAVE_IPSET in the debian shorewall-init script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-14 09:49:18 -07:00
Tom Eastep
aa6bd2819c Update the Build document
- Add build46
- Mention shorewall-pkg.config

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-14 08:03:31 -07:00
Tom Eastep
8236ce572e Apply Louis Lagendijk's patch for Shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-12 16:39:52 -07:00
Tom Eastep
bf5be7198b Make dump work correctly on RHEL5
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-12 16:18:42 -07:00
Tom Eastep
6f777098d7 Add 'wildcard' member to the interface table
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-12 06:51:17 -07:00
Tom Eastep
e545329eb9 Modify the preceding fix to work with wildcard interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-12 06:50:59 -07:00
Tom Eastep
aedd9b5a76 Add 'wildcard' member to the interface table
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-11 08:30:44 -07:00
Tom Eastep
cf33bac318 Revert most of last change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-10 12:15:08 -07:00
Tom Eastep
0005bb697b Describe a way to improve provider selection from the firewall
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-10 09:50:21 -07:00
Tom Eastep
c5549ff21e Update the Configuration File Basics document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-10 08:09:31 -07:00
Tom Eastep
427f38109e Some cosmetic cleanup
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-10 07:20:23 -07:00
Tom Eastep
0e1a1a3f44 Modify the preceding fix to work with wildcard interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-08 10:34:29 -07:00
Tom Eastep
b6161b8be7 Merge branch '4.6.2' 2014-08-08 08:30:04 -07:00
Tom Eastep
d3209ca624 Correct handling of a physical name in the provider INTERFACE column
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-08 08:15:26 -07:00
Tom Eastep
34ecbb9074 Correct Cygwin64 detection in the Shorewall installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-07 07:17:34 -07:00
Tom Eastep
beb70854ef Correct Cygwin64 detection in the Shorewall installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-07 06:40:34 -07:00
Tom Eastep
7030fad572 Revert "Install the core components along with Shorewall"
This reverts commit c653a04a43.
2014-08-07 06:36:23 -07:00
Tom Eastep
c653a04a43 Install the core components along with Shorewall
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-06 12:59:12 -07:00
Tom Eastep
5ef5aa8cdb Allow inline matches in an action file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-05 07:34:24 -07:00
Tom Eastep
0ca12bd86f Correct syntax error caused by replacing '%%' with '??'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-03 15:29:58 -07:00
Tom Eastep
a2f1c57246 Add DNSAmp action
- Allow escaping '@' allowing u32 in action body
- Allow inline matches in actions

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-03 15:11:25 -07:00
Tom Eastep
fd42fa9f74 Make 'detect_configuration' work in the 'run' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-08-01 07:34:40 -07:00
Tom Eastep
e49832f4b5 Run the 'init' script in the 'run' command.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-30 10:25:00 -07:00
Tom Eastep
0bf80c15d8 Detect missing <commmand> in the generated scrip
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-29 11:35:32 -07:00
Tom Eastep
4e9a0b989d Update 'run' help text
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-29 10:46:28 -07:00
Tom Eastep
31e5aeeaea Refine the 'run' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-29 10:30:07 -07:00
Tom Eastep
eb5026d3b7 Merge branch '4.6.2' 2014-07-28 14:47:23 -07:00
Tom Eastep
a799d74901 Correct typo and link in the shorewall-mangle manpage
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-28 08:39:07 -07:00
Tom Eastep
7a41981487 Bring the -lite manpages up to date
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-28 08:31:43 -07:00
Tom Eastep
aae23d7a9e Bring the -lite manpages up to date
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-28 08:31:20 -07:00
Tom Eastep
a7b18ca875 Implement 'run' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-28 07:04:56 -07:00
Tom Eastep
ad6c91bcbd Allow optimize level 8 to work with Perl 5.20.0.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-25 21:03:48 -07:00
Tom Eastep
8c0fe063a7 Another tweak to the FTP module documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-25 09:03:23 -07:00
Tom Eastep
dbf78d7dd0 Merge branch '4.6.2' 2014-07-25 09:02:48 -07:00
Tom Eastep
bea2b49eb0 More FTP module documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-25 08:38:46 -07:00
Tom Eastep
3b4012b60a Document FTP helpers on kernel 3.5 and later in the FTP document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-25 08:15:58 -07:00
Tom Eastep
21209504c5 Correct example from preceding commit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-23 10:47:11 -07:00
Tom Eastep
44a34ceb95 Add complex port-forwarding example to the aliased interfaces article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-23 10:36:34 -07:00
Tom Eastep
848078873d Update tcfilters manpages to mention BASIC_FILTERS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-22 07:19:10 -07:00
Tom Eastep
3e6f57e699 Correct link in the Multi-ISP document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-21 14:33:59 -07:00
Tom Eastep
461f7b10ba Detect Arptables JF capability when LOAD_HELPERS_ONLY = No.
- Move detection of Header Match to its proper ordinal.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-20 07:19:02 -07:00
Tom Eastep
2c9eda9cee Add some white space for readability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-19 18:33:02 -07:00
Tom Eastep
64fc3d2e43 Correct a typo that caused iset couter match to be mis-detected
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-19 10:27:29 -07:00
Tom Eastep
d0aed87546 Correct IPV6 ipset capabilities checking on 3.14 kernels
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-19 10:25:46 -07:00
Tom Eastep
56fa6bd78a Revert "Correct ipset detection on later kernels."
This reverts commit b207f64a85.
2014-07-19 10:22:12 -07:00
Tom Eastep
b207f64a85 Correct ipset detection on later kernels.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-19 08:55:02 -07:00
Tom Eastep
9f381209d5 Detect HEADER_MATCH when LOAD_MODULES_ONLY=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-19 07:20:28 -07:00
Tom Eastep
29e6bc9379 Merge branch '4.6.2' of ssh://server.shorewall.net/home/teastep/shorewall/code into 4.6.2 2014-07-18 15:15:33 -07:00
Tom Eastep
4b3196b959 Add refmiscinfo to the shorewall-tcrules manpage
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-18 13:49:30 -07:00
Tom Eastep
6771dc54ad Streamline some code from the last commit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-18 12:58:49 -07:00
Tom Eastep
ba69708092 Merge branch '4.6.2' of ssh://server.shorewall.net/home/teastep/shorewall/code into 4.6.2 2014-07-18 08:45:06 -07:00
Tom Eastep
417bd0138e Correct two problems with tcrules processing:
- SAVE and RESTORE didn't work
- '|' and '&' were ignored


Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-18 08:32:22 -07:00
Tom Eastep
a1cc4847c7 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-07-16 15:40:25 -07:00
Tom Eastep
0ec4cfd18d Fix incorrect link in the complex TC document.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-16 15:39:37 -07:00
Tom Eastep
d5ea667c61 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-07-13 07:55:56 -07:00
Tom Eastep
3e6e0b4a09 Amplify the route filtering problem in the multi-ISP document.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-13 07:45:51 -07:00
Tom Eastep
a97e2fd3d9 Update manpages regarding 'status -i'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-12 19:37:05 -07:00
Tom Eastep
53dda803e2 More Cygwin64 changes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-09 11:28:45 -07:00
Tom Eastep
cc935009ce Correct install problems under Cygwin
- configure.pl doesn't understand CYGWIN return from uname
- shorewall-core install.sh doesn't understand CYGWIN return from uname
- shorewall install.sh generates 'mkdir -p //etc/shorewall' which is
  broken under Cygwin

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-09 10:48:03 -07:00
Tom Eastep
a0ab9f6ab2 Update FAQ copyright
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-08 07:45:34 -07:00
Tom Eastep
a7856e4dd6 Update another copyright
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-06 15:11:16 -07:00
Tom Eastep
4a4cea46c0 Update copyrights in the Sample files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-06 13:44:34 -07:00
Tom Eastep
cf626b58da Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-07-06 09:55:21 -07:00
Tom Eastep
2ed523101c Allow specification of the MAC address of a gateway
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-06 09:54:53 -07:00
Tom Eastep
c72265667f Add FAQ 103
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-06 08:51:42 -07:00
Tom Eastep
77513da27e Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-07-04 08:17:48 -07:00
Tom Eastep
c663a14c4d Correct TIME column handling in IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-04 08:17:19 -07:00
Tom Eastep
c17a196838 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-07-04 08:02:29 -07:00
Tom Eastep
8bfff55ed2 Add a TIME column to the mangle file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-04 08:01:14 -07:00
Tom Eastep
7184c9aa58 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-07-02 21:45:34 -07:00
Tom Eastep
b1a6ec7f03 Merge branch '4.6.1' 2014-07-02 21:41:27 -07:00
Tom Eastep
9f71791919 Merge branch '4.6.1' of ssh://server.shorewall.net/home/teastep/shorewall/code into 4.6.1 2014-07-02 16:44:32 -07:00
Tom Eastep
1a7cc9b86d Allow SAVE/RESTORE rules in the OUTPUT chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-02 16:35:13 -07:00
Tom Eastep
a8f6d2f438 Apply Thibaut Chèze's patch for DSCP names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-02 16:35:07 -07:00
Tom Eastep
b8777c0fd5 Merge branch '4.6.1' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-07-02 12:47:07 -07:00
Tom Eastep
cad8443e01 Allow SAVE/RESTORE rules in the OUTPUT chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-02 12:38:02 -07:00
Tom Eastep
2ad81f1a81 Apply Thibaut Chèze's patch for DSCP names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-02 12:37:50 -07:00
Tom Eastep
166e1a3df9 Allow SAVE/RESTORE rules in the OUTPUT chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-01 06:54:54 -07:00
Tom Eastep
84437ea689 Apply Thibaut Chèze's patch for DSCP names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-01 06:52:58 -07:00
Tom Eastep
20a567fea7 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2014-07-01 06:43:36 -07:00
Tom Eastep
7082bf1971 Update Events.xml with stateful knocking example/description
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-07-01 06:43:20 -07:00
Tuomo Soini
87b5751a49 macro.IPMI: add missing ports from Asus, Supermicro, and Dell documentation
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2014-07-01 13:14:01 +03:00
Tuomo Soini
49aada0f9c macro.ILO: add support for HP Integrated Lights-Out
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2014-07-01 12:25:26 +03:00
Tom Eastep
7fdc398a5e Revert "Revert "Revert "Add a TIME column to the mangle file"""
This reverts commit 1165b2689c.
2014-06-27 08:23:04 -07:00
Tom Eastep
1165b2689c Revert "Revert "Add a TIME column to the mangle file""
This reverts commit 9c7fcd09fd.
2014-06-27 08:14:28 -07:00
Tom Eastep
2701b0a756 Correct number of columns in split_line2() calls.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-25 08:22:09 -07:00
Tom Eastep
9c7fcd09fd Revert "Add a TIME column to the mangle file"
This reverts commit 824b14b714.
2014-06-25 07:33:42 -07:00
Tom Eastep
380a159c8c Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2014-06-25 07:32:23 -07:00
Tom Eastep
80c09c4747 Merge branch '4.6.1' 2014-06-25 07:31:36 -07:00
Tom Eastep
824b14b714 Add a TIME column to the mangle file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-25 07:05:12 -07:00
Tom Eastep
122d58b122 Clear inline matches in perl_action_tcp_helper
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-21 07:58:27 -07:00
Tom Eastep
61bb73fd8c Correct handling of matches in action_tcp_helper()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-20 14:28:17 -07:00
Tom Eastep
ff8d354c1c Allow INLINE_MATCHES=Yes and AUTOHELPERS=No to work correctly.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-20 07:01:31 -07:00
Tom Eastep
0b1dda2a31 Allow INLINE_MATCHES=Yes and AUTOHELPERS=No to work correctly.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-20 07:00:06 -07:00
Tom Eastep
50736fb8ae Correct last patch (s/-i/-x/)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-18 15:38:11 -07:00
Tom Eastep
a2e514c0ab Add the -i option to the 'show bl' help text
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-18 15:35:49 -07:00
Tom Eastep
7b0cf2b665 Add 'show bl' to the usage output
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-18 15:16:07 -07:00
Tom Eastep
6ad9b95351 Implement 'show bl'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-18 13:27:25 -07:00
Tom Eastep
ac4bf15606 Implement 'status -i'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-18 11:07:37 -07:00
Tom Eastep
4e5d24fd9b Currect masq manpages
Describe the SOURCE column as optional

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-16 07:27:05 -07:00
Tom Eastep
e6132b5630 Additional fixes for Shorewall-init init script.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-15 09:03:10 -07:00
Tom Eastep
041e8c445e Correct Shorewall-init Debian init script.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-15 09:03:04 -07:00
Tom Eastep
a0bb7ca018 Merge branch 'master' into 4.6.1 2014-06-13 07:02:51 -07:00
Roberto C. Sanchez
a8885844ae Fix typos 2014-06-13 07:25:54 -04:00
Tom Eastep
2610dd4744 Merge branch 'master' into 4.6.1 2014-06-12 16:39:01 -07:00
Roberto C. Sanchez
b3acb4d30d Fix typo 2014-06-12 18:58:59 -04:00
Tom Eastep
e6372a3e04 Merge branch 'master' into 4.6.1 2014-06-11 15:26:16 -07:00
Roberto C. Sanchez
41ab0d20c9 Update outdated links, thanks to Lee Brown 2014-06-11 16:57:33 -04:00
Tom Eastep
36e31ed839 Correct typo in error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-08 09:40:50 -07:00
Tom Eastep
b55b6a913c Insert the server address list into the error message in DNAT/REDIRECT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-08 09:36:18 -07:00
Tom Eastep
9c9ae04c86 Raise an error when a server list is specified in a DNAT or REDIRECT rule
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-08 08:52:41 -07:00
Tom Eastep
1892cbf218 Remove dest zone name in DNAT- rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-07 17:02:04 -07:00
Tom Eastep
c0c6bedb17 Fix the DNAT- rule shown in the port-knocking example.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-07 16:34:07 -07:00
Tom Eastep
c898129ad6 Correct pi-rho's patch to not deal with the loopback interface
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-06 13:12:02 -07:00
Tom Eastep
7adc16ace9 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2014-06-06 12:45:36 -07:00
Tuomo Soini
7b38bc9558 remove optional SSH and WS-MAN from IPMI macro and only document
vendors which are tested to work

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2014-06-06 22:15:37 +03:00
Tom Eastep
2cd5c41ec0 Clean up white space in pi-rho's patch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-06 10:44:33 -07:00
Tom Eastep
bea5434de6 Merge branch '4.5.21' 2014-06-06 10:05:02 -07:00
Tom Eastep
8657dd97f7 Apply pi-rho's patch for rpfilter.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-06 10:04:42 -07:00
Tom Eastep
ef038d5eab Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2014-06-04 15:21:05 -07:00
Tuomo Soini
b6ea20e7df Added macro IPMI for Remote Console Protocl (RMCP)
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2014-06-02 23:48:30 +03:00
Tom Eastep
6632afaf6a Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2014-06-02 12:21:18 -07:00
Tuomo Soini
0f55863076 Add new macros for AMQP, MongoDB, Redis, and Sieve
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2014-06-02 21:24:09 +03:00
Tom Eastep
9f9d9fd8d1 Eradicate usage of an interface name in the SOURCE column of the masq file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-02 07:35:02 -07:00
Tom Eastep
ec4fc4ee8f Add 4.6 to the Shorewall 4 document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-06-01 12:39:00 -07:00
Tom Eastep
4e33948844 Make 'show filters' work with Simple TC
Signed-off-by: Tom Eastep <teastep@shorewall.net>

Conflicts:

	Shorewall-core/lib.cli
2014-05-25 12:57:15 -07:00
Tom Eastep
954cddc37a Enable 1:1 NAT in IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-25 12:50:00 -07:00
Tom Eastep
e64a7feda2 Make 'show filters' work with Simple TC
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-25 12:30:12 -07:00
Tom Eastep
24721e01b6 Document nat vs. subzone restriction.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-25 10:07:07 -07:00
Tom Eastep
5a22b14947 Enable 1:1 NAT in IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-25 08:57:01 -07:00
Tom Eastep
df738025a3 Change for RHEL7.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-23 12:18:32 -07:00
Tom Eastep
d49d352d77 Improve the output of 'shorewall[6] show filters'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-23 09:26:12 -07:00
Tom Eastep
0f6bd0e2af Update support guide with the current release information
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-22 15:47:44 -07:00
Tom Eastep
89c5d5080b A couple more tweaks to the masq manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-22 11:14:46 -07:00
Tom Eastep
66b3d9aeb5 Correct the heading of the SOURCE masq column
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-22 09:07:00 -07:00
Tom Eastep
b088ea77cd Replace eth1 by eth2 in FAQ 2e
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-22 07:20:36 -07:00
Tom Eastep
966926fac5 RHE7 support -- first cut
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-19 15:15:52 -07:00
Tom Eastep
dcc2fb27c5 Apply Tuomo Soini's whitespace patch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-19 14:18:48 -07:00
Tom Eastep
2859b1aa6e Add bridge instructions to Shorewall FAQ 2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-19 14:18:25 -07:00
Tom Eastep
6d3b1d80d4 Make 'update -A' convert the tcrules file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-16 14:46:15 -07:00
Tom Eastep
d5e83a5295 Delete extra blank line from the IPv4 mangle file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-16 12:11:11 -07:00
Tom Eastep
670c33d20b Update install files to secure the .service files as 644 rather than 600.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-05-01 11:43:59 -07:00
Tom Eastep
58700b2301 Correct the behavior of rpfilter when FASTACCEPT=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-03-31 07:29:29 -07:00
Tom Eastep
72869adcd6 Correct missing comment in trace entry.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-03-28 08:55:55 -07:00
Tom Eastep
0c8365001d Avoid spurious comments on jumps to section chains.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2014-03-28 08:55:48 -07:00
202 changed files with 4318 additions and 1301 deletions

View File

@@ -98,7 +98,7 @@ if [ -z "$vendor" ]; then
eval $(cat /etc/os-release | grep ^ID=)
case $ID in
fedora)
fedora|rhel)
vendor=redhat
;;
debian|ubuntu)
@@ -195,6 +195,10 @@ elif [ -n "${options[VARDIR]}" ]; then
fi
fi
if [ -z "${options[SERVICEDIR]}" ]; then
$options[SERVICEDIR]="${options[SYSTEMD]}"
fi
for on in \
HOST \
PREFIX \
@@ -209,7 +213,7 @@ for on in \
INITFILE \
AUXINITSOURCE \
AUXINITFILE \
SYSTEMD \
SERVICEDIR \
SERVICEFILE \
SYSCONFFILE \
SYSCONFDIR \

View File

@@ -64,7 +64,7 @@ unless ( defined $vendor ) {
$id =~ s/ID=//;
if ( $id eq 'fedora' ) {
if ( $id eq 'fedora' || $id eq 'rhel' ) {
$vendor = 'redhat';
} elsif ( $id eq 'opensuse' ) {
$vendor = 'suse';
@@ -100,7 +100,7 @@ if ( defined $vendor ) {
} elsif ( `uname` =~ '^Darwin' ) {
$vendor = 'apple';
$rcfilename = 'shorewallrc.apple';
} elsif ( `uname` =~ '^Cygwin' ) {
} elsif ( `uname` =~ /^Cygwin/i ) {
$vendor = 'cygwin';
$rcfilename = 'shorewallrc.cygwin';
} else {
@@ -154,6 +154,8 @@ if ( $options{VARLIB} ) {
$options{VARDIR} = '${VARLIB}/${PRODUCT}';
}
$options{SERVICEDIR}=$options{SYSTEMD} unless $options{SERVICEDIR};
for ( qw/ HOST
PREFIX
SHAREDIR
@@ -167,8 +169,8 @@ for ( qw/ HOST
INITFILE
AUXINITSOURCE
AUXINITFILE
SYSTEMD
SERVICEFILE
SERVICEDIR
SERVICEFILE
SYSCONFFILE
SYSCONFDIR
SPARSE

View File

@@ -187,7 +187,7 @@ INSTALLD='-D'
if [ -z "$BUILD" ]; then
case $(uname) in
cygwin*)
cygwin*|CYGWIN*)
BUILD=cygwin
;;
Darwin)
@@ -198,7 +198,7 @@ if [ -z "$BUILD" ]; then
eval $(cat /etc/os-release | grep ^ID)
case $ID in
fedora)
fedora|rhel|centos|foobar)
BUILD=redhat
;;
debian)
@@ -329,9 +329,13 @@ if [ -n "${SYSCONFDIR}" ]; then
chmod 755 ${DESTDIR}${SYSCONFDIR}
fi
if [ -n "${SYSTEMD}" ]; then
mkdir -p ${DESTDIR}${SYSTEMD}
chmod 755 ${DESTDIR}${SYSTEMD}
if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD"
fi
if [ -n "${SERVICEDIR}" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR}
chmod 755 ${DESTDIR}${SERVICEDIR}
fi
mkdir -p ${DESTDIR}${SBINDIR}

View File

@@ -252,7 +252,15 @@ show_classifiers() {
if [ -n "$qdisc" ]; then
echo Device $device:
tc -s filter ls dev $device
qt tc -s filter ls root dev $device && tc -s filter ls root dev $device | grep -v '^$'
tc filter show dev $device
tc class show dev $device | fgrep 'leaf ' | fgrep -v ' hfsc' | sed 's/^.*leaf //;s/ .*//' | while read class; do
if [ -n "$class" ]; then
echo
echo Node $class
tc filter show dev $device parent $class
fi
done
echo
fi
}
@@ -263,6 +271,19 @@ show_classifiers() {
}
#
# Display blacklist chains
#
show_bl() {
$g_tool -L $g_ipt_options | \
awk 'BEGIN {prnt=0; };
/^$/ {if (prnt == 1) print ""; prnt=0; };
/Chain .*~ / {prnt=1; };
/Chain dynamic / {prnt=1; };
{if (prnt == 1) print; };
END {if (prnt == 1 ) print "" };'
}
#
# Watch the Firewall Log
#
@@ -346,6 +367,17 @@ resolve_arptables() {
esac
}
#
# Try to run the 'savesets' command
#
savesets() {
local supported
supported=$(run_it ${VARDIR}/firewall help | fgrep savesets )
[ -n "$supported" ] && run_it ${VARDIR}/firewall savesets ${g_restorepath}-ipsets
}
#
# Save currently running configuration
#
@@ -407,45 +439,47 @@ do_save() {
;;
esac
case ${SAVE_IPSETS:=No} in
[Yy]es)
case ${IPSET:=ipset} in
*/*)
if [ ! -x "$IPSET" ]; then
error_message "ERROR: IPSET=$IPSET does not exist or is not executable - ipsets are not saved"
IPSET=
if ! savesets; then
case ${SAVE_IPSETS:=No} in
[Yy]es)
case ${IPSET:=ipset} in
*/*)
if [ ! -x "$IPSET" ]; then
error_message "ERROR: IPSET=$IPSET does not exist or is not executable - ipsets are not saved"
IPSET=
fi
;;
*)
IPSET="$(mywhich $IPSET)"
[ -n "$IPSET" ] || error_message "ERROR: The ipset utility cannot be located - ipsets are not saved"
;;
esac
if [ -n "$IPSET" ]; then
if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then
#
# The 'grep -v' is a hack for a bug in ipset's nethash implementation when xtables-addons is applied to Lenny
#
hack='| grep -v /31'
else
hack=
fi
;;
*)
IPSET="$(mywhich $IPSET)"
[ -n "$IPSET" ] || error_message "ERROR: The ipset utility cannot be located - ipsets are not saved"
;;
esac
if [ -n "$IPSET" ]; then
if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then
#
# The 'grep -v' is a hack for a bug in ipset's nethash implementation when xtables-addons is applied to Lenny
#
hack='| grep -v /31'
else
hack=
if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then
#
# Don't save an 'empty' file
#
grep -qE -- '^(-N|create )' ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${g_restorepath}-ipsets
fi
fi
if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then
#
# Don't save an 'empty' file
#
grep -qE -- '^(-N|create )' ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${g_restorepath}-ipsets
fi
fi
;;
[Nn]o)
;;
*)
error_message "WARNING: Invalid value ($SAVE_IPSETS) for SAVE_IPSETS"
;;
esac
;;
[Nn]o)
;;
*)
error_message "WARNING: Invalid value ($SAVE_IPSETS) for SAVE_IPSETS"
;;
esac
fi
return $status
}
@@ -459,6 +493,8 @@ save_config() {
[ -x $iptables_save ] || echo "$iptables-save does not exist or is not executable" >&2
[ -n "$g_counters" ] && iptables_save="$iptables_save --counters"
if product_is_started ; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
@@ -1181,7 +1217,13 @@ show_command() {
echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)"
echo
show_events
;;
;;
bl|blacklists)
[ $# -gt 1 ] && usage 1
echo "$g_product $SHOREWALL_VERSION blacklist chains at $g_hostname - $(date)"
echo
show_bl;
;;
*)
case "$g_program" in
*-lite)
@@ -1443,10 +1485,22 @@ do_dump_command() {
$g_tool -t rawpost -L $g_ipt_options
fi
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
local count
local max
heading "Conntrack Table ($count out of $max)"
if [ -f /proc/sys/net/netfilter/nf_conntrack_count ]; then
count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
heading "Conntrack Table ($count out of $max)"
elif [ -f /proc/sys/net/ipv4/netfilter/ip_conntrack_count ]; then
count=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_count)
max=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max)
heading "Conntrack Table ($count out of $max)"
else
heading "Conntrack Table"
fi
if [ $g_family -eq 4 ]; then
[ -f /proc/net/ip_conntrack ] && cat /proc/net/ip_conntrack || grep -v '^ipv6' /proc/net/nf_conntrack
@@ -1572,6 +1626,15 @@ restore_command() {
g_noroutes=Yes
option=${option#n}
;;
p*)
[ -n "$(which conntrack)" ] || fatal_error "The '-p' option requires the conntrack utility which does not appear to be installed on this system"
g_purge=Yes
option=${option%p}
;;
C*)
g_counters=Yes
option=${option#C}
;;
*)
usage 1
;;
@@ -2944,9 +3007,74 @@ show_status() {
}
interface_status() {
case $(cat $1) in
0)
echo Enabled
;;
1)
echo Disabled
;;
*)
echo Unknown
;;
esac
}
show_interfaces() {
local f
local interface
local printed
for f in ${VARDIR}/*.status; do
interface=$(basename $f)
echo " Interface ${interface%.status} is $(interface_status $f)"
printed=Yes
done
[ -n "$printed" ] && echo
}
status_command() {
local finished
finished=0
local option
local interfaces
while [ $finished -eq 0 -a $# -gt 0 ]; do
option=$1
case $option in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
-)
finished=1
option=
;;
i*)
interfaces=Yes
option=${option#i}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
[ $# -eq 0 ] || usage 1
[ $VERBOSITY -ge 1 ] && echo "${g_product}-$SHOREWALL_VERSION Status at $g_hostname - $(date)" && echo
show_status
[ -n "$interfaces" ] && show_interfaces
exit $status
}
@@ -2991,11 +3119,45 @@ reject_command() {
}
save_command() {
local finished
finished=0
shift
while [ $finished -eq 0 -a $# -gt 0 ]; do
option=$1
case $option in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
-)
finished=1
option=
;;
C*)
g_counters=Yes
option=${option#C}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
case $# in
1)
0)
;;
2)
RESTOREFILE="$2"
1)
RESTOREFILE="$1"
validate_restorefile '<restore file>'
;;
*)
@@ -3290,7 +3452,11 @@ start_command() {
[ -n "$g_nolock" ] || mutex_on
if [ -x ${VARDIR}/firewall ]; then
run_it ${VARDIR}/firewall $g_debugging start
if [ -n "$g_fast" -a -x ${VARDIR}/${RESTOREFILE} -a ! ${VARDIR}/firewall -nt ${VARDIR}/${RESTOREFILE} ]; then
run_it ${VARDIR}/${RESTOREFILE} $g_debugging restore
else
run_it ${VARDIR}/firewall $g_debugging start
fi
rc=$?
else
error_message "${VARDIR}/firewall is missing or is not executable"
@@ -3326,6 +3492,14 @@ start_command() {
finished=1
option=
;;
f*)
g_fast=Yes
option=${option#f}
;;
C*)
g_counters=Yes
option=${option#C}
;;
p*)
[ -n "$(which conntrack)" ] || fatal_error "The '-p' option requires the conntrack utility which does not appear to be installed on this system"
g_purge=Yes
@@ -3387,6 +3561,10 @@ restart_command() {
g_purge=Yes
option=${option%p}
;;
C*)
g_counters=Yes
option=${option#C}
;;
*)
usage 1
;;
@@ -3423,6 +3601,14 @@ restart_command() {
return $rc
}
run_command() {
if [ -x ${VARDIR}/firewall ] ; then
run_it ${VARDIR}/firewall $g_debugging $@
else
fatal_error "${VARDIR}/firewall does not exist or is not executable"
fi
}
#
# Give Usage Information
#
@@ -3452,12 +3638,14 @@ usage() # $1 = exit status
echo " logwatch [<refresh interval>]"
echo " reject <address> ..."
echo " reset [ <chain> ... ]"
echo " restart [ -n ] [ -p ] [ -f ] [ <directory> ]"
echo " restore [ -n ] [ <file name> ]"
echo " save [ <file name> ]"
echo " restart [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]"
echo " restore [ -n ] [ -p ] [ -C ] [ <file name> ]"
echo " run <command> [ <parameter> ... ]"
echo " save [ -C ] [ <file name> ]"
echo " [ show | list | ls ] [ -b ] [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]"
echo " [ show | list | ls ] [ -f ] capabilities"
echo " [ show | list | ls ] arptables"
echo " [ show | list | ls ] [ -x ] {bl|blacklists}"
echo " [ show | list | ls ] classifiers"
echo " [ show | list | ls ] config"
echo " [ show | list | ls ] connections"
@@ -3478,9 +3666,9 @@ usage() # $1 = exit status
echo " [ show | list | ls ] tc [ device ]"
echo " [ show | list | ls ] vardir"
echo " [ show | list | ls ] zones"
echo " start [ -f ] [ -p ] [ <directory> ]"
echo " start [ -f ] [ -p ] [ -C ] [ <directory> ]"
echo " stop"
echo " status"
echo " status [ -i ]"
echo " version [ -a ]"
echo
exit $1
@@ -3530,6 +3718,7 @@ shorewall_cli() {
g_directives=
g_inline=
g_tcrules=
g_counters=
VERBOSE=
VERBOSITY=1
@@ -3725,16 +3914,21 @@ shorewall_cli() {
fatal_error "$g_product is not running"
fi
;;
run)
[ $# -gt 1 ] || fatal_error "Missing function name"
get_config Yes
run_command $@
;;
show|list|ls)
get_config Yes No Yes
shift
show_command $@
;;
status)
[ $# -eq 1 ] || usage 1
[ "$(id -u)" != 0 ] && fatal_error "The status command may only be run by root"
get_config
status_command
shift
status_command $@
;;
dump)
get_config Yes No Yes

View File

@@ -157,6 +157,7 @@ run_it() {
[ -n "$g_timestamp" ] && options=${options}t
[ -n "$g_purge" ] && options=${options}p
[ -n "$g_recovering" ] && options=${options}r
[ -n "$g_counters" ] && options=${options}c
options="${options}V $VERBOSITY"
@@ -172,6 +173,7 @@ run_it() {
error_message() # $* = Error Message
{
echo " $@" >&2
return 1
}
#

View File

@@ -14,7 +14,7 @@ INITDIR= #Unused on OS X
INITFILE= #Unused on OS X
INITSOURCE= #Unused on OS X
ANNOTATED= #Unused on OS X
SYSTEMD= #Unused on OS X
SYSTEMDDIR= #Unused on OS X
SERVICEFILE= #Unused on OS X
SYSCONFDIR= #Unused on OS X
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.

View File

@@ -15,7 +15,7 @@ INITFILE= #Name of the product's installed SysV ini
INITSOURCE= #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed
SYSCONFDIR= #Directory where SysV init parameter files are installed
SYSTEMD=/usr/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
SYSTEMDDIR=/usr/lib/systemd/system #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=/var/lib #Directory where product variable data is stored.

View File

@@ -14,7 +14,7 @@ INITDIR=/etc/init.d #Unused on Cygwin
INITFILE= #Unused on Cygwin
INITSOURCE= #Unused on Cygwin
ANNOTATED= #Unused on Cygwin
SYSTEMD= #Unused on Cygwin
SYSTEMDDIR= #Unused on Cygwin
SERVICEFILE= #Unused on Cygwin
SYSCONFDIR= #Unused on Cygwin
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.

View File

@@ -17,7 +17,7 @@ ANNOTATED= #If non-zero, annotated configuration fi
SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
SYSTEMD= #Directory where .service files are installed (systems running systemd only)
SYSTEMDDIR= #Directory where .service files are installed (systems running systemd only)
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
VARLIB=/var/lib #Directory where product variable data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.

View File

@@ -14,7 +14,7 @@ INITDIR=/etc/init.d #Directory where SysV init scripts are i
INITFILE=$PRODUCT #Name of the product's installed SysV init script
INITSOURCE=init.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed
SYSTEMD= #Directory where .service files are installed (systems running systemd only)
SYSTEMDDIR= #Directory where .service files are installed (systems running systemd only)
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR
SYSCONFDIR= #Directory where SysV init parameter files are installed

View File

@@ -14,7 +14,7 @@ INITDIR=/etc/rc.d/init.d #Directory where SysV init scripts are i
INITFILE=$PRODUCT #Name of the product's installed SysV init script
INITSOURCE=init.fedora.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed
SYSTEMD=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
SYSTEMDDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
SYSCONFFILE=sysconfig #Name of the distributed file to be installed as $SYSCONFDIR/$PRODUCT
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed

View File

@@ -15,7 +15,7 @@ AUXINITSOURCE=init.slackware.firewall.sh #Name of the distributed file to be i
AUXINITFILE=rc.firewall #Name of the product's installed SysV init script
INITSOURCE=init.slackware.$PRODUCT.sh #Name of the distributed file to be installed as a second SysV init script
INITFILE=rc.$PRODUCT #Name of the product's installed second init script
SYSTEMD= #Name of the directory where .service files are installed (systems running systemd only)
SYSTEMDDIR= #Name of the directory where .service files are installed (systems running systemd only)
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR
SYSCONFDIR= #Name of the directory where SysV init parameter files are installed.

View File

@@ -8,13 +8,13 @@ CONFDIR=/etc #Directory where subsystem
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
LIBEXECDIR=${PREFIX}/lib #Directory for executable scripts.
PERLLIBDIR=${PREFIX}/lib/perl5/vendor_perl/5.14.2 #Directory to install Shorewall Perl module directory
SBINDIR=/sbin #Directory where system administration programs are installed
SBINDIR=/usr/sbin #Directory where system administration programs are installed
MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed.
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
INITFILE=$PRODUCT #Name of the product's SysV init script
INITSOURCE=init.suse.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed
SYSTEMD= #Directory where .service files are installed (systems running systemd only)
SYSTEMDDIR= #Directory where .service files are installed (systems running systemd only)
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFFILE=sysconfig #Name of the distributed file to be installed in $SYSCONFDIR
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed

View File

@@ -105,24 +105,35 @@ shorewall_start () {
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/$PRODUCT/firewall ]; then
if [ -x ${STATEDIR}/firewall ]; then
#
# Run in a sub-shell to avoid name collisions
#
(
if ! ${STATEDIR}/$PRODUCT/firewall status > /dev/null 2>&1; then
${STATEDIR}/$PRODUCT/firewall ${OPTIONS} stop || echo_notdone
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop || echo_notdone
else
echo_notdone
fi
)
else
echo echo_notdone
echo_notdone
fi
done
echo "done."
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
echo -n "Restoring ipsets: "
if ! ipset -R < "$SAVE_IPSETS"; then
echo_notdone
fi
echo "done."
fi
return 0
}
@@ -135,13 +146,27 @@ shorewall_stop () {
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/$PRODUCT/firewall ]; then
${STATEDIR}/$PRODUCT/firewall ${OPTIONS} clear || echo_notdone
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear || echo_notdone
fi
done
echo "done."
if [ -n "$SAVE_IPSETS" ]; then
echo "Saving ipsets: "
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"
else
echo_notdone
fi
echo "done."
fi
return 0
}

View File

@@ -35,6 +35,7 @@ usage() # $1 = exit status
echo "usage: $ME [ <configuration-file> ]"
echo " $ME -v"
echo " $ME -h"
echo " $ME -n"
exit $1
}
@@ -105,9 +106,12 @@ PRODUCT=shorewall-init
T='-T'
finished=0
configure=1
while [ $finished -eq 0 ] ; do
case "$1" in
option="$1"
case "$option" in
-*)
option=${option#-}
@@ -120,6 +124,10 @@ while [ $finished -eq 0 ] ; do
echo "Shorewall-init Firewall Installer Version $VERSION"
exit 0
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
@@ -176,6 +184,8 @@ for var in SHAREDIR LIBEXECDIR CONFDIR SBINDIR VARLIB VARDIR; do
require $var
done
[ -n "$SANDBOX" ] && configure=0
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
if [ -z "$BUILD" ]; then
@@ -191,7 +201,7 @@ if [ -z "$BUILD" ]; then
eval $(cat /etc/os-release | grep ^ID=)
case $ID in
fedora)
fedora|rhel|centos|foobar)
BUILD=redhat
;;
debian|ubuntu)
@@ -306,6 +316,7 @@ fi
# Install the Firewall Script
#
if [ -n "$INITFILE" ]; then
mkdir -p ${DESTDIR}${INITDIR}
install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE
@@ -319,13 +330,17 @@ fi
#
# Install the .service file
#
if [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}${SYSTEMD}
if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD"
fi
if [ -n "$SERVICEDIR" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR}
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SYSTEMD}/$PRODUCT.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SYSTEMD}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SYSTEMD}/$PRODUCT.service"
if [ -n "$DESTDIR" ]; then
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
[ ${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}
fi
@@ -366,14 +381,24 @@ if [ $HOST = debian ]; then
if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}/etc/network/if-up.d/
mkdir -p ${DESTDIR}/etc/network/if-down.d/
mkdir -p ${DESTDIR}/etc/network/if-post-down.d/
elif [ $configure -eq 0 ]; then
mkdir -p ${DESTDIR}${CONFDIR}/network/if-up.d/
mkdir -p ${DESTDIR}${CONFDIR}/network/if-down.d/
mkdir -p ${DESTDIR}${CONFDIR}/network/if-post-down.d/
fi
if [ ! -f ${DESTDIR}/etc/default/shorewall-init ]; then
if [ ! -f ${DESTDIR}${CONFDIR}/default/shorewall-init ]; then
if [ -n "${DESTDIR}" ]; then
mkdir ${DESTDIR}/etc/default
fi
install_file sysconfig ${DESTDIR}/etc/default/shorewall-init 0644
if [ $configure -eq 1 ]; then
install_file sysconfig ${DESTDIR}/etc/default/shorewall-init 0644
else
mkdir -p ${DESTDIR}${CONFDIR}/default
install_file sysconfig ${DESTDIR}${CONFDIR}/default/shorewall-init 0644
fi
fi
IFUPDOWN=ifupdown.debian.sh
@@ -384,7 +409,7 @@ else
if [ -z "$RPM" ]; then
if [ $HOST = suse ]; then
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-up.d
mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-down.d
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-down.d
elif [ $HOST = gentoo ]; then
# Gentoo does not support if-{up,down}.d
/bin/true
@@ -415,17 +440,33 @@ mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
install_file ifupdown ${DESTDIR}/etc/NetworkManager/dispatcher.d/01-shorewall 0544
if [ $configure -eq 1 ]; then
install_file ifupdown ${DESTDIR}/etc/NetworkManager/dispatcher.d/01-shorewall 0544
else
mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/
install_file ifupdown ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/01-shorewall 0544
fi
fi
case $HOST in
debian)
install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-down.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
if [ $configure -eq 1 ]; then
install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-down.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
else
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-down.d/shorewall 0544
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-post-down.d/shorewall 0544
fi
;;
suse)
if [ -z "$RPM" ]; then
if [ $configure -eq 0 ]; then
mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-up.d/
mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-down.d/
fi
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-down.d/shorewall 0544
fi
@@ -453,7 +494,7 @@ case $HOST in
esac
if [ -z "$DESTDIR" ]; then
if [ -n "$first_install" ]; then
if [ $configure -eq 1 -a -n "$first_install" ]; then
if [ $HOST = debian ]; then
if mywhich insserv; then
if insserv ${INITDIR}/shorewall-init; then
@@ -476,7 +517,7 @@ if [ -z "$DESTDIR" ]; then
# not by the installer
/bin/true
else
if [ -n "$SYSTEMD" ]; then
if [ -n "$SERVICEDIR" ]; then
if systemctl enable shorewall-init.service; then
echo "Shorewall Init will start automatically at boot"
fi
@@ -505,7 +546,7 @@ if [ -z "$DESTDIR" ]; then
fi
fi
else
if [ -n "$first_install" ]; then
if [ $configure -eq 1 -a -n "$first_install" ]; then
if [ $HOST = debian ]; then
if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}/etc/rcS.d

View File

@@ -63,18 +63,19 @@ shorewall_start () {
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/$PRODUCT/firewall ]; then
if [ -x ${STATEDIR}/firewall ]; then
#
# Run in a sub-shell to avoid name collisions
#
(
if ! ${STATEDIR}/$PRODUCT/firewall status > /dev/null 2>&1; then
${STATEDIR}/$PRODUCT/firewall ${OPTIONS} stop || exit 1
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop || exit 1
else
exit 1
fi
)
else
echo ERROR: ${STATEDIR}/firewall does not exist or is not executable!
exit 1
fi
done
@@ -95,8 +96,8 @@ shorewall_stop () {
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/$PRODUCT/firewall ]; then
${STATEDIR}/$PRODUCT/firewall ${OPTIONS} clear || exit 1
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear || exit 1
fi
done

View File

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

View File

@@ -0,0 +1,21 @@
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
#
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
#
[Unit]
Description=Shorewall IPv4 firewall (bootup security)
Before=network-pre.target
Wants=network-pre.target
Conflicts=iptables.service firewalld.service
[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,4 +1,4 @@
\#!/bin/sh
#!/bin/sh
#
# Script to back uninstall Shoreline Firewall
#
@@ -69,6 +69,42 @@ remove_file() # $1 = file to restore
fi
}
finished=0
configure=1
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Installer Version $VERSION"
exit 0
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
#
# Read the RC file
#
@@ -114,22 +150,29 @@ fi
echo "Uninstalling Shorewall Init $VERSION"
[ -n "$SANDBOX" ] && configure=0
INITSCRIPT=${CONFDIR}/init.d/shorewall-init
if [ -f "$INITSCRIPT" ]; then
if mywhich updaterc.d ; then
updaterc.d shorewall-init remove
elif mywhich insserv ; then
insserv -r $INITSCRIPT
elif mywhich chkconfig ; then
chkconfig --del $(basename $INITSCRIPT)
elif mywhich systemctl ; then
systemctl disable shorewall-init
if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then
updaterc.d shorewall-init remove
elif mywhich insserv ; then
insserv -r $INITSCRIPT
elif mywhich chkconfig ; then
chkconfig --del $(basename $INITSCRIPT)
fi
fi
remove_file $INITSCRIPT
fi
if [ -n "$SYSTEMD" ]; then
[ $configure -eq 1 ] && systemctl disable shorewall-init.service
rm -f $SYSTEMD/shorewall-init.service
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
@@ -159,8 +202,9 @@ if [ -d ${CONFDIR}/ppp ]; then
done
fi
rm -f ${SBINDIR}/shorewall-init
rm -rf ${SHAREDIR}/shorewall-init
rm -rf ${LIBEXEC}/shorewall-init
rm -rf ${LIBEXECDIR}/shorewall-init
echo "Shorewall Init Uninstalled"

View File

@@ -39,7 +39,7 @@ fi
start() {
echo -n $"Starting Shorewall: "
$shorewall $OPTIONS start 2>&1 | $logger
$shorewall $OPTIONS start $STARTOPTIONS 2>&1 | $logger
retval=${PIPESTATUS[0]}
if [[ $retval == 0 ]]; then
touch $lockfile
@@ -69,7 +69,7 @@ restart() {
# Note that we don't simply stop and start since shorewall has a built in
# restart which stops the firewall if running and then starts it.
echo -n $"Restarting Shorewall: "
$shorewall $OPTIONS restart 2>&1 | $logger
$shorewall $OPTIONS restart $RESTARTOPTIONS 2>&1 | $logger
retval=${PIPESTATUS[0]}
if [[ $retval == 0 ]]; then
touch $lockfile

View File

@@ -30,6 +30,7 @@ usage() # $1 = exit status
echo "usage: $ME [ <configuration-file> ]"
echo " $ME -v"
echo " $ME -h"
echo " $ME -n"
exit $1
}
@@ -113,9 +114,13 @@ fi
# Parse the run line
#
finished=0
configure=1
while [ $finished -eq 0 ] ; do
case "$1" in
option=$1
case "$option" in
-*)
option=${option#-}
@@ -128,6 +133,10 @@ while [ $finished -eq 0 ] ; do
echo "$Product Firewall Installer Version $VERSION"
exit 0
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
@@ -186,6 +195,8 @@ done
PATH=${SBINDIR}:/bin:/usr${SBINDIR}:/usr/bin:/usr/local/bin:/usr/local${SBINDIR}
[ -n "$SANDBOX" ] && configure=0
#
# Determine where to install the firewall script
#
@@ -195,7 +206,7 @@ T='-T'
if [ -z "$BUILD" ]; then
case $(uname) in
cygwin*)
cygwin*|CYGWIN*)
BUILD=cygwin
;;
Darwin)
@@ -206,7 +217,7 @@ if [ -z "$BUILD" ]; then
eval $(cat /etc/os-release | grep ^ID)
case $ID in
fedora)
fedora|rhel|centos|foobar)
BUILD=redhat
;;
debian)
@@ -242,7 +253,7 @@ if [ -z "$BUILD" ]; then
fi
case $BUILD in
cygwin*)
cygwin*|CYGWIN*)
OWNER=$(id -un)
GROUP=$(id -gn)
;;
@@ -346,6 +357,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}
echo "$Product control program installed in ${DESTDIR}${SBINDIR}/$PRODUCT"
@@ -358,7 +370,7 @@ mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT
mkdir -p ${DESTDIR}${VARDIR}
chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT
chmod 755 ${DESTDIR}/usr/share/$PRODUCT
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT
if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
@@ -380,12 +392,16 @@ fi
#
# Install the .service file
#
if [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}${SYSTEMD}
if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD"
fi
if [ -n "$SERVICEDIR" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR}
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SYSTEMD}/$PRODUCT.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SYSTEMD}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SYSTEMD}/$PRODUCT.service"
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
fi
#
# Install the config file
@@ -466,18 +482,18 @@ done
if [ -d manpages ]; then
cd manpages
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${SHAREDIR}/man/man5/ ${DESTDIR}${SHAREDIR}/man/man8/
[ -n "$INSTALLD" ] || 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}${SHAREDIR}/man/man5/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}${SHAREDIR}/man/man5/$f.gz"
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz
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}${SHAREDIR}/man/man8/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}${SHAREDIR}/man/man8/$f.gz"
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
done
cd ..
@@ -499,7 +515,7 @@ chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
# Remove and create the symbolic link to the init script
#
if [ -z "$DESTDIR" ]; then
if [ -z "${DESTDIR}" -a -n "${INITFILE}" ]; then
rm -f ${SHAREDIR}/$PRODUCT/init
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/$PRODUCT/init
fi
@@ -526,8 +542,8 @@ if [ ${SHAREDIR} != /usr/share ]; then
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SBINDIR}/$PRODUCT
fi
if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
if [ -n "$SYSTEMD" ]; then
if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
if [ -n "$SERVICEDIR" ]; then
if systemctl enable ${PRODUCT}.service; then
echo "$Product will start automatically at boot"
fi

View File

@@ -299,7 +299,7 @@
<arg><option>-n</option></arg>
<arg><option>-p</option></arg>
<arg><option>-p</option><arg><option>-C</option></arg></arg>
<arg><replaceable>directory</replaceable></arg>
</cmdsynopsis>
@@ -314,6 +314,8 @@
<arg choice="plain"><option>restore</option></arg>
<arg><option>-C</option></arg>
<arg><replaceable>filename</replaceable></arg>
</cmdsynopsis>
@@ -325,7 +327,23 @@
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>save</option></arg>
<arg choice="plain"><option>run</option></arg>
<arg choice="plain">function</arg>
<arg><replaceable>parameter ...</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
<arg
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
<arg>-<replaceable>options</replaceable></arg>
<arg
choice="plain"><option>save</option><arg><option>-C</option></arg></arg>
<arg choice="opt"><replaceable>filename</replaceable></arg>
</cmdsynopsis>
@@ -352,6 +370,20 @@
rep="repeat"><replaceable>chain</replaceable></arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
<arg>-<replaceable>options</replaceable></arg>
<arg choice="opt"><option>show | list | ls </option></arg>
<arg><option>-x</option></arg>
<arg choice="plain"><option>{bl|blacklists}</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
@@ -445,6 +477,10 @@
<arg><option>-n</option></arg>
<arg><option>-p</option></arg>
<arg><option>-f</option></arg>
<arg><option>-C</option></arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -465,7 +501,8 @@
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>status</option></arg>
<arg choice="plain"><arg
choice="plain"><option>status</option><arg><option>-i</option></arg></arg></arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -496,8 +533,9 @@
<para>The nolock <option>option</option> prevents the command from
attempting to acquire the Shorewall-lite lockfile. It is useful if you
need to include <command>shorewall</command> commands in
<filename>/etc/shorewall/started</filename>.</para>
need to include <command>shorewall</command> commands in the
<filename>started</filename> <ulink
url="../shorewall_extension_scripts.html">extension script</ulink>.</para>
<para>The <emphasis>options</emphasis> control the amount of output that
the command produces. They consist of a sequence of the letters <emphasis
@@ -508,8 +546,8 @@
role="bold">v</emphasis> adds one to the effective verbosity and each
<emphasis role="bold">q</emphasis> subtracts one from the effective
VERBOSITY. Alternately, <emphasis role="bold">v</emphasis> may be followed
immediately with one of -1,0,1,2 to specify a specify VERBOSITY. There may
be no white-space between <emphasis role="bold">v</emphasis> and the
immediately with one of -1,0,1,2 to specify VERBOSITY. There may be no
white-space between <emphasis role="bold">v</emphasis> and the
VERBOSITY.</para>
<para>The <emphasis>options</emphasis> may also include the letter
@@ -789,6 +827,12 @@
<para>The <option>-p</option> option causes the connection tracking
table to be flushed; the <command>conntrack</command> utility must
be installed to use this option.</para>
<para>The <option>-C</option> option was added in Shorewall 4.6.5.
If the specified (or implicit) firewall script is the one that
generated the current running configuration, then the running
netfilter configuration will be reloaded as is so as to preserve the
iptables packet and byte counters.</para>
</listitem>
</varlistentry>
@@ -804,6 +848,36 @@
<emphasis>filename</emphasis> is given then Shorewall-lite will be
restored from the file specified by the RESTOREFILE option in <ulink
url="shorewall.conf.html">shorewall.conf</ulink>(5).</para>
<caution>
<para>If your iptables ruleset depends on variables that are
detected at run-time, either in your params file or by
Shorewall-generated code, <command>restore</command> will use the
values that were current when the ruleset was saved, which may be
different from the current values.</para>
</caution>
<para>The <option>-C</option> option was added in Shorewall 4.6.5.
If the <option>-C</option> option was specified during <emphasis
role="bold">shorewall save</emphasis>, then the counters saved by
that operation will be restored.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">run</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.3. Executes
<replaceable>command</replaceable> in the context of the generated
script passing the supplied <replaceable>parameter</replaceable>s.
Normally, the <replaceable>command</replaceable> will be a function
declared in <filename>lib.private</filename>.</para>
<para>Before executing the <replaceable>command</replaceable>, the
script will detect the configuration, setting all SW_* variables and
will run your <filename>init</filename> extension script with
$COMMAND = 'run'.</para>
</listitem>
</varlistentry>
@@ -818,6 +892,10 @@
<emphasis>filename</emphasis> is not given then the state is saved
in the file specified by the RESTOREFILE option in <ulink
url="shorewall.conf.html">shorewall.conf</ulink>(5).</para>
<para>The <option>-C</option> option, added in Shorewall 4.6.5,
causes the iptables packet and byte counters to be saved along with
the chains and rules.</para>
</listitem>
</varlistentry>
@@ -829,6 +907,19 @@
arguments:</para>
<variablelist>
<varlistentry>
<term><emphasis role="bold">bl|blacklists</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.2. Displays the dynamic chain
along with any chains produced by entries in
shorewall-blrules(5).The <emphasis role="bold">-x</emphasis>
option is passed directly through to iptables and causes
actual packet and byte counts to be displayed. Without this
option, those counts are abbreviated.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">capabilities</emphasis></term>
@@ -1042,6 +1133,22 @@
<para>The <option>-p</option> option causes the connection tracking
table to be flushed; the <command>conntrack</command> utility must
be installed to use this option.</para>
<para>The <option>-m</option> option prevents the firewall script
from modifying the current routing configuration.</para>
<para>The <option>-f</option> option was added in Shorewall 4.6.5.
If the RESTOREFILE named in <ulink
url="shorewall.conf.html">shorewall.conf</ulink>(5) exists, is
executable and is not older than the current filewall script, then
that saved configuration is restored.</para>
<para>The <option>-C</option> option was added in Shorewall 4.6.5
and is only meaningful when the <option>-f</option> option is also
specified. If the previously-saved configuration is restored, and if
the <option>-C</option> option was also specified in the <emphasis
role="bold">save</emphasis> command, then the packet and byte
counters will be restored.</para>
</listitem>
</varlistentry>
@@ -1073,6 +1180,10 @@
<listitem>
<para>Produces a short report about the state of the
Shorewall-configured firewall.</para>
<para>The <option>-i </option>option was added in Shorewall 4.6.2
and causes the status of each optional or provider interface to be
displayed.</para>
</listitem>
</varlistentry>

View File

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

View File

@@ -0,0 +1,20 @@
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall
#
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
#
[Unit]
Description=Shorewall IPv4 firewall (lite)
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

View File

@@ -27,11 +27,16 @@
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall-lite
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME [ <shorewallrc file> ]"
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo "where <option> is one of"
echo " -h"
echo " -v"
echo " -n"
exit $1
}
@@ -69,6 +74,42 @@ remove_file() # $1 = file to restore
fi
}
finished=0
configure=1
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Installer Version $VERSION"
exit 0
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
#
# Read the RC file
#
@@ -112,8 +153,12 @@ fi
echo "Uninstalling Shorewall Lite $VERSION"
if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then
shorewall-lite clear
[ -n "$SANDBOX" ] && configure=0
if [ $configure -eq 1 ]; then
if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then
shorewall-lite clear
fi
fi
if [ -L ${SHAREDIR}/shorewall-lite/init ]; then
@@ -123,28 +168,34 @@ elif [ -n "$INITFILE" ]; then
fi
if [ -f "$FIREWALL" ]; then
if mywhich updaterc.d ; then
updaterc.d shorewall-lite remove
elif mywhich insserv ; then
insserv -r $FIREWALL
elif [ mywhich chkconfig ; then
chkconfig --del $(basename $FIREWALL)
elif mywhich systemctl ; then
systemctl disable shorewall-lite
if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then
updaterc.d shorewall-lite remove
elif mywhich insserv ; then
insserv -r $FIREWALL
elif mywhich chkconfig ; then
chkconfig --del $(basename $FIREWALL)
fi
fi
remove_file $FIREWALL
fi
if [ -n "$SYSTEMD" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
rm -f $SYSTEMD/shorewall-lite.service
fi
rm -f ${SBINDIR}/shorewall-lite
rm -rf ${SBINDIR}/shorewall-lite
rm -rf ${CONFDIR}/shorewall-lite
rm -rf ${VARDIR}/shorewall-lite
rm -rf ${SHAREDIR}/shorewall-lite
rm -rf ${LIBEXEC}/shorewall-lite
rm -rf ${LIBEXECDIR}/shorewall-lite
rm -f ${CONFDIR}/logrotate.d/shorewall-lite
[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/shorewall-lite.service
rm -f ${MANDIR}/man5/shorewall-lite*
rm -f ${MANDIR}/man8/shorewall-lite*
echo "Shorewall Lite Uninstalled"

View File

@@ -0,0 +1,14 @@
#
# Shorewall version 4 - AMQP Macro
#
# /usr/share/shorewall/macro.AMQP
#
# This macro handles AMQP traffic.
#
###############################################################################
?FORMAT 2
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
PARAM - - tcp 5672
PARAM - - udp 5672

View File

@@ -14,7 +14,7 @@
# PORT(S) PORT(S) DEST LIMIT GROUP
?if ( __CT_TARGET && ! $AUTOHELPERS && __AMANDA_HELPER )
PARAM - - udp 10080 ; helper=amanda
PARAM - - udp 10080 { helper=amanda }
?else
PARAM - - udp 10080
?endif

View File

@@ -11,7 +11,7 @@
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
?if ( __CT_TARGET && ! $AUTOHELPERS && __FTP_HELPER )
PARAM - - tcp 21 ; helper=ftp
PARAM - - tcp 21 { helper=ftp }
?else
PARAM - - tcp 21
?endif

View File

@@ -0,0 +1,12 @@
#
# Shorewall version 4 - Citrix/Goto Meeting macro
#
# /usr/share/shorewall/macro.Goto-Meeting
# by Eric Teeter
# This macro handles Citrix/Goto Meeting
# Assumes that ports 80 and 443 are already open
# If needed, use the macros that open Http and Https to reduce redundancy
####################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 8200 # Goto Meeting only needed (TCP outbound)

View File

@@ -0,0 +1,23 @@
#
# Shorewall version 4 - ILO Macro
#
# /usr/share/shorewall/macro.ILO
#
# This macro handles console redirection with HP ILO 2+,
# Use this macro to open access to your ILO interface from management
# workstations.
#
###############################################################################
?FORMAT 2
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
PARAM - - tcp 3002 # Raw serial data
PARAM - - tcp 9300 # Shared Remote Console
PARAM - - tcp 17988 # Virtual Media
PARAM - - tcp 17990 # Console Replay
HTTP
HTTPS
RDP
SSH
Telnet # Remote Console/Telnet

View File

@@ -0,0 +1,26 @@
#
# Shorewall version 4 - IPMI Macro
#
# /usr/share/shorewall/macro.IPMI
#
# This macro handles IPMI console redirection with Asus (AMI),
# Dell DRAC5+ (Avocent), and Supermicro (Aten or AMI).
# Use this macro to open access to your IPMI interface from management
# workstations.
#
###############################################################################
?FORMAT 2
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
PARAM - - tcp 623 # RMCP
PARAM - - tcp 3668,3669 # Virtual Media, Secure (Dell)
PARAM - - tcp 5120,5123 # CD, floppy (Asus, Aten)
PARAM - - tcp 5900,5901 # Remote Console (Aten, Dell)
PARAM - - tcp 7578 # Remote Console (AMI)
PARAM - - udp 623 # RMCP
HTTP
HTTPS
SNMP
SSH # Serial over Lan
Telnet

View File

@@ -12,7 +12,7 @@
# PORT(S) PORT(S) DEST LIMIT GROUP
?if ( __CT_TARGET && ! $AUTOHELPERS && __IRC_HELPER )
PARAM - - tcp 6667 ; helper=irc
PARAM - - tcp 6667 { helper=irc }
?else
PARAM - - tcp 6667
?endif

View File

@@ -0,0 +1,13 @@
#
# Shorewall version 4 - MongoDB Macro
#
# /usr/share/shorewall/macro.MongoDB
#
# This macro handles MongoDB Daemon/Router traffic.
#
###############################################################################
?FORMAT 2
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
PARAM - - tcp 27017

View File

@@ -14,7 +14,7 @@ PARAM - - 47
PARAM DEST SOURCE 47
?if ( __CT_TARGET && ! $AUTOHELPERS && __PPTP_HELPER )
PARAM - - tcp 1723 ; helper=pptp
PARAM - - tcp 1723 { helper=pptp }
?else
PARAM - - tcp 1723
?endif

View File

@@ -0,0 +1,13 @@
#
# Shorewall version 4 - Redis Macro
#
# /usr/share/shorewall/macro.Redis
#
# This macro handles Redis traffic.
#
###############################################################################
?FORMAT 2
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
PARAM - - tcp 6379

View File

@@ -12,7 +12,7 @@
# PORT(S) PORT(S) DEST LIMIT GROUP
?if ( __CT_TARGET && ! $AUTOHELPERS && __SANE_HELPER )
PARAM - - tcp 6566 ; helper=sane
PARAM - - tcp 6566 { helper=sane }
?else
PARAM - - tcp 6566
?endif

View File

@@ -12,7 +12,7 @@
# PORT(S) PORT(S) DEST LIMIT GROUP
?if ( __CT_TARGET && ! $AUTOHELPERS && __SIP_HELPER )
PARAM - - udp 5060 ; helper=sip
PARAM - - udp 5060 { helper=sip }
?else
PARAM - - udp 5060
?endif

View File

@@ -17,7 +17,7 @@
PARAM - - udp 135,445
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
PARAM - - udp 137 ; helper=netbios-ns
PARAM - - udp 137 { helper=netbios-ns }
PARAM - - udp 138:139
?else
PARAM - - udp 137:139

View File

@@ -17,7 +17,7 @@
PARAM - - udp 135,445
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
PARAM - - udp 137 ; helper=netbios-ns
PARAM - - udp 137 { helper=netbios-ns }
PARAM - - udp 138:139
?else
PARAM - - udp 137:139
@@ -28,7 +28,7 @@ PARAM - - tcp 135,139,445
PARAM DEST SOURCE udp 135,445
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
PARAM DEST SOURCE udp 137 ; helper=netbios-ns
PARAM DEST SOURCE udp 137 { helper=netbios-ns }
PARAM DEST SOURCE udp 138:139
?else
PARAM DEST SOURCE udp 137:139

View File

@@ -14,7 +14,7 @@
# PORT(S) PORT(S) DEST LIMIT GROUP
?if ( __CT_TARGET && ! $AUTOHELPERS && __SNMP_HELPER )
PARAM - - udp 161 ; helper=snmp
PARAM - - udp 161 { helper=snmp }
?else
PARAM - - udp 161
?endif

View File

@@ -0,0 +1,13 @@
#
# Shorewall version 4 - Sieve Macro
#
# /usr/share/shorewall/macro.Sieve
#
# This macro handles sieve aka ManageSieve protocol.
#
###############################################################################
?FORMAT 2
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
PARAM - - tcp 4190

View File

@@ -14,7 +14,7 @@
# PORT(S) PORT(S) DEST LIMIT GROUP
?if ( __CT_TARGET && ! $AUTOHELPERS && __TFTP_HELPER )
PARAM - - udp 69 ; helper=tftp
PARAM - - udp 69 { helper=tftp }
?else
PARAM - - udp 69
?endif

View File

@@ -155,8 +155,6 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
my ($action, $chain, $source, $dest, $proto, $ports, $sports, $user, $mark, $ipsec, $headers ) = @_;
$acctable = $config{ACCOUNTING_TABLE};
$jumpchainref = 0;
$asection = LEGACY if $asection < 0;
@@ -453,6 +451,8 @@ sub setup_accounting() {
set_section_function( &process_section );
$acctable = $config{ACCOUNTING_TABLE};
first_entry "$doing $fn...";
my $nonEmpty = 0;

View File

@@ -73,6 +73,7 @@ our @EXPORT = ( qw(
allow_optimize
allow_delete
allow_move
make_terminating
set_optflags
reset_optflags
has_return
@@ -104,7 +105,6 @@ our @EXPORT = ( qw(
AUDIT
HELPER
INLINE
TERMINATING
STATEMATCH
USERBUILTIN
INLINERULE
@@ -262,6 +262,7 @@ our %EXPORT_TAGS = (
set_global_variables
save_dynamic_chains
load_ipsets
create_save_ipsets
validate_nfobject
create_nfobjects
create_netfilter_load
@@ -793,6 +794,13 @@ sub decr_cmd_level( $ ) {
assert( --$_[0]->{cmdlevel} >= 0, $_[0] );
}
#
# Mark an action as terminating
#
sub make_terminating( $ ) {
$terminating{$_[0]} = 1;
}
#
# Transform the passed iptables rule into an internal-form hash reference.
# Most of the compiler has been converted to use the new form natively.
@@ -1654,7 +1662,8 @@ sub insert_rule($$$) {
sub insert_irule( $$$$;@ ) {
my ( $chainref, $jump, $target, $number, @matches ) = @_;
my $ruleref = {};
my $rulesref = $chainref->{rules};
my $ruleref = {};
$ruleref->{mode} = ( $ruleref->{cmdlevel} = $chainref->{cmdlevel} ) ? CMD_MODE : CAT_MODE;
@@ -1673,7 +1682,15 @@ sub insert_irule( $$$$;@ ) {
$ruleref->{comment} = shortlineinfo( $chainref->{origin} ) || $ruleref->{comment} || $comment;
splice( @{$chainref->{rules}}, $number, 0, $ruleref );
if ( $number >= @$rulesref ) {
#
# Avoid failure in spice if we insert beyond the end of the chain
#
$number = @$rulesref;
push @$rulesref, $ruleref;
} else {
splice( @$rulesref, $number, 0, $ruleref );
}
trace( $chainref, 'I', ++$number, format_rule( $chainref, $ruleref ) ) if $debug;
@@ -3503,7 +3520,7 @@ sub optimize_level8( $$$ ) {
%renamed = ();
while ( $progress ) {
my @chains = ( sort level8_compare grep $_->{referenced} && ! $_->{builtin}, values %{$tableref} );
my @chains = ( sort { level8_compare($a, $b) } ( grep $_->{referenced} && ! $_->{builtin}, values %{$tableref} ) );
my @chains1 = @chains;
my $chains = @chains;
my %rename;
@@ -4859,62 +4876,79 @@ my %norate = ( DROP => 1, REJECT => 1 );
# Create a "-m limit" match for the passed LIMIT/BURST
#
sub do_ratelimit( $$ ) {
my ( $rate, $action ) = @_;
my ( $rates, $action ) = @_;
return '' unless $rate and $rate ne '-';
return '' unless $rates and $rates ne '-';
fatal_error "Rate Limiting not available with $action" if $norate{$action};
#
# "-m hashlimit" match for the passed LIMIT/BURST
#
if ( $rate =~ /^[sd]:{1,2}/ ) {
require_capability 'HASHLIMIT_MATCH', 'Per-ip rate limiting' , 's';
my $limit = "-m hashlimit ";
my $match = have_capability( 'OLD_HL_MATCH' ) ? 'hashlimit' : 'hashlimit-upto';
my $units;
my @rates = split_list $rates, 'rate';
if ( $rate =~ /^[sd]:((\w*):)?((\d+)(\/(sec|min|hour|day))?):(\d+)$/ ) {
fatal_error "Invalid Rate ($3)" unless $4;
fatal_error "Invalid Burst ($7)" unless $7;
$limit .= "--$match $3 --hashlimit-burst $7 --hashlimit-name ";
$limit .= $2 ? $2 : 'shorewall' . $hashlimitset++;
$limit .= ' --hashlimit-mode ';
$units = $6;
} elsif ( $rate =~ /^[sd]:((\w*):)?((\d+)(\/(sec|min|hour|day))?)$/ ) {
fatal_error "Invalid Rate ($3)" unless $4;
$limit .= "--$match $3 --hashlimit-name ";
$limit .= $2 ? $2 : 'shorewall' . $hashlimitset++;
$limit .= ' --hashlimit-mode ';
$units = $6;
} else {
fatal_error "Invalid rate ($rate)";
}
if ( @rates == 2 ) {
$rates[0] = 's:' . $rates[0];
$rates[1] = 'd:' . $rates[1];
} elsif ( @rates > 2 ) {
fatal error "Only two rates may be specified";
}
$limit .= $rate =~ /^s:/ ? 'srcip ' : 'dstip ';
my $limit = '';
if ( $units && $units ne 'sec' ) {
my $expire = 60000; # 1 minute in milliseconds
for my $rate ( @rates ) {
#
# "-m hashlimit" match for the passed LIMIT/BURST
#
if ( $rate =~ /^([sd]):{1,2}/ ) {
require_capability 'HASHLIMIT_MATCH', 'Per-ip rate limiting' , 's';
if ( $units ne 'min' ) {
$expire *= 60; #At least an hour
$expire *= 24 if $units eq 'day';
my $match = have_capability( 'OLD_HL_MATCH' ) ? 'hashlimit' : 'hashlimit-upto';
my $units;
$limit .= "-m hashlimit ";
if ( $rate =~ /^[sd]:((\w*):)?((\d+)(\/(sec|min|hour|day))?):(\d+)$/ ) {
fatal_error "Invalid Rate ($3)" unless $4;
fatal_error "Invalid Burst ($7)" unless $7;
$limit .= "--$match $3 --hashlimit-burst $7 --hashlimit-name ";
$limit .= $2 ? $2 : 'shorewall' . $hashlimitset++;
$limit .= ' --hashlimit-mode ';
$units = $6;
} elsif ( $rate =~ /^[sd]:((\w*):)?((\d+)(\/(sec|min|hour|day))?)$/ ) {
fatal_error "Invalid Rate ($3)" unless $4;
$limit .= "--$match $3 --hashlimit-name ";
$limit .= $2 ? $2 : 'shorewall' . $hashlimitset++;
$limit .= ' --hashlimit-mode ';
$units = $6;
} else {
fatal_error "Invalid rate ($rate)";
}
$limit .= "--hashlimit-htable-expire $expire ";
}
$limit .= $rate =~ /^s:/ ? 'srcip ' : 'dstip ';
$limit;
} elsif ( $rate =~ /^((\d+)(\/(sec|min|hour|day))?):(\d+)$/ ) {
fatal_error "Invalid Rate ($1)" unless $2;
fatal_error "Invalid Burst ($5)" unless $5;
"-m limit --limit $1 --limit-burst $5 ";
} elsif ( $rate =~ /^(\d+)(\/(sec|min|hour|day))?$/ ) {
fatal_error "Invalid Rate (${1}${2})" unless $1;
"-m limit --limit $rate ";
} else {
fatal_error "Invalid rate ($rate)";
if ( $units && $units ne 'sec' ) {
my $expire = 60000; # 1 minute in milliseconds
if ( $units ne 'min' ) {
$expire *= 60; #At least an hour
$expire *= 24 if $units eq 'day';
}
$limit .= "--hashlimit-htable-expire $expire ";
}
} else {
if ( $rate =~ /^((\d+)(\/(sec|min|hour|day))?):(\d+)$/ ) {
fatal_error "Invalid Rate ($1)" unless $2;
fatal_error "Invalid Burst ($5)" unless $5;
$limit = "-m limit --limit $1 --limit-burst $5 ";
} elsif ( $rate =~ /^(\d+)(\/(sec|min|hour|day))?$/ ) {
fatal_error "Invalid Rate (${1}${2})" unless $1;
$limit = "-m limit --limit $rate ";
} else {
fatal_error "Invalid rate ($rate)";
}
}
}
$limit;
}
#
@@ -6487,7 +6521,6 @@ sub set_chain_variables() {
emit( 'IPTABLES_RESTORE=${IPTABLES}-restore',
'[ -x "$IPTABLES_RESTORE" ] || startup_error "$IPTABLES_RESTORE does not exist or is not executable"' );
emit( 'g_tool=$IPTABLES' );
} else {
if ( $config{IP6TABLES} ) {
@@ -6502,7 +6535,6 @@ sub set_chain_variables() {
emit( 'IP6TABLES_RESTORE=${IP6TABLES}-restore',
'[ -x "$IP6TABLES_RESTORE" ] || startup_error "$IP6TABLES_RESTORE does not exist or is not executable"' );
emit( 'g_tool=$IP6TABLES' );
}
@@ -6723,20 +6755,25 @@ sub interface_mac( $$ ) {
#
# Record the fact that the ruleset requires MAC address of the passed gateway IP routed out of the passed interface for the passed provider number
#
sub get_interface_mac( $$$ ) {
my ( $ipaddr, $logical , $table ) = @_;
sub get_interface_mac( $$$$ ) {
my ( $ipaddr, $logical , $table, $mac ) = @_;
my $interface = get_physical( $logical );
my $variable = interface_mac( $interface , $table );
$global_variables |= NOT_RESTORE;
if ( interface_is_optional $logical ) {
$interfacemacs{$table} = qq($variable=\$(find_mac $ipaddr $interface)\n);
if ( $mac ) {
$interfacemacs{$table} = qq($variable=$mac);
} else {
$interfacemacs{$table} = qq($variable=\$(find_mac $ipaddr $interface)
if ( interface_is_optional $logical ) {
$interfacemacs{$table} = qq($variable=\$(find_mac $ipaddr $interface)\n);
} else {
$interfacemacs{$table} = qq($variable=\$(find_mac $ipaddr $interface)
[ -n "\$$variable" ] || startup_error "Unable to determine the MAC address of $ipaddr through interface \\"$interface\\""
);
}
}
"\$$variable";
@@ -7565,7 +7602,7 @@ sub expand_rule( $$$$$$$$$$$;$ )
$exceptionrule,
$actparms{disposition} || $disposition,
$target ),
$terminating{$basictarget} || ( $targetref || $targetref->{complete} ),
$terminating{$basictarget} || ( $targetref && $targetref->{complete} ),
$matches );
}
@@ -7870,14 +7907,18 @@ sub emitr1( $$ ) {
sub save_dynamic_chains() {
my $tool;
my $tool = $family == F_IPV4 ? '${IPTABLES}' : '${IP6TABLES}';
my $utility = $family == F_IPV4 ? 'iptables-restore' : 'ip6tables-restore';
emit ( 'if [ "$COMMAND" = restart -o "$COMMAND" = refresh ]; then' );
push_indent;
if ( have_capability 'IPTABLES_S' ) {
$tool = $family == F_IPV4 ? '${IPTABLES}' : '${IP6TABLES}';
emit( 'if [ -n "$g_counters" ]; then' ,
" ${tool}-save --counters | grep -vE '[ :]shorewall ' > \${VARDIR}/.${utility}-input",
"fi\n"
);
if ( have_capability 'IPTABLES_S' ) {
emit <<"EOF";
if chain_exists 'UPnP -t nat'; then
$tool -t nat -S UPnP | tail -n +2 > \${VARDIR}/.UPnP
@@ -7897,6 +7938,7 @@ else
rm -f \${VARDIR}/.dynamic
fi
EOF
} else {
$tool = $family == F_IPV4 ? '${IPTABLES}-save' : '${IP6TABLES}-save';
@@ -7974,11 +8016,99 @@ sub ensure_ipset( $ ) {
}
}
#
# Generate the save_ipsets() function
#
sub create_save_ipsets() {
my @ipsets = all_ipsets;
emit( "#\n#Save the ipsets specified by the SAVE_IPSETS setting and by dynamic zones\n#",
'save_ipsets() {' );
if ( @ipsets || @{$globals{SAVED_IPSETS}} || ( $config{SAVE_IPSETS} && have_ipset_rules ) ) {
emit( ' local file' ,
'',
' file=$1'
);
if ( @ipsets ) {
emit '';
ensure_ipset( $_ ) for @ipsets;
}
if ( $config{SAVE_IPSETS} ) {
if ( $family == F_IPV6 || $config{SAVE_IPSETS} eq 'ipv4' ) {
my $select = $family == F_IPV4 ? '^create.*family inet ' : 'create.*family inet6 ';
emit( '' ,
' rm -f $file' ,
' touch $file' ,
' local set' ,
);
if ( @ipsets ) {
emit '';
emit( " \$IPSET -S $_ >> \$file" ) for @ipsets;
}
emit( '',
" for set in \$(\$IPSET save | grep '$select' | cut -d' ' -f2); do" ,
" \$IPSET save \$set >> \$file" ,
" done" );
} else {
emit ( '' ,
' if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then' ,
' #',
' # The \'grep -v\' is a hack for a bug in ipset\'s nethash implementation when xtables-addons is applied to Lenny' ,
' #',
' hack=\'| grep -v /31\'' ,
' else' ,
' hack=' ,
' fi' ,
'',
' if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then' ,
" grep -qE -- \"^(-N|create )\" \${VARDIR}/ipsets.tmp && mv -f \${VARDIR}/ipsets.tmp \$file" ,
' fi' );
}
emit("}\n" );
} elsif ( @ipsets || $globals{SAVED_IPSETS} ) {
emit( '' ,
' rm -f ${VARDIR}/ipsets.tmp' ,
' touch ${VARDIR}/ipsets.tmp' ,
);
if ( @ipsets ) {
emit '';
emit( " \$IPSET -S $_ >> \${VARDIR}/ipsets.tmp" ) for @ipsets;
}
emit( '' ,
" if qt \$IPSET list $_; then" ,
" \$IPSET save $_ >> \${VARDIR}/ipsets.tmp" ,
' else' ,
" error_message 'ipset $_ not saved (not found)'" ,
" fi\n" ) for @{$globals{SAVED_IPSETS}};
emit( '' ,
" grep -qE -- \"(-N|^create )\" \${VARDIR}/ipsets.tmp && cat \${VARDIR}/ipsets.tmp >> \$file\n" ,
'' ,
"}\n" );
}
} elsif ( $config{SAVE_IPSETS} ) {
emit( ' error_message "WARNING: No ipsets were saved"',
"}\n" );
} else {
emit( ' true',
"}\n" );
}
}
sub load_ipsets() {
my @ipsets = all_ipsets;
if ( @ipsets || ( $config{SAVE_IPSETS} && have_ipset_rules ) ) {
if ( @ipsets || @{$globals{SAVED_IPSETS}} || ( $config{SAVE_IPSETS} && have_ipset_rules ) ) {
emit ( '',
'local hack',
'',
@@ -8005,9 +8135,25 @@ sub load_ipsets() {
emit ( '' );
ensure_ipset( $_ ) for @ipsets;
emit ( '' );
emit ( ' if [ -f ${VARDIR}/ipsets.save ]; then' ,
' $IPSET flush' ,
' $IPSET destroy' ,
' $IPSET restore < ${VARDIR}/ipsets.save' ,
" fi\n" ) for @{$globals{SAVED_IPSETS}};
}
} else {
ensure_ipset( $_ ) for @ipsets;
if ( @{$globals{SAVED_IPSETS}} ) {
emit ( '' );
emit ( ' if [ -f ${VARDIR}/ipsets.save ]; then' ,
' $IPSET flush' ,
' $IPSET destroy' ,
' $IPSET restore < ${VARDIR}/ipsets.save' ,
" fi\n" ) for @{$globals{SAVED_IPSETS}};
}
}
emit ( 'elif [ "$COMMAND" = restore -a -z "$g_recovering" ]; then' );
@@ -8031,6 +8177,12 @@ sub load_ipsets() {
}
} else {
ensure_ipset( $_ ) for @ipsets;
emit ( ' if [ -f ${VARDIR}/ipsets.save ]; then' ,
' $IPSET flush' ,
' $IPSET destroy' ,
' $IPSET restore < ${VARDIR}/ipsets.save' ,
" fi\n" ) for @{$globals{SAVED_IPSETS}};
}
if ( @ipsets ) {
@@ -8038,36 +8190,14 @@ sub load_ipsets() {
ensure_ipset( $_ ) for @ipsets;
}
emit( 'elif [ "$COMMAND" = stop ]; then' );
if ( @ipsets ) {
ensure_ipset( $_ ) for @ipsets;
emit( '' );
}
if ( $family == F_IPV4 ) {
emit ( ' if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then' ,
' #',
' # The \'grep -v\' is a hack for a bug in ipset\'s nethash implementation when xtables-addons is applied to Lenny' ,
' #',
' hack=\'| grep -v /31\'' ,
' else' ,
' hack=' ,
' fi' ,
'',
' if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then' ,
' grep -qE -- "^(-N|create )" ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save' ,
' fi' );
} else {
emit ( ' if eval $IPSET -S > ${VARDIR}/ipsets.tmp; then' ,
' grep -qE -- "^(-N|create )" ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save' ,
' fi' );
}
emit( 'elif [ "$COMMAND" = stop ]; then' ,
' save_ipsets'
);
if ( @ipsets ) {
emit( 'elif [ "$COMMAND" = refresh ]; then' );
ensure_ipset( $_ ) for @ipsets;
}
};
emit ( 'fi' ,
'' );
@@ -8113,17 +8243,29 @@ sub create_netfilter_load( $ ) {
'# Create the input to iptables-restore/ip6tables-restore and pass that input to the utility',
'#',
'setup_netfilter()',
'{'
);
'{',
' local option',
);
push_indent;
my $utility = $family == F_IPV4 ? 'iptables-restore' : 'ip6tables-restore';
my $UTILITY = $family == F_IPV4 ? 'IPTABLES_RESTORE' : 'IP6TABLES_RESTORE';
save_progress_message "Preparing $utility input...";
emit( '',
'if [ "$COMMAND" = restart -a -n "$g_counters" ] && chain_exists $g_sha1sum1 && chain_exists $g_sha1sum2 ; then',
' option="--counters"',
'',
' progress_message "Reusing existing ruleset..."',
'',
'else'
);
emit '';
push_indent;
emit 'option=';
save_progress_message "Preparing $utility input...";
emit "exec 3>\${VARDIR}/.${utility}-input";
@@ -8163,6 +8305,14 @@ sub create_netfilter_load( $ ) {
push @chains, $chainref;
}
}
#
# SHA1SUM chains for handling 'restart -s'
#
if ( $table eq 'filter' ) {
emit_unindented ':$g_sha1sum1 - [0:0]';
emit_unindented ':$g_sha1sum2 - [0:0]';
}
#
# Then emit the rules
#
@@ -8177,20 +8327,24 @@ sub create_netfilter_load( $ ) {
}
enter_cmd_mode;
pop_indent, emit "fi\n";
#
# Now generate the actual ip[6]tables-restore command
#
emit( 'exec 3>&-',
'',
'[ -n "$g_debug_iptables" ] && command=debug_restore_input || command=$' . $UTILITY,
'',
'progress_message2 "Running $command..."',
'',
"cat \${VARDIR}/.${utility}-input | \$command # Use this nonsensical form to appease SELinux",
'if [ $? != 0 ]; then',
qq( fatal_error "iptables-restore Failed. Input is in \${VARDIR}/.${utility}-input"),
"fi\n"
);
'' );
emit( '[ -n "$g_debug_iptables" ] && command=debug_restore_input || command="$' . $UTILITY . ' $option"' );
emit( '',
'progress_message2 "Running $command..."',
'',
"cat \${VARDIR}/.${utility}-input | \$command # Use this nonsensical form to appease SELinux",
'if [ $? != 0 ]; then',
qq( fatal_error "iptables-restore Failed. Input is in \${VARDIR}/.${utility}-input"),
"fi\n"
);
pop_indent;

View File

@@ -280,42 +280,43 @@ sub generate_script_2() {
if ( $global_variables ) {
emit( 'case $COMMAND in' );
push_indent;
if ( $global_variables & NOT_RESTORE ) {
emit( 'start|restart|refresh|disable|enable)' );
} else {
emit( 'start|restart|refresh|disable|enable|restore)' );
}
push_indent;
emit( 'case $COMMAND in' );
set_global_variables(1);
handle_optional_interfaces(0);
emit ';;';
if ( $global_variables == ( ALL_COMMANDS | NOT_RESTORE ) ) {
pop_indent;
push_indent;
emit 'restore)';
push_indent;
set_global_variables(0);
if ( $global_variables == ( ALL_COMMANDS | NOT_RESTORE ) ) {
handle_optional_interfaces(0);
set_global_variables(0);
handle_optional_interfaces(0);
}
emit ';;';
pop_indent;
emit '*)';
push_indent;
}
pop_indent;
pop_indent;
set_global_variables(1);
emit ( 'esac' ) ,
if ( $global_variables & NOT_RESTORE ) {
handle_optional_interfaces(0);
emit ';;';
pop_indent;
pop_indent;
emit ( 'esac' );
} else {
handle_optional_interfaces(1);
}
} else {
emit( 'true' ) unless handle_optional_interfaces(1);
}
@@ -347,10 +348,12 @@ sub generate_script_3($) {
create_netfilter_load( $test );
create_arptables_load( $test ) if $have_arptables;
create_chainlist_reload( $_[0] );
create_save_ipsets;
emit "#\n# Start/Restart the Firewall\n#";
emit 'define_firewall() {';
emit( 'define_firewall() {',
' local options' );
push_indent;
@@ -468,10 +471,12 @@ sub generate_script_3($) {
emit( '',
'if [ $COMMAND = restore ]; then',
' iptables_save_file=${VARDIR}/$(basename $0)-iptables',
' if [ -f $iptables_save_file ]; then' );
' if [ -f $iptables_save_file ]; then',
' [ -n "$g_counters" ] && options=--counters'
);
if ( $family == F_IPV4 ) {
emit( ' cat $iptables_save_file | $IPTABLES_RESTORE # Use this nonsensical form to appease SELinux' );
emit( ' cat $iptables_save_file | $IPTABLES_RESTORE $options # Use this nonsensical form to appease SELinux' );
emit( '',
' arptables_save_file=${VARDIR}/$(basename $0)-arptables',
@@ -481,7 +486,7 @@ sub generate_script_3($) {
if $config{SAVE_ARPTABLES};
} else {
emit ' cat $iptables_save_file | $IP6TABLES_RESTORE # Use this nonsensical form to appease SELinux'
emit ' cat $iptables_save_file | $IP6TABLES_RESTORE $options # Use this nonsensical form to appease SELinux'
}
emit( ' else',
@@ -510,45 +515,41 @@ EOF
#
# Use a parameter list rather than 'here documents' to avoid an extra blank line
#
emit(
' run_refreshed_exit',
' do_iptables -N shorewall' );
emit( ' run_refreshed_exit',
' do_iptables -N shorewall' );
emit ( ' do_iptables -A shorewall -m recent --set --name %CURRENTTIME' ) if have_capability 'RECENT_MATCH';
emit(
" set_state Started $config_dir",
' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall',
'else',
' setup_netfilter'
" set_state Started $config_dir",
' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall',
'else',
' setup_netfilter'
);
push_indent;
emit 'setup_arptables' if $have_arptables;
setup_load_distribution;
pop_indent;
emit<<'EOF';
conditionally_flush_conntrack
EOF
emit( " conditionally_flush_conntrack\n" );
push_indent;
initialize_switches;
setup_forwarding( $family , 0 );
pop_indent;
emit<<"EOF";
run_start_exit
do_iptables -N shorewall
EOF
emit( ' run_start_exit',
' do_iptables -N shorewall',
'' );
emit ( ' do_iptables -A shorewall -m recent --set --name %CURRENTTIME' ) if have_capability 'RECENT_MATCH';
emit( ' do_iptables -A shorewall -m recent --set --name %CURRENTTIME' ) if have_capability 'RECENT_MATCH';
emit<<"EOF";
set_state Started $config_dir
my_pathname=\$(my_pathname)
[ \$my_pathname = \${VARDIR}/firewall ] || cp -f \$my_pathname \${VARDIR}/firewall
run_started_exit
fi
EOF
emit( " set_state Started $config_dir",
' my_pathname=$(my_pathname)',
' [ $my_pathname = ${VARDIR}/firewall ] || cp -f $my_pathname ${VARDIR}/firewall',
' run_started_exit',
"fi\n" );
emit<<'EOF';
date > ${VARDIR}/restarted
@@ -730,7 +731,7 @@ sub compiler {
#
# Do all of the zone-independent stuff (mostly /proc)
#
add_common_rules( $convert );
add_common_rules( $convert, $tcrules );
#
# More /proc
#
@@ -741,6 +742,8 @@ sub compiler {
}
setup_source_routing($family);
setup_log_backend($family);
#
# Proxy Arp/Ndp
#
@@ -819,7 +822,7 @@ sub compiler {
#
# Setup Nat
#
setup_nat if $family == F_IPV4;
setup_nat;
#
# Setup NETMAP
#
@@ -974,8 +977,7 @@ sub compiler {
# compile_stop_firewall() also validates the routestopped file. Since we don't
# call that function during normal 'check', we must validate routestopped here.
#
process_routestopped;
process_stoppedrules;
process_routestopped unless process_stoppedrules;
}
#
# Report used/required capabilities

View File

@@ -40,6 +40,7 @@ use Cwd qw(abs_path getcwd);
use autouse 'Carp' => qw(longmess confess);
use Scalar::Util 'reftype';
use FindBin;
use Digest::SHA qw(sha1_hex);
our @ISA = qw(Exporter);
#
@@ -88,6 +89,7 @@ our @EXPORT = qw(
our @EXPORT_OK = qw( $shorewall_dir initialize shorewall);
our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
generate_sha1
finalize_script
enable_script
disable_script
@@ -741,6 +743,7 @@ sub initialize( $;$$) {
RPFILTER_LOG_LEVEL => undef,
INVALID_LOG_LEVEL => undef,
UNTRACKED_LOG_LEVEL => undef,
LOG_BACKEND => undef,
#
# Location of Files
#
@@ -1105,7 +1108,8 @@ sub initialize( $;$$) {
$family == F_IPV4 ? 'shorewall' : 'shorewall6'
) if defined $shorewallrc;
$globals{SHAREDIRPL} = "$shorewallrc{SHAREDIR}/shorewall/";
$globals{SHAREDIRPL} = "$shorewallrc{SHAREDIR}/shorewall/";
$globals{SAVED_IPSETS} = [];
if ( $family == F_IPV4 ) {
$globals{SHAREDIR} = "$shorewallrc{SHAREDIR}/shorewall";
@@ -1758,6 +1762,13 @@ sub create_temp_script( $$ ) {
}
# Generate the SHA1 digest of the (incomplete script)
#
sub generate_sha1() {
my $data = `cat $tempfile`;
sha1_hex $data;
}
#
# Finalize the script file
#
@@ -1767,6 +1778,19 @@ sub finalize_script( $ ) {
$script = 0;
if ( $file ne '-' ) {
my $sha1sum = generate_sha1;
my $sha1sum1 = join( '-', 'sha-lh', substr( $sha1sum, 0, 20 ) );
my $sha1sum2 = join( '-', 'sha-rh', substr( $sha1sum, -20 ) );
@ARGV = ( $tempfile );
$^I = '';
while ( <> ) {
s/g_sha1sum1=/g_sha1sum1=$sha1sum1/;
s/g_sha1sum2=/g_sha1sum2=$sha1sum2/;
print;
}
rename $tempfile, $file or fatal_error "Cannot Rename $tempfile to $file: $!";
chmod 0700, $file or fatal_error "Cannot secure $file for execute access";
progress_message3 "Shorewall configuration compiled to $file" unless $export;
@@ -3259,7 +3283,11 @@ sub expand_variables( \$ ) {
fatal_error "Variable Expansion Loop" if ++$count > 100;
}
if ( $actparms{0} ) {
if ( $chain ) {
#
# We're in an action body -- allow escaping at signs (@) for u32
#
$$lineref =~ s/\\@/??/g;
# $1 $2 $3 - $4
while ( $$lineref =~ m( ^(.*?) \@({)? (\d+|[a-zA-Z_]\w*) (?(2)}) (.*)$ )x ) {
my ( $first, $var, $rest ) = ( $1, $3, $4);
@@ -3268,6 +3296,8 @@ sub expand_variables( \$ ) {
$$lineref = join( '', $first , $val , $rest );
fatal_error "Variable Expansion Loop" if ++$count > 100;
}
$$lineref =~ s/\?\?/@/g;
}
}
@@ -3496,8 +3526,9 @@ sub default ( $$ ) {
#
# Provide a default value for a yes/no configuration variable.
#
sub default_yes_no ( $$ ) {
my ( $var, $val ) = @_;
sub default_yes_no ( $$;$ ) {
my ( $var, $val, $other ) = @_;
my $result = 1;
my $curval = $config{$var};
@@ -3506,12 +3537,31 @@ sub default_yes_no ( $$ ) {
if ( $curval eq 'no' ) {
$config{$var} = '';
} elsif ( defined( $other ) ) {
if ( $other eq '*' ) {
if ( $curval eq 'yes' ) {
$config{$var} = 'Yes';
} else {
$result = 0;
}
} elsif ( $curval eq $other ) {
#
# Downshift value for later comparison
#
$config{$var} = $curval;
}
} else {
fatal_error "Invalid value for $var ($curval)" unless $curval eq 'yes';
#
# Make Case same as default
#
$config{$var} = 'Yes';
}
} else {
$config{$var} = $val;
}
$result;
}
sub default_yes_no_ipv4 ( $$ ) {
@@ -4118,7 +4168,7 @@ sub IPSet_Match() {
if ( $ipset && -x $ipset ) {
qt( "$ipset -X $sillyname" );
if ( qt( "$ipset -N $sillyname iphash" ) || qt( "$ipset -N $sillyname hash:ip family $fam") ) {
if ( qt( "$ipset -N $sillyname hash:ip family $fam" ) || qt( "$ipset -N $sillyname iphash" ) ) {
if ( qt1( "$iptables $iptablesw -A $sillyname -m set --match-set $sillyname src -j ACCEPT" ) ) {
$capabilities{IPSET_MATCH_NOMATCH} = qt1( "$iptables $iptablesw -A $sillyname -m set --match-set $sillyname src --return-nomatch -j ACCEPT" );
$capabilities{IPSET_MATCH_COUNTERS} = qt1( "$iptables $iptablesw -A $sillyname -m set --match-set $sillyname src --packets-lt 100 -j ACCEPT" );
@@ -4140,7 +4190,7 @@ sub IPSet_Match_Nomatch() {
}
sub IPSet_Match_Counters() {
have_capability 'IPSET_MATCH' && $capabilities{IPSET_MATCH_COUNTGERS};
have_capability 'IPSET_MATCH' && $capabilities{IPSET_MATCH_COUNTERS};
}
sub IPSET_V5() {
@@ -4615,6 +4665,7 @@ sub determine_capabilities() {
$capabilities{FWMARK_RT_MASK} = detect_capability( 'FWMARK_RT_MASK' );
$capabilities{MARK_ANYWHERE} = detect_capability( 'MARK_ANYWHERE' );
$capabilities{ACCOUNT_TARGET} = detect_capability( 'ACCOUNT_TARGET' );
$capabilities{HEADER_MATCH} = detect_capability( 'HEADER_MATCH' );
$capabilities{AUDIT_TARGET} = detect_capability( 'AUDIT_TARGET' );
$capabilities{IPSET_V5} = detect_capability( 'IPSET_V5' );
$capabilities{CONDITION_MATCH} = detect_capability( 'CONDITION_MATCH' );
@@ -4630,6 +4681,7 @@ sub determine_capabilities() {
$capabilities{RPFILTER_MATCH} = detect_capability( 'RPFILTER_MATCH' );
$capabilities{NFACCT_MATCH} = detect_capability( 'NFACCT_MATCH' );
$capabilities{CHECKSUM_TARGET} = detect_capability( 'CHECKSUM_TARGET' );
$capabilities{ARPTABLESJF} = detect_capability( 'ARPTABLESJF' );
$capabilities{MASQUERADE_TGT} = detect_capability( 'MASQUERADE_TGT' );
$capabilities{UDPLITEREDIRECT} = detect_capability( 'UDPLITEREDIRECT' );
$capabilities{NEW_TOS_MATCH} = detect_capability( 'NEW_TOS_MATCH' );
@@ -5026,15 +5078,23 @@ sub unsupported_yes_no_warning( $ ) {
#
# Process the params file
#
sub get_params() {
sub get_params( $ ) {
my $export = $_[0];
my $fn = find_file 'params';
my %reserved = ( COMMAND => 1, CONFDIR => 1, SHAREDIR => 1, VARDIR => 1 );
if ( -f $fn ) {
my $shellpath = $export ? '/bin/sh' : $config{SHOREWALL_SHELL} || '/bin/sh';
$shellpath = which( $shellpath ) unless $shellpath =~ '/';
fatal_error "SHOREWALL_SHELL ($shellpath) is not found or is not executable" unless -x $shellpath;
progress_message2 "Processing $fn ...";
my $command = "$FindBin::Bin/getparams $fn " . join( ':', @config_path ) . " $family";
my $command = "$shellpath $FindBin::Bin/getparams $fn " . join( ':', @config_path ) . " $family";
#
# getparams silently sources the params file under 'set -a', then executes 'export -p'
#
@@ -5304,7 +5364,7 @@ sub get_configuration( $$$$$ ) {
ensure_config_path;
get_params;
get_params( $export );
process_shorewall_conf( $update, $annotate, $directives );
@@ -5541,7 +5601,16 @@ sub get_configuration( $$$$$ ) {
unsupported_yes_no 'BRIDGING';
unsupported_yes_no_warning 'RFC1918_STRICT';
default_yes_no 'SAVE_IPSETS' , '';
unless (default_yes_no 'SAVE_IPSETS', '', '*' ) {
$val = $config{SAVE_IPSETS};
unless ( $val eq 'ipv4' ) {
my @sets = split_list( $val , 'ipset' );
$globals{SAVED_IPSETS} = \@sets;
require_capability 'IPSET_V5', 'A saved ipset list', 's';
$config{SAVE_IPSETS} = '';
}
}
default_yes_no 'SAVE_ARPTABLES' , '';
default_yes_no 'STARTUP_ENABLED' , 'Yes';
default_yes_no 'DELAYBLACKLISTLOAD' , '';
@@ -5739,6 +5808,20 @@ sub get_configuration( $$$$$ ) {
default_log_level 'INVALID_LOG_LEVEL', '';
default_log_level 'UNTRACKED_LOG_LEVEL', '';
if ( supplied( $val = $config{LOG_BACKEND} ) ) {
if ( $family == F_IPV4 && $val eq 'ULOG' ) {
$val = 'ipt_ULOG';
} elsif ( $val eq 'netlink' ) {
$val = 'nfnetlink_log';
} elsif ( $val eq 'LOG' ) {
$val = $family == F_IPV4 ? 'ipt_LOG' : 'ip6t_log';
} else {
fatal_error "Invalid LOG Backend ($val)";
}
$config{LOG_BACKEND} = $val;
}
warning_message "RFC1918_LOG_LEVEL=$config{RFC1918_LOG_LEVEL} ignored. The 'norfc1918' interface/host option is no longer supported" if $config{RFC1918_LOG_LEVEL};
default_log_level 'SMURF_LOG_LEVEL', '';

View File

@@ -690,11 +690,10 @@ sub process_stoppedrules() {
my $result;
if ( my $fn = open_file 'stoppedrules' , 1, 1 ) {
first_entry sub() {
progress_message2("$doing $fn...");
first_entry sub () {
progress_message2( "$doing $fn..." );
unless ( $config{ADMINISABSENTMINDED} ) {
warning_message("Entries in the routestopped file are processed as if ADMINISABSENTMINDED=Yes");
$config{ADMINISABSENTMINDED} = 'Yes';
insert_ijump $filter_table ->{$_}, j => 'ACCEPT', 0, state_imatch 'ESTABLISHED,RELATED' for qw/INPUT FORWARD/;
}
};
@@ -775,8 +774,8 @@ sub process_stoppedrules() {
sub setup_mss();
sub add_common_rules ( $ ) {
my $upgrade = shift;
sub add_common_rules ( $$ ) {
my ( $upgrade_blacklist, $upgrade_tcrules ) = @_;
my $interface;
my $chainref;
my $target;
@@ -929,8 +928,8 @@ sub add_common_rules ( $ ) {
run_user_exit1 'initdone';
if ( $upgrade ) {
exit 0 unless convert_blacklist;
if ( $upgrade_blacklist ) {
exit 0 unless convert_blacklist || $upgrade_tcrules;
} else {
setup_blacklist;
}
@@ -994,7 +993,7 @@ sub add_common_rules ( $ ) {
for my $hostref ( @$list ) {
$interface = $hostref->[0];
my $ipsec = $hostref->[1];
my @policy = have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
my $target = source_exclusion( $hostref->[3], $chainref );
for $chain ( option_chains $interface ) {
@@ -1118,7 +1117,8 @@ sub add_common_rules ( $ ) {
for my $hostref ( @$list ) {
my $interface = $hostref->[0];
my $target = source_exclusion( $hostref->[3], $chainref );
my @policy = have_ipsec ? ( policy => "--pol $hostref->[1] --dir in" ) : ();
my $ipsec = $hostref->[1];
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
for $chain ( option_chains $interface ) {
add_ijump( $filter_table->{$chain} , j => $target, p => 'tcp', imatch_source_net( $hostref->[2] ), @policy );
@@ -1289,7 +1289,7 @@ sub setup_mac_lists( $ ) {
for my $hostref ( @$maclist_hosts ) {
my $interface = $hostref->[0];
my $ipsec = $hostref->[1];
my @policy = have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
my @source = imatch_source_net $hostref->[2];
my @state = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,UNTRACKED' : state_imatch 'NEW';
@@ -2606,42 +2606,11 @@ EOF
my @ipsets = all_ipsets;
if ( @ipsets || ( $config{SAVE_IPSETS} && have_ipset_rules ) ) {
emit <<'EOF';
case $IPSET in
*/*)
if [ ! -x "$IPSET" ]; then
error_message "ERROR: IPSET=$IPSET does not exist or is not executable - ipsets are not saved"
IPSET=
fi
;;
*)
IPSET="$(mywhich $IPSET)"
[ -n "$IPSET" ] || error_message "ERROR: The ipset utility cannot be located - ipsets are not saved"
;;
esac
if [ -n "$IPSET" ]; then
if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then
#
# The 'grep -v' is a hack for a bug in ipset's nethash implementation when xtables-addons is applied to Lenny
#
hack='| grep -v /31'
else
hack=
fi
if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then
#
# Don't save an 'empty' file
#
grep -qE '^(-N|create )' ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save
fi
fi
EOF
if ( @ipsets || @{$globals{SAVED_IPSETS}} || ( $config{SAVE_IPSETS} && have_ipset_rules ) ) {
emit( '',
' save_ipsets ${VARDIR}/ipsets.save' );
}
emit '
set_state "Stopped"

View File

@@ -633,7 +633,7 @@ sub setup_netmap() {
}
#
# Called from process_rule1 to add a rule to the NAT table
# Called from process_rule to add a rule to the NAT table
#
sub handle_nat_rule( $$$$$$$$$$$$$ ) {
my ( $dest, # <server>[:port]
@@ -687,6 +687,11 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
#
$server = $dest;
}
#
# Check for list in $server
#
fatal_error "An address list ($server) is not allowed in the DEST column of a $action RULE" if $server =~ /,/;
#
# Generate the target
#

View File

@@ -42,6 +42,7 @@ our @EXPORT = qw(
setup_source_routing
setup_accept_ra
setup_forwarding
setup_log_backend
);
our @EXPORT_OK = qw( setup_interface_proc );
our $VERSION = 'MODULEVERSION';
@@ -348,5 +349,43 @@ sub setup_interface_proc( $ ) {
}
}
sub setup_log_backend($) {
if ( my $setting = $config{LOG_BACKEND} ) {
my $family = shift;
my $file = '/proc/sys/net/netfilter/nf_log/' . ( $family == F_IPV4 ? '2' : '10' );
emit( 'progress_message2 "Setting up log backend"',
'',
"if [ -f $file ]; then"
);
if ( $setting =~ /ip6?t_log/i ) {
my $alternative = 'nf_log_ipv' . $family;
emit( " setting=$setting",
'',
" fgrep -q $setting /proc/net/netfilter/nf_log || setting=$alternative",
'',
" if echo \$setting > $file; then",
' progress_message "Log Backend set to $setting"',
' else',
' error_message "WARNING: Unable to set log backend to $setting"',
' fi',
'else',
" error_message 'WARNING: $file does not exist - log backend not set'",
"fi\n"
);
} else {
emit( " if echo $setting > $file; then",
" progress_message 'Log Backend set to $setting'",
' else',
" error_message 'WARNING: Unable to set log backend to $setting'",
' fi',
'else',
" error_message 'WARNING: $file does not exist - log backend not set'",
"fi\n" );
}
}
}
1;

View File

@@ -258,7 +258,7 @@ sub copy_and_edit_table( $$$$$ ) {
emit '';
if ( $realm ) {
emit ( "\$IP -$family -o route show table $duplicate | sed -r 's/ realm [[:alnum:]]+//' | ${filter}while read net route; do" )
emit ( "\$IP -$family -o route show table $duplicate | sed -r 's/ realm [[:alnum:]_]+//' | ${filter}while read net route; do" )
} else {
emit ( "\$IP -$family -o route show table $duplicate | ${filter}while read net route; do" )
}
@@ -442,10 +442,11 @@ sub process_a_provider( $ ) {
fatal_error 'INTERFACE must be specified' if $interface eq '-';
( $interface, my $address ) = split /:/, $interface;
( $interface, my $address ) = split /:/, $interface, 2;
my $shared = 0;
my $noautosrc = 0;
my $mac = '';
if ( defined $address ) {
validate_address $address, 0;
@@ -453,10 +454,33 @@ sub process_a_provider( $ ) {
require_capability 'REALM_MATCH', "Configuring multiple providers through one interface", "s";
}
fatal_error "Unknown Interface ($interface)" unless known_interface( $interface );
my $interfaceref = known_interface( $interface );
fatal_error "Unknown Interface ($interface)" unless $interfaceref;
fatal_error "A bridge port ($interface) may not be configured as a provider interface" if port_to_bridge $interface;
my $physical = get_physical $interface;
#
# Switch to the logical name if a physical name was passed
#
my $physical;
if ( $interface eq $interfaceref->{name} ) {
#
# The logical interface name was specified
#
$physical = $interfaceref->{physical};
} else {
#
# A Physical name was specified
#
$physical = $interface;
#
# Switch to the logical name unless it is a wildcard
#
$interface = $interfaceref->{name} unless $interfaceref->{wildcard};
}
my $gatewaycase = '';
if ( $physical =~ /\+$/ ) {
@@ -469,7 +493,17 @@ sub process_a_provider( $ ) {
$gateway = get_interface_gateway $interface;
$gatewaycase = 'detect';
} elsif ( $gateway && $gateway ne '-' ) {
( $gateway, $mac ) = split_host_list( $gateway, 0 );
validate_address $gateway, 0;
if ( defined $mac ) {
$mac =~ tr/-/:/;
$mac =~ s/^~//;
fatal_error "Invalid MAC address ($mac)" unless $mac =~ /^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/;
} else {
$mac = '';
}
$gatewaycase = 'specified';
} else {
$gatewaycase = 'none';
@@ -644,6 +678,7 @@ sub process_a_provider( $ ) {
loose => $loose ,
duplicate => $duplicate ,
address => $address ,
mac => $mac ,
local => $local ,
tproxy => $tproxy ,
load => $load ,
@@ -720,6 +755,7 @@ sub add_a_provider( $$ ) {
my $loose = $providerref->{loose};
my $duplicate = $providerref->{duplicate};
my $address = $providerref->{address};
my $mac = $providerref->{mac};
my $local = $providerref->{local};
my $tproxy = $providerref->{tproxy};
my $load = $providerref->{load};
@@ -733,7 +769,7 @@ sub add_a_provider( $$ ) {
my $realm = '';
if ( $shared ) {
my $variable = $providers{$table}{mac} = get_interface_mac( $gateway, $interface , $table );
my $variable = $providers{$table}{mac} = get_interface_mac( $gateway, $interface , $table, $mac );
$realm = "realm $number";
start_provider( $label , $table, $number, $id, qq(if interface_is_usable $physical && [ -n "$variable" ]; then) );
} elsif ( $pseudo ) {
@@ -1260,9 +1296,11 @@ sub start_providers() {
emit_unindented "$providers{$_}{number}\t$_" unless $providers{$_}{pseudo};
}
emit_unindented "EOF\n";
emit_unindented 'EOF';
emit "fi\n";
emit( 'else',
' error_message "WARNING: /etc/iproute2/rt_tables is missing or is not writeable"',
"fi\n" );
}
emit ( '#',
@@ -1859,8 +1897,10 @@ sub handle_optional_interfaces( $ ) {
if ( @$interfaces ) {
my $require = $config{REQUIRE_INTERFACE};
my $gencase = shift;
verify_required_interfaces( shift );
verify_required_interfaces( $gencase );
emit '' if $gencase;
emit( 'HAVE_INTERFACE=', '' ) if $require;
#

View File

@@ -818,9 +818,7 @@ sub apply_policy_rules() {
progress_message2 'Applying Policies...';
for my $chainref ( @policy_chains ) {
my $policy = $chainref->{policy};
unless ( $policy eq 'NONE' ) {
unless ( ( my $policy = $chainref->{policy} ) eq 'NONE' ) {
my $loglevel = $chainref->{loglevel};
my $provisional = $chainref->{provisional};
my $default = $chainref->{default};
@@ -1673,9 +1671,11 @@ sub process_action($$) {
$origdest = $connlimit = $time = $headers = $condition = $helper = '-';
} else {
($target, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper )
= split_line1( 'action file',
= split_line2( 'action file',
\%rulecolumns,
$action_commands );
$action_commands,
undef,
1 );
}
fatal_error 'TARGET must be specified' if $target eq '-';
@@ -1748,14 +1748,15 @@ sub process_actions() {
undef, #Columns
1 ); #Allow inline matches
my $type = ( $action eq $config{REJECT_ACTION} ? INLINE : ACTION );
my $noinline = 0;
my $nolog = ( $type == INLINE ) || 0;
my $builtin = 0;
my $raw = 0;
my $mangle = 0;
my $filter = 0;
my $nat = 0;
my $type = ( $action eq $config{REJECT_ACTION} ? INLINE : ACTION );
my $noinline = 0;
my $nolog = ( $type == INLINE ) || 0;
my $builtin = 0;
my $raw = 0;
my $mangle = 0;
my $filter = 0;
my $nat = 0;
my $terminating = 0;
if ( $action =~ /:/ ) {
warning_message 'Default Actions are now specified in /etc/shorewall/shorewall.conf';
@@ -1774,6 +1775,8 @@ sub process_actions() {
$nolog = 1;
} elsif ( $_ eq 'builtin' ) {
$builtin = 1;
} elsif ( $_ eq 'terminating' ) {
$terminating = 1;
} elsif ( $_ eq 'mangle' ) {
$mangle = 1;
} elsif ( $_ eq 'raw' ) {
@@ -1822,6 +1825,8 @@ sub process_actions() {
}
$targets{$action} = $actiontype;
make_terminating( $action ) if $terminating;
} else {
fatal_error "Table names are only allowed for builtin actions" if $mangle || $raw || $nat || $filter;
new_action $action, $type, $noinline, $nolog;
@@ -2374,7 +2379,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
my ( $tgt, $options ) = split / /, $param;
my $target_type = $builtin_target{$tgt};
fatal_error "Unknown target ($tgt)" unless $target_type;
fatal_error "The $tgt TARGET is now allowed in the filter table" unless $target_type & FILTER_TABLE;
fatal_error "The $tgt TARGET is not allowed in the filter table" unless $target_type & FILTER_TABLE;
$action = $param;
} else {
$action = '';
@@ -2387,7 +2392,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
my ( $tgt, $options ) = split / /, $param;
my $target_type = $builtin_target{$tgt};
fatal_error "Unknown target ($tgt)" unless $target_type;
fatal_error "The $tgt TARGET is now allowed in the filter table" unless $target_type & FILTER_TABLE;
fatal_error "The $tgt TARGET is not allowed in the filter table" unless $target_type & FILTER_TABLE;
$action = $param;
} else {
$action = '';
@@ -2950,7 +2955,7 @@ sub perl_action_helper($$;$) {
$matches .= ' ' unless $matches =~ /^(?:.+\s)?$/;
set_inline_matches $matches if $target =~ /^INLINE(?::.*)?$/;
set_inline_matches( $target =~ /^INLINE(?::.*)?$/ ? $matches : '' );
if ( $isstatematch ) {
if ( $statematch ) {
@@ -3023,6 +3028,8 @@ sub perl_action_tcp_helper($$) {
$proto .= ' ' unless $proto =~ /^(?:.+\s)?$/;
set_inline_matches( '' ) if $config{INLINE_MATCHES};
if ( $passedproto eq '-' || $passedproto eq 'tcp' || $passedproto eq '6' ) {
#
# For other protos, a 'no rule generated' warning will be issued

View File

@@ -174,8 +174,8 @@ sub initialize( $ ) {
#
# Process a rule from the tcrules or mangle file
#
sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
our ( $file, $action, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp , $state ) = @_;
sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
our ( $file, $action, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp , $state, $time ) = @_;
use constant {
PREROUTING => 1, #Actually tcpre
@@ -229,7 +229,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
sub handle_mark_param( $$ ) {
my ( $option, $marktype ) = @_;
my $and_or = $1 if $params =~ s/^([|&])//;
my $and_or = $params =~ s/^([|&])// ? $1 : '';
if ( $params =~ /-/ ) {
#
@@ -423,7 +423,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
function => sub () {
require_capability 'DSCP_TARGET', 'The DSCP action', 's';
my $dscp = numeric_value( $params );
$dscp = $dscpmap{$1} unless defined $dscp;
$dscp = $dscpmap{$params} unless defined $dscp;
fatal_error( "Invalid DSCP ($params)" ) unless defined $dscp && $dscp <= 0x38 && ! ( $dscp & 1 );
$target = 'DSCP --set-dscp ' . in_hex( $dscp );
},
@@ -556,13 +556,13 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
mask => in_hex( $globals{TC_MASK} ),
function => sub () {
$target = 'MARK';
handle_mark_param('--set-mark', , HIGHMARK );
handle_mark_param('', , HIGHMARK );
},
},
RESTORE => {
defaultchain => 0,
allowedchains => PREROUTING | FORWARD | POSTROUTING,
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
minparams => 0,
maxparams => 1,
function => sub () {
@@ -591,7 +591,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
SAVE => {
defaultchain => 0,
allowedchains => PREROUTING | FORWARD | POSTROUTING,
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
minparams => 0,
maxparams => 1,
function => sub () {
@@ -798,6 +798,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
do_probability( $probability ) .
do_dscp( $dscp ) .
state_match( $state ) .
do_time( $time ) .
$raw_matches ,
$source ,
$dest ,
@@ -926,21 +927,22 @@ sub process_tc_rule1( $$$$$$$$$$$$$$$$ ) {
$designator = '';
}
my ( $cmd, $rest );
if ( $mark =~ /^TOS/ ) {
$cmd = $mark;
$rest = '';
} else {
($cmd, $rest) = split( '/', $mark, 2 );
}
unless ( $command ) {
{
if ( $cmd =~ /^([A-Z]+)/ ) {
my ( $cmd, $rest ) = split( '/', $mark, 2 );
if ( $cmd =~ /^([A-Z]+)(?:\((.+)\))?/ ) {
if ( my $tccmd = $tccmd{$1} ) {
fatal_error "Invalid $1 ACTION ($originalmark)" unless $tccmd->{match}($cmd);
$command = $tccmd->{command} if $tccmd->{command};
$command = $1;
if ( supplied $rest ) {
fatal_error "Invalid $1 ACTION ($originalmark)" if supplied $2;
$mark = $rest;
} elsif ( supplied $2 ) {
$mark = $2;
} else {
$mark = '';
}
}
} else {
$command = 'MARK';
@@ -986,7 +988,9 @@ sub process_tc_rule1( $$$$$$$$$$$$$$$$ ) {
$headers,
$probability,
$dscp,
$state );
$state,
'-',
);
}
}
@@ -1046,9 +1050,9 @@ sub process_tc_rule( ) {
}
sub process_mangle_rule( ) {
my ( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp , $state );
my ( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp , $state, $time );
if ( $family == F_IPV4 ) {
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $probability, $dscp, $state ) =
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $probability, $dscp, $state, $time ) =
split_line2( 'tcrules file',
{ mark => 0,
action => 0,
@@ -1065,13 +1069,15 @@ sub process_mangle_rule( ) {
helper => 11,
probability => 12 ,
scp => 13,
state => 14 },
state => 14,
time => 15,
},
{},
15,
16,
1 );
$headers = '-';
} else {
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability, $dscp, $state ) =
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability, $dscp, $state, $time ) =
split_line2( 'tcrules file',
{ mark => 0,
action => 0,
@@ -1089,14 +1095,16 @@ sub process_mangle_rule( ) {
headers => 12,
probability => 13,
dscp => 14,
state => 15 },
state => 15,
time => 16,
},
{},
16,
17,
1 );
}
for my $proto (split_list( $protos, 'Protocol' ) ) {
process_mangle_rule1( 'Mangle', $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp , $state );
process_mangle_rule1( 'Mangle', $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp , $state, $time );
}
}

View File

@@ -193,6 +193,7 @@ our %reservedName = ( all => 1,
# physical => <physical interface name>
# base => <shell variable base representing this interface>
# provider => <Provider Name, if interface is associated with a provider>
# wildcard => undef|1 # Wildcard Name
# zones => { zone1 => 1, ... }
# }
# }
@@ -1375,6 +1376,7 @@ sub process_interface( $$ ) {
base => var_base( $physical ),
zones => {},
origin => shortlineinfo(''),
wildcard => $wildcard,
};
if ( $zone ) {
@@ -1497,7 +1499,7 @@ sub map_physical( $$ ) {
$physical =~ s/\+$//;
$physical . substr( $name, length $interfaceref->{root} );
$physical . substr( $name, length( $interfaceref->{root} ) );
}
#
@@ -1531,6 +1533,7 @@ sub known_interface($)
number => $interfaceref->{number} ,
physical => $physical ,
base => var_base( $physical ) ,
wildcard => $interfaceref->{wildcard} ,
zones => $interfaceref->{zones} ,
};
}
@@ -1768,7 +1771,7 @@ sub find_interfaces_by_option1( $ ) {
my $optionsref = $interfaceref->{options};
if ( $optionsref && defined $optionsref->{$option} ) {
$wild ||= ( $interfaceref->{physical} =~ /\+$/ );
$wild ||= $interfaceref->{wildcard};
push @ints , $interface
}
}
@@ -2118,14 +2121,26 @@ sub have_ipsec() {
sub find_hosts_by_option( $ ) {
my $option = $_[0];
my @hosts;
my %done;
for my $interface ( @interfaces ) {
my $value = $interfaces{$interface}{options}{$option};
if ( ! $interfaces{$interface}{zone} && $value ) {
push @hosts, [ $interface, '', ALLIP , [], $value ];
$done{$interface} = 1;
}
}
for my $zone ( grep ! ( $zones{$_}{type} & FIREWALL ) , @zones ) {
while ( my ($type, $interfaceref) = each %{$zones{$zone}{hosts}} ) {
while ( my ( $interface, $arrayref) = ( each %{$interfaceref} ) ) {
for my $host ( @{$arrayref} ) {
if ( my $value = $host->{options}{$option} ) {
for my $net ( @{$host->{hosts}} ) {
push @hosts, [ $interface, $host->{ipsec} , $net , $host->{exclusions}, $value ];
my $ipsec = $host->{ipsec};
unless ( $done{$interface} ) {
if ( my $value = $host->{options}{$option} ) {
for my $net ( @{$host->{hosts}} ) {
push @hosts, [ $interface, $ipsec , $net , $host->{exclusions}, $value ];
}
}
}
}
@@ -2133,12 +2148,6 @@ sub find_hosts_by_option( $ ) {
}
}
for my $interface ( @interfaces ) {
if ( ! $interfaces{$interface}{zone} && $interfaces{$interface}{options}{$option} ) {
push @hosts, [ $interface, 'none', ALLIP , [] ];
}
}
\@hosts;
}

View File

@@ -587,7 +587,7 @@ debug_restore_input() {
done
}
interface_up() {
interface_enabled() {
return $(cat ${VARDIR}/$1.status)
}
@@ -604,7 +604,7 @@ distribute_load() {
totalload=0
for interface in $@; do
if interface_up $interface; then
if interface_enabled $interface; then
load=$(cat ${VARDIR}/${interface}_load)
eval ${interface}_load=$load
mark=$(cat ${VARDIR}/${interface}_mark)

View File

@@ -17,8 +17,10 @@ usage() {
echo " reset"
echo " refresh"
echo " restart"
echo " run <command> [ <parameter> ... ]"
echo " status"
echo " up <interface>"
echo " savesets <file>"
echo " version"
echo
echo "Options are:"
@@ -27,6 +29,7 @@ usage() {
echo " -n Don't update routing configuration"
echo " -p Purge Conntrack Table"
echo " -t Timestamp progress Messages"
echo " -c Save/restore iptables counters"
echo " -V <verbosity> Set verbosity explicitly"
echo " -R <file> Override RESTOREFILE setting"
exit $1
@@ -84,6 +87,17 @@ g_purge=$PURGE
g_noroutes=$NOROUTES
g_timestamp=$TIMESTAMP
g_recovering=$RECOVERING
#
# These two variables contain the high-order and low-order parts respectively of
# an SHA1 digest of this file. The digest is generated before the two following
# lines are updated to contain the value of that digest.
#
g_sha1sum1=
g_sha1sum2=
#
# Other Globals
#
g_counters=
initialize
@@ -135,6 +149,10 @@ while [ $finished -eq 0 -a $# -gt 0 ]; do
g_recovering=Yes
option=${option#r}
;;
c*)
g_counters=Yes
option=${option#c}
;;
V*)
option=${option#V}
@@ -371,6 +389,24 @@ case "$COMMAND" in
fi
status=0
;;
run)
if [ $# -gt 1 ]; then
shift
detect_configuration
run_init_exit
eval $@
status=$?
else
error_message "ERROR: Missing command"
fi
;;
savesets)
if [ $# -eq 2 ]; then
save_ipsets $2
else
usage 2
fi
;;
version)
[ $# -ne 1 ] && usage 2
echo $SHOREWALL_VERSION

View File

@@ -11,4 +11,4 @@
###############################################################################
#ZONE INTERFACE OPTIONS
- lo ignore
net all dhcp,physical=+,routeback,optional
net all dhcp,physical=+,routeback

View File

@@ -25,6 +25,8 @@ BLACKLIST_LOG_LEVEL=
INVALID_LOG_LEVEL=
LOG_BACKEND=
LOG_MARTIANS=Yes
LOG_VERBOSITY=2

View File

@@ -3,7 +3,7 @@ For instructions on using this sample configuration, please see
http://www.shorewall.net/standalone.htm
Shorewall Samples
Copyright (C) 2006 by the following authors:
Copyright (C) 2006-2014 by the following authors:
Thomas M. Eastep
Paul D. Gear
Cristian Rodriguez

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Interfaces File for one-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Policy File for one-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Rules File for one-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -2,7 +2,7 @@
#
# Shorewall version 4.0 - Sample shorewall.conf for one-interface
# configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -36,6 +36,8 @@ BLACKLIST_LOG_LEVEL=
INVALID_LOG_LEVEL=
LOG_BACKEND=
LOG_MARTIANS=Yes
LOG_VERBOSITY=2

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Zones File for one-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -3,7 +3,7 @@ For instructions on using these sample configurations, please see
http://www.shorewall.net/three-interface.htm
Shorewall Samples
Copyright (C) 2006 by the following authors:
Copyright (C) 2006-2014 by the following authors:
Thomas M. Eastep
Paul D. Gear
Cristian Rodriguez

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Interfaces File for three-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 3.4 - Sample Masq file for three-interface configuration.
# Copyright (C) 2006,2007 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 3.4 - Sample Policy File for three-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Rules File for three-interface configuration.
# Copyright (C) 2006,2007 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -2,8 +2,7 @@
#
# Shorewall version 4.0 - Sample shorewall.conf for three-interface
# configuration.
# Copyright (C) 2006 by the Shorewall Team
# 2011 by Thomas M. Eastep
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -34,6 +33,8 @@ BLACKLIST_LOG_LEVEL=
INVALID_LOG_LEVEL=
LOG_BACKEND=
LOG_MARTIANS=Yes
LOG_VERBOSITY=2

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Zones File for three-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -3,7 +3,7 @@ For instructions on using these sample configurations, please see
http://www.shorewall.net/two-interface.htm
Shorewall Samples
Copyright (C) 2006 by the following authors:
Copyright (C) 2006-2014 by the following authors:
Thomas M. Eastep
Paul D. Gear
Cristian Rodriguez

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Interfaces File for two-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Masq file for two-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Policy File for two-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Rules File for two-interface configuration.
# Copyright (C) 2006,2007 by the Shorewall Team
# Copyright (C) 2006-2014,2007 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

View File

@@ -2,8 +2,7 @@
#
# Shorewall version 4.0 - Sample shorewall.conf for two-interface
# configuration.
# Copyright (C) 2006,2007 by the Shorewall Team
# 2011 by Thomas M. Eastep
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -37,6 +36,8 @@ BLACKLIST_LOG_LEVEL=
INVALID_LOG_LEVEL=
LOG_BACKEND=
LOG_MARTIANS=Yes
LOG_VERBOSITY=2

View File

@@ -1,6 +1,6 @@
#
# Shorewall version 4.0 - Sample Zones File for two-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public

34
Shorewall/action.DNSAmp Normal file
View File

@@ -0,0 +1,34 @@
#
# Shorewall 4 - DNS Amplification Action
#
# /usr/share/shorewall/action.DNSAmp
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2011,2012 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# DNSAmp[([<action>])]
#
# Default action is DROP
#
##########################################################################################
?format 2
DEFAULTS DROP
IPTABLES(@1) - - udp 53 ; -m u32 --u32 "0>>22&0x3C\@8&0xffff=0x0100 && 0>>22&0x3C\@12&0xffff0000=0x00010000"

View File

@@ -31,6 +31,7 @@ allowInvalid inline # Accepts packets in the INVALID conntrack state
AutoBL noinline # Auto-blacklist IPs that exceed thesholds
AutoBLL noinline # Helper for AutoBL
Broadcast noinline # Handles Broadcast/Multicast/Anycast
DNSAmp # Matches one-question recursive DNS queries
Drop # Default Action for DROP policy
dropInvalid inline # Drops packets in the INVALID conntrack state
DropSmurfs noinline # Drop smurf packets

View File

@@ -6,7 +6,7 @@
# 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
################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
# PORT PORT(S) DEST LIMIT GROUP

View File

@@ -3,8 +3,8 @@
#
# /etc/shorewall/clear
#
# Add commands below that you want to be executed after Shorewall
# has processed the 'clear' command.
# Add commands below that you want to be executed after Shorewall has
# processed the 'clear' command.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -3,12 +3,12 @@
#
# /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
# specified as 'detect'.
# 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
# specified as 'detect'.
#
# The function should echo the IP address of the gateway if it knows what
# it is; the name of the interface is in $1.
# The function should echo the IP address of the gateway if it knows what
# it is; the name of the interface is in $1.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -5,7 +5,7 @@
#
# Add commands below that you want to be executed during
# "shorewall start" or "shorewall restart" commands at the point where
# Shorewall has not yet added any perminent rules to the builtin chains.
# 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

@@ -3,9 +3,9 @@
#
# /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
# firewall script.
# 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
# firewall script.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -9,7 +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
####################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP
# PORT(S) PORT(S)

View File

@@ -3,8 +3,8 @@
#
# /etc/shorewall/refresh
#
# Add commands below that you want to be executed before Shorewall
# has processed the 'refresh' command.
# Add commands below that you want to be executed before Shorewall
# has processed the 'refresh' command.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -3,8 +3,8 @@
#
# /etc/shorewall/refreshed
#
# Add commands below that you want to be executed after Shorewall
# has processed the 'refresh' command.
# Add commands below that you want to be executed after Shorewall has
# processed the 'refresh' command.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -3,8 +3,8 @@
#
# /etc/shorewall/scfilter
#
# Replace the 'cat' command below to filter the output of
# 'show connections.
# Replace the 'cat' command below to filter the output of
# 'show connections'.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -12,19 +12,21 @@
STARTUP_ENABLED=No
###############################################################################
# V E R B O S I T Y
# V E R B O S I T Y
###############################################################################
VERBOSITY=1
###############################################################################
# L O G G I N G
# L O G G I N G
###############################################################################
BLACKLIST_LOG_LEVEL=
INVALID_LOG_LEVEL=
LOG_BACKEND=
LOG_MARTIANS=Yes
LOG_VERBOSITY=2
@@ -100,7 +102,7 @@ QUEUE_DEFAULT=none
REJECT_DEFAULT=Reject
###############################################################################
# R S H / R C P C O M M A N D S
# R S H / R C P C O M M A N D S
###############################################################################
RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
@@ -271,8 +273,8 @@ MASK_BITS=
ZONE_BITS=0
################################################################################
# L E G A C Y O P T I O N
# D O N O T D E L E T E O R A L T E R
# L E G A C Y O P T I O N
# D O N O T D E L E T E O R A L T E R
################################################################################
IPSECFILE=zones

View File

@@ -7,4 +7,4 @@
#
###############################################################################
#INTERFACE:CLASS MARK RATE: CEIL PRIORITY OPTIONS
# DMAX:UMAX
# DMAX:UMAX

View File

@@ -3,8 +3,8 @@
#
# /etc/shorewall/tcclear
#
# Add commands below that you want to be executed before Shorewall
# clears the traffic shaping configuration.
# Add commands below that you want to be executed before Shorewall clears
# the traffic shaping configuration.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.

View File

@@ -6,5 +6,5 @@
# See http://shorewall.net/traffic_shaping.htm for additional information.
#
########################################################################################################
#INTERFACE: SOURCE DEST PROTO DEST SOURCE TOS LENGTH PRIORITY
#INTERFACE: SOURCE DEST PROTO DEST SOURCE TOS LENGTH PRIORITY
#CLASS PORT(S) PORT(S)

View File

@@ -16,7 +16,7 @@ startup=0
# wait_interface=
#
# Global start/restart/stop options
# Global start/restart options
#
OPTIONS=""

View File

@@ -57,3 +57,15 @@ loadmodule nf_nat_proto_gre
loadmodule nf_nat_sip
loadmodule nf_nat_snmp_basic
loadmodule nf_nat_tftp
#
# While not actually helpers, these are included here so that
# LOG_BACKEND can work correctly. Not all of them will be
# loaded, since at least one of them will be an alias on any
# given system.
#
loadmodule ipt_LOG
loadmodule nf_log_ipv4
loadmodule xt_LOG
loadmodule xt_NFLOG
loadmodule ipt_ULOG
loadmodule nfnetlink_log

View File

@@ -39,7 +39,7 @@ fi
start() {
echo -n $"Starting Shorewall: "
$shorewall $OPTIONS start 2>&1 | $logger
$shorewall $OPTIONS start $STARTOPTIONS 2>&1 | $logger
retval=${PIPESTATUS[0]}
if [[ $retval == 0 ]]; then
touch $lockfile
@@ -69,7 +69,7 @@ restart() {
# Note that we don't simply stop and start since shorewall has a built in
# restart which stops the firewall if running and then starts it.
echo -n $"Restarting Shorewall: "
$shorewall $OPTIONS restart 2>&1 | $logger
$shorewall $OPTIONS restart $RESTARTOPTIONS 2>&1 | $logger
retval=${PIPESTATUS[0]}
if [[ $retval == 0 ]]; then
touch $lockfile

View File

@@ -10,15 +10,16 @@
OPTIONS=""
# Use /etc/default shorewall to specify $OPTIONS to run at startup, however this
# this might prevent shorewall from starting. use at your own risk
# Use /etc/default shorewall to specify $OPTIONS and STARTOPTIONS to
# run at startup, however this this might prevent shorewall from
# starting. use at your own risk
if [ -f /etc/default/shorewall ] ; then
. /etc/default/shorewall
fi
start() {
echo "Starting IPv4 shorewall rules..."
exec /sbin/shorewall $OPTIONS start
exec /sbin/shorewall $OPTIONS start $STARTOPTIONS
}
stop() {
@@ -28,7 +29,7 @@ stop() {
restart() {
echo "Restarting IPv4 shorewall rules..."
exec /sbin/shorewall restart
exec /sbin/shorewall restart $RESTARTOPTIONS
}
status() {

View File

@@ -35,6 +35,7 @@ usage() # $1 = exit status
echo " $ME -h"
echo " $ME -s"
echo " $ME -a"
echo " $ME -n"
exit $1
}
@@ -118,6 +119,7 @@ T="-T"
INSTALLD='-D'
finished=0
configure=1
while [ $finished -eq 0 ]; do
option=$1
@@ -147,6 +149,10 @@ while [ $finished -eq 0 ]; do
ANNOTATED=
option=${option#p}
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
@@ -203,9 +209,11 @@ done
[ -n "${INITFILE}" ] && require INITSOURCE && require INITDIR
[ -n "$SANDBOX" ] && configure=0
if [ -z "$BUILD" ]; then
case $(uname) in
cygwin*)
cygwin*|CYGWIN*)
BUILD=cygwin
;;
Darwin)
@@ -216,7 +224,7 @@ if [ -z "$BUILD" ]; then
eval $(cat /etc/os-release | grep ^ID)
case $ID in
fedora)
fedora|rhel|centos|foobar)
BUILD=redhat
;;
debian)
@@ -324,6 +332,7 @@ if [ $PRODUCT = shorewall ]; then
if ! perl -e 'use Digest::SHA;' 2> /dev/null ; then
if perl -e 'use Digest::SHA1;' 2> /dev/null ; then
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Chains.pm
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm
DIGEST=SHA1
else
echo "ERROR: Shorewall $VERSION requires either Digest::SHA or Digest::SHA1" >&2
@@ -399,7 +408,7 @@ fi
#
# Create /etc/$PRODUCT and other directories
#
mkdir -p ${DESTDIR}/${CONFDIR}/$PRODUCT
mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT
mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT
mkdir -p ${DESTDIR}${PERLLIBDIR}/Shorewall
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
@@ -417,12 +426,16 @@ fi
#
# Install the .service file
#
if [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}${SYSTEMD}
if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD"
fi
if [ -n "$SERVICEDIR" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR}
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SYSTEMD}/$PRODUCT.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SYSTEMD}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SYSTEMD}/$PRODUCT.service"
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
fi
#
@@ -1120,7 +1133,7 @@ chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
# Remove and create the symbolic link to the init script
#
if [ -z "$DESTDIR" ]; then
if [ -z "${DESTDIR}" -a -n "${INITFILE}" ]; then
rm -f ${SHAREDIR}/$PRODUCT/init
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/$PRODUCT/init
fi
@@ -1167,8 +1180,8 @@ if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PR
echo "$SYSCONFFILE installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
fi
if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
if [ -n "$SYSTEMD" ]; then
if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
if [ -n "$SERVICEDIR" ]; then
if systemctl enable ${PRODUCT}.service; then
echo "$Product will start automatically at boot"
fi

View File

@@ -534,6 +534,10 @@ start_command() {
g_inline=Yes
option=${option#i}
;;
C*)
g_counters=Yes
option=${option#C}
;;
*)
usage 1
;;
@@ -570,14 +574,14 @@ start_command() {
esac
if [ -n "${g_fast}${AUTOMAKE}" ]; then
if [ -z "$g_fast" -o -z "$LEGACY_FASTSTART" ]; then
if [ -z "$g_fast" -o -z "${LEGACY_FASTSTART}${g_counters}" ]; then
#
# Automake or LEGACY_FASTSTART=No -- use the last compiled script
# Automake or ( LEGACY_FASTSTART=No and not -C ) -- use the last compiled script
#
object=firewall
else
#
# 'start -f' with LEGACY_FASTSTART=Yes -- use last saved configuration
# 'start -f' with ( LEGACY_FASTSTART=Yes or -C ) -- use last saved configuration
#
object=$RESTOREFILE
fi
@@ -943,6 +947,10 @@ restart_command() {
g_inline=Yes
option=${option#i}
;;
C*)
g_counters=Yes
option=${option#C}
;;
*)
usage 1
;;
@@ -1615,6 +1623,15 @@ export_command() # $* = original arguments less the command.
fi
}
run_command() {
if [ -x ${VARDIR}/firewall ] ; then
uptodate ${VARDIR}/firewall || echo " WARNING: ${VARDIR}/firewall is not up to date" >&2
run_it ${VARDIR}/firewall $g_debugging $@
else
fatal_error "${VARDIR}/firewall does not exist or is not executable"
fi
}
#
# Give Usage Information
#
@@ -1664,13 +1681,15 @@ usage() # $1 = exit status
echo " reject <address> ..."
echo " reload [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " reset [ <chain> ... ]"
echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ <directory> ]"
echo " restore [ -n ] [ <file name> ]"
echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ <directory> ]"
echo " restore [ -n ] [ -p ] [ -C ] [ <file name> ]"
echo " run <command> [ <parameter> ... ]"
echo " safe-restart [ -t <timeout> ] [ <directory> ]"
echo " safe-start [ -t <timeout> ] [ <directory> ]"
echo " save [ <file name> ]"
echo " save [ -C ] [ <file name> ]"
echo " [ show | list | ls ] [ -x ] [ -t {filter|mangle|nat|raw|rawpost} ] [ {chain [<chain> [ <chain> ... ]"
echo " [ show | list | ls ] actions"
echo " [ show | list | ls ] [ -x ] {bl|blacklists}"
echo " [ show | list | ls ] [ -f ] capabilities"
echo " [ show | list | ls ] classifiers"
echo " [ show | list | ls ] config"
@@ -1694,11 +1713,11 @@ usage() # $1 = exit status
echo " [ show | list | ls ] tc [ device ]"
echo " [ show | list | ls ] vardir"
echo " [ show | list | ls ] zones"
echo " start [ -f ] [ -n ] [ -p ] [ -c ] [ -T ] [ -i ] [ <directory> ]"
echo " status"
echo " start [ -f ] [ -n ] [ -p ] [ -c ] [ -T ] [ -i ] [ -C ] [ <directory> ]"
echo " status [ -i ]"
echo " stop"
echo " try <directory> [ <timeout> ]"
echo " update [ -a ] [ -b ] [ -r ] [ -T ] [ -D ] [ -i ] [-t] [-A] [ <directory> ]"
echo " update [ -a ] [ -b ] [ -r ] [ -T ] [ -D ] [ -i ] [-t] [-A] [ <directory> ]"
echo " version [ -a ]"
echo
exit $1

View File

@@ -71,10 +71,17 @@
role="bold">raw</emphasis>. If no table name(s) are given,
then <emphasis role="bold">filter</emphasis> is assumed. The
table names follow <emphasis role="bold">builtin</emphasis>
and are separated by commas; for example,
"FOOBAR,filter,mangle" would specify FOOBAR as a builtin
and are separated by commas; for example, "FOOBAR
builtin,filter,mangle" would specify FOOBAR as a builtin
target that can be used in the filter and mangle
tables.</para>
<para>Beginning with Shorewall 4.6.4, you may specify the
<emphasis role="bold">terminating</emphasis> option with
<emphasis role="bold">builtin</emphasis> to indicate to the
Shorewall optimizer that the action is terminating (the
current packet will not be passed to the next rule in the
chain).</para>
</listitem>
</varlistentry>
@@ -133,6 +140,17 @@
a subset of the rules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>terminating</term>
<listitem>
<para>Added in Shorewall 4.6.4. When used with
<replaceable>builtin</replaceable>, indicates that the
built-in action is termiating (i.e., if the action is jumped
to, the next rule in the chain is not evaluated).</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>

View File

@@ -27,7 +27,7 @@
<para>This file was introduced in Shorewall 4.6.0 and is intended to
replace <ulink
url="/manpages/shorewall-mangle.html">shorewall-rules(5)</ulink>. This
url="/manpages/shorewall-tcrules.html">shorewall-tcrules(5)</ulink>. This
file is only processed by the compiler if:</para>
<orderedlist numeration="loweralpha">
@@ -1109,6 +1109,104 @@ Normal-Service =&gt; 0x00</programlisting>
of the listed states.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">TIME</emphasis> -
<emphasis>timeelement</emphasis>[&amp;<emphasis>timeelement</emphasis>...]</term>
<listitem>
<para>Added in Shorewall 4.6.2.</para>
<para>May be used to limit the rule to a particular time period each
day, to particular days of the week or month, or to a range defined
by dates and times. Requires time match support in your kernel and
ip6tables.</para>
<para><replaceable>timeelement</replaceable> may be:</para>
<variablelist>
<varlistentry>
<term>timestart=<replaceable>hh</replaceable>:<replaceable>mm</replaceable>[:<replaceable>ss</replaceable>]</term>
<listitem>
<para>Defines the starting time of day.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>timestop=<replaceable>hh</replaceable>:<replaceable>mm</replaceable>[:<replaceable>ss</replaceable>]</term>
<listitem>
<para>Defines the ending time of day.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>utc</term>
<listitem>
<para>Times are expressed in Greenwich Mean Time.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>localtz</term>
<listitem>
<para>Deprecated by the Netfilter team in favor of <emphasis
role="bold">kerneltz</emphasis>. Times are expressed in Local
Civil Time (default).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>kerneltz</term>
<listitem>
<para>Added in Shorewall 4.5.2. Times are expressed in Local
Kernel Time (requires iptables 1.4.12 or later).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>weekdays=ddd[,ddd]...</term>
<listitem>
<para>where <replaceable>ddd</replaceable> is one of
<option>Mon</option>, <option>Tue</option>,
<option>Wed</option>, <option>Thu</option>,
<option>Fri</option>, <option>Sat</option> or
<option>Sun</option></para>
</listitem>
</varlistentry>
<varlistentry>
<term>monthdays=dd[,dd],...</term>
<listitem>
<para>where <replaceable>dd</replaceable> is an ordinal day of
the month</para>
</listitem>
</varlistentry>
<varlistentry>
<term>datestart=<replaceable>yyyy</replaceable>[-<replaceable>mm</replaceable>[-<replaceable>dd</replaceable>[<option>T</option><replaceable>hh</replaceable>[:<replaceable>mm</replaceable>[:<replaceable>ss</replaceable>]]]]]</term>
<listitem>
<para>Defines the starting date and time.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>datestop=<replaceable>yyyy</replaceable>[-<replaceable>mm</replaceable>[-<replaceable>dd</replaceable>[<option>T</option><replaceable>hh</replaceable>[:<replaceable>mm</replaceable>[:<replaceable>ss</replaceable>]]]]]</term>
<listitem>
<para>Defines the ending date and time.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

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