Compare commits

..

122 Commits

Author SHA1 Message Date
Tom Eastep
bb70a3637b Add PERL_HASH_SEED option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-05-02 07:51:37 -07:00
Tom Eastep
6c20cc7c4f Inline the start_command::do_it() function in lib.cli-std
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-05-01 13:51:53 -07:00
Tom Eastep
d4e05f6163 Correct handling of IPv6 tunnel-src and tunnel-dst
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-04-23 08:36:22 -07:00
Tom Eastep
6201f37913 Clarify <filename> in the generated script's header
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-04-18 16:45:17 -07:00
Tom Eastep
7ee44d6b4b Correct a typo in the generated script's header syntax description
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-04-18 16:31:51 -07:00
Tom Eastep
363b8f9802 Correct validation of string interface options.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-04-13 06:48:14 -07:00
Tom Eastep
d365a9ff18 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2017-04-05 20:15:10 -07:00
Tom Eastep
00d4724fd8 Some cleanup of the Chains module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-04-05 20:14:13 -07:00
Matt Darfeuille
749c8047d8 Explain the 'ipset' package
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Roberto C. Sánchez <roberto@connexer.com>
2017-04-05 11:50:36 -04:00
Tom Eastep
a00f2e6365 Update Copyright on the Documentation Index
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-31 20:34:43 -07:00
Tom Eastep
a46f19899b Correct typo in links to the logging article.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-27 16:12:56 -07:00
Tom Eastep
d2392c3a9b Add IPv6 UPnP Support
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-24 09:54:36 -07:00
Tom Eastep
0763b27b0b Correct a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-22 15:59:55 -07:00
Tom Eastep
8b90827611 Minor cleanup of split_columns()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-22 10:18:07 -07:00
Tom Eastep
8507c97b5a Clean up column/value pair editing.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-22 09:46:52 -07:00
Tom Eastep
a6306f2c08 ?reset action param now sets parmsmodified.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-18 12:53:05 -07:00
Tom Eastep
a79dc194a4 Re-factor the directive message change
- results in much more compact code
- Document change in the config basics doc

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-18 11:42:53 -07:00
Tom Eastep
ccf9d73c72 Clarify line continuation WRT params and .conf
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-17 19:13:29 -07:00
Tom Eastep
bdcf93f92c Report the call site when issuing messages from an action.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-17 17:08:19 -07:00
Tom Eastep
6b84727886 Delete useless blank line
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-17 13:26:07 -07:00
Tom Eastep
5f445d9c2b Merge branch '5.1.3' 2017-03-16 14:14:20 -07:00
Tom Eastep
31bd10ffdd Correct two-interface sample snat file
- s/92/192/

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-15 21:18:23 -07:00
Tom Eastep
c3303067fc Correct all+ handling in the policy file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-15 11:20:37 -07:00
Tom Eastep
55cf06d0a8 Correct all+ handling in the policy file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-15 10:09:53 -07:00
Tom Eastep
c36a7cd35b Correct typo in the Shorewall6 sample .conf files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-15 08:57:18 -07:00
Tom Eastep
561efa595c Correct typo in the Shorewall6 sample .conf files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-15 08:55:41 -07:00
Tom Eastep
158f6305b1 Correct install fix
- Also remove extra logic from action.Broadcast

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-14 14:39:25 -07:00
Tom Eastep
6407520a35 Add warning messages to the deprecated actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-14 14:32:28 -07:00
Tom Eastep
54336eaa80 Delete IPv6 actions that are now handled by their IPv4 counterparts
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-14 14:24:17 -07:00
Tom Eastep
5b85627fb8 Merge branch '5.1.3'
Conflicts:
	Shorewall/Perl/Shorewall/Config.pm
	Shorewall6/Actions/action.Multicast
2017-03-14 14:16:47 -07:00
Tom Eastep
a00d7217e3 Correct last commit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-14 13:58:59 -07:00
Tom Eastep
54ef4e4ced Delete deprecated actions during install
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-14 13:46:24 -07:00
Tom Eastep
a447d726fa Revert change which screwed up ?begin perl ... ?end perl line numbering
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-14 12:44:33 -07:00
Tom Eastep
c6050f9fbb Correct log message from IPv6 Multicast action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 16:55:45 -07:00
Tom Eastep
fe29adbd66 Correct use of $family in combined actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 16:52:16 -07:00
Tom Eastep
4dc6be6b3b Deprecate A_AllowICMPs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 15:09:07 -07:00
Tom Eastep
6ebc8f4266 Merge branch '5.1.3' 2017-03-13 14:55:23 -07:00
Tom Eastep
c5c4211081 Unify actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 14:54:25 -07:00
Tom Eastep
4010f9bce4 Add multicast to the Deprecated A_Drop and A_Reject actions
- Move A_Drop to deprecated/ directory

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 14:18:23 -07:00
Tom Eastep
02bb717d7d Quote SMURF_LOG_LEVEL setting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 11:21:13 -07:00
Tom Eastep
046998ed84 Tabification of new actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 11:19:35 -07:00
Tom Eastep
24a014655b Quote all _DEFAULT settings in the sample .conf files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 11:00:29 -07:00
Tom Eastep
0b8945da8e Correctly handle expansion of option names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 10:20:15 -07:00
Tom Eastep
da363880a9 Always quote the LEVEL and DEFAULT settings when updating
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-13 09:51:58 -07:00
Tom Eastep
b049d1805d Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code
Conflicts:
	Shorewall/Perl/Shorewall/Config.pm
2017-03-13 08:52:01 -07:00
Tom Eastep
037fe490f3 Process config options in file order during update.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-12 17:09:41 -07:00
Tom Eastep
a8d7675322 Process config options in file order during update.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-12 09:01:22 -07:00
Tom Eastep
b13014c9ab Expand variables in .conf except when upgrading
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-11 11:21:07 -08:00
Tom Eastep
76aef6cb04 Correct generation of '! --syn'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-11 08:43:04 -08:00
Tom Eastep
4c72b3ee58 Make sure that $LOG_LEVEL is defined
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-10 11:06:23 -08:00
Tom Eastep
d9071c5308 Correct $LOG_LEVEL expansion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-10 10:24:24 -08:00
Tom Eastep
5729be6431 Add dropInvalid to BLACKLIST_DEFAULT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-10 09:06:41 -08:00
Tom Eastep
1a381f717c Revert "Remove Multicast from the shorewall6.conf samples"
This reverts commit 655f260cb6.
2017-03-10 08:54:05 -08:00
Tom Eastep
c534c458dd Revert "Remove Multicast from IPv6 Policy Actions"
This reverts commit 85d571d013.
2017-03-10 08:53:54 -08:00
Tom Eastep
61435936fe Correct CONFIG_PATH in IPv6 Universal sample
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-09 14:06:47 -08:00
Tom Eastep
2d4c1411bd Delete the -n option from remote-reload in shorewall(8)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-09 13:17:23 -08:00
Tom Eastep
655f260cb6 Remove Multicast from the shorewall6.conf samples
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-09 13:16:52 -08:00
Tom Eastep
85d571d013 Remove Multicast from IPv6 Policy Actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-09 13:12:03 -08:00
Tom Eastep
fdb78898fc Make TC_ENABLED=Shared the default in the samples
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-09 13:06:55 -08:00
Tom Eastep
d4c016d9c5 'reload' documentation corrections
- Add command synopsis to the manpage
- Correct command synopsis in help output

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-09 12:50:30 -08:00
Tom Eastep
3d8d5aa469 quote $LOG_LEVEL in shorewall[6].conf files
- Delete AllowICMPs from IPv4 policy action settings

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-08 14:16:24 -08:00
Tom Eastep
49811d24fa Correct convertion of tcrules->mangle when a writable mangle exists
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 15:21:45 -08:00
Tom Eastep
fe4aaee1b4 Fix typos in action.dropNotSyn
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 14:37:08 -08:00
Tom Eastep
0ec7bc846e Correct logging in inline policy actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 13:58:14 -08:00
Tom Eastep
dbcd4d9d16 Correct typo in action.AllowICMPs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 13:57:05 -08:00
Tom Eastep
5a996cbda7 Change AllowICMPs to an inline action
Signed-off-by: Tom Eastep <teastep@shorewall.net>

Conflicts:
	Shorewall/actions.std
2017-03-07 13:56:44 -08:00
Tom Eastep
6019adaae5 Change macro.ICMPs to an inline action
Signed-off-by: Tom Eastep <teastep@shorewall.net>

Conflicts:
	Shorewall/actions.std
2017-03-07 13:54:52 -08:00
Tom Eastep
4f869c3506 More manpage updates for tcp:!syn
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 11:13:58 -08:00
Tom Eastep
e3c2874b21 Modify dropNotSyn to use {proto=6:!syn}
- also make the same change in the rejNotSyn audited case
2017-03-07 11:00:39 -08:00
Tom Eastep
e8a0142480 Document tcp:!syn support
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 10:48:24 -08:00
Tom Eastep
a4768776f7 Modify rejNotSyn to use new/corrected features
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 10:34:15 -08:00
Tom Eastep
8e000b158e Correct the handling of tcp-reset
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 10:33:51 -08:00
Tom Eastep
f1d1ab6411 Implement tcp:!syn in PROTO column
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-07 10:33:20 -08:00
Tom Eastep
cd103bb715 Correct rejNotSyn
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-06 16:01:31 -08:00
Tom Eastep
5f1370f1b4 Clear the firewall on Debian systemd 'stop' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-06 11:22:55 -08:00
Tom Eastep
dc53fa2665 Correct file/line from ?error
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-06 11:02:06 -08:00
Tom Eastep
71d9a03697 Update shorewall[6]-rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-05 14:29:57 -08:00
Tom Eastep
137d4bcc90 Alter logging behavior of Limit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-05 13:03:57 -08:00
Tom Eastep
356d3fa2dd Correct new directives with respect to omitting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-05 12:09:54 -08:00
Tom Eastep
80d93235b5 Eliminate builtin actions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-05 12:09:33 -08:00
Tom Eastep
c1e7fce1c5 Report the file/line where action invoked
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-05 09:29:00 -08:00
Tom Eastep
63ec936f21 Remove determinism sorts 2017-03-04 19:05:33 -08:00
Tom Eastep
dabe0bd205 Set PERL_HASH_SEED to make compilation deterministic.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-04 18:48:48 -08:00
Tom Eastep
63cf7dd699 Revert "Move $test to the config module."
This reverts commit 876d76b294.
2017-03-04 18:45:40 -08:00
Matt Darfeuille
0b3a32b365 Change the preferred way to remove sysvinit script
- Correct typo in command
 - Correct spacing

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-04 09:03:59 -08:00
Matt Darfeuille
a839a6f7d0 init: Add parameter files for Debian
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-04 09:03:49 -08:00
Matt Darfeuille
fec967a41d Do not display where an executable is located
Use only the exit status of the function mywhich to determine which
command should be used to remove sysvinit script.

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-04 09:03:29 -08:00
Tom Eastep
a7d45e9566 Restore logging to the BLACKLIST action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-03 10:14:30 -08:00
Tom Eastep
876d76b294 Move $test to the config module.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-02 11:42:07 -08:00
Tom Eastep
9075a6dd7a Copy libs and footer when compiling for test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-02 10:49:49 -08:00
Tom Eastep
c900e3e51c Merge branch '5.1.2' 2017-03-02 10:17:50 -08:00
Tom Eastep
e585ce04f4 Rename action.allowUPnP to action.allowinUPnP
- Allows 'show action allowinUPnP' to work correctly.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-02 10:06:01 -08:00
Tom Eastep
61f5e3531c Rename action.allowUPnP to action.allowinUPnP
- Allows 'show action allowinUPnP' to work correctly.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-03-02 10:05:31 -08:00
Tom Eastep
e8a5c45aae Correct FAQ 1e
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-25 09:10:40 -08:00
Tom Eastep
d20ad64739 Correct FAQ 1e
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-25 08:54:14 -08:00
Matt Darfeuille
7ffe8e4e4b shorewall: Document the -p option in installer
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-23 09:33:35 -08:00
Matt Darfeuille
7644e1d49f Update version and fix comment lines in rc files
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:56:29 -08:00
Matt Darfeuille
06c6a017d5 Use a specific parameter file for systemd script
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:56:25 -08:00
Matt Darfeuille
75fd8ccb37 Use a specific parameter file for sysvinit script
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:56:21 -08:00
Matt Darfeuille
c04845534a Use a common uninstaller for Lite and Lite6
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:56:15 -08:00
Matt Darfeuille
8c7e6fddfd Use a common uninstaller for Sw and Sw6
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:56:11 -08:00
Matt Darfeuille
e6ed4d425d core: Uninstall manpages
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:56:06 -08:00
Matt Darfeuille
783e438b4a Be more verbose while uninstalling Shorewall
- Remove version file as a file and not as a directory.

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:56:00 -08:00
Matt Darfeuille
27a620347a shorewall: Fail if Shorewall-core is not installed
Shorewall-core's version file resides in ${SHAREDIR}/shorewall.

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:55:56 -08:00
Matt Darfeuille
a496edef54 Use a function to fail on fatal error
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:55:50 -08:00
Matt Darfeuille
50a9b4cc6a core: Fail without a rc file and correct error msg
Abort Shorewall-core's installer execution if no Rc file is detected.

 - Correct the error message

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:55:46 -08:00
Matt Darfeuille
22b044f350 shorewall: Use a function to install file
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:55:41 -08:00
Matt Darfeuille
c58efe7698 Unify the uninstallers
- Clean up code
 - Use the .service suffix

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:55:36 -08:00
Matt Darfeuille
f48b2e715f Unify the installers
- Clean up code

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:55:31 -08:00
Matt Darfeuille
f6f7e691d0 Fail if the rc file can not be loaded
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:54:40 -08:00
Matt Darfeuille
a9048b63f2 Correct typos
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:54:36 -08:00
Matt Darfeuille
bc1df90829 Group comment lines with corresponding command
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:54:33 -08:00
Matt Darfeuille
09462cf92b Use 4 octal digits as numeric mode in installers
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:54:29 -08:00
Matt Darfeuille
315d4c39b8 Create and set directory mode using a function
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:54:04 -08:00
Matt Darfeuille
42554f8f31 Add cant_autostart() to the installers's library
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:53:59 -08:00
Matt Darfeuille
f0debcb6fb Copy only required libraries to run Shorewall
Copy only libraries that are required by Shorewall to operate properly.

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:53:54 -08:00
Matt Darfeuille
e8a9b8ddc8 lite: Change into the uninstaller's script dir
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:53:48 -08:00
Matt Darfeuille
20cc56f2f1 Load uninstallers's common functions
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 17:53:39 -08:00
Matt Darfeuille
4e771083c7 Load installers's common functions
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 16:42:38 -08:00
Matt Darfeuille
a3fc110dc9 Add the library file for the uninstallers
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 16:41:55 -08:00
Matt Darfeuille
813f592b46 Add the library file for the installers
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 16:41:25 -08:00
Matt Darfeuille
a6eebc8ecf Replace product names by product vars
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-02-22 16:40:41 -08:00
97 changed files with 1883 additions and 2107 deletions

View File

@@ -22,64 +22,20 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <http://www.gnu.org/licenses/>.
# #
VERSION=xxx #The Build script inserts the actual version VERSION=xxx # The Build script inserts the actual version
PRODUCT=shorewall-core PRODUCT=shorewall-core
Product="Shorewall Core" Product="Shorewall Core"
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <configuration-file> ] " echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo " $ME -v" echo "where <option> is one of"
echo " $ME -h" echo " -h"
echo " -v"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure shorewall to start automatically at boot" >&2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
install_file() # $1 = source $2 = target $3 = mode install_file() # $1 = source $2 = target $3 = mode
{ {
if cp -f $1 $2; then if cp -f $1 $2; then
@@ -98,16 +54,16 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1 exit 1
} }
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
#
# Source common functions
#
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
# #
# Parse the run line # Parse the run line
# #
@@ -126,7 +82,7 @@ while [ $finished -eq 0 ]; do
usage 0 usage 0
;; ;;
v) v)
echo "Shorewall Firewall Installer Version $VERSION" echo "$Product Firewall Installer Version $VERSION"
exit 0 exit 0
;; ;;
*) *)
@@ -148,14 +104,14 @@ done
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc
file=./shorewallrc file=./shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
file=~/.shorewallrc file=~/.shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc
file=/usr/share/shorewall/shorewallrc file=/usr/share/shorewall/shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -169,7 +125,7 @@ elif [ $# -eq 1 ]; then
;; ;;
esac esac
. $file . $file || fatal_error "Can not load the RC file: $file"
else else
usage 1 usage 1
fi fi
@@ -285,13 +241,12 @@ case "$HOST" in
debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt) debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt)
;; ;;
*) *)
echo "ERROR: Unknown HOST \"$HOST\"" >&2 fatal_error "Unknown HOST \"$HOST\""
exit 1;
;; ;;
esac esac
if [ -z "$file" ]; then if [ -z "$file" ]; then
if $HOST = linux; then if [ $HOST = linux ]; then
file=shorewallrc.default file=shorewallrc.default
else else
file=shorewallrc.${HOST} file=shorewallrc.${HOST}
@@ -304,7 +259,8 @@ if [ -z "$file" ]; then
echo "" >&2 echo "" >&2
echo "Example:" >&2 echo "Example:" >&2
echo "" >&2 echo "" >&2
echo " ./install.sh $file" &>2 echo " ./install.sh $file" >&2
exit 1
fi fi
if [ -n "$DESTDIR" ]; then if [ -n "$DESTDIR" ]; then
@@ -315,45 +271,31 @@ if [ -n "$DESTDIR" ]; then
fi fi
fi fi
echo "Installing Shorewall Core Version $VERSION" echo "Installing $Product Version $VERSION"
# #
# Create directories # Create directories
# #
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall make_parent_directory ${DESTDIR}${LIBEXECDIR}/shorewall 0755
chmod 755 ${DESTDIR}${LIBEXECDIR}/shorewall
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall make_parent_directory ${DESTDIR}${SHAREDIR}/shorewall 0755
chmod 755 ${DESTDIR}${SHAREDIR}/shorewall
mkdir -p ${DESTDIR}${CONFDIR} make_parent_directory ${DESTDIR}${CONFDIR} 0755
chmod 755 ${DESTDIR}${CONFDIR}
if [ -n "${SYSCONFDIR}" ]; then [ -n "${SYSCONFDIR}" ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
mkdir -p ${DESTDIR}${SYSCONFDIR}
chmod 755 ${DESTDIR}${SYSCONFDIR}
fi
if [ -z "${SERVICEDIR}" ]; then if [ -z "${SERVICEDIR}" ]; then
SERVICEDIR="$SYSTEMD" SERVICEDIR="$SYSTEMD"
fi fi
if [ -n "${SERVICEDIR}" ]; then [ -n "${SERVICEDIR}" ] && make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
mkdir -p ${DESTDIR}${SERVICEDIR}
chmod 755 ${DESTDIR}${SERVICEDIR}
fi
mkdir -p ${DESTDIR}${SBINDIR} make_parent_directory ${DESTDIR}${SBINDIR} 0755
chmod 755 ${DESTDIR}${SBINDIR}
if [ -n "${MANDIR}" ]; then [ -n "${MANDIR}" ] && make_parent_directory ${DESTDIR}${MANDIR} 0755
mkdir -p ${DESTDIR}${MANDIR}
chmod 755 ${DESTDIR}${MANDIR}
fi
if [ -n "${INITFILE}" ]; then if [ -n "${INITFILE}" ]; then
mkdir -p ${DESTDIR}${INITDIR} make_parent_directory ${DESTDIR}${INITDIR} 0755
chmod 755 ${DESTDIR}${INITDIR}
if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then
install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544 install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544
@@ -382,8 +324,14 @@ echo "wait4ifup installed in ${DESTDIR}${LIBEXECDIR}/shorewall/wait4ifup"
# Install the libraries # Install the libraries
# #
for f in lib.* ; do for f in lib.* ; do
install_file $f ${DESTDIR}${SHAREDIR}/shorewall/$f 0644 case $f in
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/shorewall/$f" *installer)
;;
*)
install_file $f ${DESTDIR}${SHAREDIR}/shorewall/$f 0644
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/shorewall/$f"
;;
esac
done done
if [ $SHAREDIR != /usr/share ]; then if [ $SHAREDIR != /usr/share ]; then
@@ -398,11 +346,11 @@ fi
if [ -n "$MANDIR" ]; then if [ -n "$MANDIR" ]; then
cd manpages cd manpages
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man8/ [ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man8 0755
for f in *.8; do for f in *.8; do
gzip -9c $f > $f.gz gzip -9c $f > $f.gz
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 644 install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 0644
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz" echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
done done
@@ -419,7 +367,7 @@ ln -sf lib.base ${DESTDIR}${SHAREDIR}/shorewall/functions
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion
chmod 644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion
if [ -z "${DESTDIR}" ]; then if [ -z "${DESTDIR}" ]; then
if [ $update -ne 0 ]; then if [ $update -ne 0 ]; then
@@ -444,14 +392,20 @@ fi
if [ ${SHAREDIR} != /usr/share ]; then if [ ${SHAREDIR} != /usr/share ]; then
for f in lib.*; do for f in lib.*; do
if [ $BUILD != apple ]; then case $f in
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f *installer)
else ;;
eval sed -i \'\' -e \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f *)
fi if [ $BUILD != apple ]; then
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
else
eval sed -i \'\' -e \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
fi
;;
esac
done done
fi fi
# #
# Report Success # Report Success
# #
echo "Shorewall Core Version $VERSION Installed" echo "$Product Version $VERSION Installed"

View File

