Compare commits

..

230 Commits

Author SHA1 Message Date
Tom Eastep
266863713d Delete main default routes when there are 'load=' or 'fallback=' interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-10-14 07:46:00 -07:00
Tom Eastep
85e44c70eb Add the Meta-connection to Tinc
- Both the macro and the tunnel type are updated

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-17 09:17:35 -07:00
Tom Eastep
03d99de8d5 Correct handling of reset
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-11 15:02:32 -07:00
Tom Eastep
426636458c Correct shorewall6 mangle man page
- Replace 'TTL' by 'HL'

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-08 12:25:59 -07:00
Tom Eastep
0aa5cb5086 Allow non-experts to use the user bits in the fw mark
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-07 11:35:47 -07:00
Tom Eastep
eddd58d459 Move a line of code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-06 10:33:09 -07:00
Tom Eastep
1bf13e5fda Provide default for SHOREWALL_SHELL
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-06 10:29:36 -07:00
Tom Eastep
682a449e7b Correct more Mangle examples
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-02 13:08:05 -07:00
Tom Eastep
9e98d30c92 Correct handling of log levels with default actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-02 08:55:18 -07:00
Tom Eastep
582755edf4 Unconditionally get inline matches
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-02 08:03:22 -07:00
Tom Eastep
dea1f853ea Correct progress messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-09-01 12:42:01 -07:00
Tom Eastep
e15a6f452e Cosmetic changes to first_entry() calls
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-31 10:54:30 -07:00
Tom Eastep
656eaabce9 Correct a typo
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-31 09:39:40 -07:00
Tom Eastep
f42dc6def1 Uniform mechanism for inserting conversion comments
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-30 15:35:05 -07:00
Tom Eastep
6e303aef69 Fix $convert/$tcrules mess
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-29 18:52:11 -07:00
Tom Eastep
ab260dc5b1 Place a header in a created mangle file during update -t
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-29 12:52:21 -07:00
Tom Eastep
55ab498291 Don't enforce FASTACCEPT/BLACKLISTNEWONLY on convert
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-29 12:51:52 -07:00
Tom Eastep
10cda4cee7 Update man pages for 'minute' and 'second' in LOGLIMIT specifications
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-27 15:49:59 -07:00
Tom Eastep
de74273dbb Assume EXPORTMODULES=No if it doesn't exist in old file during update
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-27 15:15:03 -07:00
Tom Eastep
af1e2f6c8b Read capabilities file before the .conf file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-27 11:26:26 -07:00
Tom Eastep
dc2406d25b update -t also converts the 'tos' file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-26 13:51:02 -07:00
Tom Eastep
e0734a45ee Allow 'seconds' and 'minutes' in LOGLIMIT specifications
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-26 12:53:36 -07:00
Tom Eastep
28df894add Improve 'update'
- convert BLACKLISTNEWONLY
- convert LOGRATE and LOGBURST
- default USE_DEFAULT_RT to No

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-26 12:50:56 -07:00
Tom Eastep
1d8873d3d5 Correct the shorewall6-hosts man page
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-26 12:28:57 -07:00
Tom Eastep
ad06ec3eef Correct IPV6 range parsing
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-26 11:52:51 -07:00
Tom Eastep
eae492cef5 Some rules manpage updates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-22 09:24:47 -07:00
Tom Eastep
05f9f926c4 Move fatal_error() to lib.base
Signed-off-by: Tom Eastep <teastep@shorewall.net>

Conflicts:
	Shorewall-core/lib.common
2015-08-21 14:32:09 -07:00
Tom Eastep
a709395949 Allow 'none' in the log level argument to AutoBL
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-21 13:40:12 -07:00
Tom Eastep
7956c5f6e0 Update a message to refer to the 'mangle' file rather than 'tcrules'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-20 14:48:29 -07:00
Tom Eastep
4b003163d6 Use NYTProf for profiling.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-19 14:05:15 -07:00
Tom Eastep
67aef659b5 Tweak tcrules references
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-19 12:57:36 -07:00
Tom Eastep
39982c20c4 Restore the text of tcrules warning message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-19 12:34:35 -07:00
Tom Eastep
2b1f33c391 Don't unlink the tcrules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-19 11:48:23 -07:00
Tom Eastep
1c33717cf5 Reverse the change to delete host routes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-19 11:06:28 -07:00
Tom Eastep
cd8fe38c85 Delete host routes added to the main routing table for providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-19 10:44:37 -07:00
Tom Eastep
d525419c65 Correct wording of an error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-19 10:44:00 -07:00
Tom Eastep
0e67357d63 Rewrite the trace/debugging section of the start/stop article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-18 16:00:37 -07:00
Tom Eastep
537f53f611 Restore [Install] section in the Debian .service files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-17 07:41:15 -07:00
Tom Eastep
3b1ad1e284 Delete 'conflicts=' from Shorewall-init .service files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-17 06:40:36 -07:00
Tom Eastep
9d3f35a22d Enable new update options in compiler.pl
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-16 11:57:36 -07:00
Tom Eastep
7c2a969de0 Correct handling of notrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-14 09:26:45 -07:00
Tom Eastep
8bdea65325 Update manpages for new update options
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-13 16:12:28 -07:00
Tom Eastep
fd46c0ffed Correct handling of termination after .conf file not updated
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-13 15:42:38 -07:00
Tom Eastep
60acddbb37 Add conversion version and date to the converted files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-13 14:37:13 -07:00
Tom Eastep
306dc34b31 Correct convert_blacklist()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-13 13:22:14 -07:00
Tom Eastep
f5c6a6fe82 Correct tcrules update
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-13 13:21:51 -07:00
Tom Eastep
af2b7910bd Port update changes from 5.0.0
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-12 12:33:09 -07:00
Tom Eastep
3b59e46799 Restore Debian-specific service files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-12 10:19:07 -07:00
Tom Eastep
955a2e38b7 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-08-10 17:49:40 -07:00
Tom Eastep
0f283ddc44 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-08-10 17:15:29 -07:00
Tom Eastep
4c4c5a436a Allow zero-valued options on multi-zoned interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-07 14:09:08 -07:00
Tom Eastep
d949824f94 Correct shorewall-mangle(5) examples
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-08-06 10:15:57 -07:00
Tom Eastep
a62adef0b0 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-07-31 15:21:48 -07:00
Tom Eastep
97881bb683 Create separate shorewallrc files for Debian systemd and sysvinit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-31 14:57:59 -07:00
Tom Eastep
8bcee0ee01 Add Debian .service files
- Install both .service files and SysV init scripts on Debian.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-30 14:17:36 -07:00
Tom Eastep
954f8b5790 Install both SysV init script and .service file on Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-29 09:44:20 -07:00
Tom Eastep
13650d156e Manual Updates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-26 12:51:51 -07:00
Tom Eastep
8e31255c9b Correct Shorewall6-lite manpage
- Caution moved from the restart description to the restore restriction
where it belonged

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-24 13:41:09 -07:00
Tom Eastep
5d597cb43c Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-07-19 13:52:29 -07:00
Tom Eastep
0aa7f831c4 Update my config document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-19 13:50:26 -07:00
Tom Eastep
df817b6d2c Correct formatting in the interfaces man pages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-13 13:06:53 -07:00
Tom Eastep
d0fc7f6547 Add some comments to the Zones module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-13 12:57:00 -07:00
Tom Eastep
30a5488a8a Merge branch '4.6.11' 2015-07-12 15:12:07 -07:00
Tom Eastep
5704438a44 Second Wave of changes to make script output reproducable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-12 15:00:41 -07:00
Tom Eastep
014ec1af1d First phase of producing consistent scripts with Perl >= 5.18.0
Beginning with Perl 5.18.0, the order of elements returned by the 'keys'
and 'each' iterators is no longer deterministic. This is the first wave
of Shorewall changes to compensate for this irrational behavior.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-12 10:54:48 -07:00
Tom Eastep
7fa39a63ed Don't apply 'postcompile' during an update
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-10 11:06:02 -07:00
Tom Eastep
3959feebe0 Remove extraneous line that causes a "not found" shell diagnostic
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-10 09:35:43 -07:00
Tom Eastep
bc8156b503 Include Compiler version in the compiler progress commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-08 12:53:42 -07:00
Tom Eastep
3d325431ff Change Default IPv6 .conf to specify INLINE_MATCHES=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-06 14:49:20 -07:00
Tom Eastep
f4741686e6 Correct NFLOG group description
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-06 13:42:10 -07:00
Tom Eastep
4995456563 Clean up compiler PATH fix
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-03 14:33:20 -07:00
Tom Eastep
c6f48a77e0 Only add dhcp rule if one rpfilter interface has the 'dhcp' option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-03 12:21:04 -07:00
Tom Eastep
e7792fc868 Exempt IPv4 DHCP broadcasts from rpfilter
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-03 10:03:03 -07:00
Tom Eastep
c47abe416a Add default PATH to current PATH in the compiler
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-07-03 09:38:06 -07:00
Tom Eastep
37248c9698 Correct capitalization of 'IPsec' in the IPsec-2.6 document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-29 15:35:23 -07:00
Tom Eastep
0414166d6d 'show connections' enhancement
- Allow tayloring of the entries displayed by specifying conntrack
  -L options.
2015-06-29 14:55:47 -07:00
Tom Eastep
6bd1141a8c Update Build article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-29 12:43:04 -07:00
Tom Eastep
7153146759 Don't ask for script version when WORKAROUNDS=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-28 09:18:47 -07:00
Tom Eastep
a911ec318e Add a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-27 09:19:14 -07:00
Tom Eastep
5ca68477d5 Corrections to last commit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-26 15:18:07 -07:00
Tom Eastep
9f08726794 Eliminate running the script twice is some cases
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-26 14:32:43 -07:00
Tom Eastep
846d629c47 Eliminate the usage() function in lib.cli-std
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-26 12:55:34 -07:00
Tom Eastep
273a42b068 Correct the check for ordinary user attempting to access the default config
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-26 11:35:11 -07:00
Tom Eastep
aa7aec8552 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-06-22 17:30:16 -07:00
Tom Eastep
9bf65ab9ab Don't run the postcompile script when compilation is bypassed
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-22 16:41:21 -07:00
Tom Eastep
fad92be473 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-06-22 12:23:53 -07:00
Tom Eastep
b35c214c70 Defer 'Compiling...' message until after AUTOMAKE is checked
- Avoid an export statement in compiler()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-22 10:56:17 -07:00
Tom Eastep
b5ee52e8de Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-06-19 10:04:08 -07:00
Tom Eastep
267d6c87be Merge branch '4.6.10' 2015-06-19 10:03:16 -07:00
Tom Eastep
d9e4273e6b Clarify the Universal configuration
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-19 10:00:05 -07:00
Tom Eastep
fd69209776 :Merge branch '4.6.10' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-06-09 13:09:14 -07:00
Tuomo Soini
f175ab853b rename not_configured() to not_configured_error()
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-09 11:02:00 -07:00
Tuomo Soini
e10c078a06 Set exit code to 6 when startup is disabled
Handles cases missed by 4b27c72c79

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-09 11:01:50 -07:00
Tuomo Soini
274f054d87 Add to lib.common a new function not_configured()
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-09 11:01:36 -07:00
Tuomo Soini
f3a4e25d27 Complete Shorewall-init improvements
completes 548c0558c1

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-09 11:01:28 -07:00
Tuomo Soini
e1da59e037 shorewall-init: use consitent indent
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-09 11:01:18 -07:00
Tom Eastep
5003e826b9 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-06-09 10:58:58 -07:00
Tuomo Soini
f8d95d1ee9 rename not_configured() to not_configured_error()
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-09 20:29:45 +03:00
Tom Eastep
7f50557250 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-06-08 13:50:47 -07:00
Tuomo Soini
15276b1f89 Set exit code to 6 when startup is disabled
Handles cases missed by 4b27c72c79

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-08 22:23:38 +03:00
Tuomo Soini
5221c92d7f Add to lib.common a new function not_configured()
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-08 22:18:01 +03:00
Tuomo Soini
8bc62d1474 Complete Shorewall-init improvements
completes 548c0558c1

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-08 22:15:45 +03:00
Tuomo Soini
e96fcde678 shorewall-init: use consitent indent
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-06-08 22:10:21 +03:00
Tom Eastep
116e85e040 Cosmetic cleanup of the Compiler module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-08 11:27:37 -07:00
Tom Eastep
f6b77c17ac Correct a couple of blunders in the Introductory article.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-08 10:28:18 -07:00
Tom Eastep
6be802aa7c Update the Shorewall 4 article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-08 09:46:51 -07:00
Tom Eastep
92905f0d31 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-06-07 18:18:23 -07:00
Tuomo Soini
86ffbc7e01 Fix typo in commit 1bfae13f75 2015-06-07 22:36:44 +03:00
Tom Eastep
2956698298 Corrections to WORKAROUNDS implementation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-06 12:15:03 -07:00
Tom Eastep
7c9155a6e8 Update man pages and .conf files for WORKAROUNDS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-06 07:56:14 -07:00
Tom Eastep
eb6be0e84d Remove old comment that now makes no sense
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-01 15:55:06 -07:00
Tom Eastep
019e49b481 Implement WORKAROUNDS option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-01 12:59:25 -07:00
Tom Eastep
1bfae13f75 Add note about the IPv6 address convention that uses square brackets
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-01 11:20:16 -07:00
Tom Eastep
70d41adee8 Delete extraneous '3' from the config basics article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-06-01 10:55:01 -07:00
Tom Eastep
9a3c43b6d3 Make NFQUEUE parsing more robust
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-30 07:01:30 -07:00
Tom Eastep
0a45c7a646 Another Tweak to the NFQUEUE parser
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-30 06:38:21 -07:00
Tom Eastep
f227250959 Fix NFQUEUE parsing and documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-29 18:19:35 -07:00
Tom Eastep
29a0c92918 Fix ancient bug in old parameter syntax
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-29 14:39:48 -07:00
Tom Eastep
cfc6b7405f Add sample 'findgw' scripts to the Multi-ISP doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-29 13:44:26 -07:00
Tuomo Soini
4edd6026f0 prog.footer: disabling already disabled inteface is not an error.
Neither is enabling already enabled interface

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-05-29 22:15:55 +03:00
Tom Eastep
f629d574e6 Add ipv6 'findgw' file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-28 07:20:26 -07:00
Tom Eastep
18348ef6f1 Clean up distribute_load()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-27 06:58:10 -07:00
Tom Eastep
93c7e2c2f7 Change the way in which a warning message is suppressed
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-26 15:54:41 -07:00
Tom Eastep
602315938c Correct the load distribution algorithm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-26 14:59:20 -07:00
Tom Eastep
f3d32e0023 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-05-26 11:31:12 -07:00
Tuomo Soini
19ab4472c9 shorewall-init.service*: fix description to be more generic
shorewall-init is not IPv4 only

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-05-26 19:47:28 +03:00
Tom Eastep
425094de18 Mention load= warning (sum not 1.000000)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-25 10:31:08 -07:00
Tom Eastep
ca35f565e0 Return success exit status when no ipsets are saved by the script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-25 07:36:00 -07:00
Tom Eastep
bbdbdf7c47 Clean up 'call' description in the manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-25 07:06:17 -07:00
Tom Eastep
631ebdecb8 load= enhancements
- Normalize loads to 0.nnnnnnnn
- Issue warning if the loads don't sum to 1.000000

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-23 08:05:58 -07:00
Tom Eastep
c851e03313 Don't try to use a probibility >= 1.00000000
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-23 07:06:31 -07:00
Tom Eastep
df4d6f1f92 Document load= in the providers manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-22 16:31:21 -07:00
Tom Eastep
c7ca3119ef Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-05-22 07:20:51 -07:00
Tom Eastep
ba7afcaeae Make 'call' a supported command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-21 10:38:35 -07:00
Tom Eastep
809e56cef6 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-05-21 09:04:35 -07:00
Tom Eastep
e3805b0ada Implement 'call' in the compiled script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-21 09:00:11 -07:00
Tom Eastep
f1b6e71e56 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-05-20 10:59:06 -07:00
Tom Eastep
f77d649ac7 Make policy descriptions match what the user entered rather than what was generated by the compiler
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-20 10:58:57 -07:00
Tom Eastep
267637f139 NFQUEUE enhancements
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-20 10:55:21 -07:00
Tom Eastep
acd921cd08 Don't require a helper for ctevents and expevents
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-16 13:40:40 -07:00
Tom Eastep
9329e7c36c Don't require a helper in the CT action.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-16 09:08:32 -07:00
Tom Eastep
86ef3d3e35 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-05-15 15:39:58 -07:00
Tom Eastep
cccf6b4657 Merge branch '4.6.9' 2015-05-13 14:57:53 -07:00
Tom Eastep
7195ee708e Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-05-08 09:49:42 -07:00
Tom Eastep
50d1a719f9 Delete superfluous test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-08 09:48:58 -07:00
Tom Eastep
4b27c72c79 Set exit code to 6 when startup is disabled
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-07 14:12:41 -07:00
Tom Eastep
548c0558c1 Shorewall-init improvements
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-07 12:31:46 -07:00
Tom Eastep
7a9270136c Clarify Shorewall-core's contribution in the Anatomy article.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-06 18:39:32 -07:00
Tom Eastep
a508bcf6d7 Refer to directory relocation from the Anatomy article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-05 14:35:42 -07:00
Tom Eastep
3bb1f74283 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code into 4.6.9 2015-05-05 11:28:13 -07:00
Tuomo Soini
87eca92b10 lib.core: use consisten indenting 2015-05-05 20:40:17 +03:00
Tom Eastep
b58aadad01 Correct Syntax error in the generated code.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-04 08:23:42 -07:00
Tom Eastep
6dcd8174ee Don't require interfaces on stop, clear, etc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-04 08:23:10 -07:00
Tom Eastep
fe37844455 Correct CLI helper capability detection
- Previously, the HELPERS setting was ignored

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-05-02 07:54:01 -07:00
Tom Eastep
e248c0a3d7 Update Shorewall/Shorewall6 help text for 'reenable'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-28 13:29:42 -07:00
Tom Eastep
3f17a8cf24 Update the program header information in lib.core
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-28 13:13:06 -07:00
Tom Eastep
2cea78e6df Add the 'reenable' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-28 13:02:12 -07:00
Tom Eastep
0abd51c796 Fix module versioning
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-28 11:59:01 -07:00
Tom Eastep
86e053be7a More optimization of detect_configuration()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-28 11:32:45 -07:00
Tom Eastep
864dba2e62 Clarify the need to manually create and modify ipsets
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-25 21:14:55 -07:00
Tom Eastep
75d18139f7 Optimize detect_configuration() for enable/disable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-25 15:46:19 -07:00
Tom Eastep
bebb41674a Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-04-25 12:57:04 -07:00
Tom Eastep
42f75f7ba2 Correct SetEvent and ResetEvent
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-25 12:56:36 -07:00
Tuomo Soini
2c9b7fbb07 macro.JabberSecure: use of Jabber SSL is deprecated. Note user. 2015-04-23 10:03:07 +03:00
Tuomo Soini
119299421f macro.JabberPlain: deprecate the macro in favor of macro.Jabber 2015-04-23 09:39:23 +03:00
Tuomo Soini
aef019e16d macro.Jabber: use of jabber has changed from Plain+SSL to STARTTLS 2015-04-23 09:38:40 +03:00
Tom Eastep
3ae243b882 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-04-22 20:34:03 -07:00
Tuomo Soini
0fc58f81cc macro.QUIC: added support for QUIC
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-04-22 16:29:17 +03:00
Tom Eastep
7db99832ca Add ip6tables.service to the conflicts list for Shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-18 17:22:35 -07:00
Tom Eastep
0e8b427778 Remove false comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-18 14:31:07 -07:00
Tom Eastep
ccccd847c8 Update the helpers article to mention how to avoid loading a helper.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-17 15:22:38 -07:00
Tom Eastep
6cb3004a39 Clarify helper module loading
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-17 09:51:25 -07:00
Tom Eastep
f5aa0373cb Correct interfaces example 4
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-12 08:38:55 -07:00
Tom Eastep
057ad45fd9 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2015-04-12 07:52:34 -07:00
Tuomo Soini
ade24e6299 shorewall6.service: wants before after to be consistent
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-04-12 11:31:39 +03:00
Tuomo Soini
65394b9f8c shorewall-init.service: running shorewall-init must not require networking
Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-04-12 11:26:40 +03:00
Tom Eastep
b128c30813 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code
Get Tuomo Soini's fix for serviced startup
2015-04-11 07:33:15 -07:00
Tuomo Soini
194252afd3 systemd: fix shorewall startup by adding Wants=network-online.target
Before shorewall failed to load if there were interfaces which were required
but there wasn't any other service which wanted network-online.target.
By adding Wants=network-online.target we make sure shorewall[6]* startup
won't fail if there are required interfaces

Signed-off-by: Tuomo Soini <tis@foobar.fi>
2015-04-11 10:50:54 +03:00
Tom Eastep
3cb45f234e Delete questionable logic in lib.cli
- It hasn't worked since there was a typo in it that prevented it from
  doing the correct thing.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-07 12:12:59 -07:00
Tom Eastep
16e3cb1b43 More manpage updates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-07 10:14:42 -07:00
Tom Eastep
27c1ffc5fb Include full syntax in lists of CLI commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-07 09:23:58 -07:00
Tom Eastep
23137e5e8a Correct typo in lib.cli
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-07 09:23:35 -07:00
Tom Eastep
0e54a86e82 Add descriptions of 'list' and 'ls' to the CLI manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-06 09:39:41 -07:00
Tom Eastep
4fd8aa692d Add comment to setting of TCPMSS_TARGET with old caps file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-04 09:34:23 -07:00
Tom Eastep
8c3dda80a3 Simplify previous change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-03 16:35:50 -07:00
Tom Eastep
9f96f58a0d Default TCPMSS_TARGET to 1 in old capabilities files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-03 14:46:50 -07:00
Tom Eastep
77165326f2 Merge branch '4.6.8'
Conflicts:
	Shorewall6/uninstall.sh
2015-04-03 14:02:21 -07:00
Tom Eastep
eb3a162560 Apply Matt Darfeuille's fix for fatal_error()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-02 13:26:51 -07:00
Tom Eastep
a8026999a5 Another fix for the Shorewall6 uninstaller
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-02 07:47:53 -07:00
Tom Eastep
44142ed457 Apply Matt Darfeuille's uninstall fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-02 07:28:21 -07:00
Tom Eastep
659e9d550c Apply Matt Darfeuille's uninstall fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-04-02 07:27:57 -07:00
Tom Eastep
7442c2189d Implement TCPMSS_TARGET capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-31 15:53:05 -07:00
Tom Eastep
551be3ed39 Rearrange script samples in the Multi-ISP document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-30 09:11:20 -07:00
Tom Eastep
468167f9e5 Apply nfw's fix for IP[6]TABLES in the conntrack file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-24 09:23:15 -07:00
Tom Eastep
6921270c77 Clarify DESTDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-24 09:08:30 -07:00
Tom Eastep
50bbf9499a Don't install in global directories when configure == 0
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-24 07:51:56 -07:00
Tom Eastep
b00a7af619 Allow a comma-separated list in the rtrules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-18 15:16:25 -07:00
Tom Eastep
0c11870e46 Implement the 'savesets' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-17 10:03:12 -07:00
Tom Eastep
fdc36747ad Allow the 'open' and 'close' commands to handle icmp
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-16 16:25:32 -07:00
Tom Eastep
79d8d73e02 Correct types in config file basics doc 2015-03-16 15:11:14 -07:00
Tom Eastep
ecaae1f644 Improve editing of open numbers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-15 10:15:39 -07:00
Tom Eastep
52e7efc666 Move open_close_setup() inside open_close_command()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-14 09:42:43 -07:00
Tom Eastep
c5ef3fd905 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-03-14 08:55:40 -07:00
Tom Eastep
86d6d6900e Improve 'close' and 'show opens' commands
- close accepts a rule number
- list opens displays rule numbers

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-14 08:54:30 -07:00
Tom Eastep
9a5cc5e51c Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-03-07 07:57:26 -08:00
Tom Eastep
d7a1ca41f9 Another attempt to correct the formatting of the manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-07 07:56:34 -08:00
Tom Eastep
d3552346b0 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-03-06 15:38:48 -08:00
Tom Eastep
1e6c266b51 Formatting fix (I hope)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-06 15:37:56 -08:00
Tom Eastep
d6f8cda2d5 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-03-06 14:10:13 -08:00
Tom Eastep
4cc866cd81 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2015-03-06 14:09:11 -08:00
Tom Eastep
095e523c9f Add 'show opens' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-06 13:10:23 -08:00
Tom Eastep
2817060edb Improvements to the 'open' and 'close' commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-06 08:13:44 -08:00
Tom Eastep
30e750608b Fix broken links
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-05 16:23:49 -08:00
Tom Eastep
a85fdc45ac Implement 'open' and 'close' commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-03-05 16:20:54 -08:00
Roberto C. Sánchez
79b6b7cf08 Fix incorrectly specified directory for VARDIR 2015-03-02 10:27:03 -05:00
Roberto C. Sánchez
5f2a8dd9cb Fix typo 2015-03-02 10:12:36 -05:00
Roberto C. Sánchez
a28cd7371c Fix typo 2015-03-02 10:10:52 -05:00
Roberto C. Sánchez
e9bb447537 Fix typo 2015-03-02 09:58:09 -05:00
Tom Eastep
cdc2d52208 Implement ADD and DEL in the mangle file.
- Also document the parameter to SAME

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-02-18 12:04:01 -08:00
Tom Eastep
18c8f1f835 Remove blank line
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-02-17 20:10:25 -08:00
Tom Eastep
aff8623a44 Allow TTL to be specified in the SAME action.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-02-17 19:11:28 -08:00
Tom Eastep
361f5af3e0 Fix broken link
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-02-13 14:28:21 -08:00
Tom Eastep
b14e7c54f9 Merge branch '4.6.6' 2015-02-07 08:29:44 -08:00
Tom Eastep
5d110616a5 Merge branch '4.6.6' 2015-01-24 18:16:47 -08:00
Tom Eastep
c7cd0060f0 Merge branch '4.6.6' 2015-01-23 09:07:28 -08:00
Tom Eastep
7ab055e61e Correct file name in mangle 'split_line' error messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-01-22 08:31:51 -08:00
Tom Eastep
758f3cf955 Change the installation default value of INLINE_MATCHES to 'No'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-01-22 08:30:50 -08:00
Tom Eastep
08a184d95b Protect 'enable' and 'disable' with mutex
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-01-22 08:30:05 -08:00
Tom Eastep
50a0103e89 Merge branch '4.6.6' 2015-01-20 08:11:07 -08:00
Tom Eastep
28ac76bde4 Add tinc tunnel support
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2015-01-13 13:28:37 -08:00
115 changed files with 5188 additions and 2159 deletions

View File

@@ -102,7 +102,7 @@ if [ -z "$vendor" ]; then
vendor=redhat
;;
debian|ubuntu)
vendor=debian
ls -l /sbin/init |fgrep -q systemd | vendor=debian.systemd | vendor=debian.sysvinit
;;
opensuse)
vendor=suse
@@ -130,7 +130,7 @@ if [ -z "$vendor" ]; then
*)
if [ -f /etc/debian_version ]; then
params[HOST]=debian
rcfile=shorewallrc.debian
rcfile=shorewallrc.debian.sysvinit
elif [ -f /etc/redhat-release ]; then
params[HOST]=redhat
rcfile=shorewallrc.redhat

View File

@@ -68,14 +68,16 @@ unless ( defined $vendor ) {
$vendor = 'redhat';
} elsif ( $id eq 'opensuse' ) {
$vendor = 'suse';
} elsif ( $id eq 'ubuntu' ) {
$vendor = 'debian';
} elsif ( $id eq 'ubuntu' || $id eq 'debian' ) {
my $init = `ls -l /sbin/init`;
$vendor = $init =~ /systemd/ ? 'debian.systemd' : 'debian.sysvinit';
} else {
$vendor = $id;
}
}
$params{HOST} = $vendor;
$params{HOST} =~ s/\..*//;
}
if ( defined $vendor ) {
@@ -84,7 +86,7 @@ if ( defined $vendor ) {
} else {
if ( -f '/etc/debian_version' ) {
$vendor = 'debian';
$rcfilename = 'shorewallrc.debian';
$rcfilename = 'shorewallrc.debian.sysvinit';
} elsif ( -f '/etc/redhat-release' ){
$vendor = 'redhat';
$rcfilename = 'shorewallrc.redhat';
@@ -117,7 +119,7 @@ my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
if ( $vendor eq 'linux' ) {
printf "INFO: Creating a generic Linux installation - %s %2d %04d %02d:%02d:%02d\n\n", $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];;
} else {
printf "INFO: Creating a %s-specific installation - %s %2d %04d %02d:%02d:%02d\n\n", $vendor, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];;
printf "INFO: Creating a %s-specific installation - %s %2d %04d %02d:%02d:%02d\n\n", $params{HOST}, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];;
}
open $rcfile, '<', $rcfilename or die "Unable to open $rcfilename for input: $!";

View File

@@ -75,6 +75,24 @@ elif [ -z "${VARDIR}" ]; then
VARDIR="${VARLIB}/${PRODUCT}"
fi
#
# Fatal Error
#
fatal_error() # $@ = Message
{
echo " ERROR: $@" >&2
exit 2
}
#
# Not configured Error
#
not_configured_error() # $@ = Message
{
echo " ERROR: $@" >&2
exit 6
}
#
# Conditionally produce message
#

View File

