Compare commits

..

153 Commits

Author SHA1 Message Date
Matt Darfeuille
0e4c1cdac1 Init: Correct indentation
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-12 10:26:37 -08:00
Tom Eastep
27a0f0f7a0 Make TRACK_PROVIDERS=Yes the default
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-10 08:46:01 -08:00
Tom Eastep
9ac075fd56 Clear the connection mark in tunneled packets from tracked providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-09 17:12:14 -08:00
Tom Eastep
b2604583af Revert "Clear the connection mark in tunneled packets from tracked providers"
This reverts commit 62c6411cb0.
2018-01-09 17:01:51 -08:00
Tom Eastep
62c6411cb0 Clear the connection mark in tunneled packets from tracked providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-09 14:51:57 -08:00
Matt Darfeuille
6badf3ce1a Update supported Shorewall version
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-08 09:08:53 -08:00
Tom Eastep
1bc90beb01 Update copyrights
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-07 15:01:46 -08:00
Tom Eastep
eaccf033c6 Update copyrights for 2018
- Update some header versions to 5.1

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-07 14:24:01 -08:00
Tom Eastep
056711d304 Remove anachronistic comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-06 13:58:20 -08:00
Tom Eastep
0aa0bebe07 Reword error message
- "Invalid action name ..." to "Reserved action name ..."

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-06 13:56:36 -08:00
Tom Eastep
1a68d87c94 Don't enable forwarding in 'clear'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-04 15:39:07 -08:00
Tom Eastep
c518cfaa4a Allow address variables to work correctly with the 'clear' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-03 08:58:28 -08:00
Tom Eastep
196a56ea3c Permit when firewall stopped when using an ipset for dynamic BL
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 13:26:32 -08:00
Tom Eastep
2c3f121835 Don't call setup_dbl() unconditionally
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 13:11:31 -08:00
Tom Eastep
18ba5c7311 Don't verify 'conntrack' utility for 'remote-' commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 11:52:35 -08:00
Tom Eastep
c8774110c6 Correct typo (rootonly => root_only)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 11:51:42 -08:00
Tom Eastep
1479e955d4 Add FAQ 106 (startup at boot on Debian)
- mention reload as a faster alternative to restart

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 08:52:12 -08:00
Tom Eastep
09980cc75e Use split() in uptodate()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-31 15:59:28 -08:00
Tom Eastep
e0a757ea03 Quit find after finding the first newer file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-31 14:15:45 -08:00
Tom Eastep
550003f0f4 Only look at regular files when running 'find'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-31 14:09:51 -08:00
Tom Eastep
4f50303318 Merge branch '5.1.10'
# Conflicts:
#	Shorewall/lib.cli-std
2017-12-31 14:06:52 -08:00
Tom Eastep
5053999442 Don't run 'find' in the PWD
- Also remove -mindepth so as to catch deletions in the directories

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-31 13:33:16 -08:00
Tom Eastep
6b5889177b Correct startup_error() inadvertent change
- Switch ensure_root() back to calling startup_error()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-30 09:24:21 -08:00
Tom Eastep
71f8bad300 Tweak Shared Config doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-30 08:44:49 -08:00
Tom Eastep
377c9f5708 Only search files in each CONFIG_PATH directory - no recursion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-30 08:44:05 -08:00
Tom Eastep
45a164733b Fix breakage of ipp2p
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-30 08:38:14 -08:00
Tom Eastep
6f82bfe7d1 Handle PROTO '-' in conntrack file processing.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 15:54:15 -08:00
Tom Eastep
4e5b98d3d9 Only search files in each CONFIG_PATH directory - no recursion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 15:42:09 -08:00
Tom Eastep
078c781dfa Allow override of :syn assumption in CT rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 15:15:33 -08:00
Tom Eastep
46f68c6dcb Move adjustment of the protocol in process_conntrack_rule()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 13:51:33 -08:00
Tom Eastep
b42678269c Revert "Add :syn to each TCP entry in the conntrack file"
This reverts commit f861f8da35.
2017-12-29 13:08:27 -08:00
Tom Eastep
9bd10c0c00 Call fatal_error (not startup_error) when non-root does default compile
- Also reword the message
2017-12-29 12:49:43 -08:00
Tom Eastep
f861f8da35 Add :syn to each TCP entry in the conntrack file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 12:38:58 -08:00
Tom Eastep
9e3cb27d0a Use the synchain name in log messages rather than the base chain name
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-28 14:13:50 -08:00
Tom Eastep
5b97800901 Tweak Shared Config doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-28 13:26:39 -08:00
Tom Eastep
d8a22d13dd Allow non-root to run many 'show' commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-28 10:49:09 -08:00
Tom Eastep
675e41e6a6 Merge branch 'master' into 5.1.10 2017-12-27 11:15:25 -08:00
Tom Eastep
28f6379956 Fix broken links in the blacklisting article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-26 16:57:44 -08:00
Tom Eastep
c9b58e203b Fix broken links in the blacklisting article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-26 16:56:37 -08:00
Tom Eastep
9afe8daae0 Merge branch '5.1.10'
# Conflicts:
#	Shorewall-core/install.sh
#	Shorewall/install.sh
2017-12-26 15:45:20 -08:00
Tom Eastep
43adcd26a1 Make the /etc and the configfiles .conf files the same
Signed-off-by: Tom Eastep <teastep@shorewall.net>

# Conflicts:
#	Shorewall/install.sh
2017-12-26 15:39:26 -08:00
Tom Eastep
65371437b5 Correct installer for case where SHAREDIR != /usr/share/
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-26 15:36:38 -08:00
Tom Eastep
cc2022e172 Correct installer for case where SHAREDIR != /usr/share/
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-26 15:00:15 -08:00
Tom Eastep
f2a565729f Replace $PRODUCT with ${PRODUCT}
- Also correct one incidence of PRODUCT that should have been $PRODUCT

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-26 14:00:00 -08:00
Tom Eastep
ea8b2a803a Make the /etc and the configfiles .conf files the same
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-26 11:48:33 -08:00
Tom Eastep
16832149ca Remove unneeded modification of $CONFDIR/$PRODUCT/$PRODUCT.conf
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-26 11:35:56 -08:00
Tom Eastep
7edf4918d7 Remove leading ":" from CONFIG_PATH in active shorewall[6].conf
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-26 10:27:19 -08:00
Tom Eastep
d3a1dc1e2a Delete superfluous semicolon.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-25 08:45:42 -08:00
Matt Darfeuille
f68f47d01b Init: Fix when to compile the firewall on Debian
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-25 08:37:00 -08:00
Tom Eastep
b1d1fa862a Add comment noting that the 'physwild' interface member is currently unused
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-23 10:58:16 -08:00
Tom Eastep
24acf25451 Delete unused find_interfaces_by_option1()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-23 10:53:16 -08:00
Tom Eastep
229c47ac6c Don't delete options that are to be ignored from %options
- specifying some options can have side-effects that cause
  $interfaceref->{options}{$option} to be accessed

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-23 10:47:22 -08:00
Tom Eastep
38de9c1732 Make wildcard/option checks order-independent WRT the options
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-23 10:24:08 -08:00
Tom Eastep
17f4fd7cd2 Initialize $physwild to $wildcard
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-22 15:42:16 -08:00
Tom Eastep
cfd02c1bb6 More $minroot changes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-22 13:58:38 -08:00
Tom Eastep
02caeb5aa0 Remove sourceroute=0 from IPv6 Universal interface options
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-22 13:44:11 -08:00
Tom Eastep
19b7601c72 Improve handling of wildcard interfaces and options
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-22 13:43:45 -08:00
Tom Eastep
5a8e9cd0a3 Correct $minroot logic
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-22 09:08:27 -08:00
Tom Eastep
b5a6067588 Describe default interval and decay for rate estimator policing filters
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-20 09:04:52 -08:00
Tom Eastep
45468af2d2 Correct ingress policing for later releases of iproute2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-18 11:52:19 -08:00
Tom Eastep
6c018f478c Avoid unnecessary recompilation by Shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-18 10:25:56 -08:00
Tom Eastep
dec3cacb2a Correct typo in the Helpers Article
Port 1729 -> port 1723 for PPTP

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-08 15:28:01 -08:00
Tom Eastep
4ab8e1f0a2 Remove PSH from the FIN action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-05 15:25:54 -08:00
Tom Eastep
821d72093a Rename DEFAULTACTION_SECTION to POLICYACTION_SECTION.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-02 16:25:15 -08:00
Tom Eastep
42d5d13780 Retain proto setting when switching inline <-> noinline
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-02 13:40:41 -08:00
Tom Eastep
7121a0f1b1 Disallow a protocol on the Reject Action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-02 12:58:05 -08:00
Tom Eastep
ab12d63a4f Change 'default action' to 'policy action' in comments and messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-02 12:55:17 -08:00
Tom Eastep
6ba1d5413b Allow a protocol to be associated with an action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-02 11:24:08 -08:00
Tom Eastep
4fc572f664 Exit the IPv6 AllowICMPs chain if packet isn't ipv6-icmp
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-01 14:50:17 -08:00
Tom Eastep
138e64c54a Improve the documentation surrounding DNS names.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-01 09:25:20 -08:00
Tom Eastep
b04b65cac8 Clear counters in all tables during 'reset'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-30 14:31:59 -08:00
Tom Eastep
c907748b52 Correct typo in 'dump'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-30 14:31:33 -08:00
Tom Eastep
7f3414e3d8 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2017-11-29 08:19:57 -08:00
Roberto C. Sánchez
c75fe2ea8d Fix typo 2017-11-29 06:56:06 -05:00
Tom Eastep
5dcb684efc Don't be specific when deleting IPv6 balanced/fallback default routes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-28 15:26:17 -08:00
Tom Eastep
3e87e5004a Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2017-11-27 09:36:13 -08:00
Roberto C. Sánchez
c89b113a61 Fix typos 2017-11-26 15:39:59 -05:00
Tom Eastep
7289175070 Chop first config dir if non-root or if compiling for export.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-23 09:57:12 -08:00
Tom Eastep
5aaf1e53de IPv6 Samples use logical interface names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-22 09:56:45 -08:00
Tom Eastep
a9373d727b Use logical interface names in the samples.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-22 09:40:15 -08:00
Tom Eastep
528b473f6b Add some additional documentation to the Config module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-22 08:41:37 -08:00
Tom Eastep
d22210c074 Set g_export before calling get_config()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-14 13:46:41 -08:00
Tom Eastep
89d6009200 Revert "Fix for copying SYSCONFFILE. Gave a Permission denied on OpenWRT"
This reverts commit f0cb3f50e4.
2017-11-14 10:48:56 -08:00
Tom Eastep
f411f7dd31 Remove redundant test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-14 10:45:10 -08:00
Tom Eastep
502e98eb9f Add Redfish console to the IPMI macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-14 10:44:54 -08:00
Tom Eastep
f73bad440d Don't verify IP and SHOREWALL_SHELL when compiling/checking for test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-14 10:02:15 -08:00
W. van den Akker
f0cb3f50e4 Fix for copying SYSCONFFILE. Gave a Permission denied on OpenWRT
Signed-off-by: W. van den Akker <wvdakker@wilsoft.nl>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-14 09:01:06 -08:00
W. van den Akker
23bc019a82 Add OpenWRT options.
Signed-off-by: W. van den Akker <wvdakker@wilsoft.nl>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-14 09:00:46 -08:00
Tom Eastep
9d299ef866 Don't verify IP and SHOREWALL_SHELL setting when compiling for export
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-14 08:50:05 -08:00
Tom Eastep
2a9272ccd1 Clean up RAs involving "|"
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-14 08:26:17 -08:00
Tom Eastep
130ddff9de Correct a typo in an error message
- Includes cosmetic changes to Providers.pm

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-10 11:25:52 -08:00
Tom Eastep
9cf298482d Merge branch '5.1.8' 2017-11-09 12:59:59 -08:00
Tom Eastep
c5a586aa37 Allow [...] around gateway address in the providers file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-09 12:20:01 -08:00
Tom Eastep
0670ecaf5e Update Shared Configuration Article
- Add network graphic

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-08 18:47:23 -08:00
Tom Eastep
d3eebde464 Add another restriction for SAVE_IPSETS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-08 10:56:57 -08:00
Tom Eastep
832418585a Don't make persistent routes and rules dependent on autosrc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-08 09:46:25 -08:00
Tom Eastep
605f61fb3c Don't make persistent routes and rules dependent on autosrc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-08 09:45:59 -08:00
Tom Eastep
824f4ca570 Update Shared Configuration document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-08 09:44:40 -08:00
Tom Eastep
9acdbb5acf Unify online manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-03 10:43:48 -07:00
Tom Eastep
8dfa0be611 Add shorewall-logging(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-02 15:26:14 -07:00
Tom Eastep
ef8b85fc3e Implement support for logging in the SNAT file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-11-02 12:44:42 -07:00
Tom Eastep
2b5613026a Merge branch '5.1.8' 2017-10-25 09:14:20 -07:00
Tom Eastep
c7c318c0e7 Align columns in actions.std
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-25 09:13:37 -07:00
Tom Eastep
b48e5a8932 Create new Netfilter diagram using Dia
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-25 09:13:08 -07:00
Tom Eastep
d1976189aa Correct a couple of typos in the manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-22 12:59:31 -07:00
Tom Eastep
6b4905c2c0 Replace 'tcp' with '6' in action.TCPFlags
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-20 12:33:36 -07:00
Tom Eastep
774b707352 Inline Multicast when Address Type Match is available
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-20 12:01:41 -07:00
Tom Eastep
c3bd58827f Align columns in actions.std
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-20 11:44:10 -07:00
Tom Eastep
b35f1112f4 Allow 'noinline' in /etc/shorewall[6]/actions to override 'inline'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-20 09:19:50 -07:00
Tom Eastep
a0eb91cb90 Inline the Broadcast action when ADDRTYPE match is available
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-20 08:49:14 -07:00
Tom Eastep
105e6a3d01 Create new Netfilter diagram using Dia
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-19 14:51:36 -07:00
Tom Eastep
77d9eeb915 Eliminate extra parameter editing of TPROXY parameter list.
- Clarify syntax for actions with multiple parameters

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-19 13:08:12 -07:00
Tom Eastep
17838c1443 Add TCPMSS to the allowed mangle actions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-19 12:58:38 -07:00
Tom Eastep
5867ce6c3b CLAMPMSS now done in the mangle table.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-18 15:55:07 -07:00
Tom Eastep
84cd80eba9 Update the Shared Config document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-17 16:51:35 -07:00
Tom Eastep
9b02f7a922 Update Shared config article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-15 19:15:13 -07:00
Tom Eastep
f1975ae9b0 More robust detection of empty SPD entries.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-15 08:26:27 -07:00
Tom Eastep
7b9f7c095d Don't dump SPD entries for the other address family
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-14 13:39:00 -07:00
Tom Eastep
8ea96098bf Warning when 'persistent' used with RESTORE_DEFAULT_ROUTE=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-11 15:22:07 -07:00
Tom Eastep
02ed36332a Revert "Warn when RESTORE_DEFAULT_ROUTE=Yes and a persistent provider is defined"
This reverts commit 39a3c72057.
2017-10-11 11:24:54 -07:00
Tom Eastep
15a3b29a32 Revert "Document warning when RESTORE_DEFAULT_ROUTE=Yes and 'persistent'"
This reverts commit bfab002dda.
2017-10-11 11:24:39 -07:00
Tom Eastep
cb4f9e7261 Don't restore default routes when there is an enabled fallback provider
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-11 11:24:13 -07:00
Tom Eastep
bfab002dda Document warning when RESTORE_DEFAULT_ROUTE=Yes and 'persistent'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-11 11:01:09 -07:00
Tom Eastep
ddb12fcad9 Add/correct comments
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-11 11:00:46 -07:00
Tom Eastep
42ce754961 Don't restore default routes when a fallback= provider is enabled
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-11 11:00:05 -07:00
Tom Eastep
5cd4d63bc5 Delete main default routes when a fallback provider is enabled
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-11 10:59:31 -07:00
Tom Eastep
5b567f2d8b Correct delete_default_routes() in tables other than main
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-11 10:58:48 -07:00
Tom Eastep
39a3c72057 Warn when RESTORE_DEFAULT_ROUTE=Yes and a persistent provider is defined
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-11 10:58:09 -07:00
Tom Eastep
b47e633c38 Use 'route replace' rather than 'route add' to avoid persistence issues
Previous failure case was:

- disable interface
- reload
- enable interface

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-09 08:58:10 -07:00
Tom Eastep
1b55a37a28 Ensure that 'rule add' commands don't fail with persistent interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-08 08:53:53 -07:00
Tom Eastep
a97dcd23d0 Allow merging of rules that specify an IPSEC policy
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-07 13:17:43 -07:00
Tom Eastep
108b169d8d Treat LOG_TARGET like all other capabilities
- Previous implementation could generate unworkable script when
  LOAD_HELPERS_ONLY=Yes

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-06 08:01:52 -07:00
Tom Eastep
a9fbaa57ed Pass -$g_family to 'ip xfrm' commands
- This currently doesn't work correctly, but maybe it will in the future

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-10-06 08:00:29 -07:00
Tom Eastep
317f12041b Strengthen the test for empty SPD entries
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-30 15:43:17 -07:00
Tom Eastep
8469f983d8 Merge branch '5.1.7'
# Conflicts:
#	Shorewall/Perl/prog.footer
2017-09-29 15:25:37 -07:00
Tom Eastep
f54acb665a Correct handling of mark range in MARK target.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-29 14:44:33 -07:00
Tom Eastep
3d2e9eb93e Improve the fix for SELinux "getattr" denials
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-28 15:16:50 -07:00
Tom Eastep
c6a939301f Improve the fix for SELinux "getattr" denials
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-28 15:16:00 -07:00
Tom Eastep
1cb98254cc Handle SELinux getattr denials in open() processing
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-26 16:42:54 -07:00
Tom Eastep
baa791a1e3 Handle SELinux getattr denials in open() processing
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-26 16:41:50 -07:00
Tom Eastep
8b4b965f63 Remove unnecessary disable/enable of script generation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-21 14:36:30 -07:00
Tom Eastep
8ee2d6246c Update a comment in the compiler
- get_configuration() also processes the shorewallrc file(s)

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-21 12:32:34 -07:00
Tom Eastep
e2bf7e6584 Align progress messages produced by 'reenable'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-19 13:28:09 -07:00
Tom Eastep
ff3994f6a1 Correct reenable logic
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-19 13:17:50 -07:00
Tom Eastep
494ec9c59c Avoid extra comparison in reload_command()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-19 10:49:11 -07:00
Tom Eastep
721a1e3b33 Initialize g_dockeringress
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-19 10:39:52 -07:00
Tom Eastep
84fa774cb7 Change copyright dates in lib.runtime
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-19 09:03:00 -07:00
Tom Eastep
c39bc7b65f Update version of lib.*installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-18 13:09:35 -07:00
Tom Eastep
2548e8741d Update version and copyright dates in lib.common
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-18 13:07:37 -07:00
Tom Eastep
0a31fba6bb Update version and copyright dates in lib.core
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-18 13:00:50 -07:00
Tom Eastep
9701c9c522 Update version and copyright dates in lib.base
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-18 12:57:02 -07:00
Tom Eastep
973d352209 Update shorewall script
- Update copyright dates
- Add a comment about PRODUCT setting

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-18 12:51:27 -07:00
Tom Eastep
91e59c2ed4 Remove the Lite Makefiles
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-09-18 11:56:04 -07:00
113 changed files with 2306 additions and 1311 deletions

View File

@@ -2,7 +2,7 @@
# #
# Shorewall Packet Filtering Firewall RPM configuration program - V4.6 # Shorewall Packet Filtering Firewall RPM configuration program - V4.6
# #
# (c) 2012,2014 - Tom Eastep (teastep@shorewall.net) # (c) 2012,2014,2017 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at http://www.shorewall.net
# #

View File

@@ -2,7 +2,7 @@
# #
# Script to install Shoreline Firewall Core Modules # Script to install Shoreline Firewall Core Modules
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at http://shorewall.net
# #
@@ -335,9 +335,8 @@ for f in lib.* ; do
done done
if [ $SHAREDIR != /usr/share ]; then if [ $SHAREDIR != /usr/share ]; then
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.base eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/lib.base
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.core eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/lib.cli
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.cli
fi fi
# #

View File

@@ -1,7 +1,7 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.base # Shorewall 5.1 -- /usr/share/shorewall/lib.base
# #
# (c) 1999-2015 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,7 +1,7 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.cli. # Shorewall 5.1 -- /usr/share/shorewall/lib.cli.
# #
# (c) 1999-2015 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -47,6 +47,10 @@ startup_error() {
exit 1 exit 1
} }
only_root() {
[ "$(id -u)" != 0 ] && fatal_error "The '$COMMAND' command may only be run by root"
}
# #
# Display a chain if it exists # Display a chain if it exists
# #
@@ -1137,16 +1141,31 @@ show_a_macro() {
cat ${directory}/macro.$1 cat ${directory}/macro.$1
} }
# #
# Don't dump empty SPD entries # Don't dump empty SPD entries or entries from the other address family
# #
spd_filter() spd_filter() {
{ #
awk \ # af = Address Family (4 or 6)
'BEGIN { skip=0; }; \ # afok = Address Family of entry matches af
/^src/ { skip=0; }; \ # p = print the contents of A (entry is not empty)
/^src 0.0.0.0\/0/ { skip=1; }; \ # i = Number of lines stored in A
/^src ::\/0/ { skip=1; }; \ #
{ if ( skip == 0 ) print; };' awk -v af=$g_family \
'function prnt(A,i, j) { while ( j < i ) print A[j++]; };\
\
/^src / { if (p) prnt( A, i );\
afok = 1;\
p = 0;\
i = 0;\
if ( af == 4 )\
{ if ( /:/ ) afok = 0; }\
else\
{ if ( /\./ ) afok = 0; }\
};\
{ if ( afok ) A[i++] = $0; };\
/tmpl/ { p = afok; };\
\
END { if (p) prnt( A, i ); }'
} }
# #
# Print a heading with leading and trailing black lines # Print a heading with leading and trailing black lines
@@ -1159,7 +1178,8 @@ heading() {
show_ipsec() { show_ipsec() {
heading "PFKEY SPD" heading "PFKEY SPD"
$IP -s xfrm policy | spd_filter $IP -s -$g_family xfrm policy | spd_filter
heading "PFKEY SAD" heading "PFKEY SAD"
$IP -s -$g_family xfrm state | egrep -v '[[:space:]]+(auth-trunc|enc )' # Don't divulge the keys $IP -s -$g_family xfrm state | egrep -v '[[:space:]]+(auth-trunc|enc )' # Don't divulge the keys
} }
@@ -1187,6 +1207,7 @@ show_command() {
show_macro() { show_macro() {
foo=`grep 'This macro' $macro | sed 's/This macro //'` foo=`grep 'This macro' $macro | sed 's/This macro //'`
if [ -n "$foo" ]; then if [ -n "$foo" ]; then
macro=$(basename $macro)
macro=${macro#*.} macro=${macro#*.}
foo=${foo%.*} foo=${foo%.*}
if [ ${#macro} -gt 5 ]; then if [ ${#macro} -gt 5 ]; then
@@ -1281,37 +1302,47 @@ show_command() {
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
COMMAND="$COMMAND $1"
case "$1" in case "$1" in
connections) connections)
only_root
eval show_connections $@ $g_pager eval show_connections $@ $g_pager
;; ;;
nat) nat)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_nat $g_pager eval show_nat $g_pager
;; ;;
raw) raw)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_raw $g_pager eval show_raw $g_pager
;; ;;
tos|mangle) tos|mangle)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_mangle $g_pager eval show_mangle $g_pager
;; ;;
log) log)
[ $# -gt 2 ] && too_many_arguments $2 [ $# -gt 2 ] && too_many_arguments $2
only_root
setup_logread setup_logread
eval show_log $g_pager eval show_log $g_pager
;; ;;
tc) tc)
only_root
[ $# -gt 2 ] && too_many_arguments $2 [ $# -gt 2 ] && too_many_arguments $2
eval show_tc $@ $g_pager eval show_tc $@ $g_pager
;; ;;
classifiers|filters) classifiers|filters)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_classifiers_command $g_pager eval show_classifiers_command $g_pager
;; ;;
zones) zones)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
if [ -f ${VARDIR}/zones ]; then if [ -f ${VARDIR}/zones ]; then
echo "$g_product $SHOREWALL_VERSION Zones at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION Zones at $g_hostname - $(date)"
@@ -1335,6 +1366,7 @@ show_command() {
fi fi
;; ;;
capabilities) capabilities)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
determine_capabilities determine_capabilities
VERBOSITY=2 VERBOSITY=2
@@ -1371,6 +1403,7 @@ show_command() {
fi fi
;; ;;
chain) chain)
only_root
shift shift
eval show_chain $@ $g_pager eval show_chain $@ $g_pager
;; ;;
@@ -1378,26 +1411,31 @@ show_command() {
echo $VARDIR; echo $VARDIR;
;; ;;
policies) policies)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_policies $g_pager eval show_policies $g_pager
;; ;;
ipa) ipa)
only_root
[ $g_family -eq 4 ] || fatal_error "'show ipa' is now available in $g_product" [ $g_family -eq 4 ] || fatal_error "'show ipa' is now available in $g_product"
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_ipa $g_pager eval show_ipa $g_pager
;; ;;
marks) marks)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
echo "$g_product $SHOREWALL_VERSION Mark Layout at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION Mark Layout at $g_hostname - $(date)"
echo echo
[ -f ${VARDIR}/marks ] && cat ${VARDIR}/marks; [ -f ${VARDIR}/marks ] && cat ${VARDIR}/marks;
;; ;;
nfacct) nfacct)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
eval show_nfacct_command $g_pager eval show_nfacct_command $g_pager
;; ;;
arptables) arptables)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
resolve_arptables resolve_arptables
if [ -n "$arptables" -a -x $arptables ]; then if [ -n "$arptables" -a -x $arptables ]; then
eval show_arptables $g_pager eval show_arptables $g_pager
@@ -1407,6 +1445,7 @@ show_command() {
;; ;;
event) event)
[ $# -gt 1 ] || too_many_arguments $2 [ $# -gt 1 ] || too_many_arguments $2
only_root
echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)"
echo echo
shift shift
@@ -1414,14 +1453,18 @@ show_command() {
;; ;;
events) events)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
eval show_events_command $g_pager eval show_events_command $g_pager
;; ;;
bl|blacklists) bl|blacklists)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
setup_dbl
eval show_blacklists $g_pager eval show_blacklists $g_pager
;; ;;
opens) opens)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
echo "$g_product $SHOREWALL_VERSION Temporarily opened connections at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION Temporarily opened connections at $g_hostname - $(date)"
if chain_exists dynamic; then if chain_exists dynamic; then
@@ -1432,6 +1475,7 @@ show_command() {
;; ;;
ipsec) ipsec)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
eval show_ipsec_command $g_pager eval show_ipsec_command $g_pager
;; ;;
*) *)
@@ -1480,6 +1524,8 @@ show_command() {
;; ;;
esac esac
only_root
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
if [ $1 = dynamic -a $# -gt 1 ]; then if [ $1 = dynamic -a $# -gt 1 ]; then
shift shift
@@ -1797,7 +1843,7 @@ do_dump_command() {
echo echo
qt mywhich ss && ss -${g_family}tunap || { qt mywhich netstat && netatat -tunap; } qt mywhich ss && ss -${g_family}tunap || { qt mywhich netstat && netstat -tunap; }
if [ -n "$TC_ENABLED" ]; then if [ -n "$TC_ENABLED" ]; then
heading "Traffic Control" heading "Traffic Control"
@@ -2529,109 +2575,114 @@ hits_command() {
fi fi
} }
#
# Issue an error message and terminate if the firewall isn't started
#
require_started() {
if ! product_is_started; then
error_message "ERROR: $g_product is not started"
exit 2
fi
}
# #
# 'allow' command executor # 'allow' command executor
# #
allow_command() { allow_command() {
local allowed
local which
which='-s'
local range
range='--src-range'
local dynexists
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && missing_argument [ $# -eq 1 ] && missing_argument
if product_is_started ; then if [ -n "$g_blacklistipset" ]; then
local allowed case ${IPSET:=ipset} in
local which */*)
which='-s' if [ ! -x "$IPSET" ]; then
local range fatal_error "IPSET=$IPSET does not exist or is not executable"
range='--src-range' fi
local dynexists ;;
*)
if [ -n "$g_blacklistipset" ]; then IPSET="$(mywhich $IPSET)"
[ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"
case ${IPSET:=ipset} in ;;
*/*) esac
if [ ! -x "$IPSET" ]; then
fatal_error "IPSET=$IPSET does not exist or is not executable"
fi
;;
*)
IPSET="$(mywhich $IPSET)"
[ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"
;;
esac
fi
if chain_exists dynamic; then
dynexists=Yes
elif [ -z "$g_blacklistipset" ]; then
fatal_error "Dynamic blacklisting is not enabled in the current $g_product configuration"
fi
[ -n "$g_nolock" ] || mutex_on
while [ $# -gt 1 ]; do
shift
allowed=''
case $1 in
from)
which='-s'
range='--src-range'
continue
;;
to)
which='-d'
range='--dst-range'
continue
;;
*-*)
if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes
fi
fi
if [ -n "$dynexists" ]; then
if qt $g_tool -D dynamic -m iprange $range $1 -j reject ||\
qt $g_tool -D dynamic -m iprange $range $1 -j DROP ||\
qt $g_tool -D dynamic -m iprange $range $1 -j logdrop ||\
qt $g_tool -D dynamic -m iprange $range $1 -j logreject
then
allowed=Yes
fi
fi
;;
*)
if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes
fi
fi
if [ -n "$dynexists" ]; then
if qt $g_tool -D dynamic $which $1 -j reject ||\
qt $g_tool -D dynamic $which $1 -j DROP ||\
qt $g_tool -D dynamic $which $1 -j logdrop ||\
qt $g_tool -D dynamic $which $1 -j logreject
then
allowed=Yes
fi
fi
;;
esac
if [ -n "$allowed" ]; then
progress_message2 "$1 Allowed"
else
error_message "WARNING: $1 already allowed (not dynamically blacklisted)"
fi
done
[ -n "$g_nolock" ] || mutex_off
else
error_message "ERROR: $g_product is not started"
exit 2
fi fi
if chain_exists dynamic; then
dynexists=Yes
elif [ -z "$g_blacklistipset" ]; then
require_started
fatal_error "Dynamic blacklisting is not enabled in the current $g_product configuration"
fi
[ -n "$g_nolock" ] || mutex_on
while [ $# -gt 1 ]; do
shift
allowed=''
case $1 in
from)
which='-s'
range='--src-range'
continue
;;
to)
which='-d'
range='--dst-range'
continue
;;
*-*)
if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes
fi
fi
if [ -n "$dynexists" ]; then
if qt $g_tool -D dynamic -m iprange $range $1 -j reject ||\
qt $g_tool -D dynamic -m iprange $range $1 -j DROP ||\
qt $g_tool -D dynamic -m iprange $range $1 -j logdrop ||\
qt $g_tool -D dynamic -m iprange $range $1 -j logreject
then
allowed=Yes
fi
fi
;;
*)
if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes
fi
fi
if [ -n "$dynexists" ]; then
if qt $g_tool -D dynamic $which $1 -j reject ||\
qt $g_tool -D dynamic $which $1 -j DROP ||\
qt $g_tool -D dynamic $which $1 -j logdrop ||\
qt $g_tool -D dynamic $which $1 -j logreject
then
allowed=Yes
fi
fi
;;
esac
if [ -n "$allowed" ]; then
progress_message2 "$1 Allowed"
else
error_message "WARNING: $1 already allowed (not dynamically blacklisted)"
fi
done
[ -n "$g_nolock" ] || mutex_off
} }
# #
@@ -2770,7 +2821,7 @@ determine_capabilities() {
GOTO_TARGET= GOTO_TARGET=
LOGMARK_TARGET= LOGMARK_TARGET=
IPMARK_TARGET= IPMARK_TARGET=
LOG_TARGET=Yes LOG_TARGET=
ULOG_TARGET= ULOG_TARGET=
NFLOG_TARGET= NFLOG_TARGET=
PERSISTENT_SNAT= PERSISTENT_SNAT=
@@ -3138,7 +3189,7 @@ determine_capabilities() {
qt $g_tool -A $chain -m time --timestart 23:00 -j DROP && TIME_MATCH=Yes qt $g_tool -A $chain -m time --timestart 23:00 -j DROP && TIME_MATCH=Yes
qt $g_tool -A $chain -g $chain1 && GOTO_TARGET=Yes qt $g_tool -A $chain -g $chain1 && GOTO_TARGET=Yes
qt $g_tool -A $chain -j LOGMARK && LOGMARK_TARGET=Yes qt $g_tool -A $chain -j LOGMARK && LOGMARK_TARGET=Yes
qt $g_tool -A $chain -j LOG || LOG_TARGET= qt $g_tool -A $chain -j LOG && LOG_TARGET=Yes
qt $g_tool -A $chain -j ULOG && ULOG_TARGET=Yes qt $g_tool -A $chain -j ULOG && ULOG_TARGET=Yes
qt $g_tool -A $chain -j MARK --set-mark 5 && MARK_ANYWHERE=Yes qt $g_tool -A $chain -j MARK --set-mark 5 && MARK_ANYWHERE=Yes
qt $g_tool -A $chain -m statistic --mode nth --every 2 --packet 1 && STATISTIC_MATCH=Yes qt $g_tool -A $chain -m statistic --mode nth --every 2 --packet 1 && STATISTIC_MATCH=Yes
@@ -4569,12 +4620,14 @@ shorewall_cli() {
case "$COMMAND" in case "$COMMAND" in
start) start)
only_root
get_config Yes Yes get_config Yes Yes
shift shift
start_command $@ start_command $@
;; ;;
stop|clear) stop|clear)
[ $# -ne 1 ] && too_many_arguments $2 [ $# -ne 1 ] && too_many_arguments $2
only_root
get_config get_config
[ -x $g_firewall ] || fatal_error "$g_product has never been started" [ -x $g_firewall ] || fatal_error "$g_product has never been started"
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
@@ -4582,6 +4635,7 @@ shorewall_cli() {
[ -n "$g_nolock" ] || mutex_off [ -n "$g_nolock" ] || mutex_off
;; ;;
reset) reset)
only_root
get_config get_config
shift shift
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
@@ -4590,11 +4644,13 @@ shorewall_cli() {
[ -n "$g_nolock" ] || mutex_off [ -n "$g_nolock" ] || mutex_off
;; ;;
reload|restart) reload|restart)
only_root
get_config Yes Yes get_config Yes Yes
shift shift
restart_command $@ restart_command $@
;; ;;
disable|enable|reenable) disable|enable|reenable)
only_root
get_config Yes get_config Yes
if product_is_started; then if product_is_started; then
run_it ${VARDIR}/firewall $g_debugging $@ run_it ${VARDIR}/firewall $g_debugging $@
@@ -4603,6 +4659,7 @@ shorewall_cli() {
fi fi
;; ;;
blacklist) blacklist)
only_root
get_config Yes get_config Yes
shift shift
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
@@ -4611,6 +4668,7 @@ shorewall_cli() {
;; ;;
run) run)
[ $# -gt 1 ] || fatal_error "Missing function name" [ $# -gt 1 ] || fatal_error "Missing function name"
only_root
get_config Yes get_config Yes
run_command $@ run_command $@
;; ;;
@@ -4620,18 +4678,20 @@ shorewall_cli() {
show_command $@ show_command $@
;; ;;
status) status)
[ "$(id -u)" != 0 ] && fatal_error "The status command may only be run by root" only_root
get_config get_config
shift shift
status_command $@ status_command $@
;; ;;
dump) dump)
only_root
get_config Yes No Yes get_config Yes No Yes
shift shift
dump_command $@ dump_command $@
;; ;;
hits) hits)
[ $g_family -eq 6 ] && fatal_error "$g_product does not support the hits command" [ $g_family -eq 6 ] && fatal_error "$g_product does not support the hits command"
only_root
get_config Yes No Yes get_config Yes No Yes
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
shift shift
@@ -4642,53 +4702,63 @@ shorewall_cli() {
version_command $@ version_command $@
;; ;;
logwatch) logwatch)
only_root
get_config Yes Yes Yes get_config Yes Yes Yes
banner="${g_product}-$SHOREWALL_VERSION Logwatch at $g_hostname -" banner="${g_product}-$SHOREWALL_VERSION Logwatch at $g_hostname -"
logwatch_command $@ logwatch_command $@
;; ;;
drop) drop)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && missing_argument [ $# -eq 1 ] && missing_argument
drop_command $@ drop_command $@
;; ;;
logdrop) logdrop)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && missing_argument [ $# -eq 1 ] && missing_argument
logdrop_command $@ logdrop_command $@
;; ;;
reject|logreject) reject|logreject)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && missing_argument [ $# -eq 1 ] && missing_argument
reject_command $@ reject_command $@
;; ;;
open|close) open|close)
only_root
get_config get_config
shift shift
open_close_command $@ open_close_command $@
;; ;;
allow) allow)
only_root
get_config get_config
allow_command $@ allow_command $@
;; ;;
add) add)
only_root
get_config get_config
shift shift
add_command $@ add_command $@
;; ;;
delete) delete)
only_root
get_config get_config
shift shift
delete_command $@ delete_command $@
;; ;;
save) save)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
save_command $@ save_command $@
;; ;;
forget) forget)
only_root
get_config get_config
forget_command $@ forget_command $@
;; ;;
@@ -4705,11 +4775,13 @@ shorewall_cli() {
ipdecimal_command $@ ipdecimal_command $@
;; ;;
restore) restore)
only_root
get_config get_config
shift shift
restore_command $@ restore_command $@
;; ;;
call) call)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
# #
@@ -4747,17 +4819,20 @@ shorewall_cli() {
usage usage
;; ;;
iptrace) iptrace)
only_root
get_config get_config
shift shift
iptrace_command $@ iptrace_command $@
;; ;;
noiptrace) noiptrace)
only_root
get_config get_config
shift shift
noiptrace_command $@ noiptrace_command $@
;; ;;
savesets) savesets)
[ $# -eq 1 ] || too_many_arguments $2 [ $# -eq 1 ] || too_many_arguments $2
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
savesets1 savesets1

View File

@@ -1,7 +1,7 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.common. # Shorewall 5.1 -- /usr/share/shorewall/lib.common.
# #
# (c) 2010-2015 - Tom Eastep (teastep@shorewall.net) # (c) 2010-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,7 +1,7 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.core # Shorewall 5.1 -- /usr/share/shorewall/lib.core
# #
# (c) 1999-2015 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -24,7 +24,7 @@
# generated scripts. # generated scripts.
# #
SHOREWALL_LIBVERSION=50100 SHOREWALL_LIBVERSION=50108
# #
# Fatal Error # Fatal Error

View File

@@ -1,6 +1,6 @@
# #
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer. # Shorewall 5.1 -- /usr/share/shorewall/lib.installer.
# #
# (c) 2017 - Tom Eastep (teastep@shorewall.net) # (c) 2017 - Tom Eastep (teastep@shorewall.net)
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com) # (c) 2017 - Matt Darfeuille (matdarf@gmail.com)