@@ -4264,12 +4264,17 @@ usage() # $1 = exit status
echo " reenable <interface>" echo " reenable <interface>"
ecko " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]" ecko " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]"
echo " reject <address> ..." echo " reject <address> ..."
ecko " reload [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
if [ -n "$g_lite" ]; then
echo " reload [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]"
else
echo " reload [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ <directory> ]"
fi
if [ -z "$g_lite" ]; then if [ -z "$g_lite" ]; then
echo " remote-reload [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>" echo " remote-reload [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " remote-restart [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>" echo " remote-restart [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " remote-start [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>" echo " remote-start [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
fi fi
echo " reset [ <chain> ... ]" echo " reset [ <chain> ... ]"

View File

@@ -0,0 +1,89 @@
#
#
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer.
#
# (c) 2017 - Tom Eastep (teastep@shorewall.net)
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
#
# Complete documentation is available at http://shorewall.net
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# The purpose of this library is to hold those functions used by the products installer.
#
#########################################################################################
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
make_directory() # $1 = directory , $2 = mode
{
mkdir $1
chmod $2 $1
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}
make_parent_directory() # $1 = directory , $2 = mode
{
mkdir -p $1
chmod $2 $1
[ -n "$OWNERSHIP" ] && chown $OWNER:$GROUP $1
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure $Product to start automatically at boot" >&2
}

View File

@@ -0,0 +1,106 @@
#
#
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer.
#
# (c) 2017 - Tom Eastep (teastep@shorewall.net)
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
#
# Complete documentation is available at http://shorewall.net
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# The purpose of this library is to hold those functions used by the products uninstaller.
#
#########################################################################################
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to remove
{
if [ -n "$1" ] ; then
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
fi
}
remove_directory() # $1 = directory to remove
{
if [ -n "$1" ] ; then
if [ -d $1 ] ; then
rm -rf $1
echo "$1 Removed"
fi
fi
}
remove_file_with_wildcard() # $1 = file with wildcard to remove
{
if [ -n "$1" ] ; then
for f in $1; do
if [ -d $f ] ; then
rm -rf $f
echo "$f Removed"
elif [ -f $f -o -L $f ] ; then
rm -f $f
echo "$f Removed"
fi
done
fi
}
restore_file() # $1 = file to restore
{
if [ -f ${1}-shorewall.bkout ]; then
if (mv -f ${1}-shorewall.bkout $1); then
echo
echo "$1 restored"
else
exit 1
fi
fi
}

View File

@@ -432,6 +432,33 @@
<arg choice="plain"><replaceable>address</replaceable></arg> <arg choice="plain"><replaceable>address</replaceable></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis>
<command>shorewall[6][-lite]</command>
<arg
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
<arg>options</arg>
<arg choice="plain"><option>reload</option></arg>
<arg><option>-n</option></arg>
<arg><option>-p</option><arg><option>-d</option></arg></arg>
<arg><option>-f</option></arg>
<arg><option>-c</option></arg>
<arg><option>-T</option></arg>
<arg><option>-i</option></arg>
<arg><option>-C</option></arg>
<arg><replaceable>directory</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
<command>shorewall[6]</command> <command>shorewall[6]</command>
@@ -1916,10 +1943,11 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">remote-start</emphasis> <term><emphasis role="bold">remote-start</emphasis>
[-<option>s</option>] [-<option>c</option>] [-<option>r</option> [-<option>n</option>] [-<option>s</option>] [-<option>c</option>]
<replaceable>root-user-name</replaceable>] [-<option>T</option>] [-<option>r</option> <replaceable>root-user-name</replaceable>]
[-<option>i</option>] [ [ -D ] <replaceable>directory</replaceable> ] [-<option>T</option>] [-<option>i</option>] [ [ -D ]
[ <replaceable>system</replaceable> ]</term> <replaceable>directory</replaceable> ] [
<replaceable>system</replaceable> ]</term>
<listitem> <listitem>
<para>This command was renamed from <command>load</command> in <para>This command was renamed from <command>load</command> in
@@ -1955,6 +1983,9 @@
<replaceable>directory</replaceable>, then the <option>-D</option> <replaceable>directory</replaceable>, then the <option>-D</option>
option must be given.</para> option must be given.</para>
<para>The <option>-n</option> option causes Shorewall to avoid
updating the routing table(s).</para>
<para>If <emphasis role="bold">-s</emphasis> is specified and the <para>If <emphasis role="bold">-s</emphasis> is specified and the
<emphasis role="bold">start</emphasis> command succeeds, then the <emphasis role="bold">start</emphasis> command succeeds, then the
remote Shorewall-lite configuration is saved by executing <emphasis remote Shorewall-lite configuration is saved by executing <emphasis

View File

@@ -1,5 +1,5 @@
# #
# Debian Shorewall 4.5 rc file # Debian Shorewall 5.0 rc file
# #
BUILD= #Default is to detect the build system BUILD= #Default is to detect the build system
HOST=debian HOST=debian
@@ -14,7 +14,7 @@ INITDIR= #Directory where SysV init scripts are installed.
INITFILE= #Name of the product's installed SysV init script INITFILE= #Name of the product's installed SysV init script
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed ANNOTATED= #If non-zero, annotated configuration files are installed
SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR SYSCONFFILE=default.debian.systemd #Name of the distributed file to be installed in $SYSCONFDIR
SERVICEFILE=$PRODUCT.service.debian #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service SERVICEFILE=$PRODUCT.service.debian #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only) SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)

View File

@@ -1,5 +1,5 @@
# #
# Debian Shorewall 4.5 rc file # Debian Shorewall 5.0 rc file
# #
BUILD= #Default is to detect the build system BUILD= #Default is to detect the build system
HOST=debian HOST=debian
@@ -14,7 +14,7 @@ INITDIR=/etc/init.d #Directory where SysV init scripts are i
INITFILE=$PRODUCT #Name of the product's installed SysV init script INITFILE=$PRODUCT #Name of the product's installed SysV init script
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed ANNOTATED= #If non-zero, annotated configuration files are installed
SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR SYSCONFFILE=default.debian.sysvinit #Name of the distributed file to be installed in $SYSCONFDIR
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
SERVICEDIR= #Directory where .service files are installed (systems running systemd only) SERVICEDIR= #Directory where .service files are installed (systems running systemd only)

View File

@@ -1,8 +1,8 @@
# #
# Default Shorewall 5.0 rc file # Default Shorewall 5.0 rc file
# #
HOST=linux #Generic Linux
BUILD= #Default is to detect the build system BUILD= #Default is to detect the build system
HOST=linux #Generic Linux
PREFIX=/usr #Top-level directory for shared files, libraries, etc. PREFIX=/usr #Top-level directory for shared files, libraries, etc.
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files. SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts. LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.

View File

@@ -1,8 +1,8 @@
# #
# Created by Shorewall Core version 5.0.2-RC1 configure - Fri, Nov 06, 2015 10:02:03 AM # OpenWRT Shorewall 5.0 rc file
#
# Input: host=openwrt
# #
BUILD= #Default is to detect the build system
HOST=openwrt
PREFIX=/usr #Top-level directory for shared files, libraries, etc. PREFIX=/usr #Top-level directory for shared files, libraries, etc.
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files. SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts. LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Script to back uninstall Shoreline Firewall # Script to back uninstall Shoreline Firewall Core Modules
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# #
@@ -26,63 +26,75 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version VERSION=xxx # The Build script inserts the actual version
PRODUCT="shorewall-core" PRODUCT=shorewall-core
Product="Shorewall Core" Product="Shorewall Core"
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <shorewallrc file> ]" echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo "where <option> is one of"
echo " -h"
echo " -v"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
}
restore_file() # $1 = file to restore
{
if [ -f ${1}-shorewall.bkout ]; then
if (mv -f ${1}-shorewall.bkout $1); then
echo
echo "$1 restored"
else
exit 1
fi
fi
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
#
# Source common functions
#
. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; }
#
# Parse the run line
#
finished=0
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Uninstaller Version $VERSION"
exit 0
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
# #
# Read the RC file # Read the RC file
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc . ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1 . ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -92,11 +104,11 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file file=./$file || exit 1
;; ;;
esac esac
. $file . $file || fatal_error "Can not load the RC file: $file"
else else
usage 1 usage 1
fi fi
@@ -104,20 +116,26 @@ fi
if [ -f ${SHAREDIR}/shorewall/coreversion ]; then if [ -f ${SHAREDIR}/shorewall/coreversion ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)" INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Core Version $INSTALLED_VERSION is installed" echo "WARNING: $Product Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller." echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION" VERSION="$INSTALLED_VERSION"
fi fi
else else
echo "WARNING: Shorewall Core Version $VERSION is not installed" echo "WARNING: $Product Version $VERSION is not installed"
VERSION="" VERSION=""
fi fi
echo "Uninstalling Shorewall Core $VERSION" echo "Uninstalling $Product $VERSION"
rm -rf ${SHAREDIR}/shorewall if [ -n "${MANDIR}" ]; then
rm -f ~/.shorewallrc remove_file_with_wildcard ${MANDIR}/man5/shorewall\*
remove_file_with_wildcard ${MANDIR}/man8/shorewall\*
echo "Shorewall Core Uninstalled" fi
remove_directory ${SHAREDIR}/shorewall
remove_file ~/.shorewallrc
#
# Report Success
#
echo "$Product $VERSION Uninstalled"

View File

@@ -0,0 +1,21 @@
# List the Shorewall products that Shorewall-init is to
# initialize (space-separated list).
#
# Sample: PRODUCTS="shorewall shorewall6"
#
PRODUCTS=""
#
# Set this to 1 if you want Shorewall-init to react to
# ifup/ifdown and NetworkManager events
#
IFUPDOWN=0
#
# Where Up/Down events get logged
#
LOGFILE=/var/log/shorewall-ifupdown.log
# Startup options - set verbosity to 0 (minimal reporting)
OPTIONS="-V0"
# IOF

View File

@@ -0,0 +1,27 @@
# List the Shorewall products that Shorewall-init is to
# initialize (space-separated list).
#
# Sample: PRODUCTS="shorewall shorewall6"
#
PRODUCTS=""
#
# Set this to 1 if you want Shorewall-init to react to
# ifup/ifdown and NetworkManager events
#
IFUPDOWN=0
#
# Set this to the name of the file that is to hold
# ipset contents. Shorewall-init will load those ipsets
# during 'start' and will save them there during 'stop'.
#
SAVE_IPSETS=""
#
# Where Up/Down events get logged
#
LOGFILE=/var/log/shorewall-ifupdown.log
# Startup options - set verbosity to 0 (minimal reporting)
OPTIONS="-V0"
# IOF

View File