@@ -25,7 +25,7 @@
# loaded after this one and replaces some of the functions declared here.
#
SHOREWALL_CAPVERSION=40606
SHOREWALL_CAPVERSION=40609
[ -n "${g_program:=shorewall}" ]
@@ -42,16 +42,6 @@ fi
. ${SHAREDIR}/shorewall/lib.base
#
# Fatal Error
#
fatal_error() # $@ = Message
{
echo " ERROR: $@" >&2
exit 2
}
#
# Issue an error message and die
#
@@ -375,7 +365,18 @@ savesets() {
supported=$(run_it ${VARDIR}/firewall help | fgrep savesets )
[ -n "$supported" ] && run_it ${VARDIR}/firewall savesets ${g_restorepath}-ipsets
[ -n "$supported" ] && run_it ${VARDIR}/firewall savesets ${g_restorepath}-ipsets
}
#
# Proactive save of the current ipset contents
#
savesets1() {
local supported
supported=$(run_it ${VARDIR}/firewall help | fgrep savesets )
[ -n "$supported" ] && run_it ${VARDIR}/firewall savesets ${VARDIR}/ipsets.save && progress_message3 "The ipsets have been saved to ${VARDIR}/ipsets.save"
}
#
@@ -387,16 +388,30 @@ do_save() {
status=0
if [ -f ${VARDIR}/firewall ]; then
if $iptables_save | iptablesbug > ${VARDIR}/restore-$$; then
cp -f ${VARDIR}/firewall $g_restorepath
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables
chmod +x $g_restorepath
echo " Currently-running Configuration Saved to $g_restorepath"
run_user_exit save
if [ -n "$WORKAROUNDS" ]; then
if $iptables_save | iptablesbug | grep -v -- '-A dynamic.* -j ACCEPT' > ${VARDIR}/restore-$$; then
cp -f ${VARDIR}/firewall $g_restorepath
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables
chmod +x $g_restorepath
echo " Currently-running Configuration Saved to $g_restorepath"
run_user_exit save
else
rm -f ${VARDIR}/restore-$$
echo " ERROR: Currently-running Configuration Not Saved" >&2
status=1
fi
else
rm -f ${VARDIR}/restore-$$
echo " ERROR: Currently-running Configuration Not Saved" >&2
status=1
if $iptables_save | grep -v -- '-A dynamic.* -j ACCEPT' > ${VARDIR}/restore-$$; then
cp -f ${VARDIR}/firewall $g_restorepath
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables
chmod +x $g_restorepath
echo " Currently-running Configuration Saved to $g_restorepath"
run_user_exit save
else
rm -f ${VARDIR}/restore-$$
echo " ERROR: Currently-running Configuration Not Saved" >&2
status=1
fi
fi
else
echo " ERROR: ${VARDIR}/firewall does not exist" >&2
@@ -408,14 +423,24 @@ do_save() {
resolve_arptables
if [ -n "$arptables" ]; then
#
# 'sed' command is a hack to work around broken arptables_jf
#
if ${arptables}-save | sed 's/-p[[:space:]]\+0\([[:digit:]]\)00\/ffff/-p 000\1\/ffff/' > ${VARDIR}/restore-$$; then
if grep -q '^-A' ${VARDIR}/restore-$$; then
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-arptables
else
rm -f ${VARDIR}/restore-$$
if [ -n "$WORKAROUNDS" ]; then
#
# 'sed' command is a hack to work around broken arptables_jf
#
if ${arptables}-save | sed 's/-p[[:space:]]\+0\([[:digit:]]\)00\/ffff/-p 000\1\/ffff/' > ${VARDIR}/restore-$$; then
if grep -q '^-A' ${VARDIR}/restore-$$; then
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-arptables
else
rm -f ${VARDIR}/restore-$$
fi
fi
else
if ${arptables}-save > ${VARDIR}/restore-$$; then
if grep -q '^-A' ${VARDIR}/restore-$$; then
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-arptables
else
rm -f ${VARDIR}/restore-$$
fi
fi
fi
else
@@ -456,24 +481,31 @@ do_save() {
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 [ -n "$WORKAROUNDS" ]; 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 ${g_restorepath}-ipsets
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
elif eval $IPSET -S > ${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
;;
[Nn]o)
[Nn]o|ipv4|ipv6)
;;
*)
error_message "WARNING: Invalid value ($SAVE_IPSETS) for SAVE_IPSETS"
@@ -980,8 +1012,6 @@ show_command() {
case "$1" in
connections)
[ $# -gt 1 ] && usage 1
if [ $g_family -eq 4 ]; then
if [ -d /proc/sys/net/netfilter/ ]; then
local count
@@ -996,8 +1026,10 @@ show_command() {
echo
if qt mywhich conntrack ; then
conntrack -f ipv${g_family} -L | show_connections_filter
shift
conntrack -f ipv4 -L $@ | show_connections_filter
else
[ $# -gt 1 ] && usage 1
if [ -f /proc/net/ip_conntrack ]; then
cat /proc/net/ip_conntrack | show_connections_filter
else
@@ -1005,10 +1037,12 @@ show_command() {
fi
fi
elif qt mywhich conntrack ; then
shift
echo "$g_product $SHOREWALL_VERSION Connections at $g_hostname - $(date)"
echo
conntrack -f ipv6 -L | show_connections_filter
conntrack -f ipv6 -L $@ | show_connections_filter
else
[ $# -gt 1 ] && usage 1
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
echo "$g_product $SHOREWALL_VERSION Connections ($count of $max) at $g_hostname - $(date)"
@@ -1224,6 +1258,16 @@ show_command() {
echo
show_bl;
;;
opens)
[ $# -gt 1 ] && usage 1
echo "$g_product $SHOREWALL_VERSION Temporarily opened connections at $g_hostname - $(date)"
if chain_exists dynamic; then
g_ipt_options="$g_ipt_options --line-numbers"
$g_tool -t filter -L dynamic $g_ipt_options | head -n2
$g_tool -t filter -L dynamic $g_ipt_options | fgrep ACCEPT | $output_filter
fi
;;
*)
case "$g_program" in
*-lite)
@@ -1502,7 +1546,9 @@ do_dump_command() {
heading "Conntrack Table"
fi
if [ $g_family -eq 4 ]; then
if qt mywhich conntrack; then
conntrack -f ipv${g_family} -L 2> /dev/null
elif [ $g_family -eq 4 ]; then
[ -f /proc/net/ip_conntrack ] && cat /proc/net/ip_conntrack || grep -v '^ipv6' /proc/net/nf_conntrack
else
grep '^ipv6' /proc/net/nf_conntrack
@@ -1662,7 +1708,7 @@ restore_command() {
if [ -z "$STARTUP_ENABLED" ]; then
error_message "ERROR: Startup is disabled"
exit 2
exit 6
fi
g_restorepath=${VARDIR}/$RESTOREFILE
@@ -2076,6 +2122,166 @@ delete_command() {
fi
}
open_close_command() {
local command
local desc
local proto
local icmptype
open_close_setup() {
[ -n "$g_nolock" ] || mutex_on
if ! product_is_started ; then
[ -n "$g_nolock" ] || mutex_off
fatal_error "The $COMMAND command requires the firewall to be running"
fi
if ! chain_exists dynamic; then
[ -n "$g_nolock" ] || mutex_off
fatal_error "The $COMMAND command requires DYNAMIC_BLACKLIST=Yes in the running configuration"
fi
}
[ $# -le 4 ] || fatal_error "Too many parameters"
if [ $COMMAND = open ]; then
[ $# -ge 2 ] || fatal_error "Too few parameters"
else
[ $# -ge 1 ] || fatal_error "Too few parameters"
fi
if [ $# -eq 1 ]; then
#
# close <rule number>
#
case $1 in
[1-9]|[1-9][0-9]|[1-9][0-9][0-9]*)
;;
*)
fatal_error "$1 is not a valid temporary open number"
;;
esac
open_close_setup #Conditionally acquires mutex
if $g_tool -L dynamic --line-numbers | grep -q "^$1 .* ACCEPT "; then
if $g_tool -D dynamic $1; then
[ -n "$g_nolock" ] || mutex_off
echo "Temporary open #$1 closed"
return 0
fi
[ -n "$g_nolock" ] || mutex_off
return 2
else
[ -n "$g_nolock" ] || mutex_off
fatal_error "$1 is not a valid temporary open number"
fi
else
if [ $1 = all ]; then
command=dynamic
else
command="dynamic -s $1"
fi
if [ $2 != all ]; then
command="$command -d $2"
fi
desc="from $1 to $2"
if [ $# -ge 3 ]; then
proto=$3
[ $proto = icmp -a $g_family -eq 6 ] && proto=58
command="$command -p $proto"
case $3 in
[0-9]*)
desc="$desc protocol $3"
;;
*)
desc="$desc $3"
;;
esac
if [ $g_family -eq 4 ]; then
if [ $proto = 6 -o $proto = icmp ]; then
proto=icmp
icmptype='--icmp-type'
fi
else
if [ $proto = 58 -o $proto = ipv6-icmp ]; then
proto=icmp
icmptype='--icmpv6-type'
fi
fi
fi
if [ $# -eq 4 ]; then
if [ $proto = icmp ]; then
case $4 in
*,*)
fatal_error "Only a single ICMP type may be specified"
;;
[0-9]*)
desc="$desc type $4"
;;
*)
desc="$desc $4"
;;
esac
command="$command $icmptype $4"
else
case $4 in
*,*)
command="$command -m multiport --dports $4"
;;
*)
command="$command --dport $4"
;;
esac
case $4 in
[0-9]*,)
desc="$desc ports $4"
;;
[0-9]*)
desc="$desc port $4"
;;
*)
desc="$desc $4"
;;
esac
fi
fi
command="$command -j ACCEPT"
open_close_setup #Conditionally acquires mutex
if [ $COMMAND = open ]; then
if $g_tool -I $command ; then
[ -n "$g_nolock" ] || mutex_off
echo "Firewall dynamically opened for connections $desc"
return 0
fi
[ -n "$g_nolock" ] || mutex_off
return 2
fi
if $g_tool -D $command 2> /dev/null; then
[ -n "$g_nolock" ] || mutex_off
echo "Firewall dynamically closed for connections $desc (may still be permitted by rules/policies)"
return 0
fi
[ -n "$g_nolock" ] || mutex_off
fatal_error "Connections $desc are not currently opened"
fi
}
#
# 'hits' commmand executor
#
@@ -2294,6 +2500,7 @@ determine_capabilities() {
local chain
local chain1
local arptables
local helper
if [ -z "$g_tool" ]; then
[ $g_family -eq 4 ] && tool=iptables || tool=ip6tables
@@ -2394,6 +2601,7 @@ determine_capabilities() {
NEW_TOS_MATCH=
TARPIT_TARGET=
IFACE_MATCH=
TCPMSS_TARGET=
AMANDA_HELPER=
FTP_HELPER=
@@ -2551,6 +2759,8 @@ determine_capabilities() {
qt $g_tool -A $chain -m iface --iface lo --loopback && IFACE_MATCH=Yes
qt $g_tool -A $chain -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu && TCPMSS_TARGET=Yes
if [ -n "$MANGLE_ENABLED" ]; then
qt $g_tool -t mangle -N $chain
@@ -2592,21 +2802,44 @@ determine_capabilities() {
if qt $g_tool -t raw -A $chain -j CT --notrack; then
CT_TARGET=Yes;
qt $g_tool -t raw -A $chain -p udp --dport 10080 -j CT --helper amanda && AMANDA_HELPER=Yes
qt $g_tool -t raw -A $chain -p tcp --dport 21 -j CT --helper ftp && FTP_HELPER=Yes
qt $g_tool -t raw -A $chain -p tcp --dport 21 -j CT --helper ftp-0 && FTP0_HELPER=Yes
qt $g_tool -t raw -A $chain -p udp --dport 1719 -j CT --helper RAS && H323_HELPER=Yes
qt $g_tool -t raw -A $chain -p tcp --dport 6667 -j CT --helper irc && IRC_HELPER=Yes
qt $g_tool -t raw -A $chain -p tcp --dport 6667 -j CT --helper irc-0 && IRC0_HELPER=Yes
qt $g_tool -t raw -A $chain -p udp --dport 137 -j CT --helper netbios-ns && NETBIOS_NS_HELPER=Yes
qt $g_tool -t raw -A $chain -p tcp --dport 1729 -j CT --helper pptp && PPTP_HELPER=Yes
qt $g_tool -t raw -A $chain -p tcp --dport 6566 -j CT --helper sane && SANE_HELPER=Yes
qt $g_tool -t raw -A $chain -p tcp --dport 6566 -j CT --helper sane-0 && SANE0_HELPER=Yes
qt $g_tool -t raw -A $chain -p udp --dport 5060 -j CT --helper sip && SIP_HELPER=Yes
qt $g_tool -t raw -A $chain -p udp --dport 5060 -j CT --helper sip-0 && SIP0_HELPER=Yes
qt $g_tool -t raw -A $chain -p udp --dport 161 -j CT --helper snmp && SNMP_HELPER=Yes
qt $g_tool -t raw -A $chain -p udp --dport 69 -j CT --helper tftp && TFTP_HELPER=Yes
qt $g_tool -t raw -A $chain -p udp --dport 69 -j CT --helper tftp-0 && TFTP0_HELPER=Yes
for helper in amanda ftp ftp0 h323 irc irc0 netbios_ns pptp sane sane0 sip sip0 snmp tftp tftp0; do
eval ${helper}_ENABLED=''
done
if [ -n "$HELPERS" ]; then
for helper in $(split_list "$HELPERS"); do
case $helper in
none)
;;
amanda|ftp|ftp0|h323|irc|irc0|netbios_ns|pptp|sane|sane0|sip|sip0|snmp|tftp|tftp0)
eval ${helper}_ENABLED=Yes
;;
*)
error_message "WARNING: Invalid helper ($helper) ignored"
;;
esac
done
else
for helper in amanda ftp ftp0 h323 irc irc0 netbios_ns pptp sane sane0 sip sip0 snmp tftp tftp0; do
eval ${helper}_ENABLED=Yes
done
fi
[ -n "$amanda_ENABLED" ] && qt $g_tool -t raw -A $chain -p udp --dport 10080 -j CT --helper amanda && AMANDA_HELPER=Yes
[ -n "$ftp_ENABLED" ] && qt $g_tool -t raw -A $chain -p tcp --dport 21 -j CT --helper ftp && FTP_HELPER=Yes
[ -n "$ftp0_ENABLED" ] && qt $g_tool -t raw -A $chain -p tcp --dport 21 -j CT --helper ftp-0 && FTP0_HELPER=Yes
[ -n "$h323_ENABLED" ] && qt $g_tool -t raw -A $chain -p udp --dport 1719 -j CT --helper RAS && H323_HELPER=Yes
[ -n "$irc_ENABLED" ] && qt $g_tool -t raw -A $chain -p tcp --dport 6667 -j CT --helper irc && IRC_HELPER=Yes
[ -n "$irc0_ENABLED" ] && qt $g_tool -t raw -A $chain -p tcp --dport 6667 -j CT --helper irc-0 && IRC0_HELPER=Yes
[ -n "$netbios_ns_ENABLED" ] && qt $g_tool -t raw -A $chain -p udp --dport 137 -j CT --helper netbios-ns && NETBIOS_NS_HELPER=Yes
[ -n "$pptp_ENABLED" ] && qt $g_tool -t raw -A $chain -p tcp --dport 1729 -j CT --helper pptp && PPTP_HELPER=Yes
[ -n "$sane_ENABLED" ] && qt $g_tool -t raw -A $chain -p tcp --dport 6566 -j CT --helper sane && SANE_HELPER=Yes
[ -n "$sane0_ENABLED" ] && qt $g_tool -t raw -A $chain -p tcp --dport 6566 -j CT --helper sane-0 && SANE0_HELPER=Yes
[ -n "$sip_ENABLED" ] && qt $g_tool -t raw -A $chain -p udp --dport 5060 -j CT --helper sip && SIP_HELPER=Yes
[ -n "$sip0_ENABLED" ] && qt $g_tool -t raw -A $chain -p udp --dport 5060 -j CT --helper sip-0 && SIP0_HELPER=Yes
[ -n "$snmp_ENABLED" ] && qt $g_tool -t raw -A $chain -p udp --dport 161 -j CT --helper snmp && SNMP_HELPER=Yes
[ -n "$tftp_ENABLED" ] && qt $g_tool -t raw -A $chain -p udp --dport 69 -j CT --helper tftp && TFTP_HELPER=Yes
[ -n "$tftp0_ENABLED" ] && qt $g_tool -t raw -A $chain -p udp --dport 69 -j CT --helper tftp-0 && TFTP0_HELPER=Yes
fi
qt $g_tool -t raw -F $chain
@@ -2820,16 +3053,17 @@ report_capabilities_unsorted() {
report_capability "IMQ Target (IMQ_TARGET)" $IMQ_TARGET
report_capability "DSCP Match (DSCP_MATCH)" $DSCP_MATCH
report_capability "DSCP Target (DSCP_TARGET)" $DSCP_TARGET
report_capability "Geo IP match" $GEOIP_MATCH
report_capability "RPFilter match" $RPFILTER_MATCH
report_capability "NFAcct match" $NFACCT_MATCH
report_capability "Checksum Target" $CHECKSUM_TARGET
report_capability "Arptables JF" $ARPTABLESJF
report_capability "MASQUERADE Target" $MASQUERADE_TGT
report_capability "UDPLITE Port Redirection" $UDPLITEREDIRECT
report_capability "New tos Match" $NEW_TOS_MATCH
report_capability "TARPIT Target" $TARPIT_TARGET
report_capability "Iface Match" $IFACE_MATCH
report_capability "Geo IP Match (GEOIP_MATCH)" $GEOIP_MATCH
report_capability "RPFilter Match (RPFILTER_MATCH)" $RPFILTER_MATCH
report_capability "NFAcct Match" $NFACCT_MATCH
report_capability "Checksum Target (CHECKSUM_TARGET)" $CHECKSUM_TARGET
report_capability "Arptables JF (ARPTABLESJF)" $ARPTABLESJF
report_capability "MASQUERADE Target (MASQUERADE_TGT)" $MASQUERADE_TGT
report_capability "UDPLITE Port Redirection (UDPLITEREDIRECT)" $UDPLITEREDIRECT
report_capability "New tos Match (NEW_TOS_MATCH)" $NEW_TOS_MATCH
report_capability "TARPIT Target (TARPIT_TARGET)" $TARPIT_TARGET
report_capability "Iface Match (IFACE_MATCH)" $IFACE_MATCH
report_capability "TCPMSS Target (TCPMSS_TARGET)" $TCPMSS_TARGET
report_capability "Amanda Helper" $AMANDA_HELPER
report_capability "FTP Helper" $FTP_HELPER
@@ -2959,6 +3193,7 @@ report_capabilities_unsorted1() {
report_capability1 NEW_TOS_MATCH
report_capability1 TARPIT_TARGET
report_capability1 IFACE_MATCH
report_capability1 TCPMSS_TARGET
report_capability1 AMANDA_HELPER
report_capability1 FTP_HELPER
@@ -3419,6 +3654,19 @@ get_config() {
IPSET=''
fi
if [ -n "$WORKAROUNDS" ]; then
case $WORKAROUNDS in
[Yy]es)
;;
[Nn]o)
WORKAROUNDS=''
;;
*)
fatal_error "Invalid setting ($WORKAROUNDS) for WORKAROUNDS"
;;
esac
fi
TC=tc
IP=$(mywhich ip 2> /dev/null)
@@ -3470,7 +3718,7 @@ start_command() {
else
error_message "${VARDIR}/firewall is missing or is not executable"
logger -p kern.err "ERROR:$g_product start failed"
rc=2
rc=6
fi
[ -n "$g_nolock" ] || mutex_off
@@ -3603,7 +3851,7 @@ restart_command() {
else
error_message "${VARDIR}/firewall is missing or is not executable"
logger -p kern.err "ERROR:$g_product restart failed"
rc=2
rc=6
fi
[ -n "$g_nolock" ] || mutex_off
@@ -3618,6 +3866,12 @@ run_command() {
fi
}
#
# Echo the parameters if product is Shorewall or Shorewall6
#
ecko() {
[ -z "$g_lite" ] && echo "$@"
}
#
# Give Usage Information
#
@@ -3627,12 +3881,16 @@ usage() # $1 = exit status
echo "where <command> is one of:"
echo " add <interface>[:<host-list>] ... <zone>"
echo " allow <address> ..."
ecko " [ check | ck ] [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ -i ] [ <directory> ]"
echo " clear"
ecko " [ compile | co ] [ -e ] [ -p ] [ -t ] [ -c ] [ -d ] [ -T ] [ -i ] [ <directory name> ] [ <path name> ]"
echo " close <source> <dest> [ <protocol> [ <port> ] ]"
echo " delete <interface>[:<host-list>] ... <zone>"
echo " disable <interface>"
echo " drop <address> ..."
echo " dump [ -x ] [ -l ] [ -m ]"
echo " enable <interface>"
ecko " export [ <directory1> ] [<user>@]<system>[:<directory2>]"
echo " forget [ <file name> ]"
echo " help"
@@ -3642,18 +3900,46 @@ usage() # $1 = exit status
echo " iprange <address>-<address>"
fi
if [ $g_family -eq 4 ]; then
echo " iptrace <iptables match expression>"
else
echo " iptrace <ip6tables match expression>"
fi
ecko " load [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " logdrop <address> ..."
echo " logreject <address> ..."
echo " logwatch [<refresh interval>]"
if [ $g_family -eq 4 ]; then
echo " noiptrace <iptables match expression>"
else
echo " noiptrace <ip6tables match expression>"
fi
echo " open <source> <dest> [ <protocol> [ <port> ] ]"
echo " reenable <interface>"
ecko " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]"
echo " reject <address> ..."
ecko " reload [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " reset [ <chain> ... ]"
echo " restart [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]"
if [ -n "$g_lite" ]; then
echo " restart [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]"
else
echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ <directory> ]"
fi
echo " restore [ -n ] [ -p ] [ -C ] [ <file name> ]"
echo " run <command> [ <parameter> ... ]"
ecko " safe-restart [ -t <timeout> ] [ <directory> ]"
ecko " safe-start [ -t <timeout> ] [ <directory> ]"
echo " save [ -C ] [ <file name> ]"
echo " savesets"
echo " [ show | list | ls ] [ -b ] [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]"
echo " [ show | list | ls ] [ -f ] capabilities"
ecko " [ show | list | ls ] actions"
echo " [ show | list | ls ] arptables"
echo " [ show | list | ls ] [ -f ] capabilities"
echo " [ show | list | ls ] [ -x ] {bl|blacklists}"
echo " [ show | list | ls ] classifiers"
echo " [ show | list | ls ] config"
@@ -3669,15 +3955,26 @@ usage() # $1 = exit status
echo " [ show | list | ls ] [ -m ] log [<regex>]"
echo " [ show | list | ls ] [ -x ] mangle|nat|raw|rawpost"
ecko " [ show | list | ls ] macro <macro>"
ecko " [ show | list | ls ] macros"
echo " [ show | list | ls ] nfacct"
echo " [ show | list | ls ] opens"
echo " [ show | list | ls ] policies"
echo " [ show | list | ls ] routing"
echo " [ show | list | ls ] tc [ device ]"
echo " [ show | list | ls ] vardir"
echo " [ show | list | ls ] zones"
echo " start [ -f ] [ -p ] [ -C ] [ <directory> ]"
echo " stop"
if [ -n "$g_lite" ]; then
echo " start [ -f ] [ -p ] [ -C ] [ <directory> ]"
else
echo " start [ -f ] [ -n ] [ -p ] [ -c ] [ -T ] [ -i ] [ -C ] [ <directory> ]"
fi
echo " status [ -i ]"
echo " stop"
ecko " try <directory> [ <timeout> ]"
ecko " update [ -a ] [ -b ] [ -r ] [ -T ] [ -D ] [ -i ] [-t] [-s] [-n] [-A] [ <directory> ]"
echo " version [ -a ]"
echo
exit $1
@@ -3729,6 +4026,9 @@ shorewall_cli() {
g_tcrules=
g_counters=
g_loopback=
g_compiled=
g_routestopped=
g_notrack=
VERBOSE=
VERBOSITY=1
@@ -3850,10 +4150,6 @@ shorewall_cli() {
[ -n "${VARDIR:=/var/lib/$g_program}" ]
if [ ! -f ${VARDIR}/firewall ]; then
[ -f ${VARDIR}/.restore ] && cp -f ${VARDIR}/.rstore ${VARDIR}/firewall
fi
g_firewall=${VARDIR}/firewall
version_file=${g_sharedir}/version
@@ -3916,7 +4212,7 @@ shorewall_cli() {
shift
restart_command $@
;;
disable|enable)
disable|enable|reenable)
get_config Yes
if product_is_started; then
run_it ${VARDIR}/firewall $g_debugging $@
@@ -3979,6 +4275,11 @@ shorewall_cli() {
[ $# -eq 1 ] && usage 1
reject_command $@
;;
open|close)
get_config
shift
open_close_command $@
;;
allow)
get_config
allow_command $@
@@ -4023,10 +4324,29 @@ shorewall_cli() {
get_config
[ -n "$g_debugging" ] && set -x
#
# Undocumented way to call functions in the libraries directly
# Way to call functions in the libraries directly
#
shift
$@
if [ $# -gt 0 ]; then
#
# First look for it here
#
if type $1 2> /dev/null | fgrep -q 'is a function'; then
#
# It's a shell function -- call it
#
$@
else
#
# It isn't a function visible to this script -- try
# the compiled firewall
#
run_it $g_firewall $g_debugging call $@
fi
else
usage 1
fi
;;
help)
shift
@@ -4042,6 +4362,12 @@ shorewall_cli() {
shift
noiptrace_command $@
;;
savesets)
[ $# -eq 1 ] || usage 1
get_config
[ -n "$g_debugging" ] && set -x
savesets1
;;
*)
if [ -z "$g_lite" ]; then
compiler_command $@

View File

@@ -80,14 +80,23 @@ get_script_version() { # $1 = script
local digits
local verbosity
verbosity="$VERBOSITY"
VERBOSITY=0
if [ -z "$WORKAROUNDS" -o "$g_compiled" = "$g_file" ]; then
#
# Unless WORKAROUNDS=No, either this script was just compiled or AUTOMAKE
# determined that re-compilation wasn't needed
#
temp="$SHOREWALL_VERSION"
else
verbosity="$VERBOSITY"
VERBOSITY=0
temp=$( $SHOREWALL_SHELL $1 version | tail -n 1 | sed 's/-.*//' )
temp=$( $SHOREWALL_SHELL $1 version | tail -n 1 )
fi
if [ -z "$temp" ]; then
version=0
else
temp=${temp%-*}
ifs=$IFS
IFS=.
temp=$(echo $temp)
@@ -211,6 +220,17 @@ split() {
IFS=$ifs
}
#
# Split a comma-separated list into a space-separated list
#
split_list() {
local ifs
ifs=$IFS
IFS=,
echo $*
IFS=$ifs
}
#
# Search a list looking for a match -- returns zero if a match found
# 1 otherwise

View File

@@ -0,0 +1,23 @@
#
# Debian Shorewall 4.5 rc file
#
BUILD= #Default is to detect the build system
HOST=debian
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
CONFDIR=/etc #Directory where subsystem configurations are installed
SBINDIR=/sbin #Directory where system administration programs are installed
MANDIR=${PREFIX}/share/man #Directory where manpages are installed.
INITDIR= #Directory where SysV init scripts are installed.
INITFILE= #Name of the product's installed SysV init script
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed
SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR
SERVICEFILE=$PRODUCT.service.debian #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
SERVICEDIR=/lib/systemd/system #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

@@ -15,9 +15,9 @@ INITFILE=$PRODUCT #Name of the product's installed SysV in
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed
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
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
SERVICEDIR= #Directory where .service files are installed (systems running systemd only)
SERVICEDIR= #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

@@ -35,6 +35,12 @@ usage() # $1 = exit status
exit $1
}
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1

View File

@@ -74,7 +74,9 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c || echo_notdone
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c
else
return 0
fi
}
@@ -103,21 +105,17 @@ shorewall_start () {
echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/firewall ]; then
#
# Run in a sub-shell to avoid name collisions
#
(
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop || echo_notdone
else
echo_notdone
fi
)
else
echo_notdone
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
#
# Run in a sub-shell to avoid name collisions
#
(
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop
fi
)
fi
fi
done
@@ -144,10 +142,10 @@ shorewall_stop () {
echo -n "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear || echo_notdone
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear
fi
fi
done

View File

@@ -69,10 +69,10 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT ${OPTIONS} compile $STATEDIR/firewall
fi
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT ${OPTIONS} compile $STATEDIR/firewall
else
return 0
fi
}
@@ -83,11 +83,11 @@ shorewall_start () {
echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/firewall ]; then
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop || exit 1
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop
fi
fi
fi
done
@@ -106,10 +106,10 @@ shorewall_stop () {
echo -n "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear || exit 1
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear
fi
fi
done

View File

@@ -80,7 +80,9 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c || exit
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c
else
return 0
fi
}
@@ -91,14 +93,12 @@ shorewall_start () {
echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x $STATEDIR/firewall ]; then
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop || exit
if setstatedir; then
if [ -x $STATEDIR/firewall ]; then
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop
fi
fi
else
exit 6
fi
done
@@ -114,12 +114,10 @@ shorewall_stop () {
echo -n "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear || exit
else
exit 6
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear
fi
fi
done

View File

@@ -188,6 +188,8 @@ done
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
[ $configure -eq 1 ] && ETC=/etc || ETC="${CONFDIR}"
if [ -z "$BUILD" ]; then
case $(uname) in
cygwin*)
@@ -379,9 +381,9 @@ fi
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/
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/
@@ -390,15 +392,11 @@ if [ $HOST = debian ]; then
if [ ! -f ${DESTDIR}${CONFDIR}/default/shorewall-init ]; then
if [ -n "${DESTDIR}" ]; then
mkdir ${DESTDIR}/etc/default
mkdir ${DESTDIR}${ETC}/default
fi
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
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default
install_file sysconfig ${DESTDIR}${ETC}/default/shorewall-init 0644
fi
IFUPDOWN=ifupdown.debian.sh
@@ -408,13 +406,13 @@ else
if [ -z "$RPM" ]; then
if [ $HOST = suse ]; then
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-up.d
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-down.d
mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-up.d
mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-down.d
elif [ $HOST = gentoo ]; then
# Gentoo does not support if-{up,down}.d
/bin/true
else
mkdir -p ${DESTDIR}/etc/NetworkManager/dispatcher.d
mkdir -p ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d
fi
fi
fi
@@ -440,12 +438,8 @@ mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
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
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
fi
case $HOST in

View File

@@ -1,18 +1,19 @@
#! /bin/bash
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
#!/bin/bash
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.6
#
# (c) 2012-2014 - Tom Eastep (teastep@shorewall.net)
# (c) 2012-2014 - Tom Eastep (teastep@shorewall.net)
#
# On most distributions, this file should be called /etc/init.d/shorewall.
# On most distributions, this file should be called
# /etc/init.d/shorewall.
#
# Complete documentation is available at http://shorewall.net
# Complete documentation is available at http://shorewall.net
#
# This program is part of Shorewall.
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the license or,
# at your option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +23,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#########################################################################################
###############################################################################
# set the STATEDIR variable
setstatedir() {
local statedir
@@ -33,7 +34,9 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c || exit 1
${SBINDIR}/$PRODUCT ${OPTIONS} compile -c
else
return 0
fi
}
@@ -46,7 +49,7 @@ setstatedir() {
if [ -f "$SYSCONFDIR/shorewall-init" ]; then
. $SYSCONFDIR/shorewall-init
if [ -z "$PRODUCTS" ]; then
echo "ERROR: No products configured" >&2
echo "ERROR: No products configured" >&2
exit 1
fi
else
@@ -56,71 +59,66 @@ fi
# Initialize the firewall
shorewall_start () {
local PRODUCT
local STATEDIR
local PRODUCT
local STATEDIR
echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
#
# Run in a sub-shell to avoid name collisions
#
(
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop
fi
)
fi
fi
done
if [ -x ${STATEDIR}/firewall ]; then
#
# Run in a sub-shell to avoid name collisions
#
(
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
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
ipset -R < "$SAVE_IPSETS"
fi
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
ipset -R < "$SAVE_IPSETS"
fi
return 0
return 0
}
# Clear the firewall
shorewall_stop () {
local PRODUCT
local STATEDIR
local PRODUCT
local STATEDIR
echo -n "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
echo -n "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear
fi
fi
done
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall ${OPTIONS} clear || exit 1
fi
done
if [ -n "$SAVE_IPSETS" ]; then
mkdir -p $(dirname "$SAVE_IPSETS")
if ipset -S > "${SAVE_IPSETS}.tmp"; then
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
fi
fi
if [ -n "$SAVE_IPSETS" ]; then
mkdir -p $(dirname "$SAVE_IPSETS")
if ipset -S > "${SAVE_IPSETS}.tmp"; then
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
fi
fi
return 0
return 0
}
case "$1" in
start)
shorewall_start
;;
stop)
shorewall_stop
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
start)
shorewall_start
;;
stop)
shorewall_stop
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0

View File

@@ -4,9 +4,8 @@
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
#
[Unit]
Description=Shorewall IPv4 firewall (bootup security)
Description=Shorewall firewall (bootup security)
Before=network.target
Conflicts=iptables.service firewalld.service
[Service]
Type=oneshot

View File

@@ -4,10 +4,9 @@
# Copyright 2011 Jonathan Underwood <jonathan.underwood@gmail.com>
#
[Unit]
Description=Shorewall IPv4 firewall (bootup security)
Description=Shorewall firewall (bootup security)
Before=network-pre.target
Wants=network-pre.target
Conflicts=iptables.service firewalld.service
[Service]
Type=oneshot

View File

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

View File

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

View File

@@ -35,6 +35,12 @@ usage() # $1 = exit status
exit $1
}
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1

View File

@@ -47,6 +47,19 @@
<arg choice="plain"><replaceable>address</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>allow</option></arg>
<arg choice="plain"><replaceable>address</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
@@ -59,6 +72,21 @@
choice="plain"><option>clear</option><arg><option>-f</option></arg></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>close</option><arg choice="req">
<replaceable>open-number</replaceable> |
<replaceable>source</replaceable><replaceable>dest</replaceable><arg><replaceable>protocol</replaceable><arg>
<replaceable>port</replaceable> </arg></arg></arg><replaceable>
</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
@@ -265,6 +293,29 @@
expression</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
<arg choice="plain"><option>open</option><replaceable>
source</replaceable><replaceable> dest</replaceable><arg>
<replaceable>protocol</replaceable><arg> <replaceable>port</replaceable>
</arg> </arg></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>reenable</option></arg>
<arg choice="plain">{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
@@ -302,8 +353,6 @@
<arg><option>-n</option></arg>
<arg><option>-p</option><arg><option>-C</option></arg></arg>
<arg><replaceable>directory</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -350,6 +399,17 @@
<arg choice="opt"><replaceable>filename</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>savesets</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
@@ -578,7 +638,10 @@
<variablelist>
<varlistentry>
<term><emphasis role="bold">add</emphasis></term>
<term><emphasis role="bold">add </emphasis>{
<replaceable>interface</replaceable>[:<replaceable>host-list</replaceable>]...
<replaceable>zone</replaceable> | <replaceable>zone</replaceable>
<replaceable>host-list</replaceable> }</term>
<listitem>
<para>Adds a list of hosts or subnets to a dynamic zone usually used
@@ -603,7 +666,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">allow</emphasis></term>
<term><emphasis role="bold">allow
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Re-enables receipt of packets from hosts previously
@@ -615,7 +679,25 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">clear</emphasis></term>
<term><emphasis role="bold">call <replaceable>function</replaceable> [
<replaceable>parameter</replaceable> ... ]</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.10. Allows you to call a function in
one of the Shorewall libraries or in your compiled script. function
must name the shell function to be called. The listed parameters are
passed to the function.</para>
<para>The function is first searched for in
<filename>lib.base</filename>, <filename>lib.common</filename> and
<filename>lib.cli</filename>. If it is not found, the call command
is passed to the generated script to be executed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">clear
</emphasis>[-<option>f</option>]</term>
<listitem>
<para>Clear will remove all rules and chains installed by
@@ -632,7 +714,31 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">delete</emphasis></term>
<term><emphasis role="bold">close</emphasis> {
<replaceable>open-number</replaceable> |
<replaceable>source</replaceable> <replaceable>dest</replaceable> [
<replaceable>protocol</replaceable> [ <replaceable>port</replaceable>
] ] }</term>
<listitem>
<para>Added in Shorewall 4.5.8. This command closes a temporary open
created by the <command>open</command> command. In the first form,
an <replaceable>open-number</replaceable> specifies the open to be
closed. Open numbers are displayed in the <emphasis
role="bold">num</emphasis> column of the output of the
<command>shorewall-lite show opens </command>command.</para>
<para>When the second form of the command is used, the parameters
must match those given in the earlier <command>open</command>
command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">delete </emphasis>{
<replaceable>interface</replaceable>[:<replaceable>host-list</replaceable>]...
<replaceable>zone</replaceable> | <replaceable>zone</replaceable>
<replaceable>host-list</replaceable> }</term>
<listitem>
<para>The delete command reverses the effect of an earlier <emphasis
@@ -647,7 +753,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">disable</emphasis></term>
<term><emphasis role="bold">disable </emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.26. Disables the optional provider
@@ -659,7 +767,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">drop</emphasis></term>
<term><emphasis role="bold">drop
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -668,7 +777,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">dump</emphasis></term>
<term><emphasis role="bold">dump </emphasis>[-<option>x</option>]
[-<option>l</option>] [-<option>m</option>]
[-<option>c</option>]</term>
<listitem>
<para>Produces a verbose report about the firewall configuration for
@@ -689,7 +800,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">enable</emphasis></term>
<term><emphasis role="bold">enable </emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.26. Enables the optional provider
@@ -701,7 +814,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">forget</emphasis></term>
<term><emphasis role="bold">forget </emphasis>[
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>Deletes /var/lib/shorewall-lite/<emphasis>filename</emphasis>
@@ -722,7 +836,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">hits</emphasis></term>
<term><emphasis role="bold">hits </emphasis>
[-<option>t</option>]</term>
<listitem>
<para>Generates several reports from Shorewall-lite log messages in
@@ -732,7 +847,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ipcalc</emphasis></term>
<term><emphasis role="bold">ipcalc </emphasis>{ address mask |
address/vlsm }</term>
<listitem>
<para>Ipcalc displays the network address, broadcast address,
@@ -742,7 +858,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">iprange</emphasis></term>
<term><emphasis role="bold">iprange
</emphasis><replaceable>address1</replaceable>-<replaceable>address2</replaceable></term>
<listitem>
<para>Iprange decomposes the specified range of IP addresses into
@@ -751,7 +868,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">iptrace</emphasis></term>
<term><emphasis role="bold">iptrace </emphasis><replaceable>iptables
match expression</replaceable></term>
<listitem>
<para>This is a low-level debugging command that causes iptables
@@ -770,7 +888,17 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logdrop</emphasis></term>
<term><emphasis role="bold">list</emphasis></term>
<listitem>
<para><command>list</command> is a synonym for
<command>show</command> -- please see below.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logdrop
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -781,7 +909,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logwatch</emphasis></term>
<term><emphasis role="bold">logwatch </emphasis>[-<option>m</option>]
[<replaceable>refresh-interval</replaceable>]</term>
<listitem>
<para>Monitors the log file specified by the LOGFILE option in
@@ -800,7 +929,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logreject</emphasis></term>
<term><emphasis role="bold">logreject
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -811,7 +941,17 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noiptrace</emphasis></term>
<term><emphasis role="bold">ls</emphasis></term>
<listitem>
<para><command>ls</command> is a synonym for <command>show</command>
-- please see below.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noiptrace </emphasis><replaceable>iptables
match expression</replaceable></term>
<listitem>
<para>This is a low-level debugging command that cancels a trace
@@ -824,16 +964,83 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reset</emphasis></term>
<term><emphasis role="bold">open</emphasis>
<replaceable>source</replaceable> <replaceable>dest</replaceable> [
<replaceable>protocol</replaceable> [ <replaceable>port</replaceable>
] ]</term>
<listitem>
<para>All the packet and byte counters in the firewall are
reset.</para>
<para>Added in Shorewall 4.6.8. This command requires that the
firewall be in the started state and that DYNAMIC_BLACKLIST=Yes in
<ulink url="/manpages/shorewall.conf.html">shorewall.conf
(5)</ulink>. The effect of the command is to temporarily open the
firewall for connections matching the parameters.</para>
<para>The <replaceable>source</replaceable> and
<replaceable>dest</replaceable> parameters may each be specified as
<emphasis role="bold">all</emphasis> if you don't wish to restrict
the connection source or destination respectively. Otherwise, each
must contain a host or network address or a valid DNS name.</para>
<para>The <replaceable>protocol</replaceable> may be specified
either as a number or as a name listed in /etc/protocols. The
<replaceable>port</replaceable> may be specified numerically or as a
name listed in /etc/services.</para>
<para>To reverse the effect of a successful <command>open</command>
command, use the <command>close</command> command with the same
parameters or simply restart the firewall.</para>
<para>Example: To open the firewall for SSH connections to address
192.168.1.1, the command would be:</para>
<programlisting> shorewall-lite open all 192.168.1.1 tcp 22</programlisting>
<para>To reverse that command, use:</para>
<screen> shorewall-lite close all 192.168.1.1 tcp 22</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restart</emphasis></term>
<term><emphasis role="bold">reenable</emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.6.9. This is equivalent to a
<command>disable</command> command followed by an
<command>enable</command> command on the specified
<replaceable>interface</replaceable> or
<replaceable>provider</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reject</emphasis><replaceable>
address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
to be silently rejected.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reset [<replaceable>chain</replaceable>,
...]</emphasis><acronym/></term>
<listitem>
<para>Resets the packet and byte counters in the specified
<replaceable>chain</replaceable>(s). If no
<replaceable>chain</replaceable> is specified, all the packet and
byte counters in the firewall are reset.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restart </emphasis>[-n] [-p]
[-<option>C</option>]</term>
<listitem>
<para>Restart is similar to <emphasis role="bold">shorewall-lite
@@ -856,7 +1063,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restore</emphasis></term>
<term><emphasis role="bold">restore </emphasis>[-<option>n</option>]
[-<option>p</option>] [-<option>C</option>] [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>Restore Shorewall-lite to a state saved using the <emphasis
@@ -876,6 +1085,14 @@
different from the current values.</para>
</caution>
<para>The <option>-n</option> option causes Shorewall to avoid
updating the routing table(s).</para>
<para>The <option>-p</option> option, added in Shorewall 4.6.5,
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 <option>-C</option> option was specified during <emphasis
role="bold">shorewall save</emphasis>, then the counters saved by
@@ -884,7 +1101,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">run</emphasis></term>
<term><emphasis role="bold">run
</emphasis><replaceable>command</replaceable> [
<replaceable>parameter</replaceable> ... ]</term>
<listitem>
<para>Added in Shorewall 4.6.3. Executes
@@ -901,7 +1120,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">save</emphasis></term>
<term><emphasis role="bold">save </emphasis>[-<option>C</option>] [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>The dynamic blacklist is stored in
@@ -918,6 +1138,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">savesets</emphasis></term>
<listitem>
<para>Added in shorewall 4.6.8. Performs the same action as the
<command>stop</command> command with respect to saving ipsets (see
the SAVE_IPSETS option in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf</ulink> (5)).
This command may be used to proactively save your ipset contents in
the event that a system failure occurs prior to issuing a
<command>stop</command> command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">show</emphasis></term>
@@ -927,7 +1161,8 @@
<variablelist>
<varlistentry>
<term><emphasis role="bold">bl|blacklists</emphasis></term>
<term><emphasis role="bold">bl|blacklists
</emphasis>[-<option>x</option>]</term>
<listitem>
<para>Added in Shorewall 4.6.2. Displays the dynamic chain
@@ -940,7 +1175,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">capabilities</emphasis></term>
<term>[-<option>f</option>] <emphasis
role="bold">capabilities</emphasis></term>
<listitem>
<para>Displays your kernel/iptables capabilities. The
@@ -951,8 +1187,10 @@
</varlistentry>
<varlistentry>
<term>[ [ <option>chain</option> ] <emphasis>chain</emphasis>...
]</term>
<term>[-<option>b</option>] [-<option>x</option>]
[-<option>l</option>] [-<option>t</option>
{<option>filter</option>|<option>mangle</option>|<option>nat</option>|<option>raw</option>|<option>rawpost</option>}]
[ <emphasis>chain</emphasis>... ]</term>
<listitem>
<para>The rules in each <emphasis>chain</emphasis> are
@@ -1005,11 +1243,19 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">connections</emphasis></term>
<term><emphasis role="bold">connections
[<replaceable>filter_parameter</replaceable>
...]</emphasis></term>
<listitem>
<para>Displays the IP connections currently being tracked by
the firewall.</para>
<para>If the <command>conntrack</command> utility is
installed, beginning with Shorewall 4.6.11 the set of
connections displayed can be limited by including conntrack
filter parameters (-p , -s, --dport, etc). See conntrack(8)
for details.</para>
</listitem>
</varlistentry>
@@ -1051,7 +1297,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">log</emphasis></term>
<term>[-<option>m</option>] <emphasis
role="bold">log</emphasis></term>
<listitem>
<para>Displays the last 20 Shorewall-lite messages from the
@@ -1063,6 +1310,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term>[-<option>x</option>] <emphasis
role="bold">mangle</emphasis></term>
<listitem>
<para>Displays the Netfilter mangle table using the command
<emphasis role="bold">iptables -t mangle -L -n -v</emphasis>.
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">marks</emphasis></term>
@@ -1086,6 +1347,16 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">opens</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.8. Displays the iptables rules in
the 'dynamic' chain created through use of the <command>open
</command>command..</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">policies</emphasis></term>
@@ -1143,7 +1414,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">start</emphasis></term>
<term><emphasis role="bold">start</emphasis> [-<option>p</option>]
[-<option>n</option>] [<option>-f</option>]
[-<option>C</option>]</term>
<listitem>
<para>Start Shorewall Lite. Existing connections through
@@ -1155,7 +1428,7 @@
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
<para>The <option>-n</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.

View File

@@ -5,6 +5,7 @@
#
[Unit]
Description=Shorewall IPv4 firewall (lite)
Wants=network-online.target
After=network-online.target
Conflicts=iptables.service firewalld.service

View File

@@ -5,6 +5,7 @@
#
[Unit]
Description=Shorewall IPv4 firewall (lite)
Wants=network-online.target
After=network-online.target
Conflicts=iptables.service firewalld.service

View File

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

View File

@@ -40,6 +40,12 @@ usage() # $1 = exit status
exit $1
}
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1

View File

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

View File

@@ -1,13 +1,14 @@
#
# Shorewall version 3.4 - JabberPlain Macro
# Shorewall version 4 - JabberPlain Macro
#
# /usr/share/shorewall/macro.JabberPlain
#
# This macro accepts Jabber traffic (plaintext).
# This macro accepts Jabber traffic (plaintext). This macro is
# deprecated - use of macro.Jabber instead is recommended.
#
###############################################################################
?FORMAT 2
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
PARAM - - tcp 5222
Jabber

View File

@@ -1,9 +1,11 @@
#
# Shorewall version 3.4 - JabberSecure (ssl) Macro
# Shorewall version 4 - JabberSecure (SSL) Macro
#
# /usr/share/shorewall/macro.JabberSecure
#
# This macro accepts Jabber traffic (ssl).
# This macro accepts Jabber traffic (SSL). Use of Jabber with SSL
# is deprecated, please configure Jabber with STARTTLS and use
# Jabber macro instead.
#
###############################################################################
?FORMAT 2

View File

@@ -0,0 +1,13 @@
#
# Shorewall version 4 - QUIC Macro
#
# /usr/share/shorewall/macro.QUIC
#
# This macro handles QUIC (Quick UDP Internet Connections).
#
###############################################################################
?FORMAT 2
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGIN RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
PARAM - - udp 80,443

View File

@@ -9,3 +9,4 @@
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 655
PARAM - - tcp 655

View File

@@ -34,6 +34,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = ( qw( process_arprules create_arptables_load preview_arptables_load ) );
our $VERSION = 'MODULEVERSION';
our %arp_table;
our $arp_input;

View File

@@ -521,9 +521,9 @@ sub setup_accounting() {
while ( $chainswithjumps && $progress ) {
$progress = 0;
for my $chain1 ( keys %accountingjumps ) {
for my $chain1 ( sort keys %accountingjumps ) {
if ( keys %{$accountingjumps{$chain1}} ) {
for my $chain2 ( keys %{$accountingjumps{$chain1}} ) {
for my $chain2 ( sort keys %{$accountingjumps{$chain1}} ) {
delete $accountingjumps{$chain1}{$chain2}, $progress = 1 unless $accountingjumps{$chain2};
}
} else {

View File

@@ -260,6 +260,7 @@ our %EXPORT_TAGS = (
get_interface_gateway
get_interface_mac
have_global_variables
have_address_variables
set_global_variables
save_dynamic_chains
load_ipsets
@@ -279,7 +280,7 @@ our %EXPORT_TAGS = (
Exporter::export_ok_tags('internal');
our $VERSION = '4.5_18';
our $VERSION = 'MODULEVERSION';
#
# Chain Table
@@ -649,6 +650,7 @@ our %opttype = ( rule => CONTROL,
simple => CONTROL,
matches => CONTROL,
complex => CONTROL,
t => CONTROL,
i => UNIQUE,
s => UNIQUE,
@@ -763,7 +765,6 @@ sub initialize( $$$ ) {
RETURN => 1,
QUEUE => 1,
CLASSIFY => 1,
CT => 1,
DNAT => 1,
MASQUERADE => 1,
NETMAP => 1,
@@ -891,6 +892,8 @@ sub set_rule_option( $$$ ) {
}
} elsif ( $opttype == EXCLUSIVE ) {
$ruleref->{$option} .= ",$value";
} elsif ( $opttype == CONTROL ) {
$ruleref->{$option} = $value;
} elsif ( $opttype == UNIQUE ) {
#
# Shorewall::Rules::perl_action_tcp_helper() can produce rules that have two -p specifications.
@@ -925,7 +928,7 @@ sub transform_rule( $;\$ ) {
my $option;
my $invert = '';
if ( $input =~ s/^(!\s+)?-([psdjgiom])\s+// ) {
if ( $input =~ s/^(!\s+)?-([psdjgiomt])\s+// ) {
#
# Normal case of single-character
$invert = '!' if $1;
@@ -955,7 +958,7 @@ sub transform_rule( $;\$ ) {
PARAM:
{
while ( $input ne '' && $input !~ /^(?:!|-[psdjgiom])\s/ ) {
while ( $input ne '' && $input !~ /^(?:!|-[psdjgiomt])\s/ ) {
last PARAM if $input =~ /^--([^\s]+)/ && $aliases{$1 || '' };
$input =~ s/^([^\s]+)\s*//;
my $token = $1;
@@ -1159,7 +1162,7 @@ sub merge_rules( $$$ ) {
}
}
for my $option ( grep ! $opttype{$_} || $_ eq 'nfacct' || $_ eq 'recent', keys %$fromref ) {
for my $option ( grep ! $opttype{$_} || $_ eq 'nfacct' || $_ eq 'recent', sort { $b cmp $a } keys %$fromref ) {
set_rule_option( $toref, $option, $fromref->{$option} );
}
@@ -1175,7 +1178,7 @@ sub merge_rules( $$$ ) {
set_rule_option( $toref, 'policy', $fromref->{policy} ) if exists $fromref->{policy};
for my $option ( grep( get_opttype( $_, 0 ) == EXPENSIVE, keys %$fromref ) ) {
for my $option ( grep( get_opttype( $_, 0 ) == EXPENSIVE, sort keys %$fromref ) ) {
set_rule_option( $toref, $option, $fromref->{$option} );
}
@@ -3253,7 +3256,7 @@ sub optimize_level4( $$ ) {
$progress = 0;
$passes++;
my @chains = grep $_->{referenced}, values %$tableref;
my @chains = grep $_->{referenced}, sort { $a->{name} cmp $b->{name} } values %$tableref;
my $chains = @chains;
progress_message "\n Table $table pass $passes, $chains referenced chains, level 4a...";
@@ -3574,7 +3577,7 @@ sub optimize_level8( $$$ ) {
}
if ( $progress ) {
my @rename = keys %rename;
my @rename = sort keys %rename;
#
# First create aliases for each renamed chain and change the {name} member.
#
@@ -4852,7 +4855,7 @@ sub validate_mark( $ ) {
sub verify_small_mark( $ ) {
my $val = validate_mark ( (my $mark) = $_[0] );
fatal_error "Mark value ($mark) too large" if numeric_value( $mark ) > $globals{TC_MAX};
fatal_error "Mark value ($mark) too large" if numeric_value( $mark ) > $globals{SMALL_MASK};
$val;
}
@@ -5601,6 +5604,8 @@ sub have_ipset_rules() {
sub get_interface_address( $ );
sub get_interface_gateway ( $;$ );
sub record_runtime_address( $$;$ ) {
my ( $addrtype, $interface, $protect ) = @_;
@@ -6690,11 +6695,10 @@ sub get_interface_gateway ( $;$ ) {
$global_variables |= ALL_COMMANDS;
if ( interface_is_optional $logical ) {
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$($routine $interface)\n);
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$($routine $interface));
} else {
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$($routine $interface)
[ -n "\$$variable" ] || startup_error "Unable to detect the gateway through interface $interface"
);
[ -n "\$$variable" ] || startup_error "Unable to detect the gateway through interface $interface");
}
$protect ? "\${$variable:-" . NILIP . '}' : "\$$variable";
@@ -6800,36 +6804,67 @@ sub have_global_variables() {
have_capability( 'ADDRTYPE' ) ? $global_variables : $global_variables | NOT_RESTORE;
}
sub have_address_variables() {
( keys %interfaceaddr || keys %interfacemacs || keys %interfacegateways );
}
#
# Generate setting of run-time global shell variables
#
sub set_global_variables( $ ) {
sub set_global_variables( $$ ) {
my $setall = shift;
my ( $setall, $conditional ) = @_;
emit $_ for values %interfaceaddr;
emit $_ for values %interfacegateways;
emit $_ for values %interfacemacs;
if ( $conditional ) {
my ( $interface, @interfaces );
@interfaces = sort keys %interfaceaddr;
for $interface ( @interfaces ) {
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfaceaddr{$interface}) );
}
@interfaces = sort keys %interfacegateways;
for $interface ( @interfaces ) {
emit( qq(if [ -z "\$interface" -o "\$interface" = "$interface" ]; then) );
push_indent;
emit( $interfacegateways{$interface} );
pop_indent;
emit( qq(fi\n) );
}
@interfaces = sort keys %interfacemacs;
for $interface ( @interfaces ) {
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfacemacs{$interface}) );
}
} else {
emit $_ for sort values %interfaceaddr;
emit "$_\n" for sort values %interfacegateways;
emit $_ for sort values %interfacemacs;
}
if ( $setall ) {
emit $_ for values %interfaceaddrs;
emit $_ for values %interfacenets;
emit $_ for sort values %interfaceaddrs;
emit $_ for sort values %interfacenets;
unless ( have_capability( 'ADDRTYPE' ) ) {
if ( $family == F_IPV4 ) {
emit 'ALL_BCASTS="$(get_all_bcasts) 255.255.255.255"';
emit $_ for values %interfacebcasts;
emit $_ for sort values %interfacebcasts;
} else {
emit 'ALL_ACASTS="$(get_all_acasts)"';
emit $_ for values %interfaceacasts;
emit $_ for sort values %interfaceacasts;
}
}
}
}
sub verify_address_variables() {
while ( my ( $variable, $type ) = ( each %address_variables ) ) {
for my $variable ( sort keys %address_variables ) {
my $type = $address_variables{$variable};
my $address = "\$$variable";
if ( $type eq '&' ) {
@@ -7669,7 +7704,7 @@ sub add_interface_options( $ ) {
#
# Generate a digest for each chain
#
for my $chainref ( values %input_chains, values %forward_chains ) {
for my $chainref ( sort { $a->{name} cmp $b->{name} } values %input_chains, values %forward_chains ) {
my $digest = '';
assert( $chainref );
@@ -7688,7 +7723,7 @@ sub add_interface_options( $ ) {
# Insert jumps to the interface chains into the rules chains
#
for my $zone1 ( off_firewall_zones ) {
my @input_interfaces = keys %{zone_interfaces( $zone1 )};
my @input_interfaces = sort keys %{zone_interfaces( $zone1 )};
my @forward_interfaces = @input_interfaces;
if ( @input_interfaces > 1 ) {
@@ -7770,7 +7805,7 @@ sub add_interface_options( $ ) {
for my $zone1 ( firewall_zone, vserver_zones ) {
for my $zone2 ( off_firewall_zones ) {
my $chainref = $filter_table->{rules_chain( $zone1, $zone2 )};
my @interfaces = keys %{zone_interfaces( $zone2 )};
my @interfaces = sort keys %{zone_interfaces( $zone2 )};
my $chain1ref;
for my $interface ( @interfaces ) {
@@ -7950,7 +7985,7 @@ else
fi
if chain_exists dynamic; then
$tool -S dynamic | tail -n +2 > \${VARDIR}/.dynamic
$tool -S dynamic | tail -n +2 | fgrep -v -- '-j ACCEPT' > \${VARDIR}/.dynamic
else
rm -f \${VARDIR}/.dynamic
fi
@@ -8045,7 +8080,7 @@ sub create_save_ipsets() {
if ( @ipsets || @{$globals{SAVED_IPSETS}} || ( $config{SAVE_IPSETS} && have_ipset_rules ) ) {
emit( ' local file' ,
'',
' file=$1'
' file=${1:-${VARDIR}/save.ipsets}'
);
if ( @ipsets ) {
@@ -8071,8 +8106,10 @@ sub create_save_ipsets() {
emit( '',
" for set in \$(\$IPSET save | grep '$select' | cut -d' ' -f2); do" ,
" \$IPSET save \$set >> \$file" ,
" done" );
} else {
" done" ,
'',
);
} elsif ( $config{WORKAROUNDS} ) {
emit ( '' ,
' if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then' ,
' #',
@@ -8086,9 +8123,17 @@ sub create_save_ipsets() {
' if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then' ,
" grep -qE -- \"^(-N|create )\" \${VARDIR}/ipsets.tmp && mv -f \${VARDIR}/ipsets.tmp \$file" ,
' fi' );
}
} else {
emit (
'',
' if eval $IPSET -S > ${VARDIR}/ipsets.tmp; then' ,
" grep -qE -- \"^(-N|create )\" \${VARDIR}/ipsets.tmp && mv -f \${VARDIR}/ipsets.tmp \$file" ,
' fi' );
}
emit("}\n" );
emit( " return 0",
'',
"}\n" );
} elsif ( @ipsets || $globals{SAVED_IPSETS} ) {
emit( '' ,
' rm -f ${VARDIR}/ipsets.tmp' ,
@@ -8110,10 +8155,13 @@ sub create_save_ipsets() {
emit( '' ,
" grep -qE -- \"(-N|^create )\" \${VARDIR}/ipsets.tmp && cat \${VARDIR}/ipsets.tmp >> \$file\n" ,
'' ,
' return 0',
'' ,
"}\n" );
}
} elsif ( $config{SAVE_IPSETS} ) {
emit( ' error_message "WARNING: No ipsets were saved"',
' return 1',
"}\n" );
} else {
emit( ' true',
@@ -8126,9 +8174,9 @@ sub load_ipsets() {
my @ipsets = all_ipsets;
if ( @ipsets || @{$globals{SAVED_IPSETS}} || ( $config{SAVE_IPSETS} && have_ipset_rules ) ) {
emit ( '', );
emit ( 'local hack' ) if $config{WORKAROUNDS};
emit ( '',
'local hack',
'',
'case $IPSET in',
' */*)',
' [ -x "$IPSET" ] || startup_error "IPSET=$IPSET does not exist or is not executable"',
@@ -8226,7 +8274,7 @@ sub load_ipsets() {
#
sub create_nfobjects() {
my @objects = ( keys %nfobjects );
my @objects = ( sort keys %nfobjects );
if ( @objects ) {
if ( $config{NFACCT} ) {
@@ -8241,7 +8289,7 @@ sub create_nfobjects() {
}
}
for ( keys %nfobjects ) {
for ( sort keys %nfobjects ) {
emit( qq(if ! qt \$NFACCT get $_; then),
qq( \$NFACCT add $_),
qq(fi\n) );
@@ -8659,7 +8707,8 @@ sub initialize_switches() {
if ( keys %switches ) {
emit( 'if [ $COMMAND = start ]; then' );
push_indent;
while ( my ( $switch, $setting ) = each %switches ) {
for my $switch ( sort keys %switches ) {
my $setting = $switches{$switch};
my $file = "/proc/net/nf_condition/$switch";
emit "[ -f $file ] && echo $setting->{setting} > $file";
}
@@ -8700,7 +8749,7 @@ sub get_inline_matches( $ ) {
# Split the passed target into the basic target and parameter
#
sub get_target_param( $ ) {
my ( $target, $param ) = split '/', $_[0];
my ( $target, $param ) = split '/', $_[0], 2;
unless ( defined $param ) {
( $target, $param ) = ( $1, $2 ) if $target =~ /^(.*?)[(](.*)[)]$/;

View File

@@ -274,10 +274,21 @@ sub generate_script_2() {
'detect_configuration()',
'{' );
my $global_variables = have_global_variables;
my $global_variables = have_global_variables;
my $optional_interfaces = find_interfaces_by_option( 'optional' );
push_indent;
if ( have_address_variables || @$optional_interfaces ) {
emit( 'local interface',
'',
'interface="$1"',
''
);
}
map_provider_to_interface if have_providers;
if ( $global_variables ) {
if ( $global_variables & NOT_RESTORE ) {
@@ -292,7 +303,7 @@ sub generate_script_2() {
if ( $global_variables == ( ALL_COMMANDS | NOT_RESTORE ) ) {
set_global_variables(0);
set_global_variables(0, 0);
handle_optional_interfaces(0);
}
@@ -306,10 +317,10 @@ sub generate_script_2() {
push_indent;
}
set_global_variables(1);
set_global_variables(1,1);
if ( $global_variables & NOT_RESTORE ) {
handle_optional_interfaces(0);
handle_optional_interfaces(1);
emit ';;';
pop_indent;
pop_indent;
@@ -518,14 +529,12 @@ EOF
emit( ' run_refreshed_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(
" set_state Started $config_dir",
' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall',
'else',
' setup_netfilter'
);
emit( " 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;
@@ -583,8 +592,8 @@ EOF
#
sub compiler {
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path, $shorewallrc , $shorewallrc1 , $directives, $inline, $tcrules ) =
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '' , '/usr/share/shorewall/shorewallrc', '' , 0 , 0 , 0 );
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path, $shorewallrc , $shorewallrc1 , $directives, $inline, $tcrules, $routestopped , $notrack ) =
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '' , '/usr/share/shorewall/shorewallrc', '' , 0 , 0 , 0 , 0 , 0 );
$export = 0;
$test = 0;
@@ -593,12 +602,12 @@ sub compiler {
sub validate_boolean( $ ) {
my $val = numeric_value( shift );
defined($val) && ($val >= 0) && ($val < 2);
}
}
sub validate_verbosity( $ ) {
my $val = numeric_value( shift );
defined($val) && ($val >= MIN_VERBOSITY) && ($val <= MAX_VERBOSITY);
}
}
sub validate_family( $ ) {
my $val = numeric_value( shift );
@@ -625,6 +634,8 @@ sub compiler {
inline => { store => \$inline, validate=> \&validate_boolean } ,
directives => { store => \$directives, validate=> \&validate_boolean } ,
tcrules => { store => \$tcrules, validate=> \&validate_boolean } ,
routestopped => { store => \$routestopped, validate=> \&validate_boolean } ,
notrack => { store => \$notrack, validate=> \&validate_boolean } ,
config_path => { store => \$config_path } ,
shorewallrc => { store => \$shorewallrc } ,
shorewallrc1 => { store => \$shorewallrc1 } ,
@@ -728,7 +739,7 @@ sub compiler {
#
# Do all of the zone-independent stuff (mostly /proc)
#
add_common_rules( $convert, $tcrules );
add_common_rules( $convert, $tcrules , $routestopped );
#
# More /proc
#
@@ -835,13 +846,13 @@ sub compiler {
#
# Process the conntrack file
#
setup_conntrack;
setup_conntrack( $notrack );
#
# Add Tunnel rules.
#
setup_tunnels;
#
# Clear the current filename
# Clear the current filename so that the last one processed doesn't appear in error and warning messages
#
clear_currentfilename;
#
@@ -902,7 +913,7 @@ sub compiler {
# S T O P _ F I R E W A L L
# (Writes the stop_firewall() function to the compiled script)
#
compile_stop_firewall( $test, $export , $have_arptables );
compile_stop_firewall( $test, $export , $have_arptables, $routestopped );
#
# U P D O W N
# (Writes the updown() function to the compiled script)
@@ -967,14 +978,15 @@ sub compiler {
initialize_chain_table(0);
if ( $debug ) {
compile_stop_firewall( $test, $export, $have_arptables );
compile_stop_firewall( $test, $export, $have_arptables, $routestopped );
disable_script;
} else {
#
# compile_stop_firewall() also validates the routestopped file. Since we don't
# call that function during normal 'check', we must validate routestopped here.
# compile_stop_firewall() also validates the stoppedrules file. Since we don't
# call that function during normal 'check', we must validate stoppedrules here.
#
process_routestopped unless process_stoppedrules;
convert_routestopped if $routestopped;
process_stoppedrules;
}
#
# Report used/required capabilities

View File

@@ -124,6 +124,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
set_shorewall_dir
set_debug
find_file
find_writable_file
split_list
split_list1
split_list2
@@ -232,7 +233,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
Exporter::export_ok_tags('internal');
our $VERSION = '4.6.0-Beta1';
our $VERSION = 'MODULEVERSION';
#
# describe the current command, it's present progressive, and it's completion.
@@ -396,6 +397,7 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
NEW_TOS_MATCH => 'New tos Match',
TARPIT_TARGET => 'TARPIT Target',
IFACE_MATCH => 'Iface Match',
TCPMSS_TARGET => 'TCPMSS Target',
AMANDA_HELPER => 'Amanda Helper',
FTP_HELPER => 'FTP Helper',
@@ -617,6 +619,8 @@ our %deprecated = ( LOGRATE => '' ,
our %converted = ( WIDE_TC_MARKS => 1,
HIGH_ROUTE_MARKS => 1,
BLACKLISTNEWONLY => 1,
LOGRATE => 1,
LOGBURST => 1,
);
#
# Variables involved in ?IF, ?ELSE ?ENDIF processing
@@ -714,7 +718,7 @@ sub initialize( $;$$) {
EXPORT => 0,
KLUDGEFREE => '',
VERSION => "4.5.19-Beta1",
CAPVERSION => 40606 ,
CAPVERSION => 40609 ,
);
#
# From shorewall.conf file
@@ -853,6 +857,7 @@ sub initialize( $;$$) {
REJECT_ACTION => undef,
INLINE_MATCHES => undef,
BASIC_FILTERS => undef,
WORKAROUNDS => undef ,
#
# Packet Disposition
#
@@ -879,9 +884,6 @@ sub initialize( $;$$) {
#
# Valid log levels
#
# Note that we don't include LOGMARK; that is so we can default its
# priority to 'info' (LOGMARK itself defaults to 'warn').
#
%validlevels = ( DEBUG => 7,
INFO => 6,
NOTICE => 5,
@@ -983,6 +985,7 @@ sub initialize( $;$$) {
REAP_OPTION => undef,
TARPIT_TARGET => undef,
IFACE_MATCH => undef,
TCPMSS_TARGET => undef,
AMANDA_HELPER => undef,
FTP_HELPER => undef,
@@ -1867,6 +1870,20 @@ sub find_file($)
"$config_path[0]$filename";
}
sub find_writable_file($) {
my ( $filename, $nosearch ) = @_;
return $filename if $filename =~ '/';
for my $directory ( @config_path ) {
next if $directory =~ m|^$globals{SHAREDIR}/configfiles/?$| || $directory =~ m|^$shorewallrc{SHAREDIR}/doc/default-config/?$|;
my $file = "$directory$filename";
return $file if -f $file && -w _;
}
"$config_path[0]$filename";
}
#
# Split a comma-separated list into a Perl array
#
@@ -2143,7 +2160,7 @@ sub split_line2( $$;$$$ ) {
#
# This file supports INLINE or IPTABLES
#
if ( $currentline =~ /^\s*INLINE(?:\(.*\)|:.*)?\s/ || $currentline =~ /^\s*IP6?TABLES(?:\(.*\)|:.*)?\s/ ) {
if ( $currentline =~ /^\s*INLINE(?:\(.*\)(:.*)?|:.*)?\s/ || $currentline =~ /^\s*IP6?TABLES(?:\(.*\)|:.*)?\s/ ) {
$inline_matches = $pairs;
if ( $columns =~ /^(\s*|.*[^&@%]){(.*)}\s*$/ ) {
@@ -4468,7 +4485,9 @@ sub Iface_Match() {
qt1( "$iptables $iptablesw -A $sillyname -m iface --iface lo --loopback" );
}
sub Tcpmss_Target() {
qt1( "$iptables $iptablesw -A $sillyname -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu" );
}
our %detect_capability =
( ACCOUNT_TARGET =>\&Account_Target,
@@ -4557,6 +4576,7 @@ our %detect_capability =
STATISTIC_MATCH => \&Statistic_Match,
TARPIT_TARGET => \&Tarpit_Target,
TCPMSS_MATCH => \&Tcpmss_Match,
TCPMSS_TARGET => \&Tcpmss_Target,
TFTP_HELPER => \&TFTP_Helper,
TFTP0_HELPER => \&TFTP0_Helper,
TIME_MATCH => \&Time_Match,
@@ -4710,6 +4730,7 @@ sub determine_capabilities() {
$capabilities{NEW_TOS_MATCH} = detect_capability( 'NEW_TOS_MATCH' );
$capabilities{TARPIT_TARGET} = detect_capability( 'TARPIT_TARGET' );
$capabilities{IFACE_MATCH} = detect_capability( 'IFACE_MATCH' );
$capabilities{TCPMSS_TARGET} = detect_capability( 'TCPMSS_TARGET' );
unless ( have_capability 'CT_TARGET' ) {
$capabilities{HELPER_MATCH} = detect_capability 'HELPER_MATCH';
@@ -4801,6 +4822,12 @@ sub conditional_quote( $ ) {
#
# Update the shorewall[6].conf file. Save the current file with a .bak suffix.
#
sub update_default($$) {
my ( $var, $val ) = @_;
$config{$var} = $val unless defined $config{$var};
}
sub update_config_file( $$ ) {
my ( $annotate, $directives ) = @_;
@@ -4820,6 +4847,45 @@ sub update_config_file( $$ ) {
$config{PROVIDER_OFFSET} = ( $high ? $wide ? 16 : 8 : 0 ) unless defined $config{PROVIDER_OFFSET};
$config{PROVIDER_BITS} = 8 unless defined $config{PROVIDER_BITS};
unless ( supplied $config{LOGLIMIT} ) {
if ( $config{LOGRATE} || $config{LOGBURST} ) {
my $limit;
if ( supplied $config{LOGRATE} ) {
fatal_error"Invalid LOGRATE ($config{LOGRATE})" unless $config{LOGRATE} =~ /^\d+\/(second|minute)$/;
$limit = $config{LOGRATE};
}
if ( supplied $config{LOGBURST} ) {
fatal_error"Invalid LOGBURST ($config{LOGBURST})" unless $config{LOGBURST} =~ /^\d+$/;
$limit .= ":$config{LOGBURST}";
}
$config{LOGLIMIT} = $limit;
$config{LOGRATE} = $config{LOGBURST} = undef;
}
}
unless ( supplied $config{BLACKLIST} ) {
if ( $config{BLACKLISTNEWONLY} ) {
default_yes_no 'BLACKLISTNEWONLY' , '';
if ( have_capability 'RAW_TABLE' ) {
$globals{BLACKLIST_STATES} = $config{BLACKLISTNEWONLY} ? 'NEW,INVALID,UNTRACKED' : 'NEW,ESTABLISHED,INVALID,UNTRACKED';
} else {
$globals{BLACKLIST_STATES} = $config{BLACKLISTNEWONLY} ? 'NEW,INVALID' : 'NEW,ESTABLISHED,INVALID';
}
$config{BLACKLIST} = $globals{BLACKLIST_STATES};
$config{BLACKLISTNEWONLY} = undef;
}
}
update_default( 'USE_DEFAULT_RT', 'No' );
update_default( 'EXPORTMODULES', 'No' );
my $fn;
unless ( -d "$globals{SHAREDIR}/configfiles/" ) {
@@ -4833,7 +4899,8 @@ sub update_config_file( $$ ) {
#
$fn = $annotate ? "$globals{SHAREDIR}/configfiles/${product}.conf.annotated" : "$globals{SHAREDIR}/configfiles/${product}.conf";
}
if ( -f $fn ) {
if ( -f $fn ) {
my ( $template, $output );
open $template, '<' , $fn or fatal_error "Unable to open $fn: $!";
@@ -4921,8 +4988,12 @@ EOF
}
exit 0 unless ( $directives ||
-f find_file 'blacklist' ||
-f find_file 'tcrules' );
-f find_file 'blacklist' ||
-f find_file 'tcrules' ||
-f find_file 'routestopped' ||
-f find_file 'notrack' ||
-f find_file 'tos'
);
}
} else {
fatal_error "$fn does not exist";
@@ -5014,6 +5085,10 @@ sub read_capabilities() {
warning_message "Your capabilities file does not contain a Kernel Version -- using 2.6.30";
$capabilities{KERNELVERSION} = 20630;
}
#
# Assume that this is available when using an old capabilities files
#
$capabilities{TCPMSS_TARGET} = 1 if ( ( $capabilities{CAPVERSION} || 0 ) < 40609 );
$helpers_aliases{ftp} = 'ftp-0', $capabilities{FTP_HELPER} = 1 if $capabilities{FTP0_HELPER};
$helpers_aliases{irc} = 'irc-0', $capabilities{IRC_HELPER} = 1 if $capabilities{IRC0_HELPER};
@@ -5030,56 +5105,41 @@ sub read_capabilities() {
}
#
# Get the system's capabilities, either by probing or by reading a capabilities file
# Get the system's capabilities by probing
#
sub get_capabilities( $ )
sub get_capabilities($)
{
my $export = $_[0];
$iptables = $config{$toolNAME};
if ( ! $export && $> == 0 ) { # $> == $EUID
$iptables = $config{$toolNAME};
if ( $iptables ) {
fatal_error "$toolNAME=$iptables does not exist or is not executable" unless -x $iptables;
} else {
fatal_error "Can't find $toolname executable" unless $iptables = which $toolname;
}
#
# Determine if iptables supports the -w option
#
$iptablesw = qt1( "$iptables -w -L -n") ? '-w' : '';
my $iptables_restore=$iptables . '-restore';
fatal_error "$iptables_restore does not exist or is not executable" unless -x $iptables_restore;
$tc = $config{TC} || which 'tc';
if ( $tc ) {
fatal_error "TC=$tc does not exist or is not executable" unless -x $tc;
}
$ip = $config{IP} || which 'ip';
if ( $ip ) {
fatal_error "IP=$ip does not exist or is not executable" unless -x $ip;
}
load_kernel_modules;
if ( open_file 'capabilities' ) {
read_capabilities;
} else {
determine_capabilities;
}
if ( $iptables ) {
fatal_error "$toolNAME=$iptables does not exist or is not executable" unless -x $iptables;
} else {
unless ( open_file 'capabilities' ) {
fatal_error "The -e compiler option requires a capabilities file" if $export;
fatal_error "Compiling under non-root uid requires a capabilities file";
}
read_capabilities;
fatal_error "Can't find $toolname executable" unless $iptables = which $toolname;
}
#
# Determine if iptables supports the -w option
#
$iptablesw = qt1( "$iptables -w -L -n") ? '-w' : '';
my $iptables_restore=$iptables . '-restore';
fatal_error "$iptables_restore does not exist or is not executable" unless -x $iptables_restore;
$tc = $config{TC} || which 'tc';
if ( $tc ) {
fatal_error "TC=$tc does not exist or is not executable" unless -x $tc;
}
$ip = $config{IP} || which 'ip';
if ( $ip ) {
fatal_error "IP=$ip does not exist or is not executable" unless -x $ip;
}
load_kernel_modules;
determine_capabilities unless $_[0];
}
#
@@ -5318,7 +5378,7 @@ sub convert_to_directives() {
my $dirtest = qr|^$sharedir/+shorewall6?(?:/.*)?$|;
progress_message3 "Converting 'FORMAT' and 'COMMENT' lines to compiler directives...";
progress_message3 "Converting 'FORMAT', 'SECTION' and 'COMMENT' lines to compiler directives...";
for my $dir ( @path ) {
unless ( $dir =~ /$dirtest/ ) {
@@ -5353,6 +5413,7 @@ EOF
if ( system( "diff -q $file ${file}.bak > /dev/null" ) ) {
progress_message3 " File $file updated - old file renamed ${file}.bak";
} elsif ( rename "${file}.bak" , $file ) {
progress_message " File $file not updated -- no bare 'COMMENT', 'SECTION' or 'FORMAT' lines found";
progress_message " File $file not updated -- no bare 'COMMENT' or 'FORMAT' lines found";
} else {
warning message "Unable to rename ${file}.bak to $file:$!";
@@ -5390,6 +5451,38 @@ sub get_configuration( $$$$$ ) {
ensure_config_path;
my $default_path = '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin';
default 'PATH' , $default_path;
if ( supplied( $ENV{PATH} ) ) {
$ENV{PATH} .= ":$default_path";
} else {
$ENV{PATH} = $default_path;
}
my $have_capabilities;
if ( $export || $> != 0 ) {
#
# Compiling for export or user not root -- must use a capabilties file
# We read it before processing the .conf file so that 'update' has
# the capabilities.
#
unless ( open_file 'capabilities' ) {
fatal_error "The -e compiler option requires a capabilities file" if $export;
fatal_error "Compiling under non-root uid requires a capabilities file";
}
read_capabilities;
$have_capabilities = 1;
} elsif ( open_file 'capabilities' ) {
read_capabilities;
$have_capabilities = 1;
}
get_params( $export );
process_shorewall_conf( $update, $annotate, $directives );
@@ -5400,14 +5493,15 @@ sub get_configuration( $$$$$ ) {
unshift @INC, @config_path;
default 'PATH' , '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin';
#
# get_capabilities requires that the true settings of these options be established
#
default 'MODULE_PREFIX', 'ko ko.gz o o.gz gz';
default_yes_no 'LOAD_HELPERS_ONLY' , 'Yes';
get_capabilities( $export );
if ( ! $export && $> == 0 ) {
get_capabilities($have_capabilities);
}
my ( $val, $all );
@@ -5487,13 +5581,13 @@ sub get_configuration( $$$$$ ) {
my $match = have_capability( 'OLD_HL_MATCH' ) ? 'hashlimit' : 'hashlimit-upto';
my $units;
if ( $rate =~ /^[sd]:((\d+)(\/(sec|min|hour|day))):(\d+)$/ ) {
if ( $rate =~ /^[sd]:((\d+)(\/(sec|min|second|minute|hour|day))):(\d+)$/ ) {
fatal_error "Invalid rate ($1)" unless $2;
fatal_error "Invalid burst value ($5)" unless $5;
$limit .= "--$match $1 --hashlimit-burst $5 --hashlimit-name lograte --hashlimit-mode ";
$units = $4;
} elsif ( $rate =~ /^[sd]:((\d+)(\/(sec|min|hour|day))?)$/ ) {
} elsif ( $rate =~ /^[sd]:((\d+)(\/(sec|min|second|minute|hour|day))?)$/ ) {
fatal_error "Invalid rate ($1)" unless $2;
$limit .= "--$match $1 --hashlimit-name lograte --hashlimit-mode ";
$units = $4;
@@ -5513,11 +5607,11 @@ sub get_configuration( $$$$$ ) {
$limit .= "--hashlimit-htable-expire $expire ";
}
} elsif ( $rate =~ /^((\d+)(\/(sec|min|hour|day))):(\d+)$/ ) {
} elsif ( $rate =~ /^((\d+)(\/(sec|min|second|minute|hour|day))):(\d+)$/ ) {
fatal_error "Invalid rate ($1)" unless $2;
fatal_error "Invalid burst value ($5)" unless $5;
$limit = "-m limit --limit $1 --limit-burst $5 ";
} elsif ( $rate =~ /^(\d+)(\/(sec|min|hour|day))?$/ ) {
} elsif ( $rate =~ /^(\d+)(\/(sec|min|second|minute|hour|day))?$/ ) {
fatal_error "Invalid rate (${1}${2})" unless $1;
$limit = "-m limit --limit $rate ";
} else {
@@ -5583,7 +5677,9 @@ sub get_configuration( $$$$$ ) {
fatal_error "LOG_MARTIANS=On is not supported in IPv6" if $config{LOG_MARTIANS} eq 'on';
}
default 'STARTUP_LOG' , '';
default 'SHOREWALL_SHELL', '/bin/sh';
default 'STARTUP_LOG' , '';
if ( $config{STARTUP_LOG} ne '' ) {
if ( supplied $config{LOG_VERBOSITY} ) {
@@ -5608,8 +5704,9 @@ sub get_configuration( $$$$$ ) {
default_yes_no 'DETECT_DNAT_IPADDRS' , '';
default_yes_no 'CLEAR_TC' , $family == F_IPV4 ? 'Yes' : '';
if ( supplied $config{CLAMPMSS} ) {
default_yes_no 'CLAMPMSS' , '' unless $config{CLAMPMSS} =~ /^\d+$/;
if ( supplied( $val = $config{CLAMPMSS} ) ) {
default_yes_no 'CLAMPMSS' , '' unless $val =~ /^\d+$/;
require_capability 'TCPMSS_TARGET', "CLAMPMSS=$val", 's' if $config{CLAMPMSS};
} else {
$config{CLAMPMSS} = '';
}
@@ -5709,6 +5806,7 @@ sub get_configuration( $$$$$ ) {
default_yes_no 'TRACK_RULES' , '';
default_yes_no 'INLINE_MATCHES' , '';
default_yes_no 'BASIC_FILTERS' , '';
default_yes_no 'WORKAROUNDS' , 'Yes';
require_capability( 'BASIC_EMATCH', 'BASIC_FILTERS=Yes', 's' ) if $config{BASIC_FILTERS};
@@ -5804,6 +5902,10 @@ sub get_configuration( $$$$$ ) {
$globals{USER_MASK} = $globals{USER_BITS} = 0;
}
$val = $config{PROVIDER_OFFSET};
$globals{SMALL_MASK} = $val ? make_mask( $val ) : $globals{TC_MASK};
if ( supplied ( $val = $config{ZONE2ZONE} ) ) {
fatal_error "Invalid ZONE2ZONE value ( $val )" unless $val =~ /^[2-]$/;
} else {
@@ -6253,7 +6355,7 @@ sub generate_aux_config() {
emit "#\n# Shorewall auxiliary configuration file created by Shorewall version $globals{VERSION} - $date\n#";
for my $option ( qw(VERBOSITY LOGFILE LOGFORMAT ARPTABLES IPTABLES IP6TABLES IP TC IPSET PATH SHOREWALL_SHELL SUBSYSLOCK LOCKFILE RESTOREFILE) ) {
for my $option ( qw(VERBOSITY LOGFILE LOGFORMAT ARPTABLES IPTABLES IP6TABLES IP TC IPSET PATH SHOREWALL_SHELL SUBSYSLOCK LOCKFILE RESTOREFILE WORKAROUNDS) ) {
conditionally_add_option $option;
}

View File

@@ -779,6 +779,18 @@ sub normalize_6addr( $ ) {
sub validate_6range( $$ ) {
my ( $low, $high ) = @_;
if ( $low =~ /^\[(.+)\]$/ ) {
$low = $1;
} elsif ( $low =~ /^\[(.+)\]\/(\d+)$/ ) {
$low = join( '/', $1, $2 );
}
if ( $high =~ /^\[(.+)\]$/ ) {
$high = $1;
} elsif ( $high =~ /^\[(.+)\]\/(\d+)$/ ) {
$high = join( '/', $1, $2 );
}
validate_6address $low, 0;
validate_6address $high, 0;

View File

@@ -44,6 +44,7 @@ our @EXPORT = qw( process_tos
setup_mac_lists
process_routestopped
process_stoppedrules
convert_routestopped
compile_stop_firewall
generate_matrix
);
@@ -76,7 +77,7 @@ sub process_tos() {
my ( $pretosref, $outtosref );
first_entry( sub { progress_message2 "$doing $fn...";
warning_message "Use of the tos file is deprecated in favor of the TOS target in tcrules";
warning_message "Use of the tos file is deprecated in favor of the TOS target in the 'mangle' file";
$pretosref = ensure_chain 'mangle' , $chain;
$outtosref = ensure_chain 'mangle' , 'outtos';
}
@@ -176,7 +177,7 @@ sub setup_ecn()
}
if ( @hosts ) {
my @interfaces = ( keys %interfaces );
my @interfaces = ( sort { interface_number($a) <=> interface_number($b) } keys %interfaces );
progress_message "$doing ECN control on @interfaces...";
@@ -360,14 +361,16 @@ sub remove_blacklist( $ ) {
while ( read_a_line( EMBEDDED_ENABLED | EXPAND_VARIABLES ) ) {
my ( $rule, $comment ) = split '#', $currentline, 2;
if ( $rule =~ /blacklist/ ) {
if ( $rule && $rule =~ /blacklist/ ) {
$changed = 1;
if ( $comment ) {
$comment =~ s/^/ / while $rule =~ s/blacklist,//;
$comment =~ s/^/ / while $rule =~ s/blacklist,// || $rule =~ s/,blacklist//;
$rule =~ s/blacklist/ /g;
$currentline = join( '#', $rule, $comment );
} else {
$currentline =~ s/blacklist,//g;
$currentline =~ s/,blacklist//g;
$currentline =~ s/blacklist/ /g;
}
}
@@ -385,25 +388,33 @@ sub remove_blacklist( $ ) {
}
#
# Convert a pre-4.4.25 blacklist to a 4.4.25 blacklist
# Convert a pre-4.4.25 blacklist to a 4.4.25 blrules file
#
sub convert_blacklist() {
my $zones = find_zones_by_option 'blacklist', 'in';
my $zones1 = find_zones_by_option 'blacklist', 'out';
my ( $level, $disposition ) = @config{'BLACKLIST_LOG_LEVEL', 'BLACKLIST_DISPOSITION' };
my $audit = $disposition =~ /^A_/;
my $target = $disposition eq 'REJECT' ? 'reject' : $disposition;
my $target = $disposition;
my $orig_target = $target;
my @rules;
if ( @$zones || @$zones1 ) {
if ( supplied $level ) {
$target = 'blacklog';
} elsif ( $audit ) {
$target = verify_audit( $disposition );
}
$target = "$target:$level" if supplied $level;
my $fn = open_file 'blacklist';
my $fn = open_file( 'blacklist' );
unless ( $fn ) {
if ( -f ( $fn = find_file( 'blacklist' ) ) ) {
if ( unlink( $fn ) ) {
warning_message "Empty blacklist file ($fn) removed";
} else {
warning_message "Unable to remove empty blacklist file $fn: $!";
}
}
return 0;
}
first_entry "Converting $fn...";
@@ -439,8 +450,6 @@ sub convert_blacklist() {
} else {
warning_message "Duplicate 'audit' option ignored" if $auditone > 1;
}
$tgt = verify_audit( 'A_' . $target, $orig_target, $target );
}
for ( @options ) {
@@ -471,7 +480,7 @@ sub convert_blacklist() {
}
if ( @rules ) {
my $fn1 = find_file( 'blrules' );
my $fn1 = find_writable_file( 'blrules' );
my $blrules;
my $date = localtime;
@@ -682,6 +691,163 @@ sub process_routestopped() {
}
}
sub convert_routestopped() {
if ( my $fn = open_file 'routestopped' ) {
my ( @allhosts, %source, %dest , %notrack, @rule );
my $seq = 0;
my $date = localtime;
my ( $stoppedrules, $fn1 );
if ( -f ( $fn1 = find_writable_file( 'stoppedrules' ) ) ) {
open $stoppedrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
} else {
open $stoppedrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
print $stoppedrules <<'EOF';
#
# Shorewall version 4 - Stopped Rules File
#
# For information about entries in this file, type "man shorewall-stoppedrules"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-stoppedrules.html
#
# See http://shorewall.net/starting_and_stopping_shorewall.htm for additional
# information.
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE
# PORT(S) PORT(S)
EOF
}
first_entry(
sub {
my $date = localtime;
progress_message2 "$doing $fn...";
print( $stoppedrules
"#\n" ,
"# Rules generated from routestopped file $fn by Shorewall $globals{VERSION} - $date\n" ,
"#\n" );
}
);
while ( read_a_line ( NORMAL_READ ) ) {
my ($interface, $hosts, $options , $proto, $ports, $sports ) =
split_line( 'routestopped file',
{ interface => 0, hosts => 1, options => 2, proto => 3, dport => 4, sport => 5 } );
my $interfaceref;
fatal_error 'INTERFACE must be specified' if $interface eq '-';
fatal_error "Unknown interface ($interface)" unless $interfaceref = known_interface $interface;
$hosts = ALLIP unless $hosts && $hosts ne '-';
my $routeback = 0;
my @hosts;
$seq++;
my $rule = "$proto\t$ports\t$sports";
$hosts = ALLIP if $hosts eq '-';
for my $host ( split /,/, $hosts ) {
fatal_error "Ipsets not allowed with SAVE_IPSETS=Yes" if $host =~ /^!?\+/ && $config{SAVE_IPSETS};
validate_host $host, 1;
push @hosts, "$interface|$host|$seq";
push @rule, $rule;
}
unless ( $options eq '-' ) {
for my $option (split /,/, $options ) {
if ( $option eq 'routeback' ) {
if ( $routeback ) {
warning_message "Duplicate 'routeback' option ignored";
} else {
$routeback = 1;
}
} elsif ( $option eq 'source' ) {
for my $host ( split /,/, $hosts ) {
$source{"$interface|$host|$seq"} = 1;
}
} elsif ( $option eq 'dest' ) {
for my $host ( split /,/, $hosts ) {
$dest{"$interface|$host|$seq"} = 1;
}
} elsif ( $option eq 'notrack' ) {
for my $host ( split /,/, $hosts ) {
$notrack{"$interface|$host|$seq"} = 1;
}
} else {
warning_message "Unknown routestopped option ( $option ) ignored" unless $option eq 'critical';
warning_message "The 'critical' option is no longer supported (or needed)";
}
}
}
if ( $routeback || $interfaceref->{options}{routeback} ) {
my $chainref = $filter_table->{FORWARD};
for my $host ( split /,/, $hosts ) {
print $stoppedrules "ACCEPT\t$interface:$host\t$interface:$host\n";
}
}
push @allhosts, @hosts;
}
for my $host ( @allhosts ) {
my ( $interface, $h, $seq ) = split /\|/, $host;
my $rule = shift @rule;
print $stoppedrules "ACCEPT\t$interface:$h\t\$FW\t$rule\n";
print $stoppedrules "ACCEPT\t\$FW\t$interface:$h\t$rule\n" unless $config{ADMINISABSENTMINDED};
my $matched = 0;
if ( $source{$host} ) {
print $stoppedrules "ACCEPT\t$interface:$h\t-\t$rule\n";
$matched = 1;
}
if ( $dest{$host} ) {
print $stoppedrules "ACCEPT\t-\t$interface:$h\t$rule\n";
$matched = 1;
}
if ( $notrack{$host} ) {
print $stoppedrules "NOTRACK\t$interface:$h\t-\t$rule\n";
print $stoppedrules "NOTRACK\t\$FW\t$interface:$h\t$rule\n";
}
unless ( $matched ) {
for my $host1 ( @allhosts ) {
unless ( $host eq $host1 ) {
my ( $interface1, $h1 , $seq1 ) = split /\|/, $host1;
print $stoppedrules "ACCEPT\t$interface:$h\t$interface1:$h1\t$rule\n";
}
}
}
}
rename $fn, "$fn.bak";
progress_message2 "Routestopped file $fn saved in $fn.bak";
close $stoppedrules;
} elsif ( -f ( my $fn1 = find_file( 'routestopped' ) ) ) {
if ( unlink( $fn1 ) ) {
warning_message "Empty routestopped file ($fn1) removed";
} else {
warning_message "Unable to remove empty routestopped file $fn1: $!";
}
}
}
#
# Process the stoppedrules file. Returns true if the file was non-empty.
#
@@ -774,8 +940,8 @@ sub process_stoppedrules() {
sub setup_mss();
sub add_common_rules ( $$ ) {
my ( $upgrade_blacklist, $upgrade_tcrules ) = @_;
sub add_common_rules ( $$$ ) {
my ( $upgrade_blacklist, $upgrade_tcrules , $upgrade_routestopped ) = @_;
my $interface;
my $chainref;
my $target;
@@ -918,18 +1084,35 @@ sub add_common_rules ( $$ ) {
$target = $policy eq 'REJECT' ? 'reject' : $policy;
}
add_ijump( ensure_mangle_chain( 'rpfilter' ),
my $rpfilterref = ensure_mangle_chain( 'rpfilter' );
if ( $family == F_IPV4 ) {
for $interface ( @$list ) {
if ( get_interface_option( $interface, 'dhcp' ) ) {
add_ijump( $rpfilterref,
j => 'RETURN',
s => NILIPv4,
p => UDP,
dport => 67,
sport => 68
);
last;
}
}
}
add_ijump( $rpfilterref,
j => $target,
rpfilter => '--validmark --invert',
state_imatch 'NEW,RELATED,INVALID',
@ipsec
);
);
}
run_user_exit1 'initdone';
if ( $upgrade_blacklist ) {
exit 0 unless convert_blacklist || $upgrade_tcrules;
exit 0 unless convert_blacklist || $upgrade_tcrules || $upgrade_routestopped;
} else {
setup_blacklist;
}
@@ -1518,7 +1701,7 @@ sub handle_loopback_traffic() {
# Handle conntrack rules
#
if ( $notrackref->{referenced} ) {
for my $hostref ( @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
for my $hostref ( sort { $a->{type} cmp $b->{type} } @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
my $exclusion = source_exclusion( $hostref->{exclusions}, $notrackref);
my @ipsec_match = match_ipsec_in $z1 , $hostref;
@@ -1539,8 +1722,8 @@ sub handle_loopback_traffic() {
#
my $source_hosts_ref = defined_zone( $z1 )->{hosts};
for my $typeref ( values %{$source_hosts_ref} ) {
for my $hostref ( @{$typeref->{'%vserver%'}} ) {
for my $typeref ( sort { $a->{type} cmp $b->{type} } values %{$source_hosts_ref} ) {
for my $hostref ( sort { $a->{type} cmp $b->{type} } @{$typeref->{'%vserver%'}} ) {
my $exclusion = source_exclusion( $hostref->{exclusions}, $natref);
for my $net ( @{$hostref->{hosts}} ) {
@@ -1562,7 +1745,7 @@ sub add_interface_jumps {
our %input_jump_added;
our %output_jump_added;
our %forward_jump_added;
my @interfaces = grep $_ ne '%vserver%', @_;
my @interfaces = sort grep $_ ne '%vserver%', @_;
my $dummy;
my $lo_jump_added = interface_zone( loopback_interface ) && ! get_interface_option( loopback_interface, 'destonly' );
#
@@ -1809,7 +1992,7 @@ sub add_output_jumps( $$$$$$$ ) {
our @vservers;
our %output_jump_added;
my $chain1 = rules_target firewall_zone , $zone;
my $chain1 = rules_target( firewall_zone , $zone );
my $chain1ref = $filter_table->{$chain1};
my $nextchain = dest_exclusion( $exclusions, $chain1 );
my $outputref;
@@ -2136,11 +2319,9 @@ sub optimize1_zones( $$@ ) {
#
sub generate_matrix() {
my @interfaces = ( managed_interfaces );
#
# Should this be the real PREROUTING chain?
#
my @zones = off_firewall_zones;
our @vservers = vserver_zones;
my @zones = off_firewall_zones;
our @vservers = vserver_zones;
my $interface_jumps_added = 0;
@@ -2185,7 +2366,8 @@ sub generate_matrix() {
#
# Take care of PREROUTING, INPUT and OUTPUT jumps
#
for my $typeref ( values %$source_hosts_ref ) {
for my $type ( sort keys %$source_hosts_ref ) {
my $typeref = $source_hosts_ref->{$type};
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) {
if ( get_physical( $interface ) eq '+' ) {
#
@@ -2258,7 +2440,6 @@ sub generate_matrix() {
my $chain = rules_target $zone, $zone1;
next unless $chain; # CONTINUE policy with no rules
my $num_ifaces = 0;
if ( $zone eq $zone1 ) {
@@ -2270,8 +2451,9 @@ sub generate_matrix() {
}
my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT
for my $typeref ( values %{$zone1ref->{hosts}} ) {
for my $type ( sort keys %{$zone1ref->{hosts}} ) {
my $typeref = $zone1ref->{hosts}{$type};
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) {
for my $hostref ( @{$typeref->{$interface}} ) {
next if $hostref->{options}{sourceonly};
@@ -2392,20 +2574,29 @@ sub setup_mss( ) {
#
# Compile the stop_firewall() function
#
sub compile_stop_firewall( $$$ ) {
my ( $test, $export, $have_arptables ) = @_;
sub compile_stop_firewall( $$$$ ) {
my ( $test, $export, $have_arptables, $routestopped ) = @_;
my $input = $filter_table->{INPUT};
my $output = $filter_table->{OUTPUT};
my $forward = $filter_table->{FORWARD};
emit <<'EOF';
if ( $config{WORKAROUNDS} ) {
emit <<'EOF';
#
# Stop/restore the firewall after an error or because of a 'stop' or 'clear' command
#
stop_firewall() {
local hack
EOF
} else {
emit <<'EOF';
#
# Stop/restore the firewall after an error or because of a 'stop' or 'clear' command
#
stop_firewall() {
EOF
}
$output->{policy} = 'ACCEPT' if $config{ADMINISABSENTMINDED};
@@ -2418,7 +2609,7 @@ EOF
case $COMMAND in
stop|clear|restore)
if chain_exists dynamic; then
${IPTABLES}-save -t filter | grep '^-A dynamic' > ${VARDIR}/.dynamic
${IPTABLES}-save -t filter | grep '^-A dynamic' | fgrep -v -- '-j ACCEPT' > ${VARDIR}/.dynamic
fi
;;
*)
@@ -2433,7 +2624,7 @@ EOF
case $COMMAND in
stop|clear|restore)
if chain_exists dynamic; then
${IP6TABLES}-save -t filter | grep '^-A dynamic' > ${VARDIR}/.dynamic
${IP6TABLES}-save -t filter | grep '^-A dynamic' | fgrep -v -- '-j ACCEPT' > ${VARDIR}/.dynamic
fi
;;
*)
@@ -2573,7 +2764,12 @@ EOF
}
}
process_routestopped unless process_stoppedrules;
if ( $routestopped ) {
convert_routestopped;
process_stoppedrules;
} else {
process_routestopped unless process_stoppedrules;
}
if ( have_capability 'IFACE_MATCH' ) {
add_ijump $input, j => 'ACCEPT', iface => '--dev-in --loopback';

View File

@@ -80,7 +80,7 @@ sub process_one_masq1( $$$$$$$$$$ )
if ( $interfacelist =~ /^INLINE\((.+)\)$/ ) {
$interfacelist = $1;
$inlinematches = get_inline_matches(0);
} elsif ( $config{INLINE_MATCHES} ) {
} else {
$inlinematches = get_inline_matches(0);
}
#

View File

@@ -44,9 +44,10 @@ our @EXPORT = qw( process_providers
compile_updown
setup_load_distribution
have_providers
map_provider_to_interface
);
our @EXPORT_OK = qw( initialize provider_realm );
our $VERSION = '4.4_24';
our $VERSION = 'MODULEVERSION';
use constant { LOCAL_TABLE => 255,
MAIN_TABLE => 254,
@@ -59,7 +60,6 @@ our @routemarked_providers;
our %routemarked_interfaces;
our @routemarked_interfaces;
our %provider_interfaces;
our @load_providers;
our @load_interfaces;
our $balancing;
@@ -97,7 +97,6 @@ sub initialize( $ ) {
%routemarked_interfaces = ();
@routemarked_interfaces = ();
%provider_interfaces = ();
@load_providers = ();
@load_interfaces = ();
$balancing = 0;
$fallback = 0;
@@ -373,7 +372,7 @@ sub start_provider( $$$$$ ) {
emit "\n#\n# Add $what $table ($number)\n#";
if ( $number ) {
if ( $number >= 0 ) {
emit "start_provider_$table() {";
} else {
emit "start_interface_$table() {";
@@ -383,7 +382,7 @@ sub start_provider( $$$$$ ) {
emit $test;
push_indent;
if ( $number ) {
if ( $number >= 0 ) {
emit "qt ip -$family route flush table $id";
emit "echo \"\$IP -$family route flush table $id > /dev/null 2>&1\" > \${VARDIR}/undo_${table}_routing";
} else {
@@ -567,8 +566,8 @@ sub process_a_provider( $ ) {
$track = 0 if $config{TRACK_PROVIDERS};
$default_balance = 0 if $config{USE_DEFAULT_RT};
} elsif ( $option =~ /^load=(0?\.\d{1,8})/ ) {
$load = $1;
require_capability 'STATISTIC_MATCH', "load=$load", 's';
$load = sprintf "%1.8f", $1;
require_capability 'STATISTIC_MATCH', "load=$1", 's';
} elsif ( $option eq 'autosrc' ) {
$noautosrc = 0;
} elsif ( $option eq 'noautosrc' ) {
@@ -694,8 +693,6 @@ sub process_a_provider( $ ) {
$provider_interfaces{$interface} = $table unless $shared;
if ( $track ) {
fatal_error "The 'track' option requires a numeric value in the MARK column" if $mark eq '-';
if ( $routemarked_interfaces{$interface} ) {
fatal_error "Interface $interface is tracked through an earlier provider" if $routemarked_interfaces{$interface} == ROUTEMARKED_UNSHARED;
fatal_error "Multiple providers through the same interface must their IP address specified in the INTERFACES" unless $shared;
@@ -847,12 +844,12 @@ CEOF
if ( $hostroute ) {
if ( $family == F_IPV4 ) {
emit "run_ip route replace $gateway src $address dev $physical ${mtu}";
emit "run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm";
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu});
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm);
} else {
emit "qt \$IP -6 route add $gateway src $address dev $physical ${mtu}";
emit "qt \$IP -6 route del $gateway src $address dev $physical ${mtu}table $id $realm";
emit "run_ip route add $gateway src $address dev $physical ${mtu}table $id $realm";
emit qq(qt \$IP -6 route add $gateway src $address dev $physical ${mtu});
emit qq(qt \$IP -6 route del $gateway src $address dev $physical ${mtu}table $id $realm);
emit qq(run_ip route add $gateway src $address dev $physical ${mtu}table $id $realm);
}
}
@@ -1086,10 +1083,8 @@ CEOF
}
}
sub add_an_rtrule( ) {
my ( $source, $dest, $provider, $priority, $originalmark ) =
split_line( 'rtrules file',
{ source => 0, dest => 1, provider => 2, priority => 3 , mark => 4 } );
sub add_an_rtrule1( $$$$$ ) {
my ( $source, $dest, $provider, $priority, $originalmark ) = @_;
our $current_if;
@@ -1178,6 +1173,17 @@ sub add_an_rtrule( ) {
progress_message " Routing rule \"$currentline\" $done";
}
sub add_an_rtrule( ) {
my ( $sources, $dests, $provider, $priority, $originalmark ) =
split_line( 'rtrules file',
{ source => 0, dest => 1, provider => 2, priority => 3 , mark => 4 } );
for my $source ( split_list( $sources, "source" ) ) {
for my $dest (split_list( $dests , "dest" ) ) {
add_an_rtrule1( $source, $dest, $provider, $priority, $originalmark );
}
}
}
sub add_a_route( ) {
my ( $provider, $dest, $gateway, $device ) =
split_line( 'routes file',
@@ -1372,15 +1378,32 @@ sub finish_providers() {
emit( 'fi',
'' );
} else {
if ( ( $fallback || @load_interfaces ) && $config{USE_DEFAULT_RT} ) {
emit ( q(#),
q(# Delete any default routes in the 'main' table),
q(#),
"while qt \$IP -$family route del default table $main; do",
' true',
'done',
''
);
} else {
emit ( q(#),
q(# We don't have any 'balance'. 'load=' or 'fallback=' providers so we restore any default route that we've saved),
q(#),
qq(restore_default_route $config{USE_DEFAULT_RT}),
''
);
}
emit ( '#',
'# We don\'t have any \'balance\' providers so we restore any default route that we\'ve saved',
'# Delete any routes in the \'balance\' table',
'#',
"restore_default_route $config{USE_DEFAULT_RT}" ,
'#',
'# And delete any routes in the \'balance\' table',
'#',
"qt \$IP -$family route del default table $balance",
'' );
"while qt \$IP -$family route del default table $balance; do",
' true',
'done',
''
);
}
if ( $fallback ) {
@@ -1434,10 +1457,13 @@ sub process_providers( $ ) {
#
# Treat optional interfaces as pseudo-providers
#
my $num = -65536;
for ( grep interface_is_optional( $_ ) && ! $provider_interfaces{ $_ }, all_real_interfaces ) {
$num++;
#
# TABLE NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY
$currentline = var_base($_) ." 0 - - $_ - - -";
# TABLE NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY
$currentline = var_base($_) . " $num - - $_ - - -";
#
$pseudoproviders += process_a_provider(1);
}
@@ -1506,7 +1532,7 @@ EOF
" start_provider_$provider" );
}
emit ( ' else',
emit ( ' elif [ -z "$2" ]; then',
" startup_error \"Interface $providerref->{physical} is already enabled\"",
' fi',
' ;;'
@@ -1554,7 +1580,7 @@ EOF
}
emit( " stop_$providerref->{what}_$provider",
' else',
' elif [ -z "$2" ]; then',
" startup_error \"Interface $providerref->{physical} is already disabled\"",
' fi',
' ;;'
@@ -1579,10 +1605,44 @@ sub have_providers() {
return our $providers;
}
sub map_provider_to_interface() {
my $haveoptional;
for my $providerref ( sort { $a->{number} cmp $b->{number} } values %providers ) {
if ( $providerref->{optional} ) {
unless ( $haveoptional++ ) {
emit( 'if [ -n "$interface" ]; then',
' case $interface in' );
push_indent;
push_indent;
}
emit( $providerref->{provider} . ')',
' interface=' . $providerref->{physical},
' ;;' );
}
}
if ( $haveoptional ) {
pop_indent;
pop_indent;
emit( ' esac',
"fi\n"
);
}
}
sub setup_providers() {
our $providers;
if ( $providers ) {
if ( $maxload ) {
warning_message "The sum of the provider interface loads exceeds 1.000000" if $maxload > 1;
warning_message "The sum of the provider interface loads is less than 1.000000" if $maxload < 1;
}
emit "\nif [ -z \"\$g_noroutes\" ]; then";
push_indent;
@@ -1720,12 +1780,12 @@ sub compile_updown() {
q( if [ "$COMMAND" = up ]; then) ,
q( progress_message3 "Attempting enable on interface $1") ,
q( COMMAND=enable) ,
q( detect_configuration),
q( detect_configuration $1),
q( enable_provider $1),
q( elif [ "$PHASE" != post-down ]; then # pre-down or not Debian) ,
q( progress_message3 "Attempting disable on interface $1") ,
q( COMMAND=disable) ,
q( detect_configuration),
q( detect_configuration $1),
q( disable_provider $1) ,
q( fi) ,
q(elif [ "$COMMAND" = up ]; then) ,
@@ -1932,6 +1992,19 @@ sub handle_optional_interfaces( $ ) {
emit( "$physical)" ), push_indent if $wildcards;
if ( $provider eq $physical ) {
#
# Just an optional interface, or provider and interface are the same
#
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
} else {
#
# Provider
#
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
}
push_indent;
if ( $providerref->{gatewaycase} eq 'detect' ) {
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
} else {
@@ -1943,6 +2016,10 @@ sub handle_optional_interfaces( $ ) {
emit( " SW_${base}_IS_USABLE=Yes" ,
'fi' );
pop_indent;
emit( "fi\n" );
emit( ';;' ), pop_indent if $wildcards;
}
@@ -2049,7 +2126,7 @@ sub handle_stickiness( $ ) {
$rule1 = clone_irule( $_ );
set_rule_target( $rule1, 'MARK', "--set-mark $mark" );
set_rule_option( $rule1, 'recent', "--name $list --update --seconds 300 --reap" );
set_rule_option( $rule1, 'recent', "--name $list --update --seconds $rule1->{t} --reap" );
$rule2 = clone_irule( $_ );
@@ -2084,7 +2161,7 @@ sub handle_stickiness( $ ) {
$rule1 = clone_irule $_;
set_rule_target( $rule1, 'MARK', "--set-mark $mark" );
set_rule_option( $rule1, 'recent', " --name $list --rdest --update --seconds 300 --reap" );
set_rule_option( $rule1, 'recent', " --name $list --rdest --update --seconds $rule1->{t} --reap" );
$rule2 = clone_irule $_;

View File

@@ -154,7 +154,7 @@ sub setup_proxy_arp() {
emit '';
for my $interface ( keys %reset ) {
for my $interface ( sort keys %reset ) {
unless ( $set{interface} ) {
my $physical = get_physical $interface;
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
@@ -163,7 +163,7 @@ sub setup_proxy_arp() {
}
}
for my $interface ( keys %set ) {
for my $interface ( sort keys %set ) {
my $physical = get_physical $interface;
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
" echo 1 > /proc/sys/net/ipv$family/conf/$physical/$proc_file" );

View File

@@ -113,7 +113,7 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
$action = $1;
$disposition = $1;
}
} elsif ( $action =~ /^IP(6)?TABLES\((.+)\)(:(.*))$/ ) {
} elsif ( $action =~ /^IP(6)?TABLES\((.+)\)(:(.*))?$/ ) {
if ( $family == F_IPV4 ) {
fatal_error 'Invalid conntrack ACTION (IP6TABLES)' if $1;
} else {
@@ -125,8 +125,8 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
fatal_error "Unknown target ($tgt)" unless $target_type;
fatal_error "The $tgt TARGET is not allowed in the raw table" unless $target_type & RAW_TABLE;
$disposition = $tgt;
$action = 2;
validate_level( $level = $3 ) if supplied $3;
$action = $2;
validate_level( $level = $4 ) if supplied $4;
} else {
( $disposition, my ( $option, $args ), $level ) = split ':', $action, 4;
@@ -146,7 +146,7 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
if ( $option eq 'helper' ) {
my $modifiers = '';
$disposition = "helper";
$disposition = 'helper';
if ( $args =~ /^([-\w.]+)\((.+)\)$/ ) {
$args = $1;
@@ -156,8 +156,9 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
fatal_error "Invalid helper' ($args)" if $args =~ /,/;
validate_helper( $args, $proto );
$action = "CT --helper $helpers_aliases{$args}";
$exception_rule = do_proto( $proto, '-', '-' );
$exception_rule = do_proto( $proto, '-', '-' );
for my $mod ( split_list1( $modifiers, 'ctevents' ) ) {
fatal_error "Invalid helper option ($mod)" unless $mod =~ /^(\w+)=(.+)$/;
$mod = $1;
@@ -176,6 +177,17 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
fatal_error "Invalid helper option ($mod)";
}
}
} elsif ( $option eq 'ctevents' ) {
$disposition = 'helper';
for ( split_list( $args, 'ctevents' ) ) {
fatal_error "Invalid 'ctevents' event ($_)" unless $valid_ctevent{$_};
}
$action = "CT --ctevents $args";
} elsif ( $option eq 'expevents' ) {
fatal_error "Invalid expevent argument ($args)" unless $args eq 'new';
$action = 'CT --expevents new';
} else {
fatal_error "Invalid CT option ($option)";
}
@@ -263,11 +275,13 @@ sub process_format( $ ) {
$file_format = $format;
}
sub setup_conntrack() {
sub setup_conntrack($) {
my $convert = shift;
my $fn;
for my $name ( qw/notrack conntrack/ ) {
my $fn = open_file( $name, 3 , 1 );
$fn = open_file( $name, 3 , 1 );
if ( $fn ) {
@@ -329,12 +343,76 @@ sub setup_conntrack() {
} else {
warning_message "Unable to remove empty notrack file ($fn): $!";
}
$convert = undef;
}
}
} elsif ( $name eq 'notrack' ) {
$convert = undef;
if ( -f ( my $fn1 = find_file( $name ) ) ) {
if ( unlink( $fn1 ) ) {
warning_message "Empty notrack file ($fn1) removed";
} else {
warning_message "Non-empty notrack file ($fn); please move its contents to the conntrack file";
warning_message "Unable to remove empty notrack file ($fn1): $!";
}
}
}
}
if ( $convert ) {
my $conntrack;
my $empty = 1;
my $date = localtime;
if ( $fn ) {
open $conntrack, '>>', $fn or fatal_error "Unable to open $fn for notrack conversion: $!";
} else {
open $conntrack, '>', $fn = find_file 'conntrack' or fatal_error "Unable to open $fn for notrack conversion: $!";
print $conntrack <<'EOF';
#
# Shorewall version 5 - conntrack File
#
# For information about entries in this file, type "man shorewall-conntrack"
#
##############################################################################################################
EOF
print $conntrack '?' . "FORMAT 3\n";
print $conntrack <<'EOF';
#ACTION SOURCE DESTINATION PROTO DEST SOURCE USER/ SWITCH
# PORT(S) PORT(S) GROUP
EOF
}
print( $conntrack
"#\n" ,
"# Rules generated from notrack file $fn by Shorewall $globals{VERSION} - $date\n" ,
"#\n" );
$fn = open_file( 'notrack' , 3, 1 ) || fatal_error "Unable to open the notrack file for conversion: $!";
while ( read_a_line( PLAIN_READ ) ) {
#
# Don't copy the header comments from the old notrack file
#
next if $empty && ( $currentline =~ /^\s*#/ || $currentline =~ /^\s*$/ );
if ( $empty ) {
#
# First non-commentary line
#
$empty = undef;
print $conntrack '?' . "FORMAT 1\n" unless $currentline =~ /^\s*\??FORMAT/i;
}
print $conntrack "$currentline\n";
}
rename $fn, "$fn.bak" or fatal_error "Unable to rename $fn to $fn.bak: $!";
progress_message2 "notrack file $fn saved in $fn.bak"
}
}
1;

View File

@@ -224,6 +224,7 @@ sub initialize( $ ) {
$family = shift;
#
# Chains created as a result of entries in the policy file
#
@policy_chains = ();
#
# This is updated from the *_DEFAULT settings in shorewall.conf. Those settings were stored
@@ -454,13 +455,12 @@ sub process_default_action( $$$$ ) {
} elsif ( ( $targets{$def} || 0 ) == INLINE ) {
$default = $def;
$default = "$def($param)" if supplied $param;
$default = join( ':', $default, $level ) if $level ne 'none';
} elsif ( $default_option ) {
fatal_error "Unknown Action ($default) in $policy setting";
} else {
fatal_error "Unknown Default Action ($default)";
}
$default = join( ':', $default, $level ) if $level ne 'none';
} else {
$default = $default_actions{$policy} || 'none';
}
@@ -468,6 +468,64 @@ sub process_default_action( $$$$ ) {
$default;
}
#
# Verify an NFQUEUE specification and return the appropriate ip[6]tables target
#
sub handle_nfqueue( $$ ) {
my ($params, $allow_bypass ) = @_;
my ( $action, $bypass );
my ( $queue1, $queue2, $queuenum1, $queuenum2 );
require_capability( 'NFQUEUE_TARGET', 'NFQUEUE Rules and Policies', '' );
if ( supplied( $params ) ) {
( my $queue, $bypass, my $junk ) = split ',', $params, 3;
fatal_error "Invalid NFQUEUE parameter list ($params)" if defined $junk;
if ( supplied $queue ) {
if ( $queue eq 'bypass' ) {
fatal_error "'bypass' is not allowed in this context" unless $allow_bypass;
fatal_error "Invalid NFQUEUE options (bypass,$bypass)" if supplied $bypass;
return 'NFQUEUE --queue-bypass';
}
( $queue1, $queue2 ) = split ':', $queue, 2;
fatal_error "Invalid NFQUEUE parameter list ($params)" unless supplied $queue1;
$queuenum1 = numeric_value( $queue1 );
fatal_error "Invalid NFQUEUE queue number ($queue1)" unless defined( $queuenum1) && $queuenum1 >= 0 && $queuenum1 <= 65535;
if ( supplied $queue2 ) {
$queuenum2 = numeric_value( $queue2 );
fatal_error "Invalid NFQUEUE queue number ($queue2)" unless defined( $queuenum2) && $queuenum2 >= 0 && $queuenum2 <= 65535 && $queuenum1 < $queuenum2;
}
} else {
$queuenum1 = 0;
}
} else {
$queuenum1 = 0;
}
if ( supplied $bypass ) {
fatal_error "Invalid NFQUEUE option ($bypass)" if $bypass ne 'bypass';
fatal_error "'bypass' is not allowed in this context" unless $allow_bypass;
$bypass =' --queue-bypass';
} else {
$bypass = '';
}
if ( supplied $queue2 ) {
return "NFQUEUE --queue-balance ${queuenum1}:${queuenum2}${bypass}";
} else {
return "NFQUEUE --queue-num ${queuenum1}${bypass}";
}
}
#
# Process an entry in the policy file.
#
@@ -518,11 +576,9 @@ sub process_a_policy() {
$default = process_default_action( $originalpolicy, $policy, $default, $level );
if ( defined $queue ) {
fatal_error "Invalid policy ($policy($queue))" unless $policy eq 'NFQUEUE';
require_capability( 'NFQUEUE_TARGET', 'An NFQUEUE Policy', 's' );
my $queuenum = numeric_value( $queue );
fatal_error "Invalid NFQUEUE queue number ($queue)" unless defined( $queuenum) && $queuenum <= 65535;
$policy = "NFQUEUE --queue-num $queuenum";
$policy = handle_nfqueue( $queue,
0 # Don't allow 'bypass'
);
} elsif ( $policy eq 'NONE' ) {
fatal_error "NONE policy not allowed with \"all\""
if $clientwild || $serverwild;
@@ -548,10 +604,10 @@ sub process_a_policy() {
$chainref->{provisional} = 0;
$chainref->{policy} = $policy;
} else {
fatal_error qq(Policy "$client $server $policy" duplicates earlier policy "@{$chainref->{policypair}} $chainref->{policy}");
fatal_error qq(Policy "$client $server $originalpolicy" duplicates earlier policy "@{$chainref->{policypair}} $chainref->{policy}");
}
} elsif ( $chainref->{policy} ) {
fatal_error qq(Policy "$client $server $policy" duplicates earlier policy "@{$chainref->{policypair}} $chainref->{policy}");
fatal_error qq(Policy "$client $server $originalpolicy" duplicates earlier policy "@{$chainref->{policypair}} $chainref->{policy}");
} else {
convert_to_policy_chain( $chainref, $client, $server, $policy, 0 , $audit );
push @policy_chains, ( $chainref ) unless $config{EXPAND_POLICIES} && ( $clientwild || $serverwild );
@@ -583,23 +639,23 @@ sub process_a_policy() {
for my $zone ( @zonelist ) {
for my $zone1 ( @zonelist ) {
set_policy_chain rules_chain( ${zone}, ${zone1} ), $client, $server, $chainref, $policy, $intrazone;
print_policy $zone, $zone1, $policy, $chain;
print_policy $zone, $zone1, $originalpolicy, $chain;
}
}
} else {
for my $zone ( all_zones ) {
set_policy_chain rules_chain( ${zone}, ${server} ), $client, $server, $chainref, $policy, $intrazone;
print_policy $zone, $server, $policy, $chain;
print_policy $zone, $server, $originalpolicy, $chain;
}
}
} elsif ( $serverwild ) {
for my $zone ( @zonelist ) {
set_policy_chain rules_chain( ${client}, ${zone} ), $client, $server, $chainref, $policy, $intrazone;
print_policy $client, $zone, $policy, $chain;
print_policy $client, $zone, $originalpolicy, $chain;
}
} else {
print_policy $client, $server, $policy, $chain;
print_policy $client, $server, $originalpolicy, $chain;
}
}
@@ -712,7 +768,7 @@ sub process_policies()
#
# Policy Rule application
#
sub process_inline ($$$$$$$$$$$$$$$$$$$$$);
sub process_inline ($$$$$$$$$$$$$$$$$$$$$$);
sub add_policy_rules( $$$$$ ) {
my ( $chainref , $target, $loglevel, $default, $dropmulticast ) = @_;
@@ -737,6 +793,7 @@ sub add_policy_rules( $$$$$ ) {
process_inline( $action, #Inline
$chainref, #Chain
'', #Matches
'', #Matches1
$loglevel, #Log Level and Tag
$default, #Target
$param || '', #Param
@@ -1622,7 +1679,7 @@ my %builtinops = ( 'dropBcast' => \&dropBcast,
'Limit' => \&Limit,
);
sub process_rule ( $$$$$$$$$$$$$$$$$$$ );
sub process_rule ( $$$$$$$$$$$$$$$$$$$$ );
#
# Populate an action invocation chain. As new action tuples are encountered,
@@ -1686,6 +1743,7 @@ sub process_action($$) {
}
process_rule( $chainref,
'',
'',
$nolog ? $target : merge_levels( join(':', @actparms{'chain','loglevel','logtag'}), $target ),
'',
@@ -1874,6 +1932,7 @@ sub process_reject_action() {
process_inline( $action, #Inline
$rejectref, #Chain
'', #Matches
'', #Matches1
'', #Log Level and Tag
$action, #Target
'', #Param
@@ -1902,8 +1961,8 @@ sub process_reject_action() {
#
# Expand a macro rule from the rules file
#
sub process_macro ($$$$$$$$$$$$$$$$$$$$) {
my ($macro, $chainref, $matches, $target, $param, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper, $wildcard ) = @_;
sub process_macro ($$$$$$$$$$$$$$$$$$$$$) {
my ($macro, $chainref, $matches, $matches1, $target, $param, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper, $wildcard ) = @_;
my $generated = 0;
@@ -2002,7 +2061,8 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$$) {
$generated |= process_rule(
$chainref,
$matches,
$matches,
$matches1,
$mtarget,
$param,
$msource,
@@ -2035,8 +2095,8 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$$) {
#
# Expand an inline action rule from the rules file
#
sub process_inline ($$$$$$$$$$$$$$$$$$$$$) {
my ($inline, $chainref, $matches, $loglevel, $target, $param, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper, $wildcard ) = @_;
sub process_inline ($$$$$$$$$$$$$$$$$$$$$$) {
my ($inline, $chainref, $matches, $matches1, $loglevel, $target, $param, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper, $wildcard ) = @_;
my $generated = 0;
@@ -2126,7 +2186,8 @@ sub process_inline ($$$$$$$$$$$$$$$$$$$$$) {
$generated |= process_rule(
$chainref,
$matches,
$matches,
$matches1,
$mtarget,
$param,
$msource,
@@ -2179,9 +2240,10 @@ sub verify_audit($;$$) {
# reference is also passed when rules are being generated during processing of a macro used as a default action.
#
sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
my ( $chainref, #reference to Action Chain if we are being called from process_action(); undef otherwise
$rule, #Matches
$matches1, #Matches after the ones generated by the columns
$target,
$current_param,
$source,
@@ -2221,7 +2283,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
if ( $basictarget eq 'INLINE' ) {
( $action, $basictarget, $param, $loglevel, $raw_matches ) = handle_inline( FILTER_TABLE, 'filter', $action, $basictarget, $param, $loglevel );
} elsif ( $config{INLINE_MATCHES} ) {
} else {
$raw_matches = get_inline_matches(0);
}
#
@@ -2246,6 +2308,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
my $generated = process_macro( $basictarget,
$chainref,
$rule . $raw_matches,
$matches1,
$target,
$current_param,
$source,
@@ -2269,10 +2332,9 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
return $generated;
} elsif ( $actiontype & NFQ ) {
require_capability( 'NFQUEUE_TARGET', 'NFQUEUE Rules', '' );
my $paramval = $param eq '' ? 0 : numeric_value( $param );
fatal_error "Invalid value ($param) for NFQUEUE queue number" unless defined($paramval) && $paramval <= 65535;
$action = "NFQUEUE --queue-num $paramval";
$action = handle_nfqueue( $param,
1 # Allow 'bypass'
);
} elsif ( $actiontype & SET ) {
require_capability( 'IPSET_MATCH', 'SET and UNSET rules', '' );
fatal_error "$action rules require a set name parameter" unless $param;
@@ -2649,6 +2711,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
my $generated = process_inline( $basictarget,
$chainref,
$rule . $raw_matches,
$matches1,
$loglevel,
$target,
$current_param,
@@ -2703,7 +2766,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
do_headers( $headers ) ,
do_condition( $condition , $chain ) ,
do_helper( $helper ) ,
$raw_matches ,
$matches1 . $raw_matches ,
);
} else {
$rule .= join( '',
@@ -2715,7 +2778,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
do_time( $time ) ,
do_headers( $headers ) ,
do_condition( $condition , $chain ) ,
$raw_matches ,
$matches1 . $raw_matches ,
);
}
@@ -2960,8 +3023,8 @@ sub merge_target( $$ ) {
#
# May be called by Perl code in action bodies (regular and inline) to generate a rule.
#
sub perl_action_helper($$;$) {
my ( $target, $matches, $isstatematch ) = @_;
sub perl_action_helper($$;$$) {
my ( $target, $matches, $isstatematch , $matches1 ) = @_;
my $action = $actparms{action};
my $chainref = $actparms{0};
my $result;
@@ -2970,6 +3033,12 @@ sub perl_action_helper($$;$) {
$matches .= ' ' unless $matches =~ /^(?:.+\s)?$/;
if ( $matches1 ) {
$matches1 .= ' ' unless $matches1 =~ /^(?:.+\s)?$/;
} else {
$matches1 = '';
}
set_inline_matches( $target =~ /^INLINE(?::.*)?$/ ? $matches : '' );
if ( $isstatematch ) {
@@ -2993,6 +3062,7 @@ sub perl_action_helper($$;$) {
if ( my $ref = $inlines{$action} ) {
$result = &process_rule( $chainref,
$matches,
$matches1,
merge_target( $ref, $target ),
'', # CurrentParam
@columns );
@@ -3001,6 +3071,7 @@ sub perl_action_helper($$;$) {
$result = process_rule( $chainref,
$matches,
$matches1,
merge_target( $actions{$action}, $target ),
'', # Current Param
'-', # Source
@@ -3052,6 +3123,7 @@ sub perl_action_tcp_helper($$) {
if ( my $ref = $inlines{$action} ) {
$result = &process_rule( $chainref,
$proto,
'',
merge_target( $ref, $target ),
'',
@columns[0,1],
@@ -3061,6 +3133,7 @@ sub perl_action_tcp_helper($$) {
} else {
$result = process_rule( $chainref,
$proto,
'',
merge_target( $actions{$action}, $target ),
'', # Current Param
'-', # Source
@@ -3254,6 +3327,7 @@ sub process_raw_rule ( ) {
for my $proto ( @protos ) {
for my $user ( @users ) {
if ( process_rule( undef,
'',
'',
$target,
'',

View File

@@ -27,7 +27,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# This module deals with Traffic Shaping and the tcrules file.
# This module deals with Traffic Shaping and the mangle file.
#
package Shorewall::Tc;
require Exporter;
@@ -135,7 +135,7 @@ our %restrictions = ( tcpre => PREROUTE_RESTRICT ,
our $family;
our $tcrules;
our $convert;
our $mangle;
@@ -225,6 +225,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
my $device = '';
our $cmd;
our $designator;
our $ttl = 0;
my $fw = firewall_zone;
sub handle_mark_param( $$ ) {
@@ -333,7 +334,31 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
}
}
sub ipset_command() {
my %xlate = ( ADD => 'add-set' , DEL => 'del-set' );
require_capability( 'IPSET_MATCH', "$cmd rules", '' );
fatal_error "$cmd rules require a set name parameter" unless $params;
my ( $setname, $flags, $rest ) = split ':', $params, 3;
fatal_error "Invalid ADD/DEL parameter ($params)" if $rest;
$setname =~ s/^\+//;
fatal_error "Expected ipset name ($setname)" unless $setname =~ /^(6_)?[a-zA-Z][-\w]*$/;
fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/;
$target = join( ' ', 'SET --' . $xlate{$cmd} , $setname , $flags );
}
my %commands = (
ADD => {
defaultchain => PREROUTING,
allowedchains => ALLCHAINS,
minparams => 1,
maxparams => 1,
function => sub() {
ipset_command();
}
},
CHECKSUM => {
defaultchain => 0,
allowedchains => ALLCHAINS,
@@ -396,6 +421,16 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
},
},
DEL => {
defaultchain => PREROUTING,
allowedchains => ALLCHAINS,
minparams => 1,
maxparams => 1,
function => sub() {
ipset_command();
}
},
DIVERT => {
defaultchain => REALPREROUTING,
allowedchains => PREROUTING | REALPREROUTING,
@@ -587,6 +622,13 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
$target = ( $chain == OUTPUT ? 'sticko' : 'sticky' );
$restriction = DESTIFACE_DISALLOW;
ensure_mangle_chain( $target );
if (supplied $params) {
$ttl = numeric_value( $params );
fatal_error "The SAME timeout must be positive" unless $ttl;
} else {
$ttl = 300;
}
$sticky++;
},
},
@@ -601,7 +643,6 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
if ( supplied $params ) {
handle_mark_param( '--save-mark --mask ' ,
$config{TC_EXPERT} ? HIGHMARK : SMALLMARK );
} else {
$target .= '--save-mark --mask ' . in_hex( $globals{TC_MASK} );
}
@@ -708,7 +749,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
if ( $cmd eq 'INLINE' ) {
( $target, $cmd, $params, $junk, $raw_matches ) = handle_inline( MANGLE_TABLE, 'mangle', $action, $cmd, $params, '' );
} elsif ( $config{INLINE_MATCHES} ) {
} else {
$raw_matches = get_inline_matches(0);
}
@@ -756,7 +797,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
if ( $commandref->{maxparams} == 1 ) {
fatal_error "The $cmd requires a parameter";
} else {
fatal_error "The $cmd ACTION only requires at least $commandref->{maxparams} parmeters";
fatal_error "The $cmd ACTION requires at least $commandref->{maxparams} parmeters";
}
}
if ( $state ne '-' ) {
@@ -801,6 +842,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
do_dscp( $dscp ) .
state_match( $state ) .
do_time( $time ) .
( $ttl ? "-t $ttl " : '' ) .
$raw_matches ,
$source ,
$dest ,
@@ -852,13 +894,17 @@ sub process_tc_rule1( $$$$$$$$$$$$$$$$ ) {
our %tccmd;
unless ( %tccmd ) {
%tccmd = ( SAVE => { match => sub ( $ ) { $_[0] eq 'SAVE' } ,
%tccmd = ( ADD => { match => sub ( $ ) { $_[0] =~ /^ADD/ }
},
DEL => { match => sub ( $ ) { $_[0] =~ /^DEL/ }
},
SAVE => { match => sub ( $ ) { $_[0] eq 'SAVE' } ,
} ,
RESTORE => { match => sub ( $ ) { $_[0] eq 'RESTORE' },
} ,
CONTINUE => { match => sub ( $ ) { $_[0] eq 'CONTINUE' },
} ,
SAME => { match => sub ( $ ) { $_[0] eq 'SAME' },
SAME => { match => sub ( $ ) { $_[0] =~ /^SAME(?:\(d+\))?$/ },
} ,
IPMARK => { match => sub ( $ ) { $_[0] =~ /^IPMARK/ },
} ,
@@ -952,7 +998,7 @@ sub process_tc_rule1( $$$$$$$$$$$$$$$$ ) {
}
}
if ( $tcrules ) {
if ( $convert ) {
$command = ( $command ? "$command($mark)" : $mark ) . $designator;
my $line = ( $family == F_IPV6 ?
"$command\t$source\t$dest\t$proto\t$ports\t$sports\t$user\t$testval\t$length\t$tos\t$connbytes\t$helper\t$headers\t$probability\t$dscp\t$state" :
@@ -3115,11 +3161,129 @@ sub process_secmark_rule() {
}
}
sub convert_tos($$) {
my ( $mangle, $fn1 ) = @_;
my $have_tos = 0;
sub unlink_tos( $ ) {
my $fn = shift;
if ( unlink $fn ) {
warning_message "Empty tos file ($fn) removed";
} else {
warning_message "Unable to remove empty tos file $fn: $!";
}
}
if ( my $fn = open_file 'tos' ) {
first_entry(
sub {
my $date = localtime;
progress_message2 "Converting $fn...";
print( $mangle
"#\n" ,
"# Rules generated from tos file $fn by Shorewall $globals{VERSION} - $date\n" ,
"#\n" );
}
);
while ( read_a_line( NORMAL_READ ) ) {
$have_tos = 1;
my ($src, $dst, $proto, $ports, $sports , $tos, $mark ) =
split_line( 'tos file entry',
{ source => 0, dest => 1, proto => 2, dport => 3, sport => 4, tos => 5, mark => 6 } );
my $chain_designator = 'P';
decode_tos($tos, 1);
my ( $srczone , $source , $remainder );
if ( $family == F_IPV4 ) {
( $srczone , $source , $remainder ) = split( /:/, $src, 3 );
fatal_error 'Invalid SOURCE' if defined $remainder;
} elsif ( $src =~ /^(.+?):<(.*)>\s*$/ || $src =~ /^(.+?):\[(.*)\]\s*$/ ) {
$srczone = $1;
$source = $2;
} else {
$srczone = $src;
}
if ( $srczone eq firewall_zone ) {
$chain_designator = 'O';
$src = $source || '-';
} else {
$src =~ s/^all:?//;
}
$dst =~ s/^all:?//;
$src = '-' unless supplied $src;
$dst = '-' unless supplied $dst;
$proto = '-' unless supplied $proto;
$ports = '-' unless supplied $ports;
$sports = '-' unless supplied $sports;
$mark = '-' unless supplied $mark;
print $mangle "TOS($tos):$chain_designator\t$src\t$dst\t$proto\t$ports\t$sports\t-\t$mark\n"
}
if ( $have_tos ) {
progress_message2 "Converted $fn to $fn1";
if ( rename $fn, "$fn.bak" ) {
progress_message2 "$fn renamed $fn.bak";
} else {
fatal_error "Cannot Rename $fn to $fn.bak: $!";
}
} else {
unlink_tos( $fn );
}
} elsif ( -f ( $fn = find_file( 'tos' ) ) ) {
if ( unlink $fn ) {
warning_message "Empty tos file ($fn) removed";
} else {
warning_message "Unable to remove empty tos file $fn: $!";
}
}
}
sub open_mangle_for_output() {
my ( $mangle, $fn1 );
if ( -f ( $fn1 = find_writable_file( 'mangle' ) ) ) {
open( $mangle , '>>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
} else {
open( $mangle , '>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
print $mangle <<'EOF';
#
# Process the tcrules file and setup traffic shaping
# Shorewall version 4 - Mangle File
#
# For information about entries in this file, type "man shorewall-mangle"
#
# See http://shorewall.net/traffic_shaping.htm for additional information.
# For usage in selecting among multiple ISPs, see
# http://shorewall.net/MultiISP.html
#
# See http://shorewall.net/PacketMarking.html for a detailed description of
# the Netfilter/Shorewall packet marking mechanism.
####################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP
# PORT(S) PORT(S)
EOF
}
return ( $mangle, $fn1 );
}
#
# Process the mangle file and setup traffic shaping
#
sub setup_tc( $ ) {
$tcrules = $_[0];
$convert = $_[0];
if ( $config{MANGLE_ENABLED} ) {
ensure_mangle_chain 'tcpre';
@@ -3175,33 +3339,69 @@ sub setup_tc( $ ) {
if ( $fn = open_file( 'tcrules' , 2, 1 ) ) {
my $fn1;
if ( $tcrules ) {
if ( $convert ) {
#
# We are going to convert this tcrules file to the equivalent mangle file
#
open( $mangle , '>>', $fn1 = find_file('mangle') ) || fatal_error "Unable to open $fn1:$!";
( $mangle, $fn1 ) = open_mangle_for_output;
directive_callback( sub () { print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT'; 0; } );
}
first_entry "$doing $fn...";
first_entry(
sub {
if ( $convert ) {
my $date = localtime;
progress_message2 "Converting $fn...";
print( $mangle
"#\n" ,
"# Rules generated from tcrules file $fn by Shorewall $globals{VERSION} - $date\n" ,
"#\n" );
} else {
progress_message2 "$doing $fn...";
}
}
);
process_tc_rule, $have_tcrules++ while read_a_line( NORMAL_READ );
if ( $have_tcrules ) {
if ( $mangle ) {
if ( $convert ) {
if ( $have_tcrules ) {
progress_message2 "Converted $fn to $fn1";
if ( rename $fn, "$fn.bak" ) {
progress_message2 "$fn renamed $fn.bak";
} else {
fatal_error "Cannot Rename $fn to $fn.bak: $!";
}
} elsif ( -f ( my $fn = find_file( 'tcrules' ) ) ) {
if ( unlink $fn ) {
warning_message "Empty tcrules file ($fn) removed";
} else {
warning_message "Unable to remove empty tcrules file $fn: $!";
}
}
convert_tos( $mangle, $fn1 );
close $mangle, directive_callback( 0 );
}
} elsif ( $convert ) {
if ( -f ( my $fn = find_file( 'tcrules' ) ) ) {
if ( unlink $fn ) {
warning_message "Empty tcrules file ($fn) removed";
} else {
warning_message "Non-empty tcrules file ($fn); consider running '$product update -t'";
warning_message "Unable to remove empty tcrules file $fn: $!";
}
}
close $mangle, directive_callback( 0 ) if $tcrules;
if ( -f ( my $fn = find_file( 'tos' ) ) ) {
#
# We are going to convert this tos file to the equivalent mangle file
#
( $mangle, my $fn1 ) = open_mangle_for_output;
convert_tos( $mangle, $fn1 );
close $mangle;
}
}
if ( my $fn = open_file( 'mangle', 1, 1 ) ) {

View File

@@ -132,6 +132,15 @@ sub setup_tunnels() {
add_tunnel_rule $inchainref, p => 'tcp --dport 1723', @$source
}
sub setup_one_tinc {
my ( $inchainref, $outchainref, $kind, $source, $dest ) = @_;
add_tunnel_rule $inchainref, p => 'udp --dport 655', @$source;
add_tunnel_rule $outchainref, p => 'udp --dport 655', @$dest;
add_tunnel_rule $inchainref, p => 'tcp --dport 655', @$source;
add_tunnel_rule $outchainref, p => 'tcp --dport 655', @$dest;
}
sub setup_one_openvpn {
my ($inchainref, $outchainref, $kind, $source, $dest) = @_;
@@ -154,7 +163,7 @@ sub setup_tunnels() {
}
add_tunnel_rule $inchainref, p => "$protocol --dport $port", @$source;
add_tunnel_rule $outchainref, p => "$protocol --dport $port", @$dest;;
add_tunnel_rule $outchainref, p => "$protocol --dport $port", @$dest;
}
sub setup_one_openvpn_client {
@@ -263,6 +272,7 @@ sub setup_tunnels() {
'6in4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
'pptpclient' => { function => \&setup_pptp_client, params => [ $kind, \@source, \@dest ] } ,
'pptpserver' => { function => \&setup_pptp_server, params => [ $kind, \@source, \@dest ] } ,
'tinc' => { function => \&setup_one_tinc, params => [ $kind, \@source, \@dest ] } ,
'openvpn' => { function => \&setup_one_openvpn, params => [ $kind, \@source, \@dest ] } ,
'openvpnclient' => { function => \&setup_one_openvpn_client, params => [ $kind, \@source, \@dest ] } ,
'openvpnserver' => { function => \&setup_one_openvpn_server, params => [ $kind, \@source, \@dest ] } ,

View File

@@ -465,6 +465,7 @@ sub parse_zone_option_list($$\$$)
} else {
fatal_error "Missing value for option \"$e\"" unless defined $val;
fatal_error "Invalid value ($val) for option \"$e\"" unless $val =~ /^($fmt)$/;
require_capability 'TCPMSS_TARGET', "mss=$val", 's' if $e eq 'mss';
}
my $key = $zonekey{$e};
@@ -1207,18 +1208,20 @@ sub process_interface( $$ ) {
fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option};
if ( $zone ) {
fatal_error qq(The "$option" option may not be specified for a Vserver zone") if $zoneref->{type} & VSERVER && ! ( $type & IF_OPTION_VSERVER );
} else {
fatal_error "The \"$option\" option may not be specified on a multi-zone interface" if $type & IF_OPTION_ZONEONLY;
}
my $hostopt = $type & IF_OPTION_HOST;
fatal_error "The \"$option\" option is not allowed on a bridge port" if $port && ! $hostopt;
$type &= MASK_IF_OPTION;
unless ( $type == BINARY_IF_OPTION && defined $value && $value eq '0' ) {
if ( $zone ) {
fatal_error qq(The "$option" option may not be specified for a Vserver zone") if $zoneref->{type} & VSERVER && ! ( $type & IF_OPTION_VSERVER );
} else {
fatal_error "The \"$option\" option may not be specified on a multi-zone interface" if $type & IF_OPTION_ZONEONLY;
}
}
fatal_error "The \"$option\" option is not allowed on a bridge port" if $port && ! $hostopt;
if ( $type == SIMPLE_IF_OPTION ) {
fatal_error "Option $option does not take a value" if defined $value;
if ( $option eq 'blacklist' ) {
@@ -1258,6 +1261,7 @@ sub process_interface( $$ ) {
fatal_error "The '$option' option requires a value" unless defined $value;
my $numval = numeric_value $value;
fatal_error "Invalid value ($value) for option $option" unless defined $numval && $numval <= $maxoptionvalue{$option};
require_capability 'TCPMSS_TARGET', "mss=$value", 's' if $option eq 'mss';
$options{$option} = $numval;
$hostoptions{$option} = $numval if $hostopt;
} elsif ( $type == IPLIST_IF_OPTION ) {
@@ -1547,10 +1551,16 @@ sub known_interface($)
my $iface = $interface;
if ( $minroot ) {
#
# We have wildcard interfaces -- see if this interface matches one of their roots
#
while ( length $iface > $minroot ) {
chop $iface;
if ( my $i = $roots{$iface} ) {
#
# Found one
#
$interfaceref = $interfaces{$i};
my $physical = map_physical( $interface, $interfaceref );
@@ -1680,9 +1690,8 @@ sub source_port_to_bridge( $ ) {
return $portref ? $portref->{bridge} : '';
}
#
# Returns a hash reference for the zones interface through the interface
# Returns a hash reference for the zones interfaced through the interface
#
sub interface_zones( $ ) {
my $interfaceref = known_interface( $_[0] );
@@ -1717,7 +1726,7 @@ sub interface_is_required($) {
}
#
# Return true if the interface is 'plain'
# Return true if the interface is 'plain' (not optional, required or ignored and not a bridge port).
#
sub interface_is_plain($) {
my $interfaceref = $interfaces{$_[0]};
@@ -1798,7 +1807,7 @@ sub find_interfaces_by_option1( $ ) {
my @ints = ();
my $wild = 0;
for my $interface ( sort { $interfaces{$a}->{number} <=> $interfaces{$b}->{number} } keys %interfaces ) {
for my $interface ( @interfaces ) {
my $interfaceref = $interfaces{$interface};
next unless defined $interfaceref->{physical};
@@ -2067,6 +2076,7 @@ sub process_host( ) {
$zoneref->{options}{in}{blacklist} = 1;
} elsif ( $option =~ /^mss=(\d+)$/ ) {
fatal_error "Invalid mss ($1)" unless $1 >= 500;
require_capability 'TCPMSS_TARGET', $option, 's';
$options{mss} = $1;
$zoneref->{options}{complex} = 1;
} elsif ( $validhostoptions{$option}) {
@@ -2167,8 +2177,10 @@ sub find_hosts_by_option( $ ) {
}
for my $zone ( grep ! ( $zones{$_}{type} & FIREWALL ) , @zones ) {
while ( my ($type, $interfaceref) = each %{$zones{$zone}{hosts}} ) {
while ( my ( $interface, $arrayref) = ( each %{$interfaceref} ) ) {
for my $type (sort keys %{$zones{$zone}{hosts}} ) {
my $interfaceref = $zones{$zone}{hosts}->{$type};
for my $interface ( sort keys %$interfaceref ) {
my $arrayref = $interfaceref->{$interface};
for my $host ( @{$arrayref} ) {
my $ipsec = $host->{ipsec};
unless ( $done{$interface} ) {
@@ -2194,8 +2206,10 @@ sub find_zone_hosts_by_option( $$ ) {
my @hosts;
unless ( $zones{$zone}{type} & FIREWALL ) {
while ( my ($type, $interfaceref) = each %{$zones{$zone}{hosts}} ) {
while ( my ( $interface, $arrayref) = ( each %{$interfaceref} ) ) {
for my $type (sort keys %{$zones{$zone}{hosts}} ) {
my $interfaceref = $zones{$zone}{hosts}->{$type};
for my $interface ( sort keys %$interfaceref ) {
my $arrayref = $interfaceref->{$interface};
for my $host ( @{$arrayref} ) {
if ( my $value = $host->{options}{$option} ) {
for my $net ( @{$host->{hosts}} ) {
@@ -2207,7 +2221,7 @@ sub find_zone_hosts_by_option( $$ ) {
}
}
\@hosts;
\@hosts
}
#

View File

@@ -42,6 +42,8 @@
# --config_path=<path-list> # Search path for config files
# --inline # Update alternative column specifications
# --tcrules # Create mangle from tcrules
# --routestopped # Create stoppedrules from routestopped
# --notrack # Create conntrack from notrack
#
use strict;
use FindBin;
@@ -77,6 +79,8 @@ usage: compiler.pl [ <option> ... ] [ <filename> ]
[ --config_path=<path-list> ]
[ --inline ]
[ --tcrules ]
[ --routestopped ]
[ --notrack ]
_EOF_
exit shift @_;
@@ -107,6 +111,8 @@ my $shorewallrc = '';
my $shorewallrc1 = '';
my $inline = 0;
my $tcrules = 0;
my $routestopped = 0;
my $notrack = 0;
Getopt::Long::Configure ('bundling');
@@ -141,6 +147,8 @@ my $result = GetOptions('h' => \$help,
'convert' => \$convert,
'inline' => \$inline,
'tcrules' => \$tcrules,
'routestopped' => \$routestopped,
'notrack' => \$notrack,
'config_path=s' => \$config_path,
'shorewallrc=s' => \$shorewallrc,
'shorewallrc1=s' => \$shorewallrc1,
@@ -171,4 +179,6 @@ compiler( script => $ARGV[0] || '',
shorewallrc1 => $shorewallrc1,
inline => $inline,
tcrules => $tcrules,
routestopped => $routestopped,
notrack => $notrack,
);

View File

@@ -1,11 +1,11 @@
# (c) 1999-2014 - Tom Eastep (teastep@shorewall.net)
# (c) 1999-2015 - Tom Eastep (teastep@shorewall.net)
#
# This program is part of Shorewall.
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,30 +17,41 @@
#
# Options are:
#
# -n Do not alter Routing
# -v and -q Standard Shorewall Verbosity control
# -t Timestamp progress messages
# -p Purge conntrack table
# -r Recover from failed start/restart
# -V <verbosity> Set verbosity level explicitly
# -R <restore> Overrides RESTOREFILE setting
# -n Do not alter Routing
# -v and -q Standard Shorewall Verbosity control
# -t Timestamp progress messages
# -p Purge conntrack table
# -r Recover from failed start/restart
# -V <verbosity> Set verbosity level explicitly
# -R <restore> Overrides RESTOREFILE setting
#
# Commands are:
#
# start Starts the firewall
# refresh Refresh the firewall
# restart Restarts the firewall
# reload Reload the firewall
# clear Removes all firewall rules
# stop Stops the firewall
# status Displays firewall status
# version Displays the version of Shorewall that
# generated this program
# clear Removes all firewall rules
# disable Disable an optional interface
# down Stop an optional interface
# enable Enable an optional interface
# help Show command syntax
# reenable Disable then nable an optional
# interface
# refresh Refresh the firewall
# reload Reload the firewall
# restart Restarts the firewall
# restore Restore a saved configuration
# reset Reset byte and packet counters
# run Call a function in this program
# savesets Save the ipset contents
# status Displays firewall status
# start Starts the firewall
# stop Stops the firewall
# up Start an optional interface
# version Displays the version of Shorewall that
# generated this program
#
################################################################################
# Functions imported from /usr/share/shorewall/lib.core
################################################################################
# Address family-neutral Functions
# Address family-neutral Functions
################################################################################
#
# Conditionally produce message
@@ -593,48 +604,61 @@ interface_enabled() {
distribute_load() {
local interface
local totalload
local load
local mark
local maxload
local currentload # Total load of enabled interfaces
local load # Specified load of an enabled interface
local mark # Mark of an enabled interface
local totalload # Total load of all interfaces - usually 1.000000
local nload # Normalized load of an enabled interface
local var # Interface name to embed in a variable name
maxload=$1
totalload=$1
shift
totalload=0
currentload=0
for interface in $@; do
if interface_enabled $interface; then
var=$(echo $interface | sed 's/[.-]/_/g')
load=$(cat ${VARDIR}/${interface}_load)
eval ${interface}_load=$load
eval ${var}_load=$load
mark=$(cat ${VARDIR}/${interface}_mark)
eval ${interface}_mark=$mark
totalload=$( bc <<EOF
eval ${var}_mark=$mark
currentload=$( bc <<EOF
scale=8
$totalload + $load
$currentload + $load
EOF
)
fi
done
if [ $totalload ]; then
if [ $currentload ]; then
for interface in $@; do
qt $g_tool -t mangle -F ~$interface
eval load=\$${interface}_load
eval mark=\$${interface}_mark
var=$(echo $interface | sed 's/[.-]/_/g')
eval load=\$${var}_load
eval mark=\$${var}_mark
if [ -n "$load" ]; then
load=$(bc <<EOF
nload=$(bc <<EOF
scale=8
( $load / $totalload ) * $maxload
( $load / $currentload ) * $totalload
EOF
)
totalload=$(bc <<EOF
currentload=$(bc <<EOF
scale=8
$totalload - $load
$currentload - $load
EOF
)
run_iptables -t mangle -A ~$interface -m statistic --mode random --probability $load -j MARK --set-mark $mark
case $nload in
.*|0.*)
run_iptables -t mangle -A ~$interface -m statistic --mode random --probability $nload -j MARK --set-mark $mark
;;
*)
run_iptables -t mangle -A ~$interface -j MARK --set-mark $mark
;;
esac
fi
done
fi

View File

@@ -15,12 +15,14 @@ usage() {
echo " down <interface>"
echo " enable <interface>"
echo " reset"
echo " reenable <interface>"
echo " refresh"
echo " restart"
echo " run <command> [ <parameter> ... ]"
echo " status"
echo " up <interface>"
echo " savesets <file>"
echo " call <function> [ <parameter> ... ]"
echo " version"
echo
echo "Options are:"
@@ -98,6 +100,8 @@ g_sha1sum2=
# Other Globals
#
g_counters=
g_compiled=
g_file=
initialize
@@ -263,7 +267,7 @@ case "$COMMAND" in
status=0
for chain in $@; do
if chain_exists $chain; then
if qt $g_tool-Z $chain; then
if qt $g_tool -Z $chain; then
progress_message3 "Filter $chain Counters Reset"
else
error_message "ERROR: Reset of chain $chain failed"
@@ -375,8 +379,8 @@ case "$COMMAND" in
[ $# -ne 1 ] && usage 2
mutex_on
if product_is_started; then
detect_configuration
enable_provider $1
detect_configuration $1
enable_provider $1 Yes
fi
mutex_off
status=0
@@ -387,8 +391,21 @@ case "$COMMAND" in
[ $# -ne 1 ] && usage 2
mutex_on
if product_is_started; then
detect_configuration
disable_provider $1
detect_configuration $1
disable_provider $1 Yes
fi
mutex_off
status=0
;;
reenable)
[ $# -eq 1 ] && exit 0
shift
[ $# -ne 1 ] && usage 2
mutex_on
if product_is_started; then
detect_configuration $1
COMMAND=enable disable_provider $1 Yes
COMMAND=disable enable_provider $1 Yes
fi
mutex_off
status=0
@@ -407,10 +424,35 @@ case "$COMMAND" in
savesets)
if [ $# -eq 2 ]; then
save_ipsets $2
status=$?
else
usage 2
fi
;;
call)
#
# Way to call functions in the generated script directly
#
detect_configuration
shift
if [ $# -gt 0 ]; then
#
# See what it is
#
if type $1 2> /dev/null | fgrep -q 'is a function'; then
#
# It's a shell function -- call it
#
$@
else
fatal_error "$1 is not a known shell function"
fi
else
usage 1
fi
;;
version)
[ $# -ne 1 ] && usage 2
echo $SHOREWALL_VERSION

View File

@@ -234,6 +234,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=No
ZONE2ZONE=-
###############################################################################

View File

@@ -245,6 +245,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=No
ZONE2ZONE=-
###############################################################################

View File

@@ -242,6 +242,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=No
ZONE2ZONE=-
###############################################################################

View File

@@ -245,6 +245,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=No
ZONE2ZONE=-
###############################################################################

View File

@@ -33,7 +33,7 @@ fatal_error "Invalid successive interval ($succesive) passed to AutoBL" unless $
fatal_error "Invalid packet count ($count) passed to AutoBL" unless $count =~ /^\d+$/ && $count;
fatal_error "Invalid blacklist time ($bltime) passed to AutoBL" unless $bltime =~ /^\d+$/ && $bltime;
validate_level( $level );
1;
?end perl
###############################################################################
#TARGET SOURCE DEST PROTO DPORT SPORT

View File

@@ -41,9 +41,9 @@ set_action_disposition( $disposition) if supplied $disposition;
set_action_name_to_caller;
if ( $destination eq 'dst' ) {
perl_action_helper( $action, "-m recent --name $event --remove --rdest" );
perl_action_helper( $action, '', '', "-m recent --name $event --remove --rdest" );
} else {
perl_action_helper( $action, "-m recent --name $event --remove --rsource" );
perl_action_helper( $action, '', '', "-m recent --name $event --remove --rsource" );
}
1;

View File

@@ -41,9 +41,9 @@ set_action_disposition( $disposition) if supplied $disposition;
set_action_name_to_caller;
if ( $destination eq 'dst' ) {
perl_action_helper( $action, "-m recent --name $event --set --rdest" );
perl_action_helper( $action, '', '', "-m recent --name $event --set --rdest" );
} else {
perl_action_helper( $action, "-m recent --name $event --set --rsource" );
perl_action_helper( $action, '', '', "-m recent --name $event --set --rsource" );
}
1;

View File

@@ -234,6 +234,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=Yes
ZONE2ZONE=-
###############################################################################

View File

@@ -162,14 +162,13 @@ get_config() {
if [ "$2" = Yes ]; then
case $STARTUP_ENABLED in
No|no|NO)
fatal_error "$g_product startup is disabled. To enable startup, set STARTUP_ENABLED=Yes in ${g_confdir}/${g_program}.conf"
not_configured_error "$g_product startup is disabled. To enable startup, set STARTUP_ENABLED=Yes in ${g_confdir}/${g_program}.conf"
;;
Yes|yes|YES)
;;
*)
if [ -n "$STARTUP_ENABLED" ]; then
fatal_error "Invalid Value for STARTUP_ENABLED: $STARTUP_ENABLED"
exit 2
not_configured_error "Invalid Value for STARTUP_ENABLED: $STARTUP_ENABLED"
fi
;;
esac
@@ -324,6 +323,19 @@ get_config() {
;;
esac
if [ -n "$WORKAROUNDS" ]; then
case $WORKAROUNDS in
[Yy]es)
;;
[Nn]o)
WORKAROUNDS=''
;;
*)
fatal_error "Invalid setting ($WORKAROUNDS) for WORKAROUNDS"
;;
esac
fi
g_loopback=$(find_loopback_interfaces)
}
@@ -351,6 +363,21 @@ uptodate() {
return 0
}
#
# Run the postcompile user exit
#
run_postcompile() { # $1 is the compiled script
local script
script=$(find_file postcompile)
if [ -f $script ]; then
. $script $1
else
return 0
fi
}
#
# Run the compiler
#
@@ -358,11 +385,12 @@ compiler() {
local pc
local shorewallrc
local shorewallrc1
local options
pc=${LIBEXECDIR}/shorewall/compiler.pl
if [ $(id -u) -ne 0 ]; then
if [ -z "$g_shorewalldir" -o "$g_shorewalldir" = /etc/$g_program ]; then
if [ -z "$g_shorewalldir" -o "$g_shorewalldir" = $CONFDIR/$g_program ]; then
startup_error "Ordinary users may not $COMMAND the $CONFDIR/$g_program configuration"
fi
fi
@@ -375,8 +403,6 @@ compiler() {
#
get_config Yes
[ -n "$g_doing" ] && progress_message3 "$g_doing..."
case $COMMAND in
*start|try|refresh)
;;
@@ -388,11 +414,11 @@ compiler() {
debugflags="-w"
[ -n "$g_debug" ] && debugflags='-wd'
[ -n "$g_profile" ] && debugflags='-wd:DProf'
[ -n "$g_profile" ] && debugflags='-wd:NYTProf'
# Perl compiler only takes the output file as a argument
[ "$1" = debug -o "$1" = trace ] && shift;
[ "$1" = debug -o "$1" = trace ] && shift;
[ "$1" = nolock ] && shift;
shift
@@ -403,8 +429,9 @@ compiler() {
[ -f "$shorewallrc1" ] || fatal_error "Compiling for export requires a shorewallrc file"
fi
if [ -n "$g_conditional" ] && uptodate $g_file; then
if [ -n "$g_conditional" ] && uptodate "$g_file"; then
echo "$g_file is up to date -- no compilation required"
g_compiled="$g_file"
return 0
fi
@@ -426,6 +453,8 @@ compiler() {
[ -n "$g_directives" ] && options="$options --directives"
[ -n "$g_tcrules" ] && options="$options --tcrules"
[ -n "$g_inline" ] && options="$options --inline"
[ -n "$g_routestopped" ] && options="$options --routestopped"
[ -n "$g_notrack" ] && options="$options --notrack"
if [ -n "$PERL" ]; then
if [ ! -x "$PERL" ]; then
@@ -436,28 +465,33 @@ compiler() {
PERL=/usr/bin/perl
fi
case "$g_doing" in
Compiling|Checking)
progress_message3 "$g_doing using $g_product $SHOREWALL_VERSION..."
;;
Updating)
progress_message3 "Updating $g_product configuration to $SHOREWALL_VERSION..."
;;
*)
[ -n "$g_doing" ] && progress_message3 "$g_doing using $g_product $SHOREWALL_VERSION..."
;;
esac
if [ ${PERLLIBDIR} = ${LIBEXECDIR}/shorewall ]; then
$PERL $debugflags $pc $options $@
else
PERL5LIB=${PERLLIBDIR}
export PERL5LIB
$PERL $debugflags $pc $options $@
PERL5LIB=${PERLLIBDIR} $PERL $debugflags $pc $options $@
fi
}
#
# Run the postcompile user exit
#
run_postcompile() { # $1 is the compiled script
local script
status=$?
script=$(find_file postcompile)
if [ -f $script ]; then
. $script $1
else
return 0
if [ $status -eq 0 -a $COMMAND != check -a $COMMAND != update ]; then
g_compiled="$g_file"
run_postcompile "$g_compiled"
return
fi
return $status
}
#
@@ -477,8 +511,8 @@ start_command() {
rc=$?
[ -n "$nolock" ] || mutex_off
else
if compiler $g_debugging $nolock compile ${VARDIR}/.start; then
run_postcompile ${VARDIR}/.start
g_file="${VARDIR}/.start"
if compiler $g_debugging $nolock compile "$g_file"; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.start $g_debugging start
rc=$?
@@ -497,7 +531,7 @@ start_command() {
exit 0
fi
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
while [ $finished -eq 0 -a $# -gt 0 ]; do
option=$1
@@ -682,7 +716,7 @@ compile_command() {
;;
1)
g_file=$1
[ -d $g_file ] && fatal_error "$g_file is a directory"
[ -d "$g_file" ] && fatal_error "$g_file is a directory"
;;
2)
[ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
@@ -705,7 +739,7 @@ compile_command() {
[ "x$g_file" = x- ] && g_doing=''
compiler $g_debugging compile $g_file && run_postcompile $g_file
compiler $g_debugging compile "$g_file"
}
#
@@ -852,11 +886,21 @@ update_command() {
g_tcrules=Yes
option=${option#t}
;;
s*)
g_routestopped=Yes
option=${option#s}
;;
n*)
g_notrack=Yes
option=${option#n}
;;
A*)
g_inline=Yes
g_convert=Yes
g_directives=Yes
g_tcrules=Yes
g_routestopped=Yes
g_notrack=Yes
option=${option#A}
;;
*)
@@ -893,7 +937,7 @@ update_command() {
;;
esac
g_doing="Updating..."
g_doing="Updating"
compiler $g_debugging $nolock check
}
@@ -989,15 +1033,16 @@ restart_command() {
;;
esac
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
if [ -z "$g_fast" -a -n "$AUTOMAKE" ]; then
uptodate ${VARDIR}/firewall && g_fast=Yes
fi
g_file="${VARDIR}/.restart"
if [ -z "$g_fast" ]; then
if compiler $g_debugging $nolock compile ${VARDIR}/.restart; then
run_postcompile ${VARDIR}/.restart
if compiler $g_debugging $nolock compile "$g_file"; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.restart $g_debugging restart
rc=$?
@@ -1088,10 +1133,11 @@ refresh_command() {
product_is_started || fatal_error "$g_product is not running"
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
if compiler $g_debugging $nolock compile ${VARDIR}/.refresh; then
run_postcompile ${VARDIR}/.refresh
g_file="${VARDIR}/.refresh"
if compiler $g_debugging $nolock compile "$g_file"; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.refresh $g_debugging refresh
rc=$?
@@ -1177,7 +1223,7 @@ safe_commands() {
;;
esac
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
if product_is_started; then
running=Yes
@@ -1199,13 +1245,13 @@ safe_commands() {
command="restart"
fi
if ! compiler $g_debugging nolock compile ${VARDIR}/.$command; then
g_file="${VARDIR}/.$command"
if ! compiler $g_debugging nolock compile "$g_file"; then
status=$?
exit $status
fi
run_postcompile ${VARDIR}/.$command
case $command in
start)
RESTOREFILE=NONE
@@ -1314,7 +1360,7 @@ try_command() {
;;
esac
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
if product_is_started; then
running=Yes
@@ -1330,7 +1376,9 @@ try_command() {
command="restart"
fi
if ! compiler $g_debugging $nolock compile ${VARDIR}/.$command; then
g_file="${VARDIR}/.$command"
if ! compiler $g_debugging $nolock compile "$g_file"; then
status=$?
exit $status
fi
@@ -1524,7 +1572,9 @@ reload_command() # $* = original arguments less the command.
[ -n "$litedir" ] || litedir=${VARLIB}/${g_program}-lite
if compiler $g_debugging compiler $g_shorewalldir/firewall && \
g_file="$g_shorewalldir/firewall"
if compiler $g_debugging compiler "$g_file" && \
progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..." && \
rcp_command "$g_shorewalldir/firewall $g_shorewalldir/firewall.conf" ${litedir}
then
@@ -1613,7 +1663,9 @@ export_command() # $* = original arguments less the command.
g_export=Yes
if compiler $g_debugging compile $g_shorewalldir/firewall && \
g_file="$g_shorewalldir/firewall"
if compiler $g_debugging compile "$g_file" && \
echo "Copying $file and ${file}.conf to ${target#*@}..." && \
scp $g_shorewalldir/firewall $g_shorewalldir/firewall.conf $target
then
@@ -1634,97 +1686,6 @@ run_command() {
fi
}
#
# Give Usage Information
#
usage() # $1 = exit status
{
echo "Usage: $(basename $0) [debug|trace] [nolock] [ -q ] [ -v[-1|{0-2}] ] [ -t ] <command>"
echo "where <command> is one of:"
echo " add <interface>[:<host-list>] ... <zone>"
echo " allow <address> ..."
echo " [ check | ck ] [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ -i ] [ <directory> ]"
echo " clear"
echo " [ compile | co ] [ -e ] [ -p ] [ -t ] [ -c ] [ -d ] [ -T ] [ -i ] [ <directory name> ] [ <path name> ]"
echo " delete <interface>[:<host-list>] ... <zone>"
echo " disable <interface>"
echo " drop <address> ..."
echo " dump [ -x ] [ -l ] [ -m ]"
echo " enable <interface>"
echo " export [ <directory1> ] [<user>@]<system>[:<directory2>]"
echo " forget [ <file name> ]"
echo " help"
if [ $g_family -eq 4 ]; then
echo " hits [ -t ]"
echo " ipcalc { <address>/<vlsm> | <address> <netmask> }"
echo " ipdecimal { <address> | <integer> }"
echo " iprange <address>-<address>"
fi
if [ $g_family -eq 4 ]; then
echo " iptrace <iptables match expression>"
else
echo " iptrace <ip6tables match expression>"
fi
echo " load [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " logdrop <address> ..."
echo " logreject <address> ..."
echo " logwatch [<refresh interval>]"
if [ $g_family -eq 4 ]; then
echo " noiptrace <iptables match expression>"
else
echo " noiptrace <ip6tables match expression>"
fi
echo " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]"
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 ] [ -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 [ -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"
echo " [ show | list | ls ] connections"
echo " [ show | list | ls ] dynamic <zone>"
echo " [ show | list | ls ] filters"
echo " [ show | list | ls ] ip"
if [ $g_family -eq 4 ]; then
echo " [ show | list | ls ] ipa"
fi
echo " [ show | list | ls ] [ -m ] log [<regex>]"
echo " [ show | list | ls ] macro <macro>"
echo " [ show | list | ls ] macros"
echo " [ show | list | ls ] marks"
echo " [ show | list | ls ] [ -x ] mangle|nat|raw|rawpost|routing"
echo " [ show | list | ls ] nfacct"
echo " [ show | list | ls ] policies"
echo " [ show | list | ls ] routing"
echo " [ show | list | ls ] tc [ device ]"
echo " [ show | list | ls ] vardir"
echo " [ show | list | ls ] zones"
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 " version [ -a ]"
echo
exit $1
}
compiler_command() {
case $COMMAND in

View File

@@ -90,7 +90,8 @@
role="bold">NOTRACK</emphasis>|<emphasis
role="bold">CT</emphasis>:<emphasis
role="bold">helper</emphasis>:<replaceable>name</replaceable>[(<replaceable>arg</replaceable>=<replaceable>val</replaceable>[,...])|<emphasis
role="bold">CT:notrack</emphasis>|DROP|LOG|ULOG(<replaceable>ulog-parameters</replaceable>):NFLOG(<replaceable>nflog-parameters</replaceable>)|IPTABLES(<replaceable>target</replaceable>)}[<replaceable>log-level</replaceable>[:<replaceable>log-tag</replaceable>]][:<replaceable>chain-designator</replaceable>]</term>
role="bold">CT:ctevents:<replaceable>event</replaceable>[,...]|CT:expevents:new</emphasis><emphasis
role="bold">|CT:notrack</emphasis>|DROP|LOG|ULOG(<replaceable>ulog-parameters</replaceable>):NFLOG(<replaceable>nflog-parameters</replaceable>)|IPTABLES(<replaceable>target</replaceable>)}[<replaceable>log-level</replaceable>[:<replaceable>log-tag</replaceable>]][:<replaceable>chain-designator</replaceable>]</term>
<listitem>
<para>This column is only present when FORMAT &gt;= 2. Values other
@@ -114,7 +115,8 @@
<replaceable>name</replaceable> to this connection. This is more
flexible than loading the conntrack helper with preset ports. If
a <replaceable>log-level</replaceable> is specified, the packet
will also be logged at that level.</para>
will also be logged at that level. Beginning with Shorewall
4.6.10, the helper name is optional</para>
<para>At this writing, the available helpers are:</para>
@@ -244,6 +246,31 @@
</itemizedlist>
</listitem>
<listitem>
<para>ctevents:<replaceable>event</replaceable>[,...]</para>
<para>Added in Shorewall 4.6.10. Only generate the specified
conntrack events for this connection. Possible event types are:
<emphasis role="bold">new</emphasis>, <emphasis
role="bold">related</emphasis>, <emphasis
role="bold">destroy</emphasis>, <emphasis
role="bold">reply</emphasis>, <emphasis
role="bold">assured</emphasis>, <emphasis
role="bold">protoinfo</emphasis>, <emphasis
role="bold">helper</emphasis>, <emphasis
role="bold">mark</emphasis> (this is connection mark, not packet
mark), <emphasis role="bold">natseqinfo</emphasis>, and
<emphasis role="bold">secmark</emphasis>.</para>
</listitem>
<listitem>
<para>expevents=new</para>
<para>Added in Shorewall 4.6.10. Only generate <emphasis
role="bold">new</emphasis> expectation events for this
connection.</para>
</listitem>
<listitem>
<para><option>DROP</option></para>

View File

@@ -760,7 +760,7 @@ loc eth2 -</programlisting>
</varlistentry>
<varlistentry>
<term>unmanaged</term>
<term><emphasis role="bold">unmanaged</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.18. Causes all traffic between
@@ -913,7 +913,7 @@ net ppp0 -</programlisting>
<programlisting>FORMAT 2
#ZONE INTERFACE OPTIONS
- br0 routeback</programlisting>
- br0 bridge</programlisting>
</listitem>
</varlistentry>
</variablelist>

View File

@@ -123,6 +123,28 @@
following.</para>
<variablelist>
<varlistentry>
<term><emphasis
role="bold">ADD(<replaceable>ipset</replaceable>:<replaceable>flags</replaceable>)</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.7. Causes addresses and/or port
numbers to be added to the named
<replaceable>ipset</replaceable>. The
<replaceable>flags</replaceable> specify the address or tuple
to be added to the set and must match the type of ipset
involved. For example, for an iphash ipset, either the SOURCE
or DESTINATION address can be added using
<replaceable>flags</replaceable> <emphasis
role="bold">src</emphasis> or <emphasis
role="bold">dst</emphasis> respectively (see the -A command in
ipset (8)).</para>
<para>ADD is non-terminating. Even if a packet matches the
rule, it is passed on to the next rule.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">CHECKSUM</emphasis></term>
@@ -214,6 +236,27 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">DEL(<replaceable>ipset</replaceable>:<replaceable>flags</replaceable>)</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.7. Causes an entry to be deleted
from the named <replaceable>ipset</replaceable>. The
<replaceable>flags</replaceable> specify the address or tuple
to be deleted from the set and must match the type of ipset
involved. For example, for an iphash ipset, either the SOURCE
or DESTINATION address can be deleted using
<replaceable>flags</replaceable> <emphasis
role="bold">src</emphasis> or <emphasis
role="bold">dst</emphasis> respectively (see the -D command in
ipset (8)).</para>
<para>DEL is non-terminating. Even if a packet matches the
rule, it is passed on to the next rule.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DIVERT</emphasis></term>
@@ -308,18 +351,18 @@
<para>The following rules are equivalent:</para>
<programlisting>2:P eth0 - tcp 22
INLINE(2):P eth0 - tcp 22
INLINE(2):P eth0 - ; -p tcp
INLINE eth0 - tcp 22 ; -j MARK --set-mark 2
INLINE eth0 - ; -p tcp -j MARK --set-mark 2
<programlisting>2:P eth0 - tcp 22
INLINE(MARK(2)):P eth0 - tcp 22
INLINE(MARK(2)):P eth0 - ; -p tcp
INLINE eth0 - tcp 22 ; -j MARK --set-mark 2
INLINE eth0 - ; -p tcp -j MARK --set-mark 2
</programlisting>
<para>If INLINE_MATCHES=Yes in <ulink
url="/manpages/shorewall.conf.html">shorewall6.conf(5)</ulink>
then the third rule above can be specified as follows:</para>
<programlisting>2:P eth0 - ; -p tcp</programlisting>
<programlisting>MARK(2):P eth0 - ; -p tcp</programlisting>
</listitem>
</varlistentry>
@@ -509,7 +552,8 @@ INLINE eth0 - ; -p tcp -j MARK --set-mark
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SAME</emphasis></term>
<term><emphasis
role="bold">SAME[(<replaceable>timeout</replaceable>)]</emphasis></term>
<listitem>
<para>Some websites run applications that require multiple
@@ -533,12 +577,16 @@ SAME:P 192.168.1.0/24 0.0.0.0/0 tcp 80,443</programlisting>
connections to an individual remote system to all use the same
provider. For example:<programlisting>#ACTION SOURCE DEST PROTO DEST
# PORT(S)
SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>
If the firewall attempts a connection on TCP port 80 or 443
and it has sent a packet on either of those ports in the last
five minutes to the same remote system then the new connection
will use the same provider as the connection over which that
last packet was sent.</para>
SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>The
optional <replaceable>timeout</replaceable> parameter was
added in Shorewall 4.6.7 and specifies a number of seconds .
When not specified, a value of 300 seconds (5 minutes) is
assumed. If the firewall attempts a connection on TCP port 80
or 443 and it has sent a packet on either of those ports in
the last <replaceable>timeout</replaceable> seconds to the
same remote system then the new connection will use the same
provider as the connection over which that last packet was
sent.</para>
</listitem>
</varlistentry>
@@ -1235,12 +1283,12 @@ Normal-Service =&gt; 0x00</programlisting>
<programlisting> #ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
# PORT(S)
1:T 0.0.0.0/0 0.0.0.0/0 icmp echo-request
1:T 0.0.0.0/0 0.0.0.0/0 icmp echo-reply
MARK(1):T 0.0.0.0/0 0.0.0.0/0 icmp echo-request
MARK(1):T 0.0.0.0/0 0.0.0.0/0 icmp echo-reply
RESTORE:T 0.0.0.0/0 0.0.0.0/0 all - - - 0
CONTINUE:T 0.0.0.0/0 0.0.0.0/0 all - - - !0
4:T 0.0.0.0/0 0.0.0.0/0 ipp2p:all
SAVE:T 0.0.0.0/0 0.0.0.0/0 all - - - !0</programlisting>
MARK(4):T 0.0.0.0/0 0.0.0.0/0 ipp2p:all
SAVE:T 0.0.0.0/0 0.0.0.0/0 all - - - !0</programlisting>
<para>If a packet hasn't been classified (packet mark is 0), copy
the connection mark to the packet mark. If the packet mark is set,
@@ -1259,9 +1307,9 @@ Normal-Service =&gt; 0x00</programlisting>
<programlisting>/etc/shorewall/tcrules:
#ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
# PORT(S)
1-3:CF 192.168.1.0/24 eth0 ; state=NEW
#ACTION SOURCE DEST PROTO PORT(S) SOURCE USER TEST
# PORT(S)
CONNMARK(1-3):F 192.168.1.0/24 eth0 ; state=NEW
/etc/shorewall/masq:

View File

@@ -105,7 +105,7 @@
role="bold">REJECT</emphasis>|<emphasis
role="bold">CONTINUE</emphasis>|<emphasis
role="bold">QUEUE</emphasis>|<emphasis
role="bold">NFQUEUE</emphasis>[(<emphasis>queuenumber</emphasis>)]|<emphasis
role="bold">NFQUEUE</emphasis>[(<emphasis>queuenumber1</emphasis>[:<replaceable>queuenumber2</replaceable>])]|<emphasis
role="bold">NONE</emphasis>}[<emphasis
role="bold">:</emphasis>{<emphasis>default-action-or-macro</emphasis>[:level]|<emphasis
role="bold">None</emphasis>}]</term>
@@ -180,8 +180,14 @@
<listitem>
<para>Queue the request for a user-space application using the
nfnetlink_queue mechanism. If a
<replaceable>queuenumber</replaceable> is not given, queue
zero (0) is assumed.</para>
<replaceable>queuenumber1</replaceable> is not given, queue
zero (0) is assumed. Beginning with Shorewall 4.6.10, a second
queue number (queuenumber2) may be given. This specifies a
range of queues to use. Packets are then balanced across the
given queues. This is useful for multicore systems: start
multiple instances of the userspace program on queues x, x+1,
.. x+n and use "x:x+n". Packets belonging to the same
connection are put into the same nfqueue.</para>
</listitem>
</varlistentry>

View File

@@ -220,7 +220,22 @@
</varlistentry>
<varlistentry>
<term>noautosrc</term>
<term><emphasis
role="bold">load=<replaceable>probability</replaceable></emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.0. This option provides an
alternative method of load balancing based on probabilities.
Providers to be balanced are given a
<replaceable>probability</replaceable> (a number 0 &gt; n
&gt;= 1) with up to 8 digits to the right of the decimal
point. Beginning with Shorewall 4.6.10, a warning is issued if
the sum of the probabilities is not 1.00000000.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noautosrc</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.17. Prevents the addition of a

View File

@@ -48,6 +48,9 @@
&amp;<replaceable>interface</replaceable> in this column to indicate
that the source is the primary IP address of the named
interface.</para>
<para>Beginning with Shorewall 4.6.8, you may specify a
comma-separated list of addresses in this column.</para>
</listitem>
</varlistentry>
@@ -64,6 +67,9 @@
role="bold">DEST</emphasis>, place "-" in that column. Note that you
may not omit both <emphasis role="bold">SOURCE</emphasis> and
<emphasis role="bold">DEST</emphasis>.</para>
<para>Beginning with Shorewall 4.6.8, you may specify a
comma-separated list of addresses in this column.</para>
</listitem>
</varlistentry>

View File

@@ -129,8 +129,10 @@
<term><emphasis role="bold">NEW</emphasis></term>
<listitem>
<para>Packets in the NEW, INVALID and UNTRACKED states are processed
by rules in this section.</para>
<para>Packets in the NEW state are processed by rules in this
section. If the INVALID and/or UNTRACKED sections are empty or not
included, then the packets in the corresponding state(s) are also
processed in this section.</para>
</listitem>
</varlistentry>
</variablelist>
@@ -264,7 +266,8 @@
</varlistentry>
<varlistentry>
<term>AUDIT[(accept|drop|reject)]</term>
<term><emphasis
role="bold">AUDIT</emphasis>[(accept|drop|reject)]</term>
<listitem>
<para>Added in Shorewall 4.5.10. Audits the packet with the
@@ -275,7 +278,11 @@
</varlistentry>
<varlistentry>
<term>A_ACCEPT, A_ACCEPT+ and A_ACCEPT!</term>
<term><emphasis role="bold">A_ACCEPT</emphasis>, <emphasis
role="bold">A_ACCEPT</emphasis><emphasis
role="bold">+</emphasis> and <emphasis
role="bold">A_ACCEPT</emphasis><emphasis
role="bold">!</emphasis></term>
<listitem>
<para>Added in Shorewall 4.4.20. Audited versions of ACCEPT,
@@ -285,7 +292,8 @@
</varlistentry>
<varlistentry>
<term>A_DROP and A_DROP!</term>
<term><emphasis role="bold">A_DROP</emphasis> and<emphasis
role="bold"> A_DROP!</emphasis></term>
<listitem>
<para>Added in Shorewall 4.4.20. Audited versions of DROP and
@@ -295,7 +303,8 @@
</varlistentry>
<varlistentry>
<term>A_REJECT AND A_REJECT!</term>
<term><emphasis role="bold">A_REJECT</emphasis> AND <emphasis
role="bold">A_REJECT!</emphasis></term>
<listitem>
<para>Added in Shorewall 4.4.20. Audited versions of REJECT
@@ -422,7 +431,7 @@
</varlistentry>
<varlistentry>
<term>HELPER</term>
<term><emphasis role="bold">HELPER</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.7. This action requires that the
@@ -476,7 +485,8 @@
</varlistentry>
<varlistentry>
<term>IPTABLES({<replaceable>iptables-target</replaceable>
<term><emphasis
role="bold">IPTABLES</emphasis>({<replaceable>iptables-target</replaceable>
[<replaceable>option</replaceable> ...])</term>
<listitem>
@@ -559,24 +569,36 @@
<varlistentry>
<term><emphasis
role="bold">NFQUEUE</emphasis>[(<replaceable>queuenumber</replaceable>)]</term>
role="bold">NFQUEUE</emphasis>[([<replaceable>queuenumber</replaceable>1[:<replaceable>queuenumber2</replaceable>][,bypass]]|bypass)]</term>
<listitem>
<para>Queues the packet to a user-space application using the
nfnetlink_queue mechanism. If a
<replaceable>queuenumber</replaceable> is not specified, queue
zero (0) is assumed.</para>
<replaceable>queuenumber</replaceable>1 is not specified,
queue zero (0) is assumed. Beginning with Shorewall 4.6.10,
the keyword <emphasis role="bold">bypass</emphasis> can be
given. By default, if no userspace program is listening on an
NFQUEUE, then all packets that are to be queued are dropped.
When this option is used, the NFQUEUE rule is silently
bypassed instead. The packet will move on to the next rule.
Also beginning in Shorewall 4.6.10, a second queue number
(<replaceable>queuenumber2</replaceable>) may be specified.
This specifies a range of queues to use. Packets are then
balanced across the given queues. This is useful for multicore
systems: start multiple instances of the userspace program on
queues x, x+1, .. x+n and use "x:x+n". Packets belonging to
the same connection are put into the same nfqueue.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">NFQUEUE![(<replaceable>queuenumber</replaceable>)]</emphasis></term>
<term><emphasis role="bold"><emphasis
role="bold">NFQUEUE</emphasis>[([<replaceable>queuenumber1</replaceable>[,<replaceable>queuenumber2</replaceable>][,bypass]]|bypass)]</emphasis></term>
<listitem>
<para>like NFQUEUE but exempts the rule from being suppressed
by OPTIMIZE=1 in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para>
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5).</para>
</listitem>
</varlistentry>
@@ -653,8 +675,9 @@
</varlistentry>
<varlistentry>
<term>TARPIT [(<emphasis role="bold">tarpit</emphasis> |
<emphasis role="bold">honeypot</emphasis> | <emphasis
<term><emphasis role="bold">TARPIT</emphasis> [(<emphasis
role="bold">tarpit</emphasis> | <emphasis
role="bold">honeypot</emphasis> | <emphasis
role="bold">reset</emphasis>)]</term>
<listitem>

View File

@@ -70,7 +70,8 @@
<emphasis role="bold">openvpn</emphasis> - OpenVPN in point-to-point mode
<emphasis role="bold">openvpnclient</emphasis> - OpenVPN client runs on the firewall
<emphasis role="bold">openvpnserver</emphasis> - OpenVPN server runs on the firewall
<emphasis role="bold">generic</emphasis> - Other tunnel type</programlisting>
<emphasis role="bold">generic</emphasis> - Other tunnel type
<emphasis role="bold">tinc</emphasis> - TINC (added in Shorewall 4.6.6)</programlisting>
<para>If the type is <emphasis role="bold">ipsec</emphasis>, it may
be followed by <emphasis role="bold">:ah</emphasis> to indicate that
@@ -270,6 +271,19 @@
generic:udp:4444 net 4.3.99.124</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>Example 9:</term>
<listitem>
<para>TINC tunnel where the remote gateways are not specified. If
you wish to specify a list of gateways, you can do so in the GATEWAY
column.</para>
<programlisting> #TYPE ZONE GATEWAY GATEWAY ZONES
tinc net 0.0.0.0/0</programlisting>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@@ -112,7 +112,7 @@
role="bold">none</emphasis>}</term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -122,7 +122,7 @@
role="bold">none</emphasis>}</term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -132,7 +132,7 @@
role="bold">none</emphasis>}</term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -142,7 +142,7 @@
role="bold">none</emphasis>}</term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -384,6 +384,11 @@
<para>Set AUTOHELPERS=No.</para>
</listitem>
<listitem>
<para>Modify the HELPERS setting (see below) to list the helpers
that you need.</para>
</listitem>
<listitem>
<para>Either:</para>
@@ -902,9 +907,10 @@ net all DROP info</programlisting>then the chain name is 'net-all'
role="bold">HELPERS</emphasis>=[<emphasis>helper</emphasis>[,<replaceable>helper</replaceable>...]]</term>
<listitem>
<para>Added in Shorewall 4.5.7. This option lists the Netfilter
application helpers that are to be enabled. If not specified, the
default is to enable all helpers.</para>
<para>Added in Shorewall 4.5.7. This option specifies a
comma-separated list naming the Netfilter application helpers that
are to be enabled. If not specified, the default is to enable all
helpers.</para>
<para>Possible values for <replaceable>helper</replaceable>
are:</para>
@@ -1174,7 +1180,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
</varlistentry>
</variablelist>
<para></para>
<para/>
<blockquote>
<para>If this variable is not set or is given an empty value
@@ -1423,7 +1429,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
</listitem>
</itemizedlist>
<para></para>
<para/>
<blockquote>
<para>For example, using the default LOGFORMAT, the log prefix for
@@ -1440,7 +1446,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
control your firewall after you enable this option.</para>
</important>
<para></para>
<para/>
<caution>
<para>Do not use this option if the resulting log messages will
@@ -1501,8 +1507,8 @@ net all DROP info</programlisting>then the chain name is 'net-all'
role="bold">d</emphasis>}:]<emphasis>rate</emphasis><emphasis
role="bold">/</emphasis>{<emphasis
role="bold">sec</emphasis>|<emphasis
role="bold">min</emphasis>|<emphasis
role="bold">hour</emphasis>|<emphasis
role="bold">second|min</emphasis>|<emphasis
role="bold">minute|hour</emphasis>|<emphasis
role="bold">day</emphasis>}[:<emphasis>burst</emphasis>]]</term>
<listitem>
@@ -1516,6 +1522,10 @@ net all DROP info</programlisting>then the chain name is 'net-all'
<para>If <replaceable>burst</replaceable> is not specified, then a
value of 5 is assumed.</para>
<para>The keywords <emphasis role="bold">second</emphasis> and
<emphasis role="bold">minute</emphasis> are accepted beginning with
Shorewall 4.6.13.</para>
</listitem>
</varlistentry>
@@ -1784,8 +1794,8 @@ LOG:info:,bar net fw</programlisting>
<listitem>
<para>The value of this option determines the possible file
extensions of kernel modules. The default value is "ko ko.gz ko.xz o o.gz
o.xz gz xz".</para>
extensions of kernel modules. The default value is "ko ko.gz ko.xz o
o.gz o.xz gz xz".</para>
</listitem>
</varlistentry>
@@ -2162,7 +2172,7 @@ LOG:info:,bar net fw</programlisting>
role="bold">"</emphasis></term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -2967,8 +2977,8 @@ INLINE - - - ; -j REJECT
</varlistentry>
<varlistentry>
<term><emphasis role="bold">WIDE_TC_MARKS=</emphasis>{<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
<term><emphasis role="bold">WIDE_TC_MARKS=</emphasis>[<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
<listitem>
<para>Deprecated in Shorewall 4.4.26 in favor of TC_BITS and
@@ -2982,6 +2992,27 @@ INLINE - - - ; -j REJECT
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">WORKAROUNDS=</emphasis>[<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
<listitem>
<para>Added in Shorewall 4.6.11. Over time, there have been a number
of changes in Shorewall that work around defects in other products
such as iptables and ipset. When WORKAROUNDS=Yes, these workarounds
are enabled; when WORKAROUNDS=No, they are disabled. If not
specified or if specified as empty, WORKAROUNDS=Yes is
assumed.</para>
<warning>
<para>Do not set WORKAROUNDS=Yes if you need to be able to use
Shorewall-generated scripts (such as created by the
<command>save</command> command) built by Shorewall 4.4.7 or
older.</para>
</warning>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">ZONE_BITS</emphasis>=[<replaceable>number</replaceable>]</term>
@@ -2996,7 +3027,7 @@ INLINE - - - ; -j REJECT
<varlistentry>
<term><emphasis
role="bold">ZONE2ZONE</emphasis>={<option>2</option>|<option>-</option>}</term>
role="bold">ZONE2ZONE</emphasis>=[<option>2</option>|<option>-</option>]</term>
<listitem>
<para>Added in Shorewall 4.4.4. This option determines how Shorewall

View File

@@ -49,6 +49,21 @@
<arg choice="plain"><replaceable>address</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</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>call</option></arg>
<arg
choice="plain"><replaceable>function</replaceable><arg><replaceable>parameter</replaceable>
...</arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</command>
@@ -85,6 +100,21 @@
choice="plain"><option>clear</option><arg><option>-f</option></arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</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>close</option><arg choice="req">
<replaceable>open-number</replaceable> |
<replaceable>source</replaceable><replaceable>dest</replaceable><arg><replaceable>protocol</replaceable><arg>
<replaceable>port</replaceable> </arg></arg></arg><replaceable>
</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</command>
@@ -359,6 +389,31 @@
expression</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</command>
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>open</option><replaceable>
source</replaceable><replaceable> dest</replaceable><arg>
<replaceable>protocol</replaceable><arg> <replaceable>port</replaceable>
</arg> </arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</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>reenable</option></arg>
<arg choice="plain">{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</command>
@@ -528,6 +583,17 @@
<arg choice="opt"><replaceable>filename</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</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>savesets</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall</command>
@@ -560,7 +626,7 @@
<arg><option>-t</option>
{<option>filter</option>|<option>mangle</option>|<option>nat</option>|<option>raw|rawpost</option>}</arg>
<arg><arg><option>chain</option></arg><arg choice="plain"
<arg><arg choice="plain"
rep="repeat"><replaceable>chain</replaceable></arg></arg>
</cmdsynopsis>
@@ -600,8 +666,6 @@
<arg choice="req"><option>show | list | ls </option></arg>
<arg>-c</arg>
<arg choice="plain"><option>event</option><arg
choice="plain"><replaceable>event</replaceable></arg></arg>
</cmdsynopsis>
@@ -761,6 +825,10 @@
<arg><option>-t</option></arg>
<arg><option>-r</option></arg>
<arg><option>-n</option></arg>
<arg><option>-A</option></arg>
<arg><replaceable>directory</replaceable></arg>
@@ -822,7 +890,10 @@
<variablelist>
<varlistentry>
<term><emphasis role="bold">add</emphasis></term>
<term><emphasis role="bold">add </emphasis>{
<replaceable>interface</replaceable>[:<replaceable>host-list</replaceable>]...
<replaceable>zone</replaceable> | <replaceable>zone</replaceable>
<replaceable>host-list</replaceable> }</term>
<listitem>
<para>Adds a list of hosts or subnets to a dynamic zone usually used
@@ -854,7 +925,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">allow</emphasis></term>
<term><emphasis role="bold">allow</emphasis>
<replaceable>address</replaceable></term>
<listitem>
<para>Re-enables receipt of packets from hosts previously
@@ -866,7 +938,28 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">check</emphasis></term>
<term><emphasis role="bold">call <replaceable>function</replaceable> [
<replaceable>parameter</replaceable> ... ]</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.10. Allows you to call a function in
one of the Shorewall libraries or in your compiled script. function
must name the shell function to be called. The listed parameters are
passed to the function.</para>
<para>The function is first searched for in
<filename>lib.base</filename>, <filename>lib.common</filename>,
<filename>lib.cli</filename> and <filename>lib.cli-std</filename>.
If it is not found, the call command is passed to the generated
script to be executed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">check</emphasis> [-<option>e</option>]
[-<option>d</option>] [-<option>p</option>] [-<option>r</option>]
[-<option>T</option>] [-<option>i</option>]
[<replaceable>directory</replaceable>]</term>
<listitem>
<para>Compiles the configuration in the specified
@@ -896,7 +989,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -905,7 +998,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">clear</emphasis></term>
<term><emphasis role="bold">clear</emphasis>
[-<option>f</option>]</term>
<listitem>
<para>Clear will remove all rules and chains installed by Shorewall.
@@ -922,7 +1016,31 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">compile</emphasis></term>
<term><emphasis role="bold">close</emphasis> {
<replaceable>open-number</replaceable> |
<replaceable>source</replaceable> <replaceable>dest</replaceable> [
<replaceable>protocol</replaceable> [ <replaceable>port</replaceable>
] ] }</term>
<listitem>
<para>Added in Shorewall 4.5.8. This command closes a temporary open
created by the <command>open</command> command. In the first form,
an <replaceable>open-number</replaceable> specifies the open to be
closed. Open numbers are displayed in the <emphasis
role="bold">num</emphasis> column of the output of the
<command>shorewall show opens </command>command.</para>
<para>When the second form of the command is used, the parameters
must match those given in the earlier <command>open</command>
command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">compile </emphasis>[-<option>e</option>]
[-<option>c</option>] [-<option>d</option>] [-<option>p</option>]
[-<option>T</option>] [-<option>i</option>] [<replaceable> directory
</replaceable>] [<replaceable> pathname</replaceable> ]</term>
<listitem>
<para>Compiles the current configuration into the executable file
@@ -970,7 +1088,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -979,7 +1097,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">delete</emphasis></term>
<term><emphasis role="bold">delete </emphasis>{
<replaceable>interface</replaceable>[:<replaceable>host-list</replaceable>]...
<replaceable>zone</replaceable> | <replaceable>zone</replaceable>
<replaceable>host-list</replaceable> }</term>
<listitem>
<para>The delete command reverses the effect of an earlier <emphasis
@@ -1003,7 +1124,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">disable</emphasis></term>
<term><emphasis role="bold">disable </emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.26. Disables the optional provider
@@ -1022,7 +1145,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">drop</emphasis></term>
<term><emphasis role="bold">drop</emphasis>
<replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -1031,7 +1155,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">dump</emphasis></term>
<term><emphasis role="bold">dump </emphasis> [-<option>x</option>]
[-<option>l</option>] [-<option>m</option>]
[-<option>c</option>]</term>
<listitem>
<para>Produces a verbose report about the firewall configuration for
@@ -1053,7 +1179,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">enable</emphasis></term>
<term><emphasis role="bold">enable </emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.26. Enables the optional provider
@@ -1074,7 +1202,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">export</emphasis></term>
<term><emphasis role="bold">export </emphasis>[<replaceable>
directory1</replaceable> ] [<replaceable>
user</replaceable>@]<replaceable>system</replaceable>[:<replaceable>directory2</replaceable>
]</term>
<listitem>
<para>If <emphasis>directory1</emphasis> is omitted, the current
@@ -1098,7 +1229,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">forget</emphasis></term>
<term><emphasis role="bold">forget</emphasis> [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>Deletes /var/lib/shorewall/<emphasis>filename</emphasis> and
@@ -1118,7 +1250,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">hits</emphasis></term>
<term><emphasis role="bold">hits</emphasis>
[-<option>t</option>]</term>
<listitem>
<para>Generates several reports from Shorewall log messages in the
@@ -1128,7 +1261,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ipcalc</emphasis></term>
<term><emphasis role="bold">ipcalc</emphasis> { address mask |
address/vlsm }</term>
<listitem>
<para>Ipcalc displays the network address, broadcast address,
@@ -1138,7 +1272,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">iprange</emphasis></term>
<term><emphasis role="bold">iprange
</emphasis><replaceable>address1</replaceable>-<replaceable>address2</replaceable></term>
<listitem>
<para>Iprange decomposes the specified range of IP addresses into
@@ -1147,7 +1282,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">iptrace</emphasis></term>
<term><emphasis role="bold">iptrace</emphasis> <replaceable>iptables
match expression</replaceable></term>
<listitem>
<para>This is a low-level debugging command that causes iptables
@@ -1165,7 +1301,20 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">load</emphasis></term>
<term><emphasis role="bold">list</emphasis></term>
<listitem>
<para><command>list</command> is a synonym for
<command>show</command> -- please see below.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">load</emphasis> [-<option>s</option>]
[-<option>c</option>] [-<option>r</option>
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
[-<option>i</option>] [ <replaceable>directory</replaceable> ]
<replaceable>system</replaceable></term>
<listitem>
<para>If <emphasis>directory</emphasis> is omitted, the current
@@ -1211,7 +1360,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1220,7 +1369,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logdrop</emphasis></term>
<term><emphasis role="bold">logdrop</emphasis>
<replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -1232,7 +1382,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logwatch</emphasis></term>
<term><emphasis role="bold">logwatch </emphasis>[-<option>m</option>]
[<replaceable> refresh-interval </replaceable>]</term>
<listitem>
<para>Monitors the log file specified by the LOGFILE option in
@@ -1250,7 +1401,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logreject</emphasis></term>
<term><emphasis role="bold">logreject</emphasis><replaceable>
address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -1262,7 +1414,17 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noiptrace</emphasis></term>
<term><emphasis role="bold">ls</emphasis></term>
<listitem>
<para><command>ls</command> is a synonym for <command>show</command>
-- please see below.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noiptrace </emphasis><replaceable>iptables
match expression</replaceable></term>
<listitem>
<para>This is a low-level debugging command that cancels a trace
@@ -1275,7 +1437,63 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">refresh</emphasis></term>
<term><emphasis role="bold">open</emphasis>
<replaceable>source</replaceable> <replaceable>dest</replaceable> [
<replaceable>protocol</replaceable> [ <replaceable>port</replaceable>
] ]</term>
<listitem>
<para>Added in Shorewall 4.6.8. This command requires that the
firewall be in the started state and that DYNAMIC_BLACKLIST=Yes in
<ulink url="/manpages/shorewall.conf.html">shorewall.conf
(5)</ulink>. The effect of the command is to temporarily open the
firewall for connections matching the parameters.</para>
<para>The <replaceable>source</replaceable> and
<replaceable>dest</replaceable> parameters may each be specified as
<emphasis role="bold">all</emphasis> if you don't wish to restrict
the connection source or destination respectively. Otherwise, each
must contain a host or network address or a valid DNS name.</para>
<para>The <replaceable>protocol</replaceable> may be specified
either as a number or as a name listed in /etc/protocols. The
<replaceable>port</replaceable> may be specified numerically or as a
name listed in /etc/services.</para>
<para>To reverse the effect of a successful <command>open</command>
command, use the <command>close</command> command with the same
parameters or simply restart the firewall.</para>
<para>Example: To open the firewall for SSH connections to address
192.168.1.1, the command would be:</para>
<programlisting> shorewall open all 192.168.1.1 tcp 22</programlisting>
<para>To reverse that command, use:</para>
<programlisting> shorewall close all 192.168.1.1 tcp 22</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reenable</emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.6.9. This is equivalent to a
<command>disable</command> command followed by an
<command>enable</command> command on the specified
<replaceable>interface</replaceable> or
<replaceable>provider</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">refresh </emphasis> [-<option>n</option>]
[-<option>d</option>] [-<option>T</option>] [-i] [-<option>D
</option><replaceable>directory</replaceable> ] [
<replaceable>chain</replaceable>... ]</term>
<listitem>
<para>All steps performed by <command>restart</command> are
@@ -1304,7 +1522,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1327,7 +1545,21 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reload</emphasis></term>
<term><emphasis role="bold">reject</emphasis><replaceable>
address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
to be silently rejected.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reload </emphasis>[-<option>s</option>]
[-<option>c</option>] [-<option>r</option>
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
[-<option>i</option>] [ <replaceable>directory</replaceable> ]
<replaceable>system</replaceable></term>
<listitem>
<para>If <emphasis>directory</emphasis> is omitted, the current
@@ -1373,7 +1605,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1382,16 +1614,22 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reset</emphasis></term>
<term><emphasis role="bold">reset [<replaceable>chain</replaceable>,
...]</emphasis><acronym/></term>
<listitem>
<para>All the packet and byte counters in the firewall are
reset.</para>
<para>Resets the packet and byte counters in the specified
<replaceable>chain</replaceable>(s). If no
<replaceable>chain</replaceable> is specified, all the packet and
byte counters in the firewall are reset.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restart</emphasis></term>
<term><emphasis role="bold">restart </emphasis>[-<option>n</option>]
[-<option>p</option>] [-<option>d</option>] [-<option>f</option>]
[-<option>c</option>] [-<option>T</option>] [-<option>i</option>]
[-<option>C</option>] [ <replaceable>directory</replaceable> ]</term>
<listitem>
<para>Restart is similar to <emphasis role="bold">shorewall
@@ -1428,7 +1666,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1445,7 +1683,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restore</emphasis></term>
<term><emphasis role="bold">restore </emphasis> [-<option>n</option>]
[-<option>p</option>] [-<option>C</option>] [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>Restore Shorewall to a state saved using the <emphasis
@@ -1481,7 +1721,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">run</emphasis></term>
<term><emphasis role="bold">run
</emphasis><replaceable>command</replaceable> [
<replaceable>parameter</replaceable> ... ]</term>
<listitem>
<para>Added in Shorewall 4.6.3. Executes
@@ -1507,7 +1749,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">safe-restart</emphasis></term>
<term><emphasis role="bold">safe-restart
</emphasis>[-<option>d</option>] [-<option>p</option>] [-<option>t
</option><replaceable>timeout</replaceable> ] [
<replaceable>directory</replaceable> ]</term>
<listitem>
<para>Only allowed if Shorewall is running. The current
@@ -1532,7 +1777,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">safe-start</emphasis></term>
<term><emphasis role="bold">safe-start</emphasis><emphasis
role="bold"> </emphasis>[-<option>d</option>] [-<option>p</option>]
[-<option>t</option><replaceable>timeout</replaceable> ] [
<replaceable>directory</replaceable> ]</term>
<listitem>
<para>Shorewall is started normally. You will then be prompted
@@ -1554,7 +1802,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">save</emphasis></term>
<term><emphasis role="bold">save </emphasis> [-<option>C</option>] [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>The dynamic blacklist is stored in /var/lib/shorewall/save.
@@ -1572,6 +1821,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">savesets</emphasis></term>
<listitem>
<para>Added in shorewall 4.6.8. Performs the same action as the
<command>stop</command> command with respect to saving ipsets (see
the SAVE_IPSETS option in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf</ulink> (5)).
This command may be used to proactively save your ipset contents in
the event that a system failure occurs prior to issuing a
<command>stop</command> command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">show</emphasis></term>
@@ -1590,7 +1853,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">bl|blacklists</emphasis></term>
<term><emphasis role="bold">bl|blacklists</emphasis>
[-<option>x</option>]</term>
<listitem>
<para>Added in Shorewall 4.6.2. Displays the dynamic chain
@@ -1603,7 +1867,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">capabilities</emphasis></term>
<term>[-<option>f</option>] <emphasis
role="bold">capabilities</emphasis></term>
<listitem>
<para>Displays your kernel/iptables capabilities. The
@@ -1614,8 +1879,10 @@
</varlistentry>
<varlistentry>
<term>[ [ <option>chain</option> ] <emphasis>chain</emphasis>...
]</term>
<term>[-<option>b</option>] [-<option>x</option>]
[-<option>l</option>] [-<option>t</option>
{<option>filter</option>|<option>mangle</option>|<option>nat</option>|<option>raw</option>|<option>rawpost</option>}]
[ <emphasis>chain</emphasis>... ]</term>
<listitem>
<para>The rules in each <emphasis>chain</emphasis> are
@@ -1668,11 +1935,19 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">connections</emphasis></term>
<term><emphasis role="bold">connections
[<replaceable>filter_parameter</replaceable>
...]</emphasis></term>
<listitem>
<para>Displays the IP connections currently being tracked by
the firewall.</para>
<para>If the <command>conntrack</command> utility is
installed, beginning with Shorewall 4.6.11 the set of
connections displayed can be limited by including conntrack
filter parameters (-p , -s, --dport, etc). See conntrack(8)
for details.</para>
</listitem>
</varlistentry>
@@ -1714,7 +1989,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">log</emphasis></term>
<term>[-<option>m</option>] <emphasis
role="bold">log</emphasis></term>
<listitem>
<para>Displays the last 20 Shorewall messages from the log
@@ -1736,7 +2012,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">macro</emphasis></term>
<term><emphasis role="bold">macro
</emphasis><replaceable>macro</replaceable></term>
<listitem>
<para>Added in Shorewall 4.4.6. Displays the file that
@@ -1746,6 +2023,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term>[-<option>x</option>] <emphasis
role="bold">mangle</emphasis></term>
<listitem>
<para>Displays the Netfilter mangle table using the command
<emphasis role="bold">iptables -t mangle -L -n -v</emphasis>.
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">marks</emphasis></term>
@@ -1757,7 +2048,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">nat</emphasis></term>
<term>[-<option>x</option>] <emphasis
role="bold">nat</emphasis></term>
<listitem>
<para>Displays the Netfilter nat table using the command
@@ -1769,6 +2061,16 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">opens</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.8. Displays the iptables rules in
the 'dynamic' chain created through use of the <command>open
</command>command..</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">policies</emphasis></term>
@@ -1782,7 +2084,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">routing</emphasis></term>
<term>[-<option>c</option>]<emphasis role="bold">
routing</emphasis></term>
<listitem>
<para>Displays the system's IPv4 routing configuration.
@@ -1792,7 +2095,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">raw</emphasis></term>
<term>[-<option>x</option>] <emphasis
role="bold">raw</emphasis></term>
<listitem>
<para>Displays the Netfilter raw table using the command
@@ -1826,7 +2130,11 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">start</emphasis></term>
<term><emphasis role="bold">start </emphasis><emphasis role="bold">
</emphasis>[-<option>n</option>] [-<option>p</option>]
[-<option>d</option>] [-<option>f</option>] [-<option>c</option>]
[-<option>T</option>] [-<option>i</option>] [-<option>C</option>] [
<replaceable>directory</replaceable> ]</term>
<listitem>
<para>Start shorewall. Existing connections through shorewall
@@ -1870,7 +2178,7 @@
compiler-generated error and warning message.</para>
<para>The -i option was added in Shorewall 4.6.0 and causes a
warning message to be issued if the line current line contains
warning message to be issued if the current line contains
alternative input specifications following a semicolon (";"). Such
lines will be handled incorrectly if INLINE_MATCHES is set to Yes in
<ulink
@@ -1886,7 +2194,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">stop</emphasis></term>
<term><emphasis role="bold">stop</emphasis>
[-<option>f</option>]</term>
<listitem>
<para>Stops the firewall. All existing connections, except those
@@ -1908,7 +2217,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">status</emphasis></term>
<term><emphasis role="bold">status</emphasis>
[-<option>i</option>]</term>
<listitem>
<para>Produces a short report about the state of the
@@ -1921,7 +2231,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">try</emphasis></term>
<term><emphasis role="bold">try</emphasis>
<replaceable>directory</replaceable> [
<replaceable>timeout</replaceable> ]</term>
<listitem>
<para>If Shorewall is started then the firewall state is saved to a
@@ -1956,7 +2268,11 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">update</emphasis></term>
<term><emphasis role="bold">update </emphasis> [-<option>b</option>]
[-<option>d</option>] [-<option>r</option>] [-<option>T</option>]
[-<option>a</option>] [-<option>D</option>] [-<option>i</option>]
[-<option>t</option>] [-r] [-n][-<option>A</option>] [
<replaceable>directory</replaceable> ]</term>
<listitem>
<para>Added in Shorewall 4.4.21 and causes the compiler to update
@@ -1992,19 +2308,21 @@
updated, the original is saved in a .bak file in the same
directory.</para>
<para>The -i option was added in Shorewall 4.6.0 and causes a
warning message to be issued if the line current line contains
alternative input specifications following a semicolon (";"). Such
lines will be handled incorrectly if INLINE_MATCHES is set to Yes in
<ulink
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para>
<para>The <option>-t</option> option was added in Shorewall 4.6.0.
When specified, <option>-t</option> causes <ulink
url="shorewall-tcrules.html">shorewall-tcrules(5)</ulink> to be
converted to <ulink
When specified, <option>-t</option> causes the <emphasis
role="bold">tcrules</emphasis> file to be converted to <ulink
url="shorewall-mangle.html">shorewall-mangle(5)</ulink>. The old
file is renamed with a .bak suffix.</para>
file is renamed with a .bak suffix. Beginning with Shorewall
4.6.12.2, this option also causes the <emphasis
role="bold">tos</emphasis> file to be converted to <ulink
url="shorewall-mangle.html">shorewall-mangle(5)</ulink>.</para>
<important>
<para>There are some notable restrictions with the
@@ -2038,9 +2356,24 @@
</orderedlist>
</important>
<para>The <option>-r</option> option was added in Shorewall 4.6.12.
When specified, <option>-r</option> causes <ulink
url="manpages/shorewall-routestopped.html">shorewall-routestopped(5)</ulink>
to be converted to <ulink
url="manpages/shorewall-stoppedrules.html">shorewall-stoppedrules(5)</ulink>.
The old file is renamed with a .bak suffix.</para>
<para>The <option>-n</option> option was added in Shorewall 4.6.12.
When specified, <option>-n</option> causes <ulink
url="manpages/shorewall-routestopped.html">shorewall-notrack(5)</ulink>
to be converted to <ulink
url="manpages/shorewall-conntrack.html">shorewall-conntrack(5)</ulink>.
The old file is renamed with a .bak suffix.</para>
<para>The <option>-A</option> option was added in Shorewall 4.6.0
and is equivalent to specifying the <option>-b</option>,
<option>-D</option> and the <option>-t</option> options.</para>
<option>-D</option>, <option>-t,</option> <option>-r</option> and
the <option>-n</option> options.</para>
<para>For a description of the other options, see the <emphasis
role="bold">check</emphasis> command above.</para>
@@ -2048,7 +2381,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">version</emphasis></term>
<term><emphasis role="bold">version</emphasis>
[-<option>a</option>]</term>
<listitem>
<para>Displays Shorewall's version. The <option>-a</option> option

View File

@@ -5,6 +5,7 @@
#
[Unit]
Description=Shorewall IPv4 firewall
Wants=network-online.target
After=network-online.target
Conflicts=iptables.service firewalld.service

View File

@@ -5,6 +5,7 @@
#
[Unit]
Description=Shorewall IPv4 firewall
Wants=network-online.target
After=network-online.target
Conflicts=iptables.service firewalld.service

View File

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

View File

@@ -40,6 +40,12 @@ usage() # $1 = exit status
exit $1
}
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
@@ -197,7 +203,7 @@ fi
rm -rf ${VARDIR}/shorewall
rm -rf ${PERLLIBDIR}/Shorewall/*
rm -rf ${LIBEXECDIR}/shorewall
[ ${LIBEXECDIR} = ${SHAREDIR} ] || rm -rf ${LIBEXECDIR}/shorewall
rm -rf ${SHAREDIR}/shorewall/configfiles/
rm -rf ${SHAREDIR}/shorewall/Samples/
rm -rf ${SHAREDIR}/shorewall/Shorewall/

View File

@@ -47,6 +47,21 @@
<arg choice="plain"><replaceable>address</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-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>call</option></arg>
<arg
choice="plain"><replaceable>function</replaceable><arg><replaceable>parameter</replaceable>
...</arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-lite</command>
@@ -59,6 +74,35 @@
choice="plain"><option>clear</option><arg><option>-f</option></arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-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>close</option><arg choice="req">
<replaceable>open-number</replaceable> |
<replaceable>source</replaceable><replaceable>dest</replaceable><arg><replaceable>protocol</replaceable><arg>
<replaceable>port</replaceable> </arg></arg></arg><replaceable>
</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-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>close</option><replaceable>
source</replaceable><replaceable> dest</replaceable><arg>
<replaceable>protocol</replaceable><arg> <replaceable>port</replaceable>
</arg> </arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-lite</command>
@@ -168,37 +212,6 @@
choice="plain"><option>hits</option><arg><option>-t</option></arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-lite</command>
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>ipcalc</option></arg>
<group choice="req">
<arg choice="plain"><replaceable>address</replaceable>
<replaceable>mask</replaceable></arg>
<arg
choice="plain"><replaceable>address</replaceable>/<replaceable>vlsm</replaceable></arg>
</group>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-lite</command>
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>iprange</option></arg>
<arg
choice="plain"><replaceable>address1</replaceable><option>-</option><replaceable>address2</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-lite</command>
@@ -265,6 +278,34 @@
expression</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-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>open</option><replaceable>
source</replaceable><replaceable> dest</replaceable><arg>
<replaceable>protocol</replaceable><arg> <replaceable>port</replaceable>
</arg> </arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-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>reenable</option></arg>
<arg choice="plain">{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-lite</command>
@@ -304,8 +345,6 @@
<arg><option>-p</option></arg>
<arg><option>-C</option></arg>
<arg><replaceable>directory</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -353,6 +392,17 @@
<arg choice="opt"><replaceable>filename</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-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>savesets</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-lite</command>
@@ -581,7 +631,10 @@
<variablelist>
<varlistentry>
<term><emphasis role="bold">add</emphasis></term>
<term><emphasis role="bold">add </emphasis>{
<replaceable>interface</replaceable>[:<replaceable>host-list</replaceable>]...
<replaceable>zone</replaceable> | <replaceable>zone</replaceable>
<replaceable>host-list</replaceable> }</term>
<listitem>
<para>Adds a list of hosts or subnets to a dynamic zone usually used
@@ -606,7 +659,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">allow</emphasis></term>
<term><emphasis role="bold">allow
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Re-enables receipt of packets from hosts previously
@@ -617,7 +671,25 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">clear</emphasis></term>
<term><emphasis role="bold">call <replaceable>function</replaceable> [
<replaceable>parameter</replaceable> ... ]</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.10. Allows you to call a function in
one of the Shorewall libraries or in your compiled script. function
must name the shell function to be called. The listed parameters are
passed to the function.</para>
<para>The function is first searched for in
<filename>lib.base</filename>, <filename>lib.common</filename> and
<filename>lib.cli</filename>. If it is not found, the call command
is passed to the generated script to be executed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">clear </emphasis><emphasis role="bold">
</emphasis>[-<option>f</option>]</term>
<listitem>
<para>Clear will remove all rules and chains installed by
@@ -633,7 +705,31 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">delete</emphasis></term>
<term><emphasis role="bold">close</emphasis> {
<replaceable>open-number</replaceable> |
<replaceable>source</replaceable> <replaceable>dest</replaceable> [
<replaceable>protocol</replaceable> [ <replaceable>port</replaceable>
] ] }</term>
<listitem>
<para>Added in Shorewall 4.5.8. This command closes a temporary open
created by the <command>open</command> command. In the first form,
an <replaceable>open-number</replaceable> specifies the open to be
closed. Open numbers are displayed in the <emphasis
role="bold">num</emphasis> column of the output of the
<command>shorewall6-lite show opens </command>command.</para>
<para>When the second form of the command is used, the parameters
must match those given in the earlier <command>open</command>
command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">delete </emphasis>{
<replaceable>interface</replaceable>[:<replaceable>host-list</replaceable>]...
<replaceable>zone</replaceable> | <replaceable>zone</replaceable>
<replaceable>host-list</replaceable> }</term>
<listitem>
<para>The delete command reverses the effect of an earlier
@@ -648,7 +744,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">disable</emphasis></term>
<term><emphasis role="bold">disable </emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.26. Disables the optional provider
@@ -660,7 +758,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">drop</emphasis></term>
<term><emphasis role="bold">drop
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed
@@ -669,7 +768,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">dump</emphasis></term>
<term><emphasis role="bold">dump </emphasis>[-<option>x</option>]
[-<option>l</option>] [-<option>m</option>]
[-<option>c</option>]</term>
<listitem>
<para>Produces a verbose report about the firewall configuration for
@@ -691,7 +792,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">enable</emphasis></term>
<term><emphasis role="bold">enable </emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.26. Enables the optional provider
@@ -703,7 +806,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">forget</emphasis></term>
<term><emphasis role="bold">forget </emphasis>[
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>Deletes
@@ -735,26 +839,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ipcalc</emphasis></term>
<listitem>
<para>Ipcalc displays the network address, broadcast address,
network in CIDR notation and netmask corresponding to the
input[s].</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">iprange</emphasis></term>
<listitem>
<para>Iprange decomposes the specified range of IP addresses into
the equivalent list of network/host addresses.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">iptrace</emphasis></term>
<term><emphasis role="bold">iptrace </emphasis><replaceable>ip6tables
match expression</replaceable></term>
<listitem>
<para>This is a low-level debugging command that causes iptables
@@ -773,7 +859,17 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logdrop</emphasis></term>
<term><emphasis role="bold">list</emphasis></term>
<listitem>
<para><command>list</command> is a synonym for
<command>show</command> -- please see below.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logdrop
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed
@@ -785,7 +881,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logwatch</emphasis></term>
<term><emphasis role="bold">logwatch </emphasis>[-<option>m</option>]
[<replaceable>refresh-interval</replaceable>]</term>
<listitem>
<para>Monitors the log file specified by the LOGFILE option in
@@ -807,7 +904,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logreject</emphasis></term>
<term><emphasis role="bold">logreject
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed
@@ -819,43 +917,113 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noiptrace</emphasis></term>
<term><emphasis role="bold">ls</emphasis></term>
<listitem>
<para><command>ls</command> is a synonym for <command>show</command>
-- please see below.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noiptrace
</emphasis><replaceable>ip6tables match
expression</replaceable></term>
<listitem>
<para>This is a low-level debugging command that cancels a trace
started by a preceding <command>iptrace</command> command.</para>
<para>The <replaceable>iptables match expression</replaceable> must
<para>The <replaceable>ip6tables match expression</replaceable> must
be one given in the <command>iptrace</command> command being
canceled.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reset</emphasis></term>
<term><emphasis role="bold">open</emphasis>
<replaceable>source</replaceable> <replaceable>dest</replaceable> [
<replaceable>protocol</replaceable> [ <replaceable>port</replaceable>
] ]</term>
<listitem>
<para>All the packet and byte counters in the firewall are
reset.</para>
<para>Added in Shorewall 4.6.8. This command requires that the
firewall be in the started state and that DYNAMIC_BLACKLIST=Yes in
<ulink url="/manpages6/shorewall6.conf.html">shorewall6.conf
(5)</ulink>. The effect of the command is to temporarily open the
firewall for connections matching the parameters.</para>
<para>The <replaceable>source</replaceable> and
<replaceable>dest</replaceable> parameters may each be specified as
<emphasis role="bold">all</emphasis> if you don't wish to restrict
the connection source or destination respectively. Otherwise, each
must contain a host or network address or a valid DNS name.</para>
<para>The <replaceable>protocol</replaceable> may be specified
either as a number or as a name listed in /etc/protocols. The
<replaceable>port</replaceable> may be specified numerically or as a
name listed in /etc/services.</para>
<para>To reverse the effect of a successful <command>open</command>
command, use the <command>close</command> command with the same
parameters or simply restart the firewall.</para>
<para>Example: To open the firewall for SSH connections to address
2001:470:b:227::1, the command would be:</para>
<programlisting> shorewall6-lite open all 2001:470:b:227::1 tcp 22</programlisting>
<para>To reverse that command, use:</para>
<programlisting> shorewall6-lite close all 2001:470:b:227::1 tcp 22</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restart</emphasis></term>
<term><emphasis role="bold">reenable</emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.6.9. This is equivalent to a
<command>disable</command> command followed by an
<command>enable</command> command on the specified
<replaceable>interface</replaceable> or
<replaceable>provider</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reject</emphasis><replaceable>
address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
to be silently rejected.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reset [<replaceable>chain</replaceable>,
...]</emphasis><acronym/></term>
<listitem>
<para>Resets the packet and byte counters in the specified
<replaceable>chain</replaceable>(s). If no
<replaceable>chain</replaceable> is specified, all the packet and
byte counters in the firewall are reset.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restart </emphasis>[-n] [-p]
[-<option>C</option>]</term>
<listitem>
<para>Restart is similar to <command>shorewall6-lite start</command>
except that it assumes that the firewall is already started.
Existing connections are maintained.</para>
<caution>
<para>If your ip6tables 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>-n</option> option causes shorewall6-lite to avoid
updating the routing table(s).</para>
@@ -872,7 +1040,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restore</emphasis></term>
<term><emphasis role="bold">restore </emphasis>[-<option>n</option>]
[-<option>p</option>] [-<option>C</option>] [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>Restore shorewall6-lite to a state saved using the
@@ -886,6 +1056,14 @@
in <ulink
url="shorewall.conf.html">shorewall6.conf</ulink>(5).</para>
<caution>
<para>If your ip6tables 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
<command>shorewall7-lite save</command>, then the counters saved by
@@ -894,7 +1072,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">run</emphasis></term>
<term><emphasis role="bold">run
</emphasis><replaceable>command</replaceable> [
<replaceable>parameter</replaceable> ... ]</term>
<listitem>
<para>Added in Shorewall 4.6.3. Executes
@@ -911,7 +1091,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">save</emphasis></term>
<term><emphasis role="bold">save </emphasis>[-<option>C</option>] [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>The dynamic blacklist is stored in
@@ -929,6 +1110,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">savesets</emphasis></term>
<listitem>
<para>Added in shorewall 4.6.8. Performs the same action as the
<command>stop</command> command with respect to saving ipsets (see
the SAVE_IPSETS option in <ulink
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink> (5)).
This command may be used to proactively save your ipset contents in
the event that a system failure occurs prior to issuing a
<command>stop</command> command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">show</emphasis></term>
@@ -938,7 +1133,8 @@
<variablelist>
<varlistentry>
<term><emphasis role="bold">bl|blacklists</emphasis></term>
<term>[-<option>x</option>] <emphasis
role="bold">bl|blacklists</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.2. Displays the dynamic chain
@@ -951,7 +1147,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">capabilities</emphasis></term>
<term>[-<option>f</option>] <emphasis
role="bold">capabilities</emphasis></term>
<listitem>
<para>Displays your kernel/iptables capabilities. The
@@ -962,8 +1159,10 @@
</varlistentry>
<varlistentry>
<term>[ [ <option>chain</option> ] <emphasis>chain</emphasis>...
]</term>
<term>[-<option>b</option>] [-<option>x</option>]
[-<option>l</option>] [-<option>t</option>
{<option>filter</option>|<option>mangle</option>|<option>nat</option>|<option>raw</option>|<option>rawpost</option>}][
<emphasis>chain</emphasis>... ]</term>
<listitem>
<para>The rules in each <emphasis>chain</emphasis> are
@@ -1017,11 +1216,19 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">connections</emphasis></term>
<term><emphasis role="bold">connections
[<replaceable>filter_parameter</replaceable>
...]</emphasis></term>
<listitem>
<para>Displays the IP connections currently being tracked by
the firewall.</para>
<para>If the <command>conntrack</command> utility is
installed, beginning with Shorewall 4.6.11 the set of
connections displayed can be limited by including conntrack
filter parameters (-p , -s, --dport, etc). See conntrack(8)
for details.</para>
</listitem>
</varlistentry>
@@ -1063,7 +1270,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">log</emphasis></term>
<term>[-<option>m</option>] <emphasis
role="bold">log</emphasis></term>
<listitem>
<para>Displays the last 20 shorewall6-lite messages from the
@@ -1076,6 +1284,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term>[-<option>x</option>] <emphasis
role="bold">mangle</emphasis></term>
<listitem>
<para>Displays the Netfilter mangle table using the command
<command>ip6tables -t mangle -L -n -v</command>.The
<option>-x</option> option is passed directly through to
ip6tables 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">marks</emphasis></term>
@@ -1087,11 +1309,22 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">nat</emphasis></term>
<term><emphasis role="bold">opens</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.8. Displays the iptables rules in
the 'dynamic' chain created through use of the <command>open
</command>command..</para>
</listitem>
</varlistentry>
<varlistentry>
<term>[-<option>x</option>] <emphasis
role="bold">nat</emphasis></term>
<listitem>
<para>Displays the Netfilter nat table using the command
<command>iptables -t nat -L -n -v</command>.The
<command>ip6tables -t nat -L -n -v</command>.The
<option>-x</option> option is passed directly through to
iptables and causes actual packet and byte counts to be
displayed. Without this option, those counts are
@@ -1112,17 +1345,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">routing</emphasis></term>
<listitem>
<para>Displays the system's IPv4 routing configuration. The -c
option causes the route cache to be displayed in addition to
the other routing information.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">raw</emphasis></term>
<term>[-<option>x</option>] <emphasis
role="bold">raw</emphasis></term>
<listitem>
<para>Displays the Netfilter raw table using the command
@@ -1134,6 +1358,17 @@
</listitem>
</varlistentry>
<varlistentry>
<term>[-<option>c</option>]<emphasis role="bold">
</emphasis><emphasis role="bold">routing</emphasis></term>
<listitem>
<para>Displays the system's IPv4 routing configuration. The -c
option causes the route cache to be displayed in addition to
the other routing information.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">tc</emphasis></term>
@@ -1156,7 +1391,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">start</emphasis></term>
<term><emphasis role="bold">start </emphasis>[-<option>p</option>]
[-<option>n</option>] [<option>-f</option>]
[-<option>C</option>]</term>
<listitem>
<para>Start Shorewall6 Lite. Existing connections through
@@ -1168,7 +1405,7 @@
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
<para>The <option>-n</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.
@@ -1187,7 +1424,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">stop</emphasis></term>
<term><emphasis role="bold">stop </emphasis><emphasis role="bold">
</emphasis>[-<option>f</option>]</term>
<listitem>
<para>Stops the firewall. All existing connections, except those
@@ -1221,7 +1459,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">version</emphasis></term>
<term><emphasis role="bold">version
</emphasis>[-<option>a</option>]</term>
<listitem>
<para>Displays Shorewall's version. The <option>-a</option> option

View File

@@ -5,6 +5,7 @@
#
[Unit]
Description=Shorewall IPv6 firewall (lite)
Wants=network-online.target
After=network-online.target
Conflicts=ip6tables.service firewalld.service

View File

@@ -5,6 +5,7 @@
#
[Unit]
Description=Shorewall IPv6 firewall (lite)
Wants=network-online.target
After=network-online.target
Conflicts=ip6tables.service firewalld.service

View File

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

View File

@@ -36,6 +36,12 @@ usage() # $1 = exit status
exit $1
}
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1

View File

@@ -209,6 +209,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=No
ZONE2ZONE=-
###############################################################################

View File

@@ -209,6 +209,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=No
ZONE2ZONE=-
###############################################################################

View File

@@ -209,6 +209,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=No
ZONE2ZONE=-
###############################################################################

View File

@@ -209,6 +209,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=No
ZONE2ZONE=-
###############################################################################

View File

@@ -0,0 +1,16 @@
#
# Shorewall version 4 - Findgw File
#
# /etc/shorewall6/findgw
#
# The code in this file is executed when Shorewall is trying to detect the
# gateway through an interface in /etc/shorewall6/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.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.
#
###############################################################################

View File

@@ -155,7 +155,7 @@ HELPERS=
IMPLICIT_CONTINUE=No
INLINE_MATCHES=Yes
INLINE_MATCHES=No
IPSET_WARNINGS=Yes
@@ -209,6 +209,8 @@ USE_RT_NAMES=No
WARNOLDCAPVERSION=Yes
WORKAROUNDS=Yes
ZONE2ZONE=-
###############################################################################

View File

@@ -90,7 +90,7 @@
role="bold">NOTRACK</emphasis>|<emphasis
role="bold">CT</emphasis>:<emphasis
role="bold">helper</emphasis>:<replaceable>name</replaceable>[(<replaceable>arg</replaceable>=<replaceable>val</replaceable>[,...])|<emphasis
role="bold">CT:notrack</emphasis>|DROP|LOG|NFLOG(<replaceable>nflog-parameters</replaceable>)|IP6TABLES(<replaceable>target</replaceable>)}[:<replaceable>log-level</replaceable>[:<replaceable>log-tag</replaceable>]][:<replaceable>chain-designator</replaceable>]</term>
role="bold">CT:ctevents:<replaceable>event</replaceable>[,...]|CT:expevents:new|notrack</emphasis>|DROP|LOG|NFLOG(<replaceable>nflog-parameters</replaceable>)|IP6TABLES(<replaceable>target</replaceable>)}[:<replaceable>log-level</replaceable>[:<replaceable>log-tag</replaceable>]][:<replaceable>chain-designator</replaceable>]</term>
<listitem>
<para>This column is only present when FORMAT &gt;= 2. Values other
@@ -238,12 +238,37 @@
<listitem>
<para><option>expevents</option><option>=new</option></para>
<para>Only generate a <emphasis role="bold">new</emphasis>
<para>Only generate <emphasis role="bold">new</emphasis>
expectation events for this connection.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>ctevents:<replaceable>event</replaceable>[,...]</para>
<para>Added in Shorewall 4.6.10. Only generate the specified
conntrack events for this connection. Possible event types are:
<emphasis role="bold">new</emphasis>, <emphasis
role="bold">related</emphasis>, <emphasis
role="bold">destroy</emphasis>, <emphasis
role="bold">reply</emphasis>, <emphasis
role="bold">assured</emphasis>, <emphasis
role="bold">protoinfo</emphasis>, <emphasis
role="bold">helper</emphasis>, <emphasis
role="bold">mark</emphasis> (this is connection mark, not packet
mark), <emphasis role="bold">natseqinfo</emphasis>, and
<emphasis role="bold">secmark</emphasis>.</para>
</listitem>
<listitem>
<para>expevents=new</para>
<para>Added in Shorewall 4.6.10. Only generate <emphasis
role="bold">new</emphasis> expectation events for this
connection.</para>
</listitem>
<listitem>
<para><option>DROP</option></para>

View File

@@ -65,9 +65,7 @@
<varlistentry>
<term><emphasis role="bold">HOST(S)</emphasis> (hosts)-
<emphasis>interface</emphasis>:<option>[</option>{[{<emphasis>address-or-range</emphasis>[<emphasis
role="bold">,</emphasis><emphasis>address-or-range</emphasis>]...|<emphasis
role="bold">+</emphasis><emphasis>ipset</emphasis>}[<emphasis>exclusion</emphasis>]<option>]</option></term>
<emphasis>interface</emphasis>:{<replaceable>address-or-range</replaceable>[,<replaceable>address-or-range</replaceable>]...|+<replaceable>ipset</replaceable>|<option>dynamic</option>}[<replaceable>exclusion</replaceable>]</term>
<listitem>
<para>The name of an interface defined in the <ulink
@@ -87,7 +85,7 @@
<listitem>
<para>An IP address range of the form
<emphasis>low.address</emphasis>-<emphasis>high.address</emphasis>.
[<emphasis>low.address</emphasis>]-[<emphasis>high.address</emphasis>].
Your kernel and ip6tables must have iprange match
support.</para>
</listitem>

View File

@@ -538,7 +538,7 @@ loc eth2 -</programlisting>
</varlistentry>
<varlistentry>
<term>unmanaged</term>
<term><emphasis role="bold">unmanaged</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.18. Causes all traffic between
@@ -628,7 +628,7 @@ dmz eth2 -</programlisting>
<programlisting>FORMAT 2
#ZONE INTERFACE OPTIONS
- br0 routeback</programlisting>
- br0 bridge</programlisting>
</listitem>
</varlistentry>
</variablelist>

View File

@@ -124,6 +124,28 @@
following.</para>
<variablelist>
<varlistentry>
<term><emphasis
role="bold">ADD(<replaceable>ipset</replaceable>:<replaceable>flags</replaceable>)</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.7. Causes addresses and/or port
numbers to be added to the named
<replaceable>ipset</replaceable>. The
<replaceable>flags</replaceable> specify the address or tuple
to be added to the set and must match the type of ipset
involved. For example, for an iphash ipset, either the SOURCE
or DESTINATION address can be added using
<replaceable>flags</replaceable> <emphasis
role="bold">src</emphasis> or <emphasis
role="bold">dst</emphasis> respectively (see the -A command in
ipset (8)).</para>
<para>ADD is non-terminating. Even if a packet matches the
rule, it is passed on to the next rule.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">CHECKSUM</emphasis></term>
@@ -215,6 +237,27 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">DEL(<replaceable>ipset</replaceable>:<replaceable>flags</replaceable>)</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.7. Causes an entry to be deleted
from the named <replaceable>ipset</replaceable>. The
<replaceable>flags</replaceable> specify the address or tuple
to be deleted from the set and must match the type of ipset
involved. For example, for an iphash ipset, either the SOURCE
or DESTINATION address can be deleted using
<replaceable>flags</replaceable> <emphasis
role="bold">src</emphasis> or <emphasis
role="bold">dst</emphasis> respectively (see the -D command in
ipset (8)).</para>
<para>DEL is non-terminating. Even if a packet matches the
rule, it is passed on to the next rule.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DIVERT</emphasis></term>
@@ -277,6 +320,28 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">HL</emphasis>([<emphasis
role="bold">-</emphasis>|<emphasis
role="bold">+</emphasis>]<replaceable>number</replaceable>)[:P]</term>
<listitem>
<para>If <emphasis role="bold">+</emphasis> is included,
packets matching the rule will have their hop limit
incremented by <replaceable>number</replaceable>. Similarly,
if <emphasis role="bold">-</emphasis> is included, matching
packets have their hop limit decremented by
<replaceable>number</replaceable>. If neither <emphasis
role="bold">+</emphasis> nor <emphasis
role="bold">-</emphasis> is given, the hop limit of matching
packets is set to <replaceable>number</replaceable>. The valid
range of values for <replaceable>number</replaceable> is
1-255. If :P is included, the rule is placed in the mangle
PREROUTING chain -- otherwise, it is placed in the FORWARD
chain.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">IMQ</emphasis>(<replaceable>number</replaceable>)</term>
@@ -304,23 +369,23 @@
specified at the end of the rule. If the target is not one
known to Shorewall, then it must be defined as a builtin
action in <ulink
url="/manpages6/shorewall6-actions.html">shorewall6-actions</ulink>
url="/manpages/shorewall-actions.html">shorewall-actions</ulink>
(5).</para>
<para>The following rules are equivalent:</para>
<programlisting>2:P eth0 - tcp 22
INLINE(2):P eth0 - tcp 22
INLINE(2):P eth0 - ; -p tcp
INLINE eth0 - tcp 22 ; -j MARK --set-mark 2
INLINE eth0 - ; -p tcp -j MARK --set-mark 2
<programlisting>2:P eth0 - tcp 22
INLINE(MARK(2)):P eth0 - tcp 22
INLINE(MARK(2)):P eth0 - ; -p tcp
INLINE eth0 - tcp 22 ; -j MARK --set-mark 2
INLINE eth0 - ; -p tcp -j MARK --set-mark 2
</programlisting>
<para>If INLINE_MATCHES=Yes in <ulink
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)
url="/manpages/shorewall.conf.html">shorewall6.conf(5)</ulink>
then the third rule above can be specified as follows:</para>
<programlisting>2:P eth0 - ; -p tcp</programlisting>
<programlisting>MARK(2):P eth0 - ; -p tcp</programlisting>
</listitem>
</varlistentry>
@@ -510,7 +575,8 @@ INLINE eth0 - ; -p tcp -j MARK --set-mark
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SAME</emphasis></term>
<term><emphasis
role="bold">SAME[(<replaceable>timeout</replaceable>)]</emphasis></term>
<listitem>
<para>Some websites run applications that require multiple
@@ -534,12 +600,16 @@ SAME:P 192.168.1.0/24 0.0.0.0/0 tcp 80,443</programlisting>
connections to an individual remote system to all use the same
provider. For example:<programlisting>#ACTION SOURCE DEST PROTO DEST
# PORT(S)
SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>
If the firewall attempts a connection on TCP port 80 or 443
and it has sent a packet on either of those ports in the last
five minutes to the same remote system then the new connection
will use the same provider as the connection over which that
last packet was sent.</para>
SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>The
optional <replaceable>timeout</replaceable> parameter was
added in Shorewall 4.6.7 and specifies a number of seconds .
When not specified, a value of 300 seconds (5 minutes) is
assumed. If the firewall attempts a connection on TCP port 80
or 443 and it has sent a packet on either of those ports in
the last <replaceable>timeout</replaceable> seconds to the
same remote system then the new connection will use the same
provider as the connection over which that last packet was
sent.</para>
</listitem>
</varlistentry>
@@ -617,53 +687,7 @@ Normal-Service =&gt; 0x00</programlisting>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">TTL</emphasis>([<emphasis
role="bold">-</emphasis>|<emphasis
role="bold">+</emphasis>]<replaceable>number</replaceable>)</term>
<listitem>
<para>If <emphasis role="bold">+</emphasis> is included,
packets matching the rule will have their TTL incremented by
<replaceable>number</replaceable>. Similarly, if <emphasis
role="bold">-</emphasis> is included, matching packets have
their TTL decremented by <replaceable>number</replaceable>. If
neither <emphasis role="bold">+</emphasis> nor <emphasis
role="bold">-</emphasis> is given, the TTL of matching packets
is set to <replaceable>number</replaceable>. The valid range
of values for <replaceable>number</replaceable> is
1-255.</para>
</listitem>
</varlistentry>
</variablelist>
<orderedlist numeration="arabic">
<listitem>
<para><emphasis role="bold">TTL</emphasis>([<emphasis
role="bold">-</emphasis>|<emphasis
role="bold">+</emphasis>]<replaceable>number</replaceable>)</para>
<para>Added in Shorewall 4.4.24.</para>
<para>Prior to Shorewall 4.5.7.2, may be optionally followed by
<emphasis role="bold">:F</emphasis> but the resulting rule is
always added to the FORWARD chain. Beginning with Shorewall
4.5.7.s, it may be optionally followed by <emphasis
role="bold">:P</emphasis>, in which case the rule is added to
the PREROUTING chain.</para>
<para>If <emphasis role="bold">+</emphasis> is included, packets
matching the rule will have their TTL incremented by
<replaceable>number</replaceable>. Similarly, if <emphasis
role="bold">-</emphasis> is included, matching packets have
their TTL decremented by <replaceable>number</replaceable>. If
neither <emphasis role="bold">+</emphasis> nor <emphasis
role="bold">-</emphasis> is given, the TTL of matching packets
is set to <replaceable>number</replaceable>. The valid range of
values for <replaceable>number</replaceable> is 1-255.</para>
</listitem>
</orderedlist>
</listitem>
</varlistentry>

View File

@@ -105,9 +105,9 @@
role="bold">REJECT</emphasis>|<emphasis
role="bold">CONTINUE</emphasis>|<emphasis
role="bold">QUEUE</emphasis>|<emphasis
role="bold">NFQUEUE</emphasis>[(<emphasis>queuenumber</emphasis>)]|<emphasis
role="bold">NFQUEUE</emphasis>[(<emphasis>queuenumber1</emphasis>[:<replaceable>queuenumber2</replaceable>])]|<emphasis
role="bold">NONE</emphasis>}[<emphasis
role="bold">:</emphasis>{<emphasis>default-action-or-macro</emphasis>|<emphasis
role="bold">:</emphasis>{<emphasis>default-action-or-macro</emphasis>[:level]|<emphasis
role="bold">None</emphasis>}]</term>
<listitem>
@@ -180,8 +180,14 @@
<listitem>
<para>Queue the request for a user-space application using the
nfnetlink_queue mechanism. If a
<replaceable>queuenumber</replaceable> is not given, queue
zero (0) is assumed.</para>
<replaceable>queuenumber1</replaceable> is not given, queue
zero (0) is assumed. Beginning with Shorewall 4.6.10, a second
queue number (queuenumber2) may be given. This specifies a
range of queues to use. Packets are then balanced across the
given queues. This is useful for multicore systems: start
multiple instances of the userspace program on queues x, x+1,
.. x+n and use "x:x+n". Packets belonging to the same
connection are put into the same nfqueue.</para>
</listitem>
</varlistentry>

View File

@@ -213,7 +213,22 @@
</varlistentry>
<varlistentry>
<term>noautosrc</term>
<term><emphasis
role="bold">load=<replaceable>probability</replaceable></emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.0. This option provides an
alternative method of load balancing based on probabilities.
Providers to be balanced are given a
<replaceable>probability</replaceable> (a number 0 &gt; n
&gt;= 1) with up to 8 digits to the right of the decimal
point. Beginning with Shorewall 4.6.10, a warning is issued if
the sum of the probabilities is not 1.00000000.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noautosrc</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.17. Prevents the addition of a

View File

@@ -48,6 +48,9 @@
&amp;<replaceable>interface</replaceable> in this column to indicate
that the source is the primary IP address of the named
interface.</para>
<para>Beginning with Shorewall 4.6.8, you may specify a
comma-separated list of addresses in this column.</para>
</listitem>
</varlistentry>
@@ -64,6 +67,9 @@
role="bold">DEST</emphasis>, place "-" in that column. Note that you
may not omit both <emphasis role="bold">SOURCE</emphasis> and
<emphasis role="bold">DEST</emphasis>.</para>
<para>Beginning with Shorewall 4.6.8, you may specify a
comma-separated list of addresses in this column.</para>
</listitem>
</varlistentry>

View File

@@ -122,8 +122,10 @@
<term><emphasis role="bold">NEW</emphasis></term>
<listitem>
<para>Packets in the NEW, INVALID and UNTRACKED states are processed
by rules in this section.</para>
<para>Packets in the NEW state are processed by rules in this
section. If the INVALID and/or UNTRACKED sections are empty or not
included, then the packets in the corresponding state(s) are also
processed in this section.</para>
</listitem>
</varlistentry>
</variablelist>
@@ -237,7 +239,8 @@
</varlistentry>
<varlistentry>
<term>AUDIT[(accept|drop|reject)]</term>
<term><emphasis
role="bold">AUDIT</emphasis>[(accept|drop|reject)]</term>
<listitem>
<para>Added in Shorewall 4.5.10. Audits the packet with the
@@ -248,7 +251,8 @@
</varlistentry>
<varlistentry>
<term>A_ACCEPT, and A_ACCEPT!</term>
<term><emphasis role="bold">A_ACCEPT</emphasis>, and <emphasis
role="bold">A_ACCEPT!</emphasis></term>
<listitem>
<para>Added in Shorewall 4.4.20. Audited versions of ACCEPT
@@ -258,7 +262,8 @@
</varlistentry>
<varlistentry>
<term>A_DROP and A_DROP!</term>
<term><emphasis role="bold">A_DROP</emphasis> and <emphasis
role="bold">A_DROP!</emphasis></term>
<listitem>
<para>Added in Shorewall 4.4.20. Audited versions of DROP and
@@ -268,7 +273,8 @@
</varlistentry>
<varlistentry>
<term>A_REJECT AND A_REJECT!</term>
<term><emphasis role="bold">A_REJECT</emphasis> AND<emphasis
role="bold"> A_REJECT!</emphasis></term>
<listitem>
<para>Added in Shorewall 4.4.20. Audited versions of REJECT
@@ -396,7 +402,7 @@
</varlistentry>
<varlistentry>
<term>HELPER</term>
<term><emphasis role="bold">HELPER</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.7. This action requires that the
@@ -450,7 +456,8 @@
</varlistentry>
<varlistentry>
<term>IP6TABLES({<replaceable>ip6tables-target</replaceable>
<term><emphasis
role="bold">IP6TABLES</emphasis>({<replaceable>ip6tables-target</replaceable>
[<replaceable>option</replaceable> ...])</term>
<listitem>
@@ -534,19 +541,31 @@
<varlistentry>
<term><emphasis
role="bold">NFQUEUE</emphasis>[(<replaceable>queuenumber</replaceable>)]</term>
role="bold">NFQUEUE</emphasis>[([<replaceable>queuenumber</replaceable>1[:<replaceable>queuenumber2</replaceable>][,bypass]]|bypass)]</term>
<listitem>
<para>Queues the packet to a user-space application using the
nfnetlink_queue mechanism. If a
<replaceable>queuenumber</replaceable> is not specified, queue
zero (0) is assumed.</para>
<replaceable>queuenumber</replaceable>1 is not specified,
queue zero (0) is assumed. Beginning with Shorewall 4.6.10,
the keyword <emphasis role="bold">bypass</emphasis> can be
given. By default, if no userspace program is listening on an
NFQUEUE, then all packets that are to be queued are dropped.
When this option is used, the NFQUEUE rule is silently
bypassed instead. The packet will move on to the next rule.
Also beginning in Shorewall 4.6.10, a second queue number
(<replaceable>queuenumber2</replaceable>) may be specified.
This specifies a range of queues to use. Packets are then
balanced across the given queues. This is useful for multicore
systems: start multiple instances of the userspace program on
queues x, x+1, .. x+n and use "x:x+n". Packets belonging to
the same connection are put into the same nfqueue.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">NFQUEUE![(<replaceable>queuenumber</replaceable>)]</emphasis></term>
<term><emphasis role="bold"><emphasis
role="bold">NFQUEUE</emphasis>[([<replaceable>queuenumber1</replaceable>[,<replaceable>queuenumber2</replaceable>][,bypass]]|bypass)]</emphasis></term>
<listitem>
<para>like NFQUEUE but exempts the rule from being suppressed
@@ -630,8 +649,9 @@
</varlistentry>
<varlistentry>
<term>TARPIT [(<emphasis role="bold">tarpit</emphasis> |
<emphasis role="bold">honeypot</emphasis> | <emphasis
<term><emphasis role="bold">TARPIT</emphasis> [(<emphasis
role="bold">tarpit</emphasis> | <emphasis
role="bold">honeypot</emphasis> | <emphasis
role="bold">reset</emphasis>)]</term>
<listitem>

View File

@@ -65,7 +65,8 @@
<emphasis role="bold">openvpn</emphasis> - OpenVPN in point-to-point mode
<emphasis role="bold">openvpnclient</emphasis> - OpenVPN client runs on the firewall
<emphasis role="bold">openvpnserver</emphasis> - OpenVPN server runs on the firewall
<emphasis role="bold">generic</emphasis> - Other tunnel type</programlisting>
<emphasis role="bold">generic</emphasis> - Other tunnel type
<emphasis role="bold">tinc</emphasis> - TINC (added in Shorewall 4.6.6)</programlisting>
<para>If the type is <emphasis role="bold">ipsec</emphasis>, it may
be followed by <emphasis role="bold">:ah</emphasis> to indicate that
@@ -229,6 +230,19 @@
generic:udp:4444 net 2001:cec792b4:1::44</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>Example 9:</term>
<listitem>
<para>TINC tunnel where the remote gateways are not specified. If
you wish to specify a list of gateways, you can do so in the GATEWAY
column.</para>
<programlisting> #TYPE ZONE GATEWAY GATEWAY ZONES
tinc net ::/0</programlisting>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@@ -98,7 +98,7 @@
role="bold">none</emphasis>}</term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -108,7 +108,7 @@
role="bold">none</emphasis>}</term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -118,7 +118,7 @@
role="bold">none</emphasis>}</term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -128,7 +128,7 @@
role="bold">none</emphasis>}</term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -313,6 +313,11 @@
<para>Set AUTOHELPERS=No.</para>
</listitem>
<listitem>
<para>Modify the HELPERS setting (see below) to list the helpers
that you need.</para>
</listitem>
<listitem>
<para>Either:</para>
@@ -787,9 +792,10 @@ net all DROP info</programlisting>then the chain name is 'net-all'
role="bold">HELPERS</emphasis>=[<emphasis>helper</emphasis>[,<replaceable>helper</replaceable>...]]</term>
<listitem>
<para>Added in Shorewall 4.5.7. This option lists the Netfilter
application helpers that are to be enabled. If not specified, the
default is to enable all helpers.</para>
<para>Added in Shorewall 4.5.7. This option specifies a
comma-separated list naming the Netfilter application helpers that
are to be enabled. If not specified, the default is to enable all
helpers.</para>
<para>Possible values for <replaceable>helper</replaceable>
are:</para>
@@ -1239,7 +1245,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
</listitem>
</itemizedlist>
<para></para>
<para/>
<blockquote>
<para>For example, using the default LOGFORMAT, the log prefix for
@@ -1256,7 +1262,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
control your firewall after you enable this option.</para>
</important>
<para></para>
<para/>
<caution>
<para>Do not use this option if the resulting log messages will
@@ -1316,8 +1322,8 @@ net all DROP info</programlisting>then the chain name is 'net-all'
role="bold">d</emphasis>}:]<emphasis>rate</emphasis><emphasis
role="bold">/</emphasis>{<emphasis
role="bold">sec</emphasis>|<emphasis
role="bold">min</emphasis>|<emphasis
role="bold">hour</emphasis>|<emphasis
role="bold">second|min</emphasis>|<emphasis
role="bold">minute|hour</emphasis>|<emphasis
role="bold">day</emphasis>}[:<emphasis>burst</emphasis>]]</term>
<listitem>
@@ -1331,6 +1337,10 @@ net all DROP info</programlisting>then the chain name is 'net-all'
<para>If <replaceable>burst</replaceable> is not specified, then a
value of 5 is assumed.</para>
<para>The keywords <emphasis role="bold">second</emphasis> and
<emphasis role="bold">minute</emphasis> are accepted beginning with
Shorewall 4.6.13.</para>
</listitem>
</varlistentry>
@@ -1588,8 +1598,8 @@ LOG:info:,bar net fw</programlisting>
<listitem>
<para>The value of this option determines the possible file
extensions of kernel modules. The default value is "ko ko.gz ko.xz o o.gz
o.xz gz xz".</para>
extensions of kernel modules. The default value is "ko ko.gz ko.xz o
o.gz o.xz gz xz".</para>
</listitem>
</varlistentry>
@@ -1903,7 +1913,7 @@ LOG:info:,bar net fw</programlisting>
role="bold">"</emphasis></term>
<listitem>
<para></para>
<para/>
</listitem>
</varlistentry>
@@ -1949,7 +1959,7 @@ LOG:info:,bar net fw</programlisting>
into.</member>
</simplelist></para>
<programlisting></programlisting>
<programlisting/>
</listitem>
</varlistentry>
@@ -2616,8 +2626,8 @@ INLINE - - - ; -j REJECT
</varlistentry>
<varlistentry>
<term><emphasis role="bold">WIDE_TC_MARKS=</emphasis>{<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
<term><emphasis role="bold">WIDE_TC_MARKS=</emphasis>[<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
<listitem>
<para>Deprecated in Shorewall 4.4.26 in favor of TC_BITS and
@@ -2631,6 +2641,27 @@ INLINE - - - ; -j REJECT
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">WORKAROUNDS=</emphasis>[<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
<listitem>
<para>Added in Shorewall 4.6.11. Over time, there have been a number
of changes in Shorewall that work around defects in other products
such as iptables and ipset. When WORKAROUNDS=Yes, these workarounds
are enabled; when WORKAROUNDS=No, they are disabled. If not
specified or if specified as empty, WORKAROUNDS=Yes is
assumed.</para>
<warning>
<para>Do not set WORKAROUNDS=Yes if you need to be able to use
Shorewall-generated scripts (such as created by the
<command>save</command> command) built by Shorewall 4.4.7 or
older.</para>
</warning>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">ZONE_BITS</emphasis>=[<replaceable>number</replaceable>]</term>

View File

@@ -48,6 +48,21 @@
<arg choice="plain"><replaceable>address</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6</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>call</option></arg>
<arg
choice="plain"><replaceable>function</replaceable><arg><replaceable>parameter</replaceable>
...</arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6</command>
@@ -83,6 +98,21 @@
<arg choice="plain"><option>clear</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6</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>close</option><arg choice="req">
<replaceable>open-number</replaceable> |
<replaceable>source</replaceable><replaceable>dest</replaceable><arg><replaceable>protocol</replaceable><arg>
<replaceable>port</replaceable> </arg></arg></arg><replaceable>
</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6</command>
@@ -318,8 +348,24 @@
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>open</option><replaceable>
source</replaceable><replaceable> dest</replaceable><arg>
<replaceable>protocol</replaceable><arg> <replaceable>port</replaceable>
</arg> </arg></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6</command>
<arg
choice="plain"><option>recover</option><arg><option>-n</option></arg><arg><option>-p</option></arg></arg>
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>reenable</option></arg>
<arg choice="plain">{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -483,6 +529,17 @@
<arg choice="opt"><replaceable>filename</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6</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>savesets</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall6</command>
@@ -698,6 +755,10 @@
<arg><option>-t</option></arg>
<arg><option>-r</option></arg>
<arg><option>-n</option></arg>
<arg><option>-A</option></arg>
<arg><replaceable>directory</replaceable></arg>
@@ -759,7 +820,10 @@
<variablelist>
<varlistentry>
<term><emphasis role="bold">add</emphasis></term>
<term><emphasis role="bold">add </emphasis>{
<replaceable>interface</replaceable>[:<replaceable>host-list</replaceable>]...
<replaceable>zone</replaceable> | <replaceable>zone</replaceable>
<replaceable>host-list</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.21. Adds a list of hosts or subnets to
@@ -791,7 +855,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">allow</emphasis></term>
<term><emphasis role="bold">allow
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Re-enables receipt of packets from hosts previously
@@ -803,7 +868,28 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">check</emphasis></term>
<term><emphasis role="bold">call <replaceable>function</replaceable> [
<replaceable>parameter</replaceable> ... ]</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.10. Allows you to call a function in
one of the Shorewall libraries or in your compiled script. function
must name the shell function to be called. The listed parameters are
passed to the function.</para>
<para>The function is first searched for in
<filename>lib.base</filename>, <filename>lib.common</filename>,
<filename>lib.cli</filename> and <filename>lib.cli-std</filename>.
If it is not found, the call command is passed to the generated
script to be executed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">check </emphasis>[-<option>e</option>]
[-<option>d</option>] [-<option>p</option>] [-<option>r</option>]
[-<option>T</option>] [-<option>i</option>]
[<replaceable>directory</replaceable>]</term>
<listitem>
<para>Compiles the configuration in the specified
@@ -834,7 +920,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -843,7 +929,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">clear</emphasis></term>
<term><emphasis role="bold">clear
</emphasis>[-<option>f</option>]</term>
<listitem>
<para>Clear will remove all rules and chains installed by
@@ -854,7 +941,32 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">compile</emphasis></term>
<term><emphasis role="bold">close</emphasis> {
<replaceable>open-number</replaceable> |
<replaceable>source</replaceable> <replaceable>dest</replaceable> [
<replaceable>protocol</replaceable> [ <replaceable>port</replaceable>
] ] }</term>
<listitem>
<para>Added in Shorewall 4.5.8. This command closes a temporary open
created by the <command>open</command> command. In the first form,
an <replaceable>open-number</replaceable> specifies the open to be
closed. Open numbers are displayed in the <emphasis
role="bold">num</emphasis> column of the output of the
<command>shorewall6 show opens </command>command.</para>
<para>When the second form of the command is used, the parameters
must match those given in the earlier <command>open</command>
command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">compile </emphasis>[-<option>e</option>]
[-<option>c</option>] [-<option>d</option>] [-<option>p</option>]
[-<option>T</option>] [-<option>i</option>]
[<replaceable>directory</replaceable>]
[<replaceable>pathname</replaceable> ]</term>
<listitem>
<para>Compiles the current configuration into the executable file
@@ -901,7 +1013,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -910,7 +1022,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">delete</emphasis></term>
<term><emphasis role="bold">delete </emphasis>{
<replaceable>interface</replaceable>[:<replaceable>host-list</replaceable>]...
<replaceable>zone</replaceable> | <replaceable>zone</replaceable>
<replaceable>host-list</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.21. The delete command reverses the
@@ -935,7 +1050,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">disable</emphasis></term>
<term><emphasis role="bold">disable </emphasis><emphasis role="bold">
</emphasis>{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.26. Disables the optional provider
@@ -954,7 +1071,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">drop</emphasis></term>
<term><emphasis role="bold">drop
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -963,7 +1081,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">dump</emphasis></term>
<term><emphasis role="bold">dump </emphasis>[-<option>x</option>]
[-<option>l</option>] [-<option>m</option>]
[-<option>c</option>]</term>
<listitem>
<para>Produces a verbose report about the firewall configuration for
@@ -985,7 +1105,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">enable</emphasis></term>
<term><emphasis role="bold">enable </emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.4.26. Enables the optional provider
@@ -1006,7 +1128,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">export</emphasis></term>
<term><emphasis role="bold">export
</emphasis>[<replaceable>directory1</replaceable> ]
[<replaceable>user</replaceable>@]<replaceable>system</replaceable>[:<replaceable>directory2</replaceable>
]</term>
<listitem>
<para>If <emphasis>directory1</emphasis> is omitted, the current
@@ -1030,7 +1155,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">forget</emphasis></term>
<term><emphasis role="bold">forget </emphasis>[
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>Deletes <filename>/var/lib/shorewall6/<replaceable>filename
@@ -1051,7 +1177,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">iptrace</emphasis></term>
<term><emphasis role="bold">iptrace </emphasis><replaceable>ip6tables
match expression</replaceable></term>
<listitem>
<para>This is a low-level debugging command that causes iptables
@@ -1070,7 +1197,20 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">load</emphasis></term>
<term><emphasis role="bold">list</emphasis></term>
<listitem>
<para><command>list</command> is a synonym for
<command>show</command> -- please see below.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">load </emphasis> [-<option>s</option>]
[-<option>c</option>] [-<option>r</option>
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
[-<option>i</option>] [ <replaceable>directory</replaceable> ]
<replaceable>system</replaceable></term>
<listitem>
<para>If <emphasis>directory</emphasis> is omitted, the current
@@ -1116,7 +1256,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1125,7 +1265,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logdrop</emphasis></term>
<term><emphasis role="bold">logdrop
</emphasis><replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -1137,7 +1278,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logwatch</emphasis></term>
<term><emphasis role="bold">logwatch </emphasis>[-<option>m</option>]
[<replaceable>refresh-interval</replaceable>]</term>
<listitem>
<para>Monitors the log file specified by the LOGFILE option in
@@ -1155,7 +1297,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">logreject</emphasis></term>
<term><emphasis role="bold">logreject</emphasis>
<replaceable>address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
@@ -1167,7 +1310,18 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noiptrace</emphasis></term>
<term><emphasis role="bold">ls</emphasis></term>
<listitem>
<para><command>ls</command> is a synonym for <command>show</command>
-- please see below.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">noiptrace
</emphasis><replaceable>ip6tables match
expression</replaceable></term>
<listitem>
<para>This is a low-level debugging command that cancels a trace
@@ -1180,7 +1334,63 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">refresh</emphasis></term>
<term><emphasis role="bold">open</emphasis>
<replaceable>source</replaceable> <replaceable>dest</replaceable> [
<replaceable>protocol</replaceable> [ <replaceable>port</replaceable>
] ]</term>
<listitem>
<para>Added in Shorewall 4.6.8. This command requires that the
firewall be in the started state and that DYNAMIC_BLACKLIST=Yes in
<ulink url="/manpages6/shorewall6.conf.html">shorewall6.conf
(5)</ulink>. The effect of the command is to temporarily open the
firewall for connections matching the parameters.</para>
<para>The <replaceable>source</replaceable> and
<replaceable>dest</replaceable> parameters may each be specified as
<emphasis role="bold">all</emphasis> if you don't wish to restrict
the connection source or destination respectively. Otherwise, each
must contain a host or network address or a valid DNS name.</para>
<para>The <replaceable>protocol</replaceable> may be specified
either as a number or as a name listed in /etc/protocols. The
<replaceable>port</replaceable> may be specified numerically or as a
name listed in /etc/services.</para>
<para>To reverse the effect of a successful <command>open</command>
command, use the <command>close</command> command with the same
parameters or simply restart the firewall.</para>
<para>Example: To open the firewall for SSH connections to address
2001:470:b:227::1, the command would be:</para>
<programlisting> shorewall6 open all 2001:470:b:227::1 tcp 22</programlisting>
<para>To reverse that command, use:</para>
<programlisting> shorewall6 close all 2001:470:b:227::1 tcp 22</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reenable</emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.6.9. This is equivalent to a
<command>disable</command> command followed by an
<command>enable</command> command on the specified
<replaceable>interface</replaceable> or
<replaceable>provider</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">refresh </emphasis>[-<option>n</option>]
[-<option>d</option>] [-<option>T</option>] [-i]
[-<option>D</option><replaceable>directory</replaceable> ] [
<replaceable>chain</replaceable>... ]</term>
<listitem>
<para>All steps performed by <command>restart</command> are
@@ -1211,7 +1421,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1232,7 +1442,21 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reload</emphasis></term>
<term><emphasis role="bold">reject</emphasis><replaceable>
address</replaceable></term>
<listitem>
<para>Causes traffic from the listed <emphasis>address</emphasis>es
to be silently rejected.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">reload </emphasis>[-<option>s</option>]
[-<option>c</option>] [-<option>r</option>
<replaceable>root-user-name</replaceable>] [-<option>T</option>]
[-<option>i</option>] [ <replaceable>directory</replaceable> ]
<replaceable>system</replaceable></term>
<listitem>
<para>If <emphasis>directory</emphasis> is omitted, the current
@@ -1278,7 +1502,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1288,7 +1512,7 @@
<varlistentry>
<term><emphasis role="bold">reset [<replaceable>chain</replaceable>,
...]</emphasis><acronym></acronym></term>
...]</emphasis><acronym/></term>
<listitem>
<para>Resets the packet and byte counters in the specified
@@ -1299,7 +1523,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restart</emphasis></term>
<term><emphasis role="bold">restart </emphasis>[-<option>n</option>]
[-<option>p</option>] [-<option>d</option>] [-<option>f</option>]
[-<option>c</option>] [-<option>T</option>] [-<option>i</option>]
[-<option>C</option>] [ <replaceable>directory</replaceable> ]</term>
<listitem>
<para>Restart is similar to <command>shorewall6 start</command>
@@ -1337,7 +1564,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1354,7 +1581,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">restore</emphasis></term>
<term><emphasis role="bold">restore </emphasis>[-<option>n</option>]
[-<option>p</option>] [-<option>C</option>] [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>Restore Shorewall6 to a state saved using the
@@ -1382,7 +1611,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">run</emphasis></term>
<term><emphasis role="bold">run</emphasis><emphasis role="bold">
</emphasis><replaceable>command</replaceable> [
<replaceable>parameter</replaceable> ... ]</term>
<listitem>
<para>Added in Shorewall 4.6.3. Executes
@@ -1405,7 +1636,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">safe-restart</emphasis></term>
<term><emphasis role="bold">safe-restart
</emphasis>[-<option>d</option>] [-<option>p</option>]
[-<option>t</option><replaceable>timeout</replaceable> ] [
<replaceable>directory</replaceable> ]</term>
<listitem>
<para>Only allowed if Shorewall6 is running. The current
@@ -1431,7 +1665,10 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">safe-start</emphasis></term>
<term><emphasis role="bold">safe-start
</emphasis>[-<option>d</option>] [-<option>p</option>]
[-<option>t</option><replaceable>timeout</replaceable> ] [
<replaceable>directory</replaceable> ]</term>
<listitem>
<para>Shorewall6 is started normally. You will then be prompted
@@ -1453,7 +1690,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">save</emphasis></term>
<term><emphasis role="bold">save </emphasis>[-<option>C</option>] [
<replaceable>filename</replaceable> ]</term>
<listitem>
<para>The dynamic blacklist is stored in <filename>
@@ -1472,6 +1710,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">savesets</emphasis></term>
<listitem>
<para>Added in shorewall 4.6.8. Performs the same action as the
<command>stop</command> command with respect to saving ipsets (see
the SAVE_IPSETS option in <ulink
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink> (5)).
This command may be used to proactively save your ipset contents in
the event that a system failure occurs prior to issuing a
<command>stop</command> command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">show</emphasis></term>
@@ -1490,7 +1742,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">bl|blacklists</emphasis></term>
<term>[-<option>x</option>] <emphasis role="bold">bl|blacklists
</emphasis></term>
<listitem>
<para>Added in Shorewall 4.6.2. Displays the dynamic chain
@@ -1503,7 +1756,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">capabilities</emphasis></term>
<term>[-<option>f</option>] <emphasis
role="bold">capabilities</emphasis></term>
<listitem>
<para>Displays your kernel/ip6tables capabilities. The
@@ -1514,8 +1768,10 @@
</varlistentry>
<varlistentry>
<term>[ [ <option>chain</option> ] <emphasis>chain</emphasis>...
]</term>
<term>[-<option>b</option>] [-<option>x</option>]
[-<option>l</option>] [-<option>t</option>
{<option>filter</option>|<option>mangle</option>|<option>nat</option>|<option>raw</option>|<option>rawpost</option>}][
<emphasis>chain</emphasis>... ]</term>
<listitem>
<para>The rules in each <emphasis>chain</emphasis> are
@@ -1565,11 +1821,19 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">connections</emphasis></term>
<term><emphasis role="bold">connections
[<replaceable>filter_parameter</replaceable>
...]</emphasis></term>
<listitem>
<para>Displays the IP connections currently being tracked by
the firewall.</para>
<para>If the <command>conntrack</command> utility is
installed, beginning with Shorewall 4.6.11 the set of
connections displayed can be limited by including conntrack
filter parameters (-p , -s, --dport, etc). See conntrack(8)
for details.</para>
</listitem>
</varlistentry>
@@ -1600,7 +1864,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">log</emphasis></term>
<term>[-<option>m</option>] <emphasis
role="bold">log</emphasis></term>
<listitem>
<para>Displays the last 20 Shorewall6 messages from the log
@@ -1622,7 +1887,20 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">mangle</emphasis></term>
<term><emphasis role="bold">macro
</emphasis><replaceable>macro</replaceable></term>
<listitem>
<para>Added in Shorewall 4.4.6. Displays the file that
implements the specified <replaceable>macro</replaceable>
(usually
<filename>/usr/share/shorewall6/macro</filename>.<replaceable>macro</replaceable>).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>[-<option>x</option>] <emphasis
role="bold">mangle</emphasis></term>
<listitem>
<para>Displays the Netfilter mangle table using the command
@@ -1644,6 +1922,30 @@
</listitem>
</varlistentry>
<varlistentry>
<term>[-<option>x</option>] <emphasis
role="bold">nat</emphasis></term>
<listitem>
<para>Displays the Netfilter nat table using the command
<emphasis role="bold">ip6tables -t nat -L -n -v</emphasis>.
The <emphasis role="bold">-x</emphasis> option is passed
directly through to ip6tables 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">opens</emphasis></term>
<listitem>
<para>Added in Shorewall 4.5.8. Displays the iptables rules in
the 'dynamic' chain created through use of the <command>open
</command>command..</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">policies</emphasis></term>
@@ -1657,7 +1959,22 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">routing</emphasis></term>
<term>[-<option>x</option>] <emphasis
role="bold">raw</emphasis></term>
<listitem>
<para>Displays the Netfilter raw table using the command
<emphasis role="bold">ip6tables -t raw -L -n -v</emphasis>.
The <emphasis role="bold">-x</emphasis> option is passed
directly through to ip6tables 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">[-<option>c</option>]<emphasis
role="bold"> </emphasis>routing</emphasis></term>
<listitem>
<para>Displays the system's IPv6 routing configuration. The -c
@@ -1688,7 +2005,11 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">start</emphasis></term>
<term><emphasis role="bold">start </emphasis><emphasis role="bold">
</emphasis>[-<option>n</option>] [-<option>p</option>]
[-<option>d</option>] [-<option>f</option>] [-<option>c</option>]
[-<option>T</option>] [-<option>i</option>] [-<option>C</option>] [
<replaceable>directory</replaceable> ]</term>
<listitem>
<para>Start shorewall6. Existing connections through shorewall6
@@ -1728,7 +2049,7 @@
compiler-generated error and warning message.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
@@ -1744,7 +2065,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">stop</emphasis></term>
<term><emphasis role="bold">stop
</emphasis>[-<option>f</option>]</term>
<listitem>
<para>Stops the firewall. All existing connections, except those
@@ -1756,6 +2078,12 @@
is from systems listed in <ulink
url="/manpages6/shorewall6-routestopped.html">shorewall6-routestopped</ulink>(5)
or by ADMINISABSENTMINDED.</para>
<para>If <option>-f</option> is given, the command will be processed
by the compiled script that executed the last successful <emphasis
role="bold">start</emphasis>, <emphasis
role="bold">restart</emphasis> or <emphasis
role="bold">refresh</emphasis> command if that script exists.</para>
</listitem>
</varlistentry>
@@ -1773,7 +2101,9 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">try</emphasis></term>
<term><emphasis role="bold">try
</emphasis><replaceable>directory</replaceable> [
<replaceable>timeout</replaceable> ]</term>
<listitem>
<para>If Shorewall6 is started then the firewall state is saved to a
@@ -1783,7 +2113,7 @@
command is issued using the specified configuration
<replaceable>directory</replaceable>; otherwise, a <emphasis
role="bold">start</emphasis> command is performed using the
specified configuration <replaceable>directory</replaceable>. if an
specified configuration <replaceable>directory</replaceable>. If an
error occurs during the compilation phase of the <emphasis
role="bold">restart</emphasis> or <emphasis role="bold">start
</emphasis>, the command terminates without changing the Shorewall6
@@ -1807,20 +2137,24 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">update</emphasis></term>
<term><emphasis role="bold">update </emphasis> [-<option>b</option>]
[-<option>d</option>] [-<option>r</option>] [-<option>T</option>]
[-<option>a</option>] [-<option>D</option>] [-<option>i</option>]
[-<option>t</option>] [-r] [-n][-<option>A</option>] [
<replaceable>directory</replaceable> ]</term>
<listitem>
<para>Added in Shorewall 4.4.21 and causes the compiler to update
<filename>/etc/shorewall6/shorewall6.conf</filename> then validate
the configuration. The update will add options not present in the
existing file with their default values, and will move deprecated
<filename>/etc/shorewall/shorewall.conf then validate the
configuration</filename>. The update will add options not present in
the old file with their default values, and will move deprecated
options with non-defaults to a deprecated options section at the
bottom of the file. Your existing
<filename>shorewall6.conf</filename> file is renamed
<filename>shorewall6.conf.bak</filename>.</para>
<filename>shorewall.conf</filename> file is renamed
<filename>shorewall.conf.bak.</filename></para>
<para>The <option>-a</option> option causes the updated
<filename>shorewall6.conf</filename> file to be annotated with
<filename>shorewall.conf</filename> file to be annotated with
documentation.</para>
<para>The <option>-b</option> option was added in Shorewall 4.4.26
@@ -1844,18 +2178,20 @@
directory.</para>
<para>The <option>-i</option> option was added in Shorewall 4.6.0
and causes a warning message to be issued if the line current line
and causes a warning message to be issued if the current line
contains alternative input specifications following a semicolon
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
set to Yes in <ulink
url="/manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>.</para>
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5).</para>
<para>The <option>-t</option> option was added in Shorewall 4.6.0.
When specified, <option>-t</option> causes <ulink
url="shorewall6-tcrules.html">shorewall6-tcrules(5)</ulink> to be
converted to <ulink
When specified, <option>-t</option> causes the <emphasis
role="bold">tcrules</emphasis> file to be converted to <ulink
url="shorewall6-mangle.html">shorewall6-mangle(5)</ulink>. The old
file is renamed with a .bak suffix.</para>
file is renamed with a .bak suffix. Beginning with Shorewall
4.6.12.2, this option also causes the <emphasis
role="bold">tos</emphasis> file to be converted to <ulink
url="shorewall6-mangle.html">shorewall6-mangle(5)</ulink>.</para>
<important>
<para>There are some notable restrictions with the
@@ -1867,7 +2203,7 @@
<filename>mangle</filename> file; if there is no
<filename>mangle</filename> file in the CONFIG_PATH, one will
be created in <filename
class="directory">/etc/shorewall6</filename>.</para>
class="directory">/etc/shorewall</filename>.</para>
</listitem>
<listitem>
@@ -1889,9 +2225,24 @@
</orderedlist>
</important>
<para>The <option>-r</option> option was added in Shorewall 4.6.12.
When specified, <option>-r</option> causes <ulink
url="manpages6/shorewall6-routestopped.html">shorewall6-routestopped(5)</ulink>
to be converted to <ulink
url="manpages6/shorewall6-stoppedrules.html">shorewall6-stoppedrules(5)</ulink>.
The old file is renamed with a .bak suffix.</para>
<para>The <option>-n</option> option was added in Shorewall 4.6.12.
When specified, <option>-n</option> causes <ulink
url="manpages6/shorewall6-routestopped.html">shorewall6-notrack(5)</ulink>
to be converted to <ulink
url="manpages6/shorewall6-conntrack.html">shorewall6-conntrack(5)</ulink>.
The old file is renamed with a .bak suffix.</para>
<para>The <option>-A</option> option was added in Shorewall 4.6.0
and is equivalent to specifying the <option>-b</option>,
<option>-D</option> and the <option>-t</option> options.</para>
<option>-D</option>, <option>-t,</option> <option>-r</option> and
the <option>-n</option> options.</para>
<para>For a description of the other options, see the <emphasis
role="bold">check</emphasis> command above.</para>
@@ -1899,7 +2250,8 @@
</varlistentry>
<varlistentry>
<term><emphasis role="bold">version</emphasis></term>
<term><emphasis role="bold">version
[-<option>a</option>]</emphasis></term>
<listitem>
<para>Displays Shorewall6's version. If the <option>-a</option>

View File

@@ -5,6 +5,7 @@
#
[Unit]
Description=Shorewall IPv6 firewall
Wants=network-online.target
After=network-online.target
Conflicts=ip6tables.service firewalld.service

View File

@@ -5,6 +5,7 @@
#
[Unit]
Description=Shorewall IPv6 firewall
Wants=network-online.target
After=network-online.target
Conflicts=ip6tables.service firewalld.service

View File

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

View File

@@ -36,6 +36,12 @@ usage() # $1 = exit status
exit $1
}
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
@@ -136,8 +142,8 @@ else
usage 1
fi
if [ -f ${SHARDIR}/shorewall6/version ]; then
INSTALLED_VERSION="$(cat /usr/share/shorewall6/version)"
if [ -f ${SHAREDIR}/shorewall6/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall6/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall6 Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller."

View File

@@ -24,6 +24,8 @@
<year>2012</year>
<year>2015</year>
<holder>Thomas M. Eastep</holder>
</copyright>
@@ -93,13 +95,16 @@
<section id="Shorewall">
<title>Shorewall</title>
<para>The Shorewall package includes a large number of files which are
installed in <filename class="directory">/sbin</filename>, <filename
class="directory">/usr/share/shorewall</filename>, <filename
<para>The Shorewall package includes a large number of files which were
traditionally installed in <filename class="directory">/sbin</filename>,
<filename class="directory">/usr/share/shorewall</filename>, <filename
class="directory">/etc/shorewall</filename>,
<filename>/etc/init.d</filename> and <filename
class="directory">/var/lib/shorewall/</filename>. These are described in
the sub-sections that follow.</para>
the sub-sections that follow. Since Shorewall 4.5.2, each of these
directories is now relocatable using the <ulink
url="Install.htm#idp8774904608">configure scripts included with Shorewall
Core</ulink>.</para>
<section id="sbin">
<title>/sbin</title>
@@ -170,7 +175,8 @@
<listitem>
<para><filename>lib.*</filename> - Shell function libraries used by
the other shell programs.</para>
the other shell programs. Most of these are actually provided by
Shorewall-core.</para>
</listitem>
<listitem>
@@ -194,6 +200,12 @@
containing the Shorewall Perl modules used by the compiler.</para>
</listitem>
<listitem>
<para><filename>shorewallrc</filename> - A file that specifies where
all of the other installed components (from all packages) are
installed.</para>
</listitem>
<listitem>
<para><filename>version</filename> - A file containing the currently
install version of Shorewall.</para>
@@ -504,8 +516,8 @@
<section id="sbin-lite">
<title>/sbin</title>
<para>The <filename>/sbin/shorewall-lite</filename> shell program is used
to interact with Shorewall lite. See <ulink
<para>The <filename>/sbin/shorewall-lite</filename> shell program is
used to interact with Shorewall lite. See <ulink
url="manpages/shorewall-lite.html">shorewall-lite</ulink>(8).</para>
</section>

View File

@@ -53,8 +53,10 @@
required to produce a directory that is suitable for the
<command>install.sh</command> script to run in.</para>
<para>My local git repositories are:</para>
<section>
<title>trunk</title>
<title>trunk (clone of Code)</title>
<para>The development branch of each product is kept here.</para>
@@ -97,14 +99,14 @@
</section>
<section>
<title>tools</title>
<title>tools (Clone of Tools)</title>
<para>This is where the release and build tools are kept. There are two
subordinate directories:</para>
<variablelist>
<varlistentry>
<term>trunk/tools/build</term>
<term>tools/build</term>
<listitem>
<para>Tools for building and uploading new releases.</para>
@@ -112,7 +114,7 @@
</varlistentry>
<varlistentry>
<term>trunk/tools/web</term>
<term>tools/web</term>
<listitem>
<para>Tools for publishing web content</para>
@@ -122,14 +124,14 @@
</section>
<section>
<title>web</title>
<title>web (Clone of Web)</title>
<para>The files from the web site that are maintained in HTML format.
are kept in this directory.</para>
</section>
<section>
<title>release</title>
<title>release (Clone of Release)</title>
<para>Added in Shorewall 4.4.22, this directory contains the files that
contain release-dependent information (change.txt, releasenotes.txt,
@@ -142,7 +144,7 @@
<title>Build Tools</title>
<para>As described above, the build tools are kept in <filename
class="directory">trunk/tools/build.</filename> They are described in the
class="directory">tools/build.</filename> They are described in the
following sections.</para>
<section>
@@ -161,247 +163,6 @@
version or a patch version.</para>
</section>
<section>
<title>build</title>
<para>This is the script that builds Shorewall 4.6 packages from
Git.</para>
<para>The script copies content from Git using the <command>git
archive</command> command. It then uses that content to build the
packages. In addition to the usual Gnu utilities, the following software
is required:</para>
<variablelist>
<varlistentry>
<term>rpmbuild</term>
<listitem>
<para>Required to build the RPM packages.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>xsltproc (libxslt)</term>
<listitem>
<para>Required to convert the XML documents to other
formats.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Docbook XSL Stylesheets</term>
<listitem>
<para>Required to convert the XML documents to other
formats.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Perl</term>
<listitem>
<para>Required to massage some of the config files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>xmlto</term>
<listitem>
<para>Required to convert the XML manpages to manpages. Be sure
that you have a recent version; I use 0.0.23.</para>
</listitem>
</varlistentry>
</variablelist>
<para>You should ensure that you have the latest scripts. The scripts
change periodically as we move through the release cycles.</para>
<para>The build46 script may need to be modified to fit your particular
environment. There are a number of variables that are set near the top
of the file:</para>
<variablelist>
<varlistentry>
<term>STYLESHEET</term>
<listitem>
<para>Must point to the XHTML docbook.xsl stylesheet from your
Docbook XSL Stylesheets installation.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>LOGDIR</term>
<listitem>
<para>Directory where you want the build log placed. Defaults to
the current working directory.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>RPMDIR</term>
<listitem>
<para>Points to your RPM directory .</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DIR</term>
<listitem>
<para>Directory where you want the release to be built. Defaults
to the current working directory.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>GIT</term>
<listitem>
<para>Shorewall GIT repository.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The scripts assume that there will be a separate <firstterm>build
directory</firstterm> per major release.</para>
<para>To build a release, you cd to the appropriate directory and run
the build46 script.</para>
<para>The general form of the build46 command is:</para>
<blockquote>
<para><command>build</command> [ -<replaceable>options</replaceable> ]
<replaceable>release</replaceable> [ <replaceable>prior
release</replaceable> ]</para>
</blockquote>
<para>where</para>
<variablelist>
<varlistentry>
<term>opt<emphasis>i</emphasis>ons</term>
<listitem>
<para>are one or more of the following. If no options are given
then all options are assumed</para>
<variablelist>
<varlistentry>
<term>t</term>
<listitem>
<para>build tar files</para>
</listitem>
</varlistentry>
<varlistentry>
<term>r</term>
<listitem>
<para>build RPMs</para>
</listitem>
</varlistentry>
<varlistentry>
<term>c</term>
<listitem>
<para>Build the shorewall package.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>i</term>
<listitem>
<para>Build the shorewall-init package.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>l</term>
<listitem>
<para>Build the shorewall-lite package.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>6</term>
<listitem>
<para>Build the shorewall6 package.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>L</term>
<listitem>
<para>Build the shorewall6-lite package.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>h</term>
<listitem>
<para>Build the html document package.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>x</term>
<listitem>
<para>Build the xml document package.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>release</emphasis></term>
<listitem>
<para>The release version to build. Must match the version in the
associated Git path.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>prior release</emphasis></term>
<listitem>
<para>The release to be used to generate patch files.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Example 1 - Build Shorewall 4.4.7 and generate patches against
4.4.6:</para>
<blockquote>
<para><command>build 4.4.7 4.4.6</command></para>
</blockquote>
<para>Example 2 - Build Shorewall 4.2.7.1 Shorewall and generate patches
against 4.4.7:</para>
<blockquote>
<para><command>build -trc 4.4.7.1 4.4.7</command></para>
</blockquote>
</section>
<section>
<title>build45 and build46</title>
@@ -655,7 +416,7 @@
<section>
<title>upload</title>
<para>This script is used to upload a release to www1.shorewall.net. The
<para>This script is used to upload a release to www.shorewall.org. The
command is run in the build directory for the minor release of the
product.</para>
@@ -742,7 +503,7 @@
<para><command>upload 4.3.7</command></para>
</blockquote>
<para>Example 2 - Upload shorewall-4.3.7.3:</para>
<para>Example 2 - Upload shorewall-core-4.3.7.3:</para>
<blockquote>
<para><command>upload -c 4.3.7.3</command></para>

View File

@@ -2208,7 +2208,7 @@ shorewall status &gt; /dev/null 2&gt;&amp;1 || shorewall start # Start Shorewall
<listitem>
<para>Beginning with Shorewall 4.4.10, there is a new <ulink
url="Manpages/shorewall-init.html">Shorewall Init Package</ulink>
url="manpages/shorewall-init.html">Shorewall Init Package</ulink>
that is designed to handle this case.</para>
</listitem>
</varlistentry>
@@ -2319,7 +2319,7 @@ gateway:~# </programlisting>
<title>(FAQ 104) I see <emphasis>kernel</emphasis> messages in my log
when I start or restart Shorewall or Shorewall6</title>
<para>Example: </para>
<para>Example:</para>
<programlisting>&gt; Oct 1 13:04:39 deb kernel: [ 9570.619744] xt_addrtype: ipv6 does not support BROADCAST matching
</programlisting>

View File

@@ -67,6 +67,12 @@
<listitem>
<para><ulink url="Universal.html">Universal</ulink> configuration --
requires no configuration to protect a single system.</para>
<caution>
<para>This configuration places all interfaces in the net zone. If you
add another interface or VPN, you will want to select a different
QuickStart Guide.</para>
</caution>
</listitem>
</itemizedlist>
@@ -182,7 +188,7 @@
url="configuration_file_basics.htm#Ranges">Port
Ranges</ulink></entry>
<entry></entry>
<entry/>
</row>
</tbody>
</tgroup>

View File

@@ -114,9 +114,11 @@
nf_nat_<replaceable>application</replaceable>; more about that
below.</para>
<para>The modules are not auto-loaded and must be loaded explicitly
using the <command>modprob</command> or <command>insmod</command>
utilities.</para>
<para>Prior to Shorewall 4.5.7, helper modules were not auto-loaded and
must be loaded explicitly using the <command>modprob</command> or
<command>insmod</command> utilities. Beginning with Shorewall 4.5.7,
these modules are loaded when Shorewall is determining the capabilities
of your system.</para>
<para>Many of the modules allow parameters to be specified when the
module is loaded. Among the common parameters is the ports parameter
@@ -280,14 +282,23 @@
</listitem>
</varlistentry>
<varlistentry>
<term>DONT_LOAD</term>
<listitem>
<para>This is a comma-separated list of modules that you
specifically don't want Shorewall to load.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>HELPERS</term>
<listitem>
<para>This option was added in Shorewall 4.5.7 and lists the
modules to be enabled for association with connections. This
option is fully functional only on systems running kernel 3.5 or
later.</para>
modules to be enabled for association with connections
(comma-separated). This option is fully functional only on systems
running kernel 3.5 or later.</para>
<para>The module names allowed in this list are <emphasis
role="bold">amanda</emphasis>, <emphasis
@@ -297,7 +308,19 @@
role="bold">pptp</emphasis>, <emphasis
role="bold">sane</emphasis>, <emphasis role="bold">sip</emphasis>,
<emphasis role="bold">snmp</emphasis> and <emphasis
role="bold">tftp</emphasis>.</para>
role="bold">tftp</emphasis>. If you don't want a particular helper
module loaded, then:</para>
<itemizedlist>
<listitem>
<para>List it in the DONT_LOAD option; and</para>
</listitem>
<listitem>
<para>Explicitly list those helpers that you do want in
HELPERS.</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>

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