View File

@@ -1,6 +1,6 @@
# #
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer. # Shorewall 5.1 -- /usr/share/shorewall/lib.installer.
# #
# (c) 2017 - Tom Eastep (teastep@shorewall.net) # (c) 2017 - Tom Eastep (teastep@shorewall.net)
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com) # (c) 2017 - Matt Darfeuille (matdarf@gmail.com)

View File

@@ -3187,14 +3187,15 @@
shorewall-arprules(5), shorewall-blrules(5), shorewall.conf(5), shorewall-arprules(5), shorewall-blrules(5), shorewall.conf(5),
shorewall-conntrack(5), shorewall-ecn(5), shorewall-exclusion(5), shorewall-conntrack(5), shorewall-ecn(5), shorewall-exclusion(5),
shorewall-hosts(5), shorewall-init(5), shorewall_interfaces(5), shorewall-hosts(5), shorewall-init(5), shorewall_interfaces(5),
shorewall-ipsets(5), shorewall-maclist(5), shorewall-mangle(5), shorewall-ipsets(5), shorewall-logging(), shorewall-maclist(5),
shorewall-masq(5), shorewall-modules(5), shorewall-nat(5), shorewall-mangle(5), shorewall-masq(5), shorewall-modules(5),
shorewall-nesting(5), shorewall-netmap(5), shorewall-params(5), shorewall-nat(5), shorewall-nesting(5), shorewall-netmap(5),
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5), shorewall-params(5), shorewall-policy(5), shorewall-providers(5),
shorewall6-proxyndp(5), shorewall-routes(5), shorewall-rtrules(5), shorewall-proxyarp(5), shorewall6-proxyndp(5), shorewall-routes(5),
shorewall-rtrules(5), shorewall-rules(5), shorewall-secmarks(5), shorewall-rtrules(5), shorewall-rtrules(5), shorewall-rules(5),
shorewall-snat(5), shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-secmarks(5), shorewall-snat(5), shorewall-tcclasses(5),
shorewall-tcfilters(5), shorewall-tcinterfaces(5), shorewall-tcpri(5), shorewall-tcdevices(5), shorewall-tcfilters(5), shorewall-tcinterfaces(5),
shorewall-tunnels(5), shorewall-vardir(5), shorewall-zones(5)</para> shorewall-tcpri(5), shorewall-tunnels(5), shorewall-vardir(5),
shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# #
# Shorewall Packet Filtering Firewall Control Program - V5.0 # Shorewall Packet Filtering Firewall Control Program - V5.1
# #
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2014,2015 - # (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2014,2015-2017
# Tom Eastep (teastep@shorewall.net) # Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at http://www.shorewall.net
@@ -25,6 +25,10 @@
# For a list of supported commands, type 'shorewall help' or 'shorewall6 help' # For a list of supported commands, type 'shorewall help' or 'shorewall6 help'
# #
################################################################################################ ################################################################################################
#
# Default product is Shorewall. PRODUCT will be set based on $0 and on passed -[46] and -l
# options
#
PRODUCT=shorewall PRODUCT=shorewall
# #

View File