@@ -27,58 +27,21 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
VERSION=xxx #The Build script inserts the actual version. VERSION=xxx # The Build script inserts the actual version
PRODUCT=shorewall-init PRODUCT=shorewall-init
Product="Shorewall Init" Product="Shorewall Init"
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <configuration-file> ]" echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo " $ME -v" echo "where <option> is one of"
echo " $ME -h" echo " -h"
echo " $ME -n" echo " -v"
echo " -n"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure shorewall init to start automatically at boot" >&2
}
install_file() # $1 = source $2 = target $3 = mode install_file() # $1 = source $2 = target $3 = mode
{ {
if cp -f $1 $2; then if cp -f $1 $2; then
@@ -97,23 +60,16 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1 exit 1
} }
make_directory() # $1 = directory , $2 = mode
{
mkdir -p $1
chmod 0755 $1
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
#
# Source common functions
#
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
# #
# Parse the run line # Parse the run line
# #
@@ -134,7 +90,7 @@ while [ $finished -eq 0 ] ; do
usage 0 usage 0
;; ;;
v) v)
echo "Shorewall-init Firewall Installer Version $VERSION" echo "$Product Firewall Installer Version $VERSION"
exit 0 exit 0
;; ;;
n*) n*)
@@ -159,17 +115,17 @@ done
# Read the RC file # Read the RC file
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
#
# Load packager's settings if any
#
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc || exit 1
file=./shorewallrc file=./shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
file=~/.shorewallrc file=~/.shorewallrc
else . $file || fatal_error "Can not load the RC file: $file"
fatal_error "No configuration file specified and ~/.shorewallrc not found" elif [ -f /usr/share/shorewall/shorewallrc ]; then
file=/usr/share/shorewall/shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
elif [ $# -eq 1 ]; then elif [ $# -eq 1 ]; then
file=$1 file=$1
@@ -177,11 +133,11 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file file=./$file || exit 1
;; ;;
esac esac
. $file . $file || fatal_error "Can not load the RC file: $file"
else else
usage 1 usage 1
fi fi
@@ -298,12 +254,10 @@ case "$HOST" in
echo "Installing Openwrt-specific configuration..." echo "Installing Openwrt-specific configuration..."
;; ;;
linux) linux)
echo "ERROR: Shorewall-init is not supported on this system" >&2 fatal_error "Shorewall-init is not supported on this system"
exit 1
;; ;;
*) *)
echo "ERROR: Unsupported HOST distribution: \"$HOST\"" >&2 fatal_error "Unsupported HOST distribution: \"$HOST\""
exit 1;
;; ;;
esac esac
@@ -315,30 +269,27 @@ if [ -n "$DESTDIR" ]; then
OWNERSHIP="" OWNERSHIP=""
fi fi
make_directory ${DESTDIR}${INITDIR} 0755 make_parent_directory ${DESTDIR}${INITDIR} 0755
fi fi
echo "Installing Shorewall Init Version $VERSION" echo "Installing $Product Version $VERSION"
# #
# Check for /usr/share/shorewall-init/version # Check for /usr/share/shorewall-init/version
# #
if [ -f ${DESTDIR}${SHAREDIR}/shorewall-init/version ]; then if [ -f ${DESTDIR}${SHAREDIR}/$PRODUCT/version ]; then
first_install="" first_install=""
else else
first_install="Yes" first_install="Yes"
fi fi
if [ -n "$DESTDIR" ]; then [ -n "$DESTDIR" ] && make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
chmod 0755 ${DESTDIR}${CONFDIR}/logrotate.d
fi
# #
# Install the Firewall Script # Install the Firewall Script
# #
if [ -n "$INITFILE" ]; then if [ -n "$INITFILE" ]; then
mkdir -p ${DESTDIR}${INITDIR} make_parent_directory ${DESTDIR}${INITDIR} 0755
install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544 install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE
@@ -357,25 +308,21 @@ if [ -z "${SERVICEDIR}" ]; then
fi fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR} make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644 install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service" echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
if [ -n "$DESTDIR" -o $configure -eq 0 ]; then [ -n "$DESTDIR" -o $configure -eq 0 ] && make_parent_directory ${DESTDIR}${SBINDIR} 0755
mkdir -p ${DESTDIR}${SBINDIR} install_file $PRODUCT ${DESTDIR}${SBINDIR}/$PRODUCT 0700
chmod 0755 ${DESTDIR}${SBINDIR} [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/$PRODUCT
fi echo "CLI installed as ${DESTDIR}${SBINDIR}/$PRODUCT"
install_file shorewall-init ${DESTDIR}${SBINDIR}/shorewall-init 0700
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/shorewall-init
echo "CLI installed as ${DESTDIR}${SBINDIR}/shorewall-init"
fi fi
# #
# Create /usr/share/shorewall-init if needed # Create /usr/share/shorewall-init if needed
# #
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall-init make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT 0755
chmod 0755 ${DESTDIR}${SHAREDIR}/shorewall-init
# #
# Install logrotate file # Install logrotate file
@@ -388,55 +335,53 @@ fi
# #
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/shorewall-init/version echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/$PRODUCT/version
chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall-init/version chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
if [ -z "$DESTDIR" ]; then if [ -z "$DESTDIR" ]; then
rm -f ${SHAREDIR}/shorewall-init/init rm -f ${SHAREDIR}/$PRODUCT/init
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/shorewall-init/init ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/$PRODUCT/init
fi fi
if [ $HOST = debian ]; then if [ $HOST = debian ]; then
if [ -n "${DESTDIR}" ]; then if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}${ETC}/network/if-up.d/ make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755
mkdir -p ${DESTDIR}${ETC}/network/if-down.d/ make_parent_directory ${DESTDIR}${ETC}/network/if-down.d 0755
mkdir -p ${DESTDIR}${ETC}/network/if-post-down.d/ make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755
elif [ $configure -eq 0 ]; then elif [ $configure -eq 0 ]; then
mkdir -p ${DESTDIR}${CONFDIR}/network/if-up.d/ make_parent_directory ${DESTDIR}${CONFDIR}/network/if-up.d 0755
mkdir -p ${DESTDIR}${CONFDIR}/network/if-down.d/ make_parent_directory ${DESTDIR}${CONFDIR}/network/if-down.d 0755
mkdir -p ${DESTDIR}${CONFDIR}/network/if-post-down.d/ make_parent_directory ${DESTDIR}${CONFDIR}/network/if-post-down.d 0755
fi fi
if [ ! -f ${DESTDIR}${CONFDIR}/default/shorewall-init ]; then if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then
if [ -n "${DESTDIR}" ]; then [ -n "${DESTDIR}" ] && make_parent_directory ${DESTDIR}${ETC}/default 0755
mkdir -p ${DESTDIR}${ETC}/default
fi
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/default [ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/default 0755
install_file sysconfig ${DESTDIR}${ETC}/default/shorewall-init 0644 install_file ${SYSCONFFILE} ${DESTDIR}${ETC}/default/$PRODUCT 0644
echo "sysconfig file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}" echo "${SYSCONFFILE} file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
fi fi
IFUPDOWN=ifupdown.debian.sh IFUPDOWN=ifupdown.debian.sh
else else
if [ -n "$DESTDIR" ]; then if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}${SYSCONFDIR} make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
if [ -z "$RPM" ]; then if [ -z "$RPM" ]; then
if [ $HOST = suse ]; then if [ $HOST = suse ]; then
mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-up.d make_parent_directory ${DESTDIR}${ETC}/sysconfig/network/if-up.d 0755
mkdir -p ${DESTDIR}${ETC}/sysconfig/network/if-down.d make_parent_directory ${DESTDIR}${ETC}/sysconfig/network/if-down.d 0755
elif [ $HOST = gentoo ]; then elif [ $HOST = gentoo ]; then
# Gentoo does not support if-{up,down}.d # Gentoo does not support if-{up,down}.d
/bin/true /bin/true
elif [ $HOST = openwrt ]; then elif [ $HOST = openwrt ]; then
# Not implemented on openwrt # Not implemented on OpenWRT
/bin/true /bin/true
else else
mkdir -p ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755
fi fi
fi fi
fi fi
@@ -458,13 +403,13 @@ if [ $HOST != openwrt ]; then
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544 install_file ifupdown ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown 0544
fi fi
if [ -d ${DESTDIR}/etc/NetworkManager ]; then if [ -d ${DESTDIR}/etc/NetworkManager ]; then
[ $configure -eq 1 ] || mkdir -p ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d/ [ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544 install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
fi fi
@@ -483,8 +428,8 @@ case $HOST in
suse) suse)
if [ -z "$RPM" ]; then if [ -z "$RPM" ]; then
if [ $configure -eq 0 ]; then if [ $configure -eq 0 ]; then
mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-up.d/ make_parent_directory ${DESTDIR}${SYSCONFDIR}/network/if-up.d 0755
mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-down.d/ make_parent_directory ${DESTDIR}${SYSCONFDIR}/network/if-down.d 0755
fi fi
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544 install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544
@@ -518,17 +463,17 @@ if [ -z "$DESTDIR" ]; then
if [ $HOST = debian ]; then if [ $HOST = debian ]; then
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
if systemctl enable ${PRODUCT}.service; then if systemctl enable ${PRODUCT}.service; then
echo "Shorewall Init will start automatically at boot" echo "$Product will start automatically at boot"
fi fi
elif mywhich insserv; then elif mywhich insserv; then
if insserv ${INITDIR}/shorewall-init; then if insserv ${INITDIR}/$PRODUCT; then
echo "Shorewall Init will start automatically at boot" echo "$Product will start automatically at boot"
else else
cant_autostart cant_autostart
fi fi
elif mywhich update-rc.d ; then elif mywhich update-rc.d ; then
if update-rc.d $PRODUCT enable; then if update-rc.d $PRODUCT enable; then
echo "$PRODUCT will start automatically at boot" echo "$Product will start automatically at boot"
echo "Set startup=1 in ${CONFDIR}/default/$PRODUCT to enable" echo "Set startup=1 in ${CONFDIR}/default/$PRODUCT to enable"
else else
cant_autostart cant_autostart
@@ -549,31 +494,31 @@ if [ -z "$DESTDIR" ]; then
/bin/true /bin/true
else else
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
if systemctl enable shorewall-init.service; then if systemctl enable ${PRODUCT}.service; then
echo "Shorewall Init will start automatically at boot" echo "$Product will start automatically at boot"
fi fi
elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then
if insserv ${INITDIR}/shorewall-init ; then if insserv ${INITDIR}/$PRODUCT ; then
echo "Shorewall Init will start automatically at boot" echo "$Product will start automatically at boot"
else else
cant_autostart cant_autostart
fi fi
elif [ -x ${SBINDIR}/chkconfig -o -x /usr${SBINDIR}/chkconfig ]; then elif [ -x ${SBINDIR}/chkconfig -o -x /usr${SBINDIR}/chkconfig ]; then
if chkconfig --add shorewall-init ; then if chkconfig --add $PRODUCT ; then
echo "Shorewall Init will start automatically in run levels as follows:" echo "$Product will start automatically at boot"
chkconfig --list shorewall-init chkconfig --list $PRODUCT
else else
cant_autostart cant_autostart
fi fi
elif [ -x ${SBINDIR}/rc-update ]; then elif [ -x ${SBINDIR}/rc-update ]; then
if rc-update add shorewall-init default; then if rc-update add $PRODUCT default; then
echo "Shorewall Init will start automatically at boot" echo "$Product will start automatically at boot"
else else
cant_autostart cant_autostart
fi fi
elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then elif [ $HOST = openwrt -a -f ${CONFDIR}/rc.common ]; then
/etc/init.d/$PRODUCT enable /etc/init.d/$PRODUCT enable
if /etc/init.d/shorewall-init enabled; then if /etc/init.d/$PRODUCT enabled; then
echo "$Product will start automatically at boot" echo "$Product will start automatically at boot"
else else
cant_autostart cant_autostart
@@ -587,11 +532,11 @@ else
if [ $configure -eq 1 -a -n "$first_install" ]; then if [ $configure -eq 1 -a -n "$first_install" ]; then
if [ $HOST = debian -a -z "$SERVICEDIR" ]; then if [ $HOST = debian -a -z "$SERVICEDIR" ]; then
if [ -n "${DESTDIR}" ]; then if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}/etc/rcS.d make_parent_directory ${DESTDIR}/etc/rcS.d 0755
fi fi
ln -sf ../init.d/shorewall-init ${DESTDIR}${CONFDIR}/rcS.d/S38shorewall-init ln -sf ../init.d/$PRODUCT ${DESTDIR}${CONFDIR}/rcS.d/S38${PRODUCT}
echo "Shorewall Init will start automatically at boot" echo "$Product will start automatically at boot"
fi fi
fi fi
fi fi
@@ -602,8 +547,8 @@ if [ -d ${DESTDIR}/etc/ppp ]; then
case $HOST in case $HOST in
debian|suse) debian|suse)
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
mkdir -p ${DESTDIR}/etc/ppp/$directory #SuSE doesn't create the IPv6 directories make_parent_directory ${DESTDIR}/etc/ppp/$directory 0755 #SuSE doesn't create the IPv6 directories
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall
done done
;; ;;
redhat) redhat)
@@ -614,19 +559,19 @@ if [ -d ${DESTDIR}/etc/ppp ]; then
FILE=${DESTDIR}/etc/ppp/$file FILE=${DESTDIR}/etc/ppp/$file
if [ -f $FILE ]; then if [ -f $FILE ]; then
if grep -qF Shorewall-based $FILE ; then if grep -qF Shorewall-based $FILE ; then
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown $FILE
else else
echo "$FILE already exists -- ppp devices will not be handled" echo "$FILE already exists -- ppp devices will not be handled"
break break
fi fi
else else
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE cp -fp ${DESTDIR}${LIBEXECDIR}/$PRODUCT/ifupdown $FILE
fi fi
done done
;; ;;
esac esac
fi fi
# #
# Report Success # Report Success
# #
echo "shorewall Init Version $VERSION Installed" echo "shorewall Init Version $VERSION Installed"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Script to back uninstall Shoreline Firewall # Script to back uninstall Shoreline Firewall Init
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# #
@@ -26,62 +26,34 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version VERSION=xxx # The Build script inserts the actual version
PRODUCT=shorewall-init PRODUCT=shorewall-init
Product="Shorewall Init" Product="Shorewall Init"
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <shorewallrc file> ]" echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo "where <option> is one of"
echo " -h"
echo " -v"
echo " -n"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
#
# Source common functions
#
. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; }
#
# Parse the run line
#
finished=0 finished=0
configure=1 configure=1
@@ -118,16 +90,17 @@ while [ $finished -eq 0 ]; do
;; ;;
esac esac
done done
# #
# Read the RC file # Read the RC file
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc . ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1 . ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -137,72 +110,72 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file file=./$file || exit 1
;; ;;
esac esac
. $file || exit 1 . $file || fatal_error "Can not load the RC file: $file"
else else
usage 1 usage 1
fi fi
if [ -f ${SHAREDIR}/shorewall-init/version ]; then if [ -f ${SHAREDIR}/$PRODUCT/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-init/version)" INSTALLED_VERSION="$(cat ${SHAREDIR}/$PRODUCT/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Init Version $INSTALLED_VERSION is installed" echo "WARNING: $Product Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller." echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION" VERSION="$INSTALLED_VERSION"
fi fi
else else
echo "WARNING: Shorewall Init Version $VERSION is not installed" echo "WARNING: $Product Version $VERSION is not installed"
VERSION="" VERSION=""
fi fi
[ -n "${LIBEXEC:=${SHAREDIR}}" ] echo "Uninstalling $Product $VERSION"
echo "Uninstalling Shorewall Init $VERSION"
[ -n "$SANDBOX" ] && configure=0 [ -n "$SANDBOX" ] && configure=0
INITSCRIPT=${CONFDIR}/init.d/shorewall-init [ -n "${LIBEXEC:=${SHAREDIR}}" ]
if [ -f "$INITSCRIPT" ]; then remove_file ${SBINDIR}/$PRODUCT
FIREWALL=${CONFDIR}/init.d/$PRODUCT
if [ -f "$FIREWALL" ]; then
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
if [ $HOST = openwrt ]; then if [ $HOST = openwrt ] ; then
if /etc/init.d/shorewall-init enabled; then if /etc/init.d/$PRODUCT enabled; then
/etc/init.d/shorewall-init disable /etc/init.d/$PRODUCT disable
fi fi
elif mywhich updaterc.d ; then
updaterc.d shorewall-init remove
elif mywhich insserv ; then elif mywhich insserv ; then
insserv -r $INITSCRIPT insserv -r $FIREWALL
elif mywhich update-rc.d ; then
update-rc.d ${PRODUCT} remove
elif mywhich chkconfig ; then elif mywhich chkconfig ; then
chkconfig --del $(basename $INITSCRIPT) chkconfig --del $(basename $FIREWALL)
fi fi
fi fi
remove_file $INITSCRIPT remove_file $FIREWALL
fi fi
if [ -z "${SERVICEDIR}" ]; then [ -z "${SERVICEDIR}" ] && SERVICEDIR="$SYSTEMD"
SERVICEDIR="$SYSTEMD"
fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable shorewall-init.service [ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
rm -f $SERVICEDIR/shorewall-init.service remove_file $SERVICEDIR/${PRODUCT}.service
fi fi
if [ $HOST = openwrt ]; then if [ $HOST = openwrt ]; then
[ "$(readlink -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local [ "$(readlink -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifup-local
[ "$(readlink -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local [ "$(readlink -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifdown-local
else else
[ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local [ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifup-local
[ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local [ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/$PRODUCT ] && remove_file ${SBINDIR}/ifdown-local
fi fi
remove_file ${CONFDIR}/default/shorewall-init remove_file ${CONFDIR}/default/$PRODUCT
remove_file ${CONFDIR}/sysconfig/shorewall-init remove_file ${CONFDIR}/sysconfig/$PRODUCT
remove_file ${CONFDIR}/NetworkManager/dispatcher.d/01-shorewall remove_file ${CONFDIR}/NetworkManager/dispatcher.d/01-shorewall
@@ -227,10 +200,11 @@ if [ -d ${CONFDIR}/ppp ]; then
done done
fi fi
rm -f ${SBINDIR}/shorewall-init remove_directory ${SHAREDIR}/$PRODUCT
rm -rf ${SHAREDIR}/shorewall-init remove_directory ${LIBEXECDIR}/$PRODUCT
rm -rf ${LIBEXECDIR}/shorewall-init remove_file ${CONFDIR}/logrotate.d/$PRODUCT
echo "Shorewall Init Uninstalled"
#
# Report Success
#
echo "$Product $VERSION Uninstalled"

View File

@@ -0,0 +1,26 @@
#
# Global start/restart/reload/stop options
#
OPTIONS=""
#
# Start options
#
STARTOPTIONS=""
#
# Restart options
#
RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# EOF

View File

@@ -1,5 +1,5 @@
# prevent startup with default configuration # prevent startup with default configuration
# set the following varible to 1 in order to allow Shorewall-lite to start # set the following variable to 1 in order to allow Shorewall-lite to start
startup=0 startup=0
@@ -16,7 +16,7 @@ startup=0
# wait_interface= # wait_interface=
# #
# Startup options # Global start/restart/reload/stop options
# #
OPTIONS="" OPTIONS=""
@@ -30,6 +30,16 @@ STARTOPTIONS=""
# #
RESTARTOPTIONS="" RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# #
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf # Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf
# #

View File

@@ -22,62 +22,19 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <http://www.gnu.org/licenses/>.
# #
VERSION=xxx #The Build script inserts the actual version VERSION=xxx # The Build script inserts the actual version
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <configuration-file> ]" echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo " $ME -v" echo "where <option> is one of"
echo " $ME -h" echo " -h"
echo " $ME -n" echo " -v"
echo " -n"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure $Product to start automatically at boot" >&2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
install_file() # $1 = source $2 = target $3 = mode install_file() # $1 = source $2 = target $3 = mode
{ {
if cp -f $1 $2; then if cp -f $1 $2; then
@@ -96,19 +53,6 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1 exit 1
} }
make_directory() # $1 = directory , $2 = mode
{
mkdir -p $1
chmod 755 $1
[ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}
require()
{
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
@@ -122,6 +66,11 @@ else
Product="Shorewall6 Lite" Product="Shorewall6 Lite"
fi fi
#
# Source common functions
#
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
# #
# Parse the run line # Parse the run line
# #
@@ -168,12 +117,14 @@ done
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc || exit 1
file=./shorewallrc file=./shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc file=~/.shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc file=/usr/share/shorewall/shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -183,11 +134,11 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file file=./$file || exit 1
;; ;;
esac esac
. $file . $file || fatal_error "Can not load the RC file: $file"
else else
usage 1 usage 1
fi fi
@@ -318,8 +269,7 @@ case "$HOST" in
linux) linux)
;; ;;
*) *)
echo "ERROR: Unknown HOST \"$HOST\"" >&2 fatal_error "ERROR: Unknown HOST \"$HOST\""
exit 1;
;; ;;
esac esac
@@ -331,7 +281,7 @@ if [ -n "$DESTDIR" ]; then
OWNERSHIP="" OWNERSHIP=""
fi fi
make_directory ${DESTDIR}${INITDIR} 755 make_parent_directory ${DESTDIR}${INITDIR} 0755
else else
if [ ! -f ${SHAREDIR}/shorewall/coreversion ]; then if [ ! -f ${SHAREDIR}/shorewall/coreversion ]; then
@@ -371,25 +321,20 @@ fi
delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules
[ -n "${INITFILE}" ] && make_directory ${DESTDIR}${INITDIR} 755 [ -n "${INITFILE}" ] && make_parent_directory ${DESTDIR}${INITDIR} 0755
# #
# Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed # Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed
# #
mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT make_parent_directory ${DESTDIR}${CONFDIR}/$PRODUCT 0755
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT 0755
mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755
mkdir -p ${DESTDIR}${SBINDIR} make_parent_directory ${DESTDIR}${SBINDIR} 0755
mkdir -p ${DESTDIR}${VARDIR} make_parent_directory ${DESTDIR}${VARDIR} 0755
chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT
if [ -n "$DESTDIR" ]; then if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d make_parent_directory ${DESTDIR}${INITDIR} 0755
mkdir -p ${DESTDIR}${INITDIR}
chmod 755 ${DESTDIR}${INITDIR}
fi fi
if [ -n "$INITFILE" ]; then if [ -n "$INITFILE" ]; then
@@ -410,9 +355,9 @@ if [ -z "${SERVICEDIR}" ]; then
fi fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR} make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 644 install_file $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service 0644
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service" echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
fi fi
@@ -441,8 +386,14 @@ echo "Default config path file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/confi
# #
for f in lib.* ; do for f in lib.* ; do
if [ -f $f ]; then if [ -f $f ]; then
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644 case $f in
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f" *installer)
;;
*)
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
;;
esac
fi fi
done done
@@ -470,12 +421,12 @@ if [ -f modules ]; then
fi fi
if [ -f helpers ]; then if [ -f helpers ]; then
install_file helpers ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers 600 install_file helpers ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers 0600
echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers" echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers"
fi fi
for f in modules.*; do for f in modules.*; do
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 644 install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f" echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
done done
@@ -486,19 +437,19 @@ done
if [ -d manpages -a -n "$MANDIR" ]; then if [ -d manpages -a -n "$MANDIR" ]; then
cd manpages cd manpages
mkdir -p ${DESTDIR}${MANDIR}/man5/ make_parent_directory ${DESTDIR}${MANDIR}/man5 0755
for f in *.5; do for f in *.5; do
gzip -c $f > $f.gz gzip -c $f > $f.gz
install_file $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz 644 install_file $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz 0644
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz" echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz"
done done
mkdir -p ${DESTDIR}${MANDIR}/man8/ make_parent_directory ${DESTDIR}${MANDIR}/man8 0755
for f in *.8; do for f in *.8; do
gzip -c $f > $f.gz gzip -c $f > $f.gz
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 644 install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 0644
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz" echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
done done
@@ -508,7 +459,7 @@ if [ -d manpages -a -n "$MANDIR" ]; then
fi fi
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 644 install_file logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT 0644
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT" echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
fi fi
@@ -516,7 +467,7 @@ fi
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version
chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
@@ -539,10 +490,7 @@ ln -sf shorewall ${DESTDIR}${SBINDIR}/${PRODUCT}
# Note -- not all packages will have the SYSCONFFILE so we need to check for its existance here # Note -- not all packages will have the SYSCONFFILE so we need to check for its existance here
# #
if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
if [ ${DESTDIR} ]; then [ ${DESTDIR} ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
mkdir -p ${DESTDIR}${SYSCONFDIR}
chmod 755 ${DESTDIR}${SYSCONFDIR}
fi
install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640 install_file ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/${PRODUCT} 0640
echo "$SYSCONFFILE file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}" echo "$SYSCONFFILE file installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
@@ -610,6 +558,6 @@ if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${
fi fi
# #
# Report Success # Report Success
# #
echo "$Product Version $VERSION Installed" echo "$Product Version $VERSION Installed"

View File

@@ -16,7 +16,7 @@ RemainAfterExit=yes
EnvironmentFile=-/etc/default/shorewall-lite EnvironmentFile=-/etc/default/shorewall-lite
StandardOutput=syslog StandardOutput=syslog
ExecStart=/sbin/shorewall-lite $OPTIONS start $STARTOPTIONS ExecStart=/sbin/shorewall-lite $OPTIONS start $STARTOPTIONS
ExecStop=/sbin/shorewall-lite $OPTIONS stop ExecStop=/sbin/shorewall-lite $OPTIONS clear
ExecReload=/sbin/shorewall-lite $OPTIONS reload $RELOADOPTIONS ExecReload=/sbin/shorewall-lite $OPTIONS reload $RELOADOPTIONS
[Install] [Install]

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Script to back uninstall Shoreline Firewall # Script to back uninstall Shoreline Firewall Lite
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# #
@@ -26,9 +26,7 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version VERSION=xxx # The Build script inserts the actual version
PRODUCT=shorewall-lite
Product="Shorewall Lite"
usage() # $1 = exit status usage() # $1 = exit status
{ {
@@ -41,46 +39,27 @@ usage() # $1 = exit status
exit $1 exit $1
} }
fatal_error() #
{ # Change to the directory containing this script
echo " ERROR: $@" >&2 #
exit 1 cd "$(dirname $0)"
}
qt() if [ -f shorewall-lite.service ]; then
{ PRODUCT=shorewall-lite
"$@" >/dev/null 2>&1 Product="Shorewall Lite"
} else
PRODUCT=shorewall6-lite
Product="Shorewall6 Lite"
fi
split() { #
local ifs # Source common functions
ifs=$IFS #
IFS=: . ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; }
set -- $1
echo $*
IFS=$ifs
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
#
# Parse the run line
#
finished=0 finished=0
configure=1 configure=1
@@ -97,7 +76,7 @@ while [ $finished -eq 0 ]; do
usage 0 usage 0
;; ;;
v) v)
echo "$Product Firewall Installer Version $VERSION" echo "$Product Firewall Uninstaller Version $VERSION"
exit 0 exit 0
;; ;;
n*) n*)
@@ -117,16 +96,17 @@ while [ $finished -eq 0 ]; do
;; ;;
esac esac
done done
# #
# Read the RC file # Read the RC file
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc . ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1 . ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -136,46 +116,50 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file file=./$file || exit 1
;; ;;
esac esac
. $file . $file || fatal_error "Can not load the RC file: $file"
else else
usage 1 usage 1
fi fi
if [ -f ${SHAREDIR}/shorewall-lite/version ]; then if [ -f ${SHAREDIR}/$PRODUCT/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-lite/version)" INSTALLED_VERSION="$(cat ${SHAREDIR}/$PRODUCT/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Lite Version $INSTALLED_VERSION is installed" echo "WARNING: $Product Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller." echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION" VERSION="$INSTALLED_VERSION"
fi fi
else else
echo "WARNING: Shorewall Lite Version $VERSION is not installed" echo "WARNING: $Product Version $VERSION is not installed"
VERSION="" VERSION=""
fi fi
echo "Uninstalling Shorewall Lite $VERSION" echo "Uninstalling $Product $VERSION"
[ -n "$SANDBOX" ] && configure=0 [ -n "$SANDBOX" ] && configure=0
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then
shorewall-lite clear ${SBINDIR}/$PRODUCT clear
elif qt ip6tables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall6 ]; then
${SBINDIR}/$PRODUCT clear
fi fi
fi fi
if [ -L ${SHAREDIR}/shorewall-lite/init ]; then remove_file ${SBINDIR}/$PRODUCT
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
if [ $HOST = openwrt ]; then if [ $HOST = openwrt ]; then
if [ $configure -eq 1 ] && /etc/init.d/shorewall-lite enabled; then if [ $configure -eq 1 ] && /etc/init.d/$PRODUCT enabled; then
/etc/init.d/shorewall-lite disable /etc/init.d/$PRODUCT disable
fi fi
FIREWALL=$(readlink ${SHAREDIR}/shorewall-lite/init) FIREWALL=$(readlink ${SHAREDIR}/$PRODUCT/init)
else else
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall-lite/init) FIREWALL=$(readlink -m -q ${SHAREDIR}/$PRODUCT/init)
fi fi
elif [ -n "$INITFILE" ]; then elif [ -n "$INITFILE" ]; then
FIREWALL=${INITDIR}/${INITFILE} FIREWALL=${INITDIR}/${INITFILE}
@@ -183,10 +167,10 @@ fi
if [ -f "$FIREWALL" ]; then if [ -f "$FIREWALL" ]; then
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then if mywhich insserv ; then
updaterc.d shorewall-lite remove
elif mywhich insserv ; then
insserv -r $FIREWALL insserv -r $FIREWALL
elif mywhich update-rc.d ; then
update-rc.d ${PRODUCT} remove
elif mywhich chkconfig ; then elif mywhich chkconfig ; then
chkconfig --del $(basename $FIREWALL) chkconfig --del $(basename $FIREWALL)
fi fi
@@ -195,26 +179,29 @@ if [ -f "$FIREWALL" ]; then
remove_file $FIREWALL remove_file $FIREWALL
fi fi
[ -z "$SERVICEDIR" ] && SERVICEDIR="$SYSTEMD" [ -z "${SERVICEDIR}" ] && SERVICEDIR="$SYSTEMD"
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT} [ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
rm -f $SERVICEDIR/shorewall-lite.service remove_file $SERVICEDIR/${PRODUCT}.service
fi fi
rm -f ${SBINDIR}/shorewall-lite remove_directory ${CONFDIR}/$PRODUCT
remove_directory ${VARDIR}
remove_directory ${SHAREDIR}/$PRODUCT
remove_directory ${LIBEXECDIR}/$PRODUCT
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
rm -rf ${CONFDIR}/shorewall-lite if [ -n "$SYSCONFDIR" ]; then
rm -rf ${VARDIR} [ -n "$SYSCONFFILE" ] && remove_file ${SYSCONFDIR}/${PRODUCT}
rm -rf ${SHAREDIR}/shorewall-lite fi
rm -rf ${LIBEXECDIR}/shorewall-lite
rm -f ${CONFDIR}/logrotate.d/shorewall-lite
rm -f ${SYSCONFDIR}/shorewall-lite
if [ -n "${MANDIR}" ]; then if [ -n "${MANDIR}" ]; then
rm -f ${MANDIR}/man5/shorewall-lite* remove_file_with_wildcard ${MANDIR}/man5/${PRODUCT}\*
rm -f ${MANDIR}/man8/shorewall-lite* remove_file_with_wildcard ${MANDIR}/man8/${PRODUCT}\*
fi fi
echo "Shorewall Lite Uninstalled" #
# Report Success
#
echo "$Product $VERSION Uninstalled"

View File

@@ -0,0 +1,9 @@
#
# Shorewall6 -- /usr/share/shorewall/action.A_AllowICMPs
#
# This action A_ACCEPTs needed ICMP types
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT
AllowICMPs(A_ACCEPT)

View File

@@ -13,6 +13,7 @@
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!! # IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
# #
?require AUDIT_TARGET ?require AUDIT_TARGET
?warning "You are using the deprecated A_Drop default action. Please see http://www.shorewall.net/Actions.html
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT #ACTION SOURCE DEST PROTO DPORT SPORT
# #
@@ -31,9 +32,10 @@ Auth(A_DROP)
# #
A_AllowICMPs - - icmp A_AllowICMPs - - icmp
# #
# Don't log broadcasts # Don't log broadcasts and multicasts
# #
dropBcast(audit) dropBcast(audit)
dropMcast(audit)
# #
# Drop packets that are in the INVALID state -- these are usually ICMP packets # Drop packets that are in the INVALID state -- these are usually ICMP packets
# and just confuse people when they appear in the log. # and just confuse people when they appear in the log.

View File

@@ -11,6 +11,8 @@
# internet operation are always ACCEPTed. # internet operation are always ACCEPTed.
# #
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!! # IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
?require AUDIT_TARGET
?warning "You are using the deprecated A_REJECT default action. Please see http://www.shorewall.net/Actions.html
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO #ACTION SOURCE DEST PROTO
# #
@@ -25,10 +27,11 @@ COUNT
# #
A_AllowICMPs - - icmp A_AllowICMPs - - icmp
# #
# Drop Broadcasts so they don't clutter up the log # Drop Broadcasts and multicasts so they don't clutter up the log
# (broadcasts must *not* be rejected). # (these must *not* be rejected).
# #
dropBcast(audit) dropBcast(audit)
dropMcast(audit)
# #
# Drop packets that are in the INVALID state -- these are usually ICMP packets # Drop packets that are in the INVALID state -- these are usually ICMP packets
# and just confuse people when they appear in the log (these ICMPs cannot be # and just confuse people when they appear in the log (these ICMPs cannot be

View File

@@ -0,0 +1,45 @@
#
# Shorewall -- /usr/share/shorewall/action.AllowICMPs
#
# This action ACCEPTs needed ICMP types.
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
DEFAULTS ACCEPT
?if __IPV4
@1 - - icmp fragmentation-needed {comment="Needed ICMP types"}
@1 - - icmp time-exceeded {comment="Needed ICMP types"}
?else
?COMMENT Needed ICMP types (RFC4890)
@1 - - ipv6-icmp destination-unreachable
@1 - - ipv6-icmp packet-too-big
@1 - - ipv6-icmp time-exceeded
@1 - - ipv6-icmp parameter-problem
# The following should have a ttl of 255 and must be allowed to transit a bridge
@1 - - ipv6-icmp router-solicitation
@1 - - ipv6-icmp router-advertisement
@1 - - ipv6-icmp neighbour-solicitation
@1 - - ipv6-icmp neighbour-advertisement
@1 - - ipv6-icmp 137 # Redirect
@1 - - ipv6-icmp 141 # Inverse neighbour discovery solicitation
@1 - - ipv6-icmp 142 # Inverse neighbour discovery advertisement
# The following should have a link local source address and must be allowed to transit a bridge
@1 fe80::/10 - ipv6-icmp 130 # Listener query
@1 fe80::/10 - ipv6-icmp 131 # Listener report
@1 fe80::/10 - ipv6-icmp 132 # Listener done
@1 fe80::/10 - ipv6-icmp 143 # Listener report v2
# The following should be received with a ttl of 255 and must be allowed to transit a bridge
@1 - - ipv6-icmp 148 # Certificate path solicitation
@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
@1 fe80::/10 - ipv6-icmp 151 # Multicast router advertisement
@1 fe80::/10 - ipv6-icmp 152 # Multicast router solicitation
@1 fe80::/10 - ipv6-icmp 153 # Multicast router termination
?endif

View File

@@ -20,7 +20,7 @@
# @2. # @2.
############################################################################### ###############################################################################
?if $1 eq 'BLACKLIST' ?if $1 eq 'BLACKLIST'
?if $BLACKLIST_LOGLEVEL ?if $BLACKLIST_LOG_LEVEL
blacklog blacklog
?else ?else
$BLACKLIST_DISPOSITION $BLACKLIST_DISPOSITION

View File

@@ -20,7 +20,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# Broadcast[([<action>|-[,{audit|-}])] # Broadcast[([<action>|[,{audit|-}])]
# #
# Default action is DROP # Default action is DROP
# #
@@ -29,27 +29,37 @@
DEFAULTS DROP,- DEFAULTS DROP,-
?if __ADDRTYPE ?if __ADDRTYPE
@1 - - - ;; -m addrtype --dst-type BROADCAST @1 - - - ;; -m addrtype --dst-type BROADCAST
@1 - - - ;; -m addrtype --dst-type ANYCAST @1 - - - ;; -m addrtype --dst-type ANYCAST
?else ?else
?begin perl; ?begin perl;
use Shorewall::IPAddrs; use strict;
use Shorewall::Config; use Shorewall::IPAddrs;
use Shorewall::Chains; use Shorewall::Config;
use Shorewall::Chains;
my ( $action ) = get_action_params( 1 ); my ( $action, $audit ) = get_action_params( 2 );
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
add_commands $chainref, 'for address in $ALL_BCASTS; do'; fatal_error "Invalid parameter to action Broadcast" if supplied $audit && $audit ne 'audit';
incr_cmd_level $chainref;
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d $address ' if $level ne '';
add_jump $chainref, $action, 0, "-d \$address ";
decr_cmd_level $chainref;
add_commands $chainref, 'done';
1; my $target = require_audit ( $action , $audit );
?end perl; if ( $family == F_IPV4 ) {
add_commands $chainref, 'for address in $ALL_BCASTS; do';
} elsif ($family == F_IPV6 ) {
add_commands $chainref, 'for address in $ALL_ACASTS; do';
}
incr_cmd_level $chainref;
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d $address ' if $level ne '';
add_jump $chainref, $target, 0, "-d \$address ";
decr_cmd_level $chainref;
add_commands $chainref, 'done';
1;
?end perl;
?endif ?endif

View File

@@ -13,9 +13,9 @@
DEFAULTS 2,0 DEFAULTS 2,0
?if @1 !~ /^\d+/ || ! @1 || @1 > 1024 ?if @1 !~ /^\d+/ || ! @1 || @1 > 1024
?error Invalid value for Bricks (@1) ?error Invalid value (@1) for the GlusterFS Bricks argument
?elsif @2 !~ /^[01]$/ ?elsif @2 !~ /^[01]$/
?error Invalid value for IB (@2) ?error Invalid value (@2) for the GlusterFS IB argument
?endif ?endif
#ACTION SOURCE DEST PROTO DPORT #ACTION SOURCE DEST PROTO DPORT

View File

@@ -22,6 +22,49 @@
# #
# Limit(<recent-set>,<num-connections>,<timeout>) # Limit(<recent-set>,<num-connections>,<timeout>)
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -,-,-
?begin perl
use strict;
use Shorewall::Config;
use Shorewall::Chains;
my $chainref = get_action_chain;
my @param = get_action_params(3);
my ( $level, $tag ) = get_action_logging;
@param = split( ',', $tag ), $tag = $param[0] unless supplied( join '', @param );
fatal_error 'Limit rules must include <set name>,<max connections>,<interval> as the log tag or as parameters' unless @param == 3;
my $set = $param[0];
for ( @param[1,2] ) {
fatal_error 'Max connections and interval in Limit rules must be numeric (' . join( ':', 'Limit', $level eq '' ? 'none' : $level, $tag ) . ')' unless /^\d+$/
}
my $count = $param[1] + 1;
require_capability( 'RECENT_MATCH' , 'Limit rules' , '' );
warning_message "The Limit action is deprecated in favor of per-IP rate limiting using the RATE LIMIT column";
add_irule $chainref, recent => "--name $set --set";
if ( $level ne '' ) {
my $xchainref = new_chain 'filter' , "$chainref->{name}%";
log_irule_limit( $level, $xchainref, '', 'DROP', [], $tag, 'add' , '' );
add_ijump $xchainref, j => 'DROP';
add_ijump $chainref, j => $xchainref, recent => "--name $set --update --seconds $param[2] --hitcount $count";
} else {
add_ijump $chainref, j => 'DROP', recent => "--update --name $set --seconds $param[2] --hitcount $count";
}
add_ijump $chainref, j => 'ACCEPT';
1;
?end perl

View File

@@ -29,22 +29,28 @@
DEFAULTS DROP,- DEFAULTS DROP,-
?if __ADDRTYPE ?if __ADDRTYPE
@1 - - - ;; -m addrtype --dst-type MULTICAST @1 - - - ;; -m addrtype --dst-type MULTICAST
?else ?else
?begin perl; ?begin perl;
use Shorewall::IPAddrs; use strict;
use Shorewall::Config; use Shorewall::IPAddrs;
use Shorewall::Chains; use Shorewall::Config;
use Shorewall::Chains;
my ( $action ) = get_action_params( 1 ); my ( $action, $audit ) = get_action_params( 2 );
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
log_rule_limit $level, $chainref, 'Multicast' , $action, '', $tag, 'add', ' -d 224.0.0.0/4 ' if $level ne ''; fatal_error "Invalid parameter to action Multicast" if supplied $audit && $audit ne 'audit';
add_jump $chainref, $action, 0, '-d 224.0.0.0/4 ';
1; my $target = require_audit ( $action , $audit );
my $dest = ( $family == F_IPV4 ) ? join( ' ', '-d', IPv4_MULTICAST . ' ' ) : join( ' ', '-d', IPv6_MULTICAST . ' ' );
?end perl; log_rule_limit( $level, $chainref, 'Multicast' , $action, '', $tag, 'add', $dest ) if $level ne '';
add_jump $chainref, $target, 0, $dest;
1;
?end perl;
?endif ?endif

View File

@@ -22,6 +22,17 @@
# #
# allowBcast[([audit])] # allowBcast[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Broadcast(A_ACCEPT)
?else
?error "Invalid argument (@1) to allowBcast"
?endif
?else
Broadcast(ACCEPT)
?endif

View File

@@ -22,6 +22,17 @@
# #
# allowMcast[([audit])] # allowMcast[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Multicast(A_ACCEPT)
?else
?error "Invalid argument (@1) to allowMcast"
?endif
?else
Multicast(ACCEPT)
?endif

View File

@@ -1,5 +1,5 @@
# #
# Shorewall -- /usr/share/shorewall/action.allowUPnP # Shorewall -- /usr/share/shorewall/action.allowinUPnP
# #
# 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]
# #
@@ -20,8 +20,21 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# allowUPnP[([audit])] # allowinUPnP[([audit])]
#
# This is a built-in action.
# #
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
A_ACCEPT - - 17 1900
A_ACCEPT - - 6 49152
?else
?error "Invalid argument (@1) to allowinUPnP"
?endif
?else
ACCEPT - - 17 1900
ACCEPT - - 6 49152
?endif

View File

@@ -22,6 +22,18 @@
# #
# dropBcast[([audit])] # dropBcast[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Broadcast(A_DROP)
?else
?error "Invalid argument (@1) to dropBcast"
?endif
?else
Broadcast(DROP)
?endif

View File

@@ -22,6 +22,17 @@
# #
# dropMcast[([audit])] # dropMcast[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
Multicast(A_DROP)
?else
?error "Invalid argument (@1) to dropMcast"
?endif
?else
Multicast(DROP)
?endif

View File

@@ -22,6 +22,17 @@
# #
# dropNotSyn[([audit])] # dropNotSyn[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
A_DROP {proto=6:!syn}
?else
?error "Invalid argument (@1) to dropNotSyn"
?endif
?else
DROP {proto=6:!syn}
?endif

View File

@@ -22,6 +22,22 @@
# #
# forwardUPnP # forwardUPnP
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?begin perl
use strict;
use Shorewall::Config;
use Shorewall::Chains;
my $chainref = get_action_chain;
set_optflags( $chainref, DONT_OPTIMIZE );
add_commands( $chainref , '[ -f ${VARDIR}/.forwardUPnP ] && cat ${VARDIR}/.forwardUPnP >&3' );
1;
?end perl

View File

@@ -22,6 +22,18 @@
# #
# rejNotSyn[([audit])] # rejNotSyn[([audit])]
# #
# This is a built-in action.
#
############################################################################### ###############################################################################
DEFAULTS -
?if passed(@1)
?if @1 eq 'audit'
?require AUDIT_TARGET
A_REJECT {proto=6:!syn}
?else
?error "Invalid argument (@1) to rejNotSyn"
?endif
?else
REJECT(tcp-reset) {proto=6:!syn}
?endif

View File

@@ -1,13 +0,0 @@
#
# Shorewall -- /usr/share/shorewall/macro.AllowICMPs
#
# This macro ACCEPTs needed ICMP types.
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
?COMMENT Needed ICMP types
DEFAULT ACCEPT
PARAM - - icmp fragmentation-needed
PARAM - - icmp time-exceeded

View File

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

View File

@@ -405,14 +405,14 @@ our $VERSION = 'MODULEVERSION';
# Provider Chains for provider <p> # Provider Chains for provider <p>
# Load Balance - ~<p> # Load Balance - ~<p>
# #
# Zone-pair chains for rules chain <z12z2> # Zone-pair chains for rules chain <z1-z2>
# #
# Syn Flood - @<z12z2> # Syn Flood - @<z1-z2>
# Blacklist - <z12z2>~ # Blacklist - <z1-z2>~
# Established - ^<z12z2> # Established - ^<z1-z2>
# Related - +<z12z2> # Related - +<z1-z2>
# Invalid - _<z12z2> # Invalid - _<z1-z2>
# Untracked - &<z12z2> # Untracked - &<z1-z2>
# #
our %chain_table; our %chain_table;
our $raw_table; our $raw_table;
@@ -434,7 +434,7 @@ use constant { STANDARD => 0x1, #defined by Netfilter
REDIRECT => 0x20, #'REDIRECT' REDIRECT => 0x20, #'REDIRECT'
ACTION => 0x40, #An action (may be built-in) ACTION => 0x40, #An action (may be built-in)
MACRO => 0x80, #A Macro MACRO => 0x80, #A Macro
LOGRULE => 0x100, #'LOG','NFLOG' LOGRULE => 0x100, #'LOG','ULOG','NFLOG'
NFQ => 0x200, #'NFQUEUE' NFQ => 0x200, #'NFQUEUE'
CHAIN => 0x400, #Manual Chain CHAIN => 0x400, #Manual Chain
SET => 0x800, #SET SET => 0x800, #SET
@@ -1081,11 +1081,11 @@ sub format_option( $$ ) {
assert( ! reftype $value ); assert( ! reftype $value );
my $rule = ''; my $rule;
$value =~ s/\s*$//; $value =~ s/\s*$//;
$rule .= join( ' ' , ' -m', $option, $value ); $rule = join( ' ' , ' -m', $option, $value );
$rule; $rule;
} }
@@ -1223,7 +1223,7 @@ sub merge_rules( $$$ ) {
} }
} }
for my $option ( grep ! $opttype{$_} || $_ eq 'nfacct' || $_ eq 'recent', sort { $b cmp $a } keys %$fromref ) { for my $option ( grep ! $opttype{$_} || $_ eq 'nfacct' || $_ eq 'recent', keys %$fromref ) {
set_rule_option( $toref, $option, $fromref->{$option} ); set_rule_option( $toref, $option, $fromref->{$option} );
} }
@@ -1239,7 +1239,7 @@ sub merge_rules( $$$ ) {
set_rule_option( $toref, 'policy', $fromref->{policy} ) if exists $fromref->{policy}; set_rule_option( $toref, 'policy', $fromref->{policy} ) if exists $fromref->{policy};
for my $option ( grep( get_opttype( $_, 0 ) == EXPENSIVE, sort keys %$fromref ) ) { for my $option ( grep( get_opttype( $_, 0 ) == EXPENSIVE, keys %$fromref ) ) {
set_rule_option( $toref, $option, $fromref->{$option} ); set_rule_option( $toref, $option, $fromref->{$option} );
} }
@@ -3691,7 +3691,7 @@ sub optimize_level8( $$$ ) {
} }
if ( $progress ) { if ( $progress ) {
my @rename = sort keys %rename; my @rename = keys %rename;
# #
# First create aliases for each renamed chain and change the {name} member. # First create aliases for each renamed chain and change the {name} member.
# #
@@ -4556,7 +4556,8 @@ sub do_proto( $$$;$ )
if ( $proto ne '' ) { if ( $proto ne '' ) {
my $synonly = ( $proto =~ s/:syn$//i ); my $synonly = ( $proto =~ s/:(!)?syn$//i );
my $notsyn = $1;
my $invert = ( $proto =~ s/^!// ? '! ' : '' ); my $invert = ( $proto =~ s/^!// ? '! ' : '' );
my $protonum = resolve_proto $proto; my $protonum = resolve_proto $proto;
@@ -4574,7 +4575,7 @@ sub do_proto( $$$;$ )
$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;
$output = "-p $proto --syn "; $output = $notsyn ? "-p $proto ! --syn " : "-p $proto --syn ";
} }
fatal_error "SOURCE/DEST PORT(S) not allowed with PROTO !$pname" if $invert && ($ports ne '' || $sports ne ''); fatal_error "SOURCE/DEST PORT(S) not allowed with PROTO !$pname" if $invert && ($ports ne '' || $sports ne '');
@@ -6980,13 +6981,13 @@ sub set_global_variables( $$ ) {
if ( $conditional ) { if ( $conditional ) {
my ( $interface, @interfaces ); my ( $interface, @interfaces );
@interfaces = sort keys %interfaceaddr; @interfaces = keys %interfaceaddr;
for $interface ( @interfaces ) { for $interface ( @interfaces ) {
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfaceaddr{$interface}) ); emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfaceaddr{$interface}) );
} }
@interfaces = sort keys %interfacegateways; @interfaces = keys %interfacegateways;
for $interface ( @interfaces ) { for $interface ( @interfaces ) {
emit( qq(if [ -z "\$interface" -o "\$interface" = "$interface" ]; then) ); emit( qq(if [ -z "\$interface" -o "\$interface" = "$interface" ]; then) );
@@ -6996,36 +6997,36 @@ sub set_global_variables( $$ ) {
emit( qq(fi\n) ); emit( qq(fi\n) );
} }
@interfaces = sort keys %interfacemacs; @interfaces = keys %interfacemacs;
for $interface ( @interfaces ) { for $interface ( @interfaces ) {
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfacemacs{$interface}) ); emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfacemacs{$interface}) );
} }
} else { } else {
emit $_ for sort values %interfaceaddr; emit $_ for values %interfaceaddr;
emit "$_\n" for sort values %interfacegateways; emit "$_\n" for values %interfacegateways;
emit $_ for sort values %interfacemacs; emit $_ for values %interfacemacs;
} }
if ( $setall ) { if ( $setall ) {
emit $_ for sort values %interfaceaddrs; emit $_ for values %interfaceaddrs;
emit $_ for sort values %interfacenets; emit $_ for values %interfacenets;
unless ( have_capability( 'ADDRTYPE' ) ) { unless ( have_capability( 'ADDRTYPE' ) ) {
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
emit 'ALL_BCASTS="$(get_all_bcasts) 255.255.255.255"'; emit 'ALL_BCASTS="$(get_all_bcasts) 255.255.255.255"';
emit $_ for sort values %interfacebcasts; emit $_ for values %interfacebcasts;
} else { } else {
emit 'ALL_ACASTS="$(get_all_acasts)"'; emit 'ALL_ACASTS="$(get_all_acasts)"';
emit $_ for sort values %interfaceacasts; emit $_ for values %interfaceacasts;
} }
} }
} }
} }
sub verify_address_variables() { sub verify_address_variables() {
for my $variable ( sort keys %address_variables ) { for my $variable ( keys %address_variables ) {
my $type = $address_variables{$variable}; my $type = $address_variables{$variable};
my $address = "\$$variable"; my $address = "\$$variable";
@@ -7942,7 +7943,7 @@ sub add_interface_options( $ ) {
# #
# Generate a digest for each chain # Generate a digest for each chain
# #
for my $chainref ( sort { $a->{name} cmp $b->{name} } values %input_chains, values %forward_chains ) { for my $chainref ( values %input_chains, values %forward_chains ) {
my $digest = ''; my $digest = '';
assert( $chainref ); assert( $chainref );
@@ -7961,7 +7962,7 @@ sub add_interface_options( $ ) {
# Insert jumps to the interface chains into the rules chains # Insert jumps to the interface chains into the rules chains
# #
for my $zone1 ( off_firewall_zones ) { for my $zone1 ( off_firewall_zones ) {
my @input_interfaces = sort keys %{zone_interfaces( $zone1 )}; my @input_interfaces = keys %{zone_interfaces( $zone1 )};
my @forward_interfaces = @input_interfaces; my @forward_interfaces = @input_interfaces;
if ( @input_interfaces > 1 ) { if ( @input_interfaces > 1 ) {
@@ -8047,7 +8048,7 @@ sub add_interface_options( $ ) {
for my $zone1 ( firewall_zone, vserver_zones ) { for my $zone1 ( firewall_zone, vserver_zones ) {
for my $zone2 ( off_firewall_zones ) { for my $zone2 ( off_firewall_zones ) {
my $chainref = $filter_table->{rules_chain( $zone1, $zone2 )}; my $chainref = $filter_table->{rules_chain( $zone1, $zone2 )};
my @interfaces = sort keys %{zone_interfaces( $zone2 )}; my @interfaces = keys %{zone_interfaces( $zone2 )};
my $chain1ref; my $chain1ref;
for my $interface ( @interfaces ) { for my $interface ( @interfaces ) {
@@ -8453,7 +8454,7 @@ sub create_save_ipsets() {
# #
$ipsets{$_} = 1 for ( @ipsets, @{$globals{SAVED_IPSETS}} ); $ipsets{$_} = 1 for ( @ipsets, @{$globals{SAVED_IPSETS}} );
my @sets = sort keys %ipsets; my @sets = keys %ipsets;
emit( '' , emit( '' ,
' rm -f $file' , ' rm -f $file' ,
@@ -8629,7 +8630,7 @@ sub create_load_ipsets() {
# #
sub create_nfobjects() { sub create_nfobjects() {
my @objects = ( sort keys %nfobjects ); my @objects = ( keys %nfobjects );
if ( @objects ) { if ( @objects ) {
if ( $config{NFACCT} ) { if ( $config{NFACCT} ) {
@@ -8644,7 +8645,7 @@ sub create_nfobjects() {
} }
} }
for ( sort keys %nfobjects ) { for ( keys %nfobjects ) {
emit( qq(if ! qt \$NFACCT get $_; then), emit( qq(if ! qt \$NFACCT get $_; then),
qq( \$NFACCT add $_), qq( \$NFACCT add $_),
qq(fi\n) ); qq(fi\n) );
@@ -9120,7 +9121,7 @@ sub initialize_switches() {
if ( keys %switches ) { if ( keys %switches ) {
emit( 'if [ $COMMAND = start ]; then' ); emit( 'if [ $COMMAND = start ]; then' );
push_indent; push_indent;
for my $switch ( sort keys %switches ) { for my $switch ( keys %switches ) {
my $setting = $switches{$switch}; my $setting = $switches{$switch};
my $file = "/proc/net/nf_condition/$switch"; my $file = "/proc/net/nf_condition/$switch";
emit "[ -f $file ] && echo $setting->{setting} > $file"; emit "[ -f $file ] && echo $setting->{setting} > $file";

View File

@@ -93,11 +93,10 @@ sub generate_script_1( $ ) {
my $date = compiletime; my $date = compiletime;
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#"; emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
copy $globals{SHAREDIRPL} . '/lib.runtime', 0;
copy2 $globals{SHAREDIRPL} . '/lib.common' , $debug;
} }
copy $globals{SHAREDIRPL} . '/lib.runtime', 0;
copy2 $globals{SHAREDIRPL} . '/lib.common' , $debug;
} }
my $lib = find_file 'lib.private'; my $lib = find_file 'lib.private';
@@ -945,7 +944,7 @@ sub compiler {
# #
# Copy the footer to the script # Copy the footer to the script
# #
copy $globals{SHAREDIRPL} . 'prog.footer' unless $test; copy $globals{SHAREDIRPL} . 'prog.footer';
disable_script; disable_script;
# #

View File

@@ -86,6 +86,9 @@ our @EXPORT = qw(
kernel_version kernel_version
compiletime compiletime
F_IPV4
F_IPV6
); );
our @EXPORT_OK = qw( $shorewall_dir initialize shorewall); our @EXPORT_OK = qw( $shorewall_dir initialize shorewall);
@@ -197,9 +200,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
PARMSMODIFIED PARMSMODIFIED
USEDCALLER USEDCALLER
F_IPV4
F_IPV6
TCP TCP
UDP UDP
UDPLITE UDPLITE
@@ -748,7 +748,7 @@ sub initialize( $;$$) {
TC_SCRIPT => '', TC_SCRIPT => '',
EXPORT => 0, EXPORT => 0,
KLUDGEFREE => '', KLUDGEFREE => '',
VERSION => "5.1.1-RC1", VERSION => "5.1.4-Beta1",
CAPVERSION => 50100 , CAPVERSION => 50100 ,
BLACKLIST_LOG_TAG => '', BLACKLIST_LOG_TAG => '',
RELATED_LOG_TAG => '', RELATED_LOG_TAG => '',
@@ -907,6 +907,7 @@ sub initialize( $;$$) {
ZERO_MARKS => undef , ZERO_MARKS => undef ,
FIREWALL => undef , FIREWALL => undef ,
BALANCE_PROVIDERS => undef , BALANCE_PROVIDERS => undef ,
PERL_HASH_SEED => undef ,
# #
# Packet Disposition # Packet Disposition
# #
@@ -1092,7 +1093,7 @@ sub initialize( $;$$) {
%compiler_params = (); %compiler_params = ();
%actparams = ( 0 => 0, loglevel => '', logtag => '', chain => '', disposition => '', caller => '' ); %actparams = ( 0 => 0, loglevel => '', logtag => '', chain => '', disposition => '', caller => '', callfile => '', callline => '' );
$parmsmodified = 0; $parmsmodified = 0;
$usedcaller = 0; $usedcaller = 0;
%ipsets = (); %ipsets = ();
@@ -1218,7 +1219,7 @@ sub compiletime() {
sub currentlineinfo() { sub currentlineinfo() {
my $linenumber = $currentlinenumber || 1; my $linenumber = $currentlinenumber || 1;
if ( $currentfile ) { if ( $currentfilename ) {
my $lineinfo = " $currentfilename "; my $lineinfo = " $currentfilename ";
if ( $linenumber eq 'EOF' ) { if ( $linenumber eq 'EOF' ) {
@@ -2232,7 +2233,7 @@ sub split_list4( $ ) {
sub split_columns( $ ) { sub split_columns( $ ) {
my ($list) = @_; my ($list) = @_;
return split ' ', $list unless $list =~ /\(/; return split ' ', $list unless $list =~ /[()]/;
my @list1 = split ' ', $list; my @list1 = split ' ', $list;
my @list2; my @list2;
@@ -2273,9 +2274,7 @@ sub split_columns( $ ) {
} }
} }
unless ( $opencount == 0 ) { fatal_error "Mismatched parentheses ($list)" unless $opencount == 0;
fatal_error "Mismatched parentheses ($list)";
}
@list2; @list2;
} }
@@ -2288,7 +2287,7 @@ sub clear_comment();
# ensure that it has an appropriate number of columns. # ensure that it has an appropriate number of columns.
# supply '-' in omitted trailing columns. # supply '-' in omitted trailing columns.
# Handles all of the supported forms of column/pair specification # Handles all of the supported forms of column/pair specification
# Handles segragating raw iptables input in INLINE rules # Handles segragating raw iptables input in rules
# #
sub split_line2( $$;$$$ ) { sub split_line2( $$;$$$ ) {
my ( $description, $columnsref, $nopad, $maxcolumns, $inline ) = @_; my ( $description, $columnsref, $nopad, $maxcolumns, $inline ) = @_;
@@ -2437,12 +2436,12 @@ sub split_line2( $$;$$$ ) {
} }
} else { } else {
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column}; fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
$column = $columnsref->{$column};
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
$value = $1 if $value =~ /^"([^"]+)"$/; $value = $1 if $value =~ /^"([^"]+)"$/;
$value =~ s/\\"/"/g; $value =~ s/\\"/"/g;
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/; fatal_error "Non-ASCII gunk in the value of the $column column" if $value =~ /[^\s[:print:]]/;
$line[$column] = $value; my $colnum = $columnsref->{$column};
warning_message qq(Replacing "$line[$colnum]" with "$value" in the ) . uc( $column ) . ' column' if $line[$colnum] ne '-';
$line[$colnum] = $value;
} }
} }
} }
@@ -2782,7 +2781,7 @@ sub evaluate_expression( $$$$ ) {
my ( $first, $var, $rest ) = ( $1, $3, $4); my ( $first, $var, $rest ) = ( $1, $3, $4);
$var = numeric_value( $var ) if $var =~ /^\d/; $var = numeric_value( $var ) if $var =~ /^\d/;
$val = $var ? $actparams{$var} : $chain; $val = $var ? $actparams{$var} : $chain;
$usedcaller = USEDCALLER if $var eq 'caller'; $usedcaller = USEDCALLER if $var =~ /^(?:caller|callfile|callline)$/;
$expression = join_parts( $first, $val, $rest , $just_expand ); $expression = join_parts( $first, $val, $rest , $just_expand );
directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100; directive_error( "Variable Expansion Loop" , $filename, $linenumber ) if ++$count > 100;
} }
@@ -2818,7 +2817,6 @@ sub evaluate_expression( $$$$ ) {
# #
# Not a simple one-term expression -- compile it # Not a simple one-term expression -- compile it
# #
declare_passed unless $evals++; declare_passed unless $evals++;
$val = eval qq(package Shorewall::User; $val = eval qq(package Shorewall::User;
@@ -2835,6 +2833,7 @@ sub evaluate_expression( $$$$ ) {
$val; $val;
} }
sub pop_open();
# #
# Set callback # Set callback
# #
@@ -2842,6 +2841,40 @@ sub directive_callback( $ ) {
$directive_callback = shift; $directive_callback = shift;
} }
sub directive_message( \&$$$$ ) {
my ( $functptr, $verbose, $expression, $filename, $linenumber ) = @_;
unless ( $omitting ) {
if ( $actparams{0} ) {
#
# When issuing a message from an action, report the action invocation
# site rather than the action file and line number.
#
# Avoid double-reporting by temporarily removing the invocation site
# from the open stack.
#
my $saveopens = pop @openstack;
$functptr->( $verbose ,
evaluate_expression( $expression ,
$filename ,
$linenumber ,
1 ),
$actparams{callfile} ,
$actparams{callline} );
push @openstack, $saveopens;
} else {
$functptr->( $verbose ,
evaluate_expression( $expression ,
$filename ,
$linenumber ,
1 ),
$filename ,
$linenumber );
}
}
}
# #
# Each entry in @ifstack consists of a 4-tupple # Each entry in @ifstack consists of a 4-tupple
# #
@@ -2855,7 +2888,8 @@ sub process_compiler_directive( $$$$ ) {
print "CD===> $line\n" if $debug; print "CD===> $line\n" if $debug;
directive_error( "Invalid compiler directive ($line)" , $filename, $linenumber ) unless $line =~ /^\s*\?(IF\s+|ELSE|ELSIF\s+|ENDIF|SET\s+|RESET\s+|FORMAT\s+|COMMENT\s*|ERROR\s+|WARNING\s+|INFO\s+|WARNING!\s+|INFO!\s+|REQUIRE\s+)(.*)$/i; directive_error( "Invalid compiler directive ($line)" , $filename, $linenumber )
unless $line =~ /^\s*\?(IF\s+|ELSE|ELSIF\s+|ENDIF|SET\s+|RESET\s+|FORMAT\s+|COMMENT\s*|ERROR\s+|WARNING\s+|INFO\s+|WARNING!\s+|INFO!\s+|REQUIRE\s+)(.*)$/i;
my ($keyword, $expression) = ( uc $1, $2 ); my ($keyword, $expression) = ( uc $1, $2 );
@@ -2957,15 +2991,16 @@ sub process_compiler_directive( $$$$ ) {
$var = $2 || 'chain'; $var = $2 || 'chain';
directive_error( "Shorewall variables may only be RESET in the body of an action", $filename, $linenumber ) unless $actparams{0}; directive_error( "Shorewall variables may only be RESET in the body of an action", $filename, $linenumber ) unless $actparams{0};
if ( exists $actparams{$var} ) { if ( exists $actparams{$var} ) {
if ( $var =~ /^loglevel|logtag|chain|disposition|caller$/ ) { if ( $var =~ /^(?:loglevel|logtag|chain|disposition|caller|callfile|callline)$/ ) {
$actparams{$var} = ''; $actparams{$var} = '';
} else { } else {
delete $actparams{$var} delete $actparams{$var}
} }
$parmsmodified = PARMSMODIFIED if @ifstack > $ifstack;
} else { } else {
directive_warning( 'Yes', "Shorewall variable $2 does not exist", $filename, $linenumber ); directive_warning( 'Yes', "Shorewall variable $2 does not exist", $filename, $linenumber );
} }
} else { } else {
if ( exists $variables{$2} ) { if ( exists $variables{$2} ) {
delete $variables{$2}; delete $variables{$2};
@@ -2995,58 +3030,87 @@ sub process_compiler_directive( $$$$ ) {
} , } ,
ERROR => sub() { ERROR => sub() {
directive_error( evaluate_expression( $expression , unless ( $omitting ) {
$filename , if ( $actparams{0} ) {
$linenumber , close $currentfile;
1 ) , #
$filename , # Avoid 'missing ?ENDIF' error in pop_open'
$linenumber ) unless $omitting; #
@ifstack = ();
#
# Avoid double-reporting the action invocation site
#
pop_open;
directive_error( evaluate_expression( $expression ,
$filename ,
$linenumber ,
1 ) ,
$actparams{callfile} ,
$actparams{callline} );
} else {
directive_error( evaluate_expression( $expression ,
$filename ,
$linenumber ,
1 ) ,
$filename ,
$linenumber ) unless $omitting;
}
}
} , } ,
WARNING => sub() { WARNING => sub() {
directive_warning( $config{VERBOSE_MESSAGES} , directive_message( &directive_warning ,
evaluate_expression( $expression , $config{VERBOSE_MESSAGES},
$filename , $expression ,
$linenumber ,
1 ),
$filename , $filename ,
$linenumber ) unless $omitting; $linenumber );
} , } ,
INFO => sub() { INFO => sub() {
directive_info( $config{VERBOSE_MESSAGES} , directive_message( &directive_info,
evaluate_expression( $expression , $config{VERBOSE_MESSAGES} ,
$filename , $expression ,
$linenumber , $filename ,
1 ), $linenumber );
$filename ,
$linenumber ) unless $omitting;
} , } ,
'WARNING!' => sub() { 'WARNING!' => sub() {
directive_warning( ! $config{VERBOSE_MESSAGES} , directive_message( &directive_warning ,
evaluate_expression( $expression , ! $config{VERBOSE_MESSAGES} ,
$filename , $expression ,
$linenumber ,
1 ),
$filename , $filename ,
$linenumber ) unless $omitting; $linenumber );
} , } ,
'INFO!' => sub() { 'INFO!' => sub() {
directive_info( ! $config{VERBOSE_MESSAGES} , directive_message( &directive_info ,
evaluate_expression( $expression , ! $config{VERBOSE_MESSAGES} ,
$filename , $expression ,
$linenumber , $filename ,
1 ), $linenumber );
$filename ,
$linenumber ) unless $omitting;
} , } ,
REQUIRE => sub() { REQUIRE => sub() {
fatal_error "?REQUIRE may only be used within action files" unless $actparams{0}; unless ( $omitting ) {
fatal_error "Unknown capability ($expression}" unless $capabilities{$expression}; fatal_error "?REQUIRE may only be used within action files" unless $actparams{0};
require_capability( $expression, "The $actparams{action} action", 's' ); fatal_error "Unknown capability ($expression)" unless ( my $capdesc = $capdesc{$expression} );
unless ( have_capability( $expression ) ) {
close $currentfile;
#
# Avoid 'missing ?ENDIF' error in pop_open'
#
@ifstack = ();
#
# Avoid double-reporting the action call site
#
pop_open;
directive_error( "The $actparams{action} action requires the $capdesc capability",
$actparams{callfile} ,
$actparams{callline} );
}
}
} , } ,
); );
@@ -3547,6 +3611,8 @@ sub push_action_params( $$$$$$ ) {
$actparams{loglevel} = $loglevel; $actparams{loglevel} = $loglevel;
$actparams{logtag} = $logtag; $actparams{logtag} = $logtag;
$actparams{caller} = $caller; $actparams{caller} = $caller;
$actparams{callfile} = $currentfilename;
$actparams{callline} = $currentlinenumber;
$actparams{disposition} = '' if $chainref->{action}; $actparams{disposition} = '' if $chainref->{action};
# #
# The Shorewall variable '@chain' has non-word characters other than hyphen removed # The Shorewall variable '@chain' has non-word characters other than hyphen removed
@@ -3677,6 +3743,7 @@ sub expand_variables( \$ ) {
$usedcaller = USEDCALLER if $var eq 'caller'; $usedcaller = USEDCALLER if $var eq 'caller';
} else { } else {
fatal_error "Undefined shell variable (\$$var)" unless $config{IGNOREUNKNOWNVARIABLES} || exists $config{$var}; fatal_error "Undefined shell variable (\$$var)" unless $config{IGNOREUNKNOWNVARIABLES} || exists $config{$var};
$val = $config{$var};
} }
$val = '' unless defined $val; $val = '' unless defined $val;
@@ -5356,8 +5423,12 @@ sub update_config_file( $ ) {
} }
} }
if ( supplied $val ) {
$val = conditional_quote $val; #
# Log LEVEL and DEFAULT settings often contain parens
#
$val = ($var =~ /(?:LEVEL|DEFAULT)$/) ? qq("$val") : conditional_quote $val;
}
$_ = "$var=$val\n"; $_ = "$var=$val\n";
} }
@@ -5420,6 +5491,7 @@ EOF
sub process_shorewall_conf( $$ ) { sub process_shorewall_conf( $$ ) {
my ( $update, $annotate ) = @_; my ( $update, $annotate ) = @_;
my $file = find_file "$product.conf"; my $file = find_file "$product.conf";
my @vars;
if ( -f $file ) { if ( -f $file ) {
$globals{CONFIGDIR} = $configfile = $file; $globals{CONFIGDIR} = $configfile = $file;
@@ -5433,7 +5505,7 @@ sub process_shorewall_conf( $$ ) {
# Don't expand shell variables or allow embedded scripting # Don't expand shell variables or allow embedded scripting
# #
while ( read_a_line( STRIP_COMMENTS | SUPPRESS_WHITESPACE | CHECK_GUNK ) ) { while ( read_a_line( STRIP_COMMENTS | SUPPRESS_WHITESPACE | CHECK_GUNK ) ) {
if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*?)\s*$/ ) { if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*)$/ ) {
my ($var, $val) = ($1, $2); my ($var, $val) = ($1, $2);
if ( exists $config{$var} ) { if ( exists $config{$var} ) {
@@ -5452,6 +5524,12 @@ sub process_shorewall_conf( $$ ) {
next; next;
} }
if ( $update ) {
push @vars, $var;
} else {
expand_variables( $val ) unless $val =~ /^'.*'$/;
}
$config{$var} = ( $val =~ /\"([^\"]*)\"$/ ? $1 : $val ); $config{$var} = ( $val =~ /\"([^\"]*)\"$/ ? $1 : $val );
warning_message "Option $var=$val is deprecated" warning_message "Option $var=$val is deprecated"
@@ -5472,14 +5550,19 @@ sub process_shorewall_conf( $$ ) {
# #
# Now update the config file if asked # Now update the config file if asked
# #
update_config_file( $annotate ) if $update; if ( $update ) {
# update_config_file( $annotate );
# Config file update requires that the option values not have #
# Shell variables expanded. We do that now. # Config file update requires that the option values not have
# # Shell variables expanded. We do that now.
for ( values %config ) { #
if ( supplied $_ ) { # To handle options like LOG_LEVEL, we process the options
expand_variables( $_ ) unless /^'(.+)'$/; # in the order in which they appear in the .conf file.
#
for ( @vars ) {
if ( supplied( my $val = $config{$_} ) ) {
expand_variables( $config{$_} ) unless $val =~ /^'.*'$/;
}
} }
} }
} }

View File

@@ -389,6 +389,8 @@ sub resolve_proto( $ ) {
my $proto = $_[0]; my $proto = $_[0];
my $number; my $number;
$proto =~ s/:.*//;
if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) { if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) {
$number = numeric_value ( $proto ); $number = numeric_value ( $proto );
defined $number && $number <= 255 ? $number : undef; defined $number && $number <= 255 ? $number : undef;

View File

@@ -127,7 +127,7 @@ sub setup_ecn()
} }
if ( @hosts ) { if ( @hosts ) {
my @interfaces = ( sort { interface_number($a) <=> interface_number($b) } keys %interfaces ); my @interfaces = ( keys %interfaces );
progress_message "$doing ECN control on @interfaces..."; progress_message "$doing ECN control on @interfaces...";
@@ -1213,55 +1213,53 @@ sub add_common_rules ( $ ) {
} }
} }
if ( $family == F_IPV4 ) { my $announced = 0;
my $announced = 0;
$list = find_interfaces_by_option 'upnp'; $list = find_interfaces_by_option 'upnp';
if ( @$list ) { if ( @$list ) {
progress_message2 "$doing UPnP"; progress_message2 "$doing UPnP";
$chainref = set_optflags( new_nat_chain( 'UPnP' ), DONT_OPTIMIZE ); $chainref = set_optflags( new_nat_chain( 'UPnP' ), DONT_OPTIMIZE );
add_commands( $chainref, '[ -s /${VARDIR}/.UPnP ] && cat ${VARDIR}/.UPnP >&3' ); add_commands( $chainref, '[ -s /${VARDIR}/.UPnP ] && cat ${VARDIR}/.UPnP >&3' );
my $chainref1; my $chainref1;
if ( $config{MINIUPNPD} ) { if ( $config{MINIUPNPD} ) {
$chainref1 = set_optflags( new_nat_chain( 'MINIUPNPD-POSTROUTING' ), DONT_OPTIMIZE ); $chainref1 = set_optflags( new_nat_chain( 'MINIUPNPD-POSTROUTING' ), DONT_OPTIMIZE );
add_commands( $chainref, '[ -s /${VARDIR}/.MINIUPNPD-POSTROUTING ] && cat ${VARDIR}/.MINIUPNPD-POSTROUTING >&3' ); add_commands( $chainref, '[ -s /${VARDIR}/.MINIUPNPD-POSTROUTING ] && cat ${VARDIR}/.MINIUPNPD-POSTROUTING >&3' );
}
$announced = 1;
for $interface ( @$list ) {
add_ijump_extended $nat_table->{PREROUTING} , j => 'UPnP', get_interface_origin($interface), imatch_source_dev ( $interface );
add_ijump_extended $nat_table->{$globals{POSTROUTING}} , j => 'MINIUPNPD-POSTROUTING' , $origin{MINIUPNPD} , imatch_dest_dev ( $interface ) if $chainref1;
}
} }
$list = find_interfaces_by_option 'upnpclient'; $announced = 1;
if ( @$list ) { for $interface ( @$list ) {
progress_message2 "$doing UPnP" unless $announced; add_ijump_extended $nat_table->{PREROUTING} , j => 'UPnP', get_interface_origin($interface), imatch_source_dev ( $interface );
add_ijump_extended $nat_table->{$globals{POSTROUTING}} , j => 'MINIUPNPD-POSTROUTING' , $origin{MINIUPNPD} , imatch_dest_dev ( $interface ) if $chainref1;
}
}
for $interface ( @$list ) { $list = find_interfaces_by_option 'upnpclient';
my $chainref = $filter_table->{input_option_chain $interface};
my $base = uc var_base get_physical $interface;
my $optional = interface_is_optional( $interface );
my $variable = get_interface_gateway( $interface, ! $optional );
my $origin = get_interface_origin( $interface );
if ( $optional ) { if ( @$list ) {
add_commands( $chainref, progress_message2 "$doing UPnP" unless $announced;
qq(if [ -n "SW_\$${base}_IS_USABLE" -a -n "$variable" ]; then) );
incr_cmd_level( $chainref ); for $interface ( @$list ) {
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' ); my $chainref = $filter_table->{input_option_chain $interface};
decr_cmd_level( $chainref ); my $base = uc var_base get_physical $interface;
add_commands( $chainref, 'fi' ); my $optional = interface_is_optional( $interface );
} else { my $variable = get_interface_gateway( $interface, ! $optional );
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' ); my $origin = get_interface_origin( $interface );
}
if ( $optional ) {
add_commands( $chainref,
qq(if [ -n "SW_\$${base}_IS_USABLE" -a -n "$variable" ]; then) );
incr_cmd_level( $chainref );
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
decr_cmd_level( $chainref );
add_commands( $chainref, 'fi' );
} else {
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
} }
} }
} }
@@ -1297,7 +1295,7 @@ sub setup_mac_lists( $ ) {
$maclist_interfaces{ $hostref->[0] } = 1; $maclist_interfaces{ $hostref->[0] } = 1;
} }
my @maclist_interfaces = ( sort keys %maclist_interfaces ); my @maclist_interfaces = ( keys %maclist_interfaces );
if ( $phase == 1 ) { if ( $phase == 1 ) {
@@ -1618,7 +1616,7 @@ sub handle_loopback_traffic() {
# Handle conntrack rules # Handle conntrack rules
# #
if ( $notrackref->{referenced} ) { if ( $notrackref->{referenced} ) {
for my $hostref ( sort { $a->{type} cmp $b->{type} } @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) { for my $hostref ( @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
my $exclusion = source_exclusion( $hostref->{exclusions}, $notrackref); my $exclusion = source_exclusion( $hostref->{exclusions}, $notrackref);
my @ipsec_match = match_ipsec_in $z1 , $hostref; my @ipsec_match = match_ipsec_in $z1 , $hostref;
@@ -1639,8 +1637,8 @@ sub handle_loopback_traffic() {
# #
my $source_hosts_ref = defined_zone( $z1 )->{hosts}; my $source_hosts_ref = defined_zone( $z1 )->{hosts};
for my $typeref ( sort { $a->{type} cmp $b->{type} } values %{$source_hosts_ref} ) { for my $typeref ( values %{$source_hosts_ref} ) {
for my $hostref ( sort { $a->{type} cmp $b->{type} } @{$typeref->{'%vserver%'}} ) { for my $hostref ( @{$typeref->{'%vserver%'}} ) {
my $exclusion = source_exclusion( $hostref->{exclusions}, $natref); my $exclusion = source_exclusion( $hostref->{exclusions}, $natref);
for my $net ( @{$hostref->{hosts}} ) { for my $net ( @{$hostref->{hosts}} ) {
@@ -1662,7 +1660,7 @@ sub add_interface_jumps {
our %input_jump_added; our %input_jump_added;
our %output_jump_added; our %output_jump_added;
our %forward_jump_added; our %forward_jump_added;
my @interfaces = sort grep $_ ne '%vserver%', @_; my @interfaces = grep $_ ne '%vserver%', @_;
my $dummy; my $dummy;
my $lo_jump_added = interface_zone( loopback_interface ) && ! get_interface_option( loopback_interface, 'destonly' ); my $lo_jump_added = interface_zone( loopback_interface ) && ! get_interface_option( loopback_interface, 'destonly' );
# #
@@ -1776,7 +1774,7 @@ sub handle_complex_zone( $$ ) {
my $type = $zoneref->{type}; my $type = $zoneref->{type};
my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {}; my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {};
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$source_ref ) { for my $interface ( keys %$source_ref ) {
my $sourcechainref = $filter_table->{forward_chain $interface}; my $sourcechainref = $filter_table->{forward_chain $interface};
my @interfacematch; my @interfacematch;
my $interfaceref = find_interface $interface; my $interfaceref = find_interface $interface;
@@ -2288,9 +2286,9 @@ sub generate_matrix() {
# #
# Take care of PREROUTING, INPUT and OUTPUT jumps # Take care of PREROUTING, INPUT and OUTPUT jumps
# #
for my $type ( sort keys %$source_hosts_ref ) { for my $type ( keys %$source_hosts_ref ) {
my $typeref = $source_hosts_ref->{$type}; my $typeref = $source_hosts_ref->{$type};
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) { for my $interface ( keys %$typeref ) {
if ( get_physical( $interface ) eq '+' ) { if ( get_physical( $interface ) eq '+' ) {
# #
# Insert the interface-specific jumps before this one which is not interface-specific # Insert the interface-specific jumps before this one which is not interface-specific
@@ -2375,9 +2373,9 @@ sub generate_matrix() {
my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT
for my $type ( sort keys %{$zone1ref->{hosts}} ) { for my $type ( keys %{$zone1ref->{hosts}} ) {
my $typeref = $zone1ref->{hosts}{$type}; my $typeref = $zone1ref->{hosts}{$type};
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) { for my $interface ( keys %$typeref ) {
for my $hostref ( @{$typeref->{$interface}} ) { for my $hostref ( @{$typeref->{$interface}} ) {
next if $hostref->{options}{sourceonly}; next if $hostref->{options}{sourceonly};
if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) { if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) {

View File

@@ -1799,7 +1799,7 @@ sub map_provider_to_interface() {
my $haveoptional; my $haveoptional;
for my $providerref ( sort { $a->{number} cmp $b->{number} } values %providers ) { for my $providerref ( values %providers ) {
if ( $providerref->{optional} ) { if ( $providerref->{optional} ) {
unless ( $haveoptional++ ) { unless ( $haveoptional++ ) {
emit( 'if [ -n "$interface" ]; then', emit( 'if [ -n "$interface" ]; then',
@@ -1963,7 +1963,7 @@ sub compile_updown() {
} }
my @nonshared = ( grep $providers{$_}->{optional}, my @nonshared = ( grep $providers{$_}->{optional},
sort( { $providers{$a}->{number} <=> $providers{$b}->{number} } values %provider_interfaces ) ); values %provider_interfaces );
if ( @nonshared ) { if ( @nonshared ) {
my $interfaces = join( '|', map $providers{$_}->{physical}, @nonshared ); my $interfaces = join( '|', map $providers{$_}->{physical}, @nonshared );
@@ -2158,7 +2158,7 @@ sub handle_optional_interfaces( $ ) {
# names but they might derive from wildcard interface entries. Optional interfaces which do not have # names but they might derive from wildcard interface entries. Optional interfaces which do not have
# wildcard physical names are also included in the providers table. # wildcard physical names are also included in the providers table.
# #
for my $providerref ( grep $_->{optional} , sort { $a->{number} <=> $b->{number} } values %providers ) { for my $providerref ( grep $_->{optional} , values %providers ) {
push @interfaces, $providerref->{interface}; push @interfaces, $providerref->{interface};
$wildcards ||= $providerref->{wildcard}; $wildcards ||= $providerref->{wildcard};
} }

View File

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

View File

@@ -144,8 +144,6 @@ our %macros;
our $family; our $family;
our @builtins;
# #
# Commands that can be embedded in a basic rule and how many total tokens on the line (0 => unlimited). # Commands that can be embedded in a basic rule and how many total tokens on the line (0 => unlimited).
# #
@@ -352,7 +350,7 @@ sub initialize( $ ) {
# #
$macro_nest_level = 0; $macro_nest_level = 0;
# #
# All builtin actions plus those mentioned in /etc/shorewall[6]/actions and /usr/share/shorewall[6]/actions.std # All actions mentioned in /etc/shorewall[6]/actions and /usr/share/shorewall[6]/actions.std
# #
%actions = (); %actions = ();
# #
@@ -363,7 +361,6 @@ sub initialize( $ ) {
@columns = ( ( '-' ) x LAST_COLUMN, 0 ); @columns = ( ( '-' ) x LAST_COLUMN, 0 );
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
@builtins = qw/dropBcast dropMcast allowBcast allowMcast dropNotSyn rejNotSyn allowinUPnP forwardUPnP Limit/;
%reject_options = ( 'icmp-net-unreachable' => 1, %reject_options = ( 'icmp-net-unreachable' => 1,
'icmp-host-unreachable' => 1, 'icmp-host-unreachable' => 1,
'icmp-port-unreachable' => 1, 'icmp-port-unreachable' => 1,
@@ -372,10 +369,10 @@ sub initialize( $ ) {
'icmp-host-prohibited' => 1, 'icmp-host-prohibited' => 1,
'icmp-admin-prohibited' => 1, 'icmp-admin-prohibited' => 1,
'icmp-tcp-reset' => 2, 'icmp-tcp-reset' => 2,
'tcp-reset' => 2,
); );
} else { } else {
@builtins = qw/dropBcast dropMcast allowBcast allowMcast dropNotSyn rejNotSyn/;
%reject_options = ( 'icmp6-no-route' => 1, %reject_options = ( 'icmp6-no-route' => 1,
'no-route' => 1, 'no-route' => 1,
'icmp6-adm-prohibited' => 1, 'icmp6-adm-prohibited' => 1,
@@ -750,22 +747,21 @@ sub process_a_policy1($$$$$$$) {
if ( $serverwild ) { if ( $serverwild ) {
for my $zone ( @zonelist ) { for my $zone ( @zonelist ) {
for my $zone1 ( @zonelist ) { for my $zone1 ( @zonelist ) {
set_policy_chain rules_chain( ${zone}, ${zone1} ), $client, $server, $chainref, $policy, $intrazone; set_policy_chain rules_chain( ${zone}, ${zone1} ), $zone, $zone1, $chainref, $policy, $intrazone;
print_policy $zone, $zone1, $originalpolicy, $chain; print_policy $zone, $zone1, $originalpolicy, $chain;
} }
} }
} else { } else {
for my $zone ( all_zones ) { for my $zone ( all_zones ) {
set_policy_chain rules_chain( ${zone}, ${server} ), $client, $server, $chainref, $policy, $intrazone; set_policy_chain rules_chain( ${zone}, ${server} ), $zone, $server, $chainref, $policy, $intrazone;
print_policy $zone, $server, $originalpolicy, $chain; print_policy $zone, $server, $originalpolicy, $chain;
} }
} }
} elsif ( $serverwild ) { } elsif ( $serverwild ) {
for my $zone ( @zonelist ) { for my $zone ( @zonelist ) {
set_policy_chain rules_chain( ${client}, ${zone} ), $client, $server, $chainref, $policy, $intrazone; set_policy_chain rules_chain( ${client}, ${zone} ), $client, $zone, $chainref, $policy, $intrazone;
print_policy $client, $zone, $originalpolicy, $chain; print_policy $client, $zone, $originalpolicy, $chain;
} }
} else { } else {
print_policy $client, $server, $originalpolicy, $chain; print_policy $client, $server, $originalpolicy, $chain;
} }
@@ -947,13 +943,14 @@ sub add_policy_rules( $$$$$ ) {
# #
# Default action is an inline # Default action is an inline
# #
( undef, my $level ) = split /:/, $paction, 2;
( $action, my $param ) = get_target_param( $action ); ( $action, my $param ) = get_target_param( $action );
process_inline( $action, #Inline process_inline( $action, #Inline
$chainref, #Chain $chainref, #Chain
'', #Matches '', #Matches
'', #Matches1 '', #Matches1
$loglevel, #Log Level and Tag $level || '', #Log Level and Tag
$paction, #Target $paction, #Target
$param || '', #Param $param || '', #Param
'-', #Source '-', #Source
@@ -1708,191 +1705,6 @@ sub map_old_actions( $ ) {
} }
} }
#
# The following small functions generate rules for the builtin actions of the same name
#
sub dropBcast( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit ( 'DROP', $audit );
if ( have_capability( 'ADDRTYPE' ) ) {
if ( $level ne '' ) {
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', addrtype => '--dst-type BROADCAST' );
if ( $family == F_IPV4 ) {
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '224.0.0.0/4' );
} else {
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => IPv6_MULTICAST );
}
}
add_ijump $chainref, j => $target, addrtype => '--dst-type BROADCAST';
} else {
if ( $family == F_IPV4 ) {
add_commands $chainref, 'for address in $ALL_BCASTS; do';
} else {
add_commands $chainref, 'for address in $ALL_ACASTS; do';
}
incr_cmd_level $chainref;
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '$address' ) if $level ne '';
add_ijump $chainref, j => $target, d => '$address';
decr_cmd_level $chainref;
add_commands $chainref, 'done';
}
}
sub dropMcast( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit ( 'DROP', $audit );
if ( $family == F_IPV4 ) {
log_irule_limit $level, $chainref, 'dropMcast' , 'DROP', [], $tag, 'add', '', d => '224.0.0.0/4' if $level ne '';
add_ijump $chainref, j => $target, d => '224.0.0.0/4';
} else {
log_irule_limit( $level, $chainref, 'dropMcast' , 'DROP', [], $tag, 'add', '', d => IPv6_MULTICAST ) if $level ne '';
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
}
}
sub allowBcast( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit( 'ACCEPT', $audit );
if ( $family == F_IPV4 && have_capability( 'ADDRTYPE' ) ) {
if ( $level ne '' ) {
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', addrtype => '--dst-type BROADCAST' );
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', d => '224.0.0.0/4' );
}
add_ijump $chainref, j => $target, addrtype => '--dst-type BROADCAST';
} else {
if ( $family == F_IPV4 ) {
add_commands $chainref, 'for address in $ALL_BCASTS; do';
} else {
add_commands $chainref, 'for address in $ALL_MACASTS; do';
}
incr_cmd_level $chainref;
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', d => '$address' ) if $level ne '';
add_ijump $chainref, j => $target, d => '$address';
decr_cmd_level $chainref;
add_commands $chainref, 'done';
}
}
sub allowMcast( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit( 'ACCEPT', $audit );
if ( $family == F_IPV4 ) {
log_irule_limit( $level, $chainref, 'allowMcast' , 'ACCEPT', [], $tag, 'add', '', d => '224.0.0.0/4' ) if $level ne '';
add_ijump $chainref, j => $target, d => '224.0.0.0/4';
} else {
log_irule_limit( $level, $chainref, 'allowMcast' , 'ACCEPT', '', $tag, 'add', '', d => IPv6_MULTICAST ) if $level ne '';
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
}
}
sub dropNotSyn ( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit( 'DROP', $audit );
log_irule_limit( $level, $chainref, 'dropNotSyn' , 'DROP', [], $tag, 'add', '', p => '6 ! --syn' ) if $level ne '';
add_ijump $chainref , j => $target, p => '6 ! --syn';
}
sub rejNotSyn ( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
warning_message "rejNotSyn is deprecated in favor of NotSyn(REJECT)";
my $target = 'REJECT --reject-with tcp-reset';
if ( supplied $audit ) {
$target = require_audit( 'REJECT' , $audit );
}
log_irule_limit( $level, $chainref, 'rejNotSyn' , 'REJECT', [], $tag, 'add', '', p => '6 ! --syn' ) if $level ne '';
add_ijump $chainref , j => $target, p => '6 ! --syn';
}
sub forwardUPnP ( $$$$ ) {
my $chainref = set_optflags( 'forwardUPnP', DONT_OPTIMIZE );
add_commands( $chainref , '[ -f ${VARDIR}/.forwardUPnP ] && cat ${VARDIR}/.forwardUPnP >&3' );
}
sub allowinUPnP ( $$$$ ) {
my ($chainref, $level, $tag, $audit) = @_;
my $target = require_audit( 'ACCEPT', $audit );
if ( $level ne '' ) {
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', '', p => '17 --dport 1900' );
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', '', p => '6 --dport 49152' );
}
add_ijump $chainref, j => $target, p => '17 --dport 1900';
add_ijump $chainref, j => $target, p => '6 --dport 49152';
}
sub Limit( $$$$ ) {
my ($chainref, $level, $tag, $param ) = @_;
my @param;
if ( $param ) {
@param = split /,/, $param;
} else {
@param = split /,/, $tag;
$tag = '';
}
fatal_error 'Limit rules must include <set name>,<max connections>,<interval> as the log tag or as parameters' unless @param == 3;
my $set = $param[0];
for ( @param[1,2] ) {
fatal_error 'Max connections and interval in Limit rules must be numeric (' . join( ':', 'Limit', $level eq '' ? 'none' : $level, $tag ) . ')' unless /^\d+$/
}
my $count = $param[1] + 1;
require_capability( 'RECENT_MATCH' , 'Limit rules' , '' );
warning_message "The Limit action is deprecated in favor of per-IP rate limiting using the RATE LIMIT column";
add_irule $chainref, recent => "--name $set --set";
if ( $level ne '' ) {
my $xchainref = new_chain 'filter' , "$chainref->{name}%";
log_irule_limit( $level, $xchainref, $param[0], 'DROP', [], $tag, 'add' , '' );
add_ijump $xchainref, j => 'DROP';
add_ijump $chainref, j => $xchainref, recent => "--name $set --update --seconds $param[2] --hitcount $count";
} else {
add_ijump $chainref, j => 'DROP', recent => "--update --name $set --seconds $param[2] --hitcount $count";
}
add_ijump $chainref, j => 'ACCEPT';
}
my %builtinops = ( 'dropBcast' => \&dropBcast,
'dropMcast' => \&dropMcast,
'allowBcast' => \&allowBcast,
'allowMcast' => \&allowMcast,
'dropNotSyn' => \&dropNotSyn,
'rejNotSyn' => \&rejNotSyn,
'allowinUPnP' => \&allowinUPnP,
'forwardUPnP' => \&forwardUPnP,
'Limit' => \&Limit,
);
sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ); sub process_rule ( $$$$$$$$$$$$$$$$$$$$ );
sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ); sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ );
sub process_snat1( $$$$$$$$$$$$ ); sub process_snat1( $$$$$$$$$$$$ );
@@ -1914,12 +1726,6 @@ sub process_action(\$\$$) {
my $actionref = $actions{$action}; my $actionref = $actions{$action};
my $matches = fetch_inline_matches; my $matches = fetch_inline_matches;
if ( $type & BUILTIN ) {
$level = '' if $level =~ /none!?/;
$builtinops{$action}->( $chainref, $level, $tag, $param );
return 0;
}
if ( $type & MANGLE_TABLE ) { if ( $type & MANGLE_TABLE ) {
fatal_error "Action $action may only be used in the mangle file" unless $chainref->{table} eq 'mangle'; fatal_error "Action $action may only be used in the mangle file" unless $chainref->{table} eq 'mangle';
} else { } else {
@@ -1930,12 +1736,12 @@ sub process_action(\$\$$) {
progress_message2 "$doing $actionfile for chain $chainref->{name}..."; progress_message2 "$doing $actionfile for chain $chainref->{name}...";
push_open $actionfile, 2, 1, undef, 2;
my $oldparms = push_action_params( $action, $chainref, $param, $level, $tag, $caller ); my $oldparms = push_action_params( $action, $chainref, $param, $level, $tag, $caller );
my $options = $actionref->{options}; my $options = $actionref->{options};
my $nolog = $options & ( NOLOG_OPT | LOGJUMP_OPT ); my $nolog = $options & ( NOLOG_OPT | LOGJUMP_OPT );
push_open $actionfile, 2, 1, undef, 2;
setup_audit_action( $action ) if $options & AUDIT_OPT; setup_audit_action( $action ) if $options & AUDIT_OPT;
$active{$action}++; $active{$action}++;
@@ -2192,7 +1998,6 @@ sub process_action(\$\$$) {
# #
# This function is called prior to processing of the policy file. It: # This function is called prior to processing of the policy file. It:
# #
# - Adds the builtin actions to the target table
# - Reads actions.std and actions (in that order) and for each entry: # - Reads actions.std and actions (in that order) and for each entry:
# o Adds the action to the target table # o Adds the action to the target table
# o Verifies that the corresponding action file exists # o Verifies that the corresponding action file exists
@@ -2201,10 +2006,6 @@ sub process_action(\$\$$) {
sub process_actions() { sub process_actions() {
progress_message2 "Locating Action Files..."; progress_message2 "Locating Action Files...";
#
# Add built-in actions to the target table and create those actions
#
$targets{$_} = new_action( $_ , ACTION + BUILTIN, NOINLINE_OPT, '' , '' ) for @builtins;
for my $file ( qw/actions.std actions/ ) { for my $file ( qw/actions.std actions/ ) {
open_file( $file, 2 ); open_file( $file, 2 );
@@ -2917,6 +2718,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
# tcp-reset # tcp-reset
# #
fatal_error "tcp-reset may only be used with PROTO tcp" unless ( resolve_proto( $proto ) || 0 ) == TCP; fatal_error "tcp-reset may only be used with PROTO tcp" unless ( resolve_proto( $proto ) || 0 ) == TCP;
$exceptionrule = '-p 6 ';
$param = 'tcp-reset';
} }
$action = "REJECT --reject-with $param"; $action = "REJECT --reject-with $param";

View File

@@ -1924,7 +1924,7 @@ sub process_traffic_shaping() {
my ( $options, $redopts ) = ( '', $tcref->{redopts} ); my ( $options, $redopts ) = ( '', $tcref->{redopts} );
for my $option ( sort keys %validredoptions ) { for my $option ( keys %validredoptions ) {
my $type = $validredoptions{$option}; my $type = $validredoptions{$option};
if ( my $value = $redopts->{$option} ) { if ( my $value = $redopts->{$option} ) {
@@ -1943,7 +1943,7 @@ sub process_traffic_shaping() {
my ( $options, $codelopts ) = ( '', $tcref->{codelopts} ); my ( $options, $codelopts ) = ( '', $tcref->{codelopts} );
for my $option ( sort keys %validcodeloptions ) { for my $option ( keys %validcodeloptions ) {
my $type = $validcodeloptions{$option}; my $type = $validcodeloptions{$option};
if ( my $value = $codelopts->{$option} ) { if ( my $value = $codelopts->{$option} ) {
@@ -2312,9 +2312,10 @@ EOF
EOF EOF
} }
return ( $mangle, $fn1 );
} }
return ( $mangle, $fn1 );
} }
# #

View File

@@ -108,24 +108,6 @@ our @EXPORT = ( qw( NOTHING
our @EXPORT_OK = qw( initialize ); our @EXPORT_OK = qw( initialize );
our $VERSION = 'MODULEVERSION'; our $VERSION = 'MODULEVERSION';
#
# IPSEC Option types
#
use constant { NOTHING => 'NOTHING',
NUMERIC => '0x[\da-fA-F]+|\d+',
NETWORK => '\d+.\d+.\d+.\d+(\/\d+)?',
IPSECPROTO => 'ah|esp|ipcomp',
IPSECMODE => 'tunnel|transport'
};
#
# Option columns
#
use constant { IN_OUT => 1,
IN => 2,
OUT => 3 };
# #
# Zone Table. # Zone Table.
# #
@@ -221,6 +203,26 @@ our $zonemarkincr;
our $zonemarklimit; our $zonemarklimit;
our $loopback_interface; our $loopback_interface;
#
# IPSEC Option types
#
use constant { NOTHING => 'NOTHING',
NUMERIC => '0x[\da-fA-F]+|\d+',
IPSECPROTO => 'ah|esp|ipcomp',
IPSECMODE => 'tunnel|transport'
};
sub NETWORK() {
$family == F_IPV4 ? '\d+.\d+.\d+.\d+(\/\d+)?' : '(?:[0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}(?:\/d+)?';
}
#
# Option columns
#
use constant { IN_OUT => 1,
IN => 2,
OUT => 3 };
use constant { FIREWALL => 1, use constant { FIREWALL => 1,
IP => 2, IP => 2,
BPORT => 4, BPORT => 4,
@@ -276,19 +278,7 @@ our %maxoptionvalue = ( routefilter => 2, mss => 100000 , wait => 120 , ignore =
our %validhostoptions; our %validhostoptions;
our %validzoneoptions = ( mss => NUMERIC, our %validzoneoptions;
nomark => NOTHING,
blacklist => NOTHING,
dynamic_shared => NOTHING,
strict => NOTHING,
next => NOTHING,
reqid => NUMERIC,
spi => NUMERIC,
proto => IPSECPROTO,
mode => IPSECMODE,
"tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK,
);
use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 }; use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 };
# #
@@ -330,6 +320,20 @@ sub initialize( $$ ) {
$minroot = 0; $minroot = 0;
$loopback_interface = ''; $loopback_interface = '';
%validzoneoptions = ( mss => NUMERIC,
nomark => NOTHING,
blacklist => NOTHING,
dynamic_shared => NOTHING,
strict => NOTHING,
next => NOTHING,
reqid => NUMERIC,
spi => NUMERIC,
proto => IPSECPROTO,
mode => IPSECMODE,
"tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK,
);
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION, %validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
arp_ignore => ENUM_IF_OPTION, arp_ignore => ENUM_IF_OPTION,
@@ -407,6 +411,8 @@ sub initialize( $$ ) {
forward => BINARY_IF_OPTION, forward => BINARY_IF_OPTION,
physical => STRING_IF_OPTION + IF_OPTION_HOST, physical => STRING_IF_OPTION + IF_OPTION_HOST,
unmanaged => SIMPLE_IF_OPTION, unmanaged => SIMPLE_IF_OPTION,
upnp => SIMPLE_IF_OPTION,
upnpclient => SIMPLE_IF_OPTION,
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK, wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
); );
%validhostoptions = ( %validhostoptions = (
@@ -713,10 +719,10 @@ sub zone_report()
my $printed = 0; my $printed = 0;
if ( $hostref ) { if ( $hostref ) {
for my $type ( sort keys %$hostref ) { for my $type ( keys %$hostref ) {
my $interfaceref = $hostref->{$type}; my $interfaceref = $hostref->{$type};
for my $interface ( sort keys %$interfaceref ) { for my $interface ( keys %$interfaceref ) {
my $iref = $interfaces{$interface}; my $iref = $interfaces{$interface};
my $arrayref = $interfaceref->{$interface}; my $arrayref = $interfaceref->{$interface};
@@ -766,10 +772,10 @@ sub dump_zone_contents() {
$entry .= ( " mark=" . in_hex( $zoneref->{mark} ) ) if exists $zoneref->{mark}; $entry .= ( " mark=" . in_hex( $zoneref->{mark} ) ) if exists $zoneref->{mark};
if ( $hostref ) { if ( $hostref ) {
for my $type ( sort keys %$hostref ) { for my $type ( keys %$hostref ) {
my $interfaceref = $hostref->{$type}; my $interfaceref = $hostref->{$type};
for my $interface ( sort keys %$interfaceref ) { for my $interface ( keys %$interfaceref ) {
my $iref = $interfaces{$interface}; my $iref = $interfaces{$interface};
my $arrayref = $interfaceref->{$interface}; my $arrayref = $interfaceref->{$interface};
@@ -1313,7 +1319,7 @@ sub process_interface( $$ ) {
assert(0); assert(0);
} }
} elsif ( $type == STRING_IF_OPTION ) { } elsif ( $type == STRING_IF_OPTION ) {
fatal_error "The '$option' option requires a value" unless defined $value; fatal_error "The '$option' option requires a value" unless supplied $value;
if ( $option eq 'physical' ) { if ( $option eq 'physical' ) {
fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/; fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/;
@@ -2219,9 +2225,9 @@ sub find_hosts_by_option( $ ) {
} }
for my $zone ( grep ! ( $zones{$_}{type} & FIREWALL ) , @zones ) { for my $zone ( grep ! ( $zones{$_}{type} & FIREWALL ) , @zones ) {
for my $type (sort keys %{$zones{$zone}{hosts}} ) { for my $type (keys %{$zones{$zone}{hosts}} ) {
my $interfaceref = $zones{$zone}{hosts}->{$type}; my $interfaceref = $zones{$zone}{hosts}->{$type};
for my $interface ( sort keys %$interfaceref ) { for my $interface ( keys %$interfaceref ) {
my $arrayref = $interfaceref->{$interface}; my $arrayref = $interfaceref->{$interface};
for my $host ( @{$arrayref} ) { for my $host ( @{$arrayref} ) {
my $ipsec = $host->{ipsec}; my $ipsec = $host->{ipsec};
@@ -2249,9 +2255,9 @@ sub find_zone_hosts_by_option( $$ ) {
my @hosts; my @hosts;
unless ( $zones{$zone}{type} & FIREWALL ) { unless ( $zones{$zone}{type} & FIREWALL ) {
for my $type (sort keys %{$zones{$zone}{hosts}} ) { for my $type (keys %{$zones{$zone}{hosts}} ) {
my $interfaceref = $zones{$zone}{hosts}->{$type}; my $interfaceref = $zones{$zone}{hosts}->{$type};
for my $interface ( sort keys %$interfaceref ) { for my $interface ( keys %$interfaceref ) {
my $arrayref = $interfaceref->{$interface}; my $arrayref = $interfaceref->{$interface};
for my $host ( @{$arrayref} ) { for my $host ( @{$arrayref} ) {
if ( my $value = $host->{options}{$option} ) { if ( my $value = $host->{options}{$option} ) {

View File

@@ -43,6 +43,8 @@
# --inline # Update alternative column specifications # --inline # Update alternative column specifications
# --update # Update configuration to current release # --update # Update configuration to current release
# #
# If the <filename> is omitted, then a 'check' operation is performed.
#
use strict; use strict;
use FindBin; use FindBin;
use lib "$FindBin::Bin"; use lib "$FindBin::Bin";

View File

@@ -32,7 +32,7 @@
# down Stop an optional interface # down Stop an optional interface
# enable Enable an optional interface # enable Enable an optional interface
# help Show command syntax # help Show command syntax
# reenable Disable then nable an optional # reenable Disable then enable an optional
# interface # interface
# refresh Refresh the firewall # refresh Refresh the firewall
# reload Reload the firewall # reload Reload the firewall

View File

@@ -33,7 +33,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -55,19 +55,19 @@ LOGTAGONLY=No
LOGLIMIT="s:1/sec:10" LOGLIMIT="s:1/sec:10"
MACLIST_LOG_LEVEL=$LOG_LEVEL MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=$LOG_LEVEL RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=$LOG_LEVEL SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=$LOG_LEVEL SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall-init.log STARTUP_LOG=/var/log/shorewall-init.log
TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -109,11 +109,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -217,6 +217,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=Yes REQUIRE_INTERFACE=Yes

View File

@@ -120,11 +120,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -228,6 +228,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No

View File

@@ -41,7 +41,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -63,19 +63,19 @@ LOGTAGONLY=No
LOGLIMIT="s:1/sec:10" LOGLIMIT="s:1/sec:10"
MACLIST_LOG_LEVEL=$LOG_LEVEL MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=$LOG_LEVEL RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=$LOG_LEVEL SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=$LOG_LEVEL SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall-init.log STARTUP_LOG=/var/log/shorewall-init.log
TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -117,11 +117,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -225,6 +225,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No

View File

@@ -44,7 +44,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -66,19 +66,19 @@ LOGTAGONLY=No
LOGLIMIT="s:1/sec:10" LOGLIMIT="s:1/sec:10"
MACLIST_LOG_LEVEL=$LOG_LEVEL MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=$LOG_LEVEL RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=$LOG_LEVEL SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=$LOG_LEVEL SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall-init.log STARTUP_LOG=/var/log/shorewall-init.log
TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -120,11 +120,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -228,6 +228,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No

View File

@@ -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,\
92.168.0.0/16 eth0 192.168.0.0/16 eth0

View File

@@ -6,44 +6,42 @@
# Please see http://shorewall.net/Actions.html for additional # Please see http://shorewall.net/Actions.html for additional
# information. # information.
# #
# Builtin Actions are:
#
?if 0
allowBcast # Silently Allow Broadcast
allowMcast # Silently Allow Multicast
dropBcast # Silently Drop Broadcast
dropMcast # Silently Drop Multicast
dropNotSyn # Silently Drop Non-syn TCP packets
rejNotSyn # Silently Reject Non-syn TCP packets
allowinUPnP # Allow UPnP inbound (to firewall) traffic
forwardUPnP # Allow traffic that upnpd has redirected from 'upnp' interfaces.
Limit # Limit the rate of connections from each individual IP address
?endif
############################################################################### ###############################################################################
#ACTION #ACTION
A_AllowICMPs inline # Audited version of AllowICMPs
A_Drop # Audited Default Action for DROP policy A_Drop # Audited Default Action for DROP policy
A_REJECT noinline,logjump # Audits then rejects a connection request A_REJECT noinline,logjump # Audits then rejects a connection request
A_REJECT! inline # Audits then rejects a connection request A_REJECT! inline # Audits then rejects a connection request
A_Reject # Audited Default action for REJECT policy A_Reject # Audited Default action for REJECT policy
AllowICMPs inline # Allow Required ICMP packets
allowBcast inline # Silently Allow Broadcast
allowinUPnP inline # Allow UPnP inbound (to firewall) traffic
allowInvalid inline # Accepts packets in the INVALID conntrack state allowInvalid inline # Accepts packets in the INVALID conntrack state
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,audit # Handles Broadcast/Anycast Broadcast noinline,audit # Handles Broadcast/Anycast
DNSAmp # Matches one-question recursive DNS queries DNSAmp # 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
dropInvalid inline # Drops packets in the INVALID conntrack state dropInvalid inline # Drops packets in the INVALID conntrack state
dropMcast inline # Silently Drop Multicast
dropNotSyn noinline # Silently Drop Non-syn TCP packets
DropDNSrep inline # Drops DNS replies DropDNSrep inline # 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 #
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
Multicast noinline,audit # Handles Multicast Multicast noinline,audit # 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,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
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 #

View File

@@ -33,7 +33,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -55,19 +55,19 @@ LOGTAGONLY=No
LOGLIMIT="s:1/sec:10" LOGLIMIT="s:1/sec:10"
MACLIST_LOG_LEVEL=$LOG_LEVEL MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=$LOG_LEVEL RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=$LOG_LEVEL SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=$LOG_LEVEL SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall-init.log STARTUP_LOG=/var/log/shorewall-init.log
TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -109,11 +109,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -217,6 +217,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No

View File

@@ -0,0 +1,26 @@
#
# Global start/restart/reload/stop options
#
OPTIONS=""
#
# Start options
#
STARTOPTIONS=""
#
# Restart options
#
RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# EOF

View File

@@ -1,5 +1,5 @@
# prevent startup with default configuration # prevent startup with default configuration
# set the following varible to 1 in order to allow Shorewall to start # set the following variable to 1 in order to allow Shorewall to start
startup=0 startup=0
@@ -16,7 +16,7 @@ startup=0
# wait_interface= # wait_interface=
# #
# Global start/restart options # Global start/restart/reload/stop options
# #
OPTIONS="" OPTIONS=""
@@ -28,12 +28,17 @@ STARTOPTIONS=""
# #
# Restart options # Restart options
# #
RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS="" RELOADOPTIONS=""
# #
# Restart options # Stop options
# #
RESTARTOPTIONS="" STOPOPTIONS=""
# #
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf # Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf

View File

@@ -22,55 +22,22 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <http://www.gnu.org/licenses/>.
# #
VERSION=4.5.5 #The Build script inserts the actual version VERSION=xxx # The Build script inserts the actual version
#
# Change to the directory containing this script
#
usage() # $1 = exit status usage() # $1 = exit status
{ {
ME=$(basename $0) ME=$(basename $0)
echo "usage: $ME [ <configuration-file> ]" echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
echo " $ME -v" echo "where <option> is one of"
echo " $ME -h" echo " -h"
echo " $ME -s" echo " -v"
echo " $ME -a" echo " -s"
echo " $ME -n" echo " -a"
echo " -p"
echo " -n"
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
run_install() run_install()
{ {
if ! install $*; then if ! install $*; then
@@ -80,27 +47,14 @@ run_install()
fi fi
} }
cant_autostart()
{
echo
echo "WARNING: Unable to configure $PRODUCT to start automatically at boot" >&2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
install_file() # $1 = source $2 = target $3 = mode install_file() # $1 = source $2 = target $3 = mode
{ {
run_install $T $OWNERSHIP -m $3 $1 ${2} run_install $T $OWNERSHIP -m $3 $1 ${2}
} }
require() #
{ # Change to the directory containing this script
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set" #
}
cd "$(dirname $0)" cd "$(dirname $0)"
if [ -f shorewall.service ]; then if [ -f shorewall.service ]; then
@@ -111,6 +65,11 @@ else
Product=Shorewall6 Product=Shorewall6
fi fi
#
# Source common functions
#
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
# #
# Parse the run line # Parse the run line
# #
@@ -172,11 +131,14 @@ done
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc file=./shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1 file=~/.shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc file=/usr/share/shorewall/shorewallrc
. $file || fatal_error "Can not load the RC file: $file"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -186,11 +148,11 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file file=./$file || exit 1
;; ;;
esac esac
. $file . $file || fatal_error "Can not load the RC file: $file"
else else
usage 1 usage 1
fi fi
@@ -305,8 +267,7 @@ case "$HOST" in
linux) linux)
;; ;;
*) *)
echo "ERROR: Unknown HOST \"$HOST\"" >&2 fatal_error "Unknown HOST \"$HOST\""
exit 1;
;; ;;
esac esac
@@ -317,8 +278,7 @@ if [ $PRODUCT = shorewall ]; then
# #
if [ "$DIGEST" != SHA ]; then if [ "$DIGEST" != SHA ]; then
if [ "$BUILD" = "$HOST" ] && ! eval perl -e \'use Digest::$DIGEST\;\' 2> /dev/null ; then if [ "$BUILD" = "$HOST" ] && ! eval perl -e \'use Digest::$DIGEST\;\' 2> /dev/null ; then
echo "ERROR: Perl compilation with Digest::$DIGEST failed" >&2 fatal_error "Perl compilation with Digest::$DIGEST failed"
exit 1;
fi fi
cp -af Perl/Shorewall/Chains.pm Perl/Shorewall/Chains.pm.bak cp -af Perl/Shorewall/Chains.pm Perl/Shorewall/Chains.pm.bak
@@ -341,8 +301,7 @@ if [ $PRODUCT = shorewall ]; then
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm
DIGEST=SHA1 DIGEST=SHA1
else else
echo "ERROR: Shorewall $VERSION requires either Digest::SHA or Digest::SHA1" >&2 fatal_error "Shorewall $VERSION requires either Digest::SHA or Digest::SHA1"
exit 1
fi fi
fi fi
fi fi
@@ -370,11 +329,10 @@ if [ $BUILD != cygwin ]; then
fi fi
fi fi
install -d $OWNERSHIP -m 755 ${DESTDIR}${SBINDIR} run_install -d $OWNERSHIP -m 0755 ${DESTDIR}${SBINDIR}
[ -n "${INITFILE}" ] && install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR} [ -n "${INITFILE}" ] && run_install -d $OWNERSHIP -m 0755 ${DESTDIR}${INITDIR}
if [ -z "$DESTDIR" -a $PRODUCT != shorewall ]; then if [ -z "$DESTDIR" -a $PRODUCT != shorewall ]; then
[ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || \ [ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || fatal_error "Shorewall >= 4.5.0 is not installed"
{ echo " ERROR: Shorewall >= 4.5.0 is not installed" >&2; exit 1; }
fi fi
echo "Installing $Product Version $VERSION" echo "Installing $Product Version $VERSION"
@@ -388,7 +346,7 @@ else
first_install="Yes" first_install="Yes"
fi fi
if [ -z "${DESTDIR}" -a $PRODUCT = shorewall -a ! -f ${SHAREDIR}/$PRODUCT/coreversion ]; then if [ -z "${DESTDIR}" -a $PRODUCT = shorewall -a ! -f ${SHAREDIR}/shorewall/coreversion ]; then
echo "Shorewall $VERSION requires Shorewall Core which does not appear to be installed" echo "Shorewall $VERSION requires Shorewall Core which does not appear to be installed"
exit 1 exit 1
fi fi
@@ -410,22 +368,16 @@ fi
# #
# Create /etc/$PRODUCT and other directories # Create /etc/$PRODUCT and other directories
# #
mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT make_parent_directory ${DESTDIR}${CONFDIR}/$PRODUCT 0755
mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT make_parent_directory ${DESTDIR}${LIBEXECDIR}/$PRODUCT 0755
mkdir -p ${DESTDIR}${PERLLIBDIR}/Shorewall make_parent_directory ${DESTDIR}${PERLLIBDIR}/Shorewall 0755
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles 0755
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated 0755
mkdir -p ${DESTDIR}${VARDIR} make_parent_directory ${DESTDIR}${VARDIR} 0755
chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT chmod 0755 ${DESTDIR}${SHAREDIR}/$PRODUCT
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/configfiles
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/deprecated
if [ -n "$DESTDIR" ]; then [ -n "$DESTDIR" ] && make_parent_directory ${DESTDIR}${CONFDIR}/logrotate.d 0755
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
fi
# #
# Install the .service file # Install the .service file
@@ -435,9 +387,9 @@ if [ -z "${SERVICEDIR}" ]; then
fi fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
mkdir -p ${DESTDIR}${SERVICEDIR} make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
[ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service [ -z "$SERVICEFILE" ] && SERVICEFILE=$PRODUCT.service
run_install $OWNERSHIP -m 644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service run_install $OWNERSHIP -m 0644 $SERVICEFILE ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service [ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SERVICEDIR}/$PRODUCT.service
echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service" echo "Service file $SERVICEFILE installed as ${DESTDIR}${SERVICEDIR}/$PRODUCT.service"
fi fi
@@ -490,6 +442,14 @@ if [ -z "$first_install" ]; then
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_REJECT delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_REJECT
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Drop delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Drop
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Reject delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.Reject
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_Drop
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_Reject
delete_file ${DESTDIR}${SHAREDIR}/shorewall/action.A_AllowICMPs
else
delete_file ${DESTDIR}${SHAREDIR}/shorewall6/action.A_AllowICMPs
delete_file ${DESTDIR}${SHAREDIR}/shorewall6/action.AllowICMPs
delete_file ${DESTDIR}${SHAREDIR}/shorewall6/action.Broadcast
delete_file ${DESTDIR}${SHAREDIR}/shorewall6/action.Multicast
fi fi
fi fi
@@ -1094,8 +1054,14 @@ cd ..
# #
for f in lib.* Perl/lib.*; do for f in lib.* Perl/lib.*; do
if [ -f $f ]; then if [ -f $f ]; then
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$(basename $f) 0644 case $f in
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f" *installer)
;;
*)
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$(basename $f) 0644
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
;;
esac
fi fi
done done
@@ -1105,7 +1071,7 @@ if [ $PRODUCT = shorewall6 ]; then
# #
ln -sf lib.base ${DESTDIR}${SHAREDIR}/$PRODUCT/functions ln -sf lib.base ${DESTDIR}${SHAREDIR}/$PRODUCT/functions
# #
# And create a sybolic link for the CLI # And create a symbolic link for the CLI
# #
ln -sf shorewall ${DESTDIR}${SBINDIR}/shorewall6 ln -sf shorewall ${DESTDIR}${SBINDIR}/shorewall6
fi fi
@@ -1114,8 +1080,7 @@ if [ -d Perl ]; then
# #
# ${SHAREDIR}/$PRODUCT/$Product if needed # ${SHAREDIR}/$PRODUCT/$Product if needed
# #
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product make_parent_directory ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product 0755
chmod 755 ${DESTDIR}${SHAREDIR}/$PRODUCT/$Product
# #
# Install the Compiler # Install the Compiler
# #
@@ -1164,7 +1129,7 @@ fi
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version
chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version chmod 0644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
@@ -1182,7 +1147,7 @@ if [ -n "$MANDIR" ]; then
cd manpages cd manpages
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man5/ [ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man5 0755
for f in *.5; do for f in *.5; do
gzip -9c $f > $f.gz gzip -9c $f > $f.gz
@@ -1190,7 +1155,7 @@ for f in *.5; do
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz" echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz"
done done
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man8/ [ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man8 0755
for f in *.8; do for f in *.8; do
gzip -9c $f > $f.gz gzip -9c $f > $f.gz
@@ -1213,8 +1178,7 @@ fi
# #
if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then if [ -n "$SYSCONFFILE" -a -f "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
if [ ${DESTDIR} ]; then if [ ${DESTDIR} ]; then
mkdir -p ${DESTDIR}${SYSCONFDIR} make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
chmod 755 ${DESTDIR}${SYSCONFDIR}
fi fi
run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT run_install $OWNERSHIP -m 0644 ${SYSCONFFILE} ${DESTDIR}${SYSCONFDIR}/$PRODUCT
@@ -1272,6 +1236,6 @@ if [ $configure -eq 1 -a -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${
fi fi
# #
# Report Success # Report Success
# #
echo "$Product Version $VERSION Installed" echo "$Product Version $VERSION Installed"

View File

@@ -341,6 +341,18 @@ get_config() {
setup_dbl setup_dbl
fi fi
if [ -z "$PERL_HASH_SEED" ]; then
PERL_HASH_SEED=0
else
case $PERL_HASH_SEED in
[0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]|random)
;;
*)
fatal_error "Invalid setting ($PERL_HASH_SEED) for PERL_HASH_SEED"
;;
esac
fi
lib=$(find_file lib.cli-user) lib=$(find_file lib.cli-user)
[ -f $lib ] && . $lib [ -f $lib ] && . $lib
@@ -484,6 +496,18 @@ compiler() {
# #
[ "$g_debugging" != trace -a -z "$g_preview" ] || [ -n "$g_debug" ] && g_pager= [ "$g_debugging" != trace -a -z "$g_preview" ] || [ -n "$g_debug" ] && g_pager=
case $PERL_HASH_SEED in
random)
unset PERL_HASH_SEED
unset PERL_PERTURB_KEYS
;;
*)
export PERL_HASH_SEED
PERL_PERTURB_KEYS=0
export PERL_PERTURB_KEYS
;;
esac
if [ ${PERLLIBDIR} = ${LIBEXECDIR}/shorewall ]; then if [ ${PERLLIBDIR} = ${LIBEXECDIR}/shorewall ]; then
eval $PERL $debugflags $pc $options $@ $g_pager eval $PERL $debugflags $pc $options $@ $g_pager
else else
@@ -510,28 +534,6 @@ start_command() {
local rc local rc
rc=0 rc=0
do_it() {
if [ -n "$AUTOMAKE" ]; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/firewall $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
g_file="${VARDIR}/.start"
if compiler $g_debugging $nolock compile "$g_file"; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.start $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
rc=$?
mylogger kern.err "ERROR:$g_product start failed"
fi
fi
exit $rc
}
if product_is_started; then if product_is_started; then
error_message "Shorewall is already running" error_message "Shorewall is already running"
exit 0 exit 0
@@ -623,7 +625,25 @@ start_command() {
fi fi
fi fi
do_it if [ -n "$AUTOMAKE" ]; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/firewall $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
g_file="${VARDIR}/.start"
if compiler $g_debugging $nolock compile "$g_file"; then
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.start $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
rc=$?
mylogger kern.err "ERROR:$g_product start failed"
fi
fi
exit $rc
} }
# #

View File

@@ -864,7 +864,7 @@ Normal-Service =&gt; 0x00</programlisting>
on the firewall and whose source IP address matches one of the on the firewall and whose source IP address matches one of the
listed addresses and does not match any address listed in the listed addresses and does not match any address listed in the
<replaceable>exclusion</replaceable>. May not be used with a <replaceable>exclusion</replaceable>. May not be used with a
chain qualifier (:P, :F, etc.) in the ACTION column. </para> chain qualifier (:P, :F, etc.) in the ACTION column.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1028,15 +1028,16 @@ Normal-Service =&gt; 0x00</programlisting>
<varlistentry> <varlistentry>
<term><emphasis role="bold">PROTO</emphasis> - {<emphasis <term><emphasis role="bold">PROTO</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis role="bold">-</emphasis>|<emphasis
role="bold">{tcp:syn</emphasis>|<emphasis role="bold">{tcp:[!]syn</emphasis>|<emphasis
role="bold">ipp2p</emphasis>|<emphasis role="bold">ipp2p</emphasis>|<emphasis
role="bold">ipp2p:udp</emphasis>|<emphasis role="bold">ipp2p:udp</emphasis>|<emphasis
role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis
role="bold">all}[,...]}</emphasis></term> role="bold">all}[,...]}</emphasis></term>
<listitem> <listitem>
<para>Protocol - <emphasis role="bold">ipp2p</emphasis> requires <para>See <ulink
ipp2p match support in your kernel and iptables.</para> url="shorewall-rules.html">shorewall-rules(5)</ulink> for
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>

View File

@@ -66,7 +66,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 and QUEUE</para> REJECT, LOG, 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>
@@ -81,7 +81,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 and QUEUE</para> REJECT, LOG, 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
@@ -97,7 +97,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 and QUEUE.</para> REJECT, LOG, 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
@@ -113,7 +113,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 and QUEUE.</para> REJECT, LOG, 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
@@ -138,9 +138,8 @@
comfortable with the differences between the various connection tracking comfortable with the differences between the various connection tracking
states, then it is suggested that you omit the <emphasis states, then it is suggested that you omit the <emphasis
role="bold">ESTABLISHED</emphasis> and <emphasis role="bold">ESTABLISHED</emphasis> and <emphasis
role="bold">RELATED</emphasis> sections and place all of your role="bold">RELATED</emphasis> sections and place all of your rules in
non-blacklisting rules in the NEW section (That's after the line that the NEW section (That's after the line that reads ?SECTION NEW').</para>
reads ?SECTION NEW').</para>
</note> </note>
<warning> <warning>
@@ -595,7 +594,7 @@
<para>Added in Shorewall 4.5.9.3. Queues matching packets to a <para>Added in Shorewall 4.5.9.3. Queues matching packets to a
back end logging daemon via a netlink socket then continues to back end logging daemon via a netlink socket then continues to
the next rule. See <ulink the next rule. See <ulink
url="/shorewall.logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para> url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
<para>The <replaceable>nflog-parameters</replaceable> are a <para>The <replaceable>nflog-parameters</replaceable> are a
comma-separated list of up to 3 numbers:</para> comma-separated list of up to 3 numbers:</para>
@@ -730,7 +729,9 @@
<member><option>icmp-admin-prohibited</option></member> <member><option>icmp-admin-prohibited</option></member>
<member><option>icmp-tcp-reset</option> (the PROTO column <member><option>icmp-tcp-reset</option> (the PROTO column
must specify TCP)</member> must specify TCP). Beginning with Shorewall 5.1.3, this
option may also be specified as
<option>tcp-reset</option>.</member>
</simplelist> </simplelist>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -846,7 +847,7 @@
<para>Added in Shorewall 4.5.10. Queues matching packets to a <para>Added in Shorewall 4.5.10. Queues matching packets to a
back end logging daemon via a netlink socket then continues to back end logging daemon via a netlink socket then continues to
the next rule. See <ulink the next rule. See <ulink
url="/shorewall.logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para> url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</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>)],
@@ -1593,7 +1594,7 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">PROTO</emphasis>- {<emphasis <term><emphasis role="bold">PROTO</emphasis>- {<emphasis
role="bold">-</emphasis>|<emphasis role="bold">-</emphasis>|<emphasis
role="bold">tcp:syn</emphasis>|<emphasis role="bold">tcp:[!]syn</emphasis>|<emphasis
role="bold">ipp2p</emphasis>|<emphasis role="bold">ipp2p</emphasis>|<emphasis
role="bold">ipp2p:udp</emphasis>|<emphasis role="bold">ipp2p:udp</emphasis>|<emphasis
role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis
@@ -1604,7 +1605,10 @@
requires ipp2p match support in your kernel and iptables. <emphasis requires ipp2p match support in your kernel and iptables. <emphasis
role="bold">tcp:syn</emphasis> implies <emphasis role="bold">tcp:syn</emphasis> implies <emphasis
role="bold">tcp</emphasis> plus the SYN flag must be set and the role="bold">tcp</emphasis> plus the SYN flag must be set and the
RST,ACK and FIN flags must be reset.</para> RST, ACK and FIN flags must be reset. Beginning with Shorewall
5.1.3, you may also specify <emphasis
role="bold">tcp:!syn</emphasis>, which matches if SYN is not set or
if RST, ACK or FIN is set.</para>
<para>Beginning with Shorewall 4.4.19, this column can contain a <para>Beginning with Shorewall 4.4.19, this column can contain a
comma-separated list of protocol-numbers and/or protocol comma-separated list of protocol-numbers and/or protocol

View File

@@ -229,8 +229,9 @@
role="bold">all}[,...]</emphasis></term> role="bold">all}[,...]</emphasis></term>
<listitem> <listitem>
<para>Protocol - <emphasis role="bold">ipp2p</emphasis> requires <para> See <ulink
ipp2p match support in your kernel and iptables.</para> url="shorewall-rules.html">shorewall-rules(5)</ulink> for
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>

View File

@@ -256,8 +256,9 @@
<listitem> <listitem>
<para>If you wish to restrict this entry to a particular protocol <para>If you wish to restrict this entry to a particular protocol
then enter the protocol name (from protocols(5)) or number then enter the protocol name (from protocols(5)) or number here. See
here.</para> <ulink url="shorewall-rules.html">shorewall-rules(5)</ulink> for
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>

View File

@@ -2153,6 +2153,21 @@ LOG:info:,bar net fw</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">PERL_HASH_SEED=</emphasis><emphasis
role="bold"><replaceable>seed</replaceable><emphasis
role="bold">|random</emphasis></emphasis></term>
<listitem>
<para>Added in Shorewall 5.1.4. Sets the Perl hash
<replaceable>seed</replaceable> (an integer in the range 0-99999)
when running the Shorewall rules compiler. If not specified, the
value 0 is assumed. If <option>random</option> is specified, a
random seed will be chosed by Perl. See perlsec(1) for additional
information.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">PROVIDER_BITS</emphasis>=[<replaceable>number</replaceable>]</term> role="bold">PROVIDER_BITS</emphasis>=[<replaceable>number</replaceable>]</term>

View File

@@ -16,7 +16,7 @@ RemainAfterExit=yes
EnvironmentFile=-/etc/default/shorewall EnvironmentFile=-/etc/default/shorewall
StandardOutput=syslog StandardOutput=syslog
ExecStart=/sbin/shorewall $OPTIONS start $STARTOPTIONS ExecStart=/sbin/shorewall $OPTIONS start $STARTOPTIONS
ExecStop=/sbin/shorewall $OPTIONS stop ExecStop=/sbin/shorewall $OPTIONS clear
ExecReload=/sbin/shorewall $OPTIONS reload $RELOADOPTIONS ExecReload=/sbin/shorewall $OPTIONS reload $RELOADOPTIONS
[Install] [Install]

View File

@@ -26,9 +26,7 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version VERSION=xxx # The Build script inserts the actual version
PRODUCT=shorewall
Product=Shorewall
usage() # $1 = exit status usage() # $1 = exit status
{ {
@@ -41,51 +39,27 @@ usage() # $1 = exit status
exit $1 exit $1
} }
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
# #
# Change to the directory containing this script # Change to the directory containing this script
# #
cd "$(dirname $0)" cd "$(dirname $0)"
if [ -f shorewall.service ]; then
PRODUCT=shorewall
Product=Shorewall
else
PRODUCT=shorewall6
Product=Shorewall6
fi
#
# Source common functions
#
. ./lib.uninstaller || { echo "ERROR: Can not load common functions." >&2; exit 1; }
#
# Parse the run line
#
finished=0 finished=0
configure=1 configure=1
@@ -102,7 +76,7 @@ while [ $finished -eq 0 ]; do
usage 0 usage 0
;; ;;
v) v)
echo "$Product Firewall Installer Version $VERSION" echo "$Product Firewall Uninstaller Version $VERSION"
exit 0 exit 0
;; ;;
n*) n*)
@@ -123,13 +97,16 @@ while [ $finished -eq 0 ]; do
esac esac
done done
#
# Read the RC file
#
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then if [ -f ./shorewallrc ]; then
. ./shorewallrc . ./shorewallrc || fatal_error "Can not load the RC file: ./shorewallrc"
elif [ -f ~/.shorewallrc ]; then elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1 . ~/.shorewallrc || fatal_error "Can not load the RC file: ~/.shorewallrc"
elif [ -f /usr/share/shorewall/shorewallrc ]; then elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc || fatal_error "Can not load the RC file: /usr/share/shorewall/shorewallrc"
else else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found" fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi fi
@@ -139,52 +116,53 @@ elif [ $# -eq 1 ]; then
/*|.*) /*|.*)
;; ;;
*) *)
file=./$file file=./$file || exit 1
;; ;;
esac esac
. $file . $file || fatal_error "Can not load the RC file: $file"
else else
usage 1 usage 1
fi fi
if [ -f ${SHAREDIR}/shorewall/version ]; then if [ -f ${SHAREDIR}/$PRODUCT/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/version)" INSTALLED_VERSION="$(cat ${SHAREDIR}/$PRODUCT/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Version $INSTALLED_VERSION is installed" echo "WARNING: $Product Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller." echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION" VERSION="$INSTALLED_VERSION"
fi fi
else else
echo "WARNING: Shorewall Version $VERSION is not installed" echo "WARNING: $Product Version $VERSION is not installed"
VERSION="" VERSION=""
fi fi
echo "Uninstalling $Product $VERSION"
echo "Uninstalling shorewall $VERSION"
[ -n "$SANDBOX" ] && configure=0 [ -n "$SANDBOX" ] && configure=0
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall-lite ]; then if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall-lite ]; then
shorewall clear ${SBINDIR}/$PRODUCT clear
elif qt ip6tables -L shorewall6 -n && [ ! -f ${SBINDIR}/shorewall6-lite ]; then
${SBINDIR}/$PRODUCT clear
fi fi
fi fi
rm -f ${SBINDIR}/shorewall remove_file ${SBINDIR}/$PRODUCT
if [ -L ${SHAREDIR}/shorewall/init ]; then if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall/init) FIREWALL=$(readlink -m -q ${SHAREDIR}/$PRODUCT/init)
elif [ -n "$INITFILE" ]; then elif [ -n "$INITFILE" ]; then
FIREWALL=${INITDIR}/${INITFILE} FIREWALL=${INITDIR}/${INITFILE}
fi fi
if [ -f "$FIREWALL" ]; then if [ -f "$FIREWALL" ]; then
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then if mywhich insserv ; then
updaterc.d ${PRODUCT} remove
elif mywhich insserv ; then
insserv -r $FIREWALL insserv -r $FIREWALL
elif mywhich update-rc.d ; then
update-rc.d ${PRODUCT} remove
elif mywhich chkconfig ; then elif mywhich chkconfig ; then
chkconfig --del $(basename $FIREWALL) chkconfig --del $(basename $FIREWALL)
fi fi
@@ -193,51 +171,56 @@ if [ -f "$FIREWALL" ]; then
remove_file $FIREWALL remove_file $FIREWALL
fi fi
if [ -z "${SERVICEDIR}" ]; then [ -z "${SERVICEDIR}" ] && SERVICEDIR="$SYSTEMD"
SERVICEDIR="$SYSTEMD"
fi
if [ -n "$SERVICEDIR" ]; then if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT} [ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
rm -f $SERVICEDIR/shorewall.service remove_file $SERVICEDIR/${PRODUCT}.service
fi fi
rm -rf ${SHAREDIR}/shorewall/version remove_file ${SHAREDIR}/$PRODUCT/version
rm -rf ${CONFDIR}/shorewall remove_directory ${CONFDIR}/$PRODUCT
if [ -n "$SYSCONFDIR" ]; then if [ -n "$SYSCONFDIR" ]; then
[ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT} [ -n "$SYSCONFFILE" ] && remove_file ${SYSCONFDIR}/${PRODUCT}
fi fi
rm -rf ${VARDIR}/shorewall remove_directory ${VARDIR}
rm -rf ${PERLLIBDIR}/Shorewall/* [ ${LIBEXECDIR} = ${SHAREDIR} ] || remove_directory ${LIBEXECDIR}/$PRODUCT
[ ${LIBEXECDIR} = ${SHAREDIR} ] || rm -rf ${LIBEXECDIR}/shorewall remove_directory ${SHAREDIR}/$PRODUCT/configfiles
rm -rf ${SHAREDIR}/shorewall/configfiles/ remove_file_with_wildcard ${SHAREDIR}/$PRODUCT/module\*
rm -rf ${SHAREDIR}/shorewall/Samples/ remove_file ${SHAREDIR}/$PRODUCT/helpers
rm -rf ${SHAREDIR}/shorewall/Shorewall/ remove_file_with_wildcard ${SHAREDIR}/$PRODUCT/action\*
rm -f ${SHAREDIR}/shorewall/lib.cli-std remove_file_with_wildcard ${SHAREDIR}/$PRODUCT/macro.\*
rm -f ${SHAREDIR}/shorewall/lib.runtime
rm -f ${SHAREDIR}/shorewall/compiler.pl
rm -f ${SHAREDIR}/shorewall/prog.*
rm -f ${SHAREDIR}/shorewall/module*
rm -f ${SHAREDIR}/shorewall/helpers
rm -f ${SHAREDIR}/shorewall/action*
rm -f ${SHAREDIR}/shorewall/macro.*
rm -f ${SHAREDIR}/shorewall/init
for f in ${MANDIR}/man5/shorewall* ${MANDIR}/man8/shorewall*; do if [ $PRODUCT = shorewall ]; then
remove_file_with_wildcard ${PERLLIBDIR}/$Product/\*
remove_directory ${SHAREDIR}/$PRODUCT/Samples
remove_directory ${SHAREDIR}/$PRODUCT/$Product
remove_file ${SHAREDIR}/$PRODUCT/lib.cli-std
remove_file ${SHAREDIR}/$PRODUCT/lib.runtime
remove_file ${SHAREDIR}/$PRODUCT/compiler.pl
remove_file_with_wildcard ${SHAREDIR}/$PRODUCT/prog.\*
remove_file ${SHAREDIR}/$PRODUCT/init
else
remove_directory ${SHAREDIR}/$PRODUCT
fi
for f in ${MANDIR}/man5/${PRODUCT}* ${MANDIR}/man8/${PRODUCT}*; do
case $f in case $f in
shorewall6*|shorewall-lite*) shorewall[6]-lite*)
;; ;;
*) *)
rm -f $f remove_file $f
;; ;;
esac esac
done done
rm -f ${CONFDIR}/logrotate.d/shorewall remove_file ${CONFDIR}/logrotate.d/$PRODUCT
[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/shorewall.service
echo "Shorewall Uninstalled"
[ -n "$SYSTEMD" ] && remove_file ${SYSTEMD}/${PRODUCT}.service
#
# Report Success
#
echo "$Product $VERSION Uninstalled"

View File

@@ -0,0 +1,26 @@
#
# Global start/restart/reload/stop options
#
OPTIONS=""
#
# Start options
#
STARTOPTIONS=""
#
# Restart options
#
RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# EOF

View File

@@ -1,5 +1,5 @@
# prevent startup with default configuration # prevent startup with default configuration
# set the following varible to 1 in order to allow Shorewall6-lite to start # set the following variable to 1 in order to allow Shorewall6-lite to start
startup=0 startup=0
@@ -16,7 +16,7 @@ startup=0
# wait_interface= # wait_interface=
# #
# Startup options # Global start/restart/reload/stop options
# #
OPTIONS="" OPTIONS=""
@@ -30,6 +30,16 @@ STARTOPTIONS=""
# #
RESTARTOPTIONS="" RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# #
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf # Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf
# #

View File

@@ -15,7 +15,7 @@ RemainAfterExit=yes
EnvironmentFile=-/etc/default/shorewall6-lite EnvironmentFile=-/etc/default/shorewall6-lite
StandardOutput=syslog StandardOutput=syslog
ExecStart=/sbin/shorewall6-lite $OPTIONS start ExecStart=/sbin/shorewall6-lite $OPTIONS start
ExecStop=/sbin/shorewall6-lite $OPTIONS stop ExecStop=/sbin/shorewall6-lite $OPTIONS clear
ExecReload=/sbin/shorewall6-lite $OPTIONS reload ExecReload=/sbin/shorewall6-lite $OPTIONS reload
[Install] [Install]

View File

@@ -1,221 +0,0 @@
#!/bin/sh
#
# Script to back uninstall Shoreline Firewall 6 Lite
#
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.sourceforge.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/>.
#
# Usage:
#
# You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall6-lite
Product="Shorewall6 Lite"
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME [ <shorewallrc file> ]"
exit $1
}
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
finished=0
configure=1
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Installer Version $VERSION"
exit 0
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
#
# Read the RC file
#
if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then
. ./shorewallrc
elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc
else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi
elif [ $# -eq 1 ]; then
file=$1
case $file in
/*|.*)
;;
*)
file=./$file
;;
esac
. $file
else
usage 1
fi
if [ -f ${SHAREDIR}/shorewall6-lite/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall6-lite/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall6 Lite Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION"
fi
else
echo "WARNING: Shorewall6 Lite Version $VERSION is not installed"
VERSION=""
fi
echo "Uninstalling Shorewall6 Lite $VERSION"
[ -n "$SANDBOX" ] && configure=0
if [ $configure -eq 1 ]; then
if qt ip6tables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall6 ]; then
${SBINDIR}/shorewall6-lite clear
fi
fi
if [ -f ${SHAREDIR}/shorewall6-lite/init ]; then
if [ $HOST = openwrt ]; then
if [ $configure -eq 1 ] && /etc/init.d/shorewall6-lite enabled; then
/etc/init.d/shorewall6-lite disable
fi
FIREWALL=$(readlink ${SHAREDIR}/shorewall6-lite/init)
else
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall6-lite/init)
fi
elif [ -n "$INITFILE" ]; then
FIREWALL=${INITDIR}/${INITFILE}
fi
if [ -f "$FIREWALL" ]; then
if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then
updaterc.d shorewall6-lite remove
elif mywhich insserv ; then
insserv -r $FIREWALL
elif mywhich chkconfig ; then
chkconfig --del $(basename $FIREWALL)
elif mywhich systemctl ; then
systemctl disable shorewall6-lite
fi
fi
remove_file $FIREWALL
fi
[ -z "$SERVICEDIR" ] && SERVICEDIR="$SYSTEMD"
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
rm -f $SERVICEDIR/shorewall6-lite.service
fi
rm -f ${SBINDIR}/shorewall6-lite
rm -rf ${CONFDIR}/shorewall6-lite
rm -rf ${VARDIR}
rm -rf ${SHAREDIR}/shorewall6-lite
rm -rf ${LIBEXECDIR}/shorewall6-lite
rm -f ${CONFDIR}/logrotate.d/shorewall6-lite
rm -f ${SYSCONFDIR}/shorewall6-lite
if [ -n "${MANDIR}" ]; then
rm -f ${MANDIR}/man5/shorewall6-lite*
rm -f ${MANDIR}/man8/shorewall6-lite*
fi
echo "Shorewall6 Lite Uninstalled"

View File

@@ -1,38 +0,0 @@
#
# Shorewall6 -- /usr/share/shorewall6/action.A_AllowICMPs
#
# This action A_ACCEPTs needed ICMP types
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT
?comment Needed ICMP types (RFC4890)
A_ACCEPT - - ipv6-icmp destination-unreachable
A_ACCEPT - - ipv6-icmp packet-too-big
A_ACCEPT - - ipv6-icmp time-exceeded
A_ACCEPT - - ipv6-icmp parameter-problem
# The following should have a ttl of 255 and must be allowed to transit a bridge
A_ACCEPT - - ipv6-icmp router-solicitation
A_ACCEPT - - ipv6-icmp router-advertisement
A_ACCEPT - - ipv6-icmp neighbour-solicitation
A_ACCEPT - - ipv6-icmp neighbour-advertisement
A_ACCEPT - - ipv6-icmp 137 # Redirect
A_ACCEPT - - ipv6-icmp 141 # Inverse neighbour discovery solicitation
A_ACCEPT - - ipv6-icmp 142 # Inverse neighbour discovery advertisement
# The following should have a link local source address and must be allowed to transit a bridge
A_ACCEPT fe80::/10 - ipv6-icmp 130 # Listener query
A_ACCEPT fe80::/10 - ipv6-icmp 131 # Listener report
A_ACCEPT fe80::/10 - ipv6-icmp 132 # Listener done
A_ACCEPT fe80::/10 - ipv6-icmp 143 # Listener report v2
# The following should be received with a ttl of 255 and must be allowed to transit a bridge
A_ACCEPT - - ipv6-icmp 148 # Certificate path solicitation
A_ACCEPT - - 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
A_ACCEPT fe80::/10 - ipv6-icmp 151 # Multicast router advertisement
A_ACCEPT fe80::/10 - ipv6-icmp 152 # Multicast router solicitation
A_ACCEPT fe80::/10 - ipv6-icmp 153 # Multicast router termination

View File

@@ -1,40 +0,0 @@
#
# Shorewall6 -- /usr/share/shorewall6/action.AllowICMPs
#
# This action ACCEPTs needed ICMP types
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT
DEFAULTS ACCEPT
?COMMENT Needed ICMP types (RFC4890)
$1 - - ipv6-icmp destination-unreachable
$1 - - ipv6-icmp packet-too-big
$1 - - ipv6-icmp time-exceeded
$1 - - ipv6-icmp parameter-problem
# The following should have a ttl of 255 and must be allowed to transit a bridge
$1 - - ipv6-icmp router-solicitation
$1 - - ipv6-icmp router-advertisement
$1 - - ipv6-icmp neighbour-solicitation
$1 - - ipv6-icmp neighbour-advertisement
$1 - - ipv6-icmp 137 # Redirect
$1 - - ipv6-icmp 141 # Inverse neighbour discovery solicitation
$1 - - ipv6-icmp 142 # Inverse neighbour discovery advertisement
# The following should have a link local source address and must be allowed to transit a bridge
$1 fe80::/10 - ipv6-icmp 130 # Listener query
$1 fe80::/10 - ipv6-icmp 131 # Listener report
$1 fe80::/10 - ipv6-icmp 132 # Listener done
$1 fe80::/10 - ipv6-icmp 143 # Listener report v2
# The following should be received with a ttl of 255 and must be allowed to transit a bridge
$1 - - ipv6-icmp 148 # Certificate path solicitation
$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
$1 fe80::/10 - ipv6-icmp 151 # Multicast router advertisement
$1 fe80::/10 - ipv6-icmp 152 # Multicast router solicitation
$1 fe80::/10 - ipv6-icmp 153 # Multicast router termination

View File

@@ -1,65 +0,0 @@
#
# Shorewall6 -- /usr/share/shorewall6/action.Broadcast
#
# Multicast/Anycast IPv6 Action
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Broadcast[([<action>|-[,{audit|-}])]
#
# Default action is DROP
#
###############################################################################
DEFAULTS DROP,-
?begin perl;
use Shorewall::IPAddrs;
use Shorewall::Config;
use Shorewall::Chains;
my $chainref = get_action_chain;
my ( $action, $audit ) = get_action_params( 2 );
my ( $level, $tag ) = get_action_logging;
my $target = require_audit ( $action , $audit );
fatal_error "Invalid parameter to action Broadcast" if supplied $audit && $audit ne 'audit';
if ( have_capability( 'ADDRTYPE' ) ) {
if ( $level ne '' ) {
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type BROADCAST ';
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type ANYCAST ';
}
add_jump $chainref, $target, 0, '-m addrtype --dst-type BROADCAST ';
add_jump $chainref, $target, 0, '-m addrtype --dst-type ANYCAST ';
} else {
add_commands $chainref, 'for address in $ALL_ACASTS; do';
incr_cmd_level $chainref;
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d $address ' if $level ne '';
add_jump $chainref, $target, 0, "-d \$address ";
decr_cmd_level $chainref;
add_commands $chainref, 'done';
}
1;
?end perl;

View File

@@ -1,59 +0,0 @@
#
# Shorewall6 -- /usr/share/shorewall6/action.Multicast
#
# Multicast/Anycast IPv6 Action
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Multicast[([<action>|-[,{audit|-}])]
#
# Default action is DROP
#
###############################################################################
DEFAULTS DROP,-
?begin perl;
use Shorewall::IPAddrs;
use Shorewall::Config;
use Shorewall::Chains;
my $chainref = get_action_chain;
my ( $action, $audit ) = get_action_params( 2 );
my ( $level, $tag ) = get_action_logging;
my $target = require_audit ( $action , $audit );
fatal_error "Invalid parameter to action Broadcast" if supplied $audit && $audit ne 'audit';
if ( have_capability( 'ADDRTYPE' ) ) {
if ( $level ne '' ) {
log_rule_limit $level, $chainref, 'Multicast' , $action, '', $tag, 'add', ' -m addrtype --dst-type MULTICAST ';
}
add_jump $chainref, $target, 0, '-m addrtype --dst-type MULTICAST ';
} else {
log_rule_limit( $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', join( ' ', '-d', IPv6_MULTICAST . ' ' ) ) if $level ne '';
add_jump $chainref, $target, 0, join( ' ', '-d', IPv6_MULTICAST . ' ' );
}
1;
?end perl;

View File

@@ -34,7 +34,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -54,19 +54,19 @@ LOGLIMIT="s:1/sec:10"
LOGTAGONLY=No LOGTAGONLY=No
MACLIST_LOG_LEVEL=info MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=info RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=info SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=info SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall6-init.log STARTUP_LOG=/var/log/shorewall6-init.log
TCP_FLAGS_LOG_LEVEL=info TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -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=${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall
GEOIPDIR=/usr/share/xt_geoip/LE GEOIPDIR=/usr/share/xt_geoip/LE
@@ -106,11 +106,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -188,6 +188,8 @@ MANGLE_ENABLED=Yes
MARK_IN_FORWARD_CHAIN=No MARK_IN_FORWARD_CHAIN=No
MINIUPNPD=No
MODULE_SUFFIX="ko ko.xz" MODULE_SUFFIX="ko ko.xz"
MUTEX_TIMEOUT=60 MUTEX_TIMEOUT=60
@@ -196,6 +198,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=Yes REQUIRE_INTERFACE=Yes
@@ -206,7 +210,7 @@ RESTORE_ROUTEMARKS=Yes
SAVE_IPSETS=No SAVE_IPSETS=No
TC_ENABLED=No TC_ENABLED=Shared
TC_EXPERT=No TC_EXPERT=No

View File

@@ -35,7 +35,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -55,19 +55,19 @@ LOGLIMIT="s:1/sec:10"
LOGTAGONLY=No LOGTAGONLY=No
MACLIST_LOG_LEVEL=info MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=info RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=info SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=info SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall6-init.log STARTUP_LOG=/var/log/shorewall6-init.log
TCP_FLAGS_LOG_LEVEL=info TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -107,11 +107,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -189,6 +189,8 @@ MANGLE_ENABLED=Yes
MARK_IN_FORWARD_CHAIN=No MARK_IN_FORWARD_CHAIN=No
MINIUPNPD=No
MODULE_SUFFIX="ko ko.xz" MODULE_SUFFIX="ko ko.xz"
MUTEX_TIMEOUT=60 MUTEX_TIMEOUT=60
@@ -197,6 +199,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No
@@ -207,7 +211,7 @@ RESTORE_ROUTEMARKS=Yes
SAVE_IPSETS=No SAVE_IPSETS=No
TC_ENABLED=No TC_ENABLED=Shared
TC_EXPERT=No TC_EXPERT=No

View File

@@ -34,7 +34,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -54,19 +54,19 @@ LOGLIMIT="s:1/sec:10"
LOGTAGONLY=No LOGTAGONLY=No
MACLIST_LOG_LEVEL=info MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=info RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=info SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=info SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall6-init.log STARTUP_LOG=/var/log/shorewall6-init.log
TCP_FLAGS_LOG_LEVEL=info TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -106,11 +106,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -188,6 +188,8 @@ MANGLE_ENABLED=Yes
MARK_IN_FORWARD_CHAIN=No MARK_IN_FORWARD_CHAIN=No
MINIUPNPD=No
MODULE_SUFFIX="ko ko.xz" MODULE_SUFFIX="ko ko.xz"
MUTEX_TIMEOUT=60 MUTEX_TIMEOUT=60
@@ -196,6 +198,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No
@@ -206,7 +210,7 @@ RESTORE_ROUTEMARKS=Yes
SAVE_IPSETS=No SAVE_IPSETS=No
TC_ENABLED=No TC_ENABLED=Shared
TC_EXPERT=No TC_EXPERT=No

View File

@@ -34,7 +34,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -54,19 +54,19 @@ LOGLIMIT="s:1/sec:10"
LOGTAGONLY=No LOGTAGONLY=No
MACLIST_LOG_LEVEL=info MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=info RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=info SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=info SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall6-init.log STARTUP_LOG=/var/log/shorewall6-init.log
TCP_FLAGS_LOG_LEVEL=info TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -106,11 +106,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -188,6 +188,8 @@ MANGLE_ENABLED=Yes
MARK_IN_FORWARD_CHAIN=No MARK_IN_FORWARD_CHAIN=No
MINIUPNPD=No
MODULE_SUFFIX="ko ko.xz" MODULE_SUFFIX="ko ko.xz"
MUTEX_TIMEOUT=60 MUTEX_TIMEOUT=60
@@ -196,6 +198,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No
@@ -206,7 +210,7 @@ RESTORE_ROUTEMARKS=Yes
SAVE_IPSETS=No SAVE_IPSETS=No
TC_ENABLED=No TC_ENABLED=Shared
TC_EXPERT=No TC_EXPERT=No

View File

@@ -6,32 +6,28 @@
# Please see http://shorewall.net/Actions.html for additional # Please see http://shorewall.net/Actions.html for additional
# information. # information.
# #
# Builtin Actions are:
#
?if 0
allowBcasts # Accept anycast packets
allowMcasts # Accept multicast packets
dropBcasts # Silently Drop anycast packets
dropMcasts # Silently Drop multicast packets
dropNotSyn # Silently Drop Non-syn TCP packets
rejNotSyn # Silently Reject Non-syn TCP packets
?endif
############################################################################### ###############################################################################
#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 # Audited Accept needed ICMP6 types
AllowICMPs # Accept needed ICMP6 types AllowICMPs # Accept needed ICMP6 types
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
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
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
dropInvalid inline # Drops packets in the INVALID conntrack state dropInvalid inline # Drops packets in the INVALID conntrack state
dropMcast inline # Silently Drop Multicast
dropNotSyn noinline # Silently Drop Non-syn TCP packets
DropDNSrep inline # Drops DNS replies DropDNSrep inline # 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
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
@@ -39,6 +35,7 @@ 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 # 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
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

View File

@@ -34,7 +34,7 @@ FIREWALL=
# L O G G I N G # L O G G I N G
############################################################################### ###############################################################################
LOG_LEVEL=info LOG_LEVEL="info"
BLACKLIST_LOG_LEVEL= BLACKLIST_LOG_LEVEL=
@@ -54,19 +54,19 @@ LOGLIMIT="s:1/sec:10"
LOGTAGONLY=No LOGTAGONLY=No
MACLIST_LOG_LEVEL=$LOG_LEVEL MACLIST_LOG_LEVEL="$LOG_LEVEL"
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=$LOG_LEVEL RPFILTER_LOG_LEVEL="$LOG_LEVEL"
SFILTER_LOG_LEVEL=$LOG_LEVEL SFILTER_LOG_LEVEL="$LOG_LEVEL"
SMURF_LOG_LEVEL=$LOG_LEVEL SMURF_LOG_LEVEL="$LOG_LEVEL"
STARTUP_LOG=/var/log/shorewall6-init.log STARTUP_LOG=/var/log/shorewall6-init.log
TCP_FLAGS_LOG_LEVEL=$LOG_LEVEL TCP_FLAGS_LOG_LEVEL="$LOG_LEVEL"
UNTRACKED_LOG_LEVEL= UNTRACKED_LOG_LEVEL=
@@ -106,11 +106,11 @@ TC=
# D E F A U L T A C T I O N S / M A C R O S # D E F A U L T A C T I O N S / M A C R O S
############################################################################### ###############################################################################
ACCEPT_DEFAULT=none ACCEPT_DEFAULT="none"
BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT=none QUEUE_DEFAULT="none"
REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
############################################################################### ###############################################################################
@@ -188,6 +188,8 @@ MANGLE_ENABLED=Yes
MARK_IN_FORWARD_CHAIN=No MARK_IN_FORWARD_CHAIN=No
MINIUPNPD=No
MODULE_SUFFIX=ko MODULE_SUFFIX=ko
MUTEX_TIMEOUT=60 MUTEX_TIMEOUT=60
@@ -196,6 +198,8 @@ OPTIMIZE=All
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
PERL_HASH_SEED=0
REJECT_ACTION= REJECT_ACTION=
REQUIRE_INTERFACE=No REQUIRE_INTERFACE=No
@@ -206,7 +210,7 @@ RESTORE_ROUTEMARKS=Yes
SAVE_IPSETS=No SAVE_IPSETS=No
TC_ENABLED=No TC_ENABLED=Shared
TC_EXPERT=No TC_EXPERT=No

View File

@@ -0,0 +1,26 @@
#
# Global start/restart/reload/stop options
#
OPTIONS=""
#
# Start options
#
STARTOPTIONS=""
#
# Restart options
#
RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# EOF

View File

@@ -1,5 +1,5 @@
# prevent startup with default configuration # prevent startup with default configuration
# set the following varible to 1 in order to allow Shorewall6 to start # set the following variable to 1 in order to allow Shorewall6 to start
startup=0 startup=0
@@ -16,7 +16,7 @@ startup=0
# wait_interface= # wait_interface=
# #
# Startup options # Global start/restart/reload/stop options
# #
OPTIONS="" OPTIONS=""
@@ -30,6 +30,16 @@ STARTOPTIONS=""
# #
RESTARTOPTIONS="" RESTARTOPTIONS=""
#
# Reload options
#
RELOADOPTIONS=""
#
# Stop options
#
STOPOPTIONS=""
# #
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf # Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf
# #

View File

@@ -1026,8 +1026,9 @@ Normal-Service =&gt; 0x00</programlisting>
role="bold">all}[,...]}</emphasis></term> role="bold">all}[,...]}</emphasis></term>
<listitem> <listitem>
<para>Protocol - <emphasis role="bold">ipp2p</emphasis> requires <para>See <ulink
ipp2p match support in your kernel and iptables.</para> url="shorewall-rules.html">shorewall6-rules(5)</ulink> for
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>

View File

@@ -59,7 +59,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 and QUEUE</para> REJECT, LOG, 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>
@@ -74,7 +74,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 and QUEUE</para> REJECT, LOG, 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
@@ -90,7 +90,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 and QUEUE.</para> REJECT, LOG, 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
@@ -106,7 +106,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 and QUEUE.</para> REJECT, LOG, 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
@@ -1392,7 +1392,7 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">PROTO</emphasis> - {<emphasis <term><emphasis role="bold">PROTO</emphasis> - {<emphasis
role="bold">-</emphasis>|<emphasis role="bold">-</emphasis>|<emphasis
role="bold">tcp:syn</emphasis>|<emphasis role="bold">tcp:[!]syn</emphasis>|<emphasis
role="bold">ipp2p</emphasis>|<emphasis role="bold">ipp2p</emphasis>|<emphasis
role="bold">ipp2p:udp</emphasis>|<emphasis role="bold">ipp2p:udp</emphasis>|<emphasis
role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis role="bold">ipp2p:all</emphasis>|<emphasis>protocol-number</emphasis>|<emphasis>protocol-name</emphasis>|<emphasis
@@ -1403,7 +1403,9 @@
requires ipp2p match support in your kernel and ip6tables. <emphasis requires ipp2p match support in your kernel and ip6tables. <emphasis
role="bold">tcp:syn</emphasis> implies <emphasis role="bold">tcp:syn</emphasis> implies <emphasis
role="bold">tcp</emphasis> plus the SYN flag must be set and the role="bold">tcp</emphasis> plus the SYN flag must be set and the
RST,ACK and FIN flags must be reset.</para> RST,ACK and FIN flags must be reset. Beginning with Shorewall 5.1.3,
you may also specify <emphasis role="bold">tcp:!syn</emphasis>,
which matches if SYN is not set or if RST, ACK or FIN is set.</para>
<para>Beginning with Shorewall6 4.4.19, this column can contain a <para>Beginning with Shorewall6 4.4.19, this column can contain a
comma-separated list of protocol-numbers and/or protocol names comma-separated list of protocol-numbers and/or protocol names

View File

@@ -222,8 +222,9 @@
role="bold">all}</emphasis></term> role="bold">all}</emphasis></term>
<listitem> <listitem>
<para>Protocol - <emphasis role="bold">ipp2p</emphasis> requires <para>See <ulink
ipp2p match support in your kernel and iptables.</para> url="shorewall-rules.html">shorewall6-rules(5)</ulink> for
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>

View File

@@ -234,8 +234,9 @@
<listitem> <listitem>
<para>If you wish to restrict this entry to a particular protocol <para>If you wish to restrict this entry to a particular protocol
then enter the protocol name (from protocols(5)) or number then enter the protocol name (from protocols(5)) or number here. See
here.</para> <ulink url="shorewall-rules.html">shorewall6-rules(5)</ulink> for
details.</para>
<para>Beginning with Shorewall 4.5.12, this column can accept a <para>Beginning with Shorewall 4.5.12, this column can accept a
comma-separated list of protocols.</para> comma-separated list of protocols.</para>

View File

@@ -1555,6 +1555,28 @@ LOG:info:,bar net fw</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">MINIUPNPD=</emphasis>[<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
<listitem>
<para>Added in Shorewall 5.1.4. If set to Yes, Shorewall will create
a chain in the nat table named MINIUPNPD-POSTROUTING and will add
jumps from POSTROUTING to that chain for each interface with the
<option>upnpd</option> option specified. Default is No.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">MARK_IN_FORWARD_CHAIN=</emphasis>[<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
<listitem>
<para/>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">MODULE_SUFFIX=</emphasis>[<emphasis <term><emphasis role="bold">MODULE_SUFFIX=</emphasis>[<emphasis
role="bold">"</emphasis><emphasis>extension</emphasis> ...<emphasis role="bold">"</emphasis><emphasis>extension</emphasis> ...<emphasis
@@ -1868,6 +1890,21 @@ LOG:info:,bar net fw</programlisting>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">PERL_HASH_SEED=</emphasis><emphasis
role="bold"><replaceable>seed</replaceable><emphasis
role="bold">|random</emphasis></emphasis></term>
<listitem>
<para>Added in Shorewall 5.1.4. Sets the Perl hash
<replaceable>seed</replaceable> (an integer in the range 0-99999)
when running the Shorewall rules compiler. If not specified, the
value 0 is assumed. If <option>random</option> is specified, a
random seed will be chosed by Perl. See perlsec(1) for additional
information.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">PROVIDER_BITS</emphasis>=[<replaceable>number</replaceable>]</term> role="bold">PROVIDER_BITS</emphasis>=[<replaceable>number</replaceable>]</term>

View File

@@ -16,7 +16,7 @@ RemainAfterExit=yes
EnvironmentFile=-/etc/default/shorewall6 EnvironmentFile=-/etc/default/shorewall6
StandardOutput=syslog StandardOutput=syslog
ExecStart=/sbin/shorewall -6 $OPTIONS start $STARTOPTIONS ExecStart=/sbin/shorewall -6 $OPTIONS start $STARTOPTIONS
ExecStop=/sbin/shorewall -6 $OPTIONS stop ExecStop=/sbin/shorewall -6 $OPTIONS clear
ExecReload=/sbin/shorewall -6 $OPTIONS reload $RELOADOPTIONS ExecReload=/sbin/shorewall -6 $OPTIONS reload $RELOADOPTIONS
[Install] [Install]

View File

@@ -1,226 +0,0 @@
#!/bin/sh
#
# Script to back uninstall Shoreline Firewall 6
#
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://www.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/>.
#
# Usage:
#
# You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall6
Product=Shorewall6
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME [ <shorewallrc file> ]"
exit $1
}
fatal_error()
{
echo " ERROR: $@" >&2
exit 1
}
qt()
{
"$@" >/dev/null 2>&1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
return 0
fi
done
return 2
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
finished=0
configure=1
while [ $finished -eq 0 ]; do
option=$1
case "$option" in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
h)
usage 0
;;
v)
echo "$Product Firewall Installer Version $VERSION"
exit 0
;;
n*)
configure=0
option=${option#n}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
#
# Read the RC file
#
if [ $# -eq 0 ]; then
if [ -f ./shorewallrc ]; then
. ./shorewallrc
elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif [ -f /usr/share/shorewall/shorewallrc ]; then
. /usr/share/shorewall/shorewallrc
else
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
fi
elif [ $# -eq 1 ]; then
file=$1
case $file in
/*|.*)
;;
*)
file=./$file
;;
esac
. $file
else
usage 1
fi
if [ -f ${SHAREDIR}/shorewall6/version ]; then
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall6/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall6 Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION"
fi
else
echo "WARNING: Shorewall6 Version $VERSION is not installed"
VERSION=""
fi
echo "Uninstalling shorewall6 $VERSION"
[ -n "$SANDBOX" ] && configure=0
if [ $configure -eq 1 ]; then
if qt ip6tables -L shorewall6 -n && [ ! -f ${SBINDIR}/shorewall6-lite ]; then
${SBINDIR}/shorewall6 clear
fi
fi
if [ -L ${SHAREDIR}/shorewall6/init ]; then
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall6/init)
elif [ -n "$INITFILE" ]; then
FIREWALL=${INITDIR}/${INITFILE}
fi
if [ -f "$FIREWALL" ]; then
if [ $configure -eq 1 ]; then
if mywhich updaterc.d ; then
updaterc.d shorewall6 remove
elif mywhich insserv ; then
insserv -r $FIREWALL
elif mywhich chkconfig ; then
chkconfig --del $(basename $FIREWALL)
fi
fi
remove_file $FIREWALL
fi
[ -n "$SERVICEDIR" ] || SERVICEDIR=${SYSTEMD}
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}
rm -f $SERVICEDIR/shorewall6.service
fi
rm -rf ${SHAREDIR}/shorewall6/version
rm -rf ${CONFDIR}/shorewall6
if [ -n "$SYSCONFDIR" ]; then
[ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT}
fi
rm -f ${SBINDIR}/shorewall6
rm -rf ${CONFDIR}/shorewall6
rm -rf ${VARDIR}
rm -rf ${LIBEXECDIR}/shorewall6
rm -rf ${SHAREDIR}/shorewall6
for f in ${MANDIR}/man5/shorewall6* ${SHAREDIR}/man/man8/shorewall6*; do
case $f in
shorewall6-lite*)
;;
*)
rm -f $f
esac
done
rm -f ${CONFDIR}/logrotate.d/shorewall6
[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/shorewall6.service
echo "Shorewall6 Uninstalled"

View File

@@ -351,8 +351,8 @@ ACCEPT - - tcp 135,139,445</programlisting>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
<para>The recommended settings for the 6 policy actions for IPv4 are: <para>The recommended settings for the 6 policy actions for IPv4
</para> are:</para>
<programlisting> ACCEPT_DEFAULT=none <programlisting> ACCEPT_DEFAULT=none
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
@@ -365,7 +365,7 @@ ACCEPT - - tcp 135,139,445</programlisting>
<para>The recommended settings for IPv6 are:</para> <para>The recommended settings for IPv6 are:</para>
<programlisting> ACCEPT_DEFAULT=none <programlisting> ACCEPT_DEFAULT=none
BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
NFQUEUE_DEFAULT=none NFQUEUE_DEFAULT=none
QUEUE_DEFAULT=none QUEUE_DEFAULT=none

View File

@@ -18,7 +18,7 @@
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate> <pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
<copyright> <copyright>
<year>2001-2016</year> <year>2001-2017</year>
<holder>Thomas M. Eastep</holder> <holder>Thomas M. Eastep</holder>
</copyright> </copyright>

View File

@@ -406,6 +406,14 @@ DNAT net loc:192.168.1.3:22 tcp 1022</programlisting>
the net. Is it possible to only redirect 4104 to the localhost port 22 the net. Is it possible to only redirect 4104 to the localhost port 22
and have connection attempts to port 22 from the net dropped?</title> and have connection attempts to port 22 from the net dropped?</title>
<important>
<para>On systems with the "Extended Conntrack Match"
(NEW_CONNTRACK_MATCH) capability (see the output of
<command>shorewall show capabilities</command>), port 22 is opened
only to connections whose original destination port is 4104 and this
FAQ does not apply.</para>
</important>
<para><emphasis role="bold">Answer </emphasis>courtesy of Ryan: Assume <para><emphasis role="bold">Answer </emphasis>courtesy of Ryan: Assume
that the IP address of your local firewall interface is 192.168.1.1. that the IP address of your local firewall interface is 192.168.1.1.
If you configure SSHD to only listen on that address and add the If you configure SSHD to only listen on that address and add the

View File

@@ -50,7 +50,7 @@
Linux Distributions. The following diagram shows the entire Linux Distributions. The following diagram shows the entire
network.</para> network.</para>
<graphic align="center" fileref="images/Network2008a.png" /> <graphic align="center" fileref="images/Network2008a.png"/>
<para>My personal laptop (Ursa) hosts the virtual machines. As shown in <para>My personal laptop (Ursa) hosts the virtual machines. As shown in
the diagram, Ursa has routes to the Internet through both the the diagram, Ursa has routes to the Internet through both the
@@ -66,12 +66,12 @@
<section> <section>
<title>Networking Configuration</title> <title>Networking Configuration</title>
<para>I use a network configuration where each VM has its own VNET and <para>I use a network configuration where each VM has its own VNET and tap
tap device and the tap devices are all configured as ports on a Linux device and the tap devices are all configured as ports on a Linux Bridge.
Bridge. For clarity, I've only shown four of the virtual machines For clarity, I've only shown four of the virtual machines available on the
available on the system.</para> system.</para>
<graphic align="center" fileref="images/KVM1.png" /> <graphic align="center" fileref="images/KVM1.png"/>
<para>I run <ulink url="???">dmsmasq</ulink> to act as a DHCP server and <para>I run <ulink url="???">dmsmasq</ulink> to act as a DHCP server and
name server for the VMs.</para> name server for the VMs.</para>
@@ -82,11 +82,10 @@
<para>With this configuration, and with only a single network interface on <para>With this configuration, and with only a single network interface on
the laptop, this is just a simple <ulink the laptop, this is just a simple <ulink
url="two-interface.html">two-interface masquerading setup</ulink> where url="two-interface.htm">two-interface masquerading setup</ulink> where the
the local network interface is <filename local network interface is <filename class="devicefile">br0</filename>. As
class="devicefile">br0</filename>. As with all bridges, <filename with all bridges, <filename class="devicefile">br0</filename> must be
class="devicefile">br0</filename> must be configured with the configured with the <option>routeback</option> option in <ulink
<option>routeback</option> option in <ulink
url="manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5).</para> url="manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5).</para>
<para>For additional information about this setup, including the Shorewall <para>For additional information about this setup, including the Shorewall

View File

@@ -446,40 +446,42 @@ br0 - routeback</programlisting></para>
backslash (<quote>\</quote>) followed immediately by a new line character backslash (<quote>\</quote>) followed immediately by a new line character
(Enter key).</para> (Enter key).</para>
<example id="continuation"> <programlisting>ACCEPT net $FW tcp \↵
<title>Line Continuation</title>
<programlisting>ACCEPT net $FW tcp \↵
smtp,www,pop3,imap #Services running on the firewall</programlisting> smtp,www,pop3,imap #Services running on the firewall</programlisting>
<para>In certain cases, leading white space is ignored in continuation <para>In certain cases, leading white space is ignored in continuation
lines:</para> lines:</para>
<itemizedlist> <orderedlist>
<listitem> <listitem>
<para>The continued line ends with a colon (":")</para> <para>The continued line ends with a colon (":")</para>
</listitem> </listitem>
<listitem> <listitem>
<para>The continued line ends with a comma (",")</para> <para>The continued line ends with a comma (",")</para>
</listitem> </listitem>
</itemizedlist> </orderedlist>
<para>Example (<filename>/etc/shorewall/rules</filename>):</para> <important>
<para>What follows does NOT apply to <ulink
url="manpages/shorewall-params.html">shorewall-params(5)</ulink> and
<ulink url="shorewall.conf.html">shorewall.conf(5)</ulink>.</para>
</important>
<programlisting>#ACTION SOURCE DEST PROTO DPORT <para>Example (<filename>/etc/shorewall/rules</filename>):</para>
<programlisting>#ACTION SOURCE DEST PROTO DPORT
ACCEPT net:\ ACCEPT net:\
206.124.146.177,\ 206.124.146.177,\
206.124.146.178,\ 206.124.146.178,\
206.124.146.180\ 206.124.146.180\
dmz tcp 873</programlisting> dmz tcp 873</programlisting>
<para>The leading white space on the first through third continuation <para>The leading white space on the first through third continuation
lines is ignored so the SOURCE column effectively contains lines is ignored so the SOURCE column effectively contains
"net:206.124.146.177,206.124.147.178,206.124.146.180". Because the third "net:206.124.146.177,206.124.147.178,206.124.146.180". Because the third
continuation line does not end with a comma or colon, the leading white continuation line does not end with a comma or colon, the leading white
space in the last line is not ignored.</para> space in the last line is not ignored.</para>
</example>
<important> <important>
<para>A trailing backslash is not ignored in a comment. So the continued <para>A trailing backslash is not ignored in a comment. So the continued
@@ -2273,6 +2275,18 @@ SSH(ACCEPT) net:$MYIP $FW
<command>restart</command>, <command>reload</command>, <command>restart</command>, <command>reload</command>,
<command>refresh</command>, or one of the <command>safe</command>-* <command>refresh</command>, or one of the <command>safe</command>-*
commands.</para> commands.</para>
<para>See the VERBOSE_MESSAGES option in <ulink
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink> for
additional information.</para>
<para>In Shorewall 5.1.4, the behavior of ?ERROR, ?WARNING and ?INFO was
changed when they appear in an action file. Rather than reporting the
action filename and line number, the generated message reports where the
action was invoked. For example, the GlusterFS message above was changed
to:</para>
<programlisting> ERROR: Invalid value (2000) for the GlusterFS Bricks argument /etc/shorewall/rules (line 45)</programlisting>
</section> </section>
<section id="Embedded"> <section id="Embedded">

View File

@@ -26,6 +26,8 @@
<year>2015</year> <year>2015</year>
<year>2017</year>
<holder>Thomas M. Eastep</holder> <holder>Thomas M. Eastep</holder>
</copyright> </copyright>
@@ -54,7 +56,12 @@
<ulink url="http://xtables-addons.sourceforge.net/">xtables-addons</ulink> <ulink url="http://xtables-addons.sourceforge.net/">xtables-addons</ulink>
if they are not available in your current distribution. Instructions for if they are not available in your current distribution. Instructions for
installing xtables-addons may be found in the <ulink installing xtables-addons may be found in the <ulink
url="Dynamic.html">Dynamic Zones article</ulink>.</para> url="Dynamic.html">Dynamic Zones article</ulink>.
Note that xtables-addons might not be required
with the 'ipset' package provided by your distribution.
See also the section <ulink url="configuration_file_basics.htm#capabilities">capabilities</ulink>
in the <ulink url="configuration_file_basics.htm">configuration file basics article</ulink>
and the <ulink url="Shorewall-Lite.html#Shorecap">Shorecap program</ulink>.</para>
<para>Ipset allows you to create one or more named sets of addresses then <para>Ipset allows you to create one or more named sets of addresses then
use those sets to define Netfilter/iptables rules. Possible uses of ipsets use those sets to define Netfilter/iptables rules. Possible uses of ipsets