@@ -73,12 +73,16 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT} [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ $PRODUCT = shorewall ]; then if [ -x ${STATEDIR}/firewall ]; then
${SBINDIR}/shorewall compile return 0
elif [ $PRODUCT = shorewall6 ]; then
${SBINDIR}/shorewall -6 compile
else else
return 0 if [ $PRODUCT = shorewall ]; then
${SBINDIR}/shorewall compile
elif [ $PRODUCT = shorewall6 ]; then
${SBINDIR}/shorewall -6 compile
else
return 1
fi
fi fi
} }
@@ -108,16 +112,14 @@ shorewall_start () {
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if setstatedir; then if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then #
# # Run in a sub-shell to avoid name collisions
# Run in a sub-shell to avoid name collisions #
# (
( if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then ${STATEDIR}/firewall ${OPTIONS} stop
${STATEDIR}/firewall ${OPTIONS} stop fi
fi )
)
fi
fi fi
done done
@@ -145,9 +147,7 @@ shorewall_stop () {
printf "Clearing \"Shorewall-based firewalls\": " printf "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if setstatedir; then if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then ${STATEDIR}/firewall ${OPTIONS} clear
${STATEDIR}/firewall ${OPTIONS} clear
fi
fi fi
done done

View File

@@ -44,12 +44,14 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT} [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ $PRODUCT = shorewall ]; then if [ -x ${STATEDIR}/firewall ]; then
return 0
elif [ $PRODUCT = shorewall ]; then
${SBINDIR}/shorewall compile ${SBINDIR}/shorewall compile
elif [ $PRODUCT = shorewall6 ]; then elif [ $PRODUCT = shorewall6 ]; then
${SBINDIR}/shorewall -6 compile ${SBINDIR}/shorewall -6 compile
else else
return 0 return 1
fi fi
} }
@@ -75,15 +77,11 @@ start () {
retval=$? retval=$?
if [ $retval -eq 0 ]; then if [ $retval -eq 0 ]; then
if [ -x "${STATEDIR}/firewall" ]; then ${STATEDIR}/firewall ${OPTIONS} stop 2>&1 | $logger
${STATEDIR}/firewall ${OPTIONS} stop 2>&1 | $logger retval=${PIPESTATUS[0]}
retval=${PIPESTATUS[0]} [ $retval -ne 0 ] && break
[ $retval -ne 0 ] && break
else
retval=6 #Product not configured
break
fi
else else
retval=6 #Product not configured
break break
fi fi
done done
@@ -110,15 +108,11 @@ stop () {
retval=$? retval=$?
if [ $retval -eq 0 ]; then if [ $retval -eq 0 ]; then
if [ -x "${STATEDIR}/firewall" ]; then ${STATEDIR}/firewall ${OPTIONS} clear 2>&1 | $logger
${STATEDIR}/firewall ${OPTIONS} clear 2>&1 | $logger retval=${PIPESTATUS[0]}
retval=${PIPESTATUS[0]} [ $retval -ne 0 ] && break
[ $retval -ne 0 ] && break
else
retval=6 #Product not configured
break
fi
else else
retval=6 #Product not configured
break break
fi fi
done done

20
Shorewall-init/init.openwrt.sh Normal file → Executable file
View File

@@ -75,12 +75,14 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT} [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ $PRODUCT = shorewall ]; then if [ -x ${STATEDIR}/firewall ]; then
return 0
elif [ $PRODUCT = shorewall ]; then
${SBINDIR}/shorewall compile ${SBINDIR}/shorewall compile
elif [ $PRODUCT = shorewall6 ]; then elif [ $PRODUCT = shorewall6 ]; then
${SBINDIR}/shorewall -6 compile ${SBINDIR}/shorewall -6 compile
else else
return 0 return 1
fi fi
} }
@@ -92,10 +94,8 @@ start () {
printf "Initializing \"Shorewall-based firewalls\": " printf "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if setstatedir; then if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then ${STATEDIR}/firewall ${OPTIONS} stop
${STATEDIR}/firewall ${OPTIONS} stop
fi
fi fi
fi fi
done done
@@ -103,6 +103,8 @@ start () {
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
ipset -R < "$SAVE_IPSETS" ipset -R < "$SAVE_IPSETS"
fi fi
return 0
} }
boot () { boot () {
@@ -117,9 +119,7 @@ stop () {
printf "Clearing \"Shorewall-based firewalls\": " printf "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if setstatedir; then if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then ${STATEDIR}/firewall ${OPTIONS} clear
${STATEDIR}/firewall ${OPTIONS} clear
fi
fi fi
done done
@@ -131,5 +131,7 @@ stop () {
rm -f "${SAVE_IPSETS}.tmp" rm -f "${SAVE_IPSETS}.tmp"
fi fi
fi fi
return 0
} }

View File

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

View File

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

View File

@@ -33,12 +33,12 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT} [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ $PRODUCT = shorewall ]; then if [ -x ${STATEDIR}/firewall ]; then
return 0
elif [ $PRODUCT = shorewall ]; then
${SBINDIR}/shorewall compile ${SBINDIR}/shorewall compile
elif [ $PRODUCT = shorewall6 ]; then elif [ $PRODUCT = shorewall6 ]; then
${SBINDIR}/shorewall -6 compile ${SBINDIR}/shorewall -6 compile
else
return 0
fi fi
} }
@@ -67,16 +67,14 @@ shorewall_start () {
printf "Initializing \"Shorewall-based firewalls\": " printf "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if setstatedir; then if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then #
# # Run in a sub-shell to avoid name collisions
# Run in a sub-shell to avoid name collisions #
# (
( if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then ${STATEDIR}/firewall ${OPTIONS} stop
${STATEDIR}/firewall ${OPTIONS} stop fi
fi )
)
fi
fi fi
done done
@@ -95,9 +93,7 @@ shorewall_stop () {
printf "Clearing \"Shorewall-based firewalls\": " printf "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if setstatedir; then if setstatedir; then
if [ -x ${STATEDIR}/firewall ]; then ${STATEDIR}/firewall ${OPTIONS} clear
${STATEDIR}/firewall ${OPTIONS} clear
fi
fi fi
done done

View File

@@ -1,11 +1,11 @@
# #
# Shorewall -- /usr/share/shorewall/action.A_REJECTWITH # Shorewall -- /usr/share/shorewall/action.A_REJECT
# #
# A_REJECT Action. # A_REJECT Action.
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -13,7 +13,6 @@ DEFAULTS ACCEPT
@1 - - icmp time-exceeded {comment="Needed ICMP types"} @1 - - icmp time-exceeded {comment="Needed ICMP types"}
?else ?else
?COMMENT Needed ICMP types (RFC4890) ?COMMENT Needed ICMP types (RFC4890)
@1 - - ipv6-icmp destination-unreachable @1 - - ipv6-icmp destination-unreachable
@1 - - ipv6-icmp packet-too-big @1 - - ipv6-icmp packet-too-big
@1 - - ipv6-icmp time-exceeded @1 - - ipv6-icmp time-exceeded
@@ -38,7 +37,7 @@ DEFAULTS ACCEPT
@1 - - ipv6-icmp 148 # Certificate path solicitation @1 - - ipv6-icmp 148 # Certificate path solicitation
@1 - - ipv6-icmp 149 # Certificate path advertisement @1 - - ipv6-icmp 149 # Certificate path advertisement
# The following should have a link local source address and a ttl of 1 and must be allowed to transit abridge # The following should have a link local source address and a ttl of 1 and must be allowed to transit a bridge
@1 fe80::/10 - ipv6-icmp 151 # Multicast router advertisement @1 fe80::/10 - ipv6-icmp 151 # Multicast router advertisement
@1 fe80::/10 - ipv6-icmp 152 # Multicast router solicitation @1 fe80::/10 - ipv6-icmp 152 # Multicast router solicitation
@1 fe80::/10 - ipv6-icmp 153 # Multicast router termination @1 fe80::/10 - ipv6-icmp 153 # Multicast router termination

View File

@@ -3,7 +3,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -30,4 +30,4 @@
DEFAULTS ACCEPT,- DEFAULTS ACCEPT,-
@1 - - ;;+ -p 6 --tcp-flags ACK,FIN,PSH ACK,FIN,PSH @1 - - ;;+ -p 6 --tcp-flags ACK,FIN ACK,FIN

View File

@@ -4,7 +4,7 @@
# Invalid Action # Invalid Action
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -3,7 +3,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -26,4 +26,4 @@ $tcpflags_action - - ;;+ -p 6 --tcp-flags ALL FIN,URG,PSH
$tcpflags_action - - ;;+ -p 6 --tcp-flags ALL NONE $tcpflags_action - - ;;+ -p 6 --tcp-flags ALL NONE
$tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,RST SYN,RST $tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,RST SYN,RST
$tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,FIN SYN,FIN $tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,FIN SYN,FIN
$tcpflags_action - - ;;+ -p tcp --syn --sport 0 $tcpflags_action - - ;;+ -p 6 --syn --sport 0

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -3,7 +3,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -15,6 +15,7 @@ PARAM - - tcp 3668,3669 # Virtual Media, Secure (Dell)
PARAM - - tcp 5120,5123 # CD, floppy (Asus, Aten) PARAM - - tcp 5120,5123 # CD, floppy (Asus, Aten)
PARAM - - tcp 5900,5901 # Remote Console (Aten, Dell) PARAM - - tcp 5900,5901 # Remote Console (Aten, Dell)
PARAM - - tcp 7578 # Remote Console (AMI) PARAM - - tcp 7578 # Remote Console (AMI)
PARAM - - tcp 3520 # Remote Console (Redfish)
PARAM - - udp 623 # RMCP PARAM - - udp 623 # RMCP
HTTP HTTP
HTTPS HTTPS

View File

@@ -1,82 +0,0 @@
# Shorewall Packet Filtering Firewall Export Directory Makefile - V4.2
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://www.shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
################################################################################
# Place this file in each export directory. Modify each copy to set HOST
# to the name of the remote firewall corresponding to the directory.
#
# To make the 'firewall' script, type "make".
#
# Once the script is compiling correctly, you can install it by
# typing "make install".
#
################################################################################
# V A R I A B L E S
#
# Files in the export directory on which the firewall script does not depend
#
IGNOREFILES = firewall% Makefile% trace% %~
#
# Remote Firewall system
#
HOST = gateway
#
# Save some typing
#
LITEDIR = /var/lib/shorewall-lite
#
# Set this if the remote system has a non-standard modules directory
#
MODULESDIR=
#
# Default target is the firewall script
#
################################################################################
# T A R G E T S
#
all: firewall
#
# Only generate the capabilities file if it doesn't already exist
#
capabilities:
ssh root@$(HOST) "MODULESDIR=$(MODULESDIR) /usr/share/shorewall-lite/shorecap > $(LITEDIR)/capabilities"
scp root@$(HOST):$(LITEDIR)/capabilities .
#
# Compile the firewall script. Using the 'wildcard' function causes "*" to be expanded so that
# 'filter-out' will be presented with the list of files in this directory rather than "*"
#
firewall: $(filter-out $(IGNOREFILES) capabilities , $(wildcard *) ) capabilities
shorewall compile -e . firewall
#
# Only reload on demand.
#
install: firewall
scp firewall firewall.conf root@$(HOST):$(LITEDIR)
ssh root@$(HOST) "/sbin/shorewall-lite restart"
#
# Save running configuration
#
save:
ssh root@$(HOST) "/sbin/shorewall-lite save"
#
# Remove generated files
#
clean:
rm -f capabilities firewall firewall.conf reload

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Accounting.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Accounting.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Chains.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Chains.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -1403,13 +1403,15 @@ sub compatible( $$ ) {
} }
# #
# Don't combine chains where each specifies # Don't combine chains where each specifies
# -m policy # -m policy and the policies are different
# or when one specifies # or when one specifies
# -m multiport # -m multiport
# and the other specifies # and the other specifies
# --dport or --sport or -m multiport # --dport or --sport or -m multiport
# #
return ! ( $ref1->{policy} && $ref2->{policy} || my ( $p1, $p2 );
return ! ( ( ( $p1 = $ref1->{policy} ) && ( $p2 = $ref2->{policy} ) && $p1 ne $p2 ) ||
( ( $ref1->{multiport} && ( $ref2->{dport} || $ref2->{sport} || $ref2->{multiport} ) ) || ( ( $ref1->{multiport} && ( $ref2->{dport} || $ref2->{sport} || $ref2->{multiport} ) ) ||
( $ref2->{multiport} && ( $ref1->{dport} || $ref1->{sport} ) ) ) ); ( $ref2->{multiport} && ( $ref1->{dport} || $ref1->{sport} ) ) ) );
} }
@@ -3673,7 +3675,7 @@ sub optimize_level4( $$ ) {
# #
delete_chain_and_references( $chainref ); delete_chain_and_references( $chainref );
$progress = 1; $progress = 1;
} elsif ( $chainref->{builtin} || ! $globals{KLUDGEFREE} || $firstrule->{policy} ) { } elsif ( $chainref->{builtin} || ! $globals{KLUDGEFREE} ) {
# #
# This case requires a new rule merging algorithm. Ignore this chain from # This case requires a new rule merging algorithm. Ignore this chain from
# now on. # now on.
@@ -4780,6 +4782,7 @@ sub do_proto( $$$;$ )
if ( $proto ne '' ) { if ( $proto ne '' ) {
my $synonly = ( $proto =~ s/:(!)?syn$//i ); my $synonly = ( $proto =~ s/:(!)?syn$//i );
my $all = ( $proto =~ s/:all$//i );
my $notsyn = $1; my $notsyn = $1;
my $invert = ( $proto =~ s/^!// ? '! ' : '' ); my $invert = ( $proto =~ s/^!// ? '! ' : '' );
my $protonum = resolve_proto $proto; my $protonum = resolve_proto $proto;
@@ -4795,6 +4798,7 @@ sub do_proto( $$$;$ )
# $proto now contains the protocol number and $pname contains the canonical name of the protocol # $proto now contains the protocol number and $pname contains the canonical name of the protocol
# #
unless ( $synonly ) { unless ( $synonly ) {
fatal_error '":all" is only allowed with tcp' if $all && $proto != TCP;
$output = "${invert}-p ${proto} "; $output = "${invert}-p ${proto} ";
} else { } else {
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert; fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
@@ -4934,6 +4938,8 @@ sub do_proto( $$$;$ )
} else { } else {
fatal_error '":syn" is only allowed with tcp' if $synonly; fatal_error '":syn" is only allowed with tcp' if $synonly;
$proto = $proto . ':all' if $all;
if ( $proto =~ /^(ipp2p(:(tcp|udp|all))?)$/i ) { if ( $proto =~ /^(ipp2p(:(tcp|udp|all))?)$/i ) {
my $p = $2 ? lc $3 : 'tcp'; my $p = $2 ? lc $3 : 'tcp';
require_capability( 'IPP2P_MATCH' , "PROTO = $proto" , 's' ); require_capability( 'IPP2P_MATCH' , "PROTO = $proto" , 's' );
@@ -4990,6 +4996,7 @@ sub do_iproto( $$$ )
if ( $proto ne '' ) { if ( $proto ne '' ) {
my $synonly = ( $proto =~ s/:syn$//i ); my $synonly = ( $proto =~ s/:syn$//i );
my $all = ( $proto =~ s/:all$//i );
my $invert = ( $proto =~ s/^!// ? '! ' : '' ); my $invert = ( $proto =~ s/^!// ? '! ' : '' );
my $protonum = resolve_proto $proto; my $protonum = resolve_proto $proto;
@@ -5004,6 +5011,7 @@ sub do_iproto( $$$ )
# $proto now contains the protocol number and $pname contains the canonical name of the protocol # $proto now contains the protocol number and $pname contains the canonical name of the protocol
# #
unless ( $synonly ) { unless ( $synonly ) {
fatal_error '":all" is only allowed with tcp' if $all && $proto != TCP;
@output = ( p => "${invert}${proto}" ); @output = ( p => "${invert}${proto}" );
} else { } else {
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert; fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
@@ -5138,6 +5146,8 @@ sub do_iproto( $$$ )
} else { } else {
fatal_error '":syn" is only allowed with tcp' if $synonly; fatal_error '":syn" is only allowed with tcp' if $synonly;
$proto = $proto . ':all' if $all;
if ( $proto =~ /^(ipp2p(:(tcp|udp|all))?)$/i ) { if ( $proto =~ /^(ipp2p(:(tcp|udp|all))?)$/i ) {
my $p = $2 ? lc $3 : 'tcp'; my $p = $2 ? lc $3 : 'tcp';
require_capability( 'IPP2P_MATCH' , "PROTO = $proto" , 's' ); require_capability( 'IPP2P_MATCH' , "PROTO = $proto" , 's' );

View File

@@ -4,7 +4,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -59,7 +59,7 @@ our $have_arptables;
# Initilize the package-globals in the other modules # Initilize the package-globals in the other modules
# #
sub initialize_package_globals( $$$ ) { sub initialize_package_globals( $$$ ) {
Shorewall::Config::initialize($family, $_[1], $_[2]); Shorewall::Config::initialize($family, $export, $_[1], $_[2]);
Shorewall::Chains::initialize ($family, 1, $export ); Shorewall::Chains::initialize ($family, 1, $export );
Shorewall::Zones::initialize ($family, $_[0]); Shorewall::Zones::initialize ($family, $_[0]);
Shorewall::Nat::initialize($family); Shorewall::Nat::initialize($family);
@@ -692,6 +692,7 @@ sub compiler {
set_timestamp( $timestamp ); set_timestamp( $timestamp );
set_debug( $debug , $confess ); set_debug( $debug , $confess );
# #
# S H O R E W A L L R C ,
# S H O R E W A L L . C O N F A N D C A P A B I L I T I E S # S H O R E W A L L . C O N F A N D C A P A B I L I T I E S
# #
get_configuration( $export , $update , $annotate , $inline ); get_configuration( $export , $update , $annotate , $inline );
@@ -796,13 +797,10 @@ sub compiler {
emit '}'; # End of setup_common_rules() emit '}'; # End of setup_common_rules()
} }
disable_script;
# #
# R O U T I N G _ A N D _ T R A F F I C _ S H A P I N G # R O U T I N G _ A N D _ T R A F F I C _ S H A P I N G
# (Writes the setup_routing_and_traffic_shaping() function to the compiled script) # (Writes the setup_routing_and_traffic_shaping() function to the compiled script)
# #
enable_script;
#
# Validate the TC files so that the providers will know what interfaces have TC # Validate the TC files so that the providers will know what interfaces have TC
# #
my $tcinterfaces = process_tc; my $tcinterfaces = process_tc;

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Config.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Config.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -30,6 +30,84 @@
# into those files (emitters) and finalizing those files (renaming # into those files (emitters) and finalizing those files (renaming
# them to their final name and setting their mode appropriately). # them to their final name and setting their mode appropriately).
# #
# A significant portion of this module is dedicated to the preprocessor:
#
# process_compiler_directive() - processes compiler directives
#
# embedded_shell() - handles embedded shell scripting
#
# embedded_perl() - handles embedded perl scripting
#
# read_a_line() - Reads the next configuration file record to
# be passed to the function processing the file.
#
# - Detects compiler directives and passes then to
# process_compiler_directive() for handling.
#
# - Handles line continuation
#
# - Invokes a callback when the first (concatinated) non-directive
# record is read from a file.
#
# - Conditionally expands variables.
#
# - Conditionally detects embedded Shell and Perl and passes them
# off to embedded_shell() and embedded_perl() respectively.
#
# - Conditionally detects and handles [?}INCLUDE directives.
#
# - Conditionally detects and handles ?SECTION directives.
# File processing functions can supply a callback to be
# called during this processing.
#
# File processing routines may need to open a second (third, fourth, ...)
# file while processing the main file (macro and/or action files). Two
# functions are provided to make that possible:
#
# push_open() - open a file while leaving the current file open.
#
# pop_open() - close the current file, and make the previous
# file (if any) the current one.
#
# Because this module expands variables, it must be aware of action
# parameters.
#
# push_action_params() - populates the %actparams hash and
# returns a reference to the previous
# contents of that hash. The caller is
# expected to store those contents locally.
#
# pop_action_params() - Restores the %actparams hash from
# the reference returned by
# push_action_params().
#
# The following routines are provided for INLINE PERL within
# action bodies:
#
# default_action_params() - called to fill in omitted
# arguments when a DEFAULTS
# line is encountered.
#
# get_action_params() - returns an array of arguments.
#
# setup_audit_action() - helper for A_* actions.
#
# get_action_logging() - returns log level and tag
# from the action's invocation.
#
# get_action_chain_name() - returns chain name.
#
# set_action_name_to_caller() - replace chain name
# with that of invoking
# chain for logging purposes.
#
# set_action_disposition() - set the current action
# disposition for logging purposes.
#
# get_action_disposition() - get the current action disposition.
#
# set_action_param() - set the value of an argument.
#
package Shorewall::Config; package Shorewall::Config;
use strict; use strict;
@@ -42,6 +120,7 @@ use autouse 'Carp' => qw(longmess confess);
use Scalar::Util 'reftype'; use Scalar::Util 'reftype';
use FindBin; use FindBin;
use Digest::SHA qw(sha1_hex); use Digest::SHA qw(sha1_hex);
use Errno qw(:POSIX);
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
# #
@@ -596,6 +675,7 @@ our $debug; # Global debugging flag
our $confess; # If true, use Carp to report errors with stack trace. our $confess; # If true, use Carp to report errors with stack trace.
our $family; # Protocol family (4 or 6) our $family; # Protocol family (4 or 6)
our $export; # True when compiling for export
our $toolname; # Name of the tool to use (iptables or iptables6) our $toolname; # Name of the tool to use (iptables or iptables6)
our $toolNAME; # Tool name in CAPS our $toolNAME; # Tool name in CAPS
our $product; # Name of product that will run the generated script our $product; # Name of product that will run the generated script
@@ -709,8 +789,8 @@ sub add_variables( \% );
# 2. The compiler can run multiple times in the same process so it has to be # 2. The compiler can run multiple times in the same process so it has to be
# able to re-initialize its dependent modules' state. # able to re-initialize its dependent modules' state.
# #
sub initialize( $;$$) { sub initialize( $;$$$) {
( $family, my ( $shorewallrc, $shorewallrc1 ) ) = @_; ( $family, $export, my ( $shorewallrc, $shorewallrc1 ) ) = @_;
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
( $product, $Product, $toolname, $toolNAME ) = qw( shorewall Shorewall iptables IPTABLES ); ( $product, $Product, $toolname, $toolNAME ) = qw( shorewall Shorewall iptables IPTABLES );
@@ -754,7 +834,7 @@ sub initialize( $;$$) {
TC_SCRIPT => '', TC_SCRIPT => '',
EXPORT => 0, EXPORT => 0,
KLUDGEFREE => '', KLUDGEFREE => '',
VERSION => "5.1.5-RC1", VERSION => "5.1.8-Beta1",
CAPVERSION => 50106 , CAPVERSION => 50106 ,
BLACKLIST_LOG_TAG => '', BLACKLIST_LOG_TAG => '',
RELATED_LOG_TAG => '', RELATED_LOG_TAG => '',
@@ -1009,7 +1089,7 @@ sub initialize( $;$$) {
CONNLIMIT_MATCH => undef, CONNLIMIT_MATCH => undef,
TIME_MATCH => undef, TIME_MATCH => undef,
GOTO_TARGET => undef, GOTO_TARGET => undef,
LOG_TARGET => 1, # Assume that we have it. LOG_TARGET => undef,
ULOG_TARGET => undef, ULOG_TARGET => undef,
NFLOG_TARGET => undef, NFLOG_TARGET => undef,
LOGMARK_TARGET => undef, LOGMARK_TARGET => undef,
@@ -1993,6 +2073,7 @@ sub find_file($)
for my $directory ( @config_path ) { for my $directory ( @config_path ) {
my $file = "$directory$filename"; my $file = "$directory$filename";
return $file if -f $file; return $file if -f $file;
$!{ENOENT} || fatal_error "Unable to access $file: " . $!;
} }
"$config_path[0]$filename"; "$config_path[0]$filename";
@@ -2575,7 +2656,7 @@ sub open_file( $;$$$$ ) {
$max_format = supplied $mf ? $mf : 1; $max_format = supplied $mf ? $mf : 1;
$comments_allowed = supplied $ca ? $ca : 0; $comments_allowed = supplied $ca ? $ca : 0;
$nocomment = $nc; $nocomment = $nc;
do_open_file $fname;; do_open_file $fname;
} else { } else {
$ifstack = @ifstack; $ifstack = @ifstack;
''; '';
@@ -5248,7 +5329,13 @@ sub ensure_config_path() {
fatal_error "CONFIG_PATH not found in $f" unless $config{CONFIG_PATH}; fatal_error "CONFIG_PATH not found in $f" unless $config{CONFIG_PATH};
} }
@config_path = split /:/, $config{CONFIG_PATH}; my $path = $config{CONFIG_PATH};
my $chop = ( $path =~ s/^:// );
@config_path = split /:/, $path;
shift @config_path if $chop && ( $export || $> != 0 );
# #
# To accomodate Cygwin-based compilation, we have separate directories for files whose names # To accomodate Cygwin-based compilation, we have separate directories for files whose names
@@ -6404,7 +6491,7 @@ sub get_configuration( $$$$ ) {
default_yes_no 'USE_DEFAULT_RT' , ''; default_yes_no 'USE_DEFAULT_RT' , '';
default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes'; default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes';
default_yes_no 'AUTOMAKE' , ''; default_yes_no 'AUTOMAKE' , '';
default_yes_no 'TRACK_PROVIDERS' , ''; default_yes_no 'TRACK_PROVIDERS' , 'Yes';
default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : ''; default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : '';
default_yes_no 'USE_NFLOG_SIZE' , ''; default_yes_no 'USE_NFLOG_SIZE' , '';

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/IPAddrs.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/IPAddrs.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2015 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Misc.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Misc.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -2448,7 +2448,7 @@ sub setup_mss( ) {
my $clampmss = $config{CLAMPMSS}; my $clampmss = $config{CLAMPMSS};
my $option; my $option;
my @match; my @match;
my $chainref = $filter_table->{FORWARD}; my $chainref = $mangle_table->{FORWARD};
if ( $clampmss ) { if ( $clampmss ) {
if ( "\L$clampmss" eq 'yes' ) { if ( "\L$clampmss" eq 'yes' ) {

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Nat.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Nat.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Providers.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Providers.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -125,7 +125,7 @@ sub initialize( $ ) {
# Set up marking for 'tracked' interfaces. # Set up marking for 'tracked' interfaces.
# #
sub setup_route_marking() { sub setup_route_marking() {
my $mask = in_hex( $globals{PROVIDER_MASK} ); my $mask = in_hex( $globals{PROVIDER_MASK} );
my $exmask = have_capability( 'EXMARK' ) ? "/$mask" : ''; my $exmask = have_capability( 'EXMARK' ) ? "/$mask" : '';
require_capability( $_ , q(The provider 'track' option) , 's' ) for qw/CONNMARK_MATCH CONNMARK/; require_capability( $_ , q(The provider 'track' option) , 's' ) for qw/CONNMARK_MATCH CONNMARK/;
@@ -161,6 +161,15 @@ sub setup_route_marking() {
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref, $origin, i => $physical, mark => "--mark 0/$mask"; add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref, $origin, i => $physical, mark => "--mark 0/$mask";
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref1, $origin, i => "! $physical", mark => "--mark $mark/$mask"; add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref1, $origin, i => "! $physical", mark => "--mark $mark/$mask";
add_ijump_extended $mangle_table->{OUTPUT} , j => $chainref2, $origin, mark => "--mark $mark/$mask"; add_ijump_extended $mangle_table->{OUTPUT} , j => $chainref2, $origin, mark => "--mark $mark/$mask";
if ( have_ipsec ) {
if ( have_capability( 'MARK_ANYWHERE' ) ) {
add_ijump_extended $filter_table->{forward_chain($interface)}, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", , state_imatch('NEW'), policy => '--dir in --pol ipsec';
} elsif ( have_capability( 'MANGLE_FORWARD' ) ) {
add_ijump_extended $mangle_table->{FORWARD}, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", i => $physical, state_imatch('NEW'), policy => '--dir in --pol ipsec';
}
}
$marked_interfaces{$interface} = 1; $marked_interfaces{$interface} = 1;
} }
@@ -512,6 +521,9 @@ sub process_a_provider( $ ) {
set_interface_option( $interface, 'gateway', 'none' ); set_interface_option( $interface, 'gateway', 'none' );
} elsif ( $gateway && $gateway ne '-' ) { } elsif ( $gateway && $gateway ne '-' ) {
( $gateway, $mac ) = split_host_list( $gateway, 0 ); ( $gateway, $mac ) = split_host_list( $gateway, 0 );
$gateway = $1 if $family == F_IPV6 && $gateway =~ /^\[(.+)\]$/;
validate_address $gateway, 0; validate_address $gateway, 0;
if ( defined $mac ) { if ( defined $mac ) {
@@ -602,6 +614,7 @@ sub process_a_provider( $ ) {
} elsif ( $option eq 'nohostroute' ) { } elsif ( $option eq 'nohostroute' ) {
$hostroute = 0; $hostroute = 0;
} elsif ( $option eq 'persistent' ) { } elsif ( $option eq 'persistent' ) {
warning_message "When RESTORE_DEFAULT_ROUTE=Yes, the 'persistent' option may not work as expected" if $config{RESTORE_DEFAULT_ROUTE};
$persistent = 1; $persistent = 1;
} else { } else {
fatal_error "Invalid option ($option)"; fatal_error "Invalid option ($option)";
@@ -688,7 +701,6 @@ sub process_a_provider( $ ) {
$pref = 10000 + $number - 1; $pref = 10000 + $number - 1;
} }
} }
unless ( $loose || $pseudo ) { unless ( $loose || $pseudo ) {
@@ -847,7 +859,7 @@ sub add_a_provider( $$ ) {
if ( $tproxy ) { if ( $tproxy ) {
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id"; emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
} else { } else {
emit "run_ip route add default dev $physical table $id"; emit "run_ip route replace default dev $physical table $id";
} }
} }
@@ -863,7 +875,7 @@ sub add_a_provider( $$ ) {
emit qq(echo "\$IP route del $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing); emit qq(echo "\$IP route del $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
} }
emit( "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm" ); emit( "run_ip route replace default via $gateway src $address dev $physical ${mtu}table $id $realm" );
emit( qq( echo "\$IP route del default via $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) ); emit( qq( echo "\$IP route del default via $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) );
} }
@@ -873,24 +885,24 @@ sub add_a_provider( $$ ) {
emit( "run_ip rule add from $address pref 20000 table $id" , emit( "run_ip rule add from $address pref 20000 table $id" ,
"echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" ); "echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" );
} else { } else {
emit ( "find_interface_addresses $physical | while read address; do" ); emit ( "find_interface_addresses $physical | while read address; do",
emit ( " qt \$IP -$family rule del from \$address" ); " qt \$IP -$family rule del from \$address",
emit ( " run_ip rule add from \$address pref 20000 table $id", " run_ip rule add from \$address pref 20000 table $id",
" echo \"\$IP -$family rule del from \$address pref 20000 > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing", " echo \"\$IP -$family rule del from \$address pref 20000 > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing",
' rulenum=$(($rulenum + 1))', ' rulenum=$(($rulenum + 1))',
'done' 'done'
); );
} }
}
if ( @{$providerref->{persistent_routes}} ) { if ( @{$providerref->{persistent_routes}} ) {
emit ''; emit '';
emit $_ for @{$providers{$table}->{persistent_routes}}; emit $_ for @{$providers{$table}->{persistent_routes}};
} }
if ( @{$providerref->{persistent_rules}} ) { if ( @{$providerref->{persistent_rules}} ) {
emit ''; emit '';
emit $_ for @{$providers{$table}->{persistent_rules}}; emit $_ for @{$providers{$table}->{persistent_rules}};
}
} }
pop_indent; pop_indent;
@@ -898,7 +910,6 @@ sub add_a_provider( $$ ) {
emit( qq(fi\n), emit( qq(fi\n),
qq(echo 1 > \${VARDIR}/${physical}_disabled) ); qq(echo 1 > \${VARDIR}/${physical}_disabled) );
pop_indent; pop_indent;
emit( "}\n" ); emit( "}\n" );
@@ -924,7 +935,7 @@ sub add_a_provider( $$ ) {
if ( $tproxy ) { if ( $tproxy ) {
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id"; emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
} else { } else {
emit "run_ip route add default dev $physical table $id"; emit "run_ip route replace default dev $physical table $id";
} }
} }
} }
@@ -956,7 +967,7 @@ CEOF
my $hexmark = in_hex( $mark ); my $hexmark = in_hex( $mark );
my $mask = have_capability( 'FWMARK_RT_MASK' ) ? '/' . in_hex( $globals{ $tproxy && ! $local ? 'TPROXY_MARK' : 'PROVIDER_MASK' } ) : ''; my $mask = have_capability( 'FWMARK_RT_MASK' ) ? '/' . in_hex( $globals{ $tproxy && ! $local ? 'TPROXY_MARK' : 'PROVIDER_MASK' } ) : '';
emit ( "qt \$IP -$family rule del fwmark ${hexmark}${mask}" ) if $config{DELETE_THEN_ADD}; emit ( "qt \$IP -$family rule del fwmark ${hexmark}${mask}" ) if $persistent || $config{DELETE_THEN_ADD};
emit ( "run_ip rule add fwmark ${hexmark}${mask} pref $pref table $id", emit ( "run_ip rule add fwmark ${hexmark}${mask} pref $pref table $id",
"echo \"\$IP -$family rule del fwmark ${hexmark}${mask} > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" "echo \"\$IP -$family rule del fwmark ${hexmark}${mask} > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing"
@@ -985,7 +996,7 @@ CEOF
emit qq(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}table $id $realm);
} }
emit "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm"; emit "run_ip route replace default via $gateway src $address dev $physical ${mtu}table $id $realm";
} }
if ( $balance ) { if ( $balance ) {
@@ -997,14 +1008,16 @@ CEOF
emit ''; emit '';
if ( $gateway ) { if ( $gateway ) {
emit qq(run_ip route replace $gateway/32 dev $physical table $id) if $hostroute; emit qq(run_ip route replace $gateway/32 dev $physical table $id) if $hostroute;
emit qq(run_ip route add default via $gateway src $address dev $physical table $id metric $number); emit qq(run_ip route replace default via $gateway src $address dev $physical table $id metric $number);
emit qq(echo "\$IP -$family route del default via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing); emit qq(echo "\$IP -$family route del default via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
emit qq(echo "\$IP -4 route del $gateway/32 dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) if $family == F_IPV4; emit qq(echo "\$IP -4 route del $gateway/32 dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) if $family == F_IPV4;
} else { } else {
emit qq(run_ip route add default table $id dev $physical metric $number); emit qq(run_ip route replace default table $id dev $physical metric $number);
emit qq(echo "\$IP -$family route del default dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing); emit qq(echo "\$IP -$family route del default dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
} }
emit( 'g_fallback=Yes' ) if $persistent;
$metrics = 1; $metrics = 1;
} }
@@ -1026,12 +1039,13 @@ CEOF
} elsif ( ! $noautosrc ) { } elsif ( ! $noautosrc ) {
if ( $shared ) { if ( $shared ) {
if ( $persistent ) { if ( $persistent ) {
emit( qq(if ! egrep -q "^2000:[[:space:]]+from $address lookup $id"; then), emit( qq(if ! egrep -q "^20000:[[:space:]]+from $address lookup $id"; then),
qq( qt \$IP -$family rule del from $address pref 20000),
qq( run_ip rule add from $address pref 20000 table $id), qq( run_ip rule add from $address pref 20000 table $id),
qq( echo "\$IP -$family rule del from $address pref 20000> /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing ), qq( echo "\$IP -$family rule del from $address pref 20000> /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing ),
qq(fi) ); qq(fi) );
} else { } else {
emit "qt \$IP -$family rule del from $address" if $config{DELETE_THEN_ADD}; emit "qt \$IP -$family rule del from $address" if $persistent || $config{DELETE_THEN_ADD};
emit( "run_ip rule add from $address pref 20000 table $id" , emit( "run_ip rule add from $address pref 20000 table $id" ,
"echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" ); "echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" );
} }
@@ -1092,6 +1106,17 @@ CEOF
$pseudo ? "run_enabled_exit ${physical} ${interface}" : "run_enabled_exit ${physical} ${interface} ${table}" $pseudo ? "run_enabled_exit ${physical} ${interface}" : "run_enabled_exit ${physical} ${interface} ${table}"
); );
if ( ! $pseudo && $config{USE_DEFAULT_RT} && $config{RESTORE_DEFAULT_ROUTE} ) {
emit ( '#',
'# We now have a viable default route in the \'default\' table so delete any default routes in the main table',
'#',
'while qt \$IP -$family route del default table ' . MAIN_TABLE . '; do',
' true',
'done',
''
);
}
emit_started_message( '', 2, $pseudo, $table, $number ); emit_started_message( '', 2, $pseudo, $table, $number );
if ( get_interface_option( $interface, 'used_address_variable' ) || get_interface_option( $interface, 'used_gateway_variable' ) ) { if ( get_interface_option( $interface, 'used_address_variable' ) || get_interface_option( $interface, 'used_gateway_variable' ) ) {
@@ -1344,7 +1369,7 @@ sub add_an_rtrule1( $$$$$ ) {
$priority = "pref $priority"; $priority = "pref $priority";
push @{$providerref->{rules}}, "qt \$IP -$family rule del $source ${dest}${mark} $priority" if $config{DELETE_THEN_ADD}; push @{$providerref->{rules}}, "qt \$IP -$family rule del $source ${dest}${mark} $priority" if $persistent || $config{DELETE_THEN_ADD};
push @{$providerref->{rules}}, "run_ip rule add $source ${dest}${mark} $priority table $id"; push @{$providerref->{rules}}, "run_ip rule add $source ${dest}${mark} $priority table $id";
if ( $persistent ) { if ( $persistent ) {
@@ -1442,22 +1467,22 @@ sub add_a_route( ) {
if ( $gateway ne '-' ) { if ( $gateway ne '-' ) {
if ( $device ne '-' ) { if ( $device ne '-' ) {
push @$routes, qq(run_ip route add $dest via $gateway dev $physical table $id); push @$routes, qq(run_ip route replace $dest via $gateway dev $physical table $id);
push @$persistent_routes, qq(run_ip route add $dest via $gateway dev $physical table $id) if $persistent; push @$persistent_routes, qq(run_ip route replace $dest via $gateway dev $physical table $id) if $persistent;
push @$routes, q(echo "$IP ) . qq(-$family route del $dest via $gateway dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE; push @$routes, q(echo "$IP ) . qq(-$family route del $dest via $gateway dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
} elsif ( $null ) { } elsif ( $null ) {
push @$routes, qq(run_ip route add $null $dest table $id); push @$routes, qq(run_ip route replace $null $dest table $id);
push @$persistent_routes, qq(run_ip route add $null $dest table $id) if $persistent; push @$persistent_routes, qq(run_ip route replace $null $dest table $id) if $persistent;
push @$routes, q(echo "$IP ) . qq(-$family route del $null $dest table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE; push @$routes, q(echo "$IP ) . qq(-$family route del $null $dest table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
} else { } else {
push @$routes, qq(run_ip route add $dest via $gateway table $id); push @$routes, qq(run_ip route replace $dest via $gateway table $id);
push @$persistent_routes, qq(run_ip route add $dest via $gateway table $id) if $persistent; push @$persistent_routes, qq(run_ip route replace $dest via $gateway table $id) if $persistent;
push @$routes, q(echo "$IP ) . qq(-$family route del $dest via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE; push @$routes, q(echo "$IP ) . qq(-$family route del $dest via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
} }
} else { } else {
fatal_error "You must specify a device for this route" unless $physical; fatal_error "You must specify a device for this route" unless $physical;
push @$routes, qq(run_ip route add $dest dev $physical table $id); push @$routes, qq(run_ip route replace $dest dev $physical table $id);
push @$persistent_routes, qq(run_ip route add $dest dev $physical table $id) if $persistent; push @$persistent_routes, qq(run_ip route replace $dest dev $physical table $id) if $persistent;
push @$routes, q(echo "$IP ) . qq(-$family route del $dest dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE; push @$routes, q(echo "$IP ) . qq(-$family route del $dest dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
} }
@@ -1559,7 +1584,7 @@ sub finish_providers() {
emit ( " run_ip route replace default scope global table $table \$DEFAULT_ROUTE" ); emit ( " run_ip route replace default scope global table $table \$DEFAULT_ROUTE" );
} else { } else {
emit ( " if echo \$DEFAULT_ROUTE | grep -q 'nexthop.+nexthop'; then", emit ( " if echo \$DEFAULT_ROUTE | grep -q 'nexthop.+nexthop'; then",
" qt \$IP -6 route delete default scope global table $table \$DEFAULT_ROUTE", " while qt \$IP -6 route delete default table $table; do true; done",
" run_ip route add default scope global table $table \$DEFAULT_ROUTE", " run_ip route add default scope global table $table \$DEFAULT_ROUTE",
' else', ' else',
" run_ip route replace default scope global table $table \$DEFAULT_ROUTE", " run_ip route replace default scope global table $table \$DEFAULT_ROUTE",
@@ -1580,7 +1605,7 @@ sub finish_providers() {
' error_message "WARNING: No Default route added (all \'balance\' providers are down)"' ); ' error_message "WARNING: No Default route added (all \'balance\' providers are down)"' );
if ( $config{RESTORE_DEFAULT_ROUTE} ) { if ( $config{RESTORE_DEFAULT_ROUTE} ) {
emit qq( restore_default_route $config{USE_DEFAULT_RT} && error_message "NOTICE: Default route restored") emit qq( [ -z "\${FALLBACK_ROUTE}\${g_fallback}" ] && restore_default_route $config{USE_DEFAULT_RT} && error_message "NOTICE: Default route restored")
} else { } else {
emit qq( qt \$IP -$family route del default table $table && error_message "WARNING: Default route deleted from table $table"); emit qq( qt \$IP -$family route del default table $table && error_message "WARNING: Default route deleted from table $table");
} }
@@ -1607,7 +1632,7 @@ sub finish_providers() {
} }
emit ( '#', emit ( '#',
'# Delete any routes in the \'balance\' table', '# Delete any default routes with metric 0 in the \'balance\' table',
'#', '#',
"while qt \$IP -$family route del default table $balance; do", "while qt \$IP -$family route del default table $balance; do",
' true', ' true',
@@ -1622,7 +1647,7 @@ sub finish_providers() {
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
emit( " run_ip route replace default scope global table $default \$FALLBACK_ROUTE" ); emit( " run_ip route replace default scope global table $default \$FALLBACK_ROUTE" );
} else { } else {
emit( " run_ip route delete default scope global table $default \$FALLBACK_ROUTE" ); emit( " while qt \$IP -6 route delete default table $default; do true; done" );
emit( " run_ip route add default scope global table $default \$FALLBACK_ROUTE" ); emit( " run_ip route add default scope global table $default \$FALLBACK_ROUTE" );
} }
@@ -1635,7 +1660,10 @@ sub finish_providers() {
'fi', 'fi',
'' ); '' );
} elsif ( $config{USE_DEFAULT_RT} ) { } elsif ( $config{USE_DEFAULT_RT} ) {
emit( "delete_default_routes $default", emit( '#',
'# No balanced fallback routes - delete any routes with metric 0 from the \'default\' table',
'#',
"delete_default_routes $default",
'' ''
); );
} }
@@ -1680,7 +1708,7 @@ sub process_providers( $ ) {
} }
if ( $providers ) { if ( $providers ) {
fatal_error q(Either all 'fallback' providers must specify a weight or non of them can specify a weight) if $fallback && $metrics; fatal_error q(Either all 'fallback' providers must specify a weight or none of them can specify a weight) if $fallback && $metrics;
my $fn = open_file( 'route_rules' ); my $fn = open_file( 'route_rules' );
@@ -1919,7 +1947,6 @@ sub setup_providers() {
emit "fi\n"; emit "fi\n";
} }
} }
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Proxyarp.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Proxyarp.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Raw.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Raw.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2009-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2009-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -91,7 +91,7 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
my $disposition = $action; my $disposition = $action;
my $exception_rule = ''; my $exception_rule = '';
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_condition( $switch , $chainref->{name} );
my $level = ''; my $level = '';
if ( $action =~ /^(?:NFLOG|ULOG)/ ) { if ( $action =~ /^(?:NFLOG|ULOG)/ ) {
@@ -138,6 +138,14 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
require_capability 'CT_TARGET', 'CT entries in the conntrack file', ''; require_capability 'CT_TARGET', 'CT entries in the conntrack file', '';
if ( $proto ne '-' ) {
if ( $proto =~ s/:all$// ) {
fatal_error '":all" may only be used with TCP' unless resolve_proto( $proto ) == TCP;
} else {
$proto = TCP . ':syn' if $proto !~ /:syn/ && resolve_proto( $proto ) == TCP;
}
}
if ( $option eq 'notrack' ) { if ( $option eq 'notrack' ) {
fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args; fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args;
$action = 'CT --notrack'; $action = 'CT --notrack';
@@ -199,7 +207,9 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
expand_rule( $chainref , expand_rule( $chainref ,
$restriction , $restriction ,
'', '',
$rule, do_proto( $proto, $ports, $sports ) .
do_user ( $user ) .
do_condition( $switch , $chainref->{name} ),
$source , $source ,
$dest , $dest ,
'' , '' ,

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Rules.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Rules.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -96,7 +96,7 @@ use constant { NULL_SECTION => 0x00,
INVALID_SECTION => 0x10, INVALID_SECTION => 0x10,
UNTRACKED_SECTION => 0x20, UNTRACKED_SECTION => 0x20,
NEW_SECTION => 0x40, NEW_SECTION => 0x40,
DEFAULTACTION_SECTION => 0x80 }; POLICYACTION_SECTION => 0x80 };
# #
# Number of elements in the action tuple # Number of elements in the action tuple
# #
@@ -927,6 +927,28 @@ sub process_policies()
# #
sub process_inline ($$$$$$$$$$$$$$$$$$$$$$); sub process_inline ($$$$$$$$$$$$$$$$$$$$$$);
#
# Determine the protocol to be used in the jump to the passed action
#
sub determine_action_protocol( $$ ) {
my ( $action, $proto ) = @_;
if ( my $actionproto = $actions{$action}{proto} ) {
if ( $proto eq '-' ) {
$proto = $actionproto;
} else {
if ( defined( my $protonum = resolve_proto( $proto ) ) ) {
fatal_error( "The $action action is only usable with " . proto_name( $actionproto ) ) unless $actionproto == $protonum;
$proto = $protonum;
} else {
fatal_error( "Unknown protocol ($proto)" );
}
}
}
$proto;
}
sub add_policy_rules( $$$$$ ) { sub add_policy_rules( $$$$$ ) {
my ( $chainref , $target, $loglevel, $pactions, $dropmulticast ) = @_; my ( $chainref , $target, $loglevel, $pactions, $dropmulticast ) = @_;
@@ -942,12 +964,16 @@ sub add_policy_rules( $$$$$ ) {
if ( ( $targets{$action} || 0 ) & ACTION ) { if ( ( $targets{$action} || 0 ) & ACTION ) {
# #
# Default action is a regular action -- jump to the action chain # Policy action is a regular action -- jump to the action chain
# #
add_ijump $chainref, j => use_policy_action( $paction, $chainref->{name} ); if ( ( my $proto = determine_action_protocol( $action, '-' ) ) ne '-' ) {
add_ijump( $chainref, j => use_policy_action( $paction, $chainref->{name} ), p => $proto );
} else {
add_ijump $chainref, j => use_policy_action( $paction, $chainref->{name} );
}
} else { } else {
# #
# Default action is an inline # Policy action is an inline
# #
( undef, my $level ) = split /:/, $paction, 2; ( undef, my $level ) = split /:/, $paction, 2;
( $action, my $param ) = get_target_param( $action ); ( $action, my $param ) = get_target_param( $action );
@@ -1133,7 +1159,7 @@ sub setup_syn_flood_chains() {
add_rule $synchainref , "${limit}-j RETURN"; add_rule $synchainref , "${limit}-j RETURN";
log_irule_limit( $level , log_irule_limit( $level ,
$synchainref , $synchainref ,
$chainref->{name} , $synchainref->{name} ,
'DROP', 'DROP',
@{$globals{LOGILIMIT}} ? $globals{LOGILIMIT} : [ limit => "--limit 5/min --limit-burst 5" ] , @{$globals{LOGILIMIT}} ? $globals{LOGILIMIT} : [ limit => "--limit 5/min --limit-burst 5" ] ,
'' , '' ,
@@ -1262,7 +1288,7 @@ sub finish_chain_section ($$$) {
if ( $chain1ref->{is_policy} ) { if ( $chain1ref->{is_policy} ) {
if ( $chain1ref->{synparams} ) { if ( $chain1ref->{synparams} ) {
my $synchainref = ensure_chain 'filter', syn_flood_chain $chain1ref; my $synchainref = ensure_chain 'filter', syn_flood_chain $chain1ref;
if ( $section == DEFAULTACTION_SECTION ) { if ( $section == POLICYACTION_SECTION ) {
if ( $chain1ref->{policy} =~ /^(ACCEPT|CONTINUE|QUEUE|NFQUEUE)/ ) { if ( $chain1ref->{policy} =~ /^(ACCEPT|CONTINUE|QUEUE|NFQUEUE)/ ) {
add_ijump $chain1ref, j => $synchainref, p => 'tcp --syn'; add_ijump $chain1ref, j => $synchainref, p => 'tcp --syn';
} }
@@ -1298,7 +1324,7 @@ sub ensure_rules_chain( $ )
$chainref = new_rules_chain( $chain ) unless $chainref; $chainref = new_rules_chain( $chain ) unless $chainref;
unless ( $chainref->{referenced} ) { unless ( $chainref->{referenced} ) {
if ( $section & ( NEW_SECTION | DEFAULTACTION_SECTION ) ) { if ( $section & ( NEW_SECTION | POLICYACTION_SECTION ) ) {
finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED,INVALID,UNTRACKED'; finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED,INVALID,UNTRACKED';
} elsif ( $section == UNTRACKED_SECTION ) { } elsif ( $section == UNTRACKED_SECTION ) {
finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED,INVALID'; finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED,INVALID';
@@ -1417,13 +1443,13 @@ sub external_name( $ ) {
# #
# Define an Action # Define an Action
# #
sub new_action( $$$$$ ) { sub new_action( $$$$$$ ) {
my ( $action , $type, $options , $actionfile , $state ) = @_; my ( $action , $type, $options , $actionfile , $state, $proto ) = @_;
fatal_error "Invalid action name($action)" if reserved_name( $action ); fatal_error "Reserved action name ($action)" if reserved_name( $action );
$actions{$action} = { file => $actionfile, actchain => '' , type => $type, options => $options , state => $state }; $actions{$action} = { file => $actionfile, actchain => '' , type => $type, options => $options , state => $state, proto => $proto };
$targets{$action} = $type; $targets{$action} = $type;
} }
@@ -1431,11 +1457,7 @@ sub new_action( $$$$$ ) {
# #
# Create and record a log action chain -- Log action chains have names # Create and record a log action chain -- Log action chains have names
# that are formed from the action name by prepending a "%" and appending # that are formed from the action name by prepending a "%" and appending
# a 1- or 2-digit sequence number. In the functions that follow, # a 1- or 2-digit sequence number.
# the $chain, $level and $tag variables serve as arguments to the user's
# exit. We call the exit corresponding to the name of the action but we
# set $chain to the name of the iptables chain where rules are to be added.
# Similarly, $level and $tag contain the log level and log tag respectively.
# #
# The maximum length of a chain name is 30 characters -- since the log # The maximum length of a chain name is 30 characters -- since the log
# action chain name is 2-3 characters longer than the base chain name, # action chain name is 2-3 characters longer than the base chain name,
@@ -1641,7 +1663,7 @@ sub merge_inline_source_dest( $$ ) {
return join( ':', $invocation, $body ); return join( ':', $invocation, $body );
} }
} else { } else {
fatal_error 'Interface names cannot appear in the DEST column within an action body' if $body =~ /:\[|:\+|/; fatal_error 'Interface names cannot appear in the DEST column within an action body' if $body =~ /:\[|:\+/;
if ( $invocation =~ /:\[|:\+/ ) { if ( $invocation =~ /:\[|:\+/ ) {
$invocation =~ s/:.*//; $invocation =~ s/:.*//;
@@ -1751,6 +1773,14 @@ sub process_action(\$\$$) {
fatal_error "Action $action may not be used in the mangle file" if $chainref->{table} eq 'mangle'; fatal_error "Action $action may not be used in the mangle file" if $chainref->{table} eq 'mangle';
} }
if ( $type & NAT_TABLE ) {
fatal_error "Action $action may only be used in the snat file" unless $chainref->{table} eq 'nat';
} else {
fatal_error "Action $action may not be used in the snat file" if $chainref->{table} eq 'nat';
}
$param = $1 if $param =~ /^.*\|(.*)$/; #Strip interface name off of the parameters
my $actionfile = $actionref->{file}; my $actionfile = $actionref->{file};
progress_message2 "$doing $actionfile for chain $chainref->{name}..."; progress_message2 "$doing $actionfile for chain $chainref->{name}...";
@@ -1939,7 +1969,7 @@ sub process_action(\$\$$) {
for my $proto (split_list( $protos, 'Protocol' ) ) { for my $proto (split_list( $protos, 'Protocol' ) ) {
process_snat1( $chainref, process_snat1( $chainref,
$action, $nolog ? $action : merge_levels( join(':', @actparams{'chain','loglevel','logtag'}), $action ),
$source, $source,
$dest, $dest,
$proto, $proto,
@@ -2041,9 +2071,10 @@ sub process_actions() {
my $opts = $type == INLINE ? NOLOG_OPT : 0; my $opts = $type == INLINE ? NOLOG_OPT : 0;
my $state = ''; my $state = '';
my $proto = 0;
if ( $action =~ /:/ ) { if ( $action =~ /:/ ) {
warning_message 'Default Actions are now specified in /etc/shorewall/shorewall.conf'; warning_message 'Policy Actions are now specified in /etc/shorewall/shorewall.conf';
$action =~ s/:.*$//; $action =~ s/:.*$//;
} }
@@ -2057,6 +2088,9 @@ sub process_actions() {
} else { } else {
fatal_error( q(The 'state' option is reserved for use in the actions.std file) ); fatal_error( q(The 'state' option is reserved for use in the actions.std file) );
} }
} elsif ( /^proto=(.+)$/ ) {
fatal_error "Unknown Protocol ($1)" unless defined( $proto = resolve_proto( $1 ) );
fatal_error "A protocol may not be specified on the REJECT_ACTION ($action)" if $action eq $config{REJECT_ACTION};
} else { } else {
fatal_error "Invalid option ($_)" unless $options{$_}; fatal_error "Invalid option ($_)" unless $options{$_};
$opts |= $options{$_}; $opts |= $options{$_};
@@ -2066,9 +2100,9 @@ sub process_actions() {
unless ( $type & INLINE ) { unless ( $type & INLINE ) {
$type = INLINE if $opts & INLINE_OPT; $type = INLINE if $opts & INLINE_OPT;
} }
}
fatal_error "Conflicting OPTIONS ($options)" if ( $opts & NOINLINE_OPT && $type == INLINE ) || ( $opts & INLINE_OPT && $opts & BUILTIN_OPT ); fatal_error "Conflicting OPTIONS ($options)" if ( $opts & NOINLINE_OPT && $type == INLINE ) || ( $opts & INLINE_OPT && $opts & BUILTIN_OPT );
}
if ( my $actiontype = $targets{$action} ) { if ( my $actiontype = $targets{$action} ) {
if ( ( $actiontype & ACTION ) && ( $type == INLINE ) ) { if ( ( $actiontype & ACTION ) && ( $type == INLINE ) ) {
@@ -2077,6 +2111,11 @@ sub process_actions() {
next; next;
} }
$proto = $actions{$action}{proto} unless $proto;
delete $actions{$action};
delete $targets{$action};
} elsif ( ( $actiontype & INLINE ) && ( $type == ACTION ) && $opts & NOINLINE_OPT ) {
$proto = $actions{$action}{proto} unless $proto;
delete $actions{$action}; delete $actions{$action};
delete $targets{$action}; delete $targets{$action};
} else { } else {
@@ -2086,6 +2125,8 @@ sub process_actions() {
} }
if ( $opts & BUILTIN_OPT ) { if ( $opts & BUILTIN_OPT ) {
warning_message( "The 'proto' option has no effect when specified on a builtin action" ) if $proto;
my $actiontype = USERBUILTIN | OPTIONS; my $actiontype = USERBUILTIN | OPTIONS;
$actiontype |= MANGLE_TABLE if $opts & MANGLE_OPT; $actiontype |= MANGLE_TABLE if $opts & MANGLE_OPT;
$actiontype |= RAW_TABLE if $opts & RAW_OPT; $actiontype |= RAW_TABLE if $opts & RAW_OPT;
@@ -2118,7 +2159,7 @@ sub process_actions() {
fatal_error "Missing Action File ($actionfile)" unless -f $actionfile; fatal_error "Missing Action File ($actionfile)" unless -f $actionfile;
new_action ( $action, $type, $opts, $actionfile , $state ); new_action ( $action, $type, $opts, $actionfile , $state , $proto );
} }
} }
} }
@@ -2156,7 +2197,7 @@ sub process_reject_action() {
# #
# This gets called very early in the compilation process so we fake the section # This gets called very early in the compilation process so we fake the section
# #
$section = DEFAULTACTION_SECTION; $section = POLICYACTION_SECTION;
if ( ( $targets{$action} || 0 ) == ACTION ) { if ( ( $targets{$action} || 0 ) == ACTION ) {
add_ijump $rejectref, j => use_policy_action( $action, $rejectref->{name} ); add_ijump $rejectref, j => use_policy_action( $action, $rejectref->{name} );
@@ -2490,7 +2531,7 @@ sub verify_audit($;$$) {
# the target is a macro, the macro is expanded and this function is called recursively for each rule in the expansion. # the target is a macro, the macro is expanded and this function is called recursively for each rule in the expansion.
# Similarly, if a new action tuple is encountered, this function is called recursively for each rule in the action # Similarly, if a new action tuple is encountered, this function is called recursively for each rule in the action
# body. In this latter case, a reference to the tuple's chain is passed in the first ($chainref) argument. A chain # body. In this latter case, a reference to the tuple's chain is passed in the first ($chainref) argument. A chain
# reference is also passed when rules are being generated during processing of a macro used as a default action. # reference is also passed when rules are being generated during processing of a macro used as a policy action.
# #
sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) { sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
@@ -3001,6 +3042,10 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
my $actionchain; # Name of the action chain my $actionchain; # Name of the action chain
if ( $actiontype & ACTION ) { if ( $actiontype & ACTION ) {
#
# Verify action 'proto', if any
#
$proto = determine_action_protocol( $basictarget, $proto );
# #
# Save NAT-oriented column contents # Save NAT-oriented column contents
# #
@@ -3151,7 +3196,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
); );
} }
unless ( $section & ( NEW_SECTION | DEFAULTACTION_SECTION ) || unless ( $section & ( NEW_SECTION | POLICYACTION_SECTION ) ||
$inaction || $inaction ||
$blacklist || $blacklist ||
$basictarget eq 'dropInvalid' ) { $basictarget eq 'dropInvalid' ) {
@@ -3287,7 +3332,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
$log_action , $log_action ,
$exceptionrule , $exceptionrule ,
$usergenerated && ! $loglevel ) $usergenerated && ! $loglevel )
unless unreachable_warning( $wildcard || $section == DEFAULTACTION_SECTION, $chainref ); unless unreachable_warning( $wildcard || $section == POLICYACTION_SECTION, $chainref );
} }
$generated = 1; $generated = 1;
@@ -3365,7 +3410,7 @@ sub check_state( $ ) {
} }
} }
if ( $section & ( NEW_SECTION | DEFAULTACTION_SECTION ) ) { if ( $section & ( NEW_SECTION | POLICYACTION_SECTION ) ) {
if ( $state eq 'NEW' ) { if ( $state eq 'NEW' ) {
# #
# If an INVALID or UNTRACKED rule would be emitted then we must include the state match # If an INVALID or UNTRACKED rule would be emitted then we must include the state match
@@ -3906,7 +3951,7 @@ sub process_rules() {
# #
# No need to finish the NEW section since no rules need to be generated # No need to finish the NEW section since no rules need to be generated
# #
$section = $next_section = DEFAULTACTION_SECTION; $section = $next_section = POLICYACTION_SECTION;
} }
sub process_mangle_inline( $$$$$$$$$$$$$$$$$$$$ ) { sub process_mangle_inline( $$$$$$$$$$$$$$$$$$$$ ) {
@@ -4142,10 +4187,10 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
expand_rule( $chainref, expand_rule( $chainref,
$restriction, $restriction,
$prerule , $prerule ,
do_proto( $proto, $ports, $sports ) .
$match . $match .
do_user( $user ) . do_user( $user ) .
do_test( $testval, $globals{TC_MASK} ) . do_test( $testval, $mask ) .
do_test( $testval, $globals{TC_MASK} ) .
do_length( $length ) . do_length( $length ) .
do_tos( $tos ) . do_tos( $tos ) .
do_connbytes( $connbytes ) . do_connbytes( $connbytes ) .
@@ -4153,6 +4198,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
do_headers( $headers ) . do_headers( $headers ) .
do_probability( $probability ) . do_probability( $probability ) .
do_dscp( $dscp ) . do_dscp( $dscp ) .
do_time( $time ) .
do_condition( $condition, $chainref->{name} ) . do_condition( $condition, $chainref->{name} ) .
state_match( $state ) . state_match( $state ) .
$raw_matches , $raw_matches ,
@@ -4588,6 +4634,52 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
}, },
}, },
TCPMSS => {
defaultchain => FORWARD,
allowedchains => FORWARD | POSTROUTING,
minparams => 0,
maxparams => 2,
function => sub () {
if ( $proto eq '-' ) {
$proto = TCP;
} else {
fatal_error 'TCPMSS only valid with TCP' unless $proto eq '6' || $proto eq 'tcp';
}
$target = 'TCPMSS ';
$matches .= '--tcp-flags SYN,RST SYN ';
if ( supplied $params ) {
my ( $mss, $ipsec ) = split /,/, $params;
if ( supplied $mss ) {
if ( $mss eq 'pmtu' ) {
$target .= '--clamp-mss-to-pmtu';
} else {
my $num = numeric_value $mss;
fatal_error "Invalid MSS ($mss)" unless defined $num && $num >= 500 && $num < 65534;
$target .= "--set-mss $num";
}
} else {
$target .= '--clamp-mss-to-pmtu';
}
if ( supplied $ipsec && $ipsec ne 'all' ) {
if ( $ipsec eq '-' || $ipsec eq 'none' ) {
$matches .= '-m policy --pol none --dir out ';
} elsif ( $ipsec eq 'ipsec' ) {
$matches .= '-m policy --pol ipsec --dir out ';
} else {
fatal_error "Invalid ipsec parameter ($ipsec)";
}
require_capability 'POLICY_MATCH', "The $ipsec ipsec option", 's';
}
} else {
$target .= '--clamp-mss-to-pmtu';
}
},
},
TOS => { TOS => {
defaultchain => 0, defaultchain => 0,
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING, allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
@@ -4611,8 +4703,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
my ( $port, $ip, $bad ); my ( $port, $ip, $bad );
if ( $params ) { if ( $params ) {
( $port, $ip, $bad ) = split_list $params, 'Parameter'; ( $port, $ip ) = split /,/, $params, 2;
fatal_error "Invalid TPROXY specification( TPROXY($params) )" if defined $bad;
} }
my $mark = in_hex( $globals{TPROXY_MARK} ) . '/' . in_hex( $globals{TPROXY_MARK} ); my $mark = in_hex( $globals{TPROXY_MARK} ) . '/' . in_hex( $globals{TPROXY_MARK} );
@@ -4679,6 +4770,10 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
function => sub() { function => sub() {
fatal_error( qq(Action $cmd may not be used in the mangle file) ) unless $actiontype & MANGLE_TABLE; fatal_error( qq(Action $cmd may not be used in the mangle file) ) unless $actiontype & MANGLE_TABLE;
# #
# Verify action 'proto', if any
#
$proto = determine_action_protocol( $cmd, $proto );
#
# Create the action:level:tag:param tuple. # Create the action:level:tag:param tuple.
# #
my $normalized_target = normalize_action( $cmd, '', $params ); my $normalized_target = normalize_action( $cmd, '', $params );
@@ -5204,18 +5299,23 @@ sub process_mangle_rule( $ ) {
} }
} }
sub process_snat_inline( $$$$$$$$$$$$$ ) { sub process_snat_inline( $$$$$$$$$$$$$$ ) {
my ($inline, $chainref, $params, $source, $dest, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_; my ($inline, $chainref, $params, $loglevel, $source, $dest, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
my ( $level,
$tag ) = split( ':', $loglevel, 2 );
my $oldparms = push_action_params( $inline, my $oldparms = push_action_params( $inline,
$chainref, $chainref,
$params, $params,
'none', supplied $level ? $level : 'none',
'' , defined $tag ? $tag : '' ,
$chainref->{name} ); $chainref->{name} );
my $inlinefile = $actions{$inline}{file}; my $actionref = $actions{$inline};
my $matches = fetch_inline_matches; my $inlinefile = $actionref->{file};
my $options = $actionref->{options};
my $nolog = $options & NOLOG_OPT;
my $matches = fetch_inline_matches;
progress_message "..Expanding inline action $inlinefile..."; progress_message "..Expanding inline action $inlinefile...";
@@ -5249,6 +5349,8 @@ sub process_snat_inline( $$$$$$$$$$$$$ ) {
next; next;
} }
$maction = merge_levels( join(':', @actparams{'chain','loglevel','logtag'}), $maction ) unless $nolog;
$msource = $source if $msource eq '-'; $msource = $source if $msource eq '-';
if ( $mdest eq '-' ) { if ( $mdest eq '-' ) {
@@ -5293,7 +5395,7 @@ sub process_snat_inline( $$$$$$$$$$$$$ ) {
# Process a record in the snat file # Process a record in the snat file
# #
sub process_snat1( $$$$$$$$$$$$ ) { sub process_snat1( $$$$$$$$$$$$ ) {
my ( $chainref, $action, $source, $dest, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_; my ( $chainref, $origaction, $source, $dest, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
my $inchain; my $inchain;
my $inaction; my $inaction;
@@ -5310,6 +5412,9 @@ sub process_snat1( $$$$$$$$$$$$ ) {
my $actiontype; my $actiontype;
my $interfaces; my $interfaces;
my $normalized_action; my $normalized_action;
my ( $action, $loglevel ) = split_action( $origaction );
my $logaction;
my $param;
if ( $action =~ /^MASQUERADE(\+)?(?:\((.+)\))?$/ ) { if ( $action =~ /^MASQUERADE(\+)?(?:\((.+)\))?$/ ) {
$target = 'MASQUERADE'; $target = 'MASQUERADE';
@@ -5318,6 +5423,7 @@ sub process_snat1( $$$$$$$$$$$$ ) {
$addresses = ( $2 || '' ); $addresses = ( $2 || '' );
$options = 'random' if $addresses =~ s/:?random$//; $options = 'random' if $addresses =~ s/:?random$//;
$add_snat_aliases = ''; $add_snat_aliases = '';
$logaction = 'MASQ';
} elsif ( $action =~ /^SNAT(\+)?\((.+)\)$/ ) { } elsif ( $action =~ /^SNAT(\+)?\((.+)\)$/ ) {
$pre_nat = $1; $pre_nat = $1;
$addresses = $2; $addresses = $2;
@@ -5326,13 +5432,16 @@ sub process_snat1( $$$$$$$$$$$$ ) {
$options .= ':persistent' if $addresses =~ s/:persistent//; $options .= ':persistent' if $addresses =~ s/:persistent//;
$options .= ':random' if $addresses =~ s/:random//; $options .= ':random' if $addresses =~ s/:random//;
$options =~ s/^://; $options =~ s/^://;
$logaction = 'SNAT';
} elsif ( $action =~ /^CONTINUE(\+)?$/ ) { } elsif ( $action =~ /^CONTINUE(\+)?$/ ) {
$add_snat_aliases = 0; $add_snat_aliases = 0;
$actiontype = $builtin_target{$target = 'RETURN'}; $actiontype = $builtin_target{$target = 'RETURN'};
$pre_nat = $1; $pre_nat = $1;
$logaction = 'RETURN';
} elsif ( $action eq 'MASQUERADE' ) { } elsif ( $action eq 'MASQUERADE' ) {
$actiontype = $builtin_target{$target = 'MASQUERADE'}; $actiontype = $builtin_target{$target = 'MASQUERADE'};
$add_snat_aliases = ''; $add_snat_aliases = '';
$logaction = 'MASQ';
} else { } else {
( $target , $params ) = get_target_param1( $action ); ( $target , $params ) = get_target_param1( $action );
@@ -5340,11 +5449,24 @@ sub process_snat1( $$$$$$$$$$$$ ) {
$actiontype = ( $targets{$target} || 0 ); $actiontype = ( $targets{$target} || 0 );
fatal_error "Invalid ACTION ($action)" unless $actiontype & ( ACTION | INLINE ); if ( $actiontype & LOGRULE ) {
$logaction = 'LOG';
if ( $target eq 'LOG' ) {
fatal_error 'LOG requires a log level' unless supplied $loglevel;
} else {
$target = "$target($params)";
validate_level( $action );
$loglevel = supplied $loglevel ? join( ':', $target, $loglevel ) : $target;
$target = 'LOG';
}
} else {
fatal_error "Invalid ACTION ($action)" unless $actiontype & ( ACTION | INLINE );
$logaction = '';
}
} }
if ( $inchain = defined $chainref ) { if ( $inchain = defined $chainref ) {
( $inaction, undef, $interfaces, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 5 if $chainref->{action}; ( $inaction, undef,undef,undef,$param ) = split( /:/, $normalized_action = $chainref->{action}) if $chainref->{action};
fatal_error q('+' is not allowed within an action body) if $pre_nat; fatal_error q('+' is not allowed within an action body) if $pre_nat;
} }
# #
@@ -5352,6 +5474,8 @@ sub process_snat1( $$$$$$$$$$$$ ) {
# #
if ( $inaction ) { if ( $inaction ) {
$destnets = $dest; $destnets = $dest;
assert( $param =~ /^(.*)\|/ );
$interfaces=$1;
} elsif ( $family == F_IPV4 ) { } elsif ( $family == F_IPV4 ) {
if ( $dest =~ /^([^:]+)::([^:]*)$/ ) { if ( $dest =~ /^([^:]+)::([^:]*)$/ ) {
$add_snat_aliases = 0; $add_snat_aliases = 0;
@@ -5593,6 +5717,7 @@ sub process_snat1( $$$$$$$$$$$$ ) {
process_snat_inline( $target, process_snat_inline( $target,
$chainref, $chainref,
$params, $params,
$loglevel,
$source, $source,
supplied $destnets && $destnets ne '-' ? $inaction ? $destnets : join( ':', $interface, $destnets ) : $inaction ? '-' : $interface, supplied $destnets && $destnets ne '-' ? $inaction ? $destnets : join( ':', $interface, $destnets ) : $inaction ? '-' : $interface,
$proto, $proto,
@@ -5607,10 +5732,14 @@ sub process_snat1( $$$$$$$$$$$$ ) {
if ( $actiontype & ACTION ) { if ( $actiontype & ACTION ) {
fatal_error( qq(Action $target may not be used in the snat file) ) unless $actiontype & NAT_TABLE; fatal_error( qq(Action $target may not be used in the snat file) ) unless $actiontype & NAT_TABLE;
# #
# Verify action 'proto', if any
#
$proto = determine_action_protocol( $target, $proto );
#
# Create the action:level:tag:param tuple. Since we don't allow logging out of nat POSTROUTING, we store # Create the action:level:tag:param tuple. Since we don't allow logging out of nat POSTROUTING, we store
# the interface name in the log tag # the interface name in the log tag
# #
my $normalized_target = normalize_action( $target, "none:$interface", $params ); my $normalized_target = normalize_action( $target, "$loglevel", "$interface|$params" );
fatal_error( "Action $target invoked Recursively (" . join( '->', map( external_name( $_ ), @actionstack , $normalized_target ) ) . ')' ) if $active{$target}; fatal_error( "Action $target invoked Recursively (" . join( '->', map( external_name( $_ ), @actionstack , $normalized_target ) ) . ')' ) if $active{$target};
my $ref = use_action( 'nat', $normalized_target ); my $ref = use_action( 'nat', $normalized_target );
@@ -5620,9 +5749,6 @@ sub process_snat1( $$$$$$$$$$$$ ) {
# First reference to this tuple - process_action may modify both $normalized_target and $ref!!! # First reference to this tuple - process_action may modify both $normalized_target and $ref!!!
# #
process_action( $normalized_target, $ref, $chainref->{name} ); process_action( $normalized_target, $ref, $chainref->{name} );
#
# Capture the name of the action chain
#
} else { } else {
# #
# We've seen this tuple before # We've seen this tuple before
@@ -5631,6 +5757,12 @@ sub process_snat1( $$$$$$$$$$$$ ) {
} }
$target = $ref->{name}; $target = $ref->{name};
if ( $actions{$target}{options} & LOGJUMP_OPT ) {
$logaction = $target;
} else {
$loglevel = '';
}
} else { } else {
for my $option ( split_list2( $options , 'option' ) ) { for my $option ( split_list2( $options , 'option' ) ) {
if ( $option eq 'random' ) { if ( $option eq 'random' ) {
@@ -5659,8 +5791,8 @@ sub process_snat1( $$$$$$$$$$$$ ) {
$destnets , $destnets ,
$origdest , $origdest ,
$target , $target ,
'' , $loglevel ,
'' , $logaction ,
$exceptionrule , $exceptionrule ,
'' ) '' )
unless unreachable_warning( 0, $chainref ); unless unreachable_warning( 0, $chainref );

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Tc.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Tc.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Traffic Control is from tc4shorewall Version 0.5 # Traffic Control is from tc4shorewall Version 0.5
# (c) 2005 Arne Bernin <arne@ucbering.de> # (c) 2005 Arne Bernin <arne@ucbering.de>
@@ -225,11 +225,11 @@ sub handle_in_bandwidth( $$$ ) {
if ( have_capability 'BASIC_FILTER' ) { if ( have_capability 'BASIC_FILTER' ) {
if ( $in_rate ) { if ( $in_rate ) {
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 basic \\", emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 basic \\",
" police mpu 64 drop rate ${in_rate}kbit burst $in_burst\n" ); " police mpu 64 rate ${in_rate}kbit burst $in_burst drop\n" );
} else { } else {
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\", emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\",
" estimator $in_interval $in_decay basic \\", " estimator $in_interval $in_decay basic \\",
" police drop avrate ${in_avrate}kbit\n" ); " police avrate ${in_avrate}kbit drop\n" );
} }
} else { } else {
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\" , emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\" ,

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Zones.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Zones.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net) # (c) 2007,2008,2009,2010,2011-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -90,7 +90,6 @@ our @EXPORT = ( qw( NOTHING
interface_is_optional interface_is_optional
interface_is_required interface_is_required
find_interfaces_by_option find_interfaces_by_option
find_interfaces_by_option1
get_interface_option get_interface_option
get_interface_origin get_interface_origin
interface_has_option interface_has_option
@@ -253,6 +252,17 @@ use constant { NO_UPDOWN => 1,
our %validinterfaceoptions; our %validinterfaceoptions;
our %procinterfaceoptions=( accept_ra => 1,
arp_filter => 1,
arp_ignore => 1,
forward => 1,
logmartians => 1,
proxyarp => 1,
proxyndp => 1,
routefilter => 1,
sourceroute => 1,
);
our %prohibitunmanaged = ( our %prohibitunmanaged = (
blacklist => 1, blacklist => 1,
bridge => 1, bridge => 1,
@@ -317,7 +327,7 @@ sub initialize( $$ ) {
%mapbase = (); %mapbase = ();
%mapbase1 = (); %mapbase1 = ();
$baseseq = 0; $baseseq = 0;
$minroot = 0; $minroot = undef;
$loopback_interface = ''; $loopback_interface = '';
%validzoneoptions = ( mss => NUMERIC, %validzoneoptions = ( mss => NUMERIC,
@@ -339,7 +349,7 @@ sub initialize( $$ ) {
arp_ignore => ENUM_IF_OPTION, arp_ignore => ENUM_IF_OPTION,
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST, blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
bridge => SIMPLE_IF_OPTION, bridge => SIMPLE_IF_OPTION,
dbl => ENUM_IF_OPTION, dbl => ENUM_IF_OPTION + IF_OPTION_WILDOK,
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST, destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
detectnets => OBSOLETE_IF_OPTION, detectnets => OBSOLETE_IF_OPTION,
dhcp => SIMPLE_IF_OPTION, dhcp => SIMPLE_IF_OPTION,
@@ -363,9 +373,9 @@ sub initialize( $$ ) {
upnp => SIMPLE_IF_OPTION, upnp => SIMPLE_IF_OPTION,
upnpclient => SIMPLE_IF_OPTION, upnpclient => SIMPLE_IF_OPTION,
mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK, mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
physical => STRING_IF_OPTION + IF_OPTION_HOST, physical => STRING_IF_OPTION + IF_OPTION_HOST + IF_OPTION_WILDOK,
unmanaged => SIMPLE_IF_OPTION, unmanaged => SIMPLE_IF_OPTION,
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK, wait => NUMERIC_IF_OPTION,
); );
%validhostoptions = ( %validhostoptions = (
blacklist => 1, blacklist => 1,
@@ -390,7 +400,7 @@ sub initialize( $$ ) {
%validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION, %validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION,
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST, blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
bridge => SIMPLE_IF_OPTION, bridge => SIMPLE_IF_OPTION,
dbl => ENUM_IF_OPTION, dbl => ENUM_IF_OPTION + IF_OPTION_WILDOK,
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST, destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
dhcp => SIMPLE_IF_OPTION, dhcp => SIMPLE_IF_OPTION,
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK, ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
@@ -402,18 +412,18 @@ sub initialize( $$ ) {
optional => SIMPLE_IF_OPTION, optional => SIMPLE_IF_OPTION,
proxyndp => BINARY_IF_OPTION, proxyndp => BINARY_IF_OPTION,
required => SIMPLE_IF_OPTION, required => SIMPLE_IF_OPTION,
routeback => BINARY_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER, routeback => BINARY_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER + IF_OPTION_WILDOK,
rpfilter => SIMPLE_IF_OPTION, rpfilter => SIMPLE_IF_OPTION,
sfilter => IPLIST_IF_OPTION, sfilter => IPLIST_IF_OPTION,
sourceroute => BINARY_IF_OPTION, sourceroute => BINARY_IF_OPTION,
tcpflags => BINARY_IF_OPTION + IF_OPTION_HOST, tcpflags => BINARY_IF_OPTION + IF_OPTION_HOST,
mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK, mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
forward => BINARY_IF_OPTION, forward => BINARY_IF_OPTION,
physical => STRING_IF_OPTION + IF_OPTION_HOST, physical => STRING_IF_OPTION + IF_OPTION_HOST + IF_OPTION_WILDOK,
unmanaged => SIMPLE_IF_OPTION, unmanaged => SIMPLE_IF_OPTION,
upnp => SIMPLE_IF_OPTION, upnp => SIMPLE_IF_OPTION,
upnpclient => SIMPLE_IF_OPTION, upnpclient => SIMPLE_IF_OPTION,
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK, wait => NUMERIC_IF_OPTION,
); );
%validhostoptions = ( %validhostoptions = (
blacklist => 1, blacklist => 1,
@@ -714,7 +724,7 @@ sub interface_match( $$ ) {
return 1 if $piface eq $cifaceref->{bridge}; return 1 if $piface eq $cifaceref->{bridge};
return 1 if $ciface eq $pifaceref->{bridge}; return 1 if $ciface eq $pifaceref->{bridge};
if ( $minroot ) { if ( defined $minroot ) {
if ( $piface =~ /\+$/ ) { if ( $piface =~ /\+$/ ) {
my $root = $pifaceref->{root}; my $root = $pifaceref->{root};
my $rlength = length( $root ); my $rlength = length( $root );
@@ -1204,15 +1214,16 @@ sub process_interface( $$ ) {
} }
my $wildcard = 0; my $wildcard = 0;
my $physwild = 0;
my $root; my $root;
if ( $interface =~ /\+$/ ) { if ( $interface =~ /\+$/ ) {
$wildcard = 1; $wildcard = $physwild = 1; # Default physical name is the logical name
$root = substr( $interface, 0, -1 ); $root = substr( $interface, 0, -1 );
$roots{$root} = $interface; $roots{$root} = $interface;
my $len = length $root; my $len = length $root;
if ( $minroot ) { if ( defined $minroot ) {
$minroot = $len if $minroot > $len; $minroot = $len if $minroot > $len;
} else { } else {
$minroot = $len; $minroot = $len;
@@ -1258,8 +1269,6 @@ sub process_interface( $$ ) {
my %hostoptions = ( dynamic => 0 ); my %hostoptions = ( dynamic => 0 );
for my $option (split_list1 $options, 'option' ) { for my $option (split_list1 $options, 'option' ) {
next if $option eq '-';
( $option, my $value ) = split /=/, $option; ( $option, my $value ) = split /=/, $option;
fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option}; fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option};
@@ -1296,7 +1305,6 @@ sub process_interface( $$ ) {
} elsif ( $type == BINARY_IF_OPTION ) { } elsif ( $type == BINARY_IF_OPTION ) {
$value = 1 unless defined $value; $value = 1 unless defined $value;
fatal_error "Option value for '$option' must be 0 or 1" unless ( $value eq '0' || $value eq '1' ); fatal_error "Option value for '$option' must be 0 or 1" unless ( $value eq '0' || $value eq '1' );
fatal_error "The '$option' option may not be used with a wild-card interface name" if $wildcard && ! $type && IF_OPTION_WILDOK;
$options{$option} = $value; $options{$option} = $value;
$hostoptions{$option} = $value if $hostopt; $hostoptions{$option} = $value if $hostopt;
} elsif ( $type == ENUM_IF_OPTION ) { } elsif ( $type == ENUM_IF_OPTION ) {
@@ -1320,7 +1328,6 @@ sub process_interface( $$ ) {
assert( 0 ); assert( 0 );
} }
} elsif ( $type == NUMERIC_IF_OPTION ) { } elsif ( $type == NUMERIC_IF_OPTION ) {
fatal_error "The '$option' option may not be specified on a wildcard interface" if $wildcard && ! $type && IF_OPTION_WILDOK;
$value = $defaultinterfaceoptions{$option} unless defined $value; $value = $defaultinterfaceoptions{$option} unless defined $value;
fatal_error "The '$option' option requires a value" unless defined $value; fatal_error "The '$option' option requires a value" unless defined $value;
my $numval = numeric_value $value; my $numval = numeric_value $value;
@@ -1372,7 +1379,9 @@ sub process_interface( $$ ) {
fatal_error "Duplicate physical interface name ($value)" if ( $interfaces{$value} && ! $port ); fatal_error "Duplicate physical interface name ($value)" if ( $interfaces{$value} && ! $port );
fatal_error "The type of 'physical' name ($value) doesn't match the type of interface name ($interface)" if $wildcard && ! $value =~ /\+$/; $physwild = ( $value =~ /\+$/ );
fatal_error "The type of 'physical' name ($value) doesn't match the type of interface name ($interface)" if $wildcard && ! $physwild;
$physical = $value; $physical = $value;
} else { } else {
assert(0); assert(0);
@@ -1400,6 +1409,14 @@ sub process_interface( $$ ) {
$options{ignore} = 0; $options{ignore} = 0;
} }
for my $option ( keys %options ) {
if ( $root ) {
warning_message( "The '$option' option is ignored when used with a wildcard physical name" ) if $physwild && $procinterfaceoptions{$option};
} else {
warning_message( "The '$option' option is ignored when used with interface name '+'" ) unless $validinterfaceoptions{$option} & IF_OPTION_WILDOK;
}
}
if ( $netsref eq 'dynamic' ) { if ( $netsref eq 'dynamic' ) {
my $ipset = $family == F_IPV4 ? "${zone}" : "6_${zone}"; my $ipset = $family == F_IPV4 ? "${zone}" : "6_${zone}";
$ipset = join( '_', $ipset, var_base1( $physical ) ) unless $zoneref->{options}{in_out}{dynamic_shared}; $ipset = join( '_', $ipset, var_base1( $physical ) ) unless $zoneref->{options}{in_out}{dynamic_shared};
@@ -1458,6 +1475,7 @@ sub process_interface( $$ ) {
zones => {}, zones => {},
origin => shortlineinfo( '' ), origin => shortlineinfo( '' ),
wildcard => $wildcard, wildcard => $wildcard,
physwild => $physwild, # Currently unused
}; };
$interfaces{$physical} = $interfaceref if $physical ne $interface; $interfaces{$physical} = $interfaceref if $physical ne $interface;
@@ -1616,7 +1634,7 @@ sub known_interface($)
my $iface = $interface; my $iface = $interface;
if ( $minroot ) { if ( defined $minroot ) {
# #
# We have wildcard interfaces -- see if this interface matches one of their roots # We have wildcard interfaces -- see if this interface matches one of their roots
# #
@@ -1857,7 +1875,8 @@ sub find_interfaces_by_option( $;$ ) {
for my $interface ( @interfaces ) { for my $interface ( @interfaces ) {
my $interfaceref = $interfaces{$interface}; my $interfaceref = $interfaces{$interface};
next unless $interfaceref->{root}; next unless $interfaceref->{root}; # Don't return '+' interface
next if $procinterfaceoptions{$option} && $interfaceref->{physwild}; # Ignore /proc options on wildcard interface
my $optionsref = $interfaceref->{options}; my $optionsref = $interfaceref->{options};
if ( $nonzero ) { if ( $nonzero ) {
@@ -1872,35 +1891,6 @@ sub find_interfaces_by_option( $;$ ) {
\@ints; \@ints;
} }
#
# Returns reference to array of interfaces with the passed option. Unlike the preceding function, this one:
#
# - All entries in %interfaces are searched.
# - Returns a two-element list; the second element indicates whether any members of the list have wildcard physical names
#
sub find_interfaces_by_option1( $ ) {
my $option = $_[0];
my @ints = ();
my $wild = 0;
for my $interface ( @interfaces ) {
my $interfaceref = $interfaces{$interface};
next unless defined $interfaceref->{physical};
my $optionsref = $interfaceref->{options};
if ( $optionsref && defined $optionsref->{$option} ) {
$wild ||= $interfaceref->{wildcard};
push @ints , $interface
}
}
return unless defined wantarray;
wantarray ? ( \@ints, $wild ) : \@ints;
}
# #
# Return the value of an option for an interface # Return the value of an option for an interface
# #

View File

@@ -1,4 +1,4 @@
# (c) 1999-2016 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -369,7 +369,7 @@ replace_default_route() # $1 = USE_DEFAULT_RT
delete_default_routes() # $1 = table number delete_default_routes() # $1 = table number
{ {
$IP -$g_family route ls table $1 | grep -F default | grep -vF metric | while read route; do $IP -$g_family route ls table $1 | grep -F default | grep -vF metric | while read route; do
qt $IP -$g_family route del $route qt $IP -$g_family route del $route table $1
done done
} }
@@ -1065,8 +1065,6 @@ clear_firewall() {
run_iptables -F run_iptables -F
qt $IPTABLES -t raw -F qt $IPTABLES -t raw -F
echo 1 > /proc/sys/net/ipv4/ip_forward
if [ -n "$DISABLE_IPV6" ]; then if [ -n "$DISABLE_IPV6" ]; then
if [ -x $IP6TABLES ]; then if [ -x $IP6TABLES ]; then
$IP6TABLES -P INPUT ACCEPT 2> /dev/null $IP6TABLES -P INPUT ACCEPT 2> /dev/null
@@ -1375,8 +1373,6 @@ clear_firewall() {
run_iptables -F run_iptables -F
qt $IP6TABLES -t raw -F qt $IP6TABLES -t raw -F
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
run_clear_exit run_clear_exit
set_state "Cleared" set_state "Cleared"

View File

@@ -1,5 +1,23 @@
############################################################################### ###############################################################################
# Code imported from /usr/share/shorewall/prog.footer # Code imported from /usr/share/shorewall/prog.footer
#
# (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
############################################################################### ###############################################################################
# #
# Give Usage Information # Give Usage Information
@@ -78,11 +96,13 @@ reload_command() {
detect_configuration detect_configuration
define_firewall define_firewall
status=$? status=$?
if [ -n "$SUBSYSLOCK" ]; then
[ $status -eq 0 ] && touch $SUBSYSLOCK || rm -f $SUBSYSLOCK
fi
[ $status -eq 0 ] && progress_message3 "done." if [ $status -eq 0 ]; then
[ -n "$SUBSYSLOCK" ] && touch $SUBSYSLOCK
progress_message3 "done."
else
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
fi
} }
################################################################################ ################################################################################
@@ -130,6 +150,7 @@ g_docker=
g_dockeringress= g_dockeringress=
g_dockernetwork= g_dockernetwork=
g_forcereload= g_forcereload=
g_fallback=
[ -n "$SERVICEDIR" ] && SUBSYSLOCK= [ -n "$SERVICEDIR" ] && SUBSYSLOCK=
@@ -265,8 +286,10 @@ case "$COMMAND" in
error_message "$g_product is not running" error_message "$g_product is not running"
status=2 status=2
elif [ $# -eq 1 ]; then elif [ $# -eq 1 ]; then
$g_tool -Z for table in raw mangle nat filter; do
$g_tool -t mangle -Z qt $g_tool -t $table -Z
done
date > ${VARDIR}/restarted date > ${VARDIR}/restarted
status=0 status=0
progress_message3 "$g_product Counters Reset" progress_message3 "$g_product Counters Reset"
@@ -350,6 +373,7 @@ case "$COMMAND" in
clear) clear)
[ $# -ne 1 ] && usage 2 [ $# -ne 1 ] && usage 2
progress_message3 "Clearing $g_product...." progress_message3 "Clearing $g_product...."
detect_configuration
clear_firewall clear_firewall
status=0 status=0
if [ -n "$SUBSYSLOCK" ]; then if [ -n "$SUBSYSLOCK" ]; then

View File

@@ -77,7 +77,7 @@ UNTRACKED_LOG_LEVEL=
ARPTABLES= ARPTABLES=
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall" CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE

View File

@@ -1,6 +1,6 @@
# #
# Shorewall - Sample Interfaces File for one-interface configuration. # Shorewall - Sample Interfaces File for one-interface configuration.
# Copyright (C) 2006-2015 by the Shorewall Team # Copyright (C) 2006-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -14,4 +14,4 @@
?FORMAT 2 ?FORMAT 2
############################################################################### ###############################################################################
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
net eth0 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0 net NET_IF dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,physical=eth0

View File

@@ -88,7 +88,7 @@ UNTRACKED_LOG_LEVEL=
ARPTABLES= ARPTABLES=
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall" CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE

View File

@@ -1,6 +1,6 @@
# #
# Shorewall - Sample Interfaces File for three-interface configuration. # Shorewall - Sample Interfaces File for three-interface configuration.
# Copyright (C) 2006-2015 by the Shorewall Team # Copyright (C) 2006-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -14,6 +14,6 @@
?FORMAT 2 ?FORMAT 2
############################################################################### ###############################################################################
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
net eth0 tcpflags,dhcp,nosmurfs,routefilter,logmartians,sourceroute=0 net NET_IF tcpflags,dhcp,nosmurfs,routefilter,logmartians,sourceroute=0,physical=eth0
loc eth1 tcpflags,nosmurfs,routefilter,logmartians loc LOC_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth1
dmz eth2 tcpflags,nosmurfs,routefilter,logmartians dmz DMZ_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth2

View File

@@ -85,7 +85,7 @@ UNTRACKED_LOG_LEVEL=
ARPTABLES= ARPTABLES=
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall" CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE

View File

@@ -1,6 +1,6 @@
# #
# Shorewall - Sample SNAT/Masqueradee File for three-interface configuration. # Shorewall - Sample SNAT/Masqueradee File for three-interface configuration.
# Copyright (C) 2006-2016 by the Shorewall Team # Copyright (C) 2006-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -20,4 +20,4 @@
MASQUERADE 10.0.0.0/8,\ MASQUERADE 10.0.0.0/8,\
169.254.0.0/16,\ 169.254.0.0/16,\
172.16.0.0/12,\ 172.16.0.0/12,\
192.168.0.0/16 eth0 192.168.0.0/16 NET_IF

View File

@@ -1,6 +1,6 @@
# #
# Shorewall - Sample Stoppedrules File for three-interface configuration. # Shorewall - Sample Stoppedrules File for three-interface configuration.
# Copyright (C) 2012-2015 by the Shorewall Team # Copyright (C) 2012-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -13,8 +13,8 @@
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE #ACTION SOURCE DEST PROTO DEST SOURCE
# PORT(S) PORT(S) # PORT(S) PORT(S)
ACCEPT eth1 - ACCEPT LOC_IF -
ACCEPT - eth1 ACCEPT - LOC_IF
ACCEPT eth2 - ACCEPT DMZ_IF -
ACCEPT - eth2 ACCEPT - DMZ_IF

View File

@@ -1,6 +1,6 @@
# #
# Shorewall - Sample Interfaces File for two-interface configuration. # Shorewall - Sample Interfaces File for two-interface configuration.
# Copyright (C) 2006-2015 by the Shorewall Team # Copyright (C) 2006-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -14,5 +14,5 @@
?FORMAT 2 ?FORMAT 2
############################################################################### ###############################################################################
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
net eth0 dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0 net NET_IF dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0,physical=eth0
loc eth1 tcpflags,nosmurfs,routefilter,logmartians loc LOC_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth1

View File

@@ -88,7 +88,7 @@ UNTRACKED_LOG_LEVEL=
ARPTABLES= ARPTABLES=
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall" CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE

View File

@@ -1,6 +1,6 @@
# #
# Shorewall - Sample SNAT/Masqueradee File for two-interface configuration. # Shorewall - Sample SNAT/Masqueradee File for two-interface configuration.
# Copyright (C) 2006-2016 by the Shorewall Team # Copyright (C) 2006-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -20,4 +20,4 @@
MASQUERADE 10.0.0.0/8,\ MASQUERADE 10.0.0.0/8,\
169.254.0.0/16,\ 169.254.0.0/16,\
172.16.0.0/12,\ 172.16.0.0/12,\
192.168.0.0/16 eth0 192.168.0.0/16 NET_IF

View File

@@ -1,6 +1,6 @@
# #
# Shorewall - Sample Stoppedrules File for two-interface configuration. # Shorewall - Sample Stoppedrules File for two-interface configuration.
# Copyright (C) 2012-2015 by the Shorewall Team # Copyright (C) 2012-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -13,5 +13,5 @@
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE #ACTION SOURCE DEST PROTO DEST SOURCE
# PORT(S) PORT(S) # PORT(S) PORT(S)
ACCEPT eth1 - ACCEPT LOC_IF -
ACCEPT - eth1 ACCEPT - LOC_IF

View File

@@ -21,35 +21,46 @@ allowMcast inline # Silently Allow Multicast
AutoBL noinline # Auto-blacklist IPs that exceed thesholds AutoBL noinline # Auto-blacklist IPs that exceed thesholds
AutoBLL noinline # Helper for AutoBL AutoBLL noinline # Helper for AutoBL
BLACKLIST logjump,section # Add sender to the dynamic blacklist BLACKLIST logjump,section # Add sender to the dynamic blacklist
?if __ADDRTYPE
Broadcast inline,audit # Handles Broadcast/Anycast
?else
Broadcast noinline,audit # Handles Broadcast/Anycast Broadcast noinline,audit # Handles Broadcast/Anycast
DNSAmp # Matches one-question recursive DNS queries ?endif
DNSAmp proto=17 # Matches one-question recursive DNS queries
Drop # Default Action for DROP policy (deprecated) Drop # Default Action for DROP policy (deprecated)
dropBcast inline # Silently Drop Broadcast dropBcast inline # Silently Drop Broadcast
dropBcasts inline # Silently Drop Broadcast dropBcasts inline # Silently Drop Broadcast
dropInvalid inline # Drops packets in the INVALID conntrack state dropInvalid inline # Drops packets in the INVALID conntrack state
dropMcast inline # Silently Drop Multicast dropMcast inline # Silently Drop Multicast
dropNotSyn noinline # Silently Drop Non-syn TCP packets dropNotSyn noinline,proto=6 # Silently Drop Non-syn TCP packets
DropDNSrep inline # Drops DNS replies DropDNSrep inline,proto=17 # Drops DNS replies
DropSmurfs noinline # Drop smurf packets DropSmurfs noinline # Drop smurf packets
Established inline,\ # Handles packets in the ESTABLISHED state Established inline,\ # Handles packets in the ESTABLISHED state
state=ESTABLISHED # state=ESTABLISHED #
FIN inline,audit # Handles ACK,FIN,PSH packets FIN inline,audit,\ # Handles ACK,FIN packets
proto=6
forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces. forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces.
GlusterFS inline # Handles GlusterFS GlusterFS inline # Handles GlusterFS
IfEvent noinline # Perform an action based on an event IfEvent noinline # Perform an action based on an event
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
state=INVALID # state=INVALID #
Limit noinline # Limit the rate of connections from each individual IP address Limit noinline # Limit the rate of connections from each individual IP address
?if __ADDRTYPE
Multicast inline,audit # Handles Multicast
?else
Multicast noinline,audit # Handles Multicast Multicast noinline,audit # Handles Multicast
?endif
New inline,state=NEW # Handles packets in the NEW conntrack state New inline,state=NEW # Handles packets in the NEW conntrack state
NotSyn inline,audit # Handles TCP packets which do not have SYN=1 and ACK=0 NotSyn inline,audit,\ # Handles TCP packets which do not have SYN=1 and ACK=0
rejNotSyn noinline # Silently Reject Non-syn TCP packets proto=6
rejNotSyn noinline,proto=6 # Silently Reject Non-syn TCP packets
Reject # Default Action for REJECT policy (deprecated) Reject # Default Action for REJECT policy (deprecated)
Related inline,\ # Handles packets in the RELATED conntrack state Related inline,\ # Handles packets in the RELATED conntrack state
state=RELATED # state=RELATED #
ResetEvent inline # Reset an Event ResetEvent inline # Reset an Event
RST inline,audit # Handle packets with RST set RST inline,audit,\ # Handle packets with RST set
proto=6
SetEvent inline # Initialize an event SetEvent inline # Initialize an event
TCPFlags # Handle bad flag combinations. TCPFlags proto=6 # Handle bad flag combinations.
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
state=UNTRACKED # state=UNTRACKED #

View File

@@ -77,7 +77,7 @@ UNTRACKED_LOG_LEVEL=
ARPTABLES= ARPTABLES=
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall" CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE
@@ -241,7 +241,7 @@ TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2" TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
TRACK_PROVIDERS=No TRACK_PROVIDERS=Yes
TRACK_RULES=No TRACK_RULES=No

View File

@@ -3,4 +3,4 @@
# #
# /usr/share/shorewall/configpath # /usr/share/shorewall/configpath
# #
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.cli-std. # Shorewall 5.1 -- /usr/share/shorewall/lib.cli-std.
# #
# (c) 1999-2015 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -47,11 +47,10 @@ get_config() {
fi fi
fi fi
if [ "$(id -u)" -eq 0 ]; then if [ -n "$g_shorewalldir" ]; then
config=$(find_file ${PRODUCT}.conf)
else
[ -n "$g_shorewalldir" ] || fatal_error "Ordinary users may not $COMMAND the $CONFDIR/$PRODUCT configuration"
config="$g_shorewalldir/$PRODUCT.conf" config="$g_shorewalldir/$PRODUCT.conf"
else
config=$(find_file ${PRODUCT}.conf)
fi fi
if [ -f $config ]; then if [ -f $config ]; then
@@ -211,30 +210,35 @@ get_config() {
LOG_VERBOSITY=-1 LOG_VERBOSITY=-1
fi fi
if [ -n "$SHOREWALL_SHELL" -a -z "$g_export" ]; then if [ -z "${g_export}${g_test}" ]; then
if [ ! -x "$SHOREWALL_SHELL" ]; then if [ -n "$SHOREWALL_SHELL" ]; then
echo " WARNING: The program specified in SHOREWALL_SHELL does not exist or is not executable; falling back to /bin/sh" >&2 if [ ! -x "$SHOREWALL_SHELL" ]; then
SHOREWALL_SHELL=/bin/sh echo " WARNING: The program specified in SHOREWALL_SHELL does not exist or is not executable; falling back to /bin/sh" >&2
SHOREWALL_SHELL=/bin/sh
fi
fi fi
fi
if [ -n "$IP" ]; then if [ -n "$IP" ]; then
case "$IP" in case "$IP" in
*/*) */*)
if [ ! -x "$IP" ] ; then if [ ! -x "$IP" ] ; then
fatal_error "The program specified in IP ($IP) does not exist or is not executable" fatal_error "The program specified in IP ($IP) does not exist or is not executable"
fi fi
;; ;;
*) *)
prog="$(mywhich $IP 2> /dev/null)" prog="$(mywhich $IP 2> /dev/null)"
if [ -z "$prog" ] ; then if [ -z "$prog" ] ; then
fatal_error "Can't find $IP executable" fatal_error "Can't find $IP executable"
fi fi
IP=$prog IP=$prog
;; ;;
esac esac
else
IP='ip'
fi
else else
IP='ip' [ -n "$SHOREWALL_SHELL" ] || SHOREWALL_SHELL=/bin/sh
[ -n "$IP" ] || IP='ip'
fi fi
case $VERBOSITY in case $VERBOSITY in
@@ -337,8 +341,12 @@ get_config() {
fi fi
fi fi
if [ -n "$DYNAMIC_BLACKLIST" ]; then if [ -n "$DYNAMIC_BLACKLIST" -a "$(id -u)" = 0 ]; then
setup_dbl case $COMMAND in
blacklist|allow|drop|logdrop|reject)
setup_dbl
;;
esac
fi fi
if [ -z "$PERL_HASH_SEED" ]; then if [ -z "$PERL_HASH_SEED" ]; then
@@ -358,6 +366,17 @@ get_config() {
[ -f $lib ] && . $lib [ -f $lib ] && . $lib
} }
#
# Ensure that the effective UID is 0 or that we are dealing with a private configuration
#
ensure_root() {
if [ $(id -u) -ne 0 ]; then
if [ -z "$g_shorewalldir" -o "$g_shorewalldir" = $CONFDIR/$PRODUCT ]; then
startup_error "Ordinary users may not $COMMAND the default $PRODUCT configuration"
fi
fi
}
# #
# Determine if there are config files newer than the passed object # Determine if there are config files newer than the passed object
# #
@@ -365,20 +384,13 @@ uptodate() {
[ -x $1 ] || return 1 [ -x $1 ] || return 1
local dir local dir
local ifs
ifs="$IFS" for dir in $g_shorewalldir $(split $CONFIG_PATH); do
IFS=':' if [ -n "$(find ${dir} -maxdepth 1 -type f -newer $1 -print -quit)" ]; then
for dir in $g_shorewalldir $CONFIG_PATH; do
if [ -n "$(find ${dir} -newer $1)" ]; then
IFS="$ifs"
return 1; return 1;
fi fi
done done
IFS="$ifs"
return 0 return 0
} }
@@ -408,11 +420,7 @@ compiler() {
pc=${LIBEXECDIR}/shorewall/compiler.pl pc=${LIBEXECDIR}/shorewall/compiler.pl
if [ $(id -u) -ne 0 ]; then ensure_root
if [ -z "$g_shorewalldir" -o "$g_shorewalldir" = $CONFDIR/$PRODUCT ]; then
startup_error "Ordinary users may not $COMMAND the $CONFDIR/$PRODUCT configuration"
fi
fi
# #
# We've now set g_shorewalldir so recalculate CONFIG_PATH # We've now set g_shorewalldir so recalculate CONFIG_PATH
# #
@@ -770,6 +778,10 @@ check_command() {
g_profile=Yes g_profile=Yes
option=${option#p} option=${option#p}
;; ;;
t*)
g_test=Yes
option=${option#t}
;;
d*) d*)
g_debug=Yes; g_debug=Yes;
option=${option#d} option=${option#d}
@@ -854,6 +866,10 @@ update_command() {
g_profile=Yes g_profile=Yes
option=${option#p} option=${option#p}
;; ;;
t*)
g_test=Yes
option=${option#t}
;;
d*) d*)
g_debug=Yes; g_debug=Yes;
option=${option#d} option=${option#d}
@@ -1527,6 +1543,8 @@ remote_reload_command() # $* = original arguments less the command.
litedir="${VARDIR}-lite" litedir="${VARDIR}-lite"
fi fi
g_export=Yes
if [ -f $g_shorewalldir/${PRODUCT}.conf ]; then if [ -f $g_shorewalldir/${PRODUCT}.conf ]; then
if [ -f $g_shorewalldir/params ]; then if [ -f $g_shorewalldir/params ]; then
. $g_shorewalldir/params . $g_shorewalldir/params
@@ -1566,8 +1584,6 @@ remote_reload_command() # $* = original arguments less the command.
file=$(resolve_file $g_shorewalldir/firewall) file=$(resolve_file $g_shorewalldir/firewall)
g_export=Yes
program=$sbindir/${PRODUCT}-lite program=$sbindir/${PRODUCT}-lite
# #
# Handle nonstandard remote VARDIR # Handle nonstandard remote VARDIR
@@ -1728,6 +1744,7 @@ compiler_command() {
compile_command $@ compile_command $@
;; ;;
refresh) refresh)
only_root
get_config Yes Yes get_config Yes Yes
shift shift
refresh_command $@ refresh_command $@
@@ -1749,11 +1766,13 @@ compiler_command() {
export_command $@ export_command $@
;; ;;
try) try)
only_root
get_config Yes get_config Yes
shift shift
try_command $@ try_command $@
;; ;;
safe-reload|safe-restart|safe-start) safe-reload|safe-restart|safe-start)
only_root
get_config Yes get_config Yes
shift shift
safe_commands $@ safe_commands $@

View File

@@ -791,11 +791,7 @@
<title>See ALSO</title> <title>See ALSO</title>
<para><ulink <para><ulink
url="/Accounting.html">http://www.shorewall.net/Accounting.html url="shorewall-logging.htm">shorewall-logging(5)</ulink></para>
</ulink></para>
<para><ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink></para>
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>

View File

@@ -191,6 +191,27 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>proto</option>=<replaceable>protocol</replaceable></term>
<listitem>
<para>Added in Shorewall 5.1.10. Specifies that the action is
only usable with the specified
<replaceable>protocol</replaceable> (name or number). When the
action is invoked with no protocol specified in the PROTO
column, or if the action is used as a Policy Action, the named
<replaceable>protocol</replaceable> will be assumed. If a
protocol is specified in the PROTO column of an invocation,
then it must match the named
<replaceable>protocol</replaceable>.</para>
<para>The <option>proto</option> option has no effect if the
<option>inline</option> or <option>builtin</option> option is
specified. A warning is issued if <option>proto</option> is
specified along with <option>builtin</option>.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>section</option></term> <term><option>section</option></term>

View File

@@ -167,7 +167,7 @@
<listitem> <listitem>
<para>queues matching packets to a back end logging daemon via <para>queues matching packets to a back end logging daemon via
a netlink socket then continues to the next rule. See <ulink a netlink socket then continues to the next rule. See <ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para> url="shorewall-logging.html">shorewall-logging(5)</ulink>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -258,7 +258,7 @@
<para>You may also specify <emphasis role="bold">NFLOG</emphasis> <para>You may also specify <emphasis role="bold">NFLOG</emphasis>
(must be in upper case) as a log level.This will log to the NFLOG (must be in upper case) as a log level.This will log to the NFLOG
target for routing to a separate log through use of ulogd (<ulink target for routing to a separate log through use of ulogd (<ulink
url="http://www.netfilter.org/projects/ulogd/index.html">http://www.netfilter.org/projects/ulogd/index.html</ulink>).</para> url="shorewall-logging.html">shorewall-logging.htm</ulink>).</para>
<para>Actions specifying logging may be followed by a log tag (a <para>Actions specifying logging may be followed by a log tag (a
string of alphanumeric characters) which is appended to the string string of alphanumeric characters) which is appended to the string

View File

@@ -447,7 +447,7 @@
<listitem> <listitem>
<para>This form combines the preceding two and requires that <para>This form combines the preceding two and requires that
both the incoming interace and source address match.</para> both the incoming interface and source address match.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -543,7 +543,7 @@
<listitem> <listitem>
<para>This form combines the preceding two and requires that <para>This form combines the preceding two and requires that
both the outgoing interace and destination address both the outgoing interface and destination address
match.</para> match.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -579,14 +579,23 @@
<listitem> <listitem>
<para>A protocol name from <filename>/etc/protocols</filename> or a <para>A protocol name from <filename>/etc/protocols</filename> or a
protocol number.</para> protocol number. tcp and 6 may be optionally followed by <emphasis
role="bold">:syn </emphasis>to match only the SYN packet (first
packet in the three-way handshake).</para>
<para>Beginning with Shorewall 4.5.12, this column is labeled <para>Beginning with Shorewall 4.5.12, this column can accept a
<emphasis role="bold">PROTOS</emphasis> and can accept a comma-separated list of protocols and either <emphasis
comma-separated list of protocols. Either <emphasis
role="bold">proto</emphasis> or <emphasis role="bold">proto</emphasis> or <emphasis
role="bold">protos</emphasis> is accepted in the alternate input role="bold">protos</emphasis> is accepted in the alternate input
format.</para> format.</para>
<para>Beginning with Shorewall 5.1.11, when <emphasis
role="bold">tcp</emphasis> or <emphasis role="bold">6</emphasis> is
specified and the ACTION is <emphasis role="bold">CT</emphasis>, the
compiler will default to <emphasis role="bold">:syn</emphasis>. If
you wish the rule to match packets with any valid combination of TCP
flags, you may specify <emphasis role="bold">tcp:all</emphasis> or
<emphasis role="bold">6:all</emphasis>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@@ -112,7 +112,10 @@ loc eth2 -</programlisting>
url="/manpages/shorewall-nesting.html">shorewall-nesting</ulink>(5) url="/manpages/shorewall-nesting.html">shorewall-nesting</ulink>(5)
for a discussion of this problem.</para> for a discussion of this problem.</para>
<para>Shorewall allows '+' as an interface name.</para> <para>Shorewall allows '+' as an interface name, but that usage is
deprecated. A better approach is to specify
'<option>physical</option>=+' in the OPTIONS column (see
below).</para>
<para>There is no need to define the loopback interface (lo) in this <para>There is no need to define the loopback interface (lo) in this
file.</para> file.</para>
@@ -193,6 +196,54 @@ loc eth2 -</programlisting>
should have no embedded white-space.</para> should have no embedded white-space.</para>
<variablelist> <variablelist>
<varlistentry>
<term><emphasis
role="bold">accept_ra</emphasis>[={0|1|2}]</term>
<listitem>
<para>IPv6 only; added in Shorewall 4.5.16. Values are:</para>
<variablelist>
<varlistentry>
<term>0</term>
<listitem>
<para>Do not accept Router Advertisements.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>1</term>
<listitem>
<para>Accept Route Advertisements if forwarding is
disabled.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>2</term>
<listitem>
<para>Overrule forwarding behavior. Accept Route
Advertisements even if forwarding is enabled.</para>
</listitem>
</varlistentry>
</variablelist>
<para>If the option is specified without a value, then the
value 1 is assumed.</para>
<note>
<para>This option does not work with a wild-card <emphasis
role="bold">physical</emphasis> name (e.g., eth0.+).
Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">arp_filter[={0|1}]</emphasis></term> <term><emphasis role="bold">arp_filter[={0|1}]</emphasis></term>
@@ -209,12 +260,12 @@ loc eth2 -</programlisting>
changed; the value assigned to the setting will be the value changed; the value assigned to the setting will be the value
specified (if any) or 1 if no value is given.</para> specified (if any) or 1 if no value is given.</para>
<para/>
<note> <note>
<para>This option does not work with a wild-card <para>This option does not work with a wild-card <emphasis
<replaceable>interface</replaceable> name (e.g., eth0.+) in role="bold">physical</emphasis> name (e.g., eth0.+).
the INTERFACE column.</para> Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note> </note>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -243,16 +294,14 @@ loc eth2 -</programlisting>
<para>8 - do not reply for all local addresses</para> <para>8 - do not reply for all local addresses</para>
<para/>
<note> <note>
<para>This option does not work with a wild-card <para>This option does not work with a wild-card <emphasis
<replaceable>interface</replaceable> name (e.g., eth0.+) in role="bold">physical</emphasis> name (e.g., eth0.+).
the INTERFACE column.</para> Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note> </note>
<para/>
<warning> <warning>
<para>Do not specify <emphasis <para>Do not specify <emphasis
role="bold">arp_ignore</emphasis> for any interface involved role="bold">arp_ignore</emphasis> for any interface involved
@@ -430,6 +479,25 @@ loc eth2 -</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">forward</emphasis>[={0|1}]</term>
<listitem>
<para>IPv6 only Sets the
/proc/sys/net/ipv6/conf/interface/forwarding option to the
specified value. If no value is supplied, then 1 is
assumed.</para>
<note>
<para>This option does not work with a wild-card <emphasis
role="bold">physical</emphasis> name (e.g., eth0.+).
Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">ignore[=1]</emphasis></term> <term><emphasis role="bold">ignore[=1]</emphasis></term>
@@ -496,9 +564,11 @@ loc eth2 -</programlisting>
<para/> <para/>
<note> <note>
<para>This option does not work with a wild-card <para>This option does not work with a wild-card <emphasis
<replaceable>interface</replaceable> name (e.g., eth0.+) in role="bold">physical</emphasis> name (e.g., eth0.+).
the INTERFACE column.</para> Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note> </note>
<blockquote> <blockquote>
@@ -625,7 +695,10 @@ loc eth2 -</programlisting>
<para>If the <emphasis>interface</emphasis> name is a wildcard <para>If the <emphasis>interface</emphasis> name is a wildcard
name (ends with '+'), then the physical name (ends with '+'), then the physical
<emphasis>name</emphasis> must also end in '+'.</para> <emphasis>name</emphasis> must also end in '+'. The physical
<replaceable>name</replaceable> may end in '+' (or be exactly
'+') when the <replaceable>interface</replaceable> name is not
a wildcard name.</para>
<para>If <option>physical</option> is not specified, then it's <para>If <option>physical</option> is not specified, then it's
value defaults to the <emphasis>interface</emphasis> value defaults to the <emphasis>interface</emphasis>
@@ -647,9 +720,13 @@ loc eth2 -</programlisting>
url="http://tldp.org/HOWTO/Proxy-ARP-Subnet/index.html">http://tldp.org/HOWTO/Proxy-ARP-Subnet/index.html. url="http://tldp.org/HOWTO/Proxy-ARP-Subnet/index.html">http://tldp.org/HOWTO/Proxy-ARP-Subnet/index.html.
</ulink></para> </ulink></para>
<para><emphasis role="bold">Note</emphasis>: This option does <note>
not work with a wild-card <replaceable>interface</replaceable> <para>This option does not work with a wild-card <emphasis
name (e.g., eth0.+) in the INTERFACE column.</para> role="bold">physical</emphasis> name (e.g., eth0.+).
Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note>
<para>Only those interfaces with the <option>proxyarp</option> <para>Only those interfaces with the <option>proxyarp</option>
option will have their setting changed; the value assigned to option will have their setting changed; the value assigned to
@@ -665,9 +742,13 @@ loc eth2 -</programlisting>
<para>IPv6 only. Sets <para>IPv6 only. Sets
/proc/sys/net/ipv6/conf/<emphasis>interface</emphasis>/proxy_ndp.</para> /proc/sys/net/ipv6/conf/<emphasis>interface</emphasis>/proxy_ndp.</para>
<para><emphasis role="bold">Note</emphasis>: This option does <note>
not work with a wild-card <replaceable>interface</replaceable> <para>This option does not work with a wild-card <emphasis
name (e.g., eth0.+) in the INTERFACE column.</para> role="bold">physical</emphasis> name (e.g., eth0.+).
Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note>
<para>Only those interfaces with the <option>proxyndp</option> <para>Only those interfaces with the <option>proxyndp</option>
option will have their setting changed; the value assigned to option will have their setting changed; the value assigned to
@@ -731,9 +812,11 @@ loc eth2 -</programlisting>
filtering.</para> filtering.</para>
<note> <note>
<para>This option does not work with a wild-card <para>This option does not work with a wild-card <emphasis
<replaceable>interface</replaceable> name (e.g., eth0.+) in role="bold">physical</emphasis> name (e.g., eth0.+).
the INTERFACE column.</para> Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note> </note>
<para>This option can also be enabled globally via the <para>This option can also be enabled globally via the
@@ -842,9 +925,11 @@ loc eth2 -</programlisting>
specified (if any) or 1 if no value is given.</para> specified (if any) or 1 if no value is given.</para>
<note> <note>
<para>This option does not work with a wild-card <para>This option does not work with a wild-card <emphasis
<replaceable>interface</replaceable> name (e.g., eth0.+) in role="bold">physical</emphasis> name (e.g., eth0.+).
the INTERFACE column.</para> Beginning with Shorewall 5.1.10, If this option is
specified, a warning is issued and the option is
ignored.</para>
</note> </note>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@@ -0,0 +1,385 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<refentry>
<refmeta>
<refentrytitle>shorewall-logging</refentrytitle>
<manvolnum>5</manvolnum>
<refmiscinfo>Configuration Files</refmiscinfo>
</refmeta>
<refnamediv>
<refname>logging</refname>
<refpurpose>Shorewall logging</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command><replaceable>action</replaceable>:<replaceable>level</replaceable></command>
</cmdsynopsis>
<cmdsynopsis>
<command>NFLOG(<replaceable>nflog-parameters</replaceable>)</command>
</cmdsynopsis>
<cmdsynopsis>
<command>ULOG(<replaceable>ulog-parameters</replaceable>)</command>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>The disposition of packets entering a Shorewall firewall is
determined by one of a number of Shorewall facilities. Only some of these
facilities permit logging.</para>
<orderedlist>
<listitem>
<para>The packet is part of an established connection. While the
packet can be logged using LOG rules in the ESTABLISHED section of
<ulink
url="manpages/shorewall-rules.html">/etc/shorewall/rules</ulink>, that
is not recommended because of the large amount of information that may
be logged.</para>
</listitem>
<listitem>
<para>The packet represents a connection request that is related to an
established connection (such as a <ulink url="FTP.html">data
connection associated with an FTP control connection</ulink>). These
packets may be logged using LOG rules in the RELATED section of <ulink
url="manpages/shorewall-rules.html">shorewall-rules(5)</ulink>.</para>
</listitem>
<listitem>
<para>The packet is rejected because of an option in <ulink
url="manpages/shorewall.conf.html">shorewall.conf</ulink>(5) or <ulink
url="manpages/shorewall-interfaces.html">shorewall-interfaces(5)</ulink>.
These packets can be logged by setting the appropriate logging-related
option in <ulink
url="manpages/shorewall.conf.html">/etc/shorewall/shorewall.conf</ulink>.</para>
</listitem>
<listitem>
<para>The packet matches a rule in <ulink
url="manpages/shorewall-rules.html">shorewall-rules</ulink>(5). By
including a syslog level (see below) in the ACTION column of a rule
(e.g., <quote>ACCEPT<emphasis role="bold">:info</emphasis> net $FW tcp
22</quote>), the connection attempt will be logged at that
level.</para>
</listitem>
<listitem>
<para>The packet doesn't match a rule so it is handled by a policy
defined in <ulink
url="manpages/shorewall-policy.html">shorewall-policy(5)</ulink>.
These may be logged by specifying a syslog level in the LOG LEVEL
column of the policy's entry (e.g., <quote>loc net ACCEPT <emphasis
role="bold">info</emphasis></quote>).</para>
</listitem>
</orderedlist>
</refsect1>
<refsect1>
<title>Default Logging</title>
<para>By default, Shorewall directs Netfilter to log using syslog (8).
Syslog classifies log messages by a <emphasis>facility</emphasis> and a
<emphasis>priority</emphasis> (using the notation
<emphasis>facility.priority</emphasis>).</para>
<para>The facilities defined by syslog are <emphasis>auth, authpriv, cron,
daemon, kern, lpr, mail, mark, news, syslog, user, uucp</emphasis> and
<emphasis>local0</emphasis> through <emphasis>local7.</emphasis></para>
<para>Throughout the Shorewall documentation, the term
<emphasis>level</emphasis> rather than <emphasis>priority is used,
</emphasis>since <emphasis>level</emphasis> is the term used by Netfilter.
The syslog documentation uses the term
<emphasis>priority</emphasis>.</para>
</refsect1>
<refsect1>
<title>Syslog Levels</title>
<para>Syslog levels are a method of describing to syslog (8) the
importance of a message. A number of Shorewall parameters have a syslog
level as their value.</para>
<para>Valid levels are:</para>
<simplelist>
<member>7 - <emphasis role="bold">debug</emphasis> (Debug-level
messages)</member>
<member>6 - <emphasis role="bold">info</emphasis>
(Informational)</member>
<member>5 - <emphasis role="bold">notice</emphasis> (Normal but
significant Condition)</member>
<member>4 - <emphasis role="bold">warning</emphasis> (Warning
Condition)</member>
<member>3 - <emphasis role="bold">err</emphasis> (Error
Condition)</member>
<member>2 - <emphasis role="bold">crit</emphasis> (Critical
Conditions)</member>
<member>1 - <emphasis role="bold">alert</emphasis> (must be handled
immediately)</member>
<member>0 - <emphasis role="bold">emerg</emphasis> (System is
unusable)</member>
</simplelist>
<para>For most Shorewall logging, a level of 6 (info) is appropriate.
Shorewall log messages are generated by Netfilter and are logged using the
<emphasis>kern</emphasis> facility and the level that you specify. If you
are unsure of the level to choose, 6 (info) is a safe bet. You may specify
levels by name or by number.</para>
<para>Beginning with Shorewall 4.5.5, the <replaceable>level</replaceable>
name or number may be optionally followed by a comma-separated list of one
or more<replaceable> log options</replaceable>. The list is enclosed in
parentheses. Log options cause additional information to be included in
each log message.</para>
<para>Valid log options are:</para>
<variablelist>
<varlistentry>
<term><emphasis role="bold">ip_options</emphasis></term>
<listitem>
<para>Log messages will include the option settings from the IP
header.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">macdecode</emphasis></term>
<listitem>
<para>Decode the MAC address and protocol.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">tcp_sequence</emphasis></term>
<listitem>
<para>Include TCP sequence numbers.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">tcp_options</emphasis></term>
<listitem>
<para>Include options from the TCP header.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">uid</emphasis></term>
<listitem>
<para>Include the UID of the sending program; only valid for packets
originating on the firewall itself.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Example: <emphasis
role="bold">info(tcp_options,tcp_sequence)</emphasis></para>
<para>Syslogd writes log messages to files (typically in <filename
class="directory">/var/log/</filename>*) based on their facility and
level. The mapping of these facility/level pairs to log files is done in
/etc/syslog.conf (5). If you make changes to this file, you must restart
syslogd before the changes can take effect.</para>
<para>Syslog may also write to your system console. See <ulink
url="FAQ.htm#faq16">Shorewall FAQ 16</ulink> for ways to avoid having
Shorewall messages written to the console.</para>
</refsect1>
<refsect1>
<title>Configuring a Separate Log for Shorewall Messages (ulogd)</title>
<para>There are a couple of limitations to syslogd-based logging:</para>
<orderedlist>
<listitem>
<para>If you give, for example, kern.info its own log destination then
that destination will also receive all kernel messages of levels 5
(notice) through 0 (emerg).</para>
</listitem>
<listitem>
<para>All kernel.info messages will go to that destination and not
just those from Netfilter.</para>
</listitem>
<listitem>
<para>Netfilter (Shorewall) messages show up in
<command>dmesg</command>.</para>
</listitem>
</orderedlist>
<para>If your kernel has NFLOG target support (and most vendor-supplied
kernels do), you may also specify a log level of NFLOG (must be all caps).
When NFLOG is used, Shorewall will direct Netfilter to log the related
messages via the NFLOG target which will send them to a process called
<quote>ulogd</quote>. The ulogd program is included in most
distributions.</para>
<note>
<para>The NFLOG logging mechanism is <emphasis
role="underline">completely separate</emphasis> from syslog. Once you
switch to NFLOG, the settings in <filename>/etc/syslog.conf</filename>
have absolutely no effect on your Shorewall logging (except for
Shorewall status messages which still go to syslog).</para>
</note>
<para>You will need to change all instances of log levels (usually
<quote>info</quote>) in your Shorewall configuration files to
<quote>NFLOG</quote> - this includes entries in the policy, rules and
shorewall.conf files. If you initially installed using Shorewall 5.1.2 or
later, you can simply change the setting of LOG_LEVEL in
shorewall.conf.</para>
</refsect1>
<refsect1>
<title>Understanding the Contents of Shorewall Log Messages</title>
<para>For general information on the contents of Netfilter log messages,
see <ulink
url="http://logi.cc/en/2010/07/netfilter-log-format/">http://logi.cc/en/2010/07/netfilter-log-format/</ulink>.</para>
<para>For Shorewall-specific information, see <ulink
url="/FAQ.htm#faq17">FAQ #17</ulink>.</para>
</refsect1>
<refsect1>
<title>Customizing the Content of Shorewall Log Messages</title>
<para>In a Shorewall logging rule, the log level can be followed by a
<firstterm>log tag</firstterm> as in "DROP:NFLOG:junk". The generated log
message will include "<emphasis>chain-name</emphasis> junk DROP".</para>
<para>By setting the LOGTAGONLY option to Yes in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink> or <ulink
url="/manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>, the
disposition ('DROP' in the above example) will be omitted. Consider the
following rule:</para>
<programlisting>#ACTION SOURCE DEST PROTO
REJECT(icmp-proto-unreachable):notice:IPv6 loc net 41 # who's using IPv6 tunneling</programlisting>
<para>This rule generates the following warning at compile time:</para>
<simplelist>
<member>WARNING: Log Prefix shortened to "Shorewall:IPv6:REJECT(icmp-p "
/etc/shorewall/rules (line 212)</member>
</simplelist>
<para>and produces the rather ugly prefix "Shorewall:IPv6:REJECT(icmp-p
".</para>
<para>Now consider this similar rule:</para>
<programlisting>#ACTION SOURCE DEST PROTO
REJECT(icmp-proto-unreachable):notice:IPv6,tunneling loc net 41 # who's using IPv6 tunneling</programlisting>
<para>With LOGTAGONLY=Yes, no warning is generated and the prefix becomes
"Shorewall:IPv6:tunneling:"</para>
<para>See the <ulink url="shorewall.conf.html">shorewall[6].conf man
page</ulink> for further information about how LOGTAGONLY=Yes can be
used.</para>
</refsect1>
<refsect1>
<title>Log Backends</title>
<para>Netfilter logging allows configuration of multiple backends. Logging
backends provide the The low-level forward of log messages. There are
currently three backends:</para>
<variablelist>
<varlistentry>
<term>LOG (ipt_LOG and ip6t_LOG).</term>
<listitem>
<para>Normal kernel-based logging to a syslog daemon.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ULOG (ipt_ULOG)</term>
<listitem>
<para>ULOG logging as described ablve. Only available for
IPv4.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>netlink (nfnetlink_log)</term>
<listitem>
<para>The logging backend behind NFLOG, defined above.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The currently-available and currently-selected IPv4 and IPv6
backends are shown in /proc/sys/net/netfilter/nf_log:</para>
<programlisting>cat /proc/net/netfilter/nf_log
0 NONE (nfnetlink_log)
1 NONE (nfnetlink_log)
2 ipt_ULOG (ipt_ULOG,ipt_LOG,nfnetlink_log)
3 NONE (nfnetlink_log)
4 NONE (nfnetlink_log)
5 NONE (nfnetlink_log)
6 NONE (nfnetlink_log)
7 NONE (nfnetlink_log)
8 NONE (nfnetlink_log)
9 NONE (nfnetlink_log)
10 ip6t_LOG (ip6t_LOG,nfnetlink_log)
11 NONE (nfnetlink_log)
12 NONE (nfnetlink_log)</programlisting>
<para>The magic numbers (0-12) are Linux address family numbers (AF_INET
is 2 and AF_INET6 is 10).</para>
<para>The name immediately following the number is the currently-selected
backend, and the ones in parentheses are the ones that are available. You
can change the currently selected backend by echoing it's name into
/proc/net/netfilter/nf_log.<replaceable>number</replaceable>.</para>
<para>Example - change the IPv4 backend to LOG:</para>
<programlisting>sysctl net.netfilter.nf_log.2=ipt_LOG</programlisting>
<para>Beginning with Shorewall 4.6.4, you can configure the backend using
the LOG_BACKEND option in <ulink
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink> and <ulink
url="manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>.</para>
</refsect1>
<refsect1>
<title>SEE ALSO</title>
<para><ulink
url="/shorewall_logging.htm">http://www.shorewall.net/shorewall_logging.html</ulink></para>
</refsect1>
</refentry>

View File

@@ -674,6 +674,43 @@ SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis
role="bold">TCPMSS</emphasis>([<replaceable>mss</replaceable>[,<replaceable>ipsec</replaceable>]])</term>
<listitem>
<para>Added in Shorewall 5.1.9. This target only applies to
TCP traffic and alters the MSS value in SYN packets. It may be
used in the FORWARD and POSTROUTING chains; the default is
FORWARD.</para>
<para>The <replaceable>mss</replaceable> parameter may be
either <option>pmtu</option> or an integer in the range
500:65533. The value <option>pmtu</option> automatically
clamps the MSS value to (path_MTU - 40 for IPv4; -60 for
IPv6). This may not function as desired where asymmetric
routes with differing path MTU exist — the kernel uses the
path MTU which it would use to send packets from itself to the
source and destination IP addresses. Prior to Linux 2.6.25,
only the path MTU to the destination IP address was considered
by this option; subsequent kernels also consider the path MTU
to the source IP address. If an integer is given, the MSS
option is set to the specified value. If the MSS of the packet
is already lower than <replaceable>mss</replaceable>, it will
not be increased (from Linux 2.6.25 onwards) to avoid more
problems with hosts relying on a proper MSS. If
<replaceable>mss</replaceable> is omitted,
<option>pmtu</option> is assumed.</para>
<para>The <replaceable>ipsec</replaceable> parameter
determines whether the rule applies to IPSEC traffic
(<option>ipsec</option> is passed), non-IPSEC traffic
(<option>none</option> is passed) or both
(<option>all</option> is passed). If omitted,
<option>all</option> is assumed.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">TOS</emphasis>(<replaceable>tos</replaceable>[/<replaceable>mask</replaceable>])</term> role="bold">TOS</emphasis>(<replaceable>tos</replaceable>[/<replaceable>mask</replaceable>])</term>
@@ -710,7 +747,7 @@ Normal-Service =&gt; 0x00</programlisting>
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">TPROXY</emphasis>([<replaceable>port</replaceable>][,<replaceable>address</replaceable>])</term> role="bold">TPROXY</emphasis>([<replaceable>port</replaceable>[,<replaceable>address</replaceable>]])</term>
<listitem> <listitem>
<para>Transparently redirects a packet without altering the IP <para>Transparently redirects a packet without altering the IP

View File

@@ -279,8 +279,8 @@
separate log through use of ulogd (<ulink separate log through use of ulogd (<ulink
url="http://www.netfilter.org/projects/ulogd/index.html">http://www.netfilter.org/projects/ulogd/index.html</ulink>).</para> url="http://www.netfilter.org/projects/ulogd/index.html">http://www.netfilter.org/projects/ulogd/index.html</ulink>).</para>
<para>For a description of log levels, see <ulink <para>For a description of logging, see <ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para> url="/shorewall_logging.html">shorewall-logging(5)</ulink>.</para>
<para>If you don't want to log but need to specify the following <para>If you don't want to log but need to specify the following
column, place "-" here.</para> column, place "-" here.</para>

View File

@@ -84,7 +84,7 @@
<para>If PROVIDER_OFFSET is non-zero in <ulink <para>If PROVIDER_OFFSET is non-zero in <ulink
url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>, then url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>, then
the value must be a mutiple of 2^^PROVIDER_OFFSET. In all cases, the the value must be a multiple of 2^^PROVIDER_OFFSET. In all cases, the
number of significant bits may not exceed PROVIDER_OFFSET + number of significant bits may not exceed PROVIDER_OFFSET +
PROVIDER_BITS.</para> PROVIDER_BITS.</para>
</listitem> </listitem>
@@ -220,7 +220,7 @@
<para>In IPV6, the <option>balance</option> option does not <para>In IPV6, the <option>balance</option> option does not
cause balanced default routes to be created; it rather cause balanced default routes to be created; it rather
causes a sequence of default routes with different metrics causes a sequence of default routes with different metrics
to be created. </para> to be created.</para>
</caution> </caution>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -438,6 +438,14 @@
<command>enable</command> and <command>reenable</command> <command>enable</command> and <command>reenable</command>
commands can reenable the provider.</para> commands can reenable the provider.</para>
</note> </note>
<important>
<para>RESTORE_DEFAULT_OPTION=Yes in shorewall[6].conf is not
recommended when the <option>persistent</option> option is
used, as restoring default routes to the main routing table
can prevent link status monitors such as foolsm from
correctly detecting non-working providers.</para>
</important>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>

View File

@@ -67,7 +67,7 @@
this section.</para> this section.</para>
<para>The only ACTIONs allowed in this section are ACCEPT, DROP, <para>The only ACTIONs allowed in this section are ACCEPT, DROP,
REJECT, LOG, NFQUEUE and QUEUE</para> REJECT, LOG, NFLOG, NFQUEUE and QUEUE</para>
<para>There is an implicit ACCEPT rule inserted at the end of this <para>There is an implicit ACCEPT rule inserted at the end of this
section.</para> section.</para>
@@ -82,7 +82,7 @@
section.</para> section.</para>
<para>The only ACTIONs allowed in this section are ACCEPT, DROP, <para>The only ACTIONs allowed in this section are ACCEPT, DROP,
REJECT, LOG, NFQUEUE and QUEUE</para> REJECT, LOG, NFLOG, NFQUEUE and QUEUE</para>
<para>There is an implicit rule added at the end of this section <para>There is an implicit rule added at the end of this section
that invokes the RELATED_DISPOSITION (<ulink that invokes the RELATED_DISPOSITION (<ulink
@@ -98,7 +98,7 @@
processed by rules in this section.</para> processed by rules in this section.</para>
<para>The only Actions allowed in this section are ACCEPT, DROP, <para>The only Actions allowed in this section are ACCEPT, DROP,
REJECT, LOG, NFQUEUE and QUEUE.</para> REJECT, LOG, NFLOG, NFQUEUE and QUEUE.</para>
<para>There is an implicit rule added at the end of this section <para>There is an implicit rule added at the end of this section
that invokes the INVALID_DISPOSITION (<ulink that invokes the INVALID_DISPOSITION (<ulink
@@ -114,7 +114,7 @@
processed by rules in this section.</para> processed by rules in this section.</para>
<para>The only Actions allowed in this section are ACCEPT, DROP, <para>The only Actions allowed in this section are ACCEPT, DROP,
REJECT, LOG, NFQUEUE and QUEUE.</para> REJECT, LOG, NFLOG, NFQUEUE and QUEUE.</para>
<para>There is an implicit rule added at the end of this section <para>There is an implicit rule added at the end of this section
that invokes the UNTRACKED_DISPOSITION (<ulink that invokes the UNTRACKED_DISPOSITION (<ulink
@@ -908,7 +908,7 @@
<para>IPv4 only. Added in Shorewall 4.5.10. Queues matching <para>IPv4 only. Added in Shorewall 4.5.10. Queues matching
packets to a back end logging daemon via a netlink socket then packets to a back end logging daemon via a netlink socket then
continues to the next rule. See <ulink continues to the next rule. See <ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para> url="shorewall-logging.html">shorewall-logging(5)</ulink>.</para>
<para>Similar to<emphasis role="bold"> <para>Similar to<emphasis role="bold">
LOG:ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)], LOG:ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)],
@@ -956,7 +956,7 @@
(IPv4 only) or <emphasis role="bold">NFLOG</emphasis> (must be in (IPv4 only) or <emphasis role="bold">NFLOG</emphasis> (must be in
upper case) as a log level.This will log to the ULOG or NFLOG target upper case) as a log level.This will log to the ULOG or NFLOG target
for routing to a separate log through use of ulogd (<ulink for routing to a separate log through use of ulogd (<ulink
url="http://www.netfilter.org/projects/ulogd/index.html">http://www.netfilter.org/projects/ulogd/index.html</ulink>).</para> url="shorewall-logging.html">shorewall-logging(5)</ulink>).</para>
<para>Actions specifying logging may be followed by a log tag (a <para>Actions specifying logging may be followed by a log tag (a
string of alphanumeric characters) which is appended to the string string of alphanumeric characters) which is appended to the string
@@ -2636,15 +2636,15 @@
<refsect1> <refsect1>
<title>See ALSO</title> <title>See ALSO</title>
<para><ulink
url="shorewall-logging.html">shorewall-logging(5)</ulink></para>
<para><ulink <para><ulink
url="/ipsets.html">http://www.shorewall.net/ipsets.html</ulink></para> url="/ipsets.html">http://www.shorewall.net/ipsets.html</ulink></para>
<para><ulink <para><ulink
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para> url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
<para><ulink
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink></para>
<para>shorewall(8)</para> <para>shorewall(8)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -52,12 +52,52 @@
<term><emphasis role="bold">ACTION</emphasis></term> <term><emphasis role="bold">ACTION</emphasis></term>
<listitem> <listitem>
<para>Defines the type of rule to generate. Choices are:</para> <para>Defines the type of rule to generate. Beginning with Shorewall
5.1.9, with the exception of NFLOG and ULOG, the action may be
followed by a colon (":") and a <replaceable>log level</replaceable>
(see <ulink
url="shorewall-logging.html">shorewall-logging(5)</ulink>).</para>
<para>Choices for ACTION are:</para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">MASQUERADE[+]</emphasis>[([<replaceable>lowport</replaceable>-<replaceable>highport</replaceable>][<option>random</option>])]</term> role="bold"><replaceable>action</replaceable></emphasis>[+][(<replaceable>parameter</replaceable>,...)][:<replaceable>level</replaceable>]</term>
<listitem>
<para>where <replaceable>action</replaceable> is an action
declared in <ulink
url="/manpages/shorewall-actions.html">shorewall-actions(5)</ulink>
with the <option>nat</option> option. See <ulink
url="/Actions.html">www.shorewall.net/Actions.html</ulink> for
further information.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">CONTINUE</emphasis>[+]:<replaceable>level</replaceable></term>
<listitem>
<para>Causes matching packets to be exempted from any
following rules in the file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">LOG:<replaceable>level</replaceable></emphasis></term>
<listitem>
<para>Added in Shorewall 5.1.9. Simply log the packet and
continue with the next rule.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">MASQUERADE[+]</emphasis>[([<replaceable>lowport</replaceable>-<replaceable>highport</replaceable>][<option>random</option>])][:<replaceable>level</replaceable>]</term>
<listitem> <listitem>
<para>Causes matching outgoing packages to have their source <para>Causes matching outgoing packages to have their source
@@ -73,12 +113,52 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis
role="bold">NFLOG</emphasis>[(<replaceable>nflog-parameters</replaceable>)]</term>
<listitem>
<para>Added in Shorewall 5.1.9. Queues matching packets to a
back end logging daemon via a netlink socket then continues to
the next rule. See <ulink
url="shorewall-logging.html">shorewall-logging(5)</ulink>.</para>
<para>The <replaceable>nflog-parameters</replaceable> are a
comma-separated list of up to 3 numbers:</para>
<itemizedlist>
<listitem>
<para>The first number specifies the netlink group
(0-65535). If omitted (e.g., NFLOG(,0,10)) then a value of
0 is assumed.</para>
</listitem>
<listitem>
<para>The second number specifies the maximum number of
bytes to copy. If omitted, 0 (no limit) is assumed.</para>
</listitem>
<listitem>
<para>The third number specifies the number of log
messages that should be buffered in the kernel before they
are sent to user space. The default is 1.</para>
</listitem>
</itemizedlist>
<para>NFLOG is similar to<emphasis role="bold">
LOG:NFLOG</emphasis>[(<replaceable>nflog-parameters</replaceable>)],
except that the log level is not changed when this ACTION is
used in an action or macro body and the invocation of that
action or macro specifies a log level.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">SNAT[+]</emphasis>([<emphasis>address-or-address-range</emphasis>][:<emphasis>lowport</emphasis><emphasis role="bold">SNAT[+]</emphasis>([<emphasis>address-or-address-range</emphasis>][:<emphasis>lowport</emphasis><emphasis
role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis
role="bold">:random</emphasis>][:<option>persistent</option>]|<emphasis role="bold">:random</emphasis>][:<option>persistent</option>]|<emphasis
role="bold">detect</emphasis>|</term> role="bold">detect</emphasis>)[:<replaceable>level</replaceable>]</term>
<listitem> <listitem>
<para>If you specify an address here, matching packets will <para>If you specify an address here, matching packets will
@@ -132,26 +212,21 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">CONTINUE</emphasis>[+]</term>
<listitem>
<para>Causes matching packets to be exempted from any
following rules in the file.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold"><replaceable>action</replaceable></emphasis>[+][(<replaceable>parameter</replaceable>,...)]</term> role="bold">ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)]</term>
<listitem> <listitem>
<para>where <replaceable>action</replaceable> is an action <para>IPv4 only. Added in Shorewall 5.1.9. Queues matching
declared in <ulink packets to a back end logging daemon via a netlink socket then
url="/manpages/shorewall-actions.html">shorewall-actions(5)</ulink> continues to the next rule. See <ulink
with the <option>nat</option> option. See <ulink url="shorewall-logging.html">shorewall-logging(5)</ulink>.</para>
url="/Actions.html">www.shorewall.net/Actions.html</ulink> for
further information.</para> <para>Similar to<emphasis role="bold">
LOG:ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)],
except that the log level is not changed when this ACTION is
used in an action or macro body and the invocation of that
action or macro specifies a log level.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>

View File

@@ -160,7 +160,9 @@
how often the rate is estimated and how many samples are retained how often the rate is estimated and how many samples are retained
for estimating. Please see <ulink for estimating. Please see <ulink
url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink> url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink>
for details.</para> for details. If not specified, the default
<replaceable>interval</replaceable> is 250ms and the default
<replaceable>decay_interval</replaceable> is 4sec.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@@ -172,7 +172,9 @@
how often the rate is estimated and how many samples are retained how often the rate is estimated and how many samples are retained
for estimating. Please see <ulink for estimating. Please see <ulink
url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink> url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink>
for details.</para> for details. If not specified, the default
<replaceable>interval</replaceable> is 250ms and the default
<replaceable>decay_interval</replaceable> is 4sec.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@@ -107,7 +107,7 @@
<simplelist> <simplelist>
<member>2 + 6 + 2*M + 1 = 29</member> <member>2 + 6 + 2*M + 1 = 29</member>
<member>2M = 29 - 2 + 6 + 1 = 20</member> <member>2M = 29 - 2 - 6 - 1 = 20</member>
<member>M = 10</member> <member>M = 10</member>
</simplelist> </simplelist>

View File

@@ -673,7 +673,7 @@
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">CONFIG_PATH</emphasis>=[<emphasis>directory</emphasis>[:<emphasis>directory</emphasis>]...]</term> role="bold">CONFIG_PATH</emphasis>=[[:]<emphasis>directory</emphasis>[:<emphasis>directory</emphasis>]...]</term>
<listitem> <listitem>
<para>Specifies where configuration files other than <para>Specifies where configuration files other than
@@ -701,6 +701,16 @@
/etc/shorewall:/usr/share/shorewall but your particular distribution /etc/shorewall:/usr/share/shorewall but your particular distribution
may set it differently. See the output of shorewall show config for may set it differently. See the output of shorewall show config for
the default on your system.</para> the default on your system.</para>
<para>Beginning with Shorewall 5.1.10, the CONFIG_PATH setting may
begin with a colon (":"), to signal that the first
<replaceable>directory</replaceable> listed will be skipped if the
user performing a compilation is not root or if the configuration is
being compiled for export (-e option specified or if running one of
the remote-* commands) . This prevents the compiler from looking in
<filename>/etc/shorewall[6]</filename>/ when compilation is being
done by a non-root user or if the generated script is to be sent to
a remote firewall system.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -720,6 +730,14 @@
and <command>restart</command> commands will succeed even if no DNS and <command>restart</command> commands will succeed even if no DNS
server is reachable (assuming that the configuration hasn't changed server is reachable (assuming that the configuration hasn't changed
since the compiled script was last generated).</para> since the compiled script was last generated).</para>
<important>
<para>When DEFER_DNS_RESOLUTION=No and AUTOMAKE=Yes and a DNS
change makes it necessary to recompile an existing firewall
script, the <option>-c</option> option must be used with the
<command>reload</command> or <command>restart</command> command to
force recompilation.</para>
</important>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1566,10 +1584,9 @@ net all DROP info</programlisting>then the chain name is 'net-all'
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands. log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
If not assigned or if assigned an empty value, /var/log/messages is If not assigned or if assigned an empty value, /var/log/messages is
assumed. For further information, see <ulink assumed. For further information, see <ulink
url="/manpages/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>. url="shorewall-logging.html">shorewall-logging(8)</ulink>. Beginning
Beginning with Shorewall 5.0.10.1, you may specify with Shorewall 5.0.10.1, you may specify <option>systemd</option> to
<option>systemd</option> to use <command>journelctl -r</command> to use <command>journelctl -r</command> to read the log.</para>
read the log.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@@ -2,7 +2,7 @@
# #
# Script to back uninstall Shoreline Firewall # Script to back uninstall Shoreline Firewall
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at http://www.shorewall.net
# #

View File

@@ -1,82 +0,0 @@
# Shorewall6 Packet Filtering Firewall Export Directory Makefile - V4.2
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://www.shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
################################################################################
# Place this file in each export directory. Modify each copy to set HOST
# to the name of the remote firewall corresponding to the directory.
#
# To make the 'firewall' script, type "make".
#
# Once the script is compiling correctly, you can install it by
# typing "make install".
#
################################################################################
# V A R I A B L E S
#
# Files in the export directory on which the firewall script does not depend
#
IGNOREFILES = firewall% Makefile% trace% %~
#
# Remote Firewall system
#
HOST = gateway
#
# Save some typing
#
LITEDIR = /var/lib/shorewall6-lite
#
# Set this if the remote system has a non-standard modules directory
#
MODULESDIR=
#
# Default target is the firewall script
#
################################################################################
# T A R G E T S
#
all: firewall
#
# Only generate the capabilities file if it doesn't already exist
#
capabilities:
ssh root@$(HOST) "MODULESDIR=$(MODULESDIR) /usr/share/shorewall6-lite/shorecap > $(LITEDIR)/capabilities"
scp root@$(HOST):$(LITEDIR)/capabilities .
#
# Compile the firewall script. Using the 'wildcard' function causes "*" to be expanded so that
# 'filter-out' will be presented with the list of files in this directory rather than "*"
#
firewall: $(filter-out $(IGNOREFILES) capabilities , $(wildcard *) ) capabilities
shorewall6 compile -e . firewall
#
# Only reload on demand.
#
install: firewall
scp firewall firewall.conf root@$(HOST):$(LITEDIR)
ssh root@$(HOST) "/sbin/shorewall6-lite restart"
#
# Save running configuration
#
save:
ssh root@$(HOST) "/sbin/shorewall6-lite save"
#
# Remove generated files
#
clean:
rm -f capabilities firewall firewall.conf reload

View File

@@ -11,5 +11,5 @@
############################################################################### ###############################################################################
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
- lo ignore - lo ignore
net all dhcp,physical=+,routeback,sourceroute=0 net all dhcp,physical=+,routeback

View File

@@ -74,7 +74,7 @@ UNTRACKED_LOG_LEVEL=
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S # L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
############################################################################### ###############################################################################
CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall CONFIG_PATH=":${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE

View File

@@ -1,6 +1,6 @@
# #
# Shorewall6 version 5 - Sample Interfaces File for one-interface configuration. # Shorewall6 - Sample Interfaces File for one-interface configuration.
# Copyright (C) 2006-2015 by the Shorewall Team # Copyright (C) 2006-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -14,4 +14,4 @@
?FORMAT 2 ?FORMAT 2
############################################################################### ###############################################################################
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
net eth0 tcpflags net NET_IF tcpflags,physical=eth0

View File

@@ -75,7 +75,7 @@ UNTRACKED_LOG_LEVEL=
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S # L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
############################################################################### ###############################################################################
CONFIG_PATH="${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall" CONFIG_PATH=":${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE

View File

@@ -1,6 +1,6 @@
# #
# Shorewall6 version 4 - Sample Interfaces File for three-interface configuration. # Shorewall6 - Sample Interfaces File for three-interface configuration.
# Copyright (C) 2006-2014by the Shorewall Team # Copyright (C) 2006-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -14,6 +14,6 @@
?FORMAT 2 ?FORMAT 2
############################################################################### ###############################################################################
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
net eth0 tcpflags,forward=1,sourceroute=0 net NET_IF tcpflags,forward=1,sourceroute=0,physical=eth0
loc eth1 tcpflags,forward=1 loc LOC_IF tcpflags,forward=1,physical=eth1
dmz eth2 tcpflags,forward=1 dmz DMZ_IF tcpflags,forward=1,physical=eth2

View File

@@ -74,7 +74,7 @@ UNTRACKED_LOG_LEVEL=
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S # L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
############################################################################### ###############################################################################
CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall CONFIG_PATH=":${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE

View File

@@ -1,6 +1,6 @@
# #
# Shorewall6 version 4.5 Sample Stoppedrules File for three-interface configuration. # Shorewall6 - Sample Stoppedrules File for three-interface configuration.
# Copyright (C) 2012-2014 by the Shorewall Team # Copyright (C) 2012-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -13,8 +13,7 @@
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE #ACTION SOURCE DEST PROTO DEST SOURCE
# PORT(S) PORT(S) # PORT(S) PORT(S)
ACCEPT eth1 - ACCEPT LOC_IF -
ACCEPT - eth1 ACCEPT - LOC_IF
ACCEPT eth2 - ACCEPT DMZ_IF -
ACCEPT - eth2 ACCEPT - DMZ_IF

View File

@@ -1,6 +1,6 @@
# #
# Shorewall6 version 4.0 - Sample Interfaces File for two-interface configuration. # Shorewall6 - Sample Interfaces File for two-interface configuration.
# Copyright (C) 2006-2014 by the Shorewall Team # Copyright (C) 2006-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -14,5 +14,5 @@
?FORMAT 2 ?FORMAT 2
############################################################################### ###############################################################################
#ZONE INTERFACE OPTIONS #ZONE INTERFACE OPTIONS
net eth0 tcpflags,forward=1,sourceroute=0 net NET_IF tcpflags,forward=1,sourceroute=0,physical=eth0
loc eth1 tcpflags,forward=1 loc LOC_IF tcpflags,forward=1,physical=eth1

View File

@@ -74,7 +74,7 @@ UNTRACKED_LOG_LEVEL=
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S # L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
############################################################################### ###############################################################################
CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall CONFIG_PATH=":${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE

View File

@@ -1,6 +1,6 @@
# #
# Shorewall6 version 4.5 Sample Stoppedrules File for two-interface configuration. # Shorewall6 - Sample Stoppedrules File for two-interface configuration.
# Copyright (C) 2012-2014 by the Shorewall Team # Copyright (C) 2012-2017 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -13,5 +13,5 @@
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE #ACTION SOURCE DEST PROTO DEST SOURCE
# PORT(S) PORT(S) # PORT(S) PORT(S)
ACCEPT eth1 - ACCEPT LOC_IF -
ACCEPT - eth1 ACCEPT - LOC_IF

View File

@@ -8,42 +8,43 @@
# #
############################################################################### ###############################################################################
#ACTION #ACTION
A_Drop # Audited Default Action for DROP policy A_Drop # Audited Default Action for DROP policy
A_Reject # Audited Default Action for REJECT policy A_Reject # Audited Default Action for REJECT policy
A_AllowICMPs # Audited Accept needed ICMP6 types A_AllowICMPs proto=58 # Audited Accept needed ICMP6 types
AllowICMPs # Accept needed ICMP6 types AllowICMPs proto=58 # Accept needed ICMP6 types
allowBcast inline # Silently Allow Broadcast allowBcast inline # Silently Allow Broadcast
allowInvalid inline # Accepts packets in the INVALID conntrack state allowInvalid inline # Accepts packets in the INVALID conntrack state
allowMcast inline # Silently Allow Multicast allowMcast inline # Silently Allow Multicast
AutoBL noinline # Auto-blacklist IPs that exceed thesholds AutoBL noinline # Auto-blacklist IPs that exceed thesholds
AutoBLL noinline # Helper for AutoBL AutoBLL noinline # Helper for AutoBL
BLACKLIST logjump,section # Add sender to the dynamic blacklist BLACKLIST logjump,section # Add sender to the dynamic blacklist
Broadcast noinline # Handles Broadcast/Anycast Broadcast noinline # Handles Broadcast/Anycast
Drop # Default Action for DROP policy (deprecated) Drop # Default Action for DROP policy (deprecated)
dropBcast inline # Silently Drop Broadcast dropBcast inline # Silently Drop Broadcast
dropBcasts inline # Silently Drop Broadcast dropBcasts inline # Silently Drop Broadcast
dropInvalid inline # Drops packets in the INVALID conntrack state dropInvalid inline # Drops packets in the INVALID conntrack state
dropMcast inline # Silently Drop Multicast dropMcast inline # Silently Drop Multicast
dropNotSyn noinline # Silently Drop Non-syn TCP packets dropNotSyn noinline,proto=6 # Silently Drop Non-syn TCP packets
DropDNSrep inline # Drops DNS replies DropDNSrep inline,proto=17 # Drops DNS replies
DropSmurfs noinline # Handles packets with a broadcast source address DropSmurfs noinline # Handles packets with a broadcast source address
Established inline,\ # Handles packets in the ESTABLISHED state Established inline,\ # Handles packets in the ESTABLISHED state
state=ESTABLISHED state=ESTABLISHED
FIN inline,audit # Handles ACK,FIN,PSH packets FIN inline,audit,\ # Handles ACK,FIN,PSH packets
proto=6
forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces. forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces.
IfEvent noinline # Perform an action based on an event IfEvent noinline # Perform an action based on an event
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
state=INVALID state=INVALID
Multicast noinline # Handles Multicast Multicast noinline # Handles Multicast
New inline,state=NEW # Handles packets in the NEW conntrack state New inline,state=NEW # Handles packets in the NEW conntrack state
NotSyn inline # Handles TCP packets that do not have SYN=1 and ACK=0 NotSyn inline,proto=6 # Handles TCP packets that do not have SYN=1 and ACK=0
Reject # Default Action for REJECT policy (deprecated) Reject # Default Action for REJECT policy (deprecated)
rejNotSyn noinline # Silently Reject Non-syn TCP packets rejNotSyn noinline,proto=6 # Silently Reject Non-syn TCP packets
Related inline,\ # Handles packets in the RELATED conntrack state Related inline,\ # Handles packets in the RELATED conntrack state
state=RELATED state=RELATED
ResetEvent inline # Reset an Event ResetEvent inline # Reset an Event
RST inline # Handle packets with RST set RST inline,proto=6 # Handle packets with RST set
SetEvent inline # Initialize an event SetEvent inline # Initialize an event
TCPFlags # Handles bad flags combinations TCPFlags proto=6 # Handles bad flags combinations
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
state=UNTRACKED state=UNTRACKED

View File

@@ -74,7 +74,7 @@ UNTRACKED_LOG_LEVEL=
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S # L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
############################################################################### ###############################################################################
CONFIG_PATH="${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall" CONFIG_PATH=":${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall"
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE
@@ -216,7 +216,7 @@ TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2" TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
TRACK_PROVIDERS=No TRACK_PROVIDERS=Yes
TRACK_RULES=No TRACK_RULES=No

View File

@@ -3,4 +3,4 @@
# #
# /usr/share/shorewall6/configpath # /usr/share/shorewall6/configpath
# #
CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall CONFIG_PATH=":${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall"

View File

@@ -162,8 +162,7 @@
<entry><ulink url="traffic_shaping.htm">Bandwidth <entry><ulink url="traffic_shaping.htm">Bandwidth
Control</ulink></entry> Control</ulink></entry>
<entry>Manpages (<ulink url="Manpages.html">IPv4</ulink>) (<ulink <entry><ulink url="Manpages.html">Manpages</ulink></entry>
url="Manpages6.html">IPv6</ulink>)</entry>
<entry><ulink <entry><ulink
url="starting_and_stopping_shorewall.htm">Starting/stopping the url="starting_and_stopping_shorewall.htm">Starting/stopping the

View File

@@ -2340,6 +2340,15 @@ gateway:~# </programlisting>
option 8 combines identical chains which can result in a smaller option 8 combines identical chains which can result in a smaller
ruleset, but it slows down the compilation of large rulesets.</para> ruleset, but it slows down the compilation of large rulesets.</para>
</listitem> </listitem>
<listitem>
<para>Rather than <command>restart</command>, use
<command>reload</command>. With the default setting of
RESTART=restart, <command>restart</command> performs
<command>stop</command> then <command>start</command>, while
<command>reload</command> avoids the <command>stop</command>
part.</para>
</listitem>
</orderedlist> </orderedlist>
</section> </section>
@@ -2367,6 +2376,14 @@ gateway:~# </programlisting>
capabiities of your system. If you system doesn't support a command, it capabiities of your system. If you system doesn't support a command, it
will generally issue a kernel log message.</para> will generally issue a kernel log message.</para>
</section> </section>
<section>
<title id="faq106">(FAQ 106) Shorewall is not starting at boot on Debian
with systemd</title>
<para><emphasis role="bold">Answer:</emphasis> To enable start at boot,
run <command>systemctl enable shorewall.service</command></para>
</section>
</section> </section>
<section id="MultiISP"> <section id="MultiISP">

View File

@@ -71,7 +71,7 @@
</listitem> </listitem>
<listitem> <listitem>
<para>PPTP (TCP 1729)</para> <para>PPTP (TCP 1723)</para>
</listitem> </listitem>
<listitem> <listitem>
@@ -121,9 +121,10 @@
of your system.</para> of your system.</para>
<para>Many of the modules allow parameters to be specified when the <para>Many of the modules allow parameters to be specified when the
module is loaded. Among the common parameters is the ports parameter module is loaded. Among the common parameters is the
that lists one or more ports that the module is to monitor. This allows <option>ports</option> parameter that lists one or more ports that the
running the application on a non-standard port.</para> module is to monitor. This allows running the application on a
non-standard port.</para>
</section> </section>
<section> <section>

View File

@@ -18,7 +18,7 @@
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate> <pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
<copyright> <copyright>
<year>2007-2015</year> <year>2007-2017</year>
<holder>Thomas M. Eastep</holder> <holder>Thomas M. Eastep</holder>
</copyright> </copyright>
@@ -83,6 +83,9 @@
Describes how to specify set names in Shorewall configuration Describes how to specify set names in Shorewall configuration
files.</member> files.</member>
<member><ulink url="manpages/shorewall-logging.html">logging</ulink> -
Provides an overview of Shorewall packet logging facilities</member>
<member><ulink url="manpages/shorewall-maclist.html">maclist</ulink> - <member><ulink url="manpages/shorewall-maclist.html">maclist</ulink> -
Define MAC verification.</member> Define MAC verification.</member>
@@ -115,7 +118,11 @@
routing tables, usually for multiple Internet links.</member> routing tables, usually for multiple Internet links.</member>
<member><ulink url="manpages/shorewall-proxyarp.html">proxyarp</ulink> <member><ulink url="manpages/shorewall-proxyarp.html">proxyarp</ulink>
- Define Proxy ARP.</member> - Define Proxy ARP (IPv4)</member>
<member><ulink
url="manpages6/shorewall-proxyndp.html">proxyndp</ulink> - Define
Proxy NDP (IPv6)</member>
<member><ulink url="manpages/shorewall-rtrules.html">rtrules</ulink> - <member><ulink url="manpages/shorewall-rtrules.html">rtrules</ulink> -
Define routing rules.</member> Define routing rules.</member>
@@ -157,10 +164,18 @@
url="manpages/shorewall.conf.html">shorewall.conf</ulink> - Specify url="manpages/shorewall.conf.html">shorewall.conf</ulink> - Specify
values for global Shorewall options.</member> values for global Shorewall options.</member>
<member><ulink
url="manpages6/shorewall6.conf.html">shorewall6.conf</ulink> - Specify
values for global Shorewall6 options.</member>
<member><ulink <member><ulink
url="manpages/shorewall-lite.conf.html">shorewall-lite.conf</ulink> - url="manpages/shorewall-lite.conf.html">shorewall-lite.conf</ulink> -
Specify values for global Shorewall Lite options.</member> Specify values for global Shorewall Lite options.</member>
<member><ulink
url="manpages6/shorewall6-lite.conf.html">shorewall6-lite.conf</ulink>
- Specify values for global Shorewall6 Lite options.</member>
<member><ulink url="manpages/shorewall-vardir.html">vardir</ulink> - <member><ulink url="manpages/shorewall-vardir.html">vardir</ulink> -
Redefine the directory where Shorewall keeps its state Redefine the directory where Shorewall keeps its state
information.</member> information.</member>
@@ -182,16 +197,8 @@
<blockquote> <blockquote>
<simplelist> <simplelist>
<member><ulink url="manpages/shorewall.html">shorewall</ulink> - <member><ulink url="manpages/shorewall.html">shorewall</ulink> -
/sbin/shorewall command syntax and semantics.</member> /sbin/shorewall, /sbin/shorewall6/, /sbin/shorewall-lite and
/sbin/shorewall6-line command syntax and semantics.</member>
<member><ulink
url="manpages/shorewall-init.html">shorewall-init</ulink> - Companion
package that allows for automatic start/stop of other Shorewall
products based on network events.</member>
<member><ulink
url="manpages/shorewall-lite.html">shorewall-lite</ulink> -
/sbin/shorewall-lite command syntax and semantics.</member>
</simplelist> </simplelist>
</blockquote> </blockquote>
</section> </section>

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