Compare commits

..

684 Commits

Author SHA1 Message Date
Tom Eastep
fc5d80dba7 Remove extra logic 2010-06-08 15:57:45 -07:00
Tom Eastep
0b9213bc6d Move ipset-load code to Chains.pm. Better there than in Compiler.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 15:33:09 -07:00
Tom Eastep
3adb8c29c5 Move save_dynamic_chains to Chains.pm where it belongs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 15:18:22 -07:00
Tom Eastep
245d3d5574 Bump version of Actions.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 12:49:58 -07:00
Tom Eastep
1eb80541a5 Version to 4.4.10 2010-06-08 12:35:33 -07:00
Tom Eastep
96e2f38062 Update the UPnP document with the 4.4.10 changes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 11:37:17 -07:00
Tom Eastep
3aebdbfc63 Update blacklisting doc with 4.4.10 behavior.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 11:37:09 -07:00
Tom Eastep
5413c55718 Another release note tweak
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 14:54:57 -07:00
Tom Eastep
201476ce98 Tweak release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 14:44:55 -07:00
Tom Eastep
c1bfe7d5b8 More tweaks to saving/restoring dynamic chains
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 13:55:27 -07:00
Tom Eastep
486bb73c02 Merge major changes from 4.4.11
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 13:21:59 -07:00
Tom Eastep
afbb93ca8a More changes having to do with with dynamic chains
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 13:16:25 -07:00
Tom Eastep
b591110fef Much cleaner implementation of save_dynamic_chains()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 13:15:52 -07:00
Tom Eastep
a77abaf694 Make dynamic chain saving work with IPv6
Also, use hidden files to save the chain contents.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 13:13:25 -07:00
Tom Eastep
0d101799ec Purge saved dynamic blacklist if the chain doesn't exist 2010-06-07 13:13:04 -07:00
Tom Eastep
4a2f08edef Retain UPnP and dynamic blacklist over 'restart' 2010-06-07 13:12:49 -07:00
Tom Eastep
2578b2c7cb Pretty up heading on the release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-06 13:37:56 -07:00
Tom Eastep
a8e3b2ea7c Add introduction to config file basics document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-06 08:25:13 -07:00
Tom Eastep
fdc3b698a9 Version to 4.4.10 (again) 2010-06-05 15:58:23 -07:00
Tom Eastep
d388b29d70 Let Zones.pm export chain_base rather than Chains.pm 2010-06-05 08:40:00 -07:00
Tom Eastep
0e995d65ac Version to 4.4.10-RC2 2010-06-04 16:19:15 -07:00
Tom Eastep
742a3b2eef Make wait and required work on wildcard interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-04 10:35:45 -07:00
Tom Eastep
82a74d7534 Resolve Optional/Required interfaces with wildcard names
Optional is allowed
Required is not

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-04 08:46:29 -07:00
Tom Eastep
165535cd8b Disallow wildcard optional/required interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-04 07:18:55 -07:00
Tom Eastep
7625b4069b Delete references to prenet subsystem locks.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-03 12:31:39 -07:00
Tom Eastep
43afd03b9b Bump version to 4.4.10 2010-06-03 11:18:02 -07:00
Tom Eastep
5e74427332 Update the Build document with the current release model
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-02 16:23:09 -07:00
Tom Eastep
34e1826d59 Point out that example 5 uses a deprecated form 2010-06-01 12:45:41 -07:00
Tom Eastep
f29b06ec07 Update .spec files to use DESTDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-01 07:18:37 -07:00
Tom Eastep
91840acb18 Remove unused RUNLEVELS variable from the install scripts.
Add some documentation

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-01 07:12:19 -07:00
Tom Eastep
fe55fa0f31 Rename PREFIX->DESTDIR
If DESTDIR is not supplied, look for PREFIX

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-01 06:42:11 -07:00
Tom Eastep
0553f232b5 Remove apparent restriction on files where shell variables can be used
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-31 10:25:53 -07:00
Tom Eastep
78aaea749e Mention Shorewall-init in the beginner HOWTOs 2010-05-31 09:40:20 -07:00
Tom Eastep
c52d0c4d9f Update release notes for 'version -a'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-31 08:05:33 -07:00
Tom Eastep
858a422da3 Extend 'version -a' behavior to all CLIs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-31 07:32:17 -07:00
Tom Eastep
47c4cbd85a Remove extra step in DSL modem access 2010-05-30 11:31:41 -07:00
Tom Eastep
07366ac819 Enhance FAQ 89 -- DSL modem access 2010-05-30 09:30:56 -07:00
Tom Eastep
97d8fd1588 Add FAQ 89 -- DSL modem access 2010-05-30 08:59:38 -07:00
Tom Eastep
ab3c2ccd01 Two more instances of 'T' 2010-05-29 11:06:30 -07:00
Tom Eastep
347757a190 Yet more updates for build on the Mac 2010-05-29 10:57:27 -07:00
Tom Eastep
58ad0bc9e0 More updates for build on the Mac 2010-05-29 10:50:39 -07:00
Tom Eastep
226eb6ca3e Cleanup of optimization fix
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-29 09:56:14 -07:00
Tom Eastep
5bd1bac70d Document fix for optimization bug
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-29 09:13:52 -07:00
Tom Eastep
e29d6d080d Restore -a functionality to the version command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-29 08:59:45 -07:00
Tom Eastep
50ce5bab68 Fix Optimization Bug
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-29 08:58:16 -07:00
Tom Eastep
ff5f2ab15a Emphasize 'routeback' in the OpenVZ doc 2010-05-28 17:14:31 -07:00
Tom Eastep
f457ec69f9 Don't copy SELinux context during Shorwall-init install/upgrade
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-28 10:20:19 -07:00
Tom Eastep
6056e619be Make Shorewall-init play nice with insserv on Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-28 10:18:00 -07:00
Tom Eastep
d58480943a Bump version to 4.4.10 RC 1 2010-05-27 17:21:11 -07:00
Tom Eastep
77793fb899 Correct typo in install.sh 2010-05-27 14:16:28 -07:00
Tom Eastep
98dff075ca Mention SAFESTOP in the start/stop document 2010-05-27 13:55:07 -07:00
Tom Eastep
e1c04f5ad6 Add Shorewall Init Documentation 2010-05-27 13:36:00 -07:00
Tom Eastep
3125a4d0d3 Restore RPM RedHat compatibility
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-27 06:49:49 -07:00
Tom Eastep
d0bf4e016c Merge branch 'master' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall 2010-05-26 18:54:35 -07:00
Tom Eastep
cc269d5d19 Make RPM SuSE-only 2010-05-26 18:49:33 -07:00
Tom Eastep
f0a88bda62 Unconditionally install SuSE ifupdown scripts with the RPM
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-26 17:14:26 -07:00
Tom Eastep
a440a68f7f Fixes for revised file layout
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-26 17:04:58 -07:00
Tom Eastep
e627e0ea76 Bump version to 4.4.10-Beta4
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-26 16:47:49 -07:00
Tom Eastep
c256074c94 Change installation of ifupdown one more time 2010-05-26 16:45:09 -07:00
Roberto C. Sanchez
43a0d95697 Fix mode of installed file. 2010-05-26 15:34:53 -04:00
Tom Eastep
74043784ea Merge branch 'master' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall 2010-05-26 12:28:44 -07:00
Roberto C. Sanchez
0aa0669cae Fix new code section to track with the rest of Beta3 changes. 2010-05-26 15:01:15 -04:00
Tom Eastep
925de3cee9 Fix typo in tcrules manpages 2010-05-26 06:42:37 -07:00
Tom Eastep
84909de8b9 Fixes for Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-25 16:02:57 -07:00
Tom Eastep
cdcb42ce9c Increment version to 4.4.10-Beta3.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-25 07:17:57 -07:00
Tom Eastep
3db31f2f65 Add SAFESTOP setting to /etc/default/shorewall*.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-25 07:16:02 -07:00
Tom Eastep
b972de959e Make reload ad force-reload a no-op on Debian 2010-05-24 16:26:50 -07:00
Tom Eastep
273b2252e3 Create symbolic link on RedHat
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 07:46:01 -07:00
Tom Eastep
f7580d52f7 Don't install NetworkManager script from the RPM
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 07:13:33 -07:00
Tom Eastep
ce139c5ca7 Don't install NetworkManager script on SuSE and Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 07:11:49 -07:00
Tom Eastep
8e34b80f85 Fix small error in the Shorewall-init install script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 07:00:20 -07:00
Tom Eastep
cafeca0c0d Correct typo in Shorwall6-lite install script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 06:50:47 -07:00
Tom Eastep
ad9f66042d Fix manpage install in Shorewall6-lite
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 06:48:52 -07:00
Tom Eastep
2d19cd1ebb Add options to readlink
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 06:37:02 -07:00
Tom Eastep
9c0564831a Fix syntax error in generated shell script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 06:23:45 -07:00
Tom Eastep
f9425eeb1b Apply Tuomo's patch to shorewall-init.spec
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-24 06:23:26 -07:00
Tom Eastep
bfa93e2588 Fix install issues with Shorewall-init 2010-05-23 19:36:49 -07:00
Tom Eastep
f7d3bd933a Fixes to Shorewall-init 2010-05-23 17:49:51 -07:00
Tom Eastep
dcc66da50c Fixes to Shorewall-init 2010-05-23 17:49:06 -07:00
Tom Eastep
b7f03c5ada Fix some more install.sh issues 2010-05-23 17:43:17 -07:00
Tom Eastep
620f5cf76b More build fixes 2010-05-23 17:12:42 -07:00
Tom Eastep
0f7b4cf7f4 Fix logrotate issue 2010-05-23 17:01:31 -07:00
Tom Eastep
878e58fcf6 One more install.sh
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 16:36:23 -07:00
Tom Eastep
97306cb10c Rework shorewall-lite install.sh
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 16:26:14 -07:00
Tom Eastep
0ef4cd1653 Allow Debian install with PREFIX
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 16:10:36 -07:00
Tom Eastep
60c751b98f First stage rework of Shorewall install script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 16:02:28 -07:00
Tom Eastep
54e571fba9 Make install work with PREFIX and distro specified
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 15:34:42 -07:00
Tom Eastep
12f6933d5e Allow specification of distro when compiling with a PREFIX
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 14:44:35 -07:00
Tom Eastep
a539f4d646 Don'g clear the distro variables in the install script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 14:26:29 -07:00
Tom Eastep
78850c8169 Merge branch 'master' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall 2010-05-23 14:20:14 -07:00
Roberto C. Sanchez
f564a3f981 Implement required reload/force-reload parameters in init script. Make the DEBIAN and PREFIX environment variable not be mutually exclusive. 2010-05-23 17:10:50 -04:00
Tom Eastep
d32ed01cf0 Use readlink(1) where appropriate
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 13:37:26 -07:00
Tom Eastep
1b00aeb1bc Correct typo in install script
Replace /NetworkManager with /etc/NetworkManager

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 12:55:52 -07:00
Tom Eastep
2fc3fa0602 Some fixes for the RPM
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-23 12:53:56 -07:00
Tom Eastep
1fcff1d9cb Restore Required-start and Required-stop
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-21 12:46:22 -07:00
Tom Eastep
b9f7965a40 Correct run-levels
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-21 12:37:22 -07:00
Tom Eastep
66130f46c2 Add back Required-start and Required-stop
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-21 12:25:19 -07:00
Tom Eastep
abb20e909a Spec and init file fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-21 12:22:41 -07:00
Tom Eastep
4d0a3882be Replace calls to 'notdone'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-21 10:46:07 -07:00
Tom Eastep
d66206ba8b Correct issues with non-Debian init script
Remove 'Required*' lines
Correct PRODUCT->product

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-21 10:13:28 -07:00
Tom Eastep
1d87fc0102 Update .spec files with virtual requires/provides
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-21 10:12:37 -07:00
Tom Eastep
3db203cbb7 Revise summary and description in shorewall-init.spec 2010-05-21 07:17:16 -07:00
Tom Eastep
eaad566978 Update documents for Shorewall-lite 2010-05-20 17:06:53 -07:00
Tom Eastep
4264524448 Bump Version to 4.4.10-Beta2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-20 14:13:38 -07:00
Tom Eastep
2a870088d8 Remove 'close' from CLI programs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-20 14:09:40 -07:00
Tom Eastep
182f433772 Add note about supported distributions to release notes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-20 06:32:34 -07:00
Tom Eastep
896e18be00 Document REQUIRE_INTERFACE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-19 07:37:49 -07:00
Tom Eastep
50dc02da07 Implement the 'REQUIRE_INTERFACE' option.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-19 07:32:02 -07:00
Tom Eastep
62f3e5f009 Correct security on /usr/share/shorewall-init/ifupdown
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-19 06:55:07 -07:00
Tom Eastep
5a48ff978e Improve uninstall (both script and rpm)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-19 06:29:28 -07:00
Tom Eastep
06a17c8973 Adjust manpage specifications in spec file 2010-05-18 20:59:24 -07:00
Tom Eastep
159ddfcc55 Fix problem in the shorewall-init manpage 2010-05-18 20:49:17 -07:00
Tom Eastep
4e748f9255 Add Shorewall-init manpage and update release notes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 20:40:03 -07:00
Tom Eastep
4690075ed8 Start firewall on up event for optional interface.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 20:29:03 -07:00
Tom Eastep
fd696fbee7 Fix a silly bug in uninstall.sh
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 19:08:20 -07:00
Tom Eastep
00b79e8f3b Add .spec file 2010-05-18 16:34:49 -07:00
Tom Eastep
6983e9d3fe Uninstall Script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 15:42:26 -07:00
Tom Eastep
1eb5e5b081 Fail the install on unknown distros.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 15:30:53 -07:00
Tom Eastep
9c5fb89b4c Improve documentation in the release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 14:55:16 -07:00
Tom Eastep
13828bffbc Improve comments in the sysconfig file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 14:47:00 -07:00
Tom Eastep
0c9a0150d2 Document Shorewall-init; delete old auto-stop code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 14:42:39 -07:00
Tom Eastep
5b2affbd01 Changes to make RedHat work with NetworkManager
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 13:41:01 -07:00
Tom Eastep
592c9bbdbc Integrate Shorewall-init with NetworkManager on RedHat
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 12:49:09 -07:00
Tom Eastep
f9d187c288 Correct issues found in Fedora Testing
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 10:27:12 -07:00
Tom Eastep
bcf419fbce Correct problems with SuSE init.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-18 08:16:31 -07:00
Tom Eastep
9d3d66d4a2 Implement (untested) support for SuSE in shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-17 16:47:51 -07:00
Tom Eastep
9f535b670d Rename the ifupdown script.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-17 16:26:59 -07:00
Tom Eastep
499b0cddaa Log the text from startup errors.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-17 07:02:30 -07:00
Tom Eastep
a534bca914 Fix an existing bug in Shorewall6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-16 19:28:49 -07:00
Tom Eastep
a501222194 Fix some bugs in the Shorewall-init implementation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-16 17:41:09 -07:00
Tom Eastep
38cdd417eb Add Shorewall-init product
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-16 15:35:22 -07:00
Tom Eastep
4f428d8135 De-implement 'close'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-16 15:31:41 -07:00
Tom Eastep
749d6be64e Add 'optional' interfaces to updown processing.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-15 17:06:00 -07:00
Tom Eastep
a3589dc6e9 Implement the 'up' and 'down' script commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-15 12:48:04 -07:00
Tom Eastep
ff388ca5c4 Detect the 'closed' state in the status command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-15 12:46:47 -07:00
Tom Eastep
b42d80cb29 Update 'wait' documentation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-15 09:59:57 -07:00
Tom Eastep
88188202cc Add 'wait' interface option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-15 09:52:46 -07:00
Tom Eastep
16e451a7d8 Add 'required' interface option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-15 09:04:32 -07:00
Tom Eastep
a2758421ed Bump version to 4.4.10-Beta1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-13 17:03:14 -07:00
Tom Eastep
5bab407da2 Remove mention of 4.5 from the Documentation Index
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-13 16:40:07 -07:00
Tom Eastep
46b3a2a81a Remove dire threats about installing remotely
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-13 16:40:01 -07:00
Tom Eastep
529f9a07b4 Update Rules.pm version to 4.4.10 2010-05-13 16:39:52 -07:00
Tom Eastep
a0a08c918d Apply patch from Fog_Watch 2010-05-13 16:39:39 -07:00
Tom Eastep
a04d8126e1 Finish implementing 'close'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-13 16:39:01 -07:00
Tom Eastep
1d0b8b1cec Correct syntax error in generated code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-13 16:32:42 -07:00
Tom Eastep
449ca038ba Implement 'close' command 2010-05-13 16:29:25 -07:00
Tom Eastep
3a00254594 Merge branch 'master' of ssh://teastep@shorewall.git.sourceforge.net/gitroot/shorewall/shorewall 2010-05-08 16:32:42 -07:00
Tom Eastep
74c515016e Add back stuff merged earlier: 2010-05-08 16:32:03 -07:00
Tom Eastep
a2ad074179 Measure twice, cut once 2010-05-08 13:58:54 -07:00
Tom Eastep
4646920df4 fix typo 2010-05-08 13:55:33 -07:00
Tom Eastep
50e510702d Yet even more fixes for build on a Mac 2010-05-08 13:53:00 -07:00
Tom Eastep
caf2f79f6c Yet more fixes for build on a Mac 2010-05-08 13:42:41 -07:00
Tom Eastep
5f4d3cd2dc More fixes for build on a Mac 2010-05-08 13:35:21 -07:00
Tom Eastep
0c8007efa7 Don't set SPARSE when building on a Mac 2010-05-08 12:58:57 -07:00
Tom Eastep
111bfa9fef Modify first attempts to allow installaton on a Mac
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-08 12:51:04 -07:00
Roberto C. Sanchez
2a42998d97 Fix typo. 2010-05-08 15:03:17 -04:00
Tom Eastep
6991a844c8 Fix broken link 2010-05-07 20:33:37 -07:00
Tom Eastep
e9b836bbad Document OS X as an Administrative system
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-06 09:07:33 -07:00
Tom Eastep
679ad6cf04 Allow OS X to be an Administrative System
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-06 09:07:16 -07:00
Tom Eastep
65a5d34276 Update Module Versions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-03 12:46:29 -07:00
Tom Eastep
96bef5bd49 Assume 'routeback' in routestopped based on interface config.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-03 12:31:11 -07:00
Tom Eastep
13d5864f23 Update Shorewall6 mDNS macro.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-03 10:21:19 -07:00
Tom Eastep
fca404eeaf Update version to 4.4.9
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-03 10:02:02 -07:00
Tom Eastep
c7848be266 Back out the rest of the original change for dup / -[psiod]
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-03 09:59:25 -07:00
Tom Eastep
70c6a2cdf3 Update version to 4.4.9-RC2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-02 07:25:50 -07:00
Tom Eastep
7d2df848c9 Tighten up the new mDNS rule 2010-05-01 12:13:02 -07:00
Tom Eastep
9bcd9fd12b Allow for mDNS multicast responses 2010-05-01 12:01:58 -07:00
Tom Eastep
639b3ea57d Simplify checking for /! -[piosd] /
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-01 09:13:16 -07:00
Tom Eastep
311372013d More fixes to optimization
Only disallow / ! -[piosd] / if the target is a chain

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-01 08:58:41 -07:00
Tom Eastep
5456c9fba3 Add instructions for proxying firewall-local connections
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-01 08:26:22 -07:00
Tom Eastep
518416ec2e Add a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-01 08:08:39 -07:00
Tom Eastep
94c6b37e8e Avoid leaving an orphan '!' behind.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-01 07:51:24 -07:00
Tom Eastep
219b2e0761 A more comprehensive solution to multiple -[piosd] matches.
- eliminate duplicate -[piosd] matches in merged rules
- avoid tracing !* unconditionally

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-01 07:26:25 -07:00
Tom Eastep
16161d9cfc Add new trace types.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-05-01 06:43:09 -07:00
Tom Eastep
1173518d78 More minor cleanup of first code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-30 07:22:09 -07:00
Tom Eastep
2864841a9e Correct release notes
update version to RC1
correct typo

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-29 11:21:31 -07:00
Tom Eastep
076da4bd5c Couple of tweaks to my earliest code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-29 11:19:50 -07:00
Tom Eastep
83d8d497d7 Correct typos in IPSEC article.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-28 08:12:41 -07:00
Tom Eastep
a997d6507d Update release notes with more common example of failure.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-28 08:09:10 -07:00
Tom Eastep
039668b333 Update release notes to reflect reality.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-28 06:57:45 -07:00
Tom Eastep
2c1cede54e Revise addressless bridge change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-27 15:23:38 -07:00
Tom Eastep
013567496c Update manpages for addressless bridge
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-27 12:40:57 -07:00
Tom Eastep
d8b0f496df Allow simple configuration of a bridge with no IP address
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-27 12:26:58 -07:00
Tom Eastep
4b6bff7693 Add link from the netmap article to the OpenVPN doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-27 07:04:33 -07:00
Tom Eastep
eab6387817 Add solution for handling duplicate networks in an OpenVPN environment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-27 07:04:06 -07:00
Tom Eastep
40bc2cc4a2 Update Link
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-26 18:06:16 -07:00
Tom Eastep
988f7c4d7e More fixes for bad NAT optimization
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-26 16:50:18 -07:00
Tom Eastep
f49848bd5b Document rare optimization fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-26 16:32:53 -07:00
Tom Eastep
0e4698d57c Fix rare optimization bug
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-26 16:19:58 -07:00
Tom Eastep
6e04c7eec8 Mention 6in4 Tunnels in the Documentation Index
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-26 11:11:12 -07:00
Tom Eastep
6d61e962eb Use -m conntrack if available in place of -m state
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-25 13:35:41 -07:00
Tom Eastep
21e0c68ef2 Bump version to 4.4.9 RC1 2010-04-25 09:37:17 -07:00
Tom Eastep
fb2ddcee7b Bump Version to 4.4.9 Beta 5 2010-04-24 21:53:12 -07:00
Tom Eastep
33801bb8a9 Add 6in4 information to 6to4 article 2010-04-24 19:53:15 -07:00
Tom Eastep
f2f8bcd804 Add link to 2010 Linuxfest presentation 2010-04-24 08:06:07 -07:00
Tom Eastep
6053352f8c A better fix for find_first_interface_address()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-23 20:06:45 -07:00
Tom Eastep
2cb3bac946 Document fix for find_first_interface_address() 2010-04-23 12:18:51 -07:00
Tom Eastep
232fc21fe2 Allow find_first_interface_address[_if_any] to work properly in the params file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-23 11:54:36 -07:00
Tom Eastep
b821bdcdfd One more pass at improving regex's for target isolation and matching
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-22 14:45:34 -07:00
Tom Eastep
64bf772594 Set OUTPUT policy to ACCEPT when optimize_chain deletes all of its rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-22 13:38:38 -07:00
Tom Eastep
b0b39cfc39 Document optimization level 2 fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-22 11:55:13 -07:00
Tom Eastep
fb754b3a2e Don't remove a lone ACCEPT rule from the OUTPUT chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-22 11:35:14 -07:00
Tom Eastep
0dde75d345 Fix install scripts (again)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-19 13:08:03 -07:00
Tom Eastep
a0abb11f67 Extend 'show log <ipaddr>' to search for a regular expression.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-19 13:02:21 -07:00
Tom Eastep
8c09f21e5d Implement 'show log <token>'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-19 10:20:28 -07:00
Tom Eastep
32d3e50c05 Remove extra <emphasis> <\emphasis>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-17 08:54:37 -07:00
Tom Eastep
66a07c3ce6 Update copyright in UPnP Doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-17 08:51:57 -07:00
Tom Eastep
a620aa22f9 Remove outdated information from the UPnP doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-17 08:51:11 -07:00
Tom Eastep
a1a78cf09b Abandon the fantesy that multiple optimize 8 passes will achieve anything.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 17:12:08 -07:00
Tom Eastep
938cfd7ba4 Don't create fw-><bport> chains and rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 12:29:51 -07:00
Tom Eastep
c52a3dcd14 Don't generate policy chains for fw to bridgeport zones.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 09:56:11 -07:00
Tom Eastep
1030c852f9 Simplify a test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 09:21:30 -07:00
Tom Eastep
e7a4aaafc1 Modify optimization 8 loop to continue until no chains are combined.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 09:17:57 -07:00
Tom Eastep
8e1284f74c Document OPTIMIZE=15
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 09:17:12 -07:00
Tom Eastep
4f00de0c57 Make additional optimize 8 passes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 08:42:25 -07:00
Tom Eastep
21b44ac42b Change version to 4.4.9-Beta4
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 07:25:53 -07:00
Tom Eastep
0a9b7c75d0 Delete misleading wording in the explaination of rate limiting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-16 06:24:35 -07:00
Tom Eastep
82d6ba511f Unify the REs that look for '-[jg] <chain>'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 18:02:31 -07:00
Tom Eastep
cec59360f6 Use '-j' rather than '-g' when jumping to tcpre, just to be safe
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 14:14:13 -07:00
Tom Eastep
46d207a86f Restore original amount of whitespace in maclist rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 14:13:37 -07:00
Tom Eastep
e9a94b0cfb Unify reference count adjustment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 14:12:48 -07:00
Tom Eastep
cf59d9ec68 Fix an optimize 8 bug.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 12:45:00 -07:00
Tom Eastep
dde540c42d Update release notes for optimize 4 problems.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 12:44:37 -07:00
Tom Eastep
c1bcf360ee Fix another 'add_rule' that should have been an 'add_jump'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 09:59:57 -07:00
Tom Eastep
f7e48a94da Fix install scripts.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 09:39:21 -07:00
Tom Eastep
96d69bd8c3 Centralize message generation; optimize optimization-8 loop
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 09:29:37 -07:00
Tom Eastep
9ad5ee1818 Add correct release id.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-15 07:25:35 -07:00
Tom Eastep
704eb1ee8e Fix lib.private in the Multi-ISP doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-14 19:05:42 -07:00
Tom Eastep
aeb90969f7 Optimize 8 Documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-14 17:12:25 -07:00
Tom Eastep
cff6f0010f Remove chain name after '-A' (again).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-14 17:05:03 -07:00
Tom Eastep
f8bacb54ef Optimize 8
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-14 13:21:10 -07:00
Tom Eastep
3b6b7a4099 Add simple tc files to basics doc 2010-04-11 17:00:19 -07:00
Tom Eastep
b3f57ae5dc Add 'preview' to Perl doc 2010-04-11 14:31:32 -07:00
Tom Eastep
eb0abb3dd7 Remove 'Beta' status from 4.4 2010-04-11 12:49:30 -07:00
Tom Eastep
4137961169 Speed up the replace_references* functions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-11 09:00:24 -07:00
Tom Eastep
715ea9ef32 Speed up delete_jumps()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-11 08:38:14 -07:00
Tom Eastep
91a711b34f Document startup log fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-10 11:54:54 -07:00
Tom Eastep
4365b83b15 Rationalize init logs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-10 11:46:50 -07:00
Tom Eastep
76b9ef7005 Use unshift rather than splice for readability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-10 09:25:29 -07:00
Tom Eastep
2e443df8e3 Adjust references in move_rules()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-10 09:09:46 -07:00
Tom Eastep
ff73d802da More cleanup of rule and chain deletion:
- Rename purge_jumps() to delete_jumps()
- Add delete_chain() function
- Remove an unnecessary assertion

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-10 08:37:17 -07:00
Tom Eastep
1de304bfd9 Relocate purge_jumps() and change the loop exit condition to be a bit safer.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 13:51:44 -07:00
Tom Eastep
14477d61fe Verify that purge_jumps() reset the 'to' chain's referenced flag.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 12:28:01 -07:00
Tom Eastep
627468432e Merge branch 'master' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall 2010-04-09 11:38:55 -07:00
Tom Eastep
2ff1df53da Unify chain deletion.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 11:38:18 -07:00
Tom Eastep
14a1a08337 Unify deletion of rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 11:32:34 -07:00
Tom Eastep
7a831107c7 Replace the complex rule deletion loops with C-stype for loops.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 09:58:32 -07:00
Tom Eastep
9dc8267888 Don't apply RE to rules that we've already checked.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 09:46:07 -07:00
Tom Eastep
1e078b8c8d Use splice() to delete rules from chains
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 09:38:03 -07:00
Tom Eastep
2f3f591af1 Document removal of fallback scripts.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 07:43:36 -07:00
Tom Eastep
b20d5ec227 Delete remaining fallback scripts
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 07:38:46 -07:00
Tom Eastep
56bc28a182 Prepare 4.4.9 Beta 3
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-09 07:32:21 -07:00
Tom Eastep
c2c0fb0dd2 Fix deletion of only rule in a chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-08 17:20:11 -07:00
Tom Eastep
ab1a27ca2a Update version to 4.4.9 Beta 2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-08 13:14:51 -07:00
Tom Eastep
9a00191c88 Remove a 'defined' test that is no longer needed.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-08 13:12:17 -07:00
Tom Eastep
359c221783 Keep rules arrays compressed throughout the compilation process
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-08 12:53:30 -07:00
Tom Eastep
3937c10251 Keep rule arrays compressed during optimization
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-08 11:35:15 -07:00
Tom Eastep
9126cc63d9 Delete unused rules arrays
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-08 10:55:31 -07:00
Tom Eastep
c668707aac Update release docs with optimize 4 fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 20:18:56 -07:00
Tom Eastep
cca2c18370 Another case where reference counts are wrong
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 20:07:03 -07:00
Tom Eastep
aeb3b277b0 Fix reference count issue
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 19:47:49 -07:00
Tom Eastep
9d7d7e06d8 Update release documents
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 14:43:50 -07:00
Tom Eastep
48692f5c4a Fix find_first_interface_address() in IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 14:38:56 -07:00
Tom Eastep
3711e64d71 Fix for 0 values propagated to the script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 14:38:29 -07:00
Tom Eastep
3092a85999 SWAG regarding LOG_VERBOSITY issue
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 13:43:57 -07:00
Tom Eastep
c49e3076ec Recode fix for find_first_interface_address()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 13:28:07 -07:00
Tom Eastep
eb47b9b54f Add a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 13:17:11 -07:00
Tom Eastep
62c9cb7b36 Change 'first_install' tests
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 13:16:16 -07:00
Tom Eastep
f17365cf6d Fix find_first_interface_address()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-07 13:05:42 -07:00
Tom Eastep
7ab3c6a612 Add /etc/shorewall/interfaces to the IFB instructions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-06 16:14:58 -07:00
Tom Eastep
450f2787ba Cover 1:1 NAT in FAQ 2d.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-06 08:06:06 -07:00
Tom Eastep
9bf87bc5e1 Add FAQ 2d.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-06 08:02:20 -07:00
Tom Eastep
a670c05043 Reword reference to RFC 4787.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-06 07:48:35 -07:00
Tom Eastep
5e30c5683c Tone down response to Shorewall FAQ 2 and provide RFC reference.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-06 07:44:43 -07:00
Tom Eastep
3b317afb2f Add mDNS macro from Vincent Smeets.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-04-03 15:57:50 -07:00
Tom Eastep
430cbf310f Revise FAQ 73 to match reality.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-31 08:38:29 -07:00
Tom Eastep
427b14b21d Clean up file headers in the .conf files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-30 11:53:36 -07:00
Tom Eastep
ee8270aadf Correct typo in the FAQ.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-30 11:35:33 -07:00
Tom Eastep
9a720cf516 Further clarify the use of log levels with macros
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-30 08:14:32 -07:00
Tom Eastep
18bb6c94ca Improve formatting of 'rules' manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-30 08:08:57 -07:00
Tom Eastep
af893b6296 Add 'N' trace records for chain creation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-30 07:32:38 -07:00
Tom Eastep
c57ee7d68d Update release notes with additional trace information.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-30 07:23:17 -07:00
Tom Eastep
b2d8039ff6 Remove unnecessary text and 'before' images from trace entries
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-30 07:12:22 -07:00
Tom Eastep
7e97e9519d Conditionally trace writes by copy2().
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-29 11:56:26 -07:00
Tom Eastep
51d4bf19b5 Conditionally trace writes by copy2().
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-29 11:56:06 -07:00
Tom Eastep
dc7d4bdb09 Document CS->GS trace change.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-29 09:50:42 -07:00
Tom Eastep
350a89e449 More complete generated script trace
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-29 09:48:23 -07:00
Tom Eastep
5c91fb40e2 Remove unneeded test; correct typo
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-29 09:04:45 -07:00
Tom Eastep
db2bed06d8 Add 'T' to the documented netfilter trace types.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-29 08:31:12 -07:00
Tom Eastep
b261a5b2ec Document netfilter trace types.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-29 07:23:17 -07:00
Tom Eastep
6d7226ae93 Remove special trace entries
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-28 16:31:03 -07:00
Tom Eastep
1fd656b8c9 Tweak trace facility
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-28 15:31:05 -07:00
Tom Eastep
3b07053d3b Document new 'trace' facility
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-28 14:37:22 -07:00
Tom Eastep
b0733d93ee Implement a more robust trace
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-28 13:09:04 -07:00
Tom Eastep
ef4237f5a0 Avoid verbosity overflow/underflow
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-28 07:27:27 -07:00
Tom Eastep
5ad0088ce7 Describe required quoting in shorewall[6].conf
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-28 07:12:16 -07:00
Tom Eastep
1236cccc6a Set 'forward=1' on all interfaces in the multi-interface samples
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-27 16:46:05 -07:00
Tom Eastep
3e215d0482 Minor cleanup in the Chains module.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-27 08:18:41 -07:00
Tom Eastep
1153ff0c75 Avoid a shell warning when brctl is not installed.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-27 07:33:40 -07:00
Tom Eastep
f30cd7e287 Clarify provisional policy handling.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-26 08:02:49 -07:00
Tom Eastep
ad08d2195e Add a short section about bridged OpenVPN configurations.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-25 15:30:46 -07:00
Tom Eastep
5a36606167 Document fix of EXTERNAL handling in proxyarp.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-25 12:13:52 -07:00
Tom Eastep
6cdc1ab7a2 Allow a logical interface name in the EXTERNAL column of the proxyarp file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-25 11:41:06 -07:00
Tom Eastep
a0a5c55a63 Add omitted defect to 4.4.8 problems corrected
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-25 10:14:39 -07:00
Tom Eastep
7d91edc6ec Remove redundant line of code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-23 12:49:06 -07:00
Tom Eastep
626b28fcd0 Auto-detect bridge when no options specified. Remove extra logic.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-23 09:28:11 -07:00
Tom Eastep
05752dcf0b Auto-detection of bridges -- release documents.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-23 08:58:44 -07:00
Tom Eastep
5e9aceae68 Detect bridges
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-23 08:38:54 -07:00
Tom Eastep
8fc1a08766 Expand Split DNS Article 2010-03-22 19:57:23 -07:00
Tom Eastep
f9327d34e1 Add 'blacklst' to the documented unoptimized chains.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-22 06:58:29 -07:00
Tom Eastep
914d829a49 Don't optimize the 'blacklst' chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-22 06:47:39 -07:00
Tom Eastep
2e7a0297db More LOGBURST/LOGRATE clarification.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-21 07:35:38 -07:00
Tom Eastep
6ac549ef4e Add a comment explaining why avoiding creation of the blacklst chain
and branching to it is a bad idea.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-21 07:24:29 -07:00
Tom Eastep
925c61f6bd Additional advice re: LOGBURST and LOGRATE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-20 07:08:10 -07:00
Tom Eastep
6fc347b9be Prepare 4.4.9-Beta1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-20 07:06:47 -07:00
Tom Eastep
9a88156769 Back off on not jumping to the blacklist chain when there are no blacklist entries.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-19 11:32:22 -07:00
Tom Eastep
fae29bcf6f Change version to 4.4.8
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-19 10:17:32 -07:00
Tom Eastep
508475d80b Avoid panic among the user base by suppressing missing table error messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-19 10:10:20 -07:00
Tom Eastep
b22b279bd1 Some additional idiot-proofing.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-19 10:01:02 -07:00
Tom Eastep
a71f5df64f Fix indentation and quoting in TC progress messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-19 06:59:58 -07:00
Tom Eastep
f44dbcf20b More copyright updates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-18 11:13:51 -07:00
Tom Eastep
91bc3b3293 Mark a restored configuration as 'Restored' rather than 'Started'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-17 10:10:56 -07:00
Tom Eastep
1177540fd8 Update version to RC2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-16 12:39:35 -07:00
Tom Eastep
66c883de2c Fix UDPLITE handling of source port when no dest port given.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-16 10:45:31 -07:00
Tom Eastep
b2a56cd542 Copyright update
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-16 09:53:51 -07:00
Tom Eastep
a01fa345b7 Add support for UDP Lite
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-16 09:42:50 -07:00
Tom Eastep
5ac2b16936 Correct typo in comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-16 08:49:17 -07:00
Tom Eastep
16bbe780c7 Try to avoid printing import banners unnecessarily
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-16 07:23:02 -07:00
Tom Eastep
787cec4fe7 Fix 'uninitialized variable' bug in Config::copy2
Bug reported by Tuomo Soini

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-16 07:12:39 -07:00
Tom Eastep
472425cc62 Add FAQ 6c re: dmesg 2010-03-12 12:22:39 -08:00
Tom Eastep
a2ac726ce9 Add changelog entry
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-11 18:16:31 -08:00
Tom Eastep
196cd5417f Allow 'default' optimizations to be disabled by specifying optimization 4096.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-11 17:15:44 -08:00
Tom Eastep
57dc5731b2 Add change log entry
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-10 17:31:35 -08:00
Tom Eastep
249f9412f6 Add undocumented OPTIMIZE=-1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-10 17:31:08 -08:00
Tom Eastep
4f32be03d7 Fix typo in comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-08 15:34:38 -08:00
Tom Eastep
0fb9333346 Update release model doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-08 13:50:24 -08:00
Tom Eastep
93494c6ae3 Eliminate nested function declarations in generate_matrix()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-08 13:11:10 -08:00
Tom Eastep
fb4f7ebd67 Update release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-08 08:18:10 -08:00
Tom Eastep
07cba9e066 Bump version to RC1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-08 08:11:00 -08:00
Tom Eastep
efed2286b0 Move qt1() to lib.common
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-07 11:50:54 -08:00
Tom Eastep
696f7d6b2b Update copyright on basics doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-07 09:34:27 -08:00
Tom Eastep
ce8d1cbc59 Change port range in release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-07 08:39:09 -08:00
Tom Eastep
f246f728e7 Flag '-' used as a port range separator
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-07 08:36:26 -08:00
Tom Eastep
7ee96c41e0 Tweak OpenVZ doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-07 07:26:12 -08:00
Tom Eastep
1c293d17dc Formatting improvements in OpenVZ doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 12:46:42 -08:00
Tom Eastep
9b1483d93e Update OpenBZ Doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 12:40:52 -08:00
Tom Eastep
4e18414fd7 Uninstall the logrotate scripts
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 09:24:51 -08:00
Tom Eastep
5671a7ae2f Add new options to online usage info.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 08:45:43 -08:00
Tom Eastep
88447bfc7d Avoid dropping first line of library source text
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 08:45:21 -08:00
Tom Eastep
2d458b46b4 Update help text in prog.header*
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 08:13:33 -08:00
Tom Eastep
928b162d3c Fix bug in handling of -p option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 08:12:04 -08:00
Tom Eastep
7557b4b5fb Update version to 4.4.8 Beta 3
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 07:41:29 -08:00
Tom Eastep
fe089ddc36 Don't copy headers in imported libraries
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 07:40:43 -08:00
Tom Eastep
e9dffbace2 Correct Type in Extension Script Doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-06 06:43:14 -08:00
Tom Eastep
bcfa98bf4d Remove extraneous comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-05 11:36:22 -08:00
Tom Eastep
117d79ec02 Remove duplicate declaration
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-05 11:33:43 -08:00
Tom Eastep
c8d8d75cae Cosmetic change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-05 10:40:18 -08:00
Tom Eastep
707ec67430 Corrections/additions to IPv6 shell libraries.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-05 07:59:03 -08:00
Tom Eastep
35974535b2 More removal/relocation of functions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-05 07:29:27 -08:00
Tom Eastep
f8c7a284a5 Remove duplicate/unneeded functions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-05 07:02:00 -08:00
Tom Eastep
8e5114859c Only load lib.base and lib.cli (lib.base loads lib.common)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-05 06:51:13 -08:00
Tom Eastep
b4d4cedef9 Fix silly bug in 'show dynamic <zone>'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 19:05:47 -08:00
Tom Eastep
a0ea84a8c6 Make the -lite command line tools compatible with lib.common
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 14:05:31 -08:00
Tom Eastep
f06bb65ffb Correct variable handling in shorecap
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 13:19:18 -08:00
Tom Eastep
abb943bfb7 Do library consolidation on IPv6 and load lib.cli into shorecap.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 13:11:33 -08:00
Tom Eastep
50330f71f6 Move many routines into lib.common.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 12:38:02 -08:00
Tom Eastep
3e4d9b3118 Rename lib.run -> lib.common 2010-03-04 12:13:41 -08:00
Tom Eastep
7757c0bc20 Rename lib.run to lib.common
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 09:54:56 -08:00
Tom Eastep
41d709b043 Allow 'get_script_version' to correctly handle point releases
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 09:40:48 -08:00
Tom Eastep
7b52d812ae Generate correct library path name
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 09:40:18 -08:00
Tom Eastep
24432a5f76 Back out dumb change to install.sh
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 09:17:57 -08:00
Tom Eastep
4c081e5998 Add lib.run
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-04 09:12:48 -08:00
Tom Eastep
5d87983803 Update change log. Remove anacronistic comment.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 16:14:15 -08:00
Tom Eastep
1d52683af8 Don't display 'Old' capabilities that are not enabled.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 15:28:49 -08:00
Tom Eastep
a963c8f955 Don't export CONFDIR or SHAREDIR
Document CONFDIR, SHAREDIR and VARDIR
Add FILEMODE to the old reserved variable names

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 11:46:23 -08:00
Tom Eastep
a4414a9695 Delete references to unimplemented functions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 10:53:40 -08:00
Tom Eastep
3f73b3c408 Export *DIR variables
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 10:39:18 -08:00
Tom Eastep
49c1350aa0 Documentation for final cleanup of variable names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 10:28:09 -08:00
Tom Eastep
c6981de0e5 Complete elimination of globals that are not .conf options
Documentation to follow

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 09:50:07 -08:00
Tom Eastep
ee74696747 IPv6 work to only export when necessary
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 08:59:58 -08:00
Tom Eastep
234e4fa754 Update module versions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 08:51:55 -08:00
Tom Eastep
7457f643ee Don't export globals when the script is 4.4.8 or later
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-03 08:51:40 -08:00
Tom Eastep
70296b4bd6 Some fixes for -lite changes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 17:16:11 -08:00
Tom Eastep
78a39ccad5 Centralize exporting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 16:03:44 -08:00
Tom Eastep
cce4bf277a Reduce export usage; Allow PURGE and RESTOREFILE to be specified on the run-line
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 14:49:31 -08:00
Tom Eastep
2656a9b0c7 Eliminate use of PRODUCT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 12:34:36 -08:00
Tom Eastep
5613d0105a Remove all reliance on HOSTNAME
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 11:59:38 -08:00
Tom Eastep
68f5215f07 Remove Reliance on HOSTNAME in generated programs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 11:45:35 -08:00
Tom Eastep
82bb80cbba Put real fwlogwatch output in the FAQ
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 08:18:20 -08:00
Tom Eastep
55e1124bbe Update docs regarding VERSION
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 08:18:01 -08:00
Tom Eastep
3ea6f6792f Eliminate VERSION reserved variable name
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 08:02:10 -08:00
Tom Eastep
5fc6d58e19 Eliminate STOPPING variable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 07:37:30 -08:00
Tom Eastep
d4936f4bad Tweak to an RE used in optimization
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-02 06:58:09 -08:00
Tom Eastep
9ec5f36549 Add fwlogwatch info 2010-03-01 12:17:09 -08:00
Tom Eastep
169f97d76b Fix typo
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-01 11:28:54 -08:00
Tom Eastep
8cfcacc862 Update release document with fix for multiple policy matches
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-01 08:40:20 -08:00
Tom Eastep
f11bfd3890 Eliminate redundate setting of PRODUCT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-01 08:32:59 -08:00
Tom Eastep
cfa09dce22 Avoid multiple policy matches with OPTIMIZE=7 and not KLUDGEFREE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-01 08:32:37 -08:00
Tom Eastep
3ba797cb14 Correct several bugs in the VERBOSITY overhaul
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-03-01 06:57:04 -08:00
Tom Eastep
53c73bc8e9 Eliminate VERBOSE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 17:58:01 -08:00
Tom Eastep
14f83759ae Propagate VERBOSITY even though we don't use it yet
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 17:39:35 -08:00
Tom Eastep
5d840e336a Rectify anachronistic README files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 17:30:52 -08:00
Tom Eastep
546a48543d Propagate LOG_VERBOSITY
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 17:30:11 -08:00
Tom Eastep
f98e772c96 Implement verbose changes in the -lite products
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 17:13:49 -08:00
Tom Eastep
39883aa690 Eliminate LOG_VERBOSE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 16:58:30 -08:00
Tom Eastep
fb55d63eaf Allow verbosity to be separate from -V
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 16:42:50 -08:00
Tom Eastep
333ac21c2f Prepare the footers for 4.6.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 15:25:25 -08:00
Tom Eastep
83ed0a401b I'll eventually get it the way I like it
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 13:45:33 -08:00
Tom Eastep
585711caa8 Even simpler RE for detecting builtins
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 13:29:26 -08:00
Tom Eastep
693d0e5d4c Make new test in add_jump() a bit safer.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 12:44:29 -08:00
Tom Eastep
91a14b4e82 Make -s the default on Debian; Issue message when installing in a distro-specific way
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 09:15:11 -08:00
Tom Eastep
d2992c21f4 Update version to Beta 2 2010-02-28 09:04:37 -08:00
Tom Eastep
c9c957c5b8 HKP Macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-28 07:37:16 -08:00
Tom Eastep
8fadaa8f2c Add FAQ 25a 2010-02-27 16:56:23 -08:00
Tom Eastep
f0dc720740 Document -s installer option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-27 12:09:48 -08:00
Tom Eastep
3c4b41fbe0 Implement -s option in the major installers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-27 11:48:39 -08:00
Tom Eastep
643d4831ab More all-caps variable elimination
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-26 17:05:35 -08:00
Tom Eastep
061d850c16 Rename RESTOREPATH to g_restorepath
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-26 08:35:50 -08:00
Tom Eastep
c1ac19a81e Correct a couple of typos 2010-02-25 16:35:19 -08:00
Tom Eastep
8aaddf368b More reserved variable names documented
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-25 12:37:22 -08:00
Tom Eastep
e66b8759d6 Document variable name changes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-25 12:18:41 -08:00
Tom Eastep
abbcf8eba4 Correct handling of NFQUEUE(queue-num) in policies 2010-02-25 08:53:31 -08:00
Tom Eastep
7fe7ebc891 Fix Handling of NFQUEUE(queue-num) in policies
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-25 08:44:28 -08:00
Tom Eastep
4059fe6956 Belatedly update some version numbers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-25 08:43:32 -08:00
Tom Eastep
dd004bacb9 Belatedly update some version numbers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-25 07:51:08 -08:00
Tom Eastep
4dedc26d9e Correct handling of NFQUEUE(queue-num) as a policy.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-25 07:50:17 -08:00
Tom Eastep
cd2056f0aa Apply the preceding change to Shorewall6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-23 17:01:44 -08:00
Tom Eastep
4415050fd2 Eliminate another reserved variable name
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-23 17:00:26 -08:00
Tom Eastep
bffb1793d7 More global variable renaming
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-23 07:52:35 -08:00
Tom Eastep
570497766b Add COMMAND to the list of reserved variable names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-23 07:18:54 -08:00
Tom Eastep
70a246501e Update version of Tc.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-23 07:08:48 -08:00
Tom Eastep
4320ebb8b0 Add SW_* to the list of reserved variable names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-23 06:57:29 -08:00
Tom Eastep
b2350829b9 Rename 'debugging' to 'g_debugging'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-22 16:43:38 -08:00
Tom Eastep
3fc10cd94b Prepend 'SW_' to constructed shell variable names.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-22 10:27:59 -08:00
Tom Eastep
efa41d1801 Correct a typo 2010-02-22 08:36:31 -08:00
Tom Eastep
88d29d2e35 Eliminate a couple of more all-caps variable name restrictions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-22 08:24:29 -08:00
Tom Eastep
20ca22d437 Eliminate some of the all-caps variable name restrictions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-22 08:23:17 -08:00
Tom Eastep
55c9cf3e99 Eliminate some of the reserved all-caps variable names
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-22 08:05:23 -08:00
Tom Eastep
6165a50e49 Apply debian init script change to the other packages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-21 16:42:02 -08:00
Tom Eastep
56bcb5ebc4 Remove mention of variable name change from shorewall6-params
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-21 15:19:26 -08:00
Tom Eastep
8bc6f2144a Remove mention of variable name change in 4.4.8
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-21 15:14:40 -08:00
Tom Eastep
8c3bb22511 Additions to reserved shell variables 2010-02-21 08:34:21 -08:00
Tom Eastep
2a965d42b9 Add a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-21 07:57:34 -08:00
Tom Eastep
70242c0d00 Correct typo in Build document
separete -> separate

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-21 06:58:23 -08:00
Tom Eastep
3a9416fb87 Correct Build article:
- Change lists.shorewall.net to www1.shorewall.net
- Correct partial upload example

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-21 06:56:12 -08:00
Tom Eastep
e690303937 Modify Roberto's patch for 'show <chain>' error reporting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-20 19:09:54 -08:00
Tom Eastep
8baa4e60c9 Merge branch 'master' of ssh://teastep@shorewall.git.sourceforge.net/gitroot/shorewall/shorewall 2010-02-20 18:59:17 -08:00
Roberto C. Sanchez
6a3b2b0dee Clarify error message when user asks shorewall to show a non-existent chain 2010-02-20 21:57:45 -05:00
Tom Eastep
6307653a01 Pick up one fix from 4.4.7.4 regarding CONTINUE rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-20 09:42:58 -08:00
Tom Eastep
5696742ef3 Update release Document with 4.4.7.5 changes and Debian Init Script Fix
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-20 08:34:47 -08:00
Tom Eastep
a83663bf25 Return failure status when a supported command fails.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-20 08:20:42 -08:00
Tom Eastep
edaf541850 Don't apply rate limiting twice in ACCEPT+ rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-19 14:01:45 -08:00
Tom Eastep
c030bc900c List variable names to be avoided in manpages and config file basics doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-19 08:12:56 -08:00
Tom Eastep
ceff8adc78 Restore duplicate interface detection in tcinterfaces.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-18 16:11:30 -08:00
Tom Eastep
3a2173ddb4 Some code cleanup in Tc.pm.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-18 15:56:59 -08:00
Tom Eastep
ea8be87720 Use Hex representation of device numbers > 9 in simple TC.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-18 12:53:01 -08:00
Tom Eastep
4e0225a4c3 Update Documentation for per-IP rate limiting fixes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-18 07:12:36 -08:00
Tom Eastep
ea8a6c837f Document per-IP rate change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-17 15:41:12 -08:00
Tom Eastep
00b0490cd7 Create a unique hashtable for each instance of a per-IP rate limit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-17 15:39:21 -08:00
Tom Eastep
625963a4f0 Final (hopefully) fix for SFQ handle assignment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-17 09:02:18 -08:00
Tom Eastep
41bb0782a3 Another tweak to SFQ handle assignment.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-17 08:06:27 -08:00
Tom Eastep
5649dbf9a8 Improve assignment of class ID for SFQ classses
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-17 07:41:30 -08:00
Tom Eastep
115ce7b87d Update release documents for bug fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-17 06:49:13 -08:00
Tom Eastep
eaafeb8c2b Add --hashlimit-htable-expire if the units are minutes or larger 2010-02-17 06:43:52 -08:00
Tom Eastep
375160d733 Avoid duplicate SFQ class numbers 2010-02-17 06:43:16 -08:00
Tom Eastep
167b29c2c5 Bump module version in Compiler.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-15 14:24:52 -08:00
Tom Eastep
8aaf4aab3a Don't create log chain for 'RETURN' rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-15 14:24:00 -08:00
Tom Eastep
4546394531 Cosmetic changes to Compiler.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-15 14:07:35 -08:00
Tom Eastep
5d08d51fe5 Add $remote_fs to Required-Start and Required-Stop for Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-15 08:39:50 -08:00
Tom Eastep
12d3420a5d Detect FLOW_FILTER when LOAD_HELPERS_ONLY=No 2010-02-14 10:34:19 -08:00
Tom Eastep
ba01cecbcd Explain RATE and BURST in the basics doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-14 08:54:34 -08:00
Tom Eastep
0624451537 Fix for OLD_HL_MATCH.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-14 07:22:12 -08:00
Tom Eastep
5e9ecf1491 Update version of Config module 2010-02-13 11:00:34 -08:00
Tom Eastep
50d246c8be A little cleanup of compiler.pl
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-13 10:03:32 -08:00
Tom Eastep
ec95e5b32c Document fix for rate limiting of NAT rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-13 09:11:14 -08:00
Tom Eastep
1258149e0e Don't apply rate limiting twice in NAT rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-13 07:21:27 -08:00
Tom Eastep
ea5a6c79bc Bump CAPVERSION 2010-02-11 16:22:47 -08:00
Tom Eastep
5a96771e07 Start 4.4.8 Beta 1 2010-02-11 15:46:57 -08:00
Tom Eastep
757fea7467 Update documentation regarding FLOW_FILTER
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-11 14:35:12 -08:00
Tom Eastep
b35f20b403 Avoid CAPVERSION bump to implement FLOW_FILTER detection
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-11 07:29:41 -08:00
Tom Eastep
b8c195f570 Accurately detect 'flow' availability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-10 14:50:26 -08:00
Tom Eastep
b1c64913b4 Reformat column header in tcinterfaces 2010-02-10 12:00:17 -08:00
Tom Eastep
433fc385bc 'bridge' implies 'routeback'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-09 14:04:36 -08:00
Tom Eastep
add302d02a Correct typo in manpages 2010-02-09 06:49:30 -08:00
Tom Eastep
76f053246a Add description of bandwidth specification to the tcinterfaces man pages 2010-02-09 06:42:31 -08:00
Tom Eastep
01521e4941 Correct typo in simple TC doc 2010-02-08 15:40:07 -08:00
Tom Eastep
21d4c8ba21 Document workaround for lack of 'flow'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-08 10:03:10 -08:00
Tom Eastep
1f86f54a8e Update simple TC doc with 4.4.7 workaround for lack of 'flow'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-08 08:44:40 -08:00
Tom Eastep
46e2afcf16 Ignore TYPE if old distro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-08 07:13:20 -08:00
Tom Eastep
b45a70f98a Make 'nosmurfs' work correctly on IPv6 with Address Type Match
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-08 07:12:58 -08:00
Tom Eastep
6239218db5 Warn about absense of the 'flow' classifier.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-08 06:45:11 -08:00
Tom Eastep
18d03a61f5 Make 'nosmurfs' work with Address Type Match on IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-07 08:43:31 -08:00
Tom Eastep
28b1139ef7 Add 'Tips and Hints' as an alias for the config file basics doc -- Take 2 2010-02-06 17:08:00 -08:00
Tom Eastep
b449d8168e Add 'Tips and Hints' as an alias for the config file basics doc 2010-02-06 17:03:22 -08:00
Tom Eastep
11a2ec9f7c Update version to 4.4.7 2010-02-05 16:40:48 -08:00
Tom Eastep
e64af57cae Give smurf logging chain a fixed name.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-03 16:04:59 -08:00
Tom Eastep
f4e175f149 Fix IPv6 'nosmurfs'. Make 'nosmurfs' logging more efficient.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-03 15:03:15 -08:00
Tom Eastep
97f3e5b8de Clear known problems.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-03 07:18:55 -08:00
Tom Eastep
52880a8822 Clean up generate_matrix() fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-03 06:57:51 -08:00
Tom Eastep
9d288241da Fix issues in generate_matrix().
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-02 19:42:54 -08:00
Tom Eastep
096fb29203 DEBUG and PURGE -- take 2.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-02 13:57:50 -08:00
Tom Eastep
1d8a7ad09f Clear DEBUG and PURGE shell variables
Delete a blank line

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-02 13:55:29 -08:00
Tom Eastep
e788b4c0f6 Mention DYNAMIC_BLACKLIST in the blacklisting doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-02 11:13:44 -08:00
Tom Eastep
753eb97667 Update version to 4.4.7 RC2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-02 10:30:53 -08:00
Tom Eastep
ede17e2da0 Set ADD_IP_ALIASES=No in all shorewall.conf files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-02 08:16:41 -08:00
Tom Eastep
dd60f04a9f Work around lack of MARK Target support 2010-02-01 16:22:57 -08:00
Tom Eastep
58f6e57286 Update known problems 2010-02-01 16:19:36 -08:00
Tom Eastep
d354560863 Finish last change.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-01 14:25:51 -08:00
Tom Eastep
f0d101605b Don't try to combine nat chains that include '-s'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-02-01 14:24:07 -08:00
Tom Eastep
193fdc85f0 Add 'Make Install' to iptables installation instructions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-31 12:12:55 -08:00
Tom Eastep
1981372c94 Make search for "-j ACCEPT" a little tighter
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-31 08:27:30 -08:00
Tom Eastep
f2709dd525 Correct release notes to match implementation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-30 20:31:39 -08:00
Tom Eastep
3d39a47582 Set $have_ipsec after completing parse of the hosts file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-30 07:26:35 -08:00
Tom Eastep
659f774451 Sort %detect_capability for easier verification.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-29 13:09:53 -08:00
Tom Eastep
9d2decd26d Modify determine_capabilities to use detect_capability()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-29 10:38:22 -08:00
Tom Eastep
b8ec2be516 Clean up handling of %detect_capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-28 16:39:45 -08:00
Tom Eastep
ecc7861115 Validate LOAD_HELPERS_ONLY before detecting capabilities.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-28 08:05:24 -08:00
Tom Eastep
ebd847ef70 Don't display capabilties if they have not been determined
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-28 08:04:54 -08:00
Tom Eastep
05f2bb4b3a Correction to last patch.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-27 17:52:27 -08:00
Tom Eastep
103a1660bc Update release notes for RC 1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-27 12:57:47 -08:00
Tom Eastep
9d25318d80 Fix detection of HASHLIMIT_MATCH on old kernels.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-27 12:53:31 -08:00
Tom Eastep
be117f6638 Remove traffic shaping modules from 'helpers'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-27 10:37:42 -08:00
Tom Eastep
2069855e44 Restore module loader to lib.base (it is needed by shorecap).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-27 10:09:12 -08:00
Tom Eastep
846715b009 Remove module loading code from lib.base
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-27 09:58:14 -08:00
Tom Eastep
54456de888 Update module versions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-27 09:01:00 -08:00
Tom Eastep
c05c1a6f50 Update version to 4.4.7 RC1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-27 06:58:44 -08:00
Tom Eastep
17fa381409 Update Build doc for revised Git layout 2010-01-25 16:27:50 -08:00
Tom Eastep
1556002b54 A couple of tweaks to the LOAD_HELPERS_ONLY optimization change.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-25 15:59:31 -08:00
Tom Eastep
fb007bc1c7 Bump version to Beta 4 2010-01-25 12:25:01 -08:00
Tom Eastep
9408a114c6 Don't load unused modules when LOAD_HELPERS_ONLY=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-25 10:50:49 -08:00
Tom Eastep
d933aa602b Eliminate 'ORIGINAL_POLICY_MATCH'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-25 08:13:22 -08:00
Tom Eastep
90b68a05de Don't export %capabilities
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-25 07:56:16 -08:00
Tom Eastep
c5f64848f6 Tweak bridge/firewall doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-24 15:28:37 -08:00
Tom Eastep
bb1f2993cc Tweaks to aliased interfaces doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-24 13:52:25 -08:00
Tom Eastep
bfdc6719c1 Fix DropBcasts()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-24 12:16:15 -08:00
Tom Eastep
83565f7a22 Updates to Actions doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-24 12:06:56 -08:00
Tom Eastep
e14d48c2cf Bump version to 4.4.7-Beta3
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-22 16:46:29 -08:00
Tom Eastep
0d63182ab4 Fix ambiguous syntax in Config.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-22 16:44:45 -08:00
Tom Eastep
8dd835be2b Document LOAD_HELPERS_ONLY in the three basic HOWTOs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-22 13:12:41 -08:00
Tom Eastep
5d5bdfc996 Remove -common from Shorewall6 installer.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-22 10:59:05 -08:00
Tom Eastep
f283c37b1c Add helpers file to shorewall6.spec
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-22 10:41:37 -08:00
Tom Eastep
199a50e1c7 Update version to 4.4.7 Beta 2
Add problems corrected to the release notes.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-22 10:35:27 -08:00
Tom Eastep
f74771a118 More LOAD_HELPERS_ONLY documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-21 20:30:35 -08:00
Tom Eastep
8def4d03c3 Document LOAD_HELPERS_ONLY=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-21 20:17:25 -08:00
Tom Eastep
8f85c75264 Implement LOAD_HELPERS_ONLY for IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-21 15:49:44 -08:00
Tom Eastep
efc43b1b24 Add implementation of LOAD_HELPERS_ONLY
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-21 15:49:35 -08:00
Tom Eastep
a248acb4d4 Add LOAD_HELPERS_ONLY Option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-21 15:49:23 -08:00
Tom Eastep
4303ad0a3e Add Module Helpers File
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-21 15:48:24 -08:00
Tom Eastep
10fe25050f Add TC_PRIOMAP fix to change log
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-21 10:39:40 -08:00
Tom Eastep
a7d4207bf5 Add TC_PRIOMAP to shorewall*.conf
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-21 10:38:32 -08:00
Tom Eastep
61a0e85410 Renumber FAQ 87
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-19 10:43:56 -08:00
Tom Eastep
8b50966f80 sip_direct_media was added in 2.6.26.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-19 10:36:13 -08:00
Tom Eastep
f731e04388 Mention sip_direct_media=0 in FAQ 77.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-19 10:32:34 -08:00
Tom Eastep
6b9afd6a82 Remove "-common" from installer messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-19 08:28:08 -08:00
Tom Eastep
188bd64242 Mention route_rules in masq manpage
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-19 07:59:00 -08:00
Tom Eastep
9788e057bf Correct filenames in install.sh -- Take 2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-18 09:29:14 -08:00
Tom Eastep
1716995d75 Correct filenames in install.sh
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-18 09:20:09 -08:00
Tom Eastep
5cc2edf15a Add the new tc files to the repository
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-18 09:03:05 -08:00
Tom Eastep
8798d3cdb4 Install tcinterfaces and tcpri
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-18 07:39:36 -08:00
Tom Eastep
4453bb7dc8 More updates from 4.5 2010-01-17 16:18:44 -08:00
Tom Eastep
eb790c6d89 Add IPMARK and TPROXY modules to load list 2010-01-17 15:51:19 -08:00
Tom Eastep
e119037dea Make 'is_isable()' work with 'lo' 2010-01-17 15:38:20 -08:00
Tom Eastep
f072c10b18 Set version to 4.4.7 Beta1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-17 09:10:48 -08:00
Tom Eastep
957de4b057 Add new options to shorewall[6].conf
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-17 08:50:32 -08:00
Tom Eastep
146a738e4c Document TPROXY
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-17 08:20:15 -08:00
Tom Eastep
f4102417ff Shorewall::Config changes for TPROXY from 4.5
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-17 08:15:14 -08:00
Tom Eastep
07cdb8ca82 Backport TPROXY from 4.5
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-17 08:12:44 -08:00
Tom Eastep
47007c5dbd Allow protocol to be expressed in octal or hex
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-16 14:20:47 -08:00
Tom Eastep
aad8ea837a Allow port numbers to be specified in Hex
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-16 14:00:47 -08:00
Tom Eastep
5ec7759d81 Don't pass an undefined value to fatal_error when numeric conversion fails.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-16 12:35:18 -08:00
Tom Eastep
5ae3e239e6 Update manpages for functionality backported from 4.5
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-16 11:51:32 -08:00
Tom Eastep
fddb85189e Update release documents for functionality backported from 4.5.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-16 11:32:50 -08:00
Tom Eastep
4bf0b8e1dd Add new configuration options and optimization changes from 4.5
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-16 09:53:53 -08:00
Tom Eastep
c39f3c12c9 Add FAQ about Snort
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-16 08:32:24 -08:00
Tom Eastep
d5cc302ad9 Start 4.4.7
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-16 08:11:13 -08:00
Tom Eastep
25d433b36f Update TRACK_PROVIDER description in the man pages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-14 08:36:22 -08:00
Tom Eastep
45d975cb45 Final editing of release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-14 08:25:32 -08:00
Tom Eastep
81a5723009 Add appropriate 'use' statement to Limit code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-14 08:04:08 -08:00
Tom Eastep
6e998edd48 Correct typo -- TC_EXPORT -> TC_EXPERT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-14 07:48:19 -08:00
Tom Eastep
ce96bb003e Update manpages for TRACK_PROVIDERS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-14 07:48:01 -08:00
Tom Eastep
ebf1e55609 Version to 4.4.6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 15:38:19 -08:00
Tom Eastep
1f1812b786 Document mDNS change in the release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 13:24:24 -08:00
Tom Eastep
bffe8ce4c6 Add multicast address to mDNS macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 13:20:07 -08:00
Tom Eastep
79f8031267 Add IGMP to the mDNS macro.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 13:03:34 -08:00
Tom Eastep
b8b7555ff9 Add "[ <device> ]" to "show tc" usage syntax
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 12:28:20 -08:00
Tom Eastep
880cd269c7 More mark geometry misses
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 12:16:40 -08:00
Tom Eastep
72de96760f One more 0xFF -> $globals{TC_MASK} fix
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 12:11:00 -08:00
Tom Eastep
890cbfbd5d Document TRACK_PROVIDERS change in the release notes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 10:59:34 -08:00
Tom Eastep
10c5630786 A few more instances of TC_MASK
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 10:50:14 -08:00
Tom Eastep
555133fa3c Bump version to 4.4.6-Beta2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 10:14:31 -08:00
Tom Eastep
505a2bac22 Make it clear that the variable expansion restriction applies to config files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:38:16 -08:00
Tom Eastep
b4b6dce7c8 Add some comments
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:12:00 -08:00
Tom Eastep
4821d5e8b7 Change quantum to 1875 for simple TC SFQ.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:11:49 -08:00
Tom Eastep
ed3d3855f2 Correct typo in Shell Variable section
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:10:56 -08:00
Tom Eastep
55e41483de Update Release Documents
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 20:12:31 -08:00
Tom Eastep
38b8a8a7fd Allow Shorewall6 to display the tc config of one interface
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 19:09:46 -08:00
Tom Eastep
db2a1fe749 Add lib.cli changes to 4.4.6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 18:57:04 -08:00
Tom Eastep
2b39d7f522 Update version references for simplified TC
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 17:33:47 -08:00
Tom Eastep
416f600181 Update shorewall.conf(5) for Simplified TC
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 17:27:23 -08:00
Tom Eastep
f69a741691 Port Simplified TC to 4.4.6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 17:01:20 -08:00
Tom Eastep
7e183e8eb4 Change version to 4.4.6-Beta1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 15:57:55 -08:00
Tom Eastep
57672d096c Don't invoke 4.5 optimization under 4.4.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 15:47:14 -08:00
Tom Eastep
ae31a09e8b Move code and add comments:
- Declare all of the 'preview' helpers together in Chains.pm
- Add some clarifying comments in the compiler.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 15:32:59 -08:00
Tom Eastep
4420eed8d7 Allow users to preview the generated ruleset.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 15:32:50 -08:00
Tom Eastep
271e472d3d Export empty RECOVERING from the -lite programs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:54:14 -08:00
Tom Eastep
818dfb6295 Document 'show macro' in the release docs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:46:14 -08:00
Tom Eastep
cab1f8548a Update manpage for correct version at introduction.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:43:52 -08:00
Tom Eastep
5bd050f8b6 Update manpage for 'show macro' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:40:54 -08:00
Tom Eastep
6c62f14749 Add 'show macro' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:40:25 -08:00
Tom Eastep
d164880381 Update Lenny->Squeeze doc to indicate that 4.4 is now in Sid
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 12:28:35 -08:00
Tom Eastep
3822fe98c2 Correct typo in Multi-ISP doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 11:20:56 -08:00
Tom Eastep
4be3cbe97b Expand DHCP relay instructions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 09:13:29 -08:00
Tom Eastep
341617b5b8 Update DHCP document for forwarding.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 07:55:58 -08:00
Tom Eastep
4464094773 Update release documents for DHCPfwd
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 07:51:20 -08:00
Tom Eastep
b6a7723c05 Add DHCPfwd macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 07:48:55 -08:00
Tom Eastep
baa893773d Apply Macro changes from Tuomo Soini
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 07:35:41 -08:00
Tom Eastep
6b085b7897 Update module versions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 18:54:23 -08:00
Tom Eastep
5b4e9eb8e6 Revert change with migration issue
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 15:30:33 -08:00
Tom Eastep
0b549c7a15 Suppress mark geometry output
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 14:55:42 -08:00
Tom Eastep
fc8bfdcbf9 Update release documents
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 14:49:45 -08:00
Tom Eastep
1a74dbf93e Add mark geometry changes to Shorewall::Chains and Shorewall::Compiler
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 14:39:22 -08:00
Tom Eastep
01293427f5 Add Mark Geometry changes to Shorewall::Tc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 14:29:34 -08:00
Tom Eastep
4f5bb5e90b Add new mark geometry changes to Shorewall::Providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 14:22:01 -08:00
Tom Eastep
d2d2912534 Add New mark geometry variables to Shorewall::Config
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 14:16:03 -08:00
Tom Eastep
ab86994d68 Delete tc4shorewall link from the traffic shaping page
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 12:48:23 -08:00
Tom Eastep
4e50ea14ea Back out EXMARK detection since it is unused in 4.4.
Long overdue change to LIBVERSION

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-09 09:30:25 -08:00
Tom Eastep
b0feeb805d Fix typo in clear_firewall()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-09 07:28:57 -08:00
Tom Eastep
a1e46b68f0 Add [...] to IPv6 doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 15:11:19 -08:00
Tom Eastep
54b21365c2 Update release documents for [...] change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 13:58:15 -08:00
Tom Eastep
e6c0c8f6b7 Allow both <...> and [...] for IPv6 Addresses
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 13:55:13 -08:00
Tom Eastep
a2efc8e827 Correct log file for Debian and derivatives
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-07 11:41:27 -08:00
Tom Eastep
bbce309791 Bring 4.4.6 Lenny->Squeeze in sync with the 4.5.3 version
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 09:09:36 -08:00
Tom Eastep
83c2473d78 Correct typo in error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 08:26:13 -08:00
Tom Eastep
ca4eee3ae4 Correct handling of 'refresh' failures
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 08:01:46 -08:00
Tom Eastep
db819b1d3f Update release notes to qualify when ipsets are restored by 'restore'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 07:57:02 -08:00
Tom Eastep
314536dd74 Correct typo in shorewall6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 07:45:53 -08:00
Tom Eastep
605da92eca Don't try to restore ipsets when 'restore' is being used to recover
from a start/restart failure.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 07:44:34 -08:00
Tom Eastep
d362af9fb6 Set CAPSVERSION to 4.4.7 just to be safe.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 10:00:29 -08:00
Tom Eastep
ab1dc03986 Implement EXMARK capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 09:35:11 -08:00
Tom Eastep
556170c990 Replace SVN by GIT in Documentation Index
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 07:48:47 -08:00
Tom Eastep
1f49d49464 Update Build Document
- Copyright
- Add additional options to build44
- Add warning about xmlto
- Correct a couple of typos

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 07:41:27 -08:00
Tom Eastep
4d3887c4f6 Recommend EXPORTPARAMS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 16:31:49 -08:00
Tom Eastep
0c92e05509 Update the Shorewall-perl document regarding SAVE_IPSETS.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 14:45:27 -08:00
Tom Eastep
1175fa23b8 Update shorewall.conf (5) to indicate that SAVE_IPSETS was re-enabled in
shorewall 4.4.6.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 14:38:01 -08:00
Tom Eastep
d6123a8fbc Improve IPSET_SAVE restore logic:
- Call startup_error() rather than fatal_error()
- Call startup_error when restore-ipsets file exists but Shorewall is running

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 14:23:33 -08:00
Tom Eastep
84051ca19a Update the release notes regarding SAVE_IPSETS and save/restore
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 12:49:58 -08:00
Tom Eastep
559e22706b Correct manpage re save/restore
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 12:45:58 -08:00
Tom Eastep
4e0f9b2ef3 Make save/restore work with SAVE_IPSETS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 12:43:12 -08:00
Tom Eastep
e3c75dcfcc Document the restoration of SAVE_IPSETS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 11:54:59 -08:00
Tom Eastep
91b65125aa Update manpage for SAVE_IPSETS.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 11:50:33 -08:00
Tom Eastep
1aa55779e2 Re-enable SAVE_IPSETS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 11:14:45 -08:00
Tom Eastep
b491eae3c0 Document Lenny/xtables-addons hack
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 10:20:40 -08:00
Tom Eastep
a1fd3aa7e3 Add a hack to work around a 'feature' of xtables-addons on Lenny
Be more careful about checking for the ipset utility before saving the ipsets

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 10:15:27 -08:00
Tom Eastep
f306018159 Update all .conf files to specify 'MODULE_SUFFIX=ko'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 09:33:27 -08:00
Tom Eastep
cf8239e1d9 Lite copyrights
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 13:27:48 -08:00
Tom Eastep
5ecf0e826a Shorewall6 copyrights
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 13:03:52 -08:00
Tom Eastep
55e874b23f Update copyrights
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 12:58:27 -08:00
Tom Eastep
65c282af8b Delete temporary nat chain used in capabilities detection.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 10:42:21 -08:00
Tom Eastep
ea2ab6e4b6 A better solution to Marcus Limosani's issue 2009-12-29 08:22:15 -08:00
Tom Eastep
c19e7715c4 Display IPv6 Neighbors in dump 2009-12-28 16:57:55 -08:00
Tom Eastep
f568f3df9e Final fix for Marcus Limosani's problem 2009-12-28 15:05:54 -08:00
Tom Eastep
738a6de11b Make use of interface chains deterministic 2009-12-28 07:36:15 -08:00
Tom Eastep
167d86746c Correct typo in usage output 2009-12-27 11:56:38 -08:00
Tom Eastep
f933816735 Simplify handling of packet clearing 2009-12-26 15:04:41 -08:00
Tom Eastep
a7865e7e0e Fix simple TC typo 2009-12-26 12:44:42 -08:00
Tom Eastep
7e3675fb30 Move 4.5 manpage/doc updates to master 2009-12-26 12:40:16 -08:00
Tom Eastep
3bd3defd8e fix formatting in shorewall6-interfaces(5) 2009-12-24 08:16:29 -08:00
Tom Eastep
d62f3a4fed Set version to 4.4.6 2009-12-24 08:00:59 -08:00
Tom Eastep
d5c695258a Document 'forward' option in shorewall6-interfaces(5) 2009-12-24 07:58:59 -08:00
Tom Eastep
f233b86278 Fix 'forward' interface option in IPv6 2009-12-24 07:51:44 -08:00
Tom Eastep
58977a1905 Make Shorewall6 shut up about missing KERNELVERSION 2009-12-23 15:50:49 -08:00
Tom Eastep
e38df7efcb Fix another bug in ROUTE_FILTER Handling 2009-12-23 15:13:43 -08:00
Tom Eastep
e37cf0a370 Fix other issues with rp_filter fix 2009-12-20 15:54:41 -08:00
Tom Eastep
d87d0893d2 Fix typos in the release notes 2009-12-20 12:05:35 -08:00
Tom Eastep
8eb6d136ae Fix typo in release notes 2009-12-19 18:25:48 -08:00
Tom Eastep
d45dd5387a Fix type on release notes 2009-12-19 18:23:15 -08:00
Tom Eastep
61b2ed7b57 Fix bug that prevented routefilter=2 2009-12-19 16:57:16 -08:00
Tom Eastep
15a1b39822 Update change log 2009-12-19 16:40:13 -08:00
Tom Eastep
436169f0b2 Update documentation for rp_filter change 2009-12-19 16:09:20 -08:00
Tom Eastep
9cf75a4253 Revert "this is crap"
This reverts commit 7be7ef6685.
2009-12-19 16:05:28 -08:00
Tom Eastep
7be7ef6685 this is crap 2009-12-19 16:05:13 -08:00
Tom Eastep
d5914addd1 Disallow port 00 2009-12-19 14:59:03 -08:00
Tom Eastep
19af1a081c Handle kernel 2.6.31 and rp_filter 2009-12-19 13:47:12 -08:00
Tom Eastep
4f4d77be48 Add Kernel Version to the capabilities 2009-12-19 12:42:39 -08:00
173 changed files with 14276 additions and 6743 deletions

View File

@@ -109,7 +109,7 @@ RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
IP_FORWARDING=Off
ADD_IP_ALIASES=Yes
ADD_IP_ALIASES=No
ADD_SNAT_ALIASES=No
@@ -119,6 +119,8 @@ TC_ENABLED=Internal
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -137,7 +139,7 @@ BLACKLISTNEWONLY=Yes
DELAYBLACKLISTLOAD=No
MODULE_SUFFIX=
MODULE_SUFFIX=ko
DISABLE_IPV6=No
@@ -195,6 +197,14 @@ TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -109,7 +109,7 @@ RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
IP_FORWARDING=On
ADD_IP_ALIASES=Yes
ADD_IP_ALIASES=No
ADD_SNAT_ALIASES=No
@@ -119,6 +119,8 @@ TC_ENABLED=Internal
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -137,7 +139,7 @@ BLACKLISTNEWONLY=Yes
DELAYBLACKLISTLOAD=No
MODULE_SUFFIX=
MODULE_SUFFIX=ko
DISABLE_IPV6=No
@@ -195,6 +197,14 @@ TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -116,7 +116,7 @@ RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
IP_FORWARDING=On
ADD_IP_ALIASES=Yes
ADD_IP_ALIASES=No
ADD_SNAT_ALIASES=No
@@ -126,6 +126,8 @@ TC_ENABLED=Internal
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -144,7 +146,7 @@ BLACKLISTNEWONLY=Yes
DELAYBLACKLISTLOAD=No
MODULE_SUFFIX=
MODULE_SUFFIX=ko
DISABLE_IPV6=No
@@ -202,6 +204,14 @@ TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -99,6 +99,8 @@ TC_ENABLED=No
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -111,7 +113,7 @@ ADMINISABSENTMINDED=Yes
BLACKLISTNEWONLY=Yes
MODULE_SUFFIX=
MODULE_SUFFIX=ko
FASTACCEPT=No
@@ -143,7 +145,15 @@ TRACK_PROVIDERS=Yes
ZONE2ZONE=2
###############################################################################
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
##############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -12,6 +12,6 @@
# For information about entries in this file, type "man shorewall6-interfaces"
###############################################################################
#ZONE INTERFACE BROADCAST OPTIONS
net eth0 detect tcpflags
loc eth1 detect tcpflags
dmz eth2 detect
net eth0 detect tcpflags,forward=1
loc eth1 detect tcpflags,forward=1
dmz eth2 detect tcpflags,forward=1

View File

@@ -99,6 +99,8 @@ TC_ENABLED=No
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -111,7 +113,7 @@ ADMINISABSENTMINDED=Yes
BLACKLISTNEWONLY=Yes
MODULE_SUFFIX=
MODULE_SUFFIX=ko
FASTACCEPT=No
@@ -143,6 +145,14 @@ TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -12,5 +12,5 @@
# For information about entries in this file, type "man shorewall6-interfaces"
###############################################################################
#ZONE INTERFACE BROADCAST OPTIONS
net eth0 detect tcpflags
loc eth1 detect tcpflags
net eth0 detect tcpflags,forward=1
loc eth1 detect tcpflags,forward=1

View File

@@ -99,6 +99,8 @@ TC_ENABLED=No
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -111,7 +113,7 @@ ADMINISABSENTMINDED=Yes
BLACKLISTNEWONLY=Yes
MODULE_SUFFIX=
MODULE_SUFFIX=ko
FASTACCEPT=No
@@ -143,6 +145,14 @@ TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

340
Shorewall-init/COPYING Normal file
View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1 @@
This is the Shorewall-init stable 4.4 branch of Git.

100
Shorewall-init/ifupdown.sh Normal file
View File

@@ -0,0 +1,100 @@
#!/bin/sh
#
# ifupdown script for Shorewall-based products
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall 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.
#
IFUPDOWN=0
PRODUCTS=
if [ -f /etc/default/shorewall-init ]; then
. /etc/default/shorewall-init
elif [ -f /etc/sysconfig/shorewall-init ]; then
. /etc/sysconfig/shorewall-init
fi
[ "$IFUPDOWN" = 1 -a -n "$PRODUCTS" ] || exit 0
if [ -f /etc/debian_version ]; then
#
# Debian ifupdown system
#
if [ "$MODE" = start ]; then
COMMAND=up
elif [ "$MODE" = stop ]; then
COMMAND=down
else
exit 0
fi
case "$PHASE" in
pre-*)
exit 0
;;
esac
elif [ -f /etc/SuSE-release ]; then
#
# SuSE ifupdown system
#
IFACE="$2"
case $0 in
*if-up.d*)
COMMAND=up
;;
*if-down.d*)
COMMAND=down
;;
*)
exit 0
;;
esac
else
#
# Assume RedHat/Fedora/CentOS/Foobar/...
#
IFACE="$1"
case $0 in
*ifup*)
COMMAND=up
;;
*ifdown*)
COMMAND=down
;;
*dispatcher.d*)
COMMAND="$2"
;;
*)
exit 0
;;
esac
fi
for PRODUCT in $PRODUCTS; do
VARDIR=/var/lib/$PRODUCT
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
if [ -x $VARDIR/firewall ]; then
$VARDIR/firewall -V0 $COMMAND $IFACE
fi
done
exit 0

129
Shorewall-init/init.debian.sh Executable file
View File

@@ -0,0 +1,129 @@
#!/bin/sh
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.4
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2010 - Tom Eastep (teastep@shorewall.net)
#
# On most distributions, this file should be called /etc/init.d/shorewall.
#
# 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.
#
### BEGIN INIT INFO
# Provides: shorewall-init
# Required-Start: $local_fs
# X-Start-Before: $network
# Required-Stop: $local_fs
# X-Stop-After: $network
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Initialize the firewall at boot time
# Description: Place the firewall in a safe state at boot time prior to
# bringing up the network
### END INIT INFO
export VERBOSITY=0
if [ "$(id -u)" != "0" ]
then
echo "You must be root to start, stop or restart \"Shorewall \"."
exit 1
fi
echo_notdone () {
echo "not done."
exit 1
}
not_configured () {
echo "#### WARNING ####"
echo "the firewall won't be initialized unless it is configured"
if [ "$1" != "stop" ]
then
echo ""
echo "Please read about Debian specific customization in"
echo "/usr/share/doc/shorewall-init/README.Debian.gz."
fi
echo "#################"
exit 0
}
# check if shorewall-init is configured or not
if [ -f "/etc/default/shorewall-init" ]
then
. /etc/default/shorewall-init
if [ -z "$PRODUCTS" ]
then
not_configured
fi
else
not_configured
fi
# Initialize the firewall
shorewall_start () {
local product
local VARDIR
echo -n "Initializing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do
VARDIR=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then
${VARDIR}/firewall stop || echo_notdone
fi
done
echo "done."
return 0
}
# Clear the firewall
shorewall_stop () {
local product
local VARDIR
echo -n "Clearing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do
VARDIR=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then
${VARDIR}/firewall clear || echo_notdone
fi
done
echo "done."
return 0
}
case "$1" in
start)
shorewall_start
;;
stop)
shorewall_stop
;;
reload|force-reload)
;;
*)
echo "Usage: /etc/init.d/shorewall-init {start|stop|reload|force-reload}"
exit 1
esac
exit 0

102
Shorewall-init/init.sh Executable file
View File

@@ -0,0 +1,102 @@
#! /bin/bash
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.4
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2010 - Tom Eastep (teastep@shorewall.net)
#
# On most distributions, this file should be called /etc/init.d/shorewall.
#
# 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.
#
# chkconfig: - 09 91
#
### BEGIN INIT INFO
# Provides: shorewall-init
# Required-start: $local_fs
# Required-stop: $local_fs
# Default-Start: 2 3 5
# Default-Stop:
# Short-Description: Initialize the firewall at boot time
# Description: Place the firewall in a safe state at boot time
# prior to bringing up the network.
### END INIT INFO
if [ "$(id -u)" != "0" ]
then
echo "You must be root to start, stop or restart \"Shorewall \"."
exit 1
fi
# check if shorewall-init is configured or not
if [ -f "/etc/sysconfig/shorewall-init" ]
then
. /etc/sysconfig/shorewall-init
if [ -z "$PRODUCTS" ]
then
exit 0
fi
else
exit 0
fi
# Initialize the firewall
shorewall_start () {
local product
local vardir
echo -n "Initializing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do
vardir=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${vardir}/firewall ]; then
${vardir}/firewall stop || exit 1
fi
done
return 0
}
# Clear the firewall
shorewall_stop () {
local product
local vardir
echo -n "Clearing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do
vardir=/var/lib/$PRODUCT
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${vardir}/firewall ]; then
${vardir}/firewall clear || exit 1
fi
done
return 0
}
case "$1" in
start)
shorewall_start
;;
stop)
shorewall_stop
;;
*)
echo "Usage: /etc/init.d/shorewall-init {start|stop}"
exit 1
esac
exit 0

331
Shorewall-init/install.sh Executable file
View File

@@ -0,0 +1,331 @@
#!/bin/sh
#
# Script to install Shoreline Firewall Init
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
# (c) 2010 - Roberto C. Sanchez (roberto@connexer.com)
#
# Shorewall 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.
#
VERSION=4.4.10
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME"
echo " $ME -v"
echo " $ME -h"
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
}
run_install()
{
if ! install $*; then
echo
echo "ERROR: Failed to install $*" >&2
exit 1
fi
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure shorewall init to start automatically at boot" >&2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
install_file() # $1 = source $2 = target $3 = mode
{
run_install $T $OWNERSHIP -m $3 $1 ${2}
}
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
#
# Parse the run line
#
# DEST is the SysVInit script directory
# INIT is the name of the script in the $DEST directory
# ARGS is "yes" if we've already parsed an argument
#
ARGS=""
if [ -z "$DEST" ] ; then
DEST="/etc/init.d"
fi
if [ -z "$INIT" ] ; then
INIT="shorewall-init"
fi
while [ $# -gt 0 ] ; do
case "$1" in
-h|help|?)
usage 0
;;
-v)
echo "Shorewall Init Installer Version $VERSION"
exit 0
;;
*)
usage 1
;;
esac
shift
ARGS="yes"
done
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
#
# Determine where to install the firewall script
#
case $(uname) in
Darwin)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=wheel
T=
;;
*)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
;;
esac
OWNERSHIP="-o $OWNER -g $GROUP"
if [ -n "$DESTDIR" ]; then
if [ `id -u` != 0 ] ; then
echo "Not setting file owner/group permissions, not running as root."
OWNERSHIP=""
fi
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
elif [ -f /etc/debian_version ]; then
DEBIAN=yes
elif [ -f /etc/SuSE-release ]; then
SUSE=Yes
elif [ -f /etc/slackware-version ] ; then
echo "Shorewall-init is currently not supported on Slackware" >&2
exit 1
# DEST="/etc/rc.d"
# INIT="rc.firewall"
elif [ -f /etc/arch-release ] ; then
echo "Shorewall-init is currently not supported on Arch Linux" >&2
exit 1
# DEST="/etc/rc.d"
# INIT="shorewall-init"
# ARCHLINUX=yes
elif [ -d /etc/sysconfig/network-scripts/ ]; then
#
# Assume RedHat-based
#
REDHAT=Yes
else
echo "Unknown distribution: Shorewall-init support is not available" >&2
exit 1
fi
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
echo "Installing Shorewall Init Version $VERSION"
#
# Check for /usr/share/shorewall-init/version
#
if [ -f ${DESTDIR}/usr/share/shorewall-init/version ]; then
first_install=""
else
first_install="Yes"
fi
#
# Install the Init Script
#
if [ -n "$DEBIAN" ]; then
install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall-init 0544
#elif [ -n "$ARCHLINUX" ]; then
# install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544
else
install_file init.sh ${DESTDIR}${DEST}/$INIT 0544
fi
echo "Shorewall Init script installed in ${DESTDIR}${DEST}/$INIT"
#
# Create /usr/share/shorewall-init if needed
#
mkdir -p ${DESTDIR}/usr/share/shorewall-init
chmod 755 ${DESTDIR}/usr/share/shorewall-init
#
# Create the version file
#
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall-init/version
chmod 644 ${DESTDIR}/usr/share/shorewall-init/version
#
# Remove and create the symbolic link to the init script
#
if [ -z "$DESTDIR" ]; then
rm -f /usr/share/shorewall-init/init
ln -s ${DEST}/${INIT} /usr/share/shorewall-init/init
fi
if [ -n "$DEBIAN" ]; then
if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}/etc/network/if-up.d/
mkdir -p ${DESTDIR}/etc/network/if-post-down.d/
fi
if [ ! -f ${DESTDIR}/etc/default/shorewall-init ]; then
if [ -n "${DESTDIR}" ]; then
mkdir ${DESTDIR}/etc/default
fi
install_file sysconfig ${DESTDIR}/etc/default/shorewall-init 0644
fi
else
if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}/etc/sysconfig
if [ -z "$RPM" ]; then
if [ -n "$SUSE" ]; then
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-up.d
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-down.d
else
mkdir -p ${DESTDIR}/etc/NetworkManager/dispatcher.d
fi
fi
fi
if [ -d ${DESTDIR}/etc/sysconfig -a ! -f ${DESTDIR}/etc/sysconfig/shorewall-init ]; then
install_file sysconfig ${DESTDIR}/etc/sysconfig/shorewall-init 0644
fi
fi
#
# Install the ifupdown script
#
mkdir -p ${DESTDIR}/usr/share/shorewall-init
install_file ifupdown.sh ${DESTDIR}/usr/share/shorewall-init/ifupdown 0544
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
install_file ifupdown.sh ${DESTDIR}/etc/NetworkManager/dispatcher.d/01-shorewall 0544
fi
if [ -n "$DEBIAN" ]; then
install_file ifupdown.sh ${DESTDIR}/etc/network/if-up.d/shorewall 0544
install_file ifupdown.sh ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
elif [ -n "$SUSE" ]; then
install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-up.d/shorewall 0544
install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-down.d/shorewall 0544
elif [ -n "$REDHAT" ]; then
if [ -f ${DESTDIR}/sbin/ifup-local -o -f ${DESTDIR}/sbin/ifdown-local ]; then
echo "WARNING: /sbin/ifup-local and/or /sbin/ifdown-local already exist; up/down events will not be handled"
else
install_file ifupdown.sh ${DESTDIR}/sbin/ifup-local 0544
install_file ifupdown.sh ${DESTDIR}/sbin/ifdown-local 0544
fi
fi
if [ -z "$DESTDIR" ]; then
if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
ln -sf ../init.d/shorewall-init /etc/rcS.d/S38shorewall-init
echo "Shorewall Init will start automatically at boot"
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall-init ; then
echo "Shorewall Init will start automatically at boot"
else
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall-init ; then
echo "Shorewall Init will start automatically in run levels as follows:"
chkconfig --list shorewall-init
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall-init default; then
echo "Shorewall Init will start automatically at boot"
else
cant_autostart
fi
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
cant_autostart
fi
fi
fi
else
if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}/etc/rcS.d
fi
ln -sf ../init.d/shorewall-init ${DESTDIR}/etc/rcS.d/S38shorewall-init
echo "Shorewall Init will start automatically at boot"
fi
fi
fi
#
# Report Success
#
echo "shorewall Init Version $VERSION Installed"

View File

@@ -0,0 +1,120 @@
%define name shorewall-init
%define version 4.4.10
%define release 0base
Summary: Shorewall-init adds functionality to Shoreline Firewall (Shorewall).
Name: %{name}
Version: %{version}
Release: %{release}
License: GPLv2
Packager: Tom Eastep <teastep@shorewall.net>
Group: Networking/Utilities
Source: %{name}-%{version}.tgz
URL: http://www.shorewall.net/
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: shoreline_firewall >= 4.4.10
%description
The Shoreline Firewall, more commonly known as "Shorewall", is a Netfilter
(iptables) based firewall that can be used on a dedicated firewall system,
a multi-function gateway/ router/server or on a standalone GNU/Linux system.
Shorewall Init is a companion product to Shorewall that allows for tigher
control of connections during boot and that integrates Shorewall with
ifup/ifdown and NetworkManager.
%prep
%setup
%build
%install
export DESTDIR=$RPM_BUILD_ROOT ; \
export OWNER=`id -n -u` ; \
export GROUP=`id -n -g` ;\
./install.sh
%clean
rm -rf $RPM_BUILD_ROOT
%post
if [ $1 -eq 1 ]; then
if [ -x /sbin/insserv ]; then
/sbin/insserv /etc/rc.d/shorewall-init
elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --add shorewall-init;
fi
fi
if [ -f /etc/SuSE-release ]; then
cp -pf /usr/share/shorewall-init/ifupdown /etc/sysconfig/network/if-up.d/shorewall
cp -pf /usr/share/shorewall-init/ifupdown /etc/sysconfig/network/if-down.d/shorewall
else
if [ -f /sbin/ifup-local -o -f /sbin/ifdown-local ]; then
if ! grep -q Shorewall /sbin/ifup-local || ! grep -q Shorewall /sbin/ifdown-local; then
echo "WARNING: /sbin/ifup-local and/or /sbin/ifdown-local already exist; ifup/ifdown events will not be handled" >&2
else
cp -pf /usr/share/shorewall-init/ifupdown /sbin/ifup-local
cp -pf /usr/share/shorewall-init/ifupdown /sbin/ifdown-local
fi
else
cp -pf /usr/share/shorewall-init/ifupdown /sbin/ifup-local
cp -pf /usr/share/shorewall-init/ifupdown /sbin/ifdown-local
fi
if [ -d /etc/NetworkManager/dispatcher.d/ ]; then
cp -pf /usr/share/shorewall-init/ifupdown /etc/NetworkManager/dispatcher.d/01-shorewall
fi
fi
%preun
if [ $1 -eq 0 ]; then
if [ -x /sbin/insserv ]; then
/sbin/insserv -r /etc/init.d/shorewall-init
elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --del shorewall-init
fi
[ -f /sbin/ifup-local ] && grep -q Shorewall /sbin/ifup-local && rm -f /sbin/ifup-local
[ -f /sbin/ifdown-local ] && grep -q Shorewall /sbin/ifdown-local && rm -f /sbin/ifdown-local
rm -f /etc/NetworkManager/dispatcher.d/01-shorewall
fi
%files
%defattr(0644,root,root,0755)
%attr(0644,root,root) %config(noreplace) /etc/sysconfig/shorewall-init
%attr(0544,root,root) /etc/init.d/shorewall-init
%attr(0755,root,root) %dir /usr/share/shorewall-init
%attr(0644,root,root) /usr/share/shorewall-init/version
%attr(0544,root,root) /usr/share/shorewall-init/ifupdown
%doc COPYING changelog.txt releasenotes.txt
%changelog
* Tue Jun 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Mon Jun 07 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC3
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta4
* Tue May 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta3
* Thu May 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta2
* Tue May 18 2010 Tom Eastep tom@shorewall.net
- Initial version

12
Shorewall-init/sysconfig Normal file
View File

@@ -0,0 +1,12 @@
# 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

97
Shorewall-init/uninstall.sh Executable file
View File

@@ -0,0 +1,97 @@
#!/bin/sh
#
# Script to back uninstall Shoreline Firewall
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.sourceforge.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.
#
# Usage:
#
# You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.10
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME"
exit $1
}
qt()
{
"$@" >/dev/null 2>&1
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
if [ -f /usr/share/shorewall-init/version ]; then
INSTALLED_VERSION="$(cat /usr/share/shorewall-init/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Init Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION"
fi
else
echo "WARNING: Shorewall Init Version $VERSION is not installed"
VERSION=""
fi
echo "Uninstalling Shorewall Init $VERSION"
INITSCRIPT=/etc/init.d/shorewall-init
if [ -n "$INITSCRIPT" ]; then
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
insserv -r $INITSCRIPT
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $INITSCRIPT)
else
rm -f /etc/rc*.d/*$(basename $INITSCRIPT)
fi
remove_file $INITSCRIPT
fi
[ "$(readlink -m -q /sbin/ifup-local)" = /usr/share/shorewall-init ] && remove_file /sbin/ifup-local
[ "$(readlink -m -q /sbin/ifdown-local)" = /usr/share/shorewall-init ] && remove_file /sbin/ifdown-local
remove_file /etc/default/shorewall-init
remove_file /etc/sysconfig/shorewall-init
remove_file /etc/NetworkManager/dispatcher.d/01-shorewall
remove_file /etc/network/if-up.d/shorewall
remove_file /etc/network/if-down.d/shorewall
remove_file /etc/sysconfig/network/if-up.d/shorewall
remove_file /etc/sysconfig/network/if-down.d/shorewall
rm -rf /usr/share/shorewall-init
echo "Shorewall Init Uninstalled"

View File

@@ -1 +1 @@
This is the Shorewall-lite development 4.3 branch of SVN.
This is the Shorewall-lite stable 4.4 branch of Git.

View File

@@ -26,4 +26,11 @@ OPTIONS=""
#
INITLOG=/dev/null
#
# Set this to 1 to cause '/etc/init.d/shorewall-lite stop' to place the firewall in
# a safe state rather than to open it
#
SAFESTOP=0
# EOF

View File

@@ -1,104 +0,0 @@
#!/bin/sh
#
# Script to back out the installation of Shorewall Lite and to restore the previous version of
# the program
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall 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.
#
# Usage:
#
# You may only use this script to back out the installation of the version
# shown below. Simply run this script to revert to your prior version of
# Shoreline Firewall.
VERSION=4.4.5.1
usage() # $1 = exit status
{
echo "usage: $(basename $0)"
exit $1
}
restore_directory() # $1 = directory to restore
{
if [ -d ${1}-${VERSION}.bkout ]; then
if mv -f $1 ${1}-${VERSION} && mv ${1}-${VERSION}.bkout $1; then
echo
echo "$1 restored"
rm -rf ${1}-${VERSION}
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
restore_file() # $1 = file to restore, $2 = (Optional) Directory to restore from
{
if [ -n "$2" ]; then
local file
file=$(basename $1)
if [ -f $2/$file ]; then
if mv -f $2/$file $1 ; then
echo
echo "$1 restored"
return
fi
echo "ERROR: Could not restore $1"
exit 1
fi
fi
if [ -f ${1}-${VERSION}.bkout -o -L ${1}-${VERSION}.bkout ]; then
if (mv -f ${1}-${VERSION}.bkout $1); then
echo
echo "$1 restored"
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
if [ ! -f /usr/share/shorewall-lite-${VERSION}.bkout/version ]; then
echo "Shorewall Version $VERSION is not installed"
exit 1
fi
echo "Backing Out Installation of Shorewall $VERSION"
if [ -L /usr/share/shorewall-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
restore_file $FIREWALL /usr/share/shorewall-lite-${VERSION}.bkout
else
restore_file /etc/init.d/shorewall /usr/share/shorewall-lite-${VERSION}.bkout
fi
restore_file /sbin/shorewall /var/lib/shorewall-lite-${VERSION}.bkout
restore_directory /etc/shorewall-lite
restore_directory /usr/share/shorewall-lite
restore_directory /var/lib/shorewall-lite
echo "Shorewall Lite Restored to Version $(cat /usr/share/shorewall-lite/version)"

View File

@@ -2,8 +2,8 @@
### BEGIN INIT INFO
# Provides: shorewall-lite
# Required-Start: $network
# Required-Stop: $network
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Configure the firewall at boot time
@@ -42,6 +42,7 @@ echo_notdone () {
echo "not done (check $INITLOG)."
fi
exit 1
}
not_configured () {
@@ -87,7 +88,11 @@ shorewall_start () {
# stop the firewall
shorewall_stop () {
echo -n "Stopping \"Shorewall firewall\": "
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
if [ "$SAFESTOP" = 1 ]; then
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
else
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
fi
return 0
}

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2006,2007 - Tom Eastep (teastep@shorewall.net)
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.net
#
@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.5.1
VERSION=4.4.10
usage() # $1 = exit status
{
@@ -82,15 +82,16 @@ delete_file() # $1 = file to delete
install_file() # $1 = source $2 = target $3 = mode
{
run_install $OWNERSHIP -m $3 $1 ${2}
run_install $T $OWNERSHIP -m $3 $1 ${2}
}
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
#
# Parse the run line
#
# DEST is the SysVInit script directory
# INIT is the name of the script in the $DEST directory
# RUNLEVELS is the chkconfig parmeters for firewall
# ARGS is "yes" if we've already parsed an argument
#
ARGS=""
@@ -103,10 +104,6 @@ if [ -z "$INIT" ] ; then
INIT="shorewall-lite"
fi
if [ -z "$RUNLEVELS" ] ; then
RUNLEVELS=""
fi
while [ $# -gt 0 ] ; do
case "$1" in
-h|help|?)
@@ -131,10 +128,12 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
#
DEBIAN=
CYGWIN=
INSTALLD='-D'
T='-T'
case $(uname) in
CYGWIN*)
if [ -z "$PREFIX" ]; then
if [ -z "$DESTDIR" ]; then
DEST=
INIT=
fi
@@ -142,6 +141,10 @@ case $(uname) in
OWNER=$(id -un)
GROUP=$(id -gn)
;;
Darwin)
INSTALLD=
T=
;;
*)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
@@ -150,14 +153,14 @@ esac
OWNERSHIP="-o $OWNER -g $GROUP"
if [ -n "$PREFIX" ]; then
if [ -n "$DESTDIR" ]; then
if [ `id -u` != 0 ] ; then
echo "Not setting file owner/group permissions, not running as root."
OWNERSHIP=""
fi
install -d $OWNERSHIP -m 755 ${PREFIX}/sbin
install -d $OWNERSHIP -m 755 ${PREFIX}${DEST}
install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
elif [ -d /etc/apt -a -e /usr/bin/dpkg ]; then
DEBIAN=yes
elif [ -f /etc/slackware-version ] ; then
@@ -179,184 +182,203 @@ echo "Installing Shorewall Lite Version $VERSION"
#
# Check for /etc/shorewall-lite
#
if [ -z "$PREFIX" -a -d /etc/shorewall-lite ]; then
first_install=""
if [ -z "$DESTDIR" -a -d /etc/shorewall-lite ]; then
[ -f /etc/shorewall-lite/shorewall.conf ] && \
mv -f /etc/shorewall-lite/shorewall.conf /etc/shorewall-lite/shorewall-lite.conf
else
first_install="Yes"
rm -rf ${PREFIX}/etc/shorewall-lite
rm -rf ${PREFIX}/usr/share/shorewall-lite
rm -rf ${PREFIX}/var/lib/shorewall-lite
rm -rf ${DESTDIR}/etc/shorewall-lite
rm -rf ${DESTDIR}/usr/share/shorewall-lite
rm -rf ${DESTDIR}/var/lib/shorewall-lite
fi
delete_file ${PREFIX}/usr/share/shorewall-lite/xmodules
#
# Check for /sbin/shorewall-lite
#
if [ -f ${DESTDIR}/sbin/shorewall-lite ]; then
first_install=""
else
first_install="Yes"
fi
install_file shorewall-lite ${PREFIX}/sbin/shorewall-lite 0544 ${PREFIX}/var/lib/shorewall-lite-${VERSION}.bkout
delete_file ${DESTDIR}/usr/share/shorewall-lite/xmodules
echo "Shorewall Lite control program installed in ${PREFIX}/sbin/shorewall-lite"
install_file shorewall-lite ${DESTDIR}/sbin/shorewall-lite 0544
echo "Shorewall Lite control program installed in ${DESTDIR}/sbin/shorewall-lite"
#
# Install the Firewall Script
#
if [ -n "$DEBIAN" ]; then
install_file init.debian.sh /etc/init.d/shorewall-lite 0544 ${PREFIX}/usr/share/shorewall-lite-${VERSION}.bkout
install_file init.debian.sh /etc/init.d/shorewall-lite 0544
elif [ -n "$ARCHLINUX" ]; then
install_file init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-lite-${VERSION}.bkout
install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544
else
install_file init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-lite-${VERSION}.bkout
install_file init.sh ${DESTDIR}${DEST}/$INIT 0544
fi
echo "Shorewall Lite script installed in ${PREFIX}${DEST}/$INIT"
echo "Shorewall Lite script installed in ${DESTDIR}${DEST}/$INIT"
#
# Create /etc/shorewall-lite, /usr/share/shorewall-lite and /var/lib/shorewall-lite if needed
#
mkdir -p ${PREFIX}/etc/shorewall-lite
mkdir -p ${PREFIX}/usr/share/shorewall-lite
mkdir -p ${PREFIX}/var/lib/shorewall-lite
mkdir -p ${DESTDIR}/etc/shorewall-lite
mkdir -p ${DESTDIR}/usr/share/shorewall-lite
mkdir -p ${DESTDIR}/var/lib/shorewall-lite
chmod 755 ${PREFIX}/etc/shorewall-lite
chmod 755 ${PREFIX}/usr/share/shorewall-lite
chmod 755 ${DESTDIR}/etc/shorewall-lite
chmod 755 ${DESTDIR}/usr/share/shorewall-lite
if [ -n "$PREFIX" ]; then
mkdir -p ${PREFIX}/etc/logrotate.d
chmod 755 ${PREFIX}/etc/logrotate.d
if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}/etc/logrotate.d
chmod 755 ${DESTDIR}/etc/logrotate.d
fi
#
# Install the config file
#
if [ ! -f ${PREFIX}/etc/shorewall-lite/shorewall-lite.conf ]; then
run_install $OWNERSHIP -m 0744 shorewall-lite.conf ${PREFIX}/etc/shorewall-lite/shorewall-lite.conf
echo "Config file installed as ${PREFIX}/etc/shorewall-lite/shorewall-lite.conf"
if [ ! -f ${DESTDIR}/etc/shorewall-lite/shorewall-lite.conf ]; then
run_install $OWNERSHIP -m 0744 shorewall-lite.conf ${DESTDIR}/etc/shorewall-lite
echo "Config file installed as ${DESTDIR}/etc/shorewall-lite/shorewall-lite.conf"
fi
if [ -n "$ARCHLINUX" ] ; then
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${PREFIX}/etc/shorewall-lite/shorewall.conf
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${DESTDIR}/etc/shorewall-lite/shorewall.conf
fi
#
# Install the Makefile
#
run_install $OWNERSHIP -m 0600 Makefile ${PREFIX}/etc/shorewall-lite/Makefile
echo "Makefile installed as ${PREFIX}/etc/shorewall-lite/Makefile"
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}/etc/shorewall-lite
echo "Makefile installed as ${DESTDIR}/etc/shorewall-lite/Makefile"
#
# Install the default config path file
#
install_file configpath ${PREFIX}/usr/share/shorewall-lite/configpath 0644
echo "Default config path file installed as ${PREFIX}/usr/share/shorewall-lite/configpath"
install_file configpath ${DESTDIR}/usr/share/shorewall-lite/configpath 0644
echo "Default config path file installed as ${DESTDIR}/usr/share/shorewall-lite/configpath"
#
# Install the libraries
#
for f in lib.* ; do
if [ -f $f ]; then
install_file $f ${PREFIX}/usr/share/shorewall-lite/$f 0644
echo "Library ${f#*.} file installed as ${PREFIX}/usr/share/shorewall-lite/$f"
install_file $f ${DESTDIR}/usr/share/shorewall-lite/$f 0644
echo "Library ${f#*.} file installed as ${DESTDIR}/usr/share/shorewall-lite/$f"
fi
done
ln -sf lib.base ${PREFIX}/usr/share/shorewall-lite/functions
ln -sf lib.base ${DESTDIR}/usr/share/shorewall-lite/functions
echo "Common functions linked through ${PREFIX}/usr/share/shorewall-lite/functions"
echo "Common functions linked through ${DESTDIR}/usr/share/shorewall-lite/functions"
#
# Install Shorecap
#
install_file shorecap ${PREFIX}/usr/share/shorewall-lite/shorecap 0755
install_file shorecap ${DESTDIR}/usr/share/shorewall-lite/shorecap 0755
echo
echo "Capability file builder installed in ${PREFIX}/usr/share/shorewall-lite/shorecap"
echo "Capability file builder installed in ${DESTDIR}/usr/share/shorewall-lite/shorecap"
#
# Install wait4ifup
#
install_file wait4ifup ${PREFIX}/usr/share/shorewall-lite/wait4ifup 0755
if [ -f wait4ifup ]; then
install_file wait4ifup ${DESTDIR}/usr/share/shorewall-lite/wait4ifup 0755
echo
echo "wait4ifup installed in ${PREFIX}/usr/share/shorewall-lite/wait4ifup"
echo
echo "wait4ifup installed in ${DESTDIR}/usr/share/shorewall-lite/wait4ifup"
fi
#
# Install the Modules file
#
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall-lite/modules
echo "Modules file installed as ${PREFIX}/usr/share/shorewall-lite/modules"
if [ -f modules ]; then
run_install $OWNERSHIP -m 0600 modules ${DESTDIR}/usr/share/shorewall-lite
echo "Modules file installed as ${DESTDIR}/usr/share/shorewall-lite/modules"
fi
#
# Install the Man Pages
#
cd manpages
if [ -d manpages ]; then
cd manpages
for f in *.5; do
gzip -c $f > $f.gz
run_install -D -m 644 $f.gz ${PREFIX}/usr/share/man/man5/$f.gz
echo "Man page $f.gz installed to ${PREFIX}/usr/share/man/man5/$f.gz"
done
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}/usr/share/man/man5/ ${DESTDIR}/usr/share/man/man8/
for f in *.8; do
gzip -c $f > $f.gz
run_install -D -m 644 $f.gz ${PREFIX}/usr/share/man/man8/$f.gz
echo "Man page $f.gz installed to ${PREFIX}/usr/share/man/man8/$f.gz"
done
for f in *.5; do
gzip -c $f > $f.gz
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}/usr/share/man/man5/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}/usr/share/man/man5/$f.gz"
done
cd ..
for f in *.8; do
gzip -c $f > $f.gz
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}/usr/share/man/man8/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}/usr/share/man/man8/$f.gz"
done
echo "Man Pages Installed"
cd ..
if [ -d ${PREFIX}/etc/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${PREFIX}/etc/logrotate.d/shorewall-lite
echo "Logrotate file installed as ${PREFIX}/etc/logrotate.d/shorewall-lite"
echo "Man Pages Installed"
fi
if [ -d ${DESTDIR}/etc/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}/etc/logrotate.d/shorewall-lite
echo "Logrotate file installed as ${DESTDIR}/etc/logrotate.d/shorewall-lite"
fi
#
# Create the version file
#
echo "$VERSION" > ${PREFIX}/usr/share/shorewall-lite/version
chmod 644 ${PREFIX}/usr/share/shorewall-lite/version
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall-lite/version
chmod 644 ${DESTDIR}/usr/share/shorewall-lite/version
#
# Remove and create the symbolic link to the init script
#
if [ -z "$PREFIX" ]; then
if [ -z "$DESTDIR" ]; then
rm -f /usr/share/shorewall-lite/init
ln -s ${DEST}/${INIT} /usr/share/shorewall-lite/init
fi
if [ -z "$PREFIX" -a -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall-lite
ln -s ../init.d/shorewall-lite /etc/rcS.d/S40shorewall-lite
echo "Shorewall Lite will start automatically at boot"
touch /var/log/shorewall-init.log
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall-lite ; then
echo "Shorewall Lite will start automatically at boot"
else
if [ -z "$DESTDIR" ]; then
touch /var/log/shorewall-lite-init.log
if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall-lite
ln -s ../init.d/shorewall-lite /etc/rcS.d/S40shorewall-lite
echo "Shorewall Lite will start automatically at boot"
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall-lite ; then
echo "Shorewall Lite will start automatically at boot"
else
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall-lite ; then
echo "Shorewall Lite will start automatically in run levels as follows:"
chkconfig --list shorewall-lite
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall-lite default; then
echo "Shorewall Lite will start automatically at boot"
else
cant_autostart
fi
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall-lite ; then
echo "Shorewall Lite will start automatically in run levels as follows:"
chkconfig --list shorewall-lite
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall-lite default; then
echo "Shorewall Lite will start automatically at boot"
else
cant_autostart
fi
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
cant_autostart
fi
fi
fi

View File

@@ -1,4 +1,4 @@
/var/log/shorewall-init.log {
/var/log/shorewall-lite-init.log {
missingok
notifempty
create 0600 root root

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
# (c) 2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# This file should be placed in /sbin/shorewall.
#
@@ -48,18 +48,19 @@
SHAREDIR=/usr/share/shorewall-lite
VARDIR=/var/lib/shorewall-lite
CONFDIR=/etc/shorewall-lite
PRODUCT="Shorewall Lite"
g_product="Shorewall Lite"
. /usr/share/shorewall-lite/lib.base
. /usr/share/shorewall-lite/lib.cli
. /usr/share/shorewall-lite/configpath
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
VERSION=$(cat /usr/share/shorewall-lite/version)
SHOREWALL_VERSION=$(cat /usr/share/shorewall-lite/version)
[ -n "$IPTABLES" ] || IPTABLES=$(mywhich iptables)
VERBOSE=0
VERBOSITY=0
load_kernel_modules No
determine_capabilities
report_capabilities1

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006 - Tom Eastep (teastep@shorewall.net)
# (c) 2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# This file should be placed in /sbin/shorewall-lite.
#
@@ -117,8 +117,6 @@ get_config() {
[ -n "$LOGFORMAT" ] || LOGFORMAT="Shorewall:"
export LOGFORMAT
if [ -n "$IPTABLES" ]; then
if [ ! -x "$IPTABLES" ]; then
echo " ERROR: The program specified in IPTABLES does not exist or is not executable" >&2
@@ -132,8 +130,6 @@ get_config() {
fi
fi
export IPTABLES
if [ -n "$SHOREWALL_SHELL" ]; then
if [ ! -x "$SHOREWALL_SHELL" ]; then
echo " WARNING: The program specified in SHOREWALL_SHELL does not exist or is not executable; falling back to /bin/sh" >&2
@@ -145,15 +141,20 @@ get_config() {
validate_restorefile RESTOREFILE
export RESTOREFILE
[ -n "${VERBOSITY:=2}" ]
[ -n "$USE_VERBOSITY" ] && VERBOSE=$USE_VERBOSITY || VERBOSE=$(($VERBOSE_OFFSET + $VERBOSITY))
[ -n "$g_use_verbosity" ] && VERBOSITY=$g_use_verbosity || VERBOSITY=$(($g_verbose_offset + $VERBOSITY))
export VERBOSE
g_hostname=$(hostname 2> /dev/null)
[ -n "${HOSTNAME:=$(hostname)}" ]
IP=$(mywhich ip 2> /dev/null)
if [ -z "$IP" ] ; then
echo " ERROR: Can't find ip executable" >&2
exit 2
fi
IPSET=ipset
TC=tc
}
@@ -161,13 +162,13 @@ get_config() {
# Verify that we have a compiled firewall script
#
verify_firewall_script() {
if [ ! -f $FIREWALL ]; then
if [ ! -f $g_firewall ]; then
echo " ERROR: Shorewall Lite is not properly installed" >&2
if [ -L $FIREWALL ]; then
echo " $FIREWALL is a symbolic link to a" >&2
if [ -L $g_firewall ]; then
echo " $g_firewall is a symbolic link to a" >&2
echo " non-existant file" >&2
else
echo " The file $FIREWALL does not exist" >&2
echo " The file $g_firewall does not exist" >&2
fi
exit 2
@@ -187,7 +188,7 @@ start_command() {
[ -n "$nolock" ] || mutex_on
if [ -x ${LITEDIR}/firewall ]; then
${LITEDIR}/firewall $debugging start
run_it ${LITEDIR}/firewall $debugging start
rc=$?
else
error_message "${LITEDIR}/firewall is missing or is not executable"
@@ -219,12 +220,12 @@ start_command() {
option=
;;
f*)
FAST=Yes
g_fast=Yes
option=${option#f}
;;
p*)
[ -n "$(which conntrack)" ] || fatal_error "The '-p' option requires the conntrack utility which does not appear to be installed on this system"
PURGE=Yes
g_purge=Yes
option=${option%p}
;;
*)
@@ -248,36 +249,21 @@ start_command() {
;;
esac
export NOROUTES
if [ -n "$FAST" ]; then
if [ -n "$g_fast" ]; then
if qt mywhich make; then
#
# RESTOREFILE is exported by get_config()
#
make -qf ${CONFDIR}/Makefile || FAST=
export RESTOREFILE
make -qf ${CONFDIR}/Makefile || g_fast=
fi
if [ -n "$FAST" ]; then
if [ -n "$g_fast" ]; then
RESTOREPATH=${VARDIR}/$RESTOREFILE
if [ -x $RESTOREPATH ]; then
if [ -x ${RESTOREPATH}-ipsets ]; then
echo Restoring Ipsets...
#
# We must purge iptables to be sure that there are no
# references to ipsets
#
iptables -F
iptables -X
$SHOREWALL_SHELL ${RESTOREPATH}-ipsets
fi
g_restorepath=${VARDIR}/$RESTOREFILE
if [ -x $g_restorepath ]; then
echo Restoring Shorewall Lite...
$SHOREWALL_SHELL $RESTOREPATH restore
run_it $g_restorepath restore
date > ${VARDIR}/restarted
progress_message3 Shorewall Lite restored from $RESTOREPATH
progress_message3 Shorewall Lite restored from $g_restorepath
else
do_it
fi
@@ -313,12 +299,12 @@ restart_command() {
option=
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
p*)
[ -n "$(which conntrack)" ] || fatal_error "The '-p' option requires the conntrack utility which does not appear to be installed on this system"
PURGE=Yes
g_purge=Yes
option=${option%p}
;;
*)
@@ -342,12 +328,10 @@ restart_command() {
;;
esac
export NOROUTES
[ -n "$nolock" ] || mutex_on
if [ -x ${LITEDIR}/firewall ]; then
$SHOREWALL_SHELL ${LITEDIR}/firewall $debugging restart
run_it ${LITEDIR}/firewall $debugging restart
rc=$?
else
error_message "${LITEDIR}/firewall is missing or is not executable"
@@ -366,13 +350,14 @@ usage() # $1 = exit status
{
echo "Usage: $(basename $0) [debug|trace] [nolock] [ -q ] [ -v[-1|{0-2}] ] [ -t ] <command>"
echo "where <command> is one of:"
echo " add <interface>[:<host-list>] ... <zone>"
echo " allow <address> ..."
echo " clear"
echo " delete <interface>[:<host-list>] ... <zone>"
echo " drop <address> ..."
echo " dump [ -x ]"
echo " forget [ <file name> ]"
echo " help"
echo " hits [ -t ]"
echo " ipcalc { <address>/<vlsm> | <address> <netmask> }"
echo " ipdecimal { <address> | <integer> }"
echo " iprange <address>-<address>"
@@ -381,7 +366,7 @@ usage() # $1 = exit status
echo " logwatch [<refresh interval>]"
echo " reject <address> ..."
echo " reset [ <chain> ... ]"
echo " restart [ -n ] [ -p ]"
echo " restart [ -n ] [ -p ] [ -f ] [ <directory> ]"
echo " restore [ -n ] [ <file name> ]"
echo " save [ <file name> ]"
echo " show [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]"
@@ -389,23 +374,71 @@ usage() # $1 = exit status
echo " show classifiers"
echo " show config"
echo " show connections"
echo " show dynamic <zone>"
echo " show filter"
echo " show filters"
echo " show ip"
echo " show [ -m ] log"
echo " show [ -x ] mangle|nat|raw"
echo " show routing"
echo " show tc"
echo " show [ -m ] log [<regex>]"
echo " show [ -x ] mangle|nat|raw|routing"
echo " show policies"
echo " show tc [ device ]"
echo " show vardir"
echo " show zones"
echo " start [ -n ] [ -p ]"
echo " start [ -f ] [ -p ] [ <directory> ]"
echo " stop"
echo " status"
echo " version"
echo " version [ -a ]"
echo
exit $1
}
version_command() {
local finished
finished=0
local all
all=
local product
while [ $finished -eq 0 -a $# -gt 0 ]; do
option=$1
case $option in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
-)
finished=1
option=
;;
a*)
all=Yes
option=${option#a}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
[ $# -gt 0 ] && usage 1
echo $SHOREWALL_VERSION
if [ -n "$all" ]; then
for product in shorewall shorewall6 shorewall6-lite shorewall-init; do
if [ -f /usr/share/$product/version ]; then
echo "$product: $(cat /usr/share/$product/version)"
fi
done
fi
}
#
# Execution begins here
#
@@ -423,14 +456,13 @@ if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
shift
fi
IPT_OPTIONS="-nv"
FAST=
VERBOSE_OFFSET=0
USE_VERBOSITY=
NOROUTES=
EXPORT=
export TIMESTAMP=
noroutes=
g_ipt_options="-nv"
g_fast=
g_verbose_offset=0
g_use_verbosity=
g_noroutes=
g_timestamp=
g_recovering=
finished=0
@@ -449,48 +481,48 @@ while [ $finished -eq 0 ]; do
while [ -n "$option" ]; do
case $option in
x*)
IPT_OPTIONS="-xnv"
g_ipt_options="-xnv"
option=${option#x}
;;
q*)
VERBOSE_OFFSET=$(($VERBOSE_OFFSET - 1 ))
g_verbose_offset=$(($g_verbose_offset - 1 ))
option=${option#q}
;;
f*)
FAST=Yes
g_fast=Yes
option=${option#f}
;;
v*)
option=${option#v}
case $option in
-1*)
USE_VERBOSITY=-1
g_use_verbosity=-1
option=${option#-1}
;;
0*)
USE_VERBOSITY=0
g_use_verbosity=0
option=${option#0}
;;
1*)
USE_VERBOSITY=1
g_use_verbosity=1
option=${option#1}
;;
2*)
USE_VERBOSITY=2
g_use_verbosity=2
option=${option#2}
;;
*)
VERBOSE_OFFSET=$(($VERBOSE_OFFSET + 1 ))
USE_VERBOSITY=
g_verbose_offset=$(($g_verbose_offset + 1 ))
g_use_verbosity=
;;
esac
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
t*)
TIMESTAMP=Yes
g_timestamp=Yes
option=${option#t}
;;
-)
@@ -515,12 +547,11 @@ if [ $# -eq 0 ]; then
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
export PATH
MUTEX_TIMEOUT=
SHAREDIR=/usr/share/shorewall-lite
CONFDIR=/etc/shorewall-lite
export PRODUCT="Shorewall Lite"
g_product="Shorewall Lite"
[ -f ${CONFDIR}/vardir ] && . ${CONFDIR}/vardir ]
@@ -528,17 +559,10 @@ export PRODUCT="Shorewall Lite"
[ -d $VARDIR ] || mkdir -p $VARDIR || fatal_error "Unable to create $VARDIR"
LIBRARIES="$SHAREDIR/lib.base $SHAREDIR/lib.cli"
VERSION_FILE=$SHAREDIR/version
HELP=$SHAREDIR/help
version_file=$SHAREDIR/version
for library in $LIBRARIES; do
if [ -f $library ]; then
. $library
else
echo "Installation error: $library does not exist!" >&2
exit 2
fi
for library in base cli; do
. ${SHAREDIR}/lib.$library
done
ensure_config_path
@@ -558,7 +582,6 @@ else
fi
ensure_config_path
export CONFIG_PATH
LITEDIR=${VARDIR}
@@ -566,17 +589,17 @@ LITEDIR=${VARDIR}
get_config
FIREWALL=$LITEDIR/firewall
g_firewall=$LITEDIR/firewall
if [ -f $VERSION_FILE ]; then
version=$(cat $VERSION_FILE)
if [ -f $version_file ]; then
SHOREWALL_VERSION=$(cat $version_file)
else
echo " ERROR: Shorewall Lite is not properly installed" >&2
echo " The file $VERSION_FILE does not exist" >&2
echo " The file $version_file does not exist" >&2
exit 1
fi
banner="Shorewall Lite $version Status at $HOSTNAME -"
banner="Shorewall Lite $SHOREWALL_VERSION Status at $g_hostname -"
case $(echo -e) in
-e*)
@@ -608,12 +631,11 @@ case "$COMMAND" in
stop|clear)
[ $# -ne 1 ] && usage 1
verify_firewall_script
export NOROUTES
exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock $COMMAND
run_it $g_firewall $debugging $nolock $COMMAND
;;
reset)
verify_firewall_script
exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock $@
run_it $SHOREWALL_SHELL $g_firewall $debugging $nolock $@
;;
restart)
shift
@@ -626,7 +648,7 @@ case "$COMMAND" in
status)
[ $# -eq 1 ] || usage 1
[ "$(id -u)" != 0 ] && fatal_error "ERROR: The status command may only be run by root"
echo "Shorewall Lite $version Status at $HOSTNAME - $(date)"
echo "Shorewall Lite $SHOREWALL_VERSION Status at $g_hostname - $(date)"
echo
if shorewall_is_started ; then
echo "Shorewall Lite is running"
@@ -639,7 +661,7 @@ case "$COMMAND" in
if [ -f ${VARDIR}/state ]; then
state="$(cat ${VARDIR}/state)"
case $state in
Stopped*|Clear*)
Stopped*|Closed*|Clear*)
status=3
;;
esac
@@ -660,7 +682,8 @@ case "$COMMAND" in
hits_command $@
;;
version)
echo $version Lite
shift
version_command $@
;;
logwatch)
logwatch_command $@
@@ -729,7 +752,7 @@ case "$COMMAND" in
;;
esac
RESTOREPATH=${VARDIR}/$RESTOREFILE
g_restorepath=${VARDIR}/$RESTOREFILE
[ "$nolock" ] || mutex_on
@@ -751,20 +774,15 @@ case "$COMMAND" in
esac
RESTOREPATH=${VARDIR}/$RESTOREFILE
g_restorepath=${VARDIR}/$RESTOREFILE
if [ -x $RESTOREPATH ]; then
if [ -x ${RESTOREPATH}-ipsets ]; then
rm -f ${RESTOREPATH}-ipsets
echo " ${RESTOREPATH}-ipsets removed"
fi
rm -f $RESTOREPATH
rm -f ${RESTOREPATH}-iptables
echo " $RESTOREPATH removed"
elif [ -f $RESTOREPATH ]; then
echo " $RESTOREPATH exists and is not a saved Shorewall configuration"
if [ -x $g_restorepath ]; then
rm -f $g_restorepath
rm -f ${g_restorepath}-iptables
rm -f ${g_restorepath}-ipsets
echo " $g_restorepath removed"
elif [ -f $g_restorepath ]; then
echo " $g_restorepath exists and is not a saved Shorewall configuration"
fi
rm -f ${VARDIR}/save
;;

View File

@@ -4,12 +4,11 @@
# compile /var/lib/shorewall-lite/firewall. Those values may be found in
# /var/lib/shorewall-lite/firewall.conf.
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# This file should be placed in /etc/shorewall-lite
#
# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
# For information about the settings in this file, type
# "man shorewall-lite.conf"
#
# Manpage also online at
# http://www.shorewall.net/manpages/shorewall-lite.conf.html
###############################################################################
# N 0 T E
###############################################################################

View File

@@ -1,6 +1,6 @@
%define name shorewall-lite
%define version 4.4.5
%define release 1
%define version 4.4.10
%define release 0base
Summary: Shoreline Firewall Lite is an iptables-based firewall for Linux systems.
Name: %{name}
@@ -14,6 +14,7 @@ URL: http://www.shorewall.net/
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: iptables iproute
Provides: shoreline_firewall = %{version}-%{release}
%description
@@ -31,7 +32,7 @@ administrators to centralize the configuration of Shorewall-based firewalls.
%build
%install
export PREFIX=$RPM_BUILD_ROOT ; \
export DESTDIR=$RPM_BUILD_ROOT ; \
export OWNER=`id -n -u` ; \
export GROUP=`id -n -g` ;\
./install.sh
@@ -88,6 +89,7 @@ fi
%attr(- ,root,root) /usr/share/shorewall-lite/functions
%attr(0644,root,root) /usr/share/shorewall-lite/lib.base
%attr(0644,root,root) /usr/share/shorewall-lite/lib.cli
%attr(0644,root,root) /usr/share/shorewall-lite/lib.common
%attr(0644,root,root) /usr/share/shorewall-lite/modules
%attr(0544,root,root) /usr/share/shorewall-lite/shorecap
%attr(0755,root,root) /usr/share/shorewall-lite/wait4ifup
@@ -100,9 +102,69 @@ fi
%doc COPYING changelog.txt releasenotes.txt
%changelog
* Sat Dec 19 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.5-1
* Fri Nov 27 2009 Tom Eastep tom@shorewall.net
* Tue Jun 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Mon Jun 07 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC3
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta4
* Tue May 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta3
* Thu May 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta2
* Thu May 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta2
* Thu May 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta1
* Mon May 03 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0base
* Sun May 02 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0RC2
* Sun Apr 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0RC1
* Sat Apr 24 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta5
* Fri Apr 16 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta4
* Fri Apr 09 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta3
* Thu Apr 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta2
* Sat Mar 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta1
* Fri Mar 19 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0base
* Tue Mar 16 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0RC2
* Mon Mar 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0RC1
* Sun Feb 28 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0Beta2
* Thu Feb 11 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0Beta1
* Fri Feb 05 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0base
* Tue Feb 02 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0RC2
* Wed Jan 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0RC1
* Mon Jan 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta4
* Fri Jan 22 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta3
* Fri Jan 22 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta2
* Sun Jan 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta1
* Wed Jan 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.6-0base
* Tue Jan 12 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.6-0Beta1
* Thu Dec 24 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.5-0base
* Sat Nov 21 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.4-0base

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2006,2007 - Tom Eastep (teastep@shorewall.net)
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.sourceforge.net
#
@@ -26,7 +26,7 @@
# You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.5.1
VERSION=4.4.10
usage() # $1 = exit status
{
@@ -79,7 +79,7 @@ if qt iptables -L shorewall -n && [ ! -f /sbin/shorewall ]; then
fi
if [ -L /usr/share/shorewall-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
FIREWALL=$(readlink -m -q /usr/share/shorewall-lite/init)
else
FIREWALL=/etc/init.d/shorewall-lite
fi
@@ -106,6 +106,7 @@ rm -rf /var/lib/shorewall-lite
rm -rf /var/lib/shorewall-lite-*.bkout
rm -rf /usr/share/shorewall-lite
rm -rf /usr/share/shorewall-lite-*.bkout
rm -f /etc/logrotate.d/shorewall-lite
echo "Shorewall Uninstalled"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#
# Shorewall WAN Interface monitor - V4.2
# Shorewall WAN Interface monitor - V4.4
#
# Inspired by Angsuman Chakraborty's gwping script.
#

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# Shorewall WAN Interface monitor - V4.2
# Shorewall WAN Interface monitor - V4.4
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#

View File

@@ -3,9 +3,9 @@
#
# /usr/share/shorewall/macro.BGP
#
# This macro handles BGP4 traffic.
# This macro handles BGP4 traffic.
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 179 # BGP4
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 179 # BGP4

View File

@@ -3,11 +3,12 @@
#
# /usr/share/shorewall/macro.Citrix
#
# This macro handles Citrix/ICA traffic (ICA, ICA Browser, CGP a.k.a. ICA Session Reliability)
# This macro handles Citrix/ICA traffic (ICA, ICA Browser, CGP a.k.a.
# ICA Session Reliability)
#
####################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 1494 # ICA
PARAM - - udp 1604 # ICA Browser
PARAM - - tcp 2598 # CGP Session Reliabilty
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 1494 # ICA
PARAM - - udp 1604 # ICA Browser
PARAM - - tcp 2598 # CGP Session Reliabilty

View File

@@ -0,0 +1,12 @@
#
# Shorewall version 4 - DHCPfwd Macro
#
# /usr/share/shorewall/macro.DHCPfwd
#
# This macro (bidirectional) handles forwarded DHCP traffic
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 67:68 67:68 # DHCP
PARAM DEST SOURCE udp 67:68 67:68 # DHCP

View File

@@ -0,0 +1,11 @@
#
# Shorewall version 4 - HKP Macro
#
# /usr/share/shorewall/macro.HKP
#
# This macro handles OpenPGP HTTP keyserver protocol traffic.
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 11371

View File

@@ -3,9 +3,9 @@
#
# /usr/share/shorewall/macro.OSPF
#
# This macro handles OSPF multicast traffic
# This macro handles OSPF multicast traffic
#
#######################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ ORIGINAL
# PORT(S) PORT(S) DEST LIMIT GROUP DEST
PARAM - - 89 - # OSPF
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - 89 # OSPF

View File

@@ -3,7 +3,7 @@
#
# /usr/share/shorewall/macro.Razor
#
# This macro handles traffic for the Razor Antispam System
# This macro handles traffic for the Razor Antispam System
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/

View File

@@ -1,12 +1,15 @@
#
# Shorewall version 4 - Multicast DNS Macro
#
# /usr/share/shorewall/macro.DNS
# /usr/share/shorewall/macro.mDNS
#
# This macro handles multicast DNS traffic.
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 5353
PARAM DEST SOURCE udp 5353
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - 224.0.0.251 udp 5353
PARAM - - udp 32768: 5353
PARAM - 224.0.0.251 2
PARAM DEST SOURCE:224.0.0.251 udp 5353
PARAM DEST SOURCE:224.0.0.251 2

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -35,7 +35,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_accounting );
our @EXPORT_OK = qw( );
our $VERSION = '4.4_1';
our $VERSION = '4.4.7';
#
# Called by the compiler to [re-]initialize this module's state
@@ -84,7 +84,7 @@ sub process_accounting_rule( ) {
$ports = '' if $ports eq 'any' || $ports eq 'all';
$sports = '' if $sports eq 'any' || $sports eq 'all';
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, 0xFF );
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} );
my $rule2 = 0;
unless ( $action eq 'COUNT' ) {
@@ -185,17 +185,17 @@ sub setup_accounting() {
if ( have_bridges ) {
if ( $filter_table->{accounting} ) {
for my $chain ( qw/INPUT FORWARD/ ) {
insert_rule1 $filter_table->{$chain}, 0, '-j accounting';
add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 );
}
}
if ( $filter_table->{accountout} ) {
insert_rule1 $filter_table->{OUTPUT}, 0, '-j accountout';
add_jump( $filter_table->{OUTPUT}, 'accountout', 0, '', 0, 0 );
}
} else {
if ( $filter_table->{accounting} ) {
for my $chain ( qw/INPUT FORWARD OUTPUT/ ) {
insert_rule1 $filter_table->{$chain}, 0, '-j accounting';
add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 );
}
}
}

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -57,7 +57,7 @@ our @EXPORT = qw( merge_levels
$macro_commands
);
our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_5';
our $VERSION = '4.4_10';
#
# Used Actions. Each action that is actually used has an entry with value 1.
@@ -213,7 +213,7 @@ sub merge_macro_source_dest( $$ ) {
if ( $invocation ) {
if ( $body ) {
return $body if $invocation eq '-';
return "$body:$invocation" if $invocation =~ /.*?\.*?\.|^\+|^!+|^~|^!~|~</;
return "$body:$invocation" if $invocation =~ /.*?\.*?\.|^\+|^!+|^~|^!~|~<|~\[/;
return "$invocation:$body";
}
@@ -305,10 +305,10 @@ sub map_old_actions( $ ) {
# Create and record a log action chain -- Log action chains have names
# that are formed from the action name by prepending a "%" and appending
# a 1- or 2-digit sequence number. In the functions that follow,
# the CHAIN, LEVEL and TAG variable serves as arguments to the user's
# the $chain, $level and $tag variable serves as arguments to the user's
# exit. We call the exit corresponding to the name of the action but we
# set CHAIN to the name of the iptables chain where rules are to be added.
# Similarly, LEVEL and TAG contain the log level and log tag respectively.
# set $chain to the name of the iptables chain where rules are to be added.
# Similarly, $level and $tag contain the log level and log tag respectively.
#
# The maximum length of a chain name is 30 characters -- since the log
# action chain name is 2-3 characters longer than the base chain name,
@@ -341,6 +341,8 @@ sub createlogactionchain( $$ ) {
unless ( $targets{$action} & BUILTIN ) {
dont_optimize $chainref;
my $file = find_file $chain;
if ( -f $file ) {
@@ -367,6 +369,8 @@ sub createsimpleactionchain( $ ) {
unless ( $targets{$action} & BUILTIN ) {
dont_optimize $chainref;
my $file = find_file $action;
if ( -f $file ) {
@@ -384,7 +388,7 @@ sub createsimpleactionchain( $ ) {
}
#
# Create an action chain and run it's associated user exit
# Create an action chain and run its associated user exit
#
sub createactionchain( $ ) {
my ( $action , $level ) = split_action $_[0];
@@ -574,7 +578,7 @@ sub process_actions2 () {
for my $target (keys %usedactions) {
my ($action, $level) = split_action $target;
my $actionref = $actions{$action};
fatal_error "Null Action Reference in process_actions2" unless $actionref;
assert( $actionref );
for my $action1 ( keys %{$actionref->{requires}} ) {
my $action2 = merge_levels $target, $action1;
unless ( $usedactions{ $action2 } ) {
@@ -609,7 +613,7 @@ sub process_action( $$$$$$$$$$$ ) {
expand_rule ( $chainref ,
NO_RESTRICT ,
do_proto( $proto, $ports, $sports ) . do_ratelimit( $rate, $action ) . do_user $user . do_test( $mark, 0xFF ) ,
do_proto( $proto, $ports, $sports ) . do_ratelimit( $rate, $action ) . do_user $user . do_test( $mark, $globals{TC_MASK} ) ,
$source ,
$dest ,
'', #Original Dest
@@ -766,10 +770,14 @@ sub process_action3( $$$$$ ) {
sub dropBcast( $$$ ) {
my ($chainref, $level, $tag) = @_;
if ( $capabilities{ADDRTYPE} ) {
if ( have_capability( 'ADDRTYPE' ) ) {
if ( $level ne '' ) {
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -m addrtype --dst-type BROADCAST ';
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -d 224.0.0.0/4 ';
if ( $family == F_IPV4 ) {
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -d 224.0.0.0/4 ';
} else {
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -d ff00::/10 -j DROP ';
}
}
add_rule $chainref, '-m addrtype --dst-type BROADCAST -j DROP';
@@ -800,7 +808,7 @@ sub dropBcast( $$$ ) {
sub allowBcast( $$$ ) {
my ($chainref, $level, $tag) = @_;
if ( $family == F_IPV4 && $capabilities{ADDRTYPE} ) {
if ( $family == F_IPV4 && have_capability( 'ADDRTYPE' ) ) {
if ( $level ne '' ) {
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -m addrtype --dst-type BROADCAST ';
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d 224.0.0.0/4 ';
@@ -834,44 +842,46 @@ sub allowBcast( $$$ ) {
sub dropNotSyn ( $$$ ) {
my ($chainref, $level, $tag) = @_;
log_rule_limit $level, $chainref, 'dropNotSyn' , 'DROP', '', $tag, 'add', '-p tcp ! --syn ' if $level ne '';
add_rule $chainref , '-p tcp ! --syn -j DROP';
log_rule_limit $level, $chainref, 'dropNotSyn' , 'DROP', '', $tag, 'add', '-p 6 ! --syn ' if $level ne '';
add_rule $chainref , '-p 6 ! --syn -j DROP';
}
sub rejNotSyn ( $$$ ) {
my ($chainref, $level, $tag) = @_;
log_rule_limit $level, $chainref, 'rejNotSyn' , 'REJECT', '', $tag, 'add', '-p tcp ! --syn ' if $level ne '';
add_rule $chainref , '-p tcp ! --syn -j REJECT --reject-with tcp-reset';
log_rule_limit $level, $chainref, 'rejNotSyn' , 'REJECT', '', $tag, 'add', '-p 6 ! --syn ' if $level ne '';
add_rule $chainref , '-p 6 ! --syn -j REJECT --reject-with tcp-reset';
}
sub dropInvalid ( $$$ ) {
my ($chainref, $level, $tag) = @_;
log_rule_limit $level, $chainref, 'dropInvalid' , 'DROP', '', $tag, 'add', '-m state --state INVALID ' if $level ne '';
add_rule $chainref , '-m state --state INVALID -j DROP';
log_rule_limit $level, $chainref, 'dropInvalid' , 'DROP', '', $tag, 'add', "$globals{STATEMATCH} INVALID " if $level ne '';
add_rule $chainref , "$globals{STATEMATCH} INVALID -j DROP";
}
sub allowInvalid ( $$$ ) {
my ($chainref, $level, $tag) = @_;
log_rule_limit $level, $chainref, 'allowInvalid' , 'ACCEPT', '', $tag, 'add', '-m state --state INVALID ' if $level ne '';
add_rule $chainref , '-m state --state INVALID -j ACCEPT';
log_rule_limit $level, $chainref, 'allowInvalid' , 'ACCEPT', '', $tag, 'add', "$globals{STATEMATCH} INVALID " if $level ne '';
add_rule $chainref , "$globals{STATEMATCH} INVALID -j ACCEPT";
}
sub forwardUPnP ( $$$ ) {
my $chainref = dont_optimize 'forwardUPnP';
add_commands( $chainref , '[ -f ${VARDIR}/.forwardUPnP ] && cat ${VARDIR}/.forwardUPnP >&3' );
}
sub allowinUPnP ( $$$ ) {
my ($chainref, $level, $tag) = @_;
if ( $level ne '' ) {
log_rule_limit $level, $chainref, 'allowinUPnP' , 'ACCEPT', '', $tag, 'add', '-p udp --dport 1900 ';
log_rule_limit $level, $chainref, 'allowinUPnP' , 'ACCEPT', '', $tag, 'add', '-p tcp --dport 49152 ';
log_rule_limit $level, $chainref, 'allowinUPnP' , 'ACCEPT', '', $tag, 'add', '-p 17 --dport 1900 ';
log_rule_limit $level, $chainref, 'allowinUPnP' , 'ACCEPT', '', $tag, 'add', '-p 6 --dport 49152 ';
}
add_rule $chainref, '-p udp --dport 1900 -j ACCEPT';
add_rule $chainref, '-p tcp --dport 49152 -j ACCEPT';
add_rule $chainref, '-p 17 --dport 1900 -j ACCEPT';
add_rule $chainref, '-p 6 --dport 49152 -j ACCEPT';
}
sub Limit( $$$ ) {
@@ -897,7 +907,7 @@ sub Limit( $$$ ) {
my $xchainref = new_chain 'filter' , "$chainref->{name}%";
log_rule_limit $level, $xchainref, $tag[0], 'DROP', '', '', 'add', '';
add_rule $xchainref, '-j DROP';
add_rule $chainref, "-m recent --name $set --update --seconds $tag[2] --hitcount $count -j $xchainref->{name}";
add_jump $chainref, $xchainref, 0, "-m recent --name $set --update --seconds $tag[2] --hitcount $count ";
} else {
add_rule $chainref, "-m recent --update --name $set --seconds $tag[2] --hitcount $count -j DROP";
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -41,9 +41,9 @@ use Shorewall::IPAddrs;
use Shorewall::Raw;
our @ISA = qw(Exporter);
our @EXPORT = qw( compiler EXPORT TIMESTAMP DEBUG );
our @EXPORT = qw( compiler );
our @EXPORT_OK = qw( $export );
our $VERSION = '4.4_4';
our $VERSION = '4.4_10';
our $export;
@@ -72,36 +72,38 @@ sub initialize_package_globals() {
#
# First stage of script generation.
#
# Copy prog.header to the generated script.
# Copy prog.header and lib.common to the generated script.
# Generate the various user-exit jacket functions.
#
sub generate_script_1() {
# Note: This function is not called when $command eq 'check'. So it must have no side effects other
# than those related to writing to the output script file.
#
sub generate_script_1( $ ) {
if ( $test ) {
emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall-perl\n#";
} else {
my $date = localtime;
my $script = shift;
emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
if ( $family == F_IPV4 ) {
copy $globals{SHAREDIRPL} . 'prog.header';
if ( $script ) {
if ( $test ) {
emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall-perl\n#";
} else {
copy $globals{SHAREDIRPL} . 'prog.header6';
my $date = localtime;
emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
if ( $family == F_IPV4 ) {
copy $globals{SHAREDIRPL} . 'prog.header';
} else {
copy $globals{SHAREDIRPL} . 'prog.header6';
}
copy2 $globals{SHAREDIR} . '/lib.common', 0;
}
}
my $lib = find_file 'lib.private';
if ( -f $lib ) {
emit <<'EOF';
################################################################################
# Functions imported from lib.private
################################################################################
EOF
copy1 $lib;
emit "\n";
}
copy2( $lib, $debug ) if -f $lib;
emit <<'EOF';
################################################################################
@@ -164,24 +166,24 @@ sub generate_script_2() {
if ( $export ) {
emit ( 'SHAREDIR=/usr/share/shorewall-lite',
'CONFDIR=/etc/shorewall-lite',
'PRODUCT="Shorewall Lite"'
'g_product="Shorewall Lite"'
);
} else {
emit ( 'SHAREDIR=/usr/share/shorewall',
'CONFDIR=/etc/shorewall',
'PRODUCT=\'Shorewall\'',
'g_product=\'Shorewall\'',
);
}
} else {
if ( $export ) {
emit ( 'SHAREDIR=/usr/share/shorewall6-lite',
'CONFDIR=/etc/shorewall6-lite',
'PRODUCT="Shorewall6 Lite"'
'g_product="Shorewall6 Lite"'
);
} else {
emit ( 'SHAREDIR=/usr/share/shorewall6',
'CONFDIR=/etc/shorewall6',
'PRODUCT=\'Shorewall6\'',
'g_product=\'Shorewall6\'',
);
}
}
@@ -213,16 +215,15 @@ sub generate_script_2() {
my @dont_load = split_list $config{DONT_LOAD}, 'module';
emit ( '[ -n "${COMMAND:=restart}" ]',
'[ -n "${VERBOSE:=0}" ]',
'[ -n "${VERBOSITY:=0}" ]',
qq([ -n "\${RESTOREFILE:=$config{RESTOREFILE}}" ]) );
emit ( qq(VERSION="$globals{VERSION}") ) unless $test;
emit ( qq(SHOREWALL_VERSION="$globals{VERSION}") ) unless $test;
emit ( qq(PATH="$config{PATH}") ,
'TERMINATOR=fatal_error' ,
qq(DONT_LOAD="@dont_load") ,
qq(STARTUP_LOG="$config{STARTUP_LOG}") ,
"LOG_VERBOSE=$config{LOG_VERBOSITY}" ,
''
);
@@ -231,7 +232,7 @@ sub generate_script_2() {
append_file 'params' if $config{EXPORTPARAMS};
emit ( '',
"STOPPING=",
"g_stopping=",
'',
'#',
'# The library requires that ${VARDIR} exist',
@@ -270,7 +271,7 @@ sub generate_script_2() {
set_global_variables(1);
handle_optional_interfaces;
handle_optional_interfaces(0);
emit ';;';
@@ -283,7 +284,7 @@ sub generate_script_2() {
set_global_variables(0);
handle_optional_interfaces;
handle_optional_interfaces(0);
emit ';;';
}
@@ -293,7 +294,7 @@ sub generate_script_2() {
emit ( 'esac' ) ,
} else {
emit( 'true' ) unless handle_optional_interfaces;
emit( 'true' ) unless handle_optional_interfaces(1);
}
pop_indent;
@@ -302,7 +303,6 @@ sub generate_script_2() {
}
#
# Final stage of script generation.
#
# Generate code for loading the various files in /var/lib/shorewall[6][-lite]
@@ -334,9 +334,9 @@ sub generate_script_3($) {
save_progress_message 'Initializing...';
if ( $export ) {
my $fn = find_file 'modules';
my $fn = find_file $config{LOAD_HELPERS_ONLY} ? 'helpers' : 'modules';
if ( $fn ne "$globals{SHAREDIR}/modules" && -f $fn ) {
if ( -f $fn && ! $fn =~ "^$globals{SHAREDIR}/" ) {
emit 'echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir';
emit 'cat > ${VARDIR}/.modules << EOF';
open_file $fn;
@@ -353,54 +353,17 @@ sub generate_script_3($) {
}
if ( $family == F_IPV4 ) {
my @ipsets = all_ipsets;
if ( @ipsets ) {
emit ( '',
'case $IPSET in',
' */*)',
' [ -x "$IPSET" ] || fatal_error "IPSET=$IPSET does not exist or is not executable"',
' ;;',
' *)',
' IPSET="$(mywhich $IPSET)"',
' [ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"' ,
' ;;',
'esac',
'',
'if [ "$COMMAND" = start ]; then' ,
' if [ -f ${VARDIR}/ipsets.save ]; then' ,
' $IPSET -F' ,
' $IPSET -X' ,
' $IPSET -R < ${VARDIR}/ipsets.save' ,
' fi' ,
'' );
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( '' ,
'elif [ "$COMMAND" = restart ]; then' ,
'' );
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( '' ,
' if $IPSET -S > ${VARDIR}/ipsets.tmp; then' ,
' grep -q "^-N" ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save' ,
' fi' );
emit ( 'fi',
'' );
}
load_ipsets;
emit ( 'if [ "$COMMAND" = refresh ]; then' ,
' run_refresh_exit' );
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( 'else' ,
' run_refresh_exit' ,
'else' ,
' run_init_exit',
'fi',
'' );
save_dynamic_chains;
mark_firewall_not_started;
emit ('',
@@ -408,7 +371,7 @@ sub generate_script_3($) {
''
);
if ( $capabilities{NAT_ENABLED} ) {
if ( have_capability( 'NAT_ENABLED' ) ) {
emit( 'if [ -f ${VARDIR}/nat ]; then',
' while read external interface; do',
' del_ip_addr $external $interface',
@@ -423,6 +386,7 @@ sub generate_script_3($) {
} else {
emit ( '[ "$COMMAND" = refresh ] && run_refresh_exit || run_init_exit',
'' );
save_dynamic_chains;
mark_firewall_not_started;
emit '';
}
@@ -477,6 +441,7 @@ EOF
pop_indent;
setup_forwarding( $family , 1 );
push_indent;
emit<<'EOF';
set_state "Started"
run_restored_exit
@@ -485,16 +450,17 @@ else
chainlist_reload
EOF
setup_forwarding( $family , 0 );
emit<<'EOF';
run_refreshed_exit
do_iptables -N shorewall
set_state "Started"
else
setup_netfilter
restore_dynamic_rules
conditionally_flush_conntrack
EOF
setup_forwarding( $family , 0 );
emit<<'EOF';
run_start_exit
do_iptables -N shorewall
@@ -509,16 +475,16 @@ date > ${VARDIR}/restarted
case $COMMAND in
start)
logger -p kern.info "$PRODUCT started"
logger -p kern.info "$g_product started"
;;
restart)
logger -p kern.info "$PRODUCT restarted"
logger -p kern.info "$g_product restarted"
;;
refresh)
logger -p kern.info "$PRODUCT refreshed"
logger -p kern.info "$g_product refreshed"
;;
restore)
logger -p kern.info "$PRODUCT restored"
logger -p kern.info "$g_product restored"
;;
esac
EOF
@@ -536,8 +502,8 @@ EOF
#
sub compiler {
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity ) =
( '', '', -1, '', 0, '', '', -1 );
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview ) =
( '', '', -1, '', 0, '', '', -1, 0 );
$export = 0;
$test = 0;
@@ -569,6 +535,7 @@ sub compiler {
log => { store => \$log },
log_verbosity => { store => \$log_verbosity, validate => \&validate_verbosity } ,
test => { store => \$test },
preview => { store => \$preview },
);
#
# P A R A M E T E R P R O C E S S I N G
@@ -593,6 +560,8 @@ sub compiler {
set_shorewall_dir( $directory );
}
$verbosity = 1 if $debug && $verbosity < 1;
set_verbosity( $verbosity );
set_log($log, $log_verbosity) if $log;
set_timestamp( $timestamp );
@@ -602,11 +571,11 @@ sub compiler {
#
get_configuration( $export );
report_capabilities;
report_capabilities unless $config{LOAD_HELPERS_ONLY};
require_capability( 'MULTIPORT' , "Shorewall $globals{VERSION}" , 's' );
require_capability( 'RECENT_MATCH' , 'MACLIST_TTL' , 's' ) if $config{MACLIST_TTL};
require_capability( 'XCONNMARK' , 'HIGH_ROUTE_MARKS=Yes' , 's' ) if $config{HIGH_ROUTE_MARKS};
require_capability( 'XCONNMARK' , 'HIGH_ROUTE_MARKS=Yes' , 's' ) if $config{PROVIDER_OFFSET} > 0;
require_capability( 'MANGLE_ENABLED' , 'Traffic Shaping' , 's' ) if $config{TC_ENABLED};
if ( $scriptfilename ) {
@@ -659,11 +628,11 @@ sub compiler {
enable_script;
if ( $scriptfilename ) {
if ( $scriptfilename || $debug ) {
#
# Place Header in the script
#
generate_script_1;
generate_script_1( $scriptfilename );
#
# C O M M O N _ R U L E S
# (Writes the setup_common_rules() function to the compiled script)
@@ -677,11 +646,11 @@ sub compiler {
push_indent;
}
#
# Do all of the zone-independent stuff
# Do all of the zone-independent stuff (mostly /proc)
#
add_common_rules;
#
# /proc stuff
# More /proc
#
if ( $family == F_IPV4 ) {
setup_arp_filtering;
@@ -699,7 +668,7 @@ sub compiler {
#
setup_zone_mss;
if ( $scriptfilename ) {
if ( $scriptfilename || $debug ) {
emit 'return 0';
pop_indent;
emit '}';
@@ -712,7 +681,7 @@ sub compiler {
#
enable_script;
if ( $scriptfilename ) {
if ( $scriptfilename || $debug ) {
emit( "\n#",
'# Setup routing and traffic shaping',
'#',
@@ -730,7 +699,7 @@ sub compiler {
#
setup_tc;
if ( $scriptfilename ) {
if ( $scriptfilename || $debug ) {
pop_indent;
emit "}\n";
}
@@ -746,7 +715,7 @@ sub compiler {
#
# ECN
#
setup_ecn if $capabilities{MANGLE_ENABLED} && $config{MANGLE_ENABLED};
setup_ecn if have_capability( 'MANGLE_ENABLED' ) && $config{MANGLE_ENABLED};
#
# Setup Masquerading/SNAT
#
@@ -789,14 +758,26 @@ sub compiler {
#
# Accounting.
#
setup_accounting;
setup_accounting if $config{ACCOUNTING};
if ( $scriptfilename ) {
#
# Generate the zone by zone matrix
# Compiling a script - generate the zone by zone matrix
#
generate_matrix;
if ( $config{OPTIMIZE} & 0xD ) {
progress_message2 'Optimizing Ruleset...';
#
# Optimize Policy Chains
#
optimize_policy_chains if $config{OPTIMIZE} & 2;
#
# More Optimization
#
optimize_ruleset if $config{OPTIMIZE} & 0xC;
}
enable_script;
#
# I N I T I A L I Z E
@@ -818,7 +799,12 @@ sub compiler {
# S T O P _ F I R E W A L L
# (Writes the stop_firewall() function to the compiled script)
#
compile_stop_firewall( $test );
compile_stop_firewall( $test, $export );
#
# U P D O W N
# (Writes the updown() function to the compiled script)
#
compile_updown;
#
# Copy the footer to the script
#
@@ -840,17 +826,50 @@ sub compiler {
#
enable_script, generate_aux_config if $export;
} else {
#
# Just checking the configuration
#
if ( $preview || $debug ) {
#
# User wishes to preview the ruleset or we are tracing -- generate the rule matrix
#
generate_matrix;
if ( $config{OPTIMIZE} & 6 ) {
progress_message2 'Optimizing Ruleset...';
#
# Optimize Policy Chains
#
optimize_policy_chains if $config{OPTIMIZE} & 2;
#
# Ruleset Optimization
#
optimize_ruleset if $config{OPTIMIZE} & 4;
}
enable_script if $debug;
generate_script_2 if $debug;
preview_netfilter_load if $preview;
}
#
# Re-initialize the chain table so that process_routestopped() has the same
# environment that it would when called by compile_stop_firewall().
#
Shorewall::Chains::initialize( $family );
initialize_chain_table;
#
# compile_stop_firewall() also validates the routestopped file. Since we don't
# call that function during 'check', we must validate routestopped here.
#
process_routestopped;
if ( $debug ) {
compile_stop_firewall( $test, $export );
disable_script;
} else {
#
# compile_stop_firewall() also validates the routestopped file. Since we don't
# call that function during normal 'check', we must validate routestopped here.
#
process_routestopped;
}
if ( $family == F_IPV4 ) {
progress_message3 "Shorewall configuration verified";

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -26,7 +26,7 @@
#
package Shorewall::IPAddrs;
require Exporter;
use Shorewall::Config qw( :DEFAULT split_list require_capability in_hex8 F_IPV4 F_IPV6 );
use Shorewall::Config qw( :DEFAULT split_list require_capability in_hex8 numeric_value F_IPV4 F_IPV6 );
use Socket;
use strict;
@@ -47,6 +47,7 @@ our @EXPORT = qw( ALLIPv4
ALL
TCP
UDP
UDPLITE
ICMP
DCCP
IPv6_ICMP
@@ -72,7 +73,7 @@ our @EXPORT = qw( ALLIPv4
validate_icmp6
);
our @EXPORT_OK = qw( );
our $VERSION = '4.4_5';
our $VERSION = '4.4_7';
#
# Some IPv4/6 useful stuff
@@ -103,11 +104,11 @@ use constant { ALLIPv4 => '0.0.0.0/0' ,
UDP => 17,
DCCP => 33,
IPv6_ICMP => 58,
SCTP => 132 };
SCTP => 132,
UDPLITE => 136 };
our @rfc1918_networks = ( "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" );
#
# Note: initialize() is declared at the bottom of the file
#
@@ -287,7 +288,12 @@ sub resolve_proto( $ ) {
my $proto = $_[0];
my $number;
$proto =~ /^(\d+)$/ ? $proto <= 65535 ? $proto : undef : defined( $number = $nametoproto{$proto} ) ? $number : scalar getprotobyname $proto;
if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) {
$number = numeric_value ( $proto );
defined $number && $number <= 65535 ? $number : undef;
} else {
defined( $number = $nametoproto{$proto} ) ? $number : scalar getprotobyname $proto;
}
}
sub proto_name( $ ) {
@@ -301,16 +307,19 @@ sub validate_port( $$ ) {
my $value;
if ( $port =~ /^(\d+)$/ ) {
return $port if $port && $port <= 65535;
if ( $port =~ /^(\d+)$/ || $port =~ /^0x/ ) {
$port = numeric_value $port;
return $port if defined $port && $port && $port <= 65535;
} else {
$proto = proto_name $proto if $proto =~ /^(\d+)$/;
$value = getservbyname( $port, $proto );
}
fatal_error "Invalid/Unknown $proto port/service ($port)" unless defined $value;
return $value if defined $value;
$value;
fatal_error "The separator for a port range is ':', not '-' ($port)" if $port =~ /^\d+-\d+$/;
fatal_error "Invalid/Unknown $proto port/service ($_[1])" unless defined $value;
}
sub validate_portpair( $$ ) {

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -36,7 +36,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_masq setup_nat setup_netmap add_addresses );
our @EXPORT_OK = ();
our $VERSION = '4.4_4';
our $VERSION = '4.4_9';
our @addresses_to_add;
our %addresses_to_add;
@@ -150,7 +150,7 @@ sub process_one_masq( )
# Handle IPSEC options, if any
#
if ( $ipsec ne '-' ) {
fatal_error "Non-empty IPSEC column requires policy match support in your kernel and iptables" unless $globals{ORIGINAL_POLICY_MATCH};
fatal_error "Non-empty IPSEC column requires policy match support in your kernel and iptables" unless have_capability( 'POLICY_MATCH' );
if ( $ipsec =~ /^yes$/i ) {
$baserule .= '-m policy --pol ipsec --dir out ';
@@ -159,7 +159,7 @@ sub process_one_masq( )
} else {
$baserule .= do_ipsec_options $ipsec;
}
} elsif ( $capabilities{POLICY_MATCH} ) {
} elsif ( have_ipsec ) {
$baserule .= '-m policy --pol none --dir out ';
}
@@ -170,8 +170,8 @@ sub process_one_masq( )
#
# Handle Mark
#
$baserule .= do_test( $mark, 0xFF) if $mark ne '-';
$baserule .= do_user( $user ) if $user ne '-';
$baserule .= do_test( $mark, $globals{TC_MASK} ) if $mark ne '-';
$baserule .= do_user( $user ) if $user ne '-';
for my $fullinterface (split_list $interfacelist, 'interface' ) {
my $rule = '';
@@ -372,7 +372,7 @@ sub do_one_nat( $$$$$ )
$interface = $interfaceref->{name};
}
if ( $capabilities{POLICY_MATCH} ) {
if ( have_ipsec ) {
$policyin = ' -m policy --pol none --dir in';
$policyout = '-m policy --pol none --dir out';
}
@@ -402,7 +402,6 @@ sub do_one_nat( $$$$$ )
push @addresses_to_add, ( $external , $fullinterface );
}
}
}
#
@@ -457,7 +456,7 @@ sub setup_netmap() {
my $ruleout = '';
my $iface = $interface;
fatal_error "Unknown interface ($interface)" unless my $interfaceref = find_interface( $interface );
fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface );
unless ( $interfaceref->{root} ) {
$rulein = match_source_dev $interface;
@@ -466,7 +465,7 @@ sub setup_netmap() {
}
if ( $type eq 'DNAT' ) {
add_rule ensure_chain( 'nat' , input_chain $interface ) , $rulein . "-d $net1 -j NETMAP --to $net2";
add_rule ensure_chain( 'nat' , input_chain $interface ) , $rulein . "-d $net1 -j NETMAP --to $net2";
} elsif ( $type eq 'SNAT' ) {
add_rule ensure_chain( 'nat' , output_chain $interface ) , $ruleout . "-s $net1 -j NETMAP --to $net2";
} else {

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -32,9 +32,9 @@ use Shorewall::Actions;
use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( validate_policy apply_policy_rules complete_standard_chain setup_syn_flood_chains save_policies );
our @EXPORT = qw( validate_policy apply_policy_rules complete_standard_chain setup_syn_flood_chains save_policies optimize_policy_chains);
our @EXPORT_OK = qw( );
our $VERSION = '4.4_4';
our $VERSION = '4.4_9';
# @policy_chains is a list of references to policy chains in the filter table
@@ -66,11 +66,11 @@ sub convert_to_policy_chain($$$$$)
#
sub new_policy_chain($$$$)
{
my ($source, $dest, $policy, $optional) = @_;
my ($source, $dest, $policy, $provisional) = @_;
my $chainref = new_chain( 'filter', rules_chain( ${source}, ${dest} ) );
convert_to_policy_chain( $chainref, $source, $dest, $policy, $optional );
convert_to_policy_chain( $chainref, $source, $dest, $policy, $provisional );
$chainref;
}
@@ -115,7 +115,7 @@ sub set_policy_chain($$$$$)
#
# Process the policy file
#
use constant { OPTIONAL => 1 };
use constant { PROVISIONAL => 1 };
sub add_or_modify_policy_chain( $$ ) {
my ( $zone, $zone1 ) = @_;
@@ -124,11 +124,11 @@ sub add_or_modify_policy_chain( $$ ) {
if ( $chainref ) {
unless( $chainref->{is_policy} ) {
convert_to_policy_chain( $chainref, $zone, $zone1, 'CONTINUE', OPTIONAL );
convert_to_policy_chain( $chainref, $zone, $zone1, 'CONTINUE', PROVISIONAL );
push @policy_chains, $chainref;
}
} else {
push @policy_chains, ( new_policy_chain $zone, $zone1, 'CONTINUE', OPTIONAL );
push @policy_chains, ( new_policy_chain $zone, $zone1, 'CONTINUE', PROVISIONAL );
}
}
@@ -329,7 +329,8 @@ sub validate_policy()
}
for $zone ( all_zones ) {
push @policy_chains, ( new_policy_chain $zone, $zone, 'ACCEPT', OPTIONAL );
push @policy_chains, ( new_policy_chain $zone, $zone, 'ACCEPT', PROVISIONAL );
push @policy_chains, ( new_policy_chain firewall_zone, $zone, 'NONE', PROVISIONAL ) if zone_type( $zone ) == BPORT;
if ( $config{IMPLICIT_CONTINUE} && ( @{find_zone( $zone )->{parents}} ) ) {
for my $zone1 ( all_zones ) {
@@ -362,7 +363,7 @@ sub policy_rules( $$$$$ ) {
unless ( $target eq 'NONE' ) {
add_rule $chainref, "-d 224.0.0.0/4 -j RETURN" if $dropmulticast && $target ne 'CONTINUE' && $target ne 'ACCEPT';
add_rule $chainref, "-j $default" if $default && $default ne 'none';
add_jump $chainref, $default, 0 if $default && $default ne 'none';
log_rule $loglevel , $chainref , $target , '' if $loglevel ne '';
fatal_error "Null target in policy_rules()" unless $target;
@@ -418,10 +419,21 @@ sub apply_policy_rules() {
my $provisional = $chainref->{provisional};
my $default = $chainref->{default};
my $name = $chainref->{name};
my $synparms = $chainref->{synparms};
if ( $policy ne 'NONE' ) {
if ( ! $chainref->{referenced} && ( ! $provisional && $policy ne 'CONTINUE' ) ) {
ensure_filter_chain $name, 1;
unless ( $chainref->{referenced} || $provisional || $policy eq 'CONTINUE' ) {
if ( $config{OPTIMIZE} & 2 ) {
#
# This policy chain is empty and the only thing that we would put in it is
# the policy-related stuff. Don't create it if all we are going to put in it
# is a single jump. Generate_matrix() will just use the policy target when
# needed.
#
ensure_filter_chain $name, 1 if $default ne 'none' || $loglevel || $synparms || $config{MULTICAST} || ! ( $policy eq 'ACCEPT' || $config{FASTACCEPT} );
} else {
ensure_filter_chain $name, 1;
}
}
if ( $name =~ /^all[-2]|[-2]all$/ ) {
@@ -455,7 +467,7 @@ sub apply_policy_rules() {
sub complete_standard_chain ( $$$$ ) {
my ( $stdchainref, $zone, $zone2, $default ) = @_;
add_rule $stdchainref, '-m state --state ESTABLISHED,RELATED -j ACCEPT' unless $config{FASTACCEPT};
add_rule $stdchainref, "$globals{STATEMATCH} ESTABLISHED,RELATED -j ACCEPT" unless $config{FASTACCEPT};
run_user_exit $stdchainref;
@@ -487,4 +499,24 @@ sub setup_syn_flood_chains() {
}
}
#
# Optimize Policy chains with ACCEPT policy
#
sub optimize_policy_chains() {
for my $chainref ( grep $_->{policy} eq 'ACCEPT', @policy_chains ) {
optimize_chain ( $chainref );
}
#
# Often, fw->all has an ACCEPT policy. This code allows optimization in that case
#
my $outputrules = $filter_table->{OUTPUT}{rules};
if ( @{$outputrules} && $outputrules->[-1] =~ /-j ACCEPT/ ) {
optimize_chain( $filter_table->{OUTPUT} );
}
progress_message ' Policy chains optimized';
progress_message '';
}
1;

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -41,7 +41,7 @@ our @EXPORT = qw(
setup_forwarding
);
our @EXPORT_OK = qw( );
our $VERSION = '4.4_4';
our $VERSION = '4.4_7';
#
# ARP Filtering
@@ -130,7 +130,7 @@ sub setup_route_filtering() {
emit "fi\n";
}
if ( $capabilities{KERNELVERSION} < 20631 ) {
if ( have_capability( 'KERNELVERSION' ) < 20631 ) {
emit 'echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter';
} elsif ( $val ne '' ) {
emit "echo $val > /proc/sys/net/ipv4/conf/all/rp_filter";
@@ -138,7 +138,7 @@ sub setup_route_filtering() {
emit "echo $val > /proc/sys/net/ipv4/conf/default/rp_filter" if $val ne '';
emit "[ -n \"\$NOROUTES\" ] || \$IP -4 route flush cache";
emit "[ -n \"\$g_noroutes\" ] || \$IP -4 route flush cache";
}
}

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -35,7 +35,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_providers @routemarked_interfaces handle_stickiness handle_optional_interfaces );
our @EXPORT_OK = qw( initialize lookup_provider );
our $VERSION = '4.4_4';
our $VERSION = '4.4_10';
use constant { LOCAL_TABLE => 255,
MAIN_TABLE => 254,
@@ -59,6 +59,8 @@ our @providers;
our $family;
our $lastmark;
use constant { ROUTEMARKED_SHARED => 1, ROUTEMARKED_UNSHARED => 2 };
#
@@ -94,7 +96,7 @@ sub initialize( $ ) {
# Set up marking for 'tracked' interfaces.
#
sub setup_route_marking() {
my $mask = $config{HIGH_ROUTE_MARKS} ? $config{WIDE_TC_MARKS} ? '0xFF0000' : '0xFF00' : '0xFF';
my $mask = in_hex( $globals{PROVIDER_MASK} );
require_capability( $_ , q(The provider 'track' option) , 's' ) for qw/CONNMARK_MATCH CONNMARK/;
@@ -112,7 +114,7 @@ sub setup_route_marking() {
my $mark = $providerref->{mark};
unless ( $marked_interfaces{$interface} ) {
add_rule $mangle_table->{PREROUTING} , "-i $physical -m mark --mark 0/$mask -j routemark";
add_jump $mangle_table->{PREROUTING} , $chainref, 0, "-i $physical -m mark --mark 0/$mask ";
add_jump $mangle_table->{PREROUTING} , $chainref1, 0, "! -i $physical -m mark --mark $mark/$mask ";
add_jump $mangle_table->{OUTPUT} , $chainref2, 0, "-m mark --mark $mark/$mask ";
$marked_interfaces{$interface} = 1;
@@ -293,36 +295,8 @@ sub add_a_provider( ) {
$gateway = '';
}
my $val = 0;
my $pref;
if ( $mark ne '-' ) {
$val = numeric_value $mark;
fatal_error "Invalid Mark Value ($mark)" unless defined $val;
verify_mark $mark;
if ( $val < 65535 ) {
if ( $config{HIGH_ROUTE_MARKS} ) {
fatal_error "Invalid Mark Value ($mark) with HIGH_ROUTE_MARKS=Yes and WIDE_TC_MARKS=Yes" if $config{WIDE_TC_MARKS};
fatal_error "Invalid Mark Value ($mark) with HIGH_ROUTE_MARKS=Yes" if $val < 256;
}
} else {
fatal_error "Invalid Mark Value ($mark)" unless $config{HIGH_ROUTE_MARKS} && $config{WIDE_TC_MARKS};
}
for my $providerref ( values %providers ) {
fatal_error "Duplicate mark value ($mark)" if numeric_value( $providerref->{mark} ) == $val;
}
$pref = 10000 + $number - 1;
}
my ( $loose, $track, $balance , $default, $default_balance, $optional, $mtu ) =
(0, $config{TRACK_PROVIDERS}, 0 , 0, $config{USE_DEFAULT_RT} ? 1 : 0, interface_is_optional( $interface ), '' );
my ( $loose, $track, $balance , $default, $default_balance, $optional, $mtu, $local ) =
(0, $config{TRACK_PROVIDERS}, 0 , 0, $config{USE_DEFAULT_RT} ? 1 : 0, interface_is_optional( $interface ), '' , 0 );
unless ( $options eq '-' ) {
for my $option ( split_list $options, 'option' ) {
@@ -363,12 +337,43 @@ sub add_a_provider( ) {
} else {
$default = -1;
}
} elsif ( $option eq 'local' ) {
$local = 1;
$track = 0 if $config{TRACK_PROVIDERS};
$default_balance = 0 if$config{USE_DEFAULT_RT};
} else {
fatal_error "Invalid option ($option)";
}
}
}
my $val = 0;
my $pref;
$mark = ( $lastmark += ( 1 << $config{PROVIDER_OFFSET} ) ) if $mark eq '-' && $track;
if ( $mark ne '-' ) {
$val = numeric_value $mark;
fatal_error "Invalid Mark Value ($mark)" unless defined $val && $val;
verify_mark $mark;
fatal_error "Invalid Mark Value ($mark)" unless ( $val & $globals{PROVIDER_MASK} ) == $val;
fatal_error "Provider MARK may not be specified when PROVIDER_BITS=0" unless $config{PROVIDER_BITS};
for my $providerref ( values %providers ) {
fatal_error "Duplicate mark value ($mark)" if numeric_value( $providerref->{mark} ) == $val;
}
$pref = 10000 + $number - 1;
$lastmark = $val;
}
unless ( $loose ) {
warning_message q(The 'proxyarp' option is dangerous when specified on a Provider interface) if get_interface_option( $interface, 'proxyarp' );
warning_message q(The 'proxyndp' option is dangerous when specified on a Provider interface) if get_interface_option( $interface, 'proxyndp' );
@@ -411,7 +416,7 @@ sub add_a_provider( ) {
start_provider( $table, $number, qq(if interface_is_usable $physical && [ -n "$variable" ]; then) );
} else {
if ( $optional ) {
start_provider( $table, $number, qq(if [ -n "\$${base}_IS_USABLE" ]; then) );
start_provider( $table, $number, qq(if [ -n "\$SW_${base}_IS_USABLE" ]; then) );
} elsif ( $gatewaycase eq 'detect' ) {
start_provider( $table, $number, qq(if interface_is_usable $physical && [ -n "$gateway" ]; then) );
} else {
@@ -420,7 +425,13 @@ sub add_a_provider( ) {
$provider_interfaces{$interface} = $table;
emit "run_ip route add default dev $physical table $number" if $gatewaycase eq 'none';
if ( $gatewaycase eq 'none' ) {
if ( $local ) {
emit "run_ip route add local 0.0.0.0/0 dev $physical table $number";
} else {
emit "run_ip route add default dev $physical table $number";
}
}
}
if ( $mark ne '-' ) {
@@ -470,7 +481,12 @@ sub add_a_provider( ) {
}
}
if ( $loose ) {
if ( $local ) {
fatal_error "GATEWAY not valid with 'local' provider" unless $gatewaycase eq 'none';
fatal_error "'track' not valid with 'local'" if $track;
fatal_error "DUPLICATE not valid with 'local'" if $duplicate ne '-';
fatal_error "MARK required with 'local'" unless $mark;
} elsif ( $loose ) {
if ( $config{DELETE_THEN_ADD} ) {
emit ( "\nfind_interface_addresses $physical | while read address; do",
" qt \$IP -$family rule del from \$address",
@@ -527,7 +543,7 @@ sub add_a_provider( ) {
sub start_new_if( $ ) {
our $current_if = shift;
emit ( '', qq(if [ -n "\$${current_if}_IS_USABLE" ]; then) );
emit ( '', qq(if [ -n "\$SW_${current_if}_IS_USABLE" ]; then) );
push_indent;
}
@@ -589,7 +605,7 @@ sub add_an_rtrule( ) {
} else {
$source = "iif $source";
}
} elsif ( $source =~ /^(.+?):<(.+)>\s*$/ ) {
} elsif ( $source =~ /^(.+?):<(.+)>\s*$/ || $source =~ /^(.+?):\[(.+)\]\s*$/ ) {
my ($interface, $source ) = ($1, $2);
validate_net ($source, 0);
$interface = physical_name $interface;
@@ -737,12 +753,14 @@ sub finish_providers() {
sub setup_providers() {
my $providers = 0;
$lastmark = 0;
my $fn = open_file 'providers';
first_entry sub() {
emit "\nif [ -z \"\$NOROUTES\" ]; then";
push_indent;
progress_message2 "$doing $fn...";
emit "\nif [ -z \"\$g_noroutes\" ]; then";
push_indent;
start_providers; };
add_a_provider, $providers++ while read_a_line;
@@ -767,14 +785,14 @@ sub setup_providers() {
setup_null_routing if $config{NULL_ROUTE_RFC1918};
emit "\nrun_ip route flush cache";
#
# This completes the if block begun in the first_entry closure
# This completes the if-block begun in the first_entry closure above
#
pop_indent;
emit "fi\n";
setup_route_marking if @routemarked_interfaces;
} else {
emit "\nif [ -z \"\$NOROUTES\" ]; then";
emit "\nif [ -z \"\$g_noroutes\" ]; then";
push_indent;
@@ -818,14 +836,20 @@ sub lookup_provider( $ ) {
#
# This function is called by the compiler when it is generating the detect_configuration() function.
# The function emits code to set the ..._IS_USABLE interface variables appropriately for the
# optional interfaces
# The function calls Shorewall::Zones::verify_required_interfaces then emits code to set the
# ..._IS_USABLE interface variables appropriately for the optional interfaces
#
# Returns true if there were optional interfaces
# Returns true if there were required or optional interfaces
#
sub handle_optional_interfaces() {
sub handle_optional_interfaces( $ ) {
my $interfaces = find_interfaces_by_option 'optional';
my $returnvalue = verify_required_interfaces( shift );
#
# find_interfaces_by_option1() does not return wildcard interfaces. If an interface is defined
# as a wildcard in /etc/shorewall/interfaces, then only specific interfaces matching that
# wildcard are returned.
#
my $interfaces = find_interfaces_by_option1 'optional';
if ( @$interfaces ) {
for my $interface ( @$interfaces ) {
@@ -833,7 +857,12 @@ sub handle_optional_interfaces() {
my $physical = get_physical $interface;
my $base = uc chain_base( $physical );
emit '';
emit( '' );
if ( $config{REQUIRE_INTERFACE} ) {
emit( 'HAVE_INTERFACE=' );
emit( '' );
}
if ( $provider ) {
#
@@ -853,14 +882,41 @@ sub handle_optional_interfaces() {
emit qq(if interface_is_usable $physical; then);
}
emit( " ${base}_IS_USABLE=Yes" ,
emit( ' HAVE_INTERFACE=Yes' ) if $config{REQUIRE_INTERFACE};
emit( " SW_${base}_IS_USABLE=Yes" ,
'else' ,
" ${base}_IS_USABLE=" ,
" SW_${base}_IS_USABLE=" ,
'fi' );
}
1;
if ( $config{REQUIRE_INTERFACE} ) {
emit( '',
'if [ -z "$HAVE_INTERFACE" ]; then' ,
' case "$COMMAND" in',
' start|restart|restore|refresh)'
);
if ( $family == F_IPV4 ) {
emit( ' if shorewall_is_started; then' );
} else {
emit( ' if shorewall6_is_started; then' );
}
emit( ' fatal_error "No network interface available"',
' else',
' startup_error "No network interface available',
' fi',
' ;;',
' esac',
'fi'
);
}
$returnvalue = 1;
}
$returnvalue;
}
#
@@ -869,7 +925,7 @@ sub handle_optional_interfaces() {
#
sub handle_stickiness( $ ) {
my $havesticky = shift;
my $mask = $config{HIGH_ROUTE_MARKS} ? $config{WIDE_TC_MARKS} ? '0xFF0000' : '0xFF00' : '0xFF';
my $mask = in_hex( $globals{PROVIDER_MASK} );
my $setstickyref = $mangle_table->{setsticky};
my $setstickoref = $mangle_table->{setsticko};
my $tcpreref = $mangle_table->{tcpre};
@@ -942,8 +998,9 @@ sub handle_stickiness( $ ) {
}
if ( @routemarked_providers ) {
purge_jump $mangle_table->{PREROUTING}, $setstickyref unless @{$setstickyref->{rules}};
purge_jump $mangle_table->{OUTPUT}, $setstickoref unless @{$setstickoref->{rules}};
delete_jumps $mangle_table->{PREROUTING}, $setstickyref unless @{$setstickyref->{rules}};
delete_jumps $mangle_table->{OUTPUT}, $setstickoref unless @{$setstickoref->{rules}};
}
}
1;

View File

@@ -35,7 +35,7 @@ our @EXPORT = qw(
);
our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_4';
our $VERSION = '4.4_9';
our @proxyarp;
@@ -76,7 +76,7 @@ sub setup_one_proxy_arp( $$$$$ ) {
}
unless ( $haveroute ) {
emit "[ -n \"\$NOROUTES\" ] || run_ip route replace $address dev $interface";
emit "[ -n \"\$g_noroutes\" ] || run_ip route replace $address dev $interface";
$haveroute = 1 if $persistent;
}
@@ -118,6 +118,7 @@ sub setup_proxy_arp() {
}
$interface = get_physical $interface;
$external = get_physical $external;
$set{$interface} = 1;
$reset{$external} = 1 unless $set{$external};

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Traffic Control is from tc4shorewall Version 0.5
# (c) 2005 Arne Bernin <arne@ucbering.de>
@@ -40,7 +40,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_tc );
our @EXPORT_OK = qw( process_tc_rule initialize );
our $VERSION = '4.4_5';
our $VERSION = '4.4_9';
our %tcs = ( T => { chain => 'tcpost',
connmark => 0,
@@ -79,48 +79,6 @@ use constant { NOMARK => 0 ,
HIGHMARK => 2
};
our @tccmd = ( { match => sub ( $ ) { $_[0] eq 'SAVE' } ,
target => 'CONNMARK --save-mark --mask' ,
mark => SMALLMARK ,
mask => '0xFF' ,
connmark => 1
} ,
{ match => sub ( $ ) { $_[0] eq 'RESTORE' },
target => 'CONNMARK --restore-mark --mask' ,
mark => SMALLMARK ,
mask => '0xFF' ,
connmark => 1
} ,
{ match => sub ( $ ) { $_[0] eq 'CONTINUE' },
target => 'RETURN' ,
mark => NOMARK ,
mask => '' ,
connmark => 0
} ,
{ match => sub ( $ ) { $_[0] eq 'SAME' },
target => 'sticky' ,
mark => NOMARK ,
mask => '' ,
connmark => 0
} ,
{ match => sub ( $ ) { $_[0] =~ /^IPMARK/ },
target => 'IPMARK' ,
mark => NOMARK,
mask => '',
connmark => 0
} ,
{ match => sub ( $ ) { $_[0] =~ '\|.*'} ,
target => 'MARK --or-mark' ,
mark => HIGHMARK ,
mask => '' } ,
{ match => sub ( $ ) { $_[0] =~ '&.*' },
target => 'MARK --and-mark ' ,
mark => HIGHMARK ,
mask => '' ,
connmark => 0
}
);
our %flow_keys = ( 'src' => 1,
'dst' => 1,
'proto' => 1,
@@ -172,7 +130,7 @@ our %tcdevices;
our @devnums;
our $devnum;
our $sticky;
our $ipp2p;
#
# TCClasses Table
@@ -225,11 +183,14 @@ sub initialize( $ ) {
@devnums = ();
$devnum = 0;
$sticky = 0;
$ipp2p = 0;
}
sub process_tc_rule( ) {
my ( $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper ) = split_line1 2, 12, 'tcrules file';
our @tccmd;
if ( $originalmark eq 'COMMENT' ) {
process_comment;
return;
@@ -265,9 +226,9 @@ sub process_tc_rule( ) {
fatal_error "Invalid chain designator for source $fw" unless $tcsref->{fw};
}
$chain = $tcsref->{chain} if $tcsref->{chain};
$target = $tcsref->{target} if $tcsref->{target};
$mark = "$mark/0xFF" if $connmark = $tcsref->{connmark};
$chain = $tcsref->{chain} if $tcsref->{chain};
$target = $tcsref->{target} if $tcsref->{target};
$mark = "$mark/" . in_hex( $globals{TC_MASK} ) if $connmark = $tcsref->{connmark};
require_capability ('CONNMARK' , "CONNMARK Rules", '' ) if $connmark;
@@ -285,8 +246,6 @@ sub process_tc_rule( ) {
}
}
my $mask = 0xffff;
my ($cmd, $rest) = split( '/', $mark, 2 );
$list = '';
@@ -354,7 +313,39 @@ sub process_tc_rule( ) {
}
$target = "IPMARK --addr $srcdst --and-mask $mask1 --or-mask $mask2 --shift $shift";
} elsif ( $target eq 'TPROXY ' ) {
require_capability( 'TPROXY_TARGET', 'Use of TPROXY', 's');
fatal_error "Invalid TPROXY specification( $cmd/$rest )" if $rest;
$chain = 'tcpre';
$cmd =~ /TPROXY\((.+?)\)$/;
my $params = $1;
fatal_error "Invalid TPROXY specification( $cmd )" unless defined $params;
( $mark, my $port, my $ip, my $bad ) = split ',', $params;
fatal_error "Invalid TPROXY specification( $cmd )" if defined $bad;
if ( $port ) {
$port = validate_port( 'tcp', $port );
} else {
$port = 0;
}
$target .= "--on-port $port";
if ( defined $ip && $ip ne '' ) {
validate_address $ip, 1;
$target .= " --on-ip $ip";
}
$target .= ' --tproxy-mark';
}
if ( $rest ) {
fatal_error "Invalid MARK ($originalmark)" if $marktype == NOMARK;
@@ -376,10 +367,10 @@ sub process_tc_rule( ) {
validate_mark $mark;
if ( $config{HIGH_ROUTE_MARKS} ) {
if ( $config{PROVIDER_OFFSET} ) {
my $val = numeric_value( $cmd );
fatal_error "Invalid MARK/CLASSIFY ($cmd)" unless defined $val;
my $limit = $config{WIDE_TC_MARKS} ? 65535 : 255;
my $limit = $globals{TC_MASK};
fatal_error "Marks <= $limit may not be set in the PREROUTING or OUTPUT chains when HIGH_ROUTE_MARKS=Yes"
if $cmd && ( $chain eq 'tcpre' || $chain eq 'tcout' ) && $val <= $limit;
}
@@ -390,7 +381,7 @@ sub process_tc_rule( ) {
$restrictions{$chain} ,
do_proto( $proto, $ports, $sports) .
do_user( $user ) .
do_test( $testval, $mask ) .
do_test( $testval, $globals{TC_MASK} ) .
do_length( $length ) .
do_tos( $tos ) .
do_connbytes( $connbytes ) .
@@ -451,6 +442,65 @@ sub process_flow($) {
$flow;
}
sub process_simple_device() {
my ( $device , $type , $bandwidth ) = split_line 1, 3, 'tcinterfaces';
fatal_error "Duplicate INTERFACE ($device)" if $tcdevices{$device};
fatal_error "Invalid INTERFACE name ($device)" if $device =~ /[:+]/;
my $number = in_hexp( $tcdevices{$device} = ++$devnum );
my $physical = physical_name $device;
my $dev = chain_base( $physical );
if ( $type ne '-' ) {
if ( lc $type eq 'external' ) {
$type = 'nfct-src';
} elsif ( lc $type eq 'internal' ) {
$type = 'dst';
} else {
fatal_error "Invalid TYPE ($type)";
}
}
$bandwidth = rate_to_kbit( $bandwidth );
emit "if interface_is_up $physical; then";
push_indent;
emit ( "${dev}_exists=Yes",
"qt \$TC qdisc del dev $physical root",
"qt \$TC qdisc del dev $physical ingress\n"
);
emit ( "run_tc qdisc add dev $physical handle ffff: ingress",
"run_tc filter add dev $physical parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${bandwidth}kbit burst 10k drop flowid :1\n"
) if $bandwidth;
emit "run_tc qdisc add dev $physical root handle $number: prio bands 3 priomap $config{TC_PRIOMAP}";
for ( my $i = 1; $i <= 3; $i++ ) {
emit "run_tc qdisc add dev $physical parent $number:$i handle ${number}${i}: sfq quantum 1875 limit 127 perturb 10";
emit "run_tc filter add dev $physical protocol all parent $number: handle $i fw classid $number:$i";
emit "run_tc filter add dev $physical protocol all prio 1 parent ${number}$i: handle ${number}${i} flow hash keys $type divisor 1024" if $type ne '-' && have_capability 'FLOW_FILTER';
emit '';
}
save_progress_message_short qq(" TC Device $physical defined.");
pop_indent;
emit 'else';
push_indent;
emit qq(error_message "WARNING: Device $physical is not in the UP state -- traffic-shaping configuration skipped");
emit "${dev}_exists=";
pop_indent;
emit "fi\n";
progress_message " Simple tcdevice \"$currentline\" $done.";
}
sub validate_tc_device( ) {
my ( $device, $inband, $outband , $options , $redirected ) = split_line 3, 5, 'tcdevices';
@@ -509,13 +559,13 @@ sub validate_tc_device( ) {
if ( @redirected ) {
fatal_error "IFB devices may not have IN-BANDWIDTH" if $inband ne '-' && $inband;
$classify = 1;
}
for my $rdevice ( @redirected ) {
fatal_error "Invalid device name ($rdevice)" if $rdevice =~ /[:+]/;
my $rdevref = $tcdevices{$rdevice};
fatal_error "REDIRECTED device ($rdevice) has not been defined in this file" unless $rdevref;
fatal_error "IN-BANDWIDTH must be zero for REDIRECTED devices" if $rdevref->{in_bandwidth} ne '0kbit';
for my $rdevice ( @redirected ) {
fatal_error "Invalid device name ($rdevice)" if $rdevice =~ /[:+]/;
my $rdevref = $tcdevices{$rdevice};
fatal_error "REDIRECTED device ($rdevice) has not been defined in this file" unless $rdevref;
fatal_error "IN-BANDWIDTH must be zero for REDIRECTED devices" if $rdevref->{in_bandwidth} ne '0kbit';
}
}
$tcdevices{$device} = { in_bandwidth => rate_to_kbit( $inband ) . 'kbit',
@@ -648,10 +698,12 @@ sub validate_tc_class( ) {
if ( $devref->{classify} ) {
warning_message "INTERFACE $device has the 'classify' option - MARK value ($mark) ignored";
} else {
fatal_error "MARK may not be specified when TC_BITS=0" unless $config{TC_BITS};
$markval = numeric_value( $mark );
fatal_error "Invalid MARK ($markval)" unless defined $markval;
fatal_error "Invalid Mark ($mark)" unless $markval <= ( $config{WIDE_TC_MARKS} ? 0x3fff : 0xff );
fatal_error "Invalid Mark ($mark)" unless $markval <= $globals{TC_MAX};
if ( $classnumber ) {
fatal_error "Duplicate Class NUMBER ($classnumber)" if $tcref->{$classnumber};
@@ -755,7 +807,7 @@ sub validate_tc_class( ) {
fatal_error q(The 'occurs' option is only valid for IPv4) if $family == F_IPV6;
fatal_error q(The 'occurs' option may not be used with 'classify') if $devref->{classify};
fatal_error "Invalid 'occurs' ($val)" unless defined $occurs && $occurs > 1 && $occurs <= 256;
fatal_error "Invalid 'occurs' ($val)" if $occurs > ( $config{WIDE_TC_MARKS} ? 8191 : 255 );
fatal_error "Invalid 'occurs' ($val)" if $occurs > $globals{TC_MAX};
fatal_error q(Duplicate 'occurs') if $tcref->{occurs} > 1;
fatal_error q(The 'occurs' option is not valid with 'default') if $devref->{default} == $classnumber;
fatal_error q(The 'occurs' option is not valid with 'tos') if @{$tcref->{tos}};
@@ -1010,16 +1062,104 @@ sub process_tc_filter( ) {
$currentline =~ s/\s+/ /g;
save_progress_message_short qq(" TC Filter \"$currentline\" defined.");
save_progress_message_short qq(' TC Filter \"$currentline\" defined.');
emit '';
}
sub process_tc_priority() {
my ( $band, $proto, $ports , $address, $interface, $helper ) = split_line1 1, 6, 'tcpri';
if ( $band eq 'COMMENT' ) {
process_comment;
return;
}
my $val = numeric_value $band;
fatal_error "Invalid PRIORITY ($band)" unless $val && $val <= 3;
my $rule = do_helper( $helper ) . "-j MARK --set-mark $band";
$rule .= join('', '/', in_hex( $globals{TC_MASK} ) ) if have_capability( 'EXMARK' );
if ( $interface ne '-' ) {
fatal_error "Invalid combination of columns" unless $address eq '-' && $proto eq '-' && $ports eq '-';
my $forwardref = $mangle_table->{tcfor};
add_rule( $forwardref ,
join( '', match_source_dev( $interface) , $rule ) ,
1 );
} else {
my $postref = $mangle_table->{tcpost};
if ( $address ne '-' ) {
fatal_error "Invalid combination of columns" unless $proto eq '-' && $ports eq '-';
add_rule( $postref ,
join( '', match_source_net( $address) , $rule ) ,
1 );
} else {
add_rule( $postref ,
join( '', do_proto( $proto, $ports, '-' , 0 ) , $rule ) ,
1 );
if ( $ports ne '-' ) {
my $protocol = resolve_proto $proto;
if ( $proto =~ /^ipp2p/ ) {
fatal_error "ipp2p may not be used when there are tracked providers and PROVIDER_OFFSET=0" if @routemarked_interfaces && $config{PROVIDER_OFFSET} == 0;
$ipp2p = 1;
}
add_rule( $postref ,
join( '' , do_proto( $proto, '-', $ports, 0 ) , $rule ) ,
1 )
unless $proto =~ /^ipp2p/ || $protocol == ICMP || $protocol == IPv6_ICMP;
}
}
}
}
sub setup_simple_traffic_shaping() {
my $interfaces;
save_progress_message q("Setting up Traffic Control...");
my $fn = open_file 'tcinterfaces';
if ( $fn ) {
first_entry "$doing $fn...";
process_simple_device, $interfaces++ while read_a_line;
} else {
$fn = find_file 'tcinterfaces';
}
my $fn1 = open_file 'tcpri';
if ( $fn1 ) {
first_entry
sub {
progress_message2 "$doing $fn1...";
warning_message "There are entries in $fn1 but $fn was empty" unless $interfaces;
};
process_tc_priority while read_a_line;
clear_comment;
if ( $ipp2p ) {
insert_rule1 $mangle_table->{tcpost} , 0 , '-m mark --mark 0/' . in_hex( $globals{TC_MASK} ) . ' -j CONNMARK --restore-mark --ctmask ' . in_hex( $globals{TC_MASK} );
add_rule $mangle_table->{tcpost} , '-m mark ! --mark 0/' . in_hex( $globals{TC_MASK} ) . ' -j CONNMARK --save-mark --ctmask ' . in_hex( $globals{TC_MASK} );
}
}
}
sub setup_traffic_shaping() {
our $lastrule = '';
save_progress_message "Setting up Traffic Control...";
save_progress_message q("Setting up Traffic Control...");
my $fn = open_file 'tcdevices';
@@ -1029,6 +1169,9 @@ sub setup_traffic_shaping() {
validate_tc_device while read_a_line;
}
my $sfq = $devnum;
my $sfqinhex;
$devnum = $devnum > 10 ? 10 : 1;
$fn = open_file 'tcclasses';
@@ -1098,7 +1241,7 @@ sub setup_traffic_shaping() {
emit( "run_tc filter add dev $rdev parent ffff: protocol all u32 match u32 0 0 action mirred egress redirect dev $device > /dev/null" );
}
save_progress_message_short " TC Device $device defined.";
save_progress_message_short qq(" TC Device $device defined.");
pop_indent;
emit 'else';
@@ -1165,17 +1308,18 @@ sub setup_traffic_shaping() {
}
}
emit( "run_tc qdisc add dev $device parent $classid handle ${classnum}: sfq quantum \$quantum limit $tcref->{limit} perturb 10" ) if $tcref->{leaf} && ! $tcref->{pfifo};
if ( $tcref->{leaf} && ! $tcref->{pfifo} ) {
$sfqinhex = in_hexp( ++$sfq);
emit( "run_tc qdisc add dev $device parent $classid handle $sfqinhex: sfq quantum \$quantum limit $tcref->{limit} perturb 10" );
}
#
# add filters
#
unless ( $devref->{classify} ) {
if ( $tcref->{occurs} == 1 ) {
emit "run_tc filter add dev $device protocol all parent $devicenumber:0 prio " . ( $priority | 20 ) . " handle $mark fw classid $classid";
}
emit "run_tc filter add dev $device protocol all parent $devicenumber:0 prio " . ( $priority | 20 ) . " handle $mark fw classid $classid" if $tcref->{occurs} == 1;
}
emit "run_tc filter add dev $device protocol all prio 1 parent $classnum: handle $classnum flow hash keys $tcref->{flow} divisor 1024" if $tcref->{flow};
emit "run_tc filter add dev $device protocol all prio 1 parent $sfqinhex: handle $classnum flow hash keys $tcref->{flow} divisor 1024" if $tcref->{flow};
#
# options
#
@@ -1199,7 +1343,7 @@ sub setup_traffic_shaping() {
$fn = open_file 'tcfilters';
if ( $fn ) {
first_entry( sub { progress_message2 "$doing $fn..."; save_progress_message "Adding TC Filters"; } );
first_entry( sub { progress_message2 "$doing $fn..."; save_progress_message q("Adding TC Filters"); } );
process_tc_filter while read_a_line;
}
@@ -1211,11 +1355,11 @@ sub setup_traffic_shaping() {
#
sub setup_tc() {
if ( $capabilities{MANGLE_ENABLED} && $config{MANGLE_ENABLED} ) {
if ( $config{MANGLE_ENABLED} ) {
ensure_mangle_chain 'tcpre';
ensure_mangle_chain 'tcout';
if ( $capabilities{MANGLE_FORWARD} ) {
if ( have_capability( 'MANGLE_FORWARD' ) ) {
ensure_mangle_chain 'tcfor';
ensure_mangle_chain 'tcpost';
}
@@ -1223,43 +1367,88 @@ sub setup_tc() {
my $mark_part = '';
if ( @routemarked_interfaces && ! $config{TC_EXPERT} ) {
$mark_part = $config{HIGH_ROUTE_MARKS} ? $config{WIDE_TC_MARKS} ? '-m mark --mark 0/0xFF0000' : '-m mark --mark 0/0xFF00' : '-m mark --mark 0/0xFF';
$mark_part = '-m mark --mark 0/' . in_hex( $globals{PROVIDER_MASK} ) . ' ';
for my $interface ( @routemarked_interfaces ) {
add_rule $mangle_table->{PREROUTING} , match_source_dev( $interface ) . "-j tcpre";
unless ( $config{TRACK_PROVIDERS} ) {
#
# This is overloading TRACK_PROVIDERS a bit but sending tracked packets through PREROUTING is a PITA for users
#
for my $interface ( @routemarked_interfaces ) {
add_jump $mangle_table->{PREROUTING} , 'tcpre', 0, match_source_dev( $interface );
}
}
}
add_rule $mangle_table->{PREROUTING} , "$mark_part -j tcpre";
add_rule $mangle_table->{OUTPUT} , "$mark_part -j tcout";
add_jump $mangle_table->{PREROUTING} , 'tcpre', 0, $mark_part;
add_jump $mangle_table->{OUTPUT} , 'tcout', 0, $mark_part;
if ( $capabilities{MANGLE_FORWARD} ) {
add_rule $mangle_table->{FORWARD} , '-j tcfor';
add_rule $mangle_table->{POSTROUTING} , '-j tcpost';
}
if ( $config{HIGH_ROUTE_MARKS} ) {
for my $chain qw(INPUT FORWARD) {
insert_rule1 $mangle_table->{$chain}, 0, $config{WIDE_TC_MARKS} ? '-j MARK --and-mark 0xFFFF' : '-j MARK --and-mark 0xFF';
}
#
# In POSTROUTING, we only want to clear routing mark and not IPMARK.
#
insert_rule1 $mangle_table->{POSTROUTING}, 0, $config{WIDE_TC_MARKS} ? '-m mark --mark 0/0xFFFF -j MARK --and-mark 0' : '-m mark --mark 0/0xFF -j MARK --and-mark 0';
if ( have_capability( 'MANGLE_FORWARD' ) ) {
add_rule( $mangle_table->{FORWARD}, '-j MARK --set-mark 0' ) if have_capability 'MARK';
add_jump $mangle_table->{FORWARD} , 'tcfor', 0;
add_jump $mangle_table->{POSTROUTING} , 'tcpost', 0;
}
}
if ( $globals{TC_SCRIPT} ) {
save_progress_message 'Setting up Traffic Control...';
save_progress_message q('Setting up Traffic Control...');
append_file $globals{TC_SCRIPT};
} elsif ( $config{TC_ENABLED} eq 'Internal' ) {
setup_traffic_shaping;
} elsif ( $config{TC_ENABLED} eq 'Simple' ) {
setup_simple_traffic_shaping;
}
if ( $config{TC_ENABLED} ) {
our @tccmd = ( { match => sub ( $ ) { $_[0] eq 'SAVE' } ,
target => 'CONNMARK --save-mark --mask' ,
mark => SMALLMARK ,
mask => in_hex( $globals{TC_MASK} ) ,
connmark => 1
} ,
{ match => sub ( $ ) { $_[0] eq 'RESTORE' },
target => 'CONNMARK --restore-mark --mask' ,
mark => SMALLMARK ,
mask => in_hex( $globals{TC_MASK} ) ,
connmark => 1
} ,
{ match => sub ( $ ) { $_[0] eq 'CONTINUE' },
target => 'RETURN' ,
mark => NOMARK ,
mask => '' ,
connmark => 0
} ,
{ match => sub ( $ ) { $_[0] eq 'SAME' },
target => 'sticky' ,
mark => NOMARK ,
mask => '' ,
connmark => 0
} ,
{ match => sub ( $ ) { $_[0] =~ /^IPMARK/ },
target => 'IPMARK' ,
mark => NOMARK,
mask => '',
connmark => 0
} ,
{ match => sub ( $ ) { $_[0] =~ '\|.*'} ,
target => 'MARK --or-mark' ,
mark => HIGHMARK ,
mask => '' } ,
{ match => sub ( $ ) { $_[0] =~ '&.*' },
target => 'MARK --and-mark ' ,
mark => HIGHMARK ,
mask => '' ,
connmark => 0
} ,
{ match => sub ( $ ) { $_[0] =~ /^TPROXY/ },
target => 'TPROXY',
mark => HIGHMARK,
mask => '',
connmark => '' },
);
if ( my $fn = open_file 'tcrules' ) {
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'MANGLE_ENABLED' , 'a non-empty tcrules file' , 's'; } );
first_entry "$doing $fn...";
process_tc_rule while read_a_line;

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_tunnels );
our @EXPORT_OK = ( );
our $VERSION = '4.3_7';
our $VERSION = '4.4_9';
#
# Here starts the tunnel stuff -- we really should get rid of this crap...
@@ -61,7 +61,7 @@ sub setup_tunnels() {
}
}
my $options = $globals{UNTRACKED} ? '-m state --state NEW,UNTRACKED -j ACCEPT' : '-m state --state NEW -j ACCEPT';
my $options = $globals{UNTRACKED} ? "$globals{STATEMATCH} NEW,UNTRACKED -j ACCEPT" : "$globals{STATEMATCH} NEW -j ACCEPT";
add_tunnel_rule $inchainref, "-p 50 $source -j ACCEPT";
add_tunnel_rule $outchainref, "-p 50 $dest -j ACCEPT";
@@ -86,7 +86,7 @@ sub setup_tunnels() {
$inchainref = ensure_filter_chain rules_chain( ${zone}, ${fw} ), 1;
$outchainref = ensure_filter_chain rules_chain( ${fw}, ${zone} ), 1;
unless ( $capabilities{POLICY_MATCH} ) {
unless ( have_ipsec ) {
add_tunnel_rule $inchainref, "-p 50 $source -j ACCEPT";
add_tunnel_rule $outchainref, "-p 50 $dest -j ACCEPT";

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -11,7 +11,7 @@
# 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,
# This program is distributed in the shope 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.
@@ -54,6 +54,7 @@ our @EXPORT = qw( NOTHING
complex_zones
non_firewall_zones
single_interface
chain_base
validate_interfaces_file
all_interfaces
all_bridges
@@ -67,15 +68,19 @@ our @EXPORT = qw( NOTHING
source_port_to_bridge
interface_is_optional
find_interfaces_by_option
find_interfaces_by_option1
get_interface_option
set_interface_option
verify_required_interfaces
compile_updown
validate_hosts_file
find_hosts_by_option
all_ipsets
have_ipsec
);
our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_4';
our $VERSION = '4.4_10';
#
# IPSEC Option types
@@ -156,6 +161,7 @@ our @bport_zones;
our %ipsets;
our %physical;
our $family;
our $have_ipsec;
use constant { FIREWALL => 1,
IP => 2,
@@ -178,9 +184,9 @@ use constant { SIMPLE_IF_OPTION => 1,
our %validinterfaceoptions;
our %defaultinterfaceoptions = ( routefilter => 1 );
our %defaultinterfaceoptions = ( routefilter => 1 , wait => 60 );
our %maxoptionvalue = ( routefilter => 2, mss => 100000 );
our %maxoptionvalue = ( routefilter => 2, mss => 100000 , wait => 120 );
our %validhostoptions;
@@ -199,6 +205,7 @@ sub initialize( $ ) {
@zones = ();
%zones = ();
$firewall_zone = '';
$have_ipsec = undef;
@interfaces = ();
%interfaces = ();
@@ -220,6 +227,7 @@ sub initialize( $ ) {
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
optional => SIMPLE_IF_OPTION,
proxyarp => BINARY_IF_OPTION,
required => SIMPLE_IF_OPTION,
routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST,
routefilter => NUMERIC_IF_OPTION ,
sourceroute => BINARY_IF_OPTION,
@@ -228,6 +236,7 @@ sub initialize( $ ) {
upnpclient => SIMPLE_IF_OPTION,
mss => NUMERIC_IF_OPTION,
physical => STRING_IF_OPTION + IF_OPTION_HOST,
wait => NUMERIC_IF_OPTION,
);
%validhostoptions = (
blacklist => 1,
@@ -245,15 +254,17 @@ sub initialize( $ ) {
dhcp => SIMPLE_IF_OPTION,
maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY,
nosmurfs => SIMPLE_IF_OPTION,
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
optional => SIMPLE_IF_OPTION,
proxyndp => BINARY_IF_OPTION,
required => SIMPLE_IF_OPTION,
routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST,
sourceroute => BINARY_IF_OPTION,
tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST,
mss => NUMERIC_IF_OPTION,
forward => NUMERIC_IF_OPTION,
forward => BINARY_IF_OPTION,
physical => STRING_IF_OPTION + IF_OPTION_HOST,
wait => NUMERIC_IF_OPTION,
);
%validhostoptions = (
blacklist => 1,
@@ -399,24 +410,19 @@ sub process_zone( \$ ) {
}
if ( $type eq IPSEC ) {
require_capability 'POLICY_MATCH' , 'IPSEC zones', '';
for ( @parents ) {
unless ( $zones{$_}{type} == IPSEC ) {
set_super( $zones{$_} );
}
set_super( $zones{$_} ) unless $zones{$_}{type} == IPSEC;
}
}
for ( $options, $in_options, $out_options ) {
$_ = '' if $_ eq '-';
}
$zones{$zone} = { type => $type,
parents => \@parents,
bridge => '',
options => { in_out => parse_zone_option_list( $options || '', $type ) ,
in => parse_zone_option_list( $in_options || '', $type ) ,
out => parse_zone_option_list( $out_options || '', $type ) ,
complex => ($type == IPSEC || $options || $in_options || $out_options ? 1 : 0) ,
complex => ( $type == IPSEC || $options ne '-' || $in_options ne '-' || $out_options ne '-' ) ,
nested => @parents > 0 ,
super => 0 ,
} ,
@@ -669,7 +675,7 @@ sub add_group_to_zone($$$$$)
fatal_error "Duplicate Host Group ($interface:" . ALLIP . ") in zone $zone" if $allip && @$interfaceref;
$zoneref->{options}{complex} = 1 if @$interfaceref || ( @newnetworks > 1 ) || ( @exclusions );
$zoneref->{options}{complex} = 1 if @$interfaceref || ( @newnetworks > 1 ) || ( @exclusions ) || $options->{routeback};
push @{$interfaceref}, { options => $options,
hosts => \@newnetworks,
@@ -723,11 +729,30 @@ sub firewall_zone() {
$firewall_zone;
}
#
# Determine if the passed physical device is a bridge
#
sub is_a_bridge( $ ) {
which 'brctl' && qt( "brctl show | tail -n+2 | grep -q '^$_[0]\[\[:space:\]\]'" );
}
#
# Transform the passed interface name into a legal shell variable name.
#
sub chain_base($) {
my $chain = $_[0];
$chain =~ s/^@/at_/;
$chain =~ tr/[.\-%@]/_/;
$chain =~ s/\+$//;
$chain;
}
#
# Process a record in the interfaces file
#
sub process_interface( $ ) {
my $nextinum = $_[0];
sub process_interface( $$ ) {
my ( $nextinum, $export ) = @_;
my $netsref = '';
my ($zone, $originalinterface, $bcasts, $options ) = split_line 2, 4, 'interfaces file';
my $zoneref;
@@ -742,9 +767,6 @@ sub process_interface( $ ) {
fatal_error "Firewall zone not allowed in ZONE column of interface record" if $zoneref->{type} == FIREWALL;
}
$bcasts = '' if $bcasts eq '-';
$options = '' if $options eq '-';
my ($interface, $port, $extra) = split /:/ , $originalinterface, 3;
fatal_error "Invalid INTERFACE ($originalinterface)" if ! $interface || defined $extra;
@@ -752,7 +774,7 @@ sub process_interface( $ ) {
if ( defined $port && $port ne '' ) {
fatal_error qq("Virtual" interfaces are not supported -- see http://www.shorewall.net/Shorewall_and_Aliased_Interfaces.html) if $port =~ /^\d+$/;
require_capability( 'PHYSDEV_MATCH', 'Bridge Ports', '');
fatal_error "Your iptables is not recent enough to support bridge ports" unless $capabilities{KLUDGEFREE};
fatal_error "Your iptables is not recent enough to support bridge ports" unless have_capability( 'KLUDGEFREE' );
fatal_error "Invalid Interface Name ($interface:$port)" unless $port =~ /^[\w.@%-]+\+?$/;
fatal_error "Duplicate Interface ($port)" if $interfaces{$port};
@@ -789,14 +811,14 @@ sub process_interface( $ ) {
my $physical = $interface;
my $broadcasts;
unless ( $bcasts eq '' || $bcasts eq 'detect' ) {
unless ( $bcasts eq '-' || $bcasts eq 'detect' ) {
my @broadcasts = split_list $bcasts, 'address';
for my $address ( @broadcasts ) {
fatal_error 'Invalid BROADCAST address' unless $address =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
}
if ( $capabilities{ADDRTYPE} ) {
if ( have_capability( 'ADDRTYPE' ) ) {
warning_message 'Shorewall no longer uses broadcast addresses in rule generation when Address Type Match is available';
} else {
$broadcasts = \@broadcasts;
@@ -809,7 +831,9 @@ sub process_interface( $ ) {
my $hostoptionsref = {};
if ( $options ) {
$options{ignore} = 1, $options = '-' if $options eq 'ignore';
if ( $options ne '-' ) {
my %hostoptions = ( dynamic => 0 );
@@ -913,22 +937,30 @@ sub process_interface( $ ) {
}
}
fatal_error "Invalid combination of interface options" if $options{required} && $options{optional};
if ( $netsref eq 'dynamic' ) {
my $ipset = "${zone}_" . chain_base $physical;
$netsref = [ "+$ipset" ];
$ipsets{$ipset} = 1;
}
$zoneref->{options}{in_out}{routeback} = 1 if $zoneref && $options{routeback};
if ( $options{bridge} ) {
require_capability( 'PHYSDEV_MATCH', 'The "bridge" option', 's');
fatal_error "Bridges may not have wildcard names" if $wildcard;
$hostoptions{routeback} = $options{routeback} = 1;
}
$hostoptionsref = \%hostoptions;
$hostoptions{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export || $options{routeback};
}
$hostoptionsref = \%hostoptions;
} else {
#
# No options specified -- auto-detect bridge
#
$hostoptionsref->{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export;
}
$physical{$physical} = $interfaces{$interface} = { name => $interface ,
bridge => $bridge ,
@@ -970,7 +1002,7 @@ sub validate_interfaces_file( $ ) {
first_entry "$doing $fn...";
push @ifaces, process_interface( $nextinum++) while read_a_line;
push @ifaces, process_interface( $nextinum++, $export ) while read_a_line;
#
# We now assemble the @interfaces array such that bridge ports immediately precede their associated bridge
@@ -1013,7 +1045,7 @@ sub map_physical( $$ ) {
#
# Returns true if passed interface matches an entry in /etc/shorewall/interfaces
#
# If the passed name matches a wildcard, a entry for the name is added in %interfaces to speed up validation of other references to that name.
# If the passed name matches a wildcard, an entry for the name is added in %interfaces to speed up validation of other references to that name.
#
sub known_interface($)
{
@@ -1144,6 +1176,28 @@ sub find_interfaces_by_option( $ ) {
\@ints;
}
#
# Returns reference to array of interfaces with the passed option
#
sub find_interfaces_by_option1( $ ) {
my $option = $_[0];
my @ints = ();
for my $interface ( keys %interfaces ) {
my $interfaceref = $interfaces{$interface};
next unless defined $interfaceref->{physical};
next if $interfaceref->{physical} =~ /\+/;
my $optionsref = $interfaceref->{options};
if ( $optionsref && defined $optionsref->{$option} ) {
push @ints , $interface
}
}
\@ints;
}
#
# Return the value of an option for an interface
#
@@ -1162,6 +1216,258 @@ sub set_interface_option( $$$ ) {
$interfaces{$interface}{options}{$option} = $value;
}
#
# Verify that all required interfaces are available after waiting for any that specify the 'wait' option.
#
sub verify_required_interfaces( $ ) {
my $generate_case = shift;
my $returnvalue = 0;
my $interfaces = find_interfaces_by_option 'wait';
if ( @$interfaces ) {
emit "local waittime\n";
for my $interface (@$interfaces ) {
my $wait = $interfaces{$interface}{options}{wait};
if ( $wait ) {
my $physical = get_physical $interface;
if ( $physical =~ /\+$/ ) {
my $base = uc chain_base $physical;
$physical =~ s/\+$/*/;
emit( 'for interface in $(find_all_interfaces); do',
' case $interface in',
" $physical)",
" waittime=$wait",
' while [ $waittime -gt 0 ]; do',
' interface_is_usable $interface && break',
' waittime=$(($waittime - 1))',
' done',
' ;;',
' esac',
'done',
'',
);
} else {
emit qq(if ! interface_is_usable $physical; then);
emit qq( waittime=$wait);
emit '';
emit q( while [ $waittime -gt 0 ]; do);
emit qq( interface_is_usable $physical && break);
emit q( sleep 1);
emit ' waittime=$(($waittime - 1))';
emit q( done);
emit qq(fi\n);
}
$returnvalue = 1;
}
}
}
$interfaces = find_interfaces_by_option 'required';
if ( @$interfaces ) {
if ( $generate_case ) {
emit( 'case "$COMMAND" in' );
push_indent;
emit( 'start|restart|restore|refresh)' );
push_indent;
}
for my $interface (@$interfaces ) {
my $physical = get_physical $interface;
if ( $physical =~ /\+$/ ) {
my $base = uc chain_base $physical;
$physical =~ s/\+$/*/;
emit( "${base}_IS_UP=\n",
'for interface in $(find_all_interfaces); do',
' case $interface in',
" $physical)",
" interface_is_usable \$interface && ${base}_IS_UP=Yes && break",
' ;;',
' esac',
'done',
'',
"if [ -z \"\$${base}_IS_UP\" ]; then",
" startup_error \"None of the required interfaces $physical are available\"",
"fi\n"
);
} else {
emit qq(if ! interface_is_usable $physical; then);
emit qq( startup_error "Required interface $physical not available");
emit qq(fi\n);
}
}
if ( $generate_case ) {
emit( ';;' );
pop_indent;
pop_indent;
emit( 'esac' );
}
$returnvalue = 1;
}
$returnvalue;
}
#
# Emit the updown() function
#
sub compile_updown() {
emit( '',
'#',
'# Handle the "up" and "down" commands',
'#',
'updown() # $1 = interface',
'{',
);
push_indent;
emit( 'local state',
'state=cleared',
'' );
if ( $family == F_IPV4 ) {
emit 'if shorewall_is_started; then';
} else {
emit 'if shorewall6_is_started; then';
}
emit( ' state=started',
'elif [ -f ${VARDIR}/state ]; then',
' case "$(cat ${VARDIR}/state)" in',
' Stopped*)',
' state=stopped',
' ;;',
' Cleared*)',
' ;;',
' *)',
' state=unknown',
' ;;',
' esac',
'else',
' state=unknown',
'fi',
''
);
emit( 'case $1 in' );
push_indent;
my $ignore = find_interfaces_by_option 'ignore';
my $required = find_interfaces_by_option 'required';
my $optional = find_interfaces_by_option 'optional';
if ( @$ignore ) {
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$ignore;
$interfaces =~ s/\+/*/;
emit( "$interfaces)",
' exit 0',
' ;;'
);
}
if ( @$required ) {
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$required;
my $wildcard = ( $interfaces =~ s/\+/*/ );
emit( "$interfaces)",
' if [ "$COMMAND" = up ]; then' );
if ( $wildcard ) {
emit( ' if [ "$state" = started ]; then',
' COMMAND=restart',
' else',
' COMMAND=start',
' fi' );
} else {
emit( ' COMMAND=start' );
}
emit( ' detect_configuration',
' define_firewall' );
if ( $wildcard ) {
emit( ' elif [ "$state" = started ]; then',
' COMMAND=restart',
' detect_configuration',
' define_firewall' );
} else {
emit( ' else',
' COMMAND=stop',
' detect_configuration',
' stop_firewall' );
}
emit( ' fi',
' ;;'
);
}
if ( @$optional ) {
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$optional;
$interfaces =~ s/\+/*/;
emit( "$interfaces)",
' if [ "$COMMAND" = up ]; then',
' echo 0 > ${VARDIR}/${1}.state',
' else',
' echo 1 > ${VARDIR}/${1}.state',
' fi',
'',
' if [ "$state" = started ]; then',
' COMMAND=restart',
' detect_configuration',
' define_firewall',
' elif [ "$state" = stopped ]; then',
' COMMAND=start',
' detect_configuration',
' define_firewall',
' fi',
' ;;',
);
}
emit( "*)",
' case $state in',
' started)',
' COMMAND=restart',
' detect_configuration',
' define_firewall',
' ;;',
' esac',
);
pop_indent;
emit( 'esac' );
pop_indent;
emit( '}',
'',
);
}
#
# Process a record in the hosts file
#
@@ -1186,15 +1492,13 @@ sub process_host( ) {
} else {
fatal_error "Invalid HOST(S) column contents: $hosts";
}
} elsif ( $hosts =~ /^([\w.@%-]+\+?):<(.*)>\s*$/ || $hosts =~ /^([\w.@%-]+\+?):\[(.*)\]\s*$/ ) {
$interface = $1;
$hosts = $2;
$zoneref->{options}{complex} = 1 if $hosts =~ /^\+/;
fatal_error "Unknown interface ($interface)" unless $interfaces{$interface}{root};
} else {
if ( $hosts =~ /^([\w.@%-]+\+?):<(.*)>\s*$/ ) {
$interface = $1;
$hosts = $2;
$zoneref->{options}{complex} = 1 if $hosts =~ /^\+/;
fatal_error "Unknown interface ($interface)" unless $interfaces{$interface}{root};
} else {
fatal_error "Invalid HOST(S) column contents: $hosts";
}
fatal_error "Invalid HOST(S) column contents: $hosts";
}
if ( $type == BPORT ) {
@@ -1214,6 +1518,7 @@ sub process_host( ) {
for my $option ( @options ) {
if ( $option eq 'ipsec' ) {
require_capability 'POLICY_MATCH' , q(The 'ipsec' option), 's';
$type = IPSEC;
$zoneref->{options}{complex} = 1;
$ipsec = 1;
@@ -1273,7 +1578,15 @@ sub validate_hosts_file()
$ipsec |= process_host while read_a_line;
$capabilities{POLICY_MATCH} = '' unless $ipsec || haveipseczones;
$have_ipsec = $ipsec || haveipseczones;
}
#
# Return an indication of whether IPSEC is present
#
sub have_ipsec() {
return defined $have_ipsec ? $have_ipsec : have_capability 'POLICY_MATCH';
}
#

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -36,6 +36,7 @@
# --log=<filename> # Log file
# --log_verbosity=<number> # Log Verbosity range -1 to 2
# --family=<number> # IP family; 4 = IPv4 (default), 6 = IPv6
# --preview # Preview the ruleset.
#
use strict;
use FindBin;
@@ -44,7 +45,6 @@ use Shorewall::Compiler;
use Getopt::Long;
sub usage( $ ) {
my $returnval = shift @_;
print STDERR 'usage: compiler.pl [ <option> ... ] [ <filename> ]
@@ -58,10 +58,11 @@ sub usage( $ ) {
[ --log=<filename> ]
[ --log-verbose={-1|0-2} ]
[ --test ]
[ --preview ]
[ --family={4|6} ]
';
exit $returnval;
exit shift @_;
}
#
@@ -78,6 +79,7 @@ my $log_verbose = 0;
my $help = 0;
my $test = 0;
my $family = 4; # F_IPV4
my $preview = 0;
Getopt::Long::Configure ('bundling');
@@ -98,6 +100,7 @@ my $result = GetOptions('h' => \$help,
'l=s' => \$log,
'log_verbosity=i' => \$log_verbose,
'test' => \$test,
'preview' => \$preview,
'f=i' => \$family,
'family=i' => \$family,
);
@@ -105,7 +108,7 @@ my $result = GetOptions('h' => \$help,
usage(1) unless $result && @ARGV < 2;
usage(0) if $help;
compiler( script => defined $ARGV[0] ? $ARGV[0] : '',
compiler( script => $ARGV[0] || '',
directory => $shorewall_dir,
verbosity => $verbose,
timestamp => $timestamp,
@@ -115,4 +118,5 @@ compiler( script => defined $ARGV[0] ? $ARGV[0] : '',
log => $log,
log_verbosity => $log_verbose,
test => $test,
preview => $preview,
family => $family );

View File

@@ -5,7 +5,16 @@
# Give Usage Information
#
usage() {
echo "Usage: $0 [ -q ] [ -v ] [ -n ] [ start|stop|clear|reset|refresh|restart|status|version ]"
echo "Usage: $0 [ options ] [ start|stop|clear|down|reset|refresh|restart|status|up|version ]"
echo
echo "Options are:"
echo
echo " -v and -q Standard Shorewall verbosity controls"
echo " -n Don't unpdate routing configuration"
echo " -p Purge Conntrack Table"
echo " -t Timestamp progress Messages"
echo " -V <verbosity> Set verbosity explicitly"
echo " -R <file> Override RESTOREFILE setting"
exit $1
}
################################################################################
@@ -23,6 +32,17 @@ if [ $# -gt 1 ]; then
shift
fi
fi
#
# Map VERBOSE to VERBOSITY for compatibility with old Shorewall-lite installations
#
[ -z "$VERBOSITY" ] && [ -n "$VERBOSE" ] && VERBOSITY=$VERBOSE
#
# Map other old exported variables
#
g_purge=$PURGE
g_noroutes=$NOROUTES
g_timestamp=$TIMESTAMP
g_recovering=$RECOVERING
initialize
@@ -51,17 +71,78 @@ while [ $finished -eq 0 -a $# -gt 0 ]; do
while [ -n "$option" ]; do
case $option in
v*)
VERBOSE=$(($VERBOSE + 1 ))
[ $VERBOSITY -lt 2 ] && VERBOSITY=$(($VERBOSITY + 1 ))
option=${option#v}
;;
q*)
VERBOSE=$(($VERBOSE - 1 ))
[ $VERBOSITY -gt -1 ] && VERBOSITY=$(($VERBOSITY - 1 ))
option=${option#q}
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
t*)
g_timestamp=Yes
option=${option#t}
;;
p*)
g_purge=Yes
option=${option#p}
;;
r*)
g_recovering=Yes
option=${option#r}
;;
V*)
option=${option#V}
if [ -z "$option" -a $# -gt 0 ]; then
shift
option=$1
fi
if [ -n "$option" ]; then
case $option in
-1|0|1|2)
VERBOSITY=$option
option=
;;
*)
startup_error "Invalid -V option value ($option)"
;;
esac
else
startup_error "Missing -V option value"
fi
;;
R*)
option=${option#R}
if [ -z "$option" -a $# -gt 0 ]; then
shift
option=$1
fi
if [ -n "$option" ]; then
case $option in
*/*)
startup_error "-R must specify a simple file name: $option"
;;
.safe|.try|NONE)
;;
.*)
error_message "ERROR: Reserved File Name: $RESTOREFILE"
exit 2
;;
esac
else
startup_error "Missing -R option value"
fi
RESTOREFILE=$option
option=
;;
*)
usage 1
;;
@@ -77,16 +158,14 @@ done
COMMAND="$1"
[ -n "${PRODUCT:=Shorewall}" ]
case "$COMMAND" in
start)
[ $# -ne 1 ] && usage 2
if shorewall_is_started; then
error_message "$PRODUCT is already Running"
error_message "$g_product is already Running"
status=0
else
progress_message3 "Starting $PRODUCT...."
progress_message3 "Starting $g_product...."
detect_configuration
define_firewall
status=$?
@@ -96,7 +175,7 @@ case "$COMMAND" in
;;
stop)
[ $# -ne 1 ] && usage 2
progress_message3 "Stopping $PRODUCT...."
progress_message3 "Stopping $g_product...."
detect_configuration
stop_firewall
status=0
@@ -105,7 +184,7 @@ case "$COMMAND" in
;;
reset)
if ! shorewall_is_started ; then
error_message "$PRODUCT is not running"
error_message "$g_product is not running"
status=2
elif [ $# -eq 1 ]; then
$IPTABLES -Z
@@ -113,7 +192,7 @@ case "$COMMAND" in
$IPTABLES -t mangle -Z
date > ${VARDIR}/restarted
status=0
progress_message3 "$PRODUCT Counters Reset"
progress_message3 "$g_product Counters Reset"
else
shift
status=0
@@ -135,10 +214,11 @@ case "$COMMAND" in
restart)
[ $# -ne 1 ] && usage 2
if shorewall_is_started; then
progress_message3 "Restarting $PRODUCT...."
progress_message3 "Restarting $g_product...."
else
error_message "$PRODUCT is not running"
progress_message3 "Starting $PRODUCT...."
error_message "$g_product is not running"
progress_message3 "Starting $g_product...."
COMMAND=start
fi
detect_configuration
@@ -152,13 +232,13 @@ case "$COMMAND" in
refresh)
[ $# -ne 1 ] && usage 2
if shorewall_is_started; then
progress_message3 "Refreshing $PRODUCT...."
progress_message3 "Refreshing $g_product...."
detect_configuration
define_firewall
status=$?
progress_message3 "done."
else
echo "$PRODUCT is not running" >&2
echo "$g_product is not running" >&2
status=2
fi
;;
@@ -173,28 +253,30 @@ case "$COMMAND" in
;;
clear)
[ $# -ne 1 ] && usage 2
progress_message3 "Clearing $PRODUCT...."
progress_message3 "Clearing $g_product...."
clear_firewall
status=0
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
if [ -n "$SUBSYSLOCK" ]; then
rm -f $SUBSYSLOCK
fi
progress_message3 "done."
;;
status)
[ $# -ne 1 ] && usage 2
echo "$PRODUCT-$VERSION Status at $HOSTNAME - $(date)"
echo "$g_product-$SHOREWALL_VERSION Status at $(hostname) - $(date)"
echo
if shorewall_is_started; then
echo "$PRODUCT is running"
echo "$g_product is running"
status=0
else
echo "$PRODUCT is stopped"
echo "$g_product is stopped"
status=4
fi
if [ -f ${VARDIR}/state ]; then
state="$(cat ${VARDIR}/state)"
case $state in
Stopped*|Clear*)
Stopped*|lClear*)
status=3
;;
esac
@@ -204,9 +286,16 @@ case "$COMMAND" in
echo "State:$state"
echo
;;
up|down)
[ $# -eq 1 ] && exit 0
shift
[ $# -ne 1 ] && usage 2
updown $@
status=0;
;;
version)
[ $# -ne 1 ] && usage 2
echo $VERSION
echo $SHOREWALL_VERSION
status=0
;;
help)

View File

@@ -5,7 +5,16 @@
# Give Usage Information
#
usage() {
echo "Usage: $0 [ -q ] [ -v ] [ -n ] [ start|stop|clear|reset|refresh|restart|status|version ]"
echo "Usage: $0 [ options ] [ start|stop|clear|down|reset|refresh|restart|status|up|version ]"
echo
echo "Options are:"
echo
echo " -v and -q Standard Shorewall verbosity controls"
echo " -n Don't unpdate routing configuration"
echo " -p Purge Conntrack Table"
echo " -t Timestamp progress Messages"
echo " -V <verbosity> Set verbosity explicitly"
echo " -R <file> Override RESTOREFILE setting"
exit $1
}
################################################################################
@@ -23,6 +32,17 @@ if [ $# -gt 1 ]; then
shift
fi
fi
#
# Map VERBOSE to VERBOSITY for compatibility with old Shorewall6-lite installations
#
[ -z "$VERBOSITY" ] && [ -n "$VERBOSE" ] && VERBOSITY=$VERBOSE
#
# Map other old exported variables
#
g_purge=$PURGE
g_noroutes=$NOROUTES
g_timestamp=$TIMESTAMP
g_recovering=$RECOVERING
initialize
@@ -51,19 +71,77 @@ while [ $finished -eq 0 -a $# -gt 0 ]; do
while [ -n "$option" ]; do
case $option in
v*)
VERBOSE=$(($VERBOSE + 1 ))
[ $VERBOSITY -lt 2 ] && VERBOSITY=$(($VERBOSITY + 1 ))
option=${option#v}
;;
q*)
VERBOSE=$(($VERBOSE - 1 ))
[ $VERBOSITY -gt -1 ] && VERBOSITY=$(($VERBOSITY - 1 ))
option=${option#q}
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
*)
usage 1
t*)
g_timestamp=Yes
option=${option#t}
;;
p*)
g_purge=Yes
option=${option#p}
;;
r*)
g_recovering=Yes
option=${option#r}
;;
V*)
option=${option#V}
if [ -z "$option" -a $# -gt 0 ]; then
shift
option=$1
fi
if [ -n "$option" ]; then
case $option in
-1|0|1|2)
VERBOSITY=$option
option=
;;
*)
startup_error "Invalid -V option value ($option)"
;;
esac
else
startup_error "Missing -V option value"
fi
;;
R*)
option=${option#R}
if [ -z "$option" -a $# -gt 0 ]; then
shift
option=$1
fi
if [ -n "$option" ]; then
case $option in
*/*)
startup_error "-R must specify a simple file name: $option"
;;
.safe|.try|NONE)
;;
.*)
error_message "ERROR: Reserved File Name: $RESTOREFILE"
exit 2
;;
esac
else
startup_error "Missing -R option value"
fi
RESTOREFILE=$option
option=
;;
esac
done
@@ -77,21 +155,19 @@ done
COMMAND="$1"
[ -n "${PRODUCT:=Shorewall6}" ]
kernel=$(printf "%2d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g'))
if [ $kernel -lt 20624 ]; then
error_message "ERROR: $PRODUCT requires Linux kernel 2.6.24 or later"
error_message "ERROR: $g_product requires Linux kernel 2.6.24 or later"
status=2
else
case "$COMMAND" in
start)
[ $# -ne 1 ] && usage 2
if shorewall6_is_started; then
error_message "$PRODUCT is already Running"
error_message "$g_product is already Running"
status=0
else
progress_message3 "Starting $PRODUCT...."
progress_message3 "Starting $g_product...."
detect_configuration
define_firewall
status=$?
@@ -101,23 +177,23 @@ else
;;
stop)
[ $# -ne 1 ] && usage 2
progress_message3 "Stopping $PRODUCT...."
progress_message3 "Stopping $g_product...."
detect_configuration
stop_firewall
status=0
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
progress_message3 "done."
;;
reset)
reset)
if ! shorewall6_is_started ; then
error_message "$PRODUCT is not running"
error_message "$g_product is not running"
status=2
elif [ $# -eq 1 ]; then
$IP6TABLES -Z
$IP6TABLES -t mangle -Z
date > ${VARDIR}/restarted
status=0
progress_message3 "$PRODUCT Counters Reset"
progress_message3 "$g_product Counters Reset"
else
shift
status=0
@@ -139,10 +215,11 @@ else
restart)
[ $# -ne 1 ] && usage 2
if shorewall6_is_started; then
progress_message3 "Restarting $PRODUCT...."
progress_message3 "Restarting $g_product...."
else
error_message "$PRODUCT is not running"
progress_message3 "Starting $PRODUCT...."
error_message "$g_product is not running"
progress_message3 "Starting $g_product...."
COMMAND=start
fi
detect_configuration
@@ -156,13 +233,13 @@ else
refresh)
[ $# -ne 1 ] && usage 2
if shorewall6_is_started; then
progress_message3 "Refreshing $PRODUCT...."
progress_message3 "Refreshing $g_product...."
detect_configuration
define_firewall
status=$?
progress_message3 "done."
else
echo "$PRODUCT is not running" >&2
echo "$g_product is not running" >&2
status=2
fi
;;
@@ -177,21 +254,23 @@ else
;;
clear)
[ $# -ne 1 ] && usage 2
progress_message3 "Clearing $PRODUCT...."
progress_message3 "Clearing $g_product...."
clear_firewall
status=0
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
if [ -n "$SUBSYSLOCK" ]; then
rm -f $SUBSYSLOCK
fi
progress_message3 "done."
;;
status)
[ $# -ne 1 ] && usage 2
echo "$PRODUCT-$VERSION Status at $HOSTNAME - $(date)"
echo "$g_product-$SHOREWALL_VERSION Status at $(hostname) - $(date)"
echo
if shorewall6_is_started; then
echo "$PRODUCT is running"
echo "$g_product is running"
status=0
else
echo "$PRODUCT is stopped"
echo "$g_product is stopped"
status=4
fi
@@ -208,9 +287,16 @@ else
echo "State:$state"
echo
;;
up|down)
[ $# -eq 1 ] && exit 0
shift
[ $# -ne 1 ] && usage 2
updown $1
status=0
;;
version)
[ $# -ne 1 ] && usage 2
echo $VERSION
echo $SHOREWALL_VERSION
status=0
;;
help)

View File

@@ -1,11 +1,18 @@
#!/bin/sh
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 1999-2009 - Tom Eastep (teastep@shorewall.net)
# (c) 1999-2010 - Tom Eastep (teastep@shorewall.net)
#
# Options are:
#
# -n Don't alter Routing
# -v and -q Standard Shorewall Verbosity control
# -t Timestamp progress messages
# -p Purge conntrack table
# -r Recover from failed start/restart
# -V <verbosity> Set verbosity level explicitly
# -R <restore> Overrides RESTOREFILE setting
#
# Commands are:
#
@@ -22,14 +29,6 @@
################################################################################
# Functions imported from /usr/share/shorewall/prog.header
################################################################################
#
# Message to stderr
#
error_message() # $* = Error Message
{
echo " $@" >&2
}
#
# Conditionally produce message
#
@@ -38,12 +37,12 @@ progress_message() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -gt 1 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -gt 1 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
if [ $LOG_VERBOSE -gt 1 ]; then
if [ $LOG_VERBOSITY -gt 1 ]; then
timestamp="$(date +'%b %_d %T') "
echo "${timestamp}$@" >> $STARTUP_LOG
fi
@@ -54,12 +53,12 @@ progress_message2() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -gt 0 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -gt 0 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
if [ $LOG_VERBOSE -gt 0 ]; then
if [ $LOG_VERBOSITY -gt 0 ]; then
timestamp="$(date +'%b %_d %T') "
echo "${timestamp}$@" >> $STARTUP_LOG
fi
@@ -70,93 +69,17 @@ progress_message3() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -ge 0 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -ge 0 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
if [ $LOG_VERBOSE -ge 0 ]; then
if [ $LOG_VERBOSITY -ge 0 ]; then
timestamp="$(date +'%b %_d %T') "
echo "${timestamp}$@" >> $STARTUP_LOG
fi
}
#
# Split a colon-separated list into a space-separated list
#
split() {
local ifs
ifs=$IFS
IFS=:
echo $*
IFS=$ifs
}
#
# Search a list looking for a match -- returns zero if a match found
# 1 otherwise
#
list_search() # $1 = element to search for , $2-$n = list
{
local e
e=$1
while [ $# -gt 1 ]; do
shift
[ "x$e" = "x$1" ] && return 0
done
return 1
}
#
# Suppress all output for a command
#
qt()
{
"$@" >/dev/null 2>&1
}
qt1()
{
local status
while [ 1 ]; do
"$@" >/dev/null 2>&1
status=$?
[ $status -ne 4 ] && return $status
done
}
#
# Determine if Shorewall is "running"
#
shorewall_is_started() {
qt1 $IPTABLES -L shorewall -n
}
#
# Echos the fully-qualified name of the calling shell program
#
my_pathname() {
cd $(dirname $0)
echo $PWD/$(basename $0)
}
#
# Source a user exit file if it exists
#
run_user_exit() # $1 = file name
{
local user_exit
user_exit=$(find_file $1)
if [ -f $user_exit ]; then
progress_message "Processing $user_exit ..."
. $user_exit
fi
}
#
# Set a standard chain's policy
#
@@ -198,240 +121,10 @@ deleteallchains() {
}
#
# Load a Kernel Module -- assumes that the variable 'moduledirectories' contains
# a space-separated list of directories to search for
# the module and that 'moduleloader' contains the
# module loader command.
# Generate a list of all network interfaces on the system
#
loadmodule() # $1 = module name, $2 - * arguments
{
local modulename
modulename=$1
local modulefile
local suffix
if ! list_search $modulename $DONT_LOAD $MODULES; then
shift
for suffix in $MODULE_SUFFIX ; do
for directory in $moduledirectories; do
modulefile=$directory/${modulename}.${suffix}
if [ -f $modulefile ]; then
case $moduleloader in
insmod)
insmod $modulefile $*
;;
*)
modprobe $modulename $*
;;
esac
break 2
fi
done
done
fi
}
#
# Reload the Modules
#
reload_kernel_modules() {
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
local uname
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
MODULESDIR=/lib/modules/$uname/kernel/net/ipv4/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
MODULES=$(lsmod | cut -d ' ' -f1)
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
[ -n "$moduledirectories" ] && while read command; do
eval $command
done
MODULESDIR=$save_modules_dir
}
#
# Load kernel modules required for Shorewall
#
load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
{
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
local savemoduleinfo
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
local uname
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
MODULESDIR=/lib/modules/$uname/kernel/net/ipv4/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
modules=$(find_file modules)
if [ -f $modules -a -n "$moduledirectories" ]; then
MODULES=$(lsmod | cut -d ' ' -f1)
progress_message "Loading Modules..."
. $modules
if [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir
cp -f $modules ${VARDIR}/.modules
fi
elif [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
> ${VARDIR}/.modulesdir
> ${VARDIR}/.modules
fi
MODULESDIR=$save_modules_dir
}
#
# Note: The following set of IP address manipulation functions have anomalous
# behavior when the shell only supports 32-bit signed arithmetic and
# the IP address is 128.0.0.0 or 128.0.0.1.
#
LEFTSHIFT='<<'
#
# Convert an IP address in dot quad format to an integer
#
decodeaddr() {
local x
local temp
temp=0
local ifs
ifs=$IFS
IFS=.
for x in $1; do
temp=$(( $(( $temp $LEFTSHIFT 8 )) | $x ))
done
echo $temp
IFS=$ifs
}
#
# convert an integer to dot quad format
#
encodeaddr() {
addr=$1
local x
local y
y=$(($addr & 255))
for x in 1 2 3 ; do
addr=$(($addr >> 8))
y=$(($addr & 255)).$y
done
echo $y
}
#
# Netmask from CIDR
#
ip_netmask() {
local vlsm
vlsm=${1#*/}
[ $vlsm -eq 0 ] && echo 0 || echo $(( -1 $LEFTSHIFT $(( 32 - $vlsm )) ))
}
#
# Network address from CIDR
#
ip_network() {
local decodedaddr
decodedaddr=$(decodeaddr ${1%/*})
local netmask
netmask=$(ip_netmask $1)
echo $(encodeaddr $(($decodedaddr & $netmask)))
}
#
# The following hack is supplied to compensate for the fact that many of
# the popular light-weight Bourne shell derivatives don't support XOR ("^").
#
ip_broadcast() {
local x
x=$(( 32 - ${1#*/} ))
[ $x -eq 32 ] && echo -1 || echo $(( $(( 1 $LEFTSHIFT $x )) - 1 ))
}
#
# Calculate broadcast address from CIDR
#
broadcastaddress() {
local decodedaddr
decodedaddr=$(decodeaddr ${1%/*})
local netmask
netmask=$(ip_netmask $1)
local broadcast
broadcast=$(ip_broadcast $1)
echo $(encodeaddr $(( $(($decodedaddr & $netmask)) | $broadcast )))
}
#
# Test for network membership
#
in_network() # $1 = IP address, $2 = CIDR network
{
local netmask
netmask=$(ip_netmask $2)
#
# Use string comparison to work around a broken BusyBox ash in OpenWRT
#
test $(( $(decodeaddr $1) & $netmask)) = $(( $(decodeaddr ${2%/*}) & $netmask ))
}
#
# Query NetFilter about the existence of a filter chain
#
chain_exists() # $1 = chain name
{
qt1 $IPTABLES -L $1 -n
find_all_interfaces() {
${IP:-ip} link list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed 's/:$//'
}
#
@@ -534,32 +227,6 @@ find_interface_by_address() {
[ -n "$dev" ] && echo $dev
}
#
# Find the interface with the passed MAC address
#
find_interface_by_mac() {
local mac
mac=$1
local first
local second
local rest
local dev
$IP link list | while read first second rest; do
case $first in
*:)
dev=$second
;;
*)
if [ "$second" = $mac ]; then
echo ${dev%:}
return
fi
esac
done
}
#
# Determine if Interface is up
#
@@ -567,45 +234,12 @@ interface_is_up() {
[ -n "$($IP link list dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ]
}
#
# Find interface address--returns the first IP address assigned to the passed
# device
#
find_first_interface_address() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$($IP -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1)
#
# If there wasn't one, bail out now
#
[ -n "$addr" ] || startup_error "Can't determine the IP address of $1"
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//'
}
find_first_interface_address_if_any() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$($IP -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1)
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
[ -n "$addr" ] && echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//' || echo 0.0.0.0
}
#
# Determine if interface is usable from a Netfilter prespective
#
interface_is_usable() # $1 = interface
{
[ "$1" = lo ] && return 0
interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != 0.0.0.0 ] && run_isusable_exit $1
}
@@ -658,71 +292,6 @@ get_interface_bcasts() # $1 = interface
$IP -f inet addr show dev $1 2> /dev/null | grep 'inet.*brd' | sed 's/inet.*brd //; s/scope.*//;' | sort -u
}
#
# Internal version of 'which'
#
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
#
# Find a File -- For relative file name, look in each ${CONFIG_PATH} then ${CONFDIR}
#
find_file()
{
local saveifs
saveifs=
local directory
case $1 in
/*)
echo $1
;;
*)
for directory in $(split $CONFIG_PATH); do
if [ -f $directory/$1 ]; then
echo $directory/$1
return
fi
done
echo ${CONFDIR}/$1
;;
esac
}
#
# Set the Shorewall state
#
set_state () # $1 = state
{
echo "$1 ($(date))" > ${VARDIR}/state
}
#
# Perform variable substitution on the passed argument and echo the result
#
expand() # $@ = contents of variable which may be the name of another variable
{
eval echo \"$@\"
}
#
# Function for including one file into another
#
INCLUDE() {
. $(find_file $(expand $@))
}
#
# Delete IP address
#
@@ -875,16 +444,6 @@ disable_ipv6() {
fi
}
# Function to truncate a string -- It uses 'cut -b -<n>'
# rather than ${v:first:last} because light-weight shells like ash and
# dash do not support that form of expansion.
#
truncate() # $1 = length
{
cut -b -${1}
}
#
# Clear the current traffic shaping configuration
#
@@ -950,7 +509,7 @@ get_device_mtu1() # $1 = device
#
undo_routing() {
if [ -z "$NOROUTES" ]; then
if [ -z "$g_noroutes" ]; then
#
# Restore rt_tables database
#
@@ -974,7 +533,7 @@ undo_routing() {
# Restore the default route that was in place before the initial 'shorewall start'
#
restore_default_route() {
if [ -z "$NOROUTES" -a -f ${VARDIR}/default_route ]; then
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
local default_route
default_route=
local route
@@ -1017,25 +576,6 @@ restore_default_route() {
return $result
}
#
# Determine how to do "echo -e"
#
find_echo() {
local result
result=$(echo "a\tb")
[ ${#result} -eq 3 ] && { echo echo; return; }
result=$(echo -e "a\tb")
[ ${#result} -eq 3 ] && { echo "echo -e"; return; }
result=$(mywhich echo)
[ -n "$result" ] && { echo "$result -e"; return; }
echo echo
}
#
# Determine the MAC address of the passed IP through the passed interface
#
@@ -1058,11 +598,11 @@ find_mac() # $1 = IP address, $2 = interface
}
#
# Flush the conntrack table if $PURGE is non-empty
# Flush the conntrack table if $g_purge is non-empty
#
conditionally_flush_conntrack() {
if [ -n "$PURGE" ]; then
if [ -n "$g_purge" ]; then
if [ -n $(mywhich conntrack) ]; then
conntrack -F
else
@@ -1078,7 +618,7 @@ delete_proxyarp() {
if [ -f ${VARDIR}/proxyarp ]; then
while read address interface external haveroute; do
qt arp -i $external -d $address pub
[ -z "${haveroute}${NOROUTES}" ] && qt $IP -4 route del $address dev $interface
[ -z "${haveroute}${g_noroutes}" ] && qt $IP -4 route del $address dev $interface
f=/proc/sys/net/ipv4/conf/$interface/proxy_arp
[ -f $f ] && echo 0 > $f
done < ${VARDIR}/proxyarp
@@ -1102,7 +642,7 @@ clear_firewall() {
echo 1 > /proc/sys/net/ipv4/ip_forward
if [ -n "$DISABLE_IPV6" ]; then
if [ -x $IPTABLES ]; then
if [ -x $IP6TABLES ]; then
$IP6TABLES -P INPUT ACCEPT 2> /dev/null
$IP6TABLES -P OUTPUT ACCEPT 2> /dev/null
$IP6TABLES -P FORWARD ACCEPT 2> /dev/null
@@ -1113,7 +653,7 @@ clear_firewall() {
set_state "Cleared"
logger -p kern.info "$PRODUCT Cleared"
logger -p kern.info "$g_product Cleared"
}
#
@@ -1123,7 +663,7 @@ fatal_error()
{
echo " ERROR: $@" >&2
if [ $LOG_VERBOSE -gt 1 ]; then
if [ $LOG_VERBOSITY -ge 0 ]; then
timestamp="$(date +'%_b %d %T') "
echo "${timestamp} ERROR: $@" >> $STARTUP_LOG
fi
@@ -1139,30 +679,36 @@ fatal_error()
startup_error() # $* = Error Message
{
echo " ERROR: $@: Firewall state not changed" >&2
if [ $LOG_VERBOSITY -ge 0 ]; then
timestamp="$(date +'%_b %d %T') "
echo "${timestamp} ERROR: $@" >> $STARTUP_LOG
fi
case $COMMAND in
start)
logger -p kern.err "ERROR:$PRODUCT start failed:Firewall state not changed"
logger -p kern.err "ERROR:$g_product start failed:Firewall state not changed"
;;
restart)
logger -p kern.err "ERROR:$PRODUCT restart failed:Firewall state not changed"
logger -p kern.err "ERROR:$g_product restart failed:Firewall state not changed"
;;
restore)
logger -p kern.err "ERROR:$PRODUCT restore failed:Firewall state not changed"
logger -p kern.err "ERROR:$g_product restore failed:Firewall state not changed"
;;
esac
if [ $LOG_VERBOSE -gt 1 ]; then
if [ $LOG_VERBOSITY -gt 1 ]; then
timestamp="$(date +'%_b %d %T') "
case $COMMAND in
start)
echo "${timestamp} ERROR:$PRODUCT start failed:Firewall state not changed" >> $STARTUP_LOG
echo "${timestamp} ERROR:$g_product start failed:Firewall state not changed" >> $STARTUP_LOG
;;
restart)
echo "${timestamp} ERROR:$PRODUCT restart failed:Firewall state not changed" >> $STARTUP_LOG
echo "${timestamp} ERROR:$g_product restart failed:Firewall state not changed" >> $STARTUP_LOG
;;
restore)
echo "${timestamp} ERROR:$PRODUCT restore failed:Firewall state not changed" >> $STARTUP_LOG
echo "${timestamp} ERROR:$g_product restore failed:Firewall state not changed" >> $STARTUP_LOG
;;
esac
fi
@@ -1228,34 +774,6 @@ run_tc() {
fi
}
#
# Restore the rules generated by 'drop','reject','logdrop', etc.
#
restore_dynamic_rules() {
if [ -f ${VARDIR}/save ]; then
progress_message2 "Setting up dynamic rules..."
rangematch='source IP range'
while read target ignore1 ignore2 address ignore3 rest; do
case $target in
DROP|reject|logdrop|logreject)
case $rest in
$rangematch*)
run_iptables -A dynamic -m iprange --src-range ${rest#source IP range} -j $target
;;
*)
if [ -z "$rest" ]; then
run_iptables -A dynamic -s $address -j $target
else
error_message "WARNING: Unable to restore dynamic rule \"$target $ignore1 $ignore2 $address $ignore3 $rest\""
fi
;;
esac
;;
esac
done < ${VARDIR}/save
fi
}
#
# Get a list of all configured broadcast addresses on the system
#

View File

@@ -1,11 +1,18 @@
#!/bin/sh
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 1999-2009 - Tom Eastep (teastep@shorewall.net)
# (c) 1999-2010- Tom Eastep (teastep@shorewall.net)
#
# Options are:
#
# -n Don't alter Routing
# -v and -q Standard Shorewall Verbosity control
# -t Timestamp progress messages
# -p Purge conntrack table
# -r Recover from failed start/restart
# -V <verbosity> Set verbosity level explicitly
# -R <restore> Overrides RESTOREFILE setting
#
# Commands are:
#
@@ -22,14 +29,6 @@
################################################################################
# Functions imported from /usr/share/shorewall/prog.header6
################################################################################
#
# Message to stderr
#
error_message() # $* = Error Message
{
echo " $@" >&2
}
#
# Conditionally produce message
#
@@ -38,12 +37,12 @@ progress_message() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -gt 1 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -gt 1 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
if [ $LOG_VERBOSE -gt 1 ]; then
if [ $LOG_VERBOSITY -gt 1 ]; then
timestamp="$(date +'%b %_d %T') "
echo "${timestamp}$@" >> $STARTUP_LOG
fi
@@ -54,12 +53,12 @@ progress_message2() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -gt 0 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -gt 0 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
if [ $LOG_VERBOSE -gt 0 ]; then
if [ $LOG_VERBOSITY -gt 0 ]; then
timestamp="$(date +'%b %_d %T') "
echo "${timestamp}$@" >> $STARTUP_LOG
fi
@@ -70,117 +69,17 @@ progress_message3() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -ge 0 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -ge 0 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
if [ $LOG_VERBOSE -ge 0 ]; then
if [ $LOG_VERBOSITY -ge 0 ]; then
timestamp="$(date +'%b %_d %T') "
echo "${timestamp}$@" >> $STARTUP_LOG
fi
}
#
# Split a colon-separated list into a space-separated list
#
split() {
local ifs
ifs=$IFS
IFS=:
echo $*
IFS=$ifs
}
#
# Undo the effect of 'split()'
#
join()
{
local f
local o
o=
for f in $* ; do
o="${o:+$o:}$f"
done
echo $o
}
#
# Return the number of elements in a list
#
list_count() # $* = list
{
return $#
}
#
# Search a list looking for a match -- returns zero if a match found
# 1 otherwise
#
list_search() # $1 = element to search for , $2-$n = list
{
local e
e=$1
while [ $# -gt 1 ]; do
shift
[ "x$e" = "x$1" ] && return 0
done
return 1
}
#
# Suppress all output for a command
#
qt()
{
"$@" >/dev/null 2>&1
}
qt1()
{
local status
while [ 1 ]; do
"$@" >/dev/null 2>&1
status=$?
[ $status -ne 4 ] && return $status
done
}
#
# Determine if Shorewall is "running"
#
shorewall6_is_started() {
qt1 $IP6TABLES -L shorewall -n
}
#
# Echos the fully-qualified name of the calling shell program
#
my_pathname() {
cd $(dirname $0)
echo $PWD/$(basename $0)
}
#
# Source a user exit file if it exists
#
run_user_exit() # $1 = file name
{
local user_exit
user_exit=$(find_file $1)
if [ -f $user_exit ]; then
progress_message "Processing $user_exit ..."
. $user_exit
fi
}
#
# Set a standard chain's policy
#
@@ -214,128 +113,10 @@ deleteallchains() {
}
#
# Load a Kernel Module -- assumes that the variable 'moduledirectories' contains
# a space-separated list of directories to search for
# the module and that 'moduleloader' contains the
# module loader command.
# Generate a list of all network interfaces on the system
#
loadmodule() # $1 = module name, $2 - * arguments
{
local modulename
modulename=$1
local modulefile
local suffix
if ! list_search $modulename $DONT_LOAD $MODULES; then
shift
for suffix in $MODULE_SUFFIX ; do
for directory in $moduledirectories; do
modulefile=$directory/${modulename}.${suffix}
if [ -f $modulefile ]; then
case $moduleloader in
insmod)
insmod $modulefile $*
;;
*)
modprobe $modulename $*
;;
esac
break 2
fi
done
done
fi
}
#
# Reload the Modules
#
reload_kernel_modules() {
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv6/netfilter:/lib/modules/$(uname -r)/kernel/net/netfilter:/lib/modules/$(uname -r)/kernel/net/sched/
MODULES=$(lsmod | cut -d ' ' -f1)
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
[ -n "$moduledirectories" ] && while read command; do
eval $command
done
MODULESDIR=$save_modules_dir
}
#
# Load kernel modules required for Shorewall6
#
load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
{
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
local savemoduleinfo
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && \
MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv6/netfilter:/lib/modules/$(uname -r)/kernel/net/netfilter:/lib/modules/$(uname -r)/kernel/net/sched/
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
modules=$(find_file modules)
if [ -f $modules -a -n "$moduledirectories" ]; then
MODULES=$(lsmod | cut -d ' ' -f1)
progress_message "Loading Modules..."
. $modules
if [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir
cp -f $modules ${VARDIR}/.modules
fi
elif [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
> ${VARDIR}/.modulesdir
> ${VARDIR}/.modules
fi
MODULESDIR=$save_modules_dir
}
#
# Query NetFilter about the existence of a filter chain
#
chain_exists() # $1 = chain name
{
qt1 $IP6TABLES -L $1 -n
find_all_interfaces() {
${IP:-ip} link list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed 's/:$//'
}
#
@@ -400,71 +181,11 @@ find_default_interface() {
done
}
#
# Find the interface with the passed MAC address
#
find_interface_by_mac() {
local mac
mac=$1
local first
local second
local rest
local dev
$IP link list | while read first second rest; do
case $first in
*:)
dev=$second
;;
*)
if [ "$second" = $mac ]; then
echo ${dev%:}
return
fi
esac
done
}
#
# Determine if Interface is up
#
interface_is_up() {
[ -n "$($IP link list dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ]
}
#
# Find interface address--returns the first IP address assigned to the passed
# device
#
find_first_interface_address() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$($IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 .* global' | head -n1)
#
# If there wasn't one, bail out now
#
[ -n "$addr" ] || startup_error "Can't determine the IPv6 address of $1"
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
echo $addr | sed 's/\s*inet6 //;s/\/.*//;s/ peer.*//'
}
find_first_interface_address_if_any() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$($IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 2.* global' | head -n1)
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
[ -n "$addr" ] && echo $addr | sed 's/\s*inet6 //;s/\/.*//;s/ peer.*//' || echo ::
[ -n "$($IP -6 link list dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ]
}
#
@@ -472,6 +193,7 @@ find_first_interface_address_if_any() # $1 = interface
#
interface_is_usable() # $1 = interface
{
[ "$1" = lo ] && return 0
interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ] && run_isusable_exit $1
}
@@ -681,71 +403,6 @@ get_all_acasts()
find_interface_full_addresses | convert_to_anycast | sort -u
}
#
# Internal version of 'which'
#
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
#
# Find a File -- For relative file name, look in each ${CONFIG_PATH} then ${CONFDIR}
#
find_file()
{
local saveifs
saveifs=
local directory
case $1 in
/*)
echo $1
;;
*)
for directory in $(split $CONFIG_PATH); do
if [ -f $directory/$1 ]; then
echo $directory/$1
return
fi
done
echo ${CONFDIR}/$1
;;
esac
}
#
# Set the Shorewall state
#
set_state () # $1 = state
{
echo "$1 ($(date))" > ${VARDIR}/state
}
#
# Perform variable substitution on the passed argument and echo the result
#
expand() # $@ = contents of variable which may be the name of another variable
{
eval echo \"$@\"
}
#
# Function for including one file into another
#
INCLUDE() {
. $(find_file $(expand $@))
}
#
# Detect the gateway through an interface
#
@@ -771,20 +428,6 @@ detect_gateway() # $1 = interface
[ -n "$gateway" ] && echo $gateway
}
# Function to truncate a string -- It uses 'cut -b -<n>'
# rather than ${v:first:last} because light-weight shells like ash and
# dash do not support that form of expansion.
#
truncate() # $1 = length
{
cut -b -${1}
}
#
# Clear the current traffic shaping configuration
#
delete_tc1()
{
clear_one_tc() {
@@ -846,7 +489,7 @@ get_device_mtu1() # $1 = device
#
undo_routing() {
if [ -z "$NOROUTES" ]; then
if [ -z "$g_noroutes" ]; then
#
# Restore rt_tables database
#
@@ -870,7 +513,7 @@ undo_routing() {
# Restore the default route that was in place before the initial 'shorewall start'
#
restore_default_route() {
if [ -z "$NOROUTES" -a -f ${VARDIR}/default_route ]; then
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
local default_route
default_route=
local route
@@ -933,11 +576,11 @@ find_echo() {
}
#
# Flush the conntrack table if $PURGE is non-empty
# Flush the conntrack table if $g_purge is non-empty
#
conditionally_flush_conntrack() {
if [ -n "$PURGE" ]; then
if [ -n "$g_purge" ]; then
if [ -n $(which conntrack) ]; then
conntrack -F
else
@@ -964,7 +607,7 @@ clear_firewall() {
set_state "Cleared"
logger -p kern.info "$PRODUCT Cleared"
logger -p kern.info "$g_product Cleared"
}
#
@@ -974,7 +617,7 @@ fatal_error()
{
echo " ERROR: $@" >&2
if [ $LOG_VERBOSE -gt 1 ]; then
if [ $LOG_VERBOSITY -gt 1 ]; then
timestamp="$(date +'%_b %d %T') "
echo "${timestamp} ERROR: $@" >> $STARTUP_LOG
fi
@@ -990,30 +633,36 @@ fatal_error()
startup_error() # $* = Error Message
{
echo " ERROR: $@: Firewall state not changed" >&2
if [ $LOG_VERBOSITY -ge 0 ]; then
timestamp="$(date +'%_b %d %T') "
echo "${timestamp} ERROR: $@" >> $STARTUP_LOG
fi
case $COMMAND in
start)
logger -p kern.err "ERROR:$PRODUCT start failed:Firewall state not changed"
logger -p kern.err "ERROR:$g_product start failed:Firewall state not changed"
;;
restart)
logger -p kern.err "ERROR:$PRODUCT restart failed:Firewall state not changed"
logger -p kern.err "ERROR:$g_product restart failed:Firewall state not changed"
;;
restore)
logger -p kern.err "ERROR:$PRODUCT restore failed:Firewall state not changed"
logger -p kern.err "ERROR:$g_product restore failed:Firewall state not changed"
;;
esac
if [ $LOG_VERBOSE -gt 1 ]; then
if [ $LOG_VERBOSITY -gt 1 ]; then
timestamp="$(date +'%_b %d %T') "
case $COMMAND in
start)
echo "${timestamp} ERROR:$PRODUCT start failed:Firewall state not changed" >> $STARTUP_LOG
echo "${timestamp} ERROR:$g_product start failed:Firewall state not changed" >> $STARTUP_LOG
;;
restart)
echo "${timestamp} ERROR:$PRODUCT restart failed:Firewall state not changed" >> $STARTUP_LOG
echo "${timestamp} ERROR:$g_product restart failed:Firewall state not changed" >> $STARTUP_LOG
;;
restore)
echo "${timestamp} ERROR:$PRODUCT restore failed:Firewall state not changed" >> $STARTUP_LOG
echo "${timestamp} ERROR:$g_product restore failed:Firewall state not changed" >> $STARTUP_LOG
;;
esac
fi
@@ -1079,34 +728,6 @@ run_tc() {
fi
}
#
# Restore the rules generated by 'drop','reject','logdrop', etc.
#
restore_dynamic_rules() {
if [ -f ${VARDIR}/save ]; then
progress_message2 "Setting up dynamic rules..."
rangematch='source IP range'
while read target ignore1 ignore2 address ignore3 rest; do
case $target in
DROP|reject|logdrop|logreject)
case $rest in
$rangematch*)
run_iptables -A dynamic -m iprange --src-range ${rest#source IP range} -j $target
;;
*)
if [ -z "$rest" ]; then
run_iptables -A dynamic -s $address -j $target
else
error_message "WARNING: Unable to restore dynamic rule \"$target $ignore1 $ignore2 $address $ignore3 $rest\""
fi
;;
esac
;;
esac
done < ${VARDIR}/save
fi
}
#
# Run the .iptables_restore_input as a set of discrete iptables commands
#

View File

@@ -1,6 +1,150 @@
Changes in Shorewall 4.4.5.1
Changes in Shorewall 4.4.10
1) Handle rp_filter and kernel's 2.6.31 and later.
1) Fix regression with scripts.
2) Log startup errors.
3) Implement Shorewall-init.
4) Add SAFESTOP option to /etc/default/shorewall*
5) Restore -a functionality to the version command.
6) Correct Optimization issue
7) Rename PREFIX to DESTDIR in install scripts
8) Correct handling of optional/required interfaces with wildcard names.
Changes in Shorewall 4.4.9
1) Auto-detection of bridges.
2) Correct handling of a logical interface name in the EXTERNAL column
of proxyarp.
3) More robust 'trace'.
4) Added IPv6 mDNS macro.
5) Fix find_first_interface_address() error reporting.
6) Fix propagation of zero-valued config variables.
7) Fix OPTIMIZE 4 bug.
8) Deallocate unused rules.
9) Keep rule arrays compressed during optimization.
10) Remove remaining fallback scripts.
11) Rationalize startup logs.
12) Optimize 8.
13) Don't create output chains for BPORT zones.
14) Implement 'show log ip-addr' in /sbin/shorewall and
/sbin/shorewall-lite/
15) Restore lone ACCEPT rule to the OUTPUT chain under OPTIMIZE 2.
16) Change chain policy on OUTPUT chain with lone ACCEPT rule.
17) Set IP before sourcing the params file.
18) Fix rare optimization bug.
19) Allow definition of an addressless bridge without a zone.
20) In the routestopped file, assume 'routeback' if the interface has
'routeback'.
21) Make Shorewall and Shorewall6 installable on OS X.
Changes in Shorewall 4.4.8
1) Correct handling of RATE LIMIT on NAT rules.
2) Don't create a logging chain for rules with '-j RETURN'.
3) Avoid duplicate SFQ class numbers.
4) Fix low per-IP rate limits.
5) Fix Debian init script exit status
6) Fix NFQUEUE(queue-num) in policy
7) Implement -s option in install.sh
8) Add HKP Macro
9) Fix multiple policy matches with OPTIMIZE 4 and not KLUDGEFREE
10) Eliminate up-cased variable names that aren't documented options.
11) Don't show 'OLD' capabilities if they are not available.
12) Attempt to flag use of '-' as a port-range separator.
13) Add undocumented OPTIMIZE=-1 setting.
14) Replace OPTIMIZE=-1 with undocumented optimize 4096 which DISABLES
default optimizations.
15) Add support for UDPLITE
16) Distinguish between 'Started' and 'Restored' in ${VARDIR}/state
17) Issue warnings when 'blacklist' but no blacklist file entries.
18) Don't optimize 'blacklst'.
Changes in Shorewall 4.4.7
1) Backport optimization changes from 4.5.
2) Backport two new options from 4.5.
3) Backport TPROXY from 4.5
4) Add TC_PRIOMAP to shorewall*.conf
5) Implement LOAD_HELPERS_ONLY
6) Avoid excessive module loading with LOAD_HELPERS_ONLY=Yes
7) Fix case where MARK target is unavailable.
8) Change default to ADD_IP_ALIASES=No
9) Correct defects in generate_matrix().
10) Fix and optimize 'nosmurfs'.
11) Use 'OLD_HL_MATCH' to suppress use of 'flow' in Simple TC.
Changes in Shorewall 4.4.6
1) Fix for rp_filter and kernel 2.6.31.
2) Add a hack to work around a bug in Lenny + xtables-addons
3) Re-enable SAVE_IPSETS
4) Allow both <...> and [...] for IPv6 Addresses.
5) Port mark geometry change from 4.5.
6) Add Macro patch from Tuomo Soini
7) Add 'show macro' command.
8) Add -r option to check.
9) Port simplified TC from 4.5.
Changes in Shorewall 4.4.5

View File

@@ -1,19 +1,10 @@
###############################################################################
# /etc/shorewall/shorewall.conf Version 4 - Change the following variables to
# match your setup
#
# This program is under GPL
# [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# This file should be placed in /etc/shorewall
#
# (c) 1999,2000,2001,2002,2003,2004,2005,
# 2006,2007,2008 - Tom Eastep (teastep@shorewall.net)
# Shorewall Version 4 -- /etc/shorewall/shorewall.conf
#
# For information about the settings in this file, type "man shorewall.conf"
#
# Additional information is available at
# http://www.shorewall.net/Documentation.htm#Conf
# Manpage also online at http://www.shorewall.net/manpages/shorewall.conf.html
###############################################################################
# S T A R T U P E N A B L E D
###############################################################################
@@ -107,7 +98,7 @@ RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
IP_FORWARDING=On
ADD_IP_ALIASES=Yes
ADD_IP_ALIASES=No
ADD_SNAT_ALIASES=No
@@ -117,6 +108,8 @@ TC_ENABLED=Internal
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -135,7 +128,7 @@ BLACKLISTNEWONLY=Yes
DELAYBLACKLISTLOAD=No
MODULE_SUFFIX=
MODULE_SUFFIX=ko
DISABLE_IPV6=No
@@ -193,6 +186,14 @@ TRACK_PROVIDERS=No
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=No
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -0,0 +1,11 @@
#
# Shorewall version 4 - Tcinterfaces File
#
# For information about entries in this file, type "man shorewall-tcinterfaces"
#
# See http://shorewall.net/simple_traffic_shaping.htm for additional
# information.
#
###############################################################################
#INTERFACE TYPE IN-BANDWIDTH

View File

@@ -0,0 +1,13 @@
#
# Shorewall version 4 - Tcpri File
#
# For information about entries in this file, type "man shorewall-tcpri"
#
# See http://shorewall.net/simple_traffic_shaping.htm for additional
# information.
#
###############################################################################
#BAND PROTO PORT(S) ADDRESS IN-INTERFACE HELPER

View File

@@ -26,4 +26,11 @@ OPTIONS=""
#
INITLOG=/dev/null
#
# Set this to 1 to cause '/etc/init.d/shorewall stop' to place the firewall in
# a safe state rather than to open it
#
SAFESTOP=0
# EOF

63
Shorewall/helpers Normal file
View File

@@ -0,0 +1,63 @@
#
# Shorewall version 4 - Helpers File
#
# /usr/share/shorewall/helpers
#
# This file loads the kernel helper modules.
#
# THE ORDER OF THE COMMANDS BELOW IS IMPORTANT!!!!!! You MUST load in
# dependency order. i.e., if M2 depends on M1 then you must load M1
# before you load M2.
#
# If you need to modify this file, copy it to /etc/shorewall and modify the
# copy.
#
###############################################################################
# Helpers
#
loadmodule ip_conntrack_amanda
loadmodule ip_conntrack_ftp
loadmodule ip_conntrack_h323
loadmodule ip_conntrack_irc
loadmodule ip_conntrack_netbios_ns
loadmodule ip_conntrack_pptp
loadmodule ip_conntrack_sip
loadmodule ip_conntrack_tftp
loadmodule ip_nat_amanda
loadmodule ip_nat_ftp
loadmodule ip_nat_h323
loadmodule ip_nat_irc
loadmodule ip_nat_pptp
loadmodule ip_nat_sip
loadmodule ip_nat_snmp_basic
loadmodule ip_nat_tftp
loadmodule ip_set
loadmodule ip_set_iphash
loadmodule ip_set_ipmap
loadmodule ip_set_macipmap
loadmodule ip_set_portmap
#
# 2.6.20+ helpers
#
loadmodule nf_conntrack_ftp
loadmodule nf_conntrack_h323
loadmodule nf_conntrack_irc
loadmodule nf_conntrack_netbios_ns
loadmodule nf_conntrack_netlink
loadmodule nf_conntrack_pptp
loadmodule nf_conntrack_proto_gre
loadmodule nf_conntrack_proto_sctp
loadmodule nf_conntrack_sip sip_direct_media=0
loadmodule nf_conntrack_tftp
loadmodule nf_conntrack_sane
loadmodule nf_nat_amanda
loadmodule nf_nat_ftp
loadmodule nf_nat_h323
loadmodule nf_nat_irc
loadmodule nf_nat
loadmodule nf_nat_pptp
loadmodule nf_nat_proto_gre
loadmodule nf_nat_sip
loadmodule nf_nat_snmp_basic
loadmodule nf_nat_tftp

View File

@@ -1,8 +1,8 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: shorewall
# Required-Start: $network
# Required-Stop: $network
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Configure the firewall at boot time
@@ -38,6 +38,7 @@ echo_notdone () {
echo "not done (check $INITLOG)."
fi
exit 1
}
not_configured () {
@@ -92,7 +93,11 @@ shorewall_start () {
# stop the firewall
shorewall_stop () {
echo -n "Stopping \"Shorewall firewall\": "
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
if [ "$SAFESTOP" = 1 ]; then
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
else
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
fi
return 0
}
@@ -119,7 +124,7 @@ case "$1" in
;;
refresh)
shorewall_refresh
;;
;;
force-reload|restart)
shorewall_restart
;;

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1 @@
1) In kernel 2.6.31, the handling of the rp_filter interface option was
changed incompatibly. Previously, the effective value was determined
by the setting of net.ipv4.config.dev.rp_filter logically ANDed with
the setting of net.ipv4.config.all.rp_filter.
Beginning with kernel 2.6.31, the value is the arithmetic MAX of
those two values.
Given that Shorewall sets net.ipv4.config.all.rp_filter to 1 if
there are any interfaces specifying 'routefilter', specifying
'routefilter' on any interface has the effect of setting the option
on all interfaces.
A workaround for this problem is included in Shorewall 4.4.5.1.
There are no known problems in Shorewall 4.4.10

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#
# Shorewall 4.2 -- /usr/share/shorewall/lib.base
# Shorewall 4.4 -- /usr/share/shorewall/lib.base
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
@@ -24,26 +24,17 @@
# This library contains the code common to all Shorewall components.
#
# - It is loaded by /sbin/shorewall.
# - It is loaded by /usr/share/shorewall/firewall.
# - It is released as part of Shorewall Lite where it is used by /sbin/shorewall-lite
# and /usr/share/shorewall-lite/shorecap.
#
SHOREWALL_LIBVERSION=40000
SHOREWALL_CAPVERSION=40406
SHOREWALL_LIBVERSION=40407
SHOREWALL_CAPVERSION=40408
[ -n "${VARDIR:=/var/lib/shorewall}" ]
[ -n "${SHAREDIR:=/usr/share/shorewall}" ]
[ -n "${CONFDIR:=/etc/shorewall}" ]
#
# Message to stderr
#
error_message() # $* = Error Message
{
echo " $@" >&2
}
#
# Conditionally produce message
#
@@ -52,8 +43,8 @@ progress_message() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -gt 1 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -gt 1 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
}
@@ -63,8 +54,8 @@ progress_message2() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -gt 0 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -gt 0 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
}
@@ -74,40 +65,12 @@ progress_message3() # $* = Message
local timestamp
timestamp=
if [ $VERBOSE -ge 0 ]; then
[ -n "$TIMESTAMP" ] && timestamp="$(date +%H:%M:%S) "
if [ $VERBOSITY -ge 0 ]; then
[ -n "$g_timestamp" ] && timestamp="$(date +%H:%M:%S) "
echo "${timestamp}$@"
fi
}
#
# Split a colon-separated list into a space-separated list
#
split() {
local ifs
ifs=$IFS
IFS=:
echo $*
IFS=$ifs
}
#
# Search a list looking for a match -- returns zero if a match found
# 1 otherwise
#
list_search() # $1 = element to search for , $2-$n = list
{
local e
e=$1
while [ $# -gt 1 ]; do
shift
[ "x$e" = "x$1" ] && return 0
done
return 1
}
#
# Undo the effect of 'separate_list()'
#
@@ -124,167 +87,6 @@ combine_list()
echo $o
}
#
# Suppress all output for a command
#
qt()
{
"$@" >/dev/null 2>&1
}
#
# Determine if Shorewall is "running"
#
shorewall_is_started() {
qt $IPTABLES -L shorewall -n
}
#
# Echos the fully-qualified name of the calling shell program
#
my_pathname() {
cd $(dirname $0)
echo $PWD/$(basename $0)
}
#
# Source a user exit file if it exists
#
run_user_exit() # $1 = file name
{
local user_exit
user_exit=$(find_file $1)
if [ -f $user_exit ]; then
progress_message "Processing $user_exit ..."
. $user_exit
fi
}
#
# Load a Kernel Module -- assumes that the variable 'moduledirectories' contains
# a space-separated list of directories to search for
# the module and that 'moduleloader' contains the
# module loader command.
#
loadmodule() # $1 = module name, $2 - * arguments
{
local modulename
modulename=$1
local modulefile
local suffix
if ! list_search $modulename $MODULES $DONT_LOAD ; then
shift
for suffix in $MODULE_SUFFIX ; do
for directory in $moduledirectories; do
modulefile=$directory/${modulename}.${suffix}
if [ -f $modulefile ]; then
case $moduleloader in
insmod)
insmod $modulefile $*
;;
*)
modprobe $modulename $*
;;
esac
break 2
fi
done
done
fi
}
#
# Reload the Modules
#
reload_kernel_modules() {
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
local uname
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
MODULESDIR=/lib/modules/$uname/kernel/net/ipv4/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
MODULES=$(lsmod | cut -d ' ' -f1)
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
[ -n "$moduledirectories" ] && while read command; do
eval $command
done
MODULESDIR=$save_modules_dir
}
#
# Load kernel modules required for Shorewall
#
load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
{
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
local savemoduleinfo
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
local uname
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
MODULESDIR=/lib/modules/$uname/kernel/net/ipv4/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
modules=$(find_file modules)
if [ -f $modules -a -n "$moduledirectories" ]; then
MODULES=$(lsmod | cut -d ' ' -f1)
progress_message "Loading Modules..."
. $modules
if [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir
cp -f $modules ${VARDIR}/.modules
fi
elif [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
> ${VARDIR}/.modulesdir
> ${VARDIR}/.modules
fi
MODULESDIR=$save_modules_dir
}
#
# Call this function to assert mutual exclusion with Shorewall. If you invoke the
# /sbin/shorewall program while holding mutual exclusion, you should pass "nolock" as
@@ -334,12 +136,32 @@ mutex_off()
}
#
# Note: The following set of IP address manipulation functions have anomalous
# behavior when the shell only supports 32-bit signed arithmetic and
# the IP address is 128.0.0.0 or 128.0.0.1.
# Find the interface with the passed MAC address
#
LEFTSHIFT='<<'
find_interface_by_mac() {
local mac
mac=$1
local first
local second
local rest
local dev
$IP link list | while read first second rest; do
case $first in
*:)
dev=$second
;;
*)
if [ "$second" = $mac ]; then
echo ${dev%:}
return
fi
esac
done
}
[ -z "$LEFTSHIFT" ] && . ${SHAREDIR}/lib.common
#
# Validate an IP address
@@ -369,44 +191,6 @@ valid_address() {
return 0
}
#
# Convert an IP address in dot quad format to an integer
#
decodeaddr() {
local x
local temp
temp=0
local ifs
ifs=$IFS
IFS=.
for x in $1; do
temp=$(( $(( $temp $LEFTSHIFT 8 )) | $x ))
done
echo $temp
IFS=$ifs
}
#
# convert an integer to dot quad format
#
encodeaddr() {
addr=$1
local x
local y
y=$(($addr & 255))
for x in 1 2 3 ; do
addr=$(($addr >> 8))
y=$(($addr & 255)).$y
done
echo $y
}
#
# Miserable Hack to work around broken BusyBox ash in OpenWRT
#
@@ -507,66 +291,6 @@ ip_range_explicit() {
done
}
#
# Netmask from CIDR
#
ip_netmask() {
local vlsm
vlsm=${1#*/}
[ $vlsm -eq 0 ] && echo 0 || echo $(( -1 $LEFTSHIFT $(( 32 - $vlsm )) ))
}
#
# Network address from CIDR
#
ip_network() {
local decodedaddr
decodedaddr=$(decodeaddr ${1%/*})
local netmask
netmask=$(ip_netmask $1)
echo $(encodeaddr $(($decodedaddr & $netmask)))
}
#
# The following hack is supplied to compensate for the fact that many of
# the popular light-weight Bourne shell derivatives don't support XOR ("^").
#
ip_broadcast() {
local x
x=$(( 32 - ${1#*/} ))
[ $x -eq 32 ] && echo -1 || echo $(( $(( 1 $LEFTSHIFT $x )) - 1 ))
}
#
# Calculate broadcast address from CIDR
#
broadcastaddress() {
local decodedaddr
decodedaddr=$(decodeaddr ${1%/*})
local netmask
netmask=$(ip_netmask $1)
local broadcast
broadcast=$(ip_broadcast $1)
echo $(encodeaddr $(( $(($decodedaddr & $netmask)) | $broadcast )))
}
#
# Test for network membership
#
in_network() # $1 = IP address, $2 = CIDR network
{
local netmask
netmask=$(ip_netmask $2)
#
# We compare the values as strings rather than integers to work around broken BusyBox ash on OpenWRT
#
test $(( $(decodeaddr $1) & $netmask)) = $(( $(decodeaddr ${2%/*}) & $netmask ))
}
#
# Netmask to VLSM
#
@@ -590,90 +314,6 @@ ip_vlsm() {
fi
}
#
# Query NetFilter about the existence of a filter chain
#
chain_exists() # $1 = chain name
{
qt $IPTABLES -L $1 -n
}
#
# Find the interface with the passed MAC address
#
find_interface_by_mac() {
local mac
mac=$1
local first
local second
local rest
local dev
ip link list | while read first second rest; do
case $first in
*:)
dev=$second
;;
*)
if [ "$second" = $mac ]; then
echo ${dev%:}
return
fi
esac
done
}
#
# Find interface address--returns the first IP address assigned to the passed
# device
#
find_first_interface_address() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$(ip -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1)
#
# If there wasn't one, bail out now
#
[ -n "$addr" ] || fatal_error "Can't determine the IP address of $1"
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//'
}
find_first_interface_address_if_any() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$(ip -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1)
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
[ -n "$addr" ] && echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//' || echo 0.0.0.0
}
#
# Internal version of 'which'
#
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
#
# Set default config path
#
@@ -690,32 +330,6 @@ ensure_config_path() {
fi
}
#
# Find a File -- For relative file name, look in each ${CONFIG_PATH} then ${CONFDIR}
#
find_file()
{
local saveifs
saveifs=
local directory
case $1 in
/*)
echo $1
;;
*)
for directory in $(split $CONFIG_PATH); do
if [ -f $directory/$1 ]; then
echo $directory/$1
return
fi
done
echo ${CONFDIR}/$1
;;
esac
}
#
# Get fully-qualified name of file
#
@@ -750,361 +364,11 @@ resolve_file() # $1 = file name
esac
}
#
# Perform variable substitution on the passed argument and echo the result
#
expand() # $@ = contents of variable which may be the name of another variable
{
eval echo \"$@\"
}
#
# Function for including one file into another
#
INCLUDE() {
. $(find_file $(expand $@))
}
#
# Set the Shorewall state
#
set_state () # $1 = state
{
echo "$1 ($(date))" > ${VARDIR}/state
}
#
# Determine which optional facilities are supported by iptables/netfilter
#
determine_capabilities() {
[ -n "$IPTABLES" ] || IPTABLES=$(mywhich iptables)
if [ -z "$IPTABLES" ]; then
echo " ERROR: No executable iptables binary can be found on your PATH" >&2
exit 1
fi
qt $IPTABLES -t nat -L -n && NAT_ENABLED=Yes || NAT_ENABLED=
qt $IPTABLES -t mangle -L -n && MANGLE_ENABLED=Yes || MANGLE_ENABLED=
CONNTRACK_MATCH=
NEW_CONNTRACK_MATCH=
OLD_CONNTRACK_MATCH=
MULTIPORT=
XMULTIPORT=
POLICY_MATCH=
PHYSDEV_MATCH=
PHYSDEV_BRIDGE=
IPRANGE_MATCH=
RECENT_MATCH=
OWNER_MATCH=
IPSET_MATCH=
CONNMARK=
XCONNMARK=
CONNMARK_MATCH=
XCONNMARK_MATCH=
RAW_TABLE=
IPP2P_MATCH=
OLD_IPP2P_MATCH=
LENGTH_MATCH=
CLASSIFY_TARGET=
ENHANCED_REJECT=
USEPKTTYPE=
KLUDGEFREE=
MARK=
XMARK=
MANGLE_FORWARD=
COMMENTS=
ADDRTYPE=
TCPMSS_MATCH=
HASHLIMIT_MATCH=
NFQUEUE_TARGET=
REALM_MATCH=
HELPER_MATCH=
CONNLIMIT_MATCH=
TIME_MATCH=
GOTO_TARGET=
LOGMARK_TARGET=
IPMARK_TARGET=
LOG_TARGET=Yes
PERSISTENT_SNAT=
chain=fooX$$
if [ -n "$NAT_ENABLED" ]; then
if qt $IPTABLES -t nat -N $chain; then
qt $IPTABLES -t nat -A $chain -j SNAT --to-source 1.2.3.4 --persistent && PERSISTENT_SNAT=Yes
qt $IPTABLES -t nat -F $chain
qt $IPTABLES -t nat -X $chain
fi
fi
qt $IPTABLES -F $chain
qt $IPTABLES -X $chain
if ! $IPTABLES -N $chain; then
echo " ERROR: The command \"$IPTABLES -N $chain\" failed" >&2
exit 1
fi
chain1=${chain}1
qt $IPTABLES -F $chain1
qt $IPTABLES -X $chain1
if ! $IPTABLES -N $chain1; then
echo " ERROR: The command \"$IPTABLES -N $chain1\" failed" >&2
exit 1
fi
if ! qt $IPTABLES -A $chain -m state --state ESTABLISHED,RELATED -j ACCEPT; then
echo " ERROR: Your kernel lacks connection tracking and/or state matching -- Shorewall will not run on this system" >&2
exit 1
fi
qt $IPTABLES -A $chain -m conntrack --ctorigdst 192.168.1.1 -j ACCEPT && CONNTRACK_MATCH=Yes
if [ -n "$CONNTRACK_MATCH" ]; then
qt $IPTABLES -A $chain -m conntrack -p tcp --ctorigdstport 22 -j ACCEPT && NEW_CONNTRACK_MATCH=Yes
qt $IPTABLES -A $chain -m conntrack ! --ctorigdst 1.2.3.4 || OLD_CONNTRACK_MATCH=Yes
fi
if qt $IPTABLES -A $chain -p tcp -m multiport --dports 21,22 -j ACCEPT; then
MULTIPORT=Yes
qt $IPTABLES -A $chain -p tcp -m multiport --sports 60 -m multiport --dports 99 -j ACCEPT && KLUDEFREE=Yes
fi
qt $IPTABLES -A $chain -p tcp -m multiport --dports 21:22 -j ACCEPT && XMULTIPORT=Yes
qt $IPTABLES -A $chain -m policy --pol ipsec --mode tunnel --dir in -j ACCEPT && POLICY_MATCH=Yes
if qt $IPTABLES -A $chain -m physdev --physdev-out eth0 -j ACCEPT; then
PHYSDEV_MATCH=Yes
qt $IPTABLES -A $chain -m physdev --physdev-is-bridged --physdev-in eth0 --physdev-out eth0 -j ACCEPT && PHYSDEV_BRIDGE=Yes
if [ -z "${KLUDGEFREE}" ]; then
qt $IPTABLES -A $chain -m physdev --physdev-in eth0 -m physdev --physdev-out eth0 -j ACCEPT && KLUDGEFREE=Yes
fi
fi
if qt $IPTABLES -A $chain -m iprange --src-range 192.168.1.5-192.168.1.124 -j ACCEPT; then
IPRANGE_MATCH=Yes
if [ -z "${KLUDGEFREE}" ]; then
qt $IPTABLES -A $chain -m iprange --src-range 192.168.1.5-192.168.1.124 -m iprange --dst-range 192.168.1.5-192.168.1.124 -j ACCEPT && KLUDGEFREE=Yes
fi
fi
qt $IPTABLES -A $chain -m recent --update -j ACCEPT && RECENT_MATCH=Yes
qt $IPTABLES -A $chain -m owner --uid-owner 0 -j ACCEPT && OWNER_MATCH=Yes
if qt $IPTABLES -A $chain -m connmark --mark 2 -j ACCEPT; then
CONNMARK_MATCH=Yes
qt $IPTABLES -A $chain -m connmark --mark 2/0xFF -j ACCEPT && XCONNMARK_MATCH=Yes
fi
qt $IPTABLES -A $chain -p tcp -m ipp2p --edk -j ACCEPT && IPP2P_MATCH=Yes
if [ -n "$IPP2P_MATCH" ]; then
qt $IPTABLES -A $chain -p tcp -m ipp2p --ipp2p -j ACCEPT && OLD_IPP2P_MATCH=Yes
fi
qt $IPTABLES -A $chain -m length --length 10:20 -j ACCEPT && LENGTH_MATCH=Yes
qt $IPTABLES -A $chain -j REJECT --reject-with icmp-host-prohibited && ENHANCED_REJECT=Yes
qt $IPTABLES -A $chain -j ACCEPT -m comment --comment "This is a comment" && COMMENTS=Yes
if [ -n "$MANGLE_ENABLED" ]; then
qt $IPTABLES -t mangle -N $chain
if qt $IPTABLES -t mangle -A $chain -j MARK --set-mark 1; then
MARK=Yes
qt $IPTABLES -t mangle -A $chain -j MARK --and-mark 0xFF && XMARK=Yes
fi
if qt $IPTABLES -t mangle -A $chain -j CONNMARK --save-mark; then
CONNMARK=Yes
qt $IPTABLES -t mangle -A $chain -j CONNMARK --save-mark --mask 0xFF && XCONNMARK=Yes
fi
qt $IPTABLES -t mangle -A $chain -j CLASSIFY --set-class 1:1 && CLASSIFY_TARGET=Yes
qt $IPTABLES -t mangle -A $chain -j IPMARK --addr src && IPMARK_TARGET=Yes
qt $IPTABLES -t mangle -F $chain
qt $IPTABLES -t mangle -X $chain
qt $IPTABLES -t mangle -L FORWARD -n && MANGLE_FORWARD=Yes
fi
qt $IPTABLES -t raw -L -n && RAW_TABLE=Yes
if qt mywhich ipset; then
qt ipset -X $chain # Just in case something went wrong the last time
if qt ipset -N $chain iphash ; then
if qt $IPTABLES -A $chain -m set --set $chain src -j ACCEPT; then
qt $IPTABLES -D $chain -m set --set $chain src -j ACCEPT
IPSET_MATCH=Yes
fi
qt ipset -X $chain
fi
fi
qt $IPTABLES -A $chain -m pkttype --pkt-type broadcast -j ACCEPT && USEPKTTYPE=Yes
qt $IPTABLES -A $chain -m addrtype --src-type BROADCAST -j ACCEPT && ADDRTYPE=Yes
qt $IPTABLES -A $chain -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1000:1500 -j ACCEPT && TCPMSS_MATCH=Yes
qt $IPTABLES -A $chain -m hashlimit --hashlimit-upto 4 --hashlimit-burst 5 --hashlimit-name $chain --hashlimit-mode dstip -j ACCEPT && HASHLIMIT_MATCH=Yes
if [ -z "$HASHLIMIT_MATCH" ]; then
qt $IPTABLES -A $chain -m hashlimit --hashlimit 4 --hashlimit-burst 5 --hashlimit-name $chain --hashlimit-mode dstip -j ACCEPT && NEW_HL_MATCH=Yes
HASHLIMIT_MATCH=$OLD_HL_MATCH
fi
qt $IPTABLES -A $chain -j NFQUEUE --queue-num 4 && NFQUEUE_TARGET=Yes
qt $IPTABLES -A $chain -m realm --realm 4 && REALM_MATCH=Yes
qt $IPTABLES -A $chain -m helper --helper "ftp" && HELPER_MATCH=Yes
qt $IPTABLES -A $chain -m connlimit --connlimit-above 8 -j DROP && CONNLIMIT_MATCH=Yes
qt $IPTABLES -A $chain -m time --timestart 23:00 -j DROP && TIME_MATCH=Yes
qt $IPTABLES -A $chain -g $chain1 && GOTO_TARGET=Yes
qt $IPTABLES -A $chain -j LOGMARK && LOGMARK_TARGET=Yes
qt $IPTABLES -A $chain -j LOG || LOG_TARGET=
qt $IPTABLES -F $chain
qt $IPTABLES -X $chain
qt $IPTABLES -F $chain1
qt $IPTABLES -X $chain1
CAPVERSION=$SHOREWALL_CAPVERSION
KERNELVERSION=$(printf "%d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g'))
}
report_capabilities() {
report_capability() # $1 = Capability Description , $2 Capability Setting (if any)
{
local setting
setting=
[ "x$2" = "xYes" ] && setting="Available" || setting="Not available"
echo " " $1: $setting
}
if [ $VERBOSE -gt 1 ]; then
echo "Shorewall has detected the following iptables/netfilter capabilities:"
report_capability "NAT" $NAT_ENABLED
report_capability "Packet Mangling" $MANGLE_ENABLED
report_capability "Multi-port Match" $MULTIPORT
[ -n "$MULTIPORT" ] && report_capability "Extended Multi-port Match" $XMULTIPORT
report_capability "Connection Tracking Match" $CONNTRACK_MATCH
if [ -n "$CONNTRACK_MATCH" ]; then
report_capability "Extended Connection Tracking Match Support" $NEW_CONNTRACK_MATCH
report_capability "Old Connection Tracking Match Syntax" $OLD_CONNTRACK_MATCH
fi
report_capability "Packet Type Match" $USEPKTTYPE
report_capability "Policy Match" $POLICY_MATCH
report_capability "Physdev Match" $PHYSDEV_MATCH
report_capability "Physdev-is-bridged Support" $PHYSDEV_BRIDGE
report_capability "Packet length Match" $LENGTH_MATCH
report_capability "IP range Match" $IPRANGE_MATCH
report_capability "Recent Match" $RECENT_MATCH
report_capability "Owner Match" $OWNER_MATCH
report_capability "Ipset Match" $IPSET_MATCH
report_capability "CONNMARK Target" $CONNMARK
[ -n "$CONNMARK" ] && report_capability "Extended CONNMARK Target" $XCONNMARK
report_capability "Connmark Match" $CONNMARK_MATCH
[ -n "$CONNMARK_MATCH" ] && report_capability "Extended Connmark Match" $XCONNMARK_MATCH
report_capability "Raw Table" $RAW_TABLE
report_capability "IPP2P Match" $IPP2P_MATCH
[ -n "$IPP2P_MATCH" ] && report_capability "Old IPP2P Match Syntax" $OLD_IPP2P_MATCH
report_capability "CLASSIFY Target" $CLASSIFY_TARGET
report_capability "Extended REJECT" $ENHANCED_REJECT
report_capability "Repeat match" $KLUDGEFREE
report_capability "MARK Target" $MARK
[ -n "$MARK" ] && report_capability "Extended MARK Target" $XMARK
report_capability "Mangle FORWARD Chain" $MANGLE_FORWARD
report_capability "Comments" $COMMENTS
report_capability "Address Type Match" $ADDRTYPE
report_capability "TCPMSS Match" $TCPMSS_MATCH
report_capability "Hashlimit Match" $HASHLIMIT_MATCH
report_capability "Old Hashlimit Match" $OLD_HL_MATCH
report_capability "NFQUEUE Target" $NFQUEUE_TARGET
report_capability "Realm Match" $REALM_MATCH
report_capability "Helper Match" $HELPER_MATCH
report_capability "Connlimit Match" $CONNLIMIT_MATCH
report_capability "Time Match" $TIME_MATCH
report_capability "Goto Support" $GOTO_TARGET
report_capability "LOGMARK Target" $LOGMARK_TARGET
report_capability "IPMARK Target" $IPMARK_TARGET
report_capability "LOG Target" $LOG_TARGET
report_capability "Persistent SNAT" $PERSISTENT_SNAT
fi
[ -n "$PKTTYPE" ] || USEPKTTYPE=
}
report_capabilities1() {
report_capability1() # $1 = Capability
{
eval echo $1=\$$1
}
echo "#"
echo "# Shorewall $VERSION detected the following iptables/netfilter capabilities - $(date)"
echo "#"
report_capability1 NAT_ENABLED
report_capability1 MANGLE_ENABLED
report_capability1 MULTIPORT
report_capability1 XMULTIPORT
report_capability1 CONNTRACK_MATCH
report_capability1 NEW_CONNTRACK_MATCH
report_capability1 OLD_CONNTRACK_MATCH
report_capability1 USEPKTTYPE
report_capability1 POLICY_MATCH
report_capability1 PHYSDEV_MATCH
report_capability1 PHYSDEV_BRIDGE
report_capability1 LENGTH_MATCH
report_capability1 IPRANGE_MATCH
report_capability1 RECENT_MATCH
report_capability1 OWNER_MATCH
report_capability1 IPSET_MATCH
report_capability1 CONNMARK
report_capability1 XCONNMARK
report_capability1 CONNMARK_MATCH
report_capability1 XCONNMARK_MATCH
report_capability1 RAW_TABLE
report_capability1 IPP2P_MATCH
report_capability1 OLD_IPP2P_MATCH
report_capability1 CLASSIFY_TARGET
report_capability1 ENHANCED_REJECT
report_capability1 KLUDGEFREE
report_capability1 MARK
report_capability1 XMARK
report_capability1 MANGLE_FORWARD
report_capability1 COMMENTS
report_capability1 ADDRTYPE
report_capability1 TCPMSS_MATCH
report_capability1 HASHLIMIT_MATCH
report_capability1 OLD_HL_MATCH
report_capability1 NFQUEUE_TARGET
report_capability1 REALM_MATCH
report_capability1 HELPER_MATCH
report_capability1 CONNLIMIT_MATCH
report_capability1 TIME_MATCH
report_capability1 GOTO_TARGET
report_capability1 LOGMARK_TARGET
report_capability1 IPMARK_TARGET
report_capability1 LOG_TARGET
report_capability1 PERSISTENT_SNAT
echo CAPVERSION=$SHOREWALL_CAPVERSION
echo KERNELVERSION=$KERNELVERSION
}
# Function to truncate a string -- It uses 'cut -b -<n>'
# rather than ${v:first:last} because light-weight shells like ash and
# dash do not support that form of expansion.
#
truncate() # $1 = length
{
cut -b -${1}
}
#
# Determine how to do "echo -e"
#
find_echo() {
local result

File diff suppressed because it is too large Load Diff

540
Shorewall/lib.common Normal file
View File

@@ -0,0 +1,540 @@
#!/bin/sh
#
# Shorewall 4.4 -- /usr/share/shorewall/lib.common.
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2010 - 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.
#
# The purpose of this library is to hold those functions used by both the CLI and by the
# generated firewall scripts. To avoid versioning issues, it is copied into generated
# scripts rather than loaded at run-time.
#
#
# Get the Shorewall version of the passed script
#
get_script_version() { # $1 = script
local temp
local version
local ifs
local digits
temp=$( $SHOREWALL_SHELL $1 version | sed 's/-.*//' )
if [ $? -ne 0 ]; then
version=0
else
ifs=$IFS
IFS=.
temp=$(echo $temp)
IFS=$ifs
digits=0
for temp in $temp; do
version=${version}$(printf '%02d' $temp)
digits=$(($digits + 1))
[ $digits -eq 3 ] && break
done
fi
echo $version
}
#
# Do required exports or create the required option string and run the passed script using
# $SHOREWALL_SHELL
#
run_it() {
local script
local options
local version
export VARDIR
script=$1
shift
version=$(get_script_version $script)
if [ $version -lt 040408 ]; then
#
# Old script that doesn't understand 4.4.8 script options
#
export RESTOREFILE
export VERBOSITY
export NOROUTES=$g_noroutes
export PURGE=$g_purge
export TIMESTAMP=$g_timestamp
export RECOVERING=$g_recovering
if [ "$g_product" != Shorewall ]; then
#
# Shorewall Lite
#
export LOGFORMAT
export IPTABLES
fi
else
#
# 4.4.8 or later -- no additional exports required
#
options='-'
[ -n "$g_noroutes" ] && options=${options}n
[ -n "$g_timestamp" ] && options=${options}t
[ -n "$g_purge" ] && options=${options}p
[ -n "$g_recovering" ] && options=${options}r
options="${options}V $VERBOSITY"
[ -n "$RESTOREFILE" ] && options="${options} -R $RESTOREFILE"
fi
$SHOREWALL_SHELL $script $options $@
}
#
# Message to stderr
#
error_message() # $* = Error Message
{
echo " $@" >&2
}
#
# Split a colon-separated list into a space-separated list
#
split() {
local ifs
ifs=$IFS
IFS=:
echo $*
IFS=$ifs
}
#
# Search a list looking for a match -- returns zero if a match found
# 1 otherwise
#
list_search() # $1 = element to search for , $2-$n = list
{
local e
e=$1
while [ $# -gt 1 ]; do
shift
[ "x$e" = "x$1" ] && return 0
done
return 1
}
#
# Suppress all output for a command
#
qt()
{
"$@" >/dev/null 2>&1
}
qt1()
{
local status
while [ 1 ]; do
"$@" >/dev/null 2>&1
status=$?
[ $status -ne 4 ] && return $status
done
}
#
# Determine if Shorewall is "running"
#
shorewall_is_started() {
qt $IPTABLES -L shorewall -n
}
#
# Echos the fully-qualified name of the calling shell program
#
my_pathname() {
cd $(dirname $0)
echo $PWD/$(basename $0)
}
#
# Source a user exit file if it exists
#
run_user_exit() # $1 = file name
{
local user_exit
user_exit=$(find_file $1)
if [ -f $user_exit ]; then
progress_message "Processing $user_exit ..."
. $user_exit
fi
}
#
# Load a Kernel Module -- assumes that the variable 'moduledirectories' contains
# a space-separated list of directories to search for
# the module and that 'moduleloader' contains the
# module loader command.
#
loadmodule() # $1 = module name, $2 - * arguments
{
local modulename
modulename=$1
local modulefile
local suffix
if ! list_search $modulename $DONT_LOAD $MODULES; then
shift
for suffix in $MODULE_SUFFIX ; do
for directory in $moduledirectories; do
modulefile=$directory/${modulename}.${suffix}
if [ -f $modulefile ]; then
case $moduleloader in
insmod)
insmod $modulefile $*
;;
*)
modprobe $modulename $*
;;
esac
break 2
fi
done
done
fi
}
#
# Reload the Modules
#
reload_kernel_modules() {
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
local uname
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
MODULESDIR=/lib/modules/$uname/kernel/net/ipv4/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
MODULES=$(lsmod | cut -d ' ' -f1)
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
[ -n "$moduledirectories" ] && while read command; do
eval $command
done
MODULESDIR=$save_modules_dir
}
#
# Load kernel modules required for Shorewall
#
load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
{
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
local savemoduleinfo
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
local uname
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && \
uname=$(uname -r) && \
MODULESDIR=/lib/modules/$uname/kernel/net/ipv4/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
[ -n "$LOAD_HELPERS_ONLY" ] && modules=$(find_file helpers) || modules=$(find_file modules)
if [ -f $modules -a -n "$moduledirectories" ]; then
MODULES=$(lsmod | cut -d ' ' -f1)
progress_message "Loading Modules..."
. $modules
if [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir
cp -f $modules ${VARDIR}/.modules
fi
elif [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
> ${VARDIR}/.modulesdir
> ${VARDIR}/.modules
fi
MODULESDIR=$save_modules_dir
}
#
# Note: The following set of IP address manipulation functions have anomalous
# behavior when the shell only supports 32-bit signed arithmetic and
# the IP address is 128.0.0.0 or 128.0.0.1.
#
LEFTSHIFT='<<'
#
# Convert an IP address in dot quad format to an integer
#
decodeaddr() {
local x
local temp
temp=0
local ifs
ifs=$IFS
IFS=.
for x in $1; do
temp=$(( $(( $temp $LEFTSHIFT 8 )) | $x ))
done
echo $temp
IFS=$ifs
}
#
# convert an integer to dot quad format
#
encodeaddr() {
addr=$1
local x
local y
y=$(($addr & 255))
for x in 1 2 3 ; do
addr=$(($addr >> 8))
y=$(($addr & 255)).$y
done
echo $y
}
#
# Netmask from CIDR
#
ip_netmask() {
local vlsm
vlsm=${1#*/}
[ $vlsm -eq 0 ] && echo 0 || echo $(( -1 $LEFTSHIFT $(( 32 - $vlsm )) ))
}
#
# Network address from CIDR
#
ip_network() {
local decodedaddr
decodedaddr=$(decodeaddr ${1%/*})
local netmask
netmask=$(ip_netmask $1)
echo $(encodeaddr $(($decodedaddr & $netmask)))
}
#
# The following hack is supplied to compensate for the fact that many of
# the popular light-weight Bourne shell derivatives don't support XOR ("^").
#
ip_broadcast() {
local x
x=$(( 32 - ${1#*/} ))
[ $x -eq 32 ] && echo -1 || echo $(( $(( 1 $LEFTSHIFT $x )) - 1 ))
}
#
# Calculate broadcast address from CIDR
#
broadcastaddress() {
local decodedaddr
decodedaddr=$(decodeaddr ${1%/*})
local netmask
netmask=$(ip_netmask $1)
local broadcast
broadcast=$(ip_broadcast $1)
echo $(encodeaddr $(( $(($decodedaddr & $netmask)) | $broadcast )))
}
#
# Test for network membership
#
in_network() # $1 = IP address, $2 = CIDR network
{
local netmask
netmask=$(ip_netmask $2)
#
# Use string comparison to work around a broken BusyBox ash in OpenWRT
#
test $(( $(decodeaddr $1) & $netmask)) = $(( $(decodeaddr ${2%/*}) & $netmask ))
}
#
# Find interface address--returns the first IP address assigned to the passed
# device
#
find_first_interface_address() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$(${IP:-ip} -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1)
#
# If there wasn't one, bail out now
#
[ -n "$addr" ] || startup_error "Can't determine the IP address of $1"
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//'
}
find_first_interface_address_if_any() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$(${IP:-ip} -f inet addr show $1 2> /dev/null | grep 'inet .* global' | head -n1)
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
[ -n "$addr" ] && echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//' || echo 0.0.0.0
}
#
# Internal version of 'which'
#
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
#
# Query NetFilter about the existence of a filter chain
#
chain_exists() # $1 = chain name
{
qt1 $IPTABLES -L $1 -n
}
#
# Find a File -- For relative file name, look in each ${CONFIG_PATH} then ${CONFDIR}
#
find_file()
{
local saveifs
saveifs=
local directory
case $1 in
/*)
echo $1
;;
*)
for directory in $(split $CONFIG_PATH); do
if [ -f $directory/$1 ]; then
echo $directory/$1
return
fi
done
echo ${CONFDIR}/$1
;;
esac
}
#
# Set the Shorewall state
#
set_state () # $1 = state
{
echo "$1 ($(date))" > ${VARDIR}/state
}
#
# Perform variable substitution on the passed argument and echo the result
#
expand() # $@ = contents of variable which may be the name of another variable
{
eval echo \"$@\"
}
#
# Function for including one file into another
#
INCLUDE() {
. $(find_file $(expand $@))
}
# Function to truncate a string -- It uses 'cut -b -<n>'
# rather than ${v:first:last} because light-weight shells like ash and
# dash do not support that form of expansion.
#
truncate() # $1 = length
{
cut -b -${1}
}

View File

@@ -54,6 +54,8 @@ loadmodule xt_owner
loadmodule xt_physdev
loadmodule xt_pkttype
loadmodule xt_tcpmss
loadmodule xt_IPMARK
loadmodule xt_TPROXY
#
# Helpers
#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
%define name shorewall
%define version 4.4.5
%define release 1
%define version 4.4.10
%define release 0base
Summary: Shoreline Firewall is an iptables-based firewall for Linux systems.
Name: %{name}
@@ -14,6 +14,7 @@ URL: http://www.shorewall.net/
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: iptables iproute perl
Provides: shoreline_firewall = %{version}-%{release}
Obsoletes: shorewall-common shorewall-perl shorewall-shell
%description
@@ -28,7 +29,7 @@ a multi-function gateway/ router/server or on a standalone GNU/Linux system.
%build
%install
export PREFIX=$RPM_BUILD_ROOT ; \
export DESTDIR=$RPM_BUILD_ROOT ; \
export OWNER=`id -n -u` ; \
export GROUP=`id -n -g` ;\
./install.sh
@@ -75,7 +76,6 @@ fi
%attr(0755,root,root) %dir /usr/share/shorewall/configfiles
%attr(0700,root,root) %dir /var/lib/shorewall
%attr(0644,root,root) %config(noreplace) /etc/shorewall/*
%attr(0600,root,root) /etc/shorewall/Makefile
%attr(0644,root,root) /etc/logrotate.d/shorewall
@@ -89,8 +89,10 @@ fi
%attr(- ,root,root) /usr/share/shorewall/functions
%attr(0644,root,root) /usr/share/shorewall/lib.base
%attr(0644,root,root) /usr/share/shorewall/lib.cli
%attr(0644,root,root) /usr/share/shorewall/lib.common
%attr(0644,root,root) /usr/share/shorewall/macro.*
%attr(0644,root,root) /usr/share/shorewall/modules
%attr(0644,root,root) /usr/share/shorewall/helpers
%attr(0644,root,root) /usr/share/shorewall/configpath
%attr(0755,root,root) /usr/share/shorewall/wait4ifup
@@ -101,14 +103,76 @@ fi
%attr(0644,root,root) /usr/share/shorewall/configfiles/*
%attr(0644,root,root) %{_mandir}/man5/*
%attr(0644,root,root) %{_mandir}/man8/shorewall.8.gz
%attr(0644,root,root) %{_mandir}/man8/*
%doc COPYING INSTALL changelog.txt releasenotes.txt Contrib/* Samples
%changelog
* Sat Dec 19 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.5-1
* Fri Nov 27 2009 Tom Eastep tom@shorewall.net
* Tue Jun 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Mon Jun 07 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC3
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta4
* Tue May 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta3
* Thu May 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta2
* Thu May 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta2
* Thu May 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta1
* Mon May 03 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0base
* Sun May 02 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0RC2
* Sun Apr 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0RC1
* Sat Apr 24 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta5
* Fri Apr 16 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta4
* Fri Apr 09 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta3
* Thu Apr 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta2
* Sat Mar 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta1
* Fri Mar 19 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0base
* Tue Mar 16 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0RC2
* Mon Mar 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0RC1
* Sun Feb 28 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0Beta2
* Thu Feb 11 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0Beta1
* Fri Feb 05 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0base
* Tue Feb 02 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0RC2
* Wed Jan 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0RC1
* Mon Jan 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta4
* Fri Jan 22 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta3
* Fri Jan 22 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta2
* Thu Jan 21 2010 Tom Eastep tom@shorewall.net
- Add /usr/share/shorewall/helpers
* Sun Jan 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta1
* Wed Jan 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.6-0base
* Wed Jan 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.6-0Beta1
* Thu Dec 24 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.5-0base
* Sat Nov 21 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.4-0base

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005 - Tom Eastep (teastep@shorewall.net)
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://www.shorewall.net
#
@@ -26,7 +26,7 @@
# You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.5.1
VERSION=4.4.10
usage() # $1 = exit status
{
@@ -79,7 +79,7 @@ if qt iptables -L shorewall -n && [ ! -f /sbin/shorewall-lite ]; then
fi
if [ -L /usr/share/shorewall/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall/init | sed 's/^.*> //')
FIREWALL=$(readlink -m -q /usr/share/shorewall/init)
else
FIREWALL=/etc/init.d/shorewall
fi
@@ -108,6 +108,7 @@ rm -rf /usr/share/shorewall
rm -rf /usr/share/shorewall-*.bkout
rm -rf /usr/share/man/man5/shorewall*
rm -rf /usr/share/man/man8/shorewall*
rm -f /etc/logrotate.d/shorewall
echo "Shorewall Uninstalled"

View File

@@ -1 +1 @@
This is the Shorewall6-lite development 4.3 branch of SVN.
This is the Shorewall6-lite stable 4.4 branch of Git.

View File

@@ -26,4 +26,11 @@ OPTIONS=""
#
INITLOG=/dev/null
#
# Set this to 1 to cause '/etc/init.d/shorewall6-lite stop' to place the firewall in
# a safe state rather than to open it
#
SAFESTOP=0
# EOF

View File

@@ -1,104 +0,0 @@
#!/bin/sh
#
# Script to back out the installation of Shorewall Lite and to restore the previous version of
# the program
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall 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.
#
# Usage:
#
# You may only use this script to back out the installation of the version
# shown below. Simply run this script to revert to your prior version of
# Shoreline Firewall.
VERSION=4.4.5.1
usage() # $1 = exit status
{
echo "usage: $(basename $0)"
exit $1
}
restore_directory() # $1 = directory to restore
{
if [ -d ${1}-${VERSION}.bkout ]; then
if mv -f $1 ${1}-${VERSION} && mv ${1}-${VERSION}.bkout $1; then
echo
echo "$1 restored"
rm -rf ${1}-${VERSION}
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
restore_file() # $1 = file to restore, $2 = (Optional) Directory to restore from
{
if [ -n "$2" ]; then
local file
file=$(basename $1)
if [ -f $2/$file ]; then
if mv -f $2/$file $1 ; then
echo
echo "$1 restored"
return
fi
echo "ERROR: Could not restore $1"
exit 1
fi
fi
if [ -f ${1}-${VERSION}.bkout -o -L ${1}-${VERSION}.bkout ]; then
if (mv -f ${1}-${VERSION}.bkout $1); then
echo
echo "$1 restored"
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
if [ ! -f /usr/share/shorewall-lite-${VERSION}.bkout/version ]; then
echo "Shorewall Version $VERSION is not installed"
exit 1
fi
echo "Backing Out Installation of Shorewall $VERSION"
if [ -L /usr/share/shorewall-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
restore_file $FIREWALL /usr/share/shorewall-lite-${VERSION}.bkout
else
restore_file /etc/init.d/shorewall /usr/share/shorewall-lite-${VERSION}.bkout
fi
restore_file /sbin/shorewall /var/lib/shorewall-lite-${VERSION}.bkout
restore_directory /etc/shorewall-lite
restore_directory /usr/share/shorewall-lite
restore_directory /var/lib/shorewall-lite
echo "Shorewall Lite Restored to Version $(cat /usr/share/shorewall-lite/version)"

View File

@@ -2,8 +2,8 @@
### BEGIN INIT INFO
# Provides: shorewall6-lite
# Required-Start: $network
# Required-Stop: $network
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Configure the firewall at boot time
@@ -42,6 +42,7 @@ echo_notdone () {
echo "not done (check $INITLOG)."
fi
exit 1
}
not_configured () {
@@ -87,7 +88,11 @@ shorewall6_start () {
# stop the firewall
shorewall6_stop () {
echo -n "Stopping \"Shorewall6 Lite firewall\": "
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
if [ "$SAFESTOP" = 1 ]; then
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
else
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
fi
return 0
}

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2006,2007 - Tom Eastep (teastep@shorewall.net)
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.net
#
@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.5.1
VERSION=4.4.10
usage() # $1 = exit status
{
@@ -82,15 +82,16 @@ delete_file() # $1 = file to delete
install_file() # $1 = source $2 = target $3 = mode
{
run_install $OWNERSHIP -m $3 $1 ${2}
run_install $T $OWNERSHIP -m $3 $1 ${2}
}
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
#
# Parse the run line
#
# DEST is the SysVInit script directory
# INIT is the name of the script in the $DEST directory
# RUNLEVELS is the chkconfig parmeters for firewall
# ARGS is "yes" if we've already parsed an argument
#
ARGS=""
@@ -103,10 +104,6 @@ if [ -z "$INIT" ] ; then
INIT="shorewall6-lite"
fi
if [ -z "$RUNLEVELS" ] ; then
RUNLEVELS=""
fi
while [ $# -gt 0 ] ; do
case "$1" in
-h|help|?)
@@ -129,11 +126,12 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
#
# Determine where to install the firewall script
#
DEBIAN=
INSTALLD='-D'
T='-T'
case $(uname) in
CYGWIN*)
if [ -z "$PREFIX" ]; then
if [ -z "$DESTDIR" ]; then
DEST=
INIT=
fi
@@ -141,6 +139,10 @@ case $(uname) in
OWNER=$(id -un)
GROUP=$(id -gn)
;;
Darwin)
INSTALLD=
T=
;;
*)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
@@ -149,14 +151,14 @@ esac
OWNERSHIP="-o $OWNER -g $GROUP"
if [ -n "$PREFIX" ]; then
if [ -n "$DESTDIR" ]; then
if [ `id -u` != 0 ] ; then
echo "Not setting file owner/group permissions, not running as root."
OWNERSHIP=""
fi
install -d $OWNERSHIP -m 755 ${PREFIX}/sbin
install -d $OWNERSHIP -m 755 ${PREFIX}${DEST}
install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
elif [ -d /etc/apt -a -e /usr/bin/dpkg ]; then
DEBIAN=yes
elif [ -f /etc/slackware-version ] ; then
@@ -178,183 +180,201 @@ echo "Installing Shorewall6 Lite Version $VERSION"
#
# Check for /etc/shorewall6-lite
#
if [ -z "$PREFIX" -a -d /etc/shorewall6-lite ]; then
first_install=""
if [ -z "$DESTDIR" -a -d /etc/shorewall6-lite ]; then
[ -f /etc/shorewall6-lite/shorewall.conf ] && \
mv -f /etc/shorewall6-lite/shorewall.conf /etc/shorewall6-lite/shorewall6-lite.conf
else
first_install="Yes"
rm -rf ${PREFIX}/etc/shorewall6-lite
rm -rf ${PREFIX}/usr/share/shorewall6-lite
rm -rf ${PREFIX}/var/lib/shorewall6-lite
rm -rf ${DESTDIR}/etc/shorewall6-lite
rm -rf ${DESTDIR}/usr/share/shorewall6-lite
rm -rf ${DESTDIR}/var/lib/shorewall6-lite
fi
delete_file ${PREFIX}/usr/share/shorewall6-lite/xmodules
#
# Check for /sbin/shorewall6-lite
#
if [ -f ${DESTDIR}/sbin/shorewall6-lite ]; then
first_install=""
else
first_install="Yes"
fi
install_file shorewall6-lite ${PREFIX}/sbin/shorewall6-lite 0544 ${PREFIX}/var/lib/shorewall6-lite-${VERSION}.bkout
delete_file ${DESTDIR}/usr/share/shorewall6-lite/xmodules
echo "Shorewall6 Lite control program installed in ${PREFIX}/sbin/shorewall6-lite"
install_file shorewall6-lite ${DESTDIR}/sbin/shorewall6-lite 0544
echo "Shorewall6 Lite control program installed in ${DESTDIR}/sbin/shorewall6-lite"
#
# Install the Firewall Script
#
if [ -n "$DEBIAN" ]; then
install_file init.debian.sh /etc/init.d/shorewall6-lite 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall6-lite 0544
elif [ -n "$ARCHLINUX" ]; then
install_file init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544
else
install_file init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
install_file init.sh ${DESTDIR}${DEST}/$INIT 0544
fi
echo "Shorewall6 Lite script installed in ${PREFIX}${DEST}/$INIT"
echo "Shorewall6 Lite script installed in ${DESTDIR}${DEST}/$INIT"
#
# Create /etc/shorewall6-lite, /usr/share/shorewall6-lite and /var/lib/shorewall6-lite if needed
#
mkdir -p ${PREFIX}/etc/shorewall6-lite
mkdir -p ${PREFIX}/usr/share/shorewall6-lite
mkdir -p ${PREFIX}/var/lib/shorewall6-lite
mkdir -p ${DESTDIR}/etc/shorewall6-lite
mkdir -p ${DESTDIR}/usr/share/shorewall6-lite
mkdir -p ${DESTDIR}/var/lib/shorewall6-lite
chmod 755 ${PREFIX}/etc/shorewall6-lite
chmod 755 ${PREFIX}/usr/share/shorewall6-lite
chmod 755 ${DESTDIR}/etc/shorewall6-lite
chmod 755 ${DESTDIR}/usr/share/shorewall6-lite
if [ -n "$PREFIX" ]; then
mkdir -p ${PREFIX}/etc/logrotate.d
chmod 755 ${PREFIX}/etc/logrotate.d
if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}/etc/logrotate.d
chmod 755 ${DESTDIR}/etc/logrotate.d
fi
#
# Install the config file
#
if [ ! -f ${PREFIX}/etc/shorewall6-lite/shorewall6-lite.conf ]; then
run_install $OWNERSHIP -m 0744 shorewall6-lite.conf ${PREFIX}/etc/shorewall6-lite/shorewall6-lite.conf
echo "Config file installed as ${PREFIX}/etc/shorewall6-lite/shorewall6-lite.conf"
if [ ! -f ${DESTDIR}/etc/shorewall6-lite/shorewall6-lite.conf ]; then
install_file shorewall6-lite.conf ${DESTDIR}/etc/shorewall6-lite/shorewall6-lite.conf 0744
echo "Config file installed as ${DESTDIR}/etc/shorewall6-lite/shorewall6-lite.conf"
fi
if [ -n "$ARCHLINUX" ] ; then
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${PREFIX}/etc/shorewall6-lite/shorewall.conf
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${DESTDIR}/etc/shorewall6-lite/shorewall.conf
fi
#
# Install the Makefile
#
run_install $OWNERSHIP -m 0600 Makefile ${PREFIX}/etc/shorewall6-lite/Makefile
echo "Makefile installed as ${PREFIX}/etc/shorewall6-lite/Makefile"
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}/etc/shorewall6-lite
echo "Makefile installed as ${DESTDIR}/etc/shorewall6-lite/Makefile"
#
# Install the default config path file
#
install_file configpath ${PREFIX}/usr/share/shorewall6-lite/configpath 0644
echo "Default config path file installed as ${PREFIX}/usr/share/shorewall6-lite/configpath"
install_file configpath ${DESTDIR}/usr/share/shorewall6-lite/configpath 0644
echo "Default config path file installed as ${DESTDIR}/usr/share/shorewall6-lite/configpath"
#
# Install the libraries
#
for f in lib.* ; do
if [ -f $f ]; then
install_file $f ${PREFIX}/usr/share/shorewall6-lite/$f 0644
echo "Library ${f#*.} file installed as ${PREFIX}/usr/share/shorewall6-lite/$f"
install_file $f ${DESTDIR}/usr/share/shorewall6-lite/$f 0644
echo "Library ${f#*.} file installed as ${DESTDIR}/usr/share/shorewall6-lite/$f"
fi
done
ln -sf lib.base ${PREFIX}/usr/share/shorewall6-lite/functions
ln -sf lib.base ${DESTDIR}/usr/share/shorewall6-lite/functions
echo "Common functions linked through ${PREFIX}/usr/share/shorewall6-lite/functions"
echo "Common functions linked through ${DESTDIR}/usr/share/shorewall6-lite/functions"
#
# Install Shorecap
#
install_file shorecap ${PREFIX}/usr/share/shorewall6-lite/shorecap 0755
install_file shorecap ${DESTDIR}/usr/share/shorewall6-lite/shorecap 0755
echo
echo "Capability file builder installed in ${PREFIX}/usr/share/shorewall6-lite/shorecap"
echo "Capability file builder installed in ${DESTDIR}/usr/share/shorewall6-lite/shorecap"
#
# Install wait4ifup
#
install_file wait4ifup ${PREFIX}/usr/share/shorewall6-lite/wait4ifup 0755
if [ -f wait4ifup ]; then
install_file wait4ifup ${DESTDIR}/usr/share/shorewall6-lite/wait4ifup 0755
echo
echo "wait4ifup installed in ${PREFIX}/usr/share/shorewall6-lite/wait4ifup"
echo
echo "wait4ifup installed in ${DESTDIR}/usr/share/shorewall6-lite/wait4ifup"
fi
#
# Install the Modules file
#
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall6-lite/modules
echo "Modules file installed as ${PREFIX}/usr/share/shorewall6-lite/modules"
if [ -f modules ]; then
#
# Install the Modules file
#
run_install $OWNERSHIP -m 0600 modules ${DESTDIR}/usr/share/shorewall6-lite
echo "Modules file installed as ${DESTDIR}/usr/share/shorewall6-lite/modules"
fi
#
# Install the Man Pages
#
if [ -d manpages ]; then
#
# Install the Man Pages
#
cd manpages
cd manpages
for f in *.5; do
gzip -c $f > $f.gz
run_install -D -m 644 $f.gz ${PREFIX}/usr/share/man/man5/$f.gz
echo "Man page $f.gz installed to ${PREFIX}/usr/share/man/man5/$f.gz"
done
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}/usr/share/man/man5/ ${DESTDIR}/usr/share/man/man8/
for f in *.8; do
gzip -c $f > $f.gz
run_install -D -m 644 $f.gz ${PREFIX}/usr/share/man/man8/$f.gz
echo "Man page $f.gz installed to ${PREFIX}/usr/share/man/man8/$f.gz"
done
for f in *.5; do
gzip -c $f > $f.gz
run_install $INSTALLD -m 644 $f.gz ${DESTDIR}/usr/share/man/man5/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}/usr/share/man/man5/$f.gz"
done
cd ..
for f in *.8; do
gzip -c $f > $f.gz
run_install $INSTALLD -m 644 $f.gz ${DESTDIR}/usr/share/man/man8/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}/usr/share/man/man8/$f.gz"
done
cd ..
echo "Man Pages Installed"
echo "Man Pages Installed"
fi
if [ -d ${PREFIX}/etc/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${PREFIX}/etc/logrotate.d/shorewall6-lite
echo "Logrotate file installed as ${PREFIX}/etc/logrotate.d/shorewall6-lite"
if [ -d ${DESTDIR}/etc/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}/etc/logrotate.d/shorewall6-lite
echo "Logrotate file installed as ${DESTDIR}/etc/logrotate.d/shorewall6-lite"
fi
#
# Create the version file
#
echo "$VERSION" > ${PREFIX}/usr/share/shorewall6-lite/version
chmod 644 ${PREFIX}/usr/share/shorewall6-lite/version
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall6-lite/version
chmod 644 ${DESTDIR}/usr/share/shorewall6-lite/version
#
# Remove and create the symbolic link to the init script
#
if [ -z "$PREFIX" ]; then
if [ -z "$DESTDIR" ]; then
rm -f /usr/share/shorewall6-lite/init
ln -s ${DEST}/${INIT} /usr/share/shorewall6-lite/init
fi
if [ -z "$PREFIX" -a -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall6-lite
ln -s ../init.d/shorewall6-lite /etc/rcS.d/S40shorewall6-lite
echo "Shorewall6 Lite will start automatically at boot"
touch /var/log/shorewall-init.log
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall6-lite ; then
echo "Shorewall6 Lite will start automatically at boot"
else
if [ -z "$DESTDIR" ]; then
touch /var/log/shorewall6-lite-init.log
if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall6-lite
ln -s ../init.d/shorewall6-lite /etc/rcS.d/S40shorewall6-lite
echo "Shorewall6 Lite will start automatically at boot"
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall6-lite ; then
echo "Shorewall6 Lite will start automatically at boot"
else
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall6-lite ; then
echo "Shorewall6 Lite will start automatically in run levels as follows:"
chkconfig --list shorewall6-lite
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall6-lite default; then
echo "Shorewall6 Lite will start automatically at boot"
else
cant_autostart
fi
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall6-lite ; then
echo "Shorewall6 Lite will start automatically in run levels as follows:"
chkconfig --list shorewall6-lite
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall6-lite default; then
echo "Shorewall6 Lite will start automatically at boot"
else
cant_autostart
fi
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
cant_autostart
fi
fi
fi

View File

@@ -1,4 +1,4 @@
/var/log/shorewall6-init.log {
/var/log/shorewall6-lite-init.log {
missingok
notifempty
create 0600 root root

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
# (c) 2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# This file should be placed in /sbin/shorewall.
#
@@ -48,18 +48,19 @@
SHAREDIR=/usr/share/shorewall6-lite
VARDIR=/var/lib/shorewall6-lite
CONFDIR=/etc/shorewall6-lite
PRODUCT="Shorewall Lite"
g_product="Shorewall Lite"
. /usr/share/shorewall6-lite/lib.base
. /usr/share/shorewall6-lite/lib.cli
. /usr/share/shorewall6-lite/configpath
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
VERSION=$(cat /usr/share/shorewall6-lite/version)
SHOREWALL_VERSION=$(cat /usr/share/shorewall6-lite/version)
[ -n "$IPTABLES" ] || IPTABLES=$(mywhich iptables)
[ -n "$IP6TABLES" ] || IP6TABLES=$(mywhich iptables)
VERBOSE=0
VERBOSITY=0
load_kernel_modules No
determine_capabilities
report_capabilities1

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006 - Tom Eastep (teastep@shorewall.net)
# (c) 2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# This file should be placed in /sbin/shorewall-lite.
#
@@ -117,8 +117,6 @@ get_config() {
[ -n "$LOGFORMAT" ] || LOGFORMAT="Shorewall:"
export LOGFORMAT
if [ -n "$IP6TABLES" ]; then
if [ ! -x "$IP6TABLES" ]; then
echo " ERROR: The program specified in IP6TABLES does not exist or is not executable" >&2
@@ -127,13 +125,11 @@ get_config() {
else
IP6TABLES=$(mywhich ip6tables 2> /dev/null)
if [ -z "$IP6TABLES" ] ; then
echo " ERROR: Can't find iptables executable" >&2
echo " ERROR: Can't find ip6tables executable" >&2
exit 2
fi
fi
export IP6TABLES
if [ -n "$SHOREWALL_SHELL" ]; then
if [ ! -x "$SHOREWALL_SHELL" ]; then
echo " WARNING: The program specified in SHOREWALL_SHELL does not exist or is not executable; falling back to /bin/sh" >&2
@@ -145,29 +141,33 @@ get_config() {
validate_restorefile RESTOREFILE
export RESTOREFILE
[ -n "${VERBOSITY:=2}" ]
[ -n "$USE_VERBOSITY" ] && VERBOSE=$USE_VERBOSITY || VERBOSE=$(($VERBOSE_OFFSET + $VERBOSITY))
[ -n "$g_use_verbosity" ] && VERBOSITY=$g_use_verbosity || VERBOSITY=$(($g_verbose_offset + $VERBOSITY))
export VERBOSE
g_hostname=$(hostname 2> /dev/null)
[ -n "${HOSTNAME:=$(hostname)}" ]
IP=$(mywhich ip 2> /dev/null)
if [ -z "$IP" ] ; then
echo " ERROR: Can't find ip executable" >&2
exit 2
fi
IPSET=ipset
TC=tc
}
#
# Verify that we have a compiled firewall script
#
verify_firewall_script() {
if [ ! -f $FIREWALL ]; then
if [ ! -f $g_firewall ]; then
echo " ERROR: Shorewall6 Lite is not properly installed" >&2
if [ -L $FIREWALL ]; then
echo " $FIREWALL is a symbolic link to a" >&2
if [ -L $g_firewall ]; then
echo " $g_firewall is a symbolic link to a" >&2
echo " non-existant file" >&2
else
echo " The file $FIREWALL does not exist" >&2
echo " The file $g_firewall does not exist" >&2
fi
exit 2
@@ -187,7 +187,7 @@ start_command() {
[ -n "$nolock" ] || mutex_on
if [ -x ${LITEDIR}/firewall ]; then
${LITEDIR}/firewall $debugging start
run_it ${LITEDIR}/firewall $debugging start
rc=$?
else
error_message "${LITEDIR}/firewall is missing or is not executable"
@@ -219,12 +219,12 @@ start_command() {
option=
;;
f*)
FAST=Yes
g_fast=Yes
option=${option#f}
;;
p*)
[ -n "$(which conntrack)" ] || fatal_error "The '-p' option requires the conntrack utility which does not appear to be installed on this system"
PURGE=Yes
g_purge=Yes
option=${option%p}
;;
*)
@@ -244,40 +244,24 @@ start_command() {
0)
;;
*)
usage 1
;;
usage 1 ;;
esac
export NOROUTES
if [ -n "$FAST" ]; then
if [ -n "$g_fast" ]; then
if qt mywhich make; then
#
# RESTOREFILE is exported by get_config()
#
make -qf ${CONFDIR}/Makefile || FAST=
export RESTOREFILE
make -qf ${CONFDIR}/Makefile || g_fast=
fi
if [ -n "$FAST" ]; then
if [ -n "$g_fast" ]; then
RESTOREPATH=${VARDIR}/$RESTOREFILE
if [ -x $RESTOREPATH ]; then
if [ -x ${RESTOREPATH}-ipsets ]; then
echo Restoring Ipsets...
#
# We must purge iptables to be sure that there are no
# references to ipsets
#
iptables -F
iptables -X
$SHOREWALL_SHELL ${RESTOREPATH}-ipsets
fi
g_restorepath=${VARDIR}/$RESTOREFILE
if [ -x $g_restorepath ]; then
echo Restoring Shorewall6 Lite...
$SHOREWALL_SHELL $RESTOREPATH restore
run_it $g_restorepath restore
date > ${VARDIR}/restarted
progress_message3 Shorewall6 Lite restored from $RESTOREPATH
progress_message3 Shorewall6 Lite restored from $g_restorepath
else
do_it
fi
@@ -313,12 +297,12 @@ restart_command() {
option=
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
p*)
[ -n "$(which conntrack)" ] || fatal_error "The '-p' option requires the conntrack utility which does not appear to be installed on this system"
PURGE=Yes
g_purge=Yes
option=${option%p}
;;
*)
@@ -342,12 +326,10 @@ restart_command() {
;;
esac
export NOROUTES
[ -n "$nolock" ] || mutex_on
if [ -x ${LITEDIR}/firewall ]; then
$SHOREWALL_SHELL ${LITEDIR}/firewall $debugging restart
run_it ${LITEDIR}/firewall $debugging restart
rc=$?
else
error_message "${LITEDIR}/firewall is missing or is not executable"
@@ -372,27 +354,74 @@ usage() # $1 = exit status
echo " dump [ -x ]"
echo " forget [ <file name> ]"
echo " help"
echo " hits [ -t ]"
echo " ipcalc { <address>/<vlsm> | <address> <netmask> }"
echo " ipdecimal { <address> | <integer> }"
echo " iprange <address>-<address>"
echo " load [ -s ] [ -c ] [ -r <root user> ] [ <directory> ] <system>"
echo " logdrop <address> ..."
echo " logreject <address> ..."
echo " logwatch [<refresh interval>]"
echo " refresh [ <chain>... ]"
echo " reject <address> ..."
echo " reset"
echo " restart [ -n ] [ -p ]"
echo " reset [ <chain> ... ]"
echo " restart [ -n ] [ -f ]"
echo " restore [ -n ] [ <file name> ]"
echo " save [ <file name> ]"
echo " show [ -x ] [ -m ] [ -f ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]|capabilities|classifiers|config|connections|filters|ip|log|mangle|nat|routing|tc|vardir|zones} ]"
echo " start [ -f ] [ -n ] [ -p ]"
echo " show [ -x ] [ -m ] [-f] [ -t {filter|mangle} ] [ {chain [<chain> [ <chain> ... ]capabilities|classifiers|config|connections|filters|ip|log [<regex>]|macros|mangle|nat|policies|raw|routing|tc|vardir|zones} ]"
echo " start [ -f ] [ <directory> ]"
echo " stop"
echo " status"
echo " version"
echo " version [ -a ]"
echo
exit $1
}
version_command() {
local finished
finished=0
local all
all=
local product
while [ $finished -eq 0 -a $# -gt 0 ]; do
option=$1
case $option in
-*)
option=${option#-}
while [ -n "$option" ]; do
case $option in
-)
finished=1
option=
;;
a*)
all=Yes
option=${option#a}
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
[ $# -gt 0 ] && usage 1
echo $SHOREWALL_VERSION
if [ -n "$all" ]; then
for product in shorewall shorewall6 shorewall-lite shorewall-init; do
if [ -f /usr/share/$product/version ]; then
echo "$product: $(cat /usr/share/$product/version)"
fi
done
fi
}
#
# Execution begins here
#
@@ -410,14 +439,14 @@ if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
shift
fi
IPT_OPTIONS="-nv"
FAST=
VERBOSE_OFFSET=0
USE_VERBOSITY=
NOROUTES=
EXPORT=
export TIMESTAMP=
noroutes=
g_ipt_options="-nv"
g_fast=
g_verbose_offset=0
g_use_verbosity=
g_noroutes=
g_timestamp=
g_recovering=
g_purge=
finished=0
@@ -436,48 +465,48 @@ while [ $finished -eq 0 ]; do
while [ -n "$option" ]; do
case $option in
x*)
IPT_OPTIONS="-xnv"
g_ipt_options="-xnv"
option=${option#x}
;;
q*)
VERBOSE_OFFSET=$(($VERBOSE_OFFSET - 1 ))
g_verbose_offset=$(($g_verbose_offset - 1 ))
option=${option#q}
;;
f*)
FAST=Yes
g_fast=Yes
option=${option#f}
;;
v*)
option=${option#v}
case $option in
-1*)
USE_VERBOSITY=-1
g_use_verbosity=-1
option=${option#-1}
;;
0*)
USE_VERBOSITY=0
g_use_verbosity=0
option=${option#0}
;;
1*)
USE_VERBOSITY=1
g_use_verbosity=1
option=${option#1}
;;
2*)
USE_VERBOSITY=2
g_use_verbosity=2
option=${option#2}
;;
*)
VERBOSE_OFFSET=$(($VERBOSE_OFFSET + 1 ))
USE_VERBOSITY=
g_verbose_offset=$(($g_verbose_offset + 1 ))
g_use_verbosity=
;;
esac
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
t*)
TIMESTAMP=Yes
g_timestamp=Yes
option=${option#t}
;;
-)
@@ -502,12 +531,11 @@ if [ $# -eq 0 ]; then
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
export PATH
MUTEX_TIMEOUT=
SHAREDIR=/usr/share/shorewall6-lite
CONFDIR=/etc/shorewall6-lite
export PRODUCT="Shorewall6 Lite"
g_product="Shorewall6 Lite"
[ -f ${CONFDIR}/vardir ] && . ${CONFDIR}/vardir ]
@@ -515,17 +543,10 @@ export PRODUCT="Shorewall6 Lite"
[ -d $VARDIR ] || mkdir -p $VARDIR || fatal_error "Unable to create $VARDIR"
LIBRARIES="$SHAREDIR/lib.base $SHAREDIR/lib.cli"
VERSION_FILE=$SHAREDIR/version
HELP=$SHAREDIR/help
version_file=$SHAREDIR/version
for library in $LIBRARIES; do
if [ -f $library ]; then
. $library
else
echo "Installation error: $library does not exist!" >&2
exit 2
fi
for library in base cli; do
. ${SHAREDIR}/lib.$library
done
ensure_config_path
@@ -545,7 +566,6 @@ else
fi
ensure_config_path
export CONFIG_PATH
LITEDIR=${VARDIR}
@@ -553,17 +573,17 @@ LITEDIR=${VARDIR}
get_config
FIREWALL=$LITEDIR/firewall
g_firewall=$LITEDIR/firewall
if [ -f $VERSION_FILE ]; then
version=$(cat $VERSION_FILE)
if [ -f $version_file ]; then
SHOREWALL_VERSION=$(cat $version_file)
else
echo " ERROR: Shorewall6 Lite is not properly installed" >&2
echo " The file $VERSION_FILE does not exist" >&2
echo " The file $SHOREWALL_VERSION_FILE does not exist" >&2
exit 1
fi
banner="Shorewall6 Lite $version Status at $HOSTNAME -"
banner="Shorewall6 Lite $SHOREWALL_VERSION Status at $g_hostname -"
case $(echo -e) in
-e*)
@@ -595,8 +615,7 @@ case "$COMMAND" in
stop|reset|clear)
[ $# -ne 1 ] && usage 1
verify_firewall_script
export NOROUTES
exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock $COMMAND
run_it $g_firewall $debugging $nolock $COMMAND
;;
restart)
shift
@@ -609,7 +628,7 @@ case "$COMMAND" in
status)
[ $# -eq 1 ] || usage 1
[ "$(id -u)" != 0 ] && fatal_error "ERROR: The status command may only be run by root"
echo "Shorewall6 Lite $version Status at $HOSTNAME - $(date)"
echo "Shorewall6 Lite $SHOREWALL_VERSION Status at $g_hostname - $(date)"
echo
if shorewall6_is_started ; then
echo "Shorewall6 Lite is running"
@@ -622,7 +641,7 @@ case "$COMMAND" in
if [ -f ${VARDIR}/state ]; then
state="$(cat ${VARDIR}/state)"
case $state in
Stopped*|Clear*)
Stopped*|Closed*|Clear*)
status=3
;;
esac
@@ -643,7 +662,8 @@ case "$COMMAND" in
hits_command $@
;;
version)
echo $version Lite
shift
version_command $@
;;
logwatch)
logwatch_command $@
@@ -702,7 +722,7 @@ case "$COMMAND" in
;;
esac
RESTOREPATH=${VARDIR}/$RESTOREFILE
g_restorepath=${VARDIR}/$RESTOREFILE
[ "$nolock" ] || mutex_on
@@ -724,20 +744,20 @@ case "$COMMAND" in
esac
RESTOREPATH=${VARDIR}/$RESTOREFILE
g_restorepath=${VARDIR}/$RESTOREFILE
if [ -x $RESTOREPATH ]; then
if [ -x $g_restorepath ]; then
if [ -x ${RESTOREPATH}-ipsets ]; then
rm -f ${RESTOREPATH}-ipsets
echo " ${RESTOREPATH}-ipsets removed"
if [ -x ${g_restorepath}-ipsets ]; then
rm -f ${g_restorepath}-ipsets
echo " ${g_restorepath}-ipsets removed"
fi
rm -f $RESTOREPATH
rm -f ${RESTOREPATH}-iptables
echo " $RESTOREPATH removed"
elif [ -f $RESTOREPATH ]; then
echo " $RESTOREPATH exists and is not a saved Shorewall6 configuration"
rm -f $g_restorepath
rm -f ${g_restorepath}-iptables
echo " $g_restorepath removed"
elif [ -f $g_restorepath ]; then
echo " $g_restorepath exists and is not a saved Shorewall6 configuration"
fi
rm -f ${VARDIR}/save
;;

View File

@@ -1,15 +1,14 @@
###############################################################################
# /etc/shorewall6-lite/shorewall-lite.conf Version 4 - Change the following
# /etc/shorewall6-lite/shorewall6-lite.conf Version 4 - Change the following
# variables to override the values in the shorewall.conf file used to
# compile /var/lib/shorewall-lite/firewall. Those values may be found in
# /var/lib/shorewall-lite/firewall.conf.
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# This file should be placed in /etc/shorewall-lite
#
# (c) 2006,2007,2008 - Tom Eastep (teastep@shorewall.net)
# For information about the settings in this file, type
# "man shorewall6-lite.conf"
#
# Manpage also online at
# http://www.shorewall.net/manpages6/shorewall6-lite.conf.html.
###############################################################################
# N 0 T E
###############################################################################

View File

@@ -1,6 +1,6 @@
%define name shorewall6-lite
%define version 4.4.5
%define release 1
%define version 4.4.10
%define release 0base
Summary: Shoreline Firewall 6 Lite is an ip6tables-based firewall for Linux systems.
Name: %{name}
@@ -14,6 +14,7 @@ URL: http://www.shorewall.net/
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: iptables iproute
Provides: shoreline_firewall = %{version}-%{release}
%description
@@ -31,7 +32,7 @@ administrators to centralize the configuration of Shorewall6-based firewalls.
%build
%install
export PREFIX=$RPM_BUILD_ROOT ; \
export DESTDIR=$RPM_BUILD_ROOT ; \
export OWNER=`id -n -u` ; \
export GROUP=`id -n -g` ;\
./install.sh
@@ -79,6 +80,7 @@ fi
%attr(- ,root,root) /usr/share/shorewall6-lite/functions
%attr(0644,root,root) /usr/share/shorewall6-lite/lib.base
%attr(0644,root,root) /usr/share/shorewall6-lite/lib.cli
%attr(0644,root,root) /usr/share/shorewall6-lite/lib.common
%attr(0644,root,root) /usr/share/shorewall6-lite/modules
%attr(0544,root,root) /usr/share/shorewall6-lite/shorecap
%attr(0755,root,root) /usr/share/shorewall6-lite/wait4ifup
@@ -91,9 +93,69 @@ fi
%doc COPYING changelog.txt releasenotes.txt
%changelog
* Sat Dec 19 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.5-1
* Fri Nov 27 2009 Tom Eastep tom@shorewall.net
* Tue Jun 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Mon Jun 07 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC3
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta4
* Tue May 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta3
* Thu May 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta2
* Thu May 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta2
* Thu May 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0Beta1
* Mon May 03 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0base
* Sun May 02 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0RC2
* Sun Apr 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0RC1
* Sat Apr 24 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta5
* Fri Apr 16 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta4
* Fri Apr 09 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta3
* Thu Apr 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta2
* Sat Mar 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.9-0Beta1
* Fri Mar 19 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0base
* Tue Mar 16 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0RC2
* Mon Mar 08 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0RC1
* Sun Feb 28 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0Beta2
* Thu Feb 11 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.8-0Beta1
* Fri Feb 05 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0base
* Tue Feb 02 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0RC2
* Wed Jan 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0RC1
* Mon Jan 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta4
* Fri Jan 22 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta3
* Fri Jan 22 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta2
* Sun Jan 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.7-0Beta1
* Wed Jan 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.6-0base
* Tue Jan 12 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.6-0Beta1
* Thu Dec 24 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.5-0base
* Sat Nov 21 2009 Tom Eastep tom@shorewall.net
- Updated to 4.4.4-0base

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2006,2007 - Tom Eastep (teastep@shorewall.net)
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.sourceforge.net
#
@@ -26,7 +26,7 @@
# You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.5.1
VERSION=4.4.10
usage() # $1 = exit status
{
@@ -67,7 +67,7 @@ if qt ip6tables -L shorewall -n && [ ! -f /sbin/shorewall6 ]; then
fi
if [ -L /usr/share/shorewall6-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall6-lite/init | sed 's/^.*> //')
FIREWALL=$(readlink -m -q /usr/share/shorewall6-lite/init)
else
FIREWALL=/etc/init.d/shorewall6-lite
fi
@@ -94,6 +94,7 @@ rm -rf /var/lib/shorewall6-lite
rm -rf /var/lib/shorewall6-lite-*.bkout
rm -rf /usr/share/shorewall6-lite
rm -rf /usr/share/shorewall6-lite-*.bkout
rm -f /etc/logrotate.d/shorewall6-lite
echo "Shorewall6 Lite Uninstalled"

View File

@@ -1 +1 @@
This is the Shorewall6 development 4.3 branch of SVN.
This is the Shorewall6 stable 4.4 branch of Git.

View File

@@ -22,7 +22,7 @@
#
# Reject 'auth'
#
Auth/REJECT
Auth(REJECT)
#
# ACCEPT critical ICMP types
#
@@ -35,7 +35,7 @@ dropInvalid
#
# Drop Microsoft noise so that it doesn't clutter up the log.
#
SMB/DROP
SMB(DROP)
#
# Drop 'newnotsyn' traffic so that it doesn't get logged.
#

View File

@@ -18,7 +18,7 @@
#
# Don't log 'auth' -- REJECT
#
Auth/REJECT
Auth(REJECT)
#
# ACCEPT critical ICMP types
#
@@ -32,7 +32,7 @@ dropInvalid
#
# Reject Microsoft noise so that it doesn't clutter up the log.
#
SMB/REJECT
SMB(REJECT)
#
# Drop 'newnotsyn' traffic so that it doesn't get logged.
#

View File

@@ -21,4 +21,16 @@ startup=0
OPTIONS=""
#
# Init Log -- if /dev/null, use the STARTUP_LOG defined in shorewall.conf
#
INITLOG=/dev/null
#
# Set this to 1 to cause '/etc/init.d/shorewall6 stop' to place the firewall in
# a safe state rather than to open it
#
SAFESTOP=0
# EOF

View File

@@ -1,104 +0,0 @@
#!/bin/sh
#
# Script to back out the installation of Shoreline Firewall 6 and to restore the previous version of
# the program
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2001,2002,2003,2004,2005,2008 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall 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.
#
# Usage:
#
# You may only use this script to back out the installation of the version
# shown below. Simply run this script to revert to your prior version of
# Shoreline Firewall.
VERSION=4.4.5.1
usage() # $1 = exit status
{
echo "usage: $(basename $0)"
exit $1
}
restore_directory() # $1 = directory to restore
{
if [ -d ${1}-${VERSION}.bkout ]; then
if mv -f $1 ${1}-${VERSION} && mv ${1}-${VERSION}.bkout $1; then
echo
echo "$1 restored"
rm -rf ${1}-${VERSION}
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
restore_file() # $1 = file to restore, $2 = (Optional) Directory to restore from
{
if [ -n "$2" ]; then
local file
file=$(basename $1)
if [ -f $2/$file ]; then
if mv -f $2/$file $1 ; then
echo
echo "$1 restored"
return
fi
echo "ERROR: Could not restore $1"
exit 1
fi
fi
if [ -f ${1}-${VERSION}.bkout -o -L ${1}-${VERSION}.bkout ]; then
if (mv -f ${1}-${VERSION}.bkout $1); then
echo
echo "$1 restored"
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
if [ ! -f /usr/share/shorewall6-${VERSION}.bkout/version ]; then
echo "Shorewall6 Version $VERSION is not installed"
exit 1
fi
echo "Backing Out Installation of Shorewall6 $VERSION"
if [ -L /usr/share/shorewall6/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall6/init | sed 's/^.*> //')
restore_file $FIREWALL /usr/share/shorewall6-${VERSION}.bkout
else
restore_file /etc/init.d/shorewall6 /usr/share/shorewall6-${VERSION}.bkout
fi
restore_file /sbin/shorewall6 /var/lib/shorewall6-${VERSION}.bkout
restore_directory /etc/shorewall6
restore_directory /usr/share/shorewall6
restore_directory /var/lib/shorewall6
echo "Shorewall6 Restored to Version $(cat /usr/share/shorewall6/version)"

36
Shorewall6/helpers Normal file
View File

@@ -0,0 +1,36 @@
#
# Shorewall6 version 4 - Helpers File
#
# /usr/share/shorewall6/helpers
#
# This file loads the modules that may be needed by the firewall.
#
# THE ORDER OF THE COMMANDS BELOW IS IMPORTANT!!!!!! You MUST load in
# dependency order. i.e., if M2 depends on M1 then you must load M1
# before you load M2.
#
# If you need to modify this file, copy it to /etc/shorewall and modify the
# copy.
#
###############################################################################
#
# Helpers
#
loadmodule nf_conntrack_amanda
loadmodule nf_conntrack_ftp
loadmodule nf_conntrack_h323
loadmodule nf_conntrack_irc
loadmodule nf_conntrack_netbios_ns
loadmodule nf_conntrack_netbios_ns
loadmodule nf_conntrack_netlink
loadmodule nf_conntrack_pptp
loadmodule nf_conntrack_proto_sctp
loadmodule nf_conntrack_proto_udplite
loadmodule nf_conntrack_sane
loadmodule nf_conntrack_sip sip_direct_media=0
loadmodule nf_conntrack_pptp
loadmodule nf_conntrack_proto_gre
loadmodule nf_conntrack_proto_sctp
loadmodule nf_conntrack_sip
loadmodule nf_conntrack_tftp
loadmodule nf_conntrack_sane

View File

@@ -1,8 +1,8 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: shorewall6
# Required-Start: $network
# Required-Stop: $network
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Configure the firewall at boot time
@@ -38,6 +38,7 @@ echo_notdone () {
echo "not done (check $INITLOG)."
fi
exit 1
}
not_configured () {
@@ -92,7 +93,11 @@ shorewall6_start () {
# stop the firewall
shorewall6_stop () {
echo -n "Stopping \"Shorewall6 firewall\": "
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
if [ "$SAFESTOP" = 1 ]; then
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
else
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
fi
return 0
}

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2008 - Tom Eastep (teastep@shorewall.net)
# (c) 2000,2001,2002,2003,2004,2005,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.net
#
@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.5.1
VERSION=4.4.10
usage() # $1 = exit status
{
@@ -85,12 +85,13 @@ install_file() # $1 = source $2 = target $3 = mode
run_install $OWNERSHIP -m $3 $1 ${2}
}
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
#
# Parse the run line
#
# DEST is the SysVInit script directory
# INIT is the name of the script in the $DEST directory
# RUNLEVELS is the chkconfig parmeters for firewall
# ARGS is "yes" if we've already parsed an argument
#
ARGS=""
@@ -103,17 +104,16 @@ if [ -z "$INIT" ] ; then
INIT="shorewall6"
fi
if [ -z "$RUNLEVELS" ] ; then
RUNLEVELS=""
fi
DEBIAN=
CYGWIN=
MAC=
MANDIR=${MANDIR:-"/usr/share/man"}
SPARSE=
INSTALLD='-D'
case $(uname) in
CYGWIN*)
if [ -z "$PREFIX" ]; then
if [ -z "$DESTDIR" ]; then
DEST=
INIT=
fi
@@ -121,7 +121,20 @@ case $(uname) in
OWNER=$(id -un)
GROUP=$(id -gn)
CYGWIN=Yes
SPARSE=Yes
;;
Darwin)
if [ -z "$DESTDIR" ]; then
DEST=
INIT=
SPARSE=Yes
fi
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=wheel
MAC=Yes
INSTALLD=
;;
*)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
@@ -139,6 +152,9 @@ while [ $# -gt 0 ] ; do
echo "Shorewall6 Firewall Installer Version $VERSION"
exit 0
;;
-s)
SPARSE=Yes
;;
*)
usage 1
;;
@@ -153,7 +169,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
# Determine where to install the firewall script
#
if [ -n "$PREFIX" ]; then
if [ -n "$DESTDIR" ]; then
if [ -z "$CYGWIN" ]; then
if [ `id -u` != 0 ] ; then
echo "Not setting file owner/group permissions, not running as root."
@@ -161,21 +177,30 @@ if [ -n "$PREFIX" ]; then
fi
fi
install -d $OWNERSHIP -m 755 ${PREFIX}/sbin
install -d $OWNERSHIP -m 755 ${PREFIX}${DEST}
install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
CYGWIN=
MAC=
else
[ -x /usr/share/shorewall/compiler.pl ] || \
{ echo " ERROR: Shorewall >= 4.3.5 is not installed" >&2; exit 1; }
if [ -z "$CYGWIN" ]; then
if [ -n "$CYGWIN" ]; then
echo "Installing Cygwin-specific configuration..."
elif [ -n "$MAC" ]; then
echo "Installing Mac-specific configuration..."
else
if [ -d /etc/apt -a -e /usr/bin/dpkg ]; then
echo "Installing Debian-specific configuration..."
DEBIAN=yes
SPARSE=yes
elif [ -f /etc/slackware-version ] ; then
echo "Installing Slackware-specific configuration..."
DEST="/etc/rc.d"
SLACKWARE=yes
INIT="rc.firewall"
elif [ -f /etc/arch-release ] ; then
echo "Installing ArchLinux-specific configuration..."
DEST="/etc/rc.d"
INIT="shorewall6"
ARCHLINUX=yes
@@ -191,20 +216,20 @@ cd "$(dirname $0)"
echo "Installing Shorewall6 Version $VERSION"
#
# Check for /etc/shorewall6
# Check for /sbin/shorewall6
#
if [ -d ${PREFIX}/etc/shorewall6 ]; then
if [ -f ${DESTDIR}/sbin/shorewall6 ]; then
first_install=""
else
first_install="Yes"
fi
if [ -z "$CYGWIN" ]; then
install_file shorewall6 ${PREFIX}/sbin/shorewall6 0755 ${PREFIX}/var/lib/shorewall6-${VERSION}.bkout
echo "shorewall6 control program installed in ${PREFIX}/sbin/shorewall6"
install_file shorewall6 ${DESTDIR}/sbin/shorewall6 0755 ${DESTDIR}/var/lib/shorewall6-${VERSION}.bkout
echo "shorewall6 control program installed in ${DESTDIR}/sbin/shorewall6"
else
install_file shorewall6 ${PREFIX}/bin/shorewall6 0755 ${PREFIX}/var/lib/shorewall6-${VERSION}.bkout
echo "shorewall6 control program installed in ${PREFIX}/bin/shorewall6"
install_file shorewall6 ${DESTDIR}/bin/shorewall6 0755 ${DESTDIR}/var/lib/shorewall6-${VERSION}.bkout
echo "shorewall6 control program installed in ${DESTDIR}/bin/shorewall6"
fi
@@ -212,416 +237,451 @@ fi
# Install the Firewall Script
#
if [ -n "$DEBIAN" ]; then
install_file init.debian.sh /etc/init.d/shorewall6 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
install_file init.debian.sh /etc/init.d/shorewall6 0544 ${DESTDIR}/usr/share/shorewall6-${VERSION}.bkout
elif [ -n "$SLACKWARE" ]; then
install_file init.slackware.shorewall6.sh ${PREFIX}${DEST}/rc.shorewall6 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
install_file init.slackware.shorewall6.sh ${DESTDIR}${DEST}/rc.shorewall6 0544 ${DESTDIR}/usr/share/shorewall6-${VERSION}.bkout
elif [ -n "$ARCHLINUX" ]; then
install_file init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544 ${DESTDIR}/usr/share/shorewall6-${VERSION}.bkout
elif [ -n "$INIT" ]; then
install_file init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
install_file init.sh ${DESTDIR}${DEST}/$INIT 0544 ${DESTDIR}/usr/share/shorewall6-${VERSION}.bkout
fi
[ -n "$CYGWIN" ] || echo "Shorewall6 script installed in ${PREFIX}${DEST}/$INIT"
[ -n "$INIT" ] && echo "Shorewall6 script installed in ${DESTDIR}${DEST}/$INIT"
#
# Create /etc/shorewall, /usr/share/shorewall and /var/shorewall if needed
#
mkdir -p ${PREFIX}/etc/shorewall6
mkdir -p ${PREFIX}/usr/share/shorewall6
mkdir -p ${PREFIX}/usr/share/shorewall6/configfiles
mkdir -p ${PREFIX}/var/lib/shorewall6
mkdir -p ${DESTDIR}/etc/shorewall6
mkdir -p ${DESTDIR}/usr/share/shorewall6
mkdir -p ${DESTDIR}/usr/share/shorewall6/configfiles
mkdir -p ${DESTDIR}/var/lib/shorewall6
chmod 755 ${PREFIX}/etc/shorewall6
chmod 755 ${PREFIX}/usr/share/shorewall6
chmod 755 ${PREFIX}/usr/share/shorewall6/configfiles
chmod 755 ${DESTDIR}/etc/shorewall6
chmod 755 ${DESTDIR}/usr/share/shorewall6
chmod 755 ${DESTDIR}/usr/share/shorewall6/configfiles
if [ -n "$PREFIX" ]; then
mkdir -p ${PREFIX}/etc/logrotate.d
chmod 755 ${PREFIX}/etc/logrotate.d
if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}/etc/logrotate.d
chmod 755 ${DESTDIR}/etc/logrotate.d
fi
#
# Install the config file
#
run_install $OWNERSHIP -m 0644 shorewall6.conf ${PREFIX}/usr/share/shorewall6/configfiles/shorewall6.conf
run_install $OWNERSHIP -m 0644 shorewall6.conf ${DESTDIR}/usr/share/shorewall6/configfiles/shorewall6.conf
qt mywhich perl && perl -p -w -i -e 's|^CONFIG_PATH=.*|CONFIG_PATH=/usr/share/shorewall6/configfiles:/usr/share/shorewall6|;' ${PREFIX}/usr/share/shorewall6/configfiles/shorewall6.conf
perl -p -w -i -e 's|^CONFIG_PATH=.*|CONFIG_PATH=/usr/share/shorewall6/configfiles:/usr/share/shorewall6|;' ${DESTDIR}/usr/share/shorewall6/configfiles/shorewall6.conf
perl -p -w -i -e 's|^STARTUP_LOG=.*|STARTUP_LOG=/var/log/shorewall6-lite-init.log|;' ${DESTDIR}/usr/share/shorewall6/configfiles/shorewall6.conf
if [ ! -f ${PREFIX}/etc/shorewall6/shorewall6.conf ]; then
run_install $OWNERSHIP -m 0644 shorewall6.conf ${PREFIX}/etc/shorewall6/shorewall6.conf
echo "Config file installed as ${PREFIX}/etc/shorewall6/shorewall6.conf"
if [ ! -f ${DESTDIR}/etc/shorewall6/shorewall6.conf ]; then
run_install $OWNERSHIP -m 0644 shorewall6.conf ${DESTDIR}/etc/shorewall6/shorewall6.conf
if [ -n "$DEBIAN" ] && mywhich perl; then
#
# Make a Debian-like shorewall6.conf
#
perl -p -w -i -e 's|^STARTUP_ENABLED=.*|STARTUP_ENABLED=Yes|;' ${DESTDIR}/etc/shorewall6/shorewall6.conf
fi
echo "Config file installed as ${DESTDIR}/etc/shorewall6/shorewall6.conf"
fi
if [ -n "$ARCHLINUX" ] ; then
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${PREFIX}/etc/shorewall6/shorewall6.conf
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${DESTDIR}/etc/shorewall6/shorewall6.conf
fi
#
# Install the zones file
#
run_install $OWNERSHIP -m 0644 zones ${PREFIX}/usr/share/shorewall6/configfiles/zones
run_install $OWNERSHIP -m 0644 zones ${DESTDIR}/usr/share/shorewall6/configfiles/zones
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/zones ]; then
run_install $OWNERSHIP -m 0744 zones ${PREFIX}/etc/shorewall6/zones
echo "Zones file installed as ${PREFIX}/etc/shorewall6/zones"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/zones ]; then
run_install $OWNERSHIP -m 0744 zones ${DESTDIR}/etc/shorewall6/zones
echo "Zones file installed as ${DESTDIR}/etc/shorewall6/zones"
fi
delete_file ${PREFIX}/usr/share/shorewall6/compiler
delete_file ${PREFIX}/usr/share/shorewall6/lib.accounting
delete_file ${PREFIX}/usr/share/shorewall6/lib.actions
delete_file ${PREFIX}/usr/share/shorewall6/lib.dynamiczones
delete_file ${PREFIX}/usr/share/shorewall6/lib.maclist
delete_file ${PREFIX}/usr/share/shorewall6/lib.nat
delete_file ${PREFIX}/usr/share/shorewall6/lib.providers
delete_file ${PREFIX}/usr/share/shorewall6/lib.proxyarp
delete_file ${PREFIX}/usr/share/shorewall6/lib.tc
delete_file ${PREFIX}/usr/share/shorewall6/lib.tcrules
delete_file ${PREFIX}/usr/share/shorewall6/lib.tunnels
delete_file ${PREFIX}/usr/share/shorewall6/prog.header
delete_file ${PREFIX}/usr/share/shorewall6/prog.footer
delete_file ${DESTDIR}/usr/share/shorewall6/compiler
delete_file ${DESTDIR}/usr/share/shorewall6/lib.accounting
delete_file ${DESTDIR}/usr/share/shorewall6/lib.actions
delete_file ${DESTDIR}/usr/share/shorewall6/lib.dynamiczones
delete_file ${DESTDIR}/usr/share/shorewall6/lib.maclist
delete_file ${DESTDIR}/usr/share/shorewall6/lib.nat
delete_file ${DESTDIR}/usr/share/shorewall6/lib.providers
delete_file ${DESTDIR}/usr/share/shorewall6/lib.proxyarp
delete_file ${DESTDIR}/usr/share/shorewall6/lib.tc
delete_file ${DESTDIR}/usr/share/shorewall6/lib.tcrules
delete_file ${DESTDIR}/usr/share/shorewall6/lib.tunnels
delete_file ${DESTDIR}/usr/share/shorewall6/prog.header
delete_file ${DESTDIR}/usr/share/shorewall6/prog.footer
#
# Install wait4ifup
#
install_file wait4ifup ${PREFIX}/usr/share/shorewall6/wait4ifup 0755
install_file wait4ifup ${DESTDIR}/usr/share/shorewall6/wait4ifup 0755
echo
echo "wait4ifup installed in ${PREFIX}/usr/share/shorewall6/wait4ifup"
echo "wait4ifup installed in ${DESTDIR}/usr/share/shorewall6/wait4ifup"
#
# Install the policy file
#
run_install $OWNERSHIP -m 0644 policy ${PREFIX}/usr/share/shorewall6/configfiles/policy
run_install $OWNERSHIP -m 0644 policy ${DESTDIR}/usr/share/shorewall6/configfiles/policy
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/policy ]; then
run_install $OWNERSHIP -m 0600 policy ${PREFIX}/etc/shorewall6/policy
echo "Policy file installed as ${PREFIX}/etc/shorewall6/policy"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/policy ]; then
run_install $OWNERSHIP -m 0600 policy ${DESTDIR}/etc/shorewall6/policy
echo "Policy file installed as ${DESTDIR}/etc/shorewall6/policy"
fi
#
# Install the interfaces file
#
run_install $OWNERSHIP -m 0644 interfaces ${PREFIX}/usr/share/shorewall6/configfiles/interfaces
run_install $OWNERSHIP -m 0644 interfaces ${DESTDIR}/usr/share/shorewall6/configfiles/interfaces
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/interfaces ]; then
run_install $OWNERSHIP -m 0600 interfaces ${PREFIX}/etc/shorewall6/interfaces
echo "Interfaces file installed as ${PREFIX}/etc/shorewall6/interfaces"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/interfaces ]; then
run_install $OWNERSHIP -m 0600 interfaces ${DESTDIR}/etc/shorewall6/interfaces
echo "Interfaces file installed as ${DESTDIR}/etc/shorewall6/interfaces"
fi
#
# Install the hosts file
#
run_install $OWNERSHIP -m 0644 hosts ${PREFIX}/usr/share/shorewall6/configfiles/hosts
run_install $OWNERSHIP -m 0644 hosts ${DESTDIR}/usr/share/shorewall6/configfiles/hosts
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/hosts ]; then
run_install $OWNERSHIP -m 0600 hosts ${PREFIX}/etc/shorewall6/hosts
echo "Hosts file installed as ${PREFIX}/etc/shorewall6/hosts"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/hosts ]; then
run_install $OWNERSHIP -m 0600 hosts ${DESTDIR}/etc/shorewall6/hosts
echo "Hosts file installed as ${DESTDIR}/etc/shorewall6/hosts"
fi
#
# Install the rules file
#
run_install $OWNERSHIP -m 0644 rules ${PREFIX}/usr/share/shorewall6/configfiles/rules
run_install $OWNERSHIP -m 0644 rules ${DESTDIR}/usr/share/shorewall6/configfiles/rules
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/rules ]; then
run_install $OWNERSHIP -m 0600 rules ${PREFIX}/etc/shorewall6/rules
echo "Rules file installed as ${PREFIX}/etc/shorewall6/rules"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/rules ]; then
run_install $OWNERSHIP -m 0600 rules ${DESTDIR}/etc/shorewall6/rules
echo "Rules file installed as ${DESTDIR}/etc/shorewall6/rules"
fi
#
# Install the Parameters file
#
run_install $OWNERSHIP -m 0644 params ${PREFIX}/usr/share/shorewall6/configfiles/params
run_install $OWNERSHIP -m 0644 params ${DESTDIR}/usr/share/shorewall6/configfiles/params
if [ -f ${PREFIX}/etc/shorewall6/params ]; then
chmod 0644 ${PREFIX}/etc/shorewall6/params
if [ -f ${DESTDIR}/etc/shorewall6/params ]; then
chmod 0644 ${DESTDIR}/etc/shorewall6/params
else
run_install $OWNERSHIP -m 0644 params ${PREFIX}/etc/shorewall6/params
echo "Parameter file installed as ${PREFIX}/etc/shorewall6/params"
run_install $OWNERSHIP -m 0644 params ${DESTDIR}/etc/shorewall6/params
echo "Parameter file installed as ${DESTDIR}/etc/shorewall6/params"
fi
#
# Install the Stopped Routing file
#
run_install $OWNERSHIP -m 0644 routestopped ${PREFIX}/usr/share/shorewall6/configfiles/routestopped
run_install $OWNERSHIP -m 0644 routestopped ${DESTDIR}/usr/share/shorewall6/configfiles/routestopped
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/routestopped ]; then
run_install $OWNERSHIP -m 0600 routestopped ${PREFIX}/etc/shorewall6/routestopped
echo "Stopped Routing file installed as ${PREFIX}/etc/shorewall6/routestopped"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/routestopped ]; then
run_install $OWNERSHIP -m 0600 routestopped ${DESTDIR}/etc/shorewall6/routestopped
echo "Stopped Routing file installed as ${DESTDIR}/etc/shorewall6/routestopped"
fi
#
# Install the Mac List file
#
run_install $OWNERSHIP -m 0644 maclist ${PREFIX}/usr/share/shorewall6/configfiles/maclist
run_install $OWNERSHIP -m 0644 maclist ${DESTDIR}/usr/share/shorewall6/configfiles/maclist
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/maclist ]; then
run_install $OWNERSHIP -m 0600 maclist ${PREFIX}/etc/shorewall6/maclist
echo "MAC list file installed as ${PREFIX}/etc/shorewall6/maclist"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/maclist ]; then
run_install $OWNERSHIP -m 0600 maclist ${DESTDIR}/etc/shorewall6/maclist
echo "MAC list file installed as ${DESTDIR}/etc/shorewall6/maclist"
fi
#
# Install the Modules file
#
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall6/modules
echo "Modules file installed as ${PREFIX}/usr/share/shorewall6/modules"
run_install $OWNERSHIP -m 0600 modules ${DESTDIR}/usr/share/shorewall6/modules
echo "Modules file installed as ${DESTDIR}/usr/share/shorewall6/modules"
#
# Install the Module Helpers file
#
run_install $OWNERSHIP -m 0600 helpers ${DESTDIR}/usr/share/shorewall6/helpers
echo "Helper modules file installed as ${DESTDIR}/usr/share/shorewall6/helpers"
#
# Install the TC Rules file
#
run_install $OWNERSHIP -m 0644 tcrules ${PREFIX}/usr/share/shorewall6/configfiles/tcrules
run_install $OWNERSHIP -m 0644 tcrules ${DESTDIR}/usr/share/shorewall6/configfiles/tcrules
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/tcrules ]; then
run_install $OWNERSHIP -m 0600 tcrules ${PREFIX}/etc/shorewall6/tcrules
echo "TC Rules file installed as ${PREFIX}/etc/shorewall6/tcrules"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/tcrules ]; then
run_install $OWNERSHIP -m 0600 tcrules ${DESTDIR}/etc/shorewall6/tcrules
echo "TC Rules file installed as ${DESTDIR}/etc/shorewall6/tcrules"
fi
#
# Install the TC Interfaces file
#
run_install $OWNERSHIP -m 0644 tcinterfaces ${DESTDIR}/usr/share/shorewall6/configfiles/tcinterfaces
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/tcinterfaces ]; then
run_install $OWNERSHIP -m 0600 tcinterfaces ${DESTDIR}/etc/shorewall6/tcinterfaces
echo "TC Interfaces file installed as ${DESTDIR}/etc/shorewall6/tcinterfaces"
fi
#
# Install the TC Priority file
#
run_install $OWNERSHIP -m 0644 tcpri ${DESTDIR}/usr/share/shorewall6/configfiles/tcpri
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/tcpri ]; then
run_install $OWNERSHIP -m 0600 tcpri ${DESTDIR}/etc/shorewall6/tcpri
echo "TC Priority file installed as ${DESTDIR}/etc/shorewall6/tcpri"
fi
#
# Install the TOS file
#
run_install $OWNERSHIP -m 0644 tos ${PREFIX}/usr/share/shorewall6/configfiles/tos
run_install $OWNERSHIP -m 0644 tos ${DESTDIR}/usr/share/shorewall6/configfiles/tos
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/tos ]; then
run_install $OWNERSHIP -m 0600 tos ${PREFIX}/etc/shorewall6/tos
echo "TOS file installed as ${PREFIX}/etc/shorewall6/tos"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/tos ]; then
run_install $OWNERSHIP -m 0600 tos ${DESTDIR}/etc/shorewall6/tos
echo "TOS file installed as ${DESTDIR}/etc/shorewall6/tos"
fi
#
# Install the Tunnels file
#
run_install $OWNERSHIP -m 0644 tunnels ${PREFIX}/usr/share/shorewall6/configfiles/tunnels
run_install $OWNERSHIP -m 0644 tunnels ${DESTDIR}/usr/share/shorewall6/configfiles/tunnels
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/tunnels ]; then
run_install $OWNERSHIP -m 0600 tunnels ${PREFIX}/etc/shorewall6/tunnels
echo "Tunnels file installed as ${PREFIX}/etc/shorewall6/tunnels"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/tunnels ]; then
run_install $OWNERSHIP -m 0600 tunnels ${DESTDIR}/etc/shorewall6/tunnels
echo "Tunnels file installed as ${DESTDIR}/etc/shorewall6/tunnels"
fi
#
# Install the blacklist file
#
run_install $OWNERSHIP -m 0644 blacklist ${PREFIX}/usr/share/shorewall6/configfiles/blacklist
run_install $OWNERSHIP -m 0644 blacklist ${DESTDIR}/usr/share/shorewall6/configfiles/blacklist
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/blacklist ]; then
run_install $OWNERSHIP -m 0600 blacklist ${PREFIX}/etc/shorewall6/blacklist
echo "Blacklist file installed as ${PREFIX}/etc/shorewall6/blacklist"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/blacklist ]; then
run_install $OWNERSHIP -m 0600 blacklist ${DESTDIR}/etc/shorewall6/blacklist
echo "Blacklist file installed as ${DESTDIR}/etc/shorewall6/blacklist"
fi
#
# Install the Providers file
#
run_install $OWNERSHIP -m 0644 providers ${PREFIX}/usr/share/shorewall6/configfiles/providers
run_install $OWNERSHIP -m 0644 providers ${DESTDIR}/usr/share/shorewall6/configfiles/providers
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/providers ]; then
run_install $OWNERSHIP -m 0600 providers ${PREFIX}/etc/shorewall6/providers
echo "Providers file installed as ${PREFIX}/etc/shorewall6/providers"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/providers ]; then
run_install $OWNERSHIP -m 0600 providers ${DESTDIR}/etc/shorewall6/providers
echo "Providers file installed as ${DESTDIR}/etc/shorewall6/providers"
fi
#
# Install the Route Rules file
#
run_install $OWNERSHIP -m 0644 route_rules ${PREFIX}/usr/share/shorewall6/configfiles/route_rules
run_install $OWNERSHIP -m 0644 route_rules ${DESTDIR}/usr/share/shorewall6/configfiles/route_rules
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/route_rules ]; then
run_install $OWNERSHIP -m 0600 route_rules ${PREFIX}/etc/shorewall6/route_rules
echo "Routing rules file installed as ${PREFIX}/etc/shorewall6/route_rules"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/route_rules ]; then
run_install $OWNERSHIP -m 0600 route_rules ${DESTDIR}/etc/shorewall6/route_rules
echo "Routing rules file installed as ${DESTDIR}/etc/shorewall6/route_rules"
fi
#
# Install the tcclasses file
#
run_install $OWNERSHIP -m 0644 tcclasses ${PREFIX}/usr/share/shorewall6/configfiles/tcclasses
run_install $OWNERSHIP -m 0644 tcclasses ${DESTDIR}/usr/share/shorewall6/configfiles/tcclasses
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/tcclasses ]; then
run_install $OWNERSHIP -m 0600 tcclasses ${PREFIX}/etc/shorewall6/tcclasses
echo "TC Classes file installed as ${PREFIX}/etc/shorewall6/tcclasses"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/tcclasses ]; then
run_install $OWNERSHIP -m 0600 tcclasses ${DESTDIR}/etc/shorewall6/tcclasses
echo "TC Classes file installed as ${DESTDIR}/etc/shorewall6/tcclasses"
fi
#
# Install the tcdevices file
#
run_install $OWNERSHIP -m 0644 tcdevices ${PREFIX}/usr/share/shorewall6/configfiles/tcdevices
run_install $OWNERSHIP -m 0644 tcdevices ${DESTDIR}/usr/share/shorewall6/configfiles/tcdevices
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/tcdevices ]; then
run_install $OWNERSHIP -m 0600 tcdevices ${PREFIX}/etc/shorewall6/tcdevices
echo "TC Devices file installed as ${PREFIX}/etc/shorewall6/tcdevices"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/tcdevices ]; then
run_install $OWNERSHIP -m 0600 tcdevices ${DESTDIR}/etc/shorewall6/tcdevices
echo "TC Devices file installed as ${DESTDIR}/etc/shorewall6/tcdevices"
fi
#
# Install the Notrack file
#
run_install $OWNERSHIP -m 0644 notrack ${PREFIX}/usr/share/shorewall6/configfiles/notrack
run_install $OWNERSHIP -m 0644 notrack ${DESTDIR}/usr/share/shorewall6/configfiles/notrack
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/notrack ]; then
run_install $OWNERSHIP -m 0600 notrack ${PREFIX}/etc/shorewall6/notrack
echo "Notrack file installed as ${PREFIX}/etc/shorewall6/notrack"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/notrack ]; then
run_install $OWNERSHIP -m 0600 notrack ${DESTDIR}/etc/shorewall6/notrack
echo "Notrack file installed as ${DESTDIR}/etc/shorewall6/notrack"
fi
#
# Install the default config path file
#
install_file configpath ${PREFIX}/usr/share/shorewall6/configpath 0644
echo "Default config path file installed as ${PREFIX}/usr/share/shorewall6/configpath"
install_file configpath ${DESTDIR}/usr/share/shorewall6/configpath 0644
echo "Default config path file installed as ${DESTDIR}/usr/share/shorewall6/configpath"
#
# Install the init file
#
run_install $OWNERSHIP -m 0644 init ${PREFIX}/usr/share/shorewall6/configfiles/init
run_install $OWNERSHIP -m 0644 init ${DESTDIR}/usr/share/shorewall6/configfiles/init
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/init ]; then
run_install $OWNERSHIP -m 0600 init ${PREFIX}/etc/shorewall6/init
echo "Init file installed as ${PREFIX}/etc/shorewall6/init"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/init ]; then
run_install $OWNERSHIP -m 0600 init ${DESTDIR}/etc/shorewall6/init
echo "Init file installed as ${DESTDIR}/etc/shorewall6/init"
fi
#
# Install the start file
#
run_install $OWNERSHIP -m 0644 start ${PREFIX}/usr/share/shorewall6/configfiles/start
run_install $OWNERSHIP -m 0644 start ${DESTDIR}/usr/share/shorewall6/configfiles/start
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/start ]; then
run_install $OWNERSHIP -m 0600 start ${PREFIX}/etc/shorewall6/start
echo "Start file installed as ${PREFIX}/etc/shorewall6/start"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/start ]; then
run_install $OWNERSHIP -m 0600 start ${DESTDIR}/etc/shorewall6/start
echo "Start file installed as ${DESTDIR}/etc/shorewall6/start"
fi
#
# Install the stop file
#
run_install $OWNERSHIP -m 0644 stop ${PREFIX}/usr/share/shorewall6/configfiles/stop
run_install $OWNERSHIP -m 0644 stop ${DESTDIR}/usr/share/shorewall6/configfiles/stop
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/stop ]; then
run_install $OWNERSHIP -m 0600 stop ${PREFIX}/etc/shorewall6/stop
echo "Stop file installed as ${PREFIX}/etc/shorewall6/stop"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/stop ]; then
run_install $OWNERSHIP -m 0600 stop ${DESTDIR}/etc/shorewall6/stop
echo "Stop file installed as ${DESTDIR}/etc/shorewall6/stop"
fi
#
# Install the stopped file
#
run_install $OWNERSHIP -m 0644 stopped ${PREFIX}/usr/share/shorewall6/configfiles/stopped
run_install $OWNERSHIP -m 0644 stopped ${DESTDIR}/usr/share/shorewall6/configfiles/stopped
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/stopped ]; then
run_install $OWNERSHIP -m 0600 stopped ${PREFIX}/etc/shorewall6/stopped
echo "Stopped file installed as ${PREFIX}/etc/shorewall6/stopped"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/stopped ]; then
run_install $OWNERSHIP -m 0600 stopped ${DESTDIR}/etc/shorewall6/stopped
echo "Stopped file installed as ${DESTDIR}/etc/shorewall6/stopped"
fi
#
# Install the Accounting file
#
run_install $OWNERSHIP -m 0644 accounting ${PREFIX}/usr/share/shorewall6/configfiles/accounting
run_install $OWNERSHIP -m 0644 accounting ${DESTDIR}/usr/share/shorewall6/configfiles/accounting
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/accounting ]; then
run_install $OWNERSHIP -m 0600 accounting ${PREFIX}/etc/shorewall6/accounting
echo "Accounting file installed as ${PREFIX}/etc/shorewall6/accounting"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/accounting ]; then
run_install $OWNERSHIP -m 0600 accounting ${DESTDIR}/etc/shorewall6/accounting
echo "Accounting file installed as ${DESTDIR}/etc/shorewall6/accounting"
fi
#
# Install the Started file
#
run_install $OWNERSHIP -m 0644 started ${PREFIX}/usr/share/shorewall6/configfiles/started
run_install $OWNERSHIP -m 0644 started ${DESTDIR}/usr/share/shorewall6/configfiles/started
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/started ]; then
run_install $OWNERSHIP -m 0600 started ${PREFIX}/etc/shorewall6/started
echo "Started file installed as ${PREFIX}/etc/shorewall6/started"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/started ]; then
run_install $OWNERSHIP -m 0600 started ${DESTDIR}/etc/shorewall6/started
echo "Started file installed as ${DESTDIR}/etc/shorewall6/started"
fi
#
# Install the Restored file
#
run_install $OWNERSHIP -m 0644 restored ${PREFIX}/usr/share/shorewall6/configfiles/restored
run_install $OWNERSHIP -m 0644 restored ${DESTDIR}/usr/share/shorewall6/configfiles/restored
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/restored ]; then
run_install $OWNERSHIP -m 0600 restored ${PREFIX}/etc/shorewall6/restored
echo "Restored file installed as ${PREFIX}/etc/shorewall6/restored"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/restored ]; then
run_install $OWNERSHIP -m 0600 restored ${DESTDIR}/etc/shorewall6/restored
echo "Restored file installed as ${DESTDIR}/etc/shorewall6/restored"
fi
#
# Install the Clear file
#
run_install $OWNERSHIP -m 0644 clear ${PREFIX}/usr/share/shorewall6/configfiles/clear
run_install $OWNERSHIP -m 0644 clear ${DESTDIR}/usr/share/shorewall6/configfiles/clear
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/clear ]; then
run_install $OWNERSHIP -m 0600 clear ${PREFIX}/etc/shorewall6/clear
echo "Clear file installed as ${PREFIX}/etc/shorewall6/clear"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/clear ]; then
run_install $OWNERSHIP -m 0600 clear ${DESTDIR}/etc/shorewall6/clear
echo "Clear file installed as ${DESTDIR}/etc/shorewall6/clear"
fi
#
# Install the Isusable file
#
run_install $OWNERSHIP -m 0644 isusable ${PREFIX}/usr/share/shorewall6/configfiles/isusable
run_install $OWNERSHIP -m 0644 isusable ${DESTDIR}/usr/share/shorewall6/configfiles/isusable
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/isusable ]; then
run_install $OWNERSHIP -m 0600 isusable ${PREFIX}/etc/shorewall6/isusable
echo "Isusable file installed as ${PREFIX}/etc/shorewall/isusable"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/isusable ]; then
run_install $OWNERSHIP -m 0600 isusable ${DESTDIR}/etc/shorewall6/isusable
echo "Isusable file installed as ${DESTDIR}/etc/shorewall/isusable"
fi
#
# Install the Refresh file
#
run_install $OWNERSHIP -m 0644 refresh ${PREFIX}/usr/share/shorewall6/configfiles/refresh
run_install $OWNERSHIP -m 0644 refresh ${DESTDIR}/usr/share/shorewall6/configfiles/refresh
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/refresh ]; then
run_install $OWNERSHIP -m 0600 refresh ${PREFIX}/etc/shorewall6/refresh
echo "Refresh file installed as ${PREFIX}/etc/shorewall6/refresh"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/refresh ]; then
run_install $OWNERSHIP -m 0600 refresh ${DESTDIR}/etc/shorewall6/refresh
echo "Refresh file installed as ${DESTDIR}/etc/shorewall6/refresh"
fi
#
# Install the Refreshed file
#
run_install $OWNERSHIP -m 0644 refreshed ${PREFIX}/usr/share/shorewall6/configfiles/refreshed
run_install $OWNERSHIP -m 0644 refreshed ${DESTDIR}/usr/share/shorewall6/configfiles/refreshed
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/refreshed ]; then
run_install $OWNERSHIP -m 0600 refreshed ${PREFIX}/etc/shorewall6/refreshed
echo "Refreshed file installed as ${PREFIX}/etc/shorewall6/refreshed"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/refreshed ]; then
run_install $OWNERSHIP -m 0600 refreshed ${DESTDIR}/etc/shorewall6/refreshed
echo "Refreshed file installed as ${DESTDIR}/etc/shorewall6/refreshed"
fi
#
# Install the Tcclear file
#
run_install $OWNERSHIP -m 0644 tcclear ${PREFIX}/usr/share/shorewall6/configfiles/tcclear
run_install $OWNERSHIP -m 0644 tcclear ${DESTDIR}/usr/share/shorewall6/configfiles/tcclear
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/tcclear ]; then
run_install $OWNERSHIP -m 0600 tcclear ${PREFIX}/etc/shorewall6/tcclear
echo "Tcclear file installed as ${PREFIX}/etc/shorewall6/tcclear"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/tcclear ]; then
run_install $OWNERSHIP -m 0600 tcclear ${DESTDIR}/etc/shorewall6/tcclear
echo "Tcclear file installed as ${DESTDIR}/etc/shorewall6/tcclear"
fi
#
# Install the Standard Actions file
#
install_file actions.std ${PREFIX}/usr/share/shorewall6/actions.std 0644
echo "Standard actions file installed as ${PREFIX}/usr/shared/shorewall6/actions.std"
install_file actions.std ${DESTDIR}/usr/share/shorewall6/actions.std 0644
echo "Standard actions file installed as ${DESTDIR}/usr/shared/shorewall6/actions.std"
#
# Install the Actions file
#
run_install $OWNERSHIP -m 0644 actions ${PREFIX}/usr/share/shorewall6/configfiles/actions
run_install $OWNERSHIP -m 0644 actions ${DESTDIR}/usr/share/shorewall6/configfiles/actions
if [ -z "$CYGWIN" -a ! -f ${PREFIX}/etc/shorewall6/actions ]; then
run_install $OWNERSHIP -m 0644 actions ${PREFIX}/etc/shorewall6/actions
echo "Actions file installed as ${PREFIX}/etc/shorewall6/actions"
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/actions ]; then
run_install $OWNERSHIP -m 0644 actions ${DESTDIR}/etc/shorewall6/actions
echo "Actions file installed as ${DESTDIR}/etc/shorewall6/actions"
fi
#
# Install the Makefiles
#
run_install $OWNERSHIP -m 0644 Makefile-lite ${PREFIX}/usr/share/shorewall6/configfiles/Makefile
run_install $OWNERSHIP -m 0644 Makefile-lite ${DESTDIR}/usr/share/shorewall6/configfiles/Makefile
if [ -z "$CYGWIN" ]; then
run_install $OWNERSHIP -m 0600 Makefile ${PREFIX}/etc/shorewall6/Makefile
echo "Makefile installed as ${PREFIX}/etc/shorewall6/Makefile"
if [ -z "$SPARSE" ]; then
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}/etc/shorewall6/Makefile
echo "Makefile installed as ${DESTDIR}/etc/shorewall6/Makefile"
fi
#
# Install the Action files
#
for f in action.* ; do
install_file $f ${PREFIX}/usr/share/shorewall6/$f 0644
echo "Action ${f#*.} file installed as ${PREFIX}/usr/share/shorewall6/$f"
install_file $f ${DESTDIR}/usr/share/shorewall6/$f 0644
echo "Action ${f#*.} file installed as ${DESTDIR}/usr/share/shorewall6/$f"
done
# Install the Macro files
#
for f in macro.* ; do
install_file $f ${PREFIX}/usr/share/shorewall6/$f 0644
echo "Macro ${f#*.} file installed as ${PREFIX}/usr/share/shorewall6/$f"
install_file $f ${DESTDIR}/usr/share/shorewall6/$f 0644
echo "Macro ${f#*.} file installed as ${DESTDIR}/usr/share/shorewall6/$f"
done
#
# Install the libraries
#
for f in lib.* ; do
if [ -f $f ]; then
install_file $f ${PREFIX}/usr/share/shorewall6/$f 0644
echo "Library ${f#*.} file installed as ${PREFIX}/usr/share/shorewall6/$f"
install_file $f ${DESTDIR}/usr/share/shorewall6/$f 0644
echo "Library ${f#*.} file installed as ${DESTDIR}/usr/share/shorewall6/$f"
fi
done
#
# Symbolically link 'functions' to lib.base
#
ln -sf lib.base ${PREFIX}/usr/share/shorewall6/functions
ln -sf lib.base ${DESTDIR}/usr/share/shorewall6/functions
#
# Create the version file
#
echo "$VERSION" > ${PREFIX}/usr/share/shorewall6/version
chmod 644 ${PREFIX}/usr/share/shorewall6/version
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall6/version
chmod 644 ${DESTDIR}/usr/share/shorewall6/version
#
# Remove and create the symbolic link to the init script
#
if [ -z "$PREFIX" ]; then
if [ -z "$DESTDIR" ]; then
rm -f /usr/share/shorewall6/init
ln -s ${DEST}/${INIT} /usr/share/shorewall6/init
fi
@@ -632,35 +692,37 @@ fi
cd manpages
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${MANDIR}/man5/ ${DESTDIR}${MANDIR}/man8/
for f in *.5; do
gzip -c $f > $f.gz
run_install -D -m 0644 $f.gz ${PREFIX}${MANDIR}/man5/$f.gz
echo "Man page $f.gz installed to ${PREFIX}${MANDIR}/man5/$f.gz"
run_install $INSTALLD -m 0644 $f.gz ${DESTDIR}${MANDIR}/man5/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man5/$f.gz"
done
for f in *.8; do
gzip -c $f > $f.gz
run_install -D -m 0644 $f.gz ${PREFIX}${MANDIR}/man8/$f.gz
echo "Man page $f.gz installed to ${PREFIX}${MANDIR}/man8/$f.gz"
run_install $INSTALLD -m 0644 $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
done
cd ..
echo "Man Pages Installed"
if [ -d ${PREFIX}/etc/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${PREFIX}/etc/logrotate.d/shorewall6
echo "Logrotate file installed as ${PREFIX}/etc/logrotate.d/shorewall6"
if [ -d ${DESTDIR}/etc/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}/etc/logrotate.d/shorewall6
echo "Logrotate file installed as ${DESTDIR}/etc/logrotate.d/shorewall6"
fi
if [ -z "$PREFIX" -a -n "$first_install" -a -z "$CYGWIN" ]; then
if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then
if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall6
ln -s ../init.d/shorewall6 /etc/rcS.d/S40shorewall6
echo "shorewall6 will start automatically at boot"
echo "Set startup=1 in /etc/default/shorewall6 to enable"
touch /var/log/shorewall6-init.log
qt mywhich perl && perl -p -w -i -e 's/^STARTUP_ENABLED=No/STARTUP_ENABLED=Yes/;s/^IP_FORWARDING=On/IP_FORWARDING=Keep/;s/^SUBSYSLOCK=.*/SUBSYSLOCK=/;' /etc/shorewall6/shorewall6.conf
perl -p -w -i -e 's/^STARTUP_ENABLED=No/STARTUP_ENABLED=Yes/;s/^IP_FORWARDING=On/IP_FORWARDING=Keep/;s/^SUBSYSLOCK=.*/SUBSYSLOCK=/;' /etc/shorewall6/shorewall6.conf
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall6 ; then
@@ -693,4 +755,4 @@ fi
#
# Report Success
#
echo "shorewall6-common Version $VERSION Installed"
echo "shorewall6 Version $VERSION Installed"

File diff suppressed because it is too large Load Diff

View File

@@ -34,6 +34,7 @@ fatal_error() # $@ = Message
exit 2
}
#
# Display a chain if it exists
#
@@ -132,13 +133,22 @@ syslog_circular_buffer() {
#
packet_log() # $1 = number of messages
{
if [ -n "$SHOWMACS" -o $VERBOSE -gt 2 ]; then
$LOGREAD | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
else
$LOGREAD | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
fi
}
search_log() # $1 = IP address to search for
{
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
else
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
fi
}
#
# Show traffic control information
#
@@ -158,9 +168,13 @@ show_tc() {
fi
}
ip -o link list | while read inx interface details; do
show_one_tc ${interface%:}
done
if [ $# -gt 0 ]; then
show_one_tc $1
else
ip -o link list | while read inx interface details; do
show_one_tc ${interface%:}
done
fi
}
@@ -194,7 +208,7 @@ logwatch() # $1 = timeout -- if negative, prompt each time that
# an 'interesting' packet count changes
{
host=$(echo $HOSTNAME | sed 's/\..*$//')
host=$(echo $g_hostname | sed 's/\..*$//')
oldrejects=$($IP6TABLES -L -v -n | grep 'LOG')
if [ $1 -lt 0 ]; then
@@ -222,13 +236,13 @@ logwatch() # $1 = timeout -- if negative, prompt each time that
if [ "$rejects" != "$oldrejects" ]; then
oldrejects="$rejects"
$RING_BELL
$g_ring_bell
packet_log 40
if [ "$pause" = "Yes" ]; then
echo
echo $ECHO_N 'Enter any character to continue: '
echo $g_echo_n 'Enter any character to continue: '
read foo
else
timed_read
@@ -244,6 +258,30 @@ logwatch() # $1 = timeout -- if negative, prompt each time that
#
# Save currently running configuration
#
do_save() {
local status
status=0
if [ -f ${VARDIR}/firewall ]; then
if $iptables_save > ${VARDIR}/restore-$$; then
cp -f ${VARDIR}/firewall $g_restorepath
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables
chmod +x $g_restorepath
echo " Currently-running Configuration Saved to $g_restorepath"
run_user_exit save
else
rm -f ${VARDIR}/restore-$$
echo " ERROR: Currently-running Configuration Not Saved" >&2
status=1
fi
else
echo " ERROR: ${VARDIR}/firewall does not exist" >&2
status=1
fi
return $status
}
save_config() {
local result
@@ -256,8 +294,8 @@ save_config() {
if shorewall6_is_started ; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
if [ -f $RESTOREPATH -a ! -x $RESTOREPATH ]; then
echo " ERROR: $RESTOREPATH exists and is not a saved $PRODUCT configuration" >&2
if [ -f $g_restorepath -a ! -x $g_restorepath ]; then
echo " ERROR: $g_restorepath exists and is not a saved $g_product configuration" >&2
else
case $RESTOREFILE in
capabilities|chains|default_route|firewall|firewall.conf|nat|proxyarp|restarted|rt_tables|save|state|undo_routing|zones)
@@ -266,24 +304,15 @@ save_config() {
*)
validate_restorefile RESTOREFILE
if $IP6TABLES -L dynamic -n > ${VARDIR}/save; then
echo " Dynamic Rules Saved"
if [ -f ${VARDIR}/firewall ]; then
if $iptables_save > ${VARDIR}/restore-$$; then
cp -f ${VARDIR}/firewall $RESTOREPATH
mv -f ${VARDIR}/restore-$$ ${RESTOREPATH}-iptables
chmod +x $RESTOREPATH
echo " Currently-running Configuration Saved to $RESTOREPATH"
run_user_exit save
else
rm -f ${VARDIR}/restore-$$
echo " ERROR: Currently-running Configuration Not Saved" >&2
fi
if chain_exists dynamic; then
if $IP6TABLES -L dynamic -n > ${VARDIR}/save; then
echo " Dynamic Rules Saved"
do_save
else
echo " ERROR: ${VARDIR}/firewall does not exist" >&2
echo "Error Saving the Dynamic Rules" >&2
fi
else
echo "Error Saving the Dynamic Rules" >&2
do_save && rm -f ${VARDIR}/save
fi
;;
esac
@@ -334,7 +363,7 @@ show_command() {
if [ ${#macro} -gt 10 ]; then
echo " $macro ${foo#\#}"
else
$ECHO_E " $macro \t${foo#\#}"
$g_echo_e " $macro \t${foo#\#}"
fi
fi
}
@@ -352,19 +381,19 @@ show_command() {
option=
;;
v*)
VERBOSE=$(($VERBOSE + 1 ))
VERBOSITY=$(($VERBOSITY + 1 ))
option=${option#v}
;;
x*)
IPT_OPTIONS="-xnv"
g_ipt_options="-xnv"
option=${option#x}
;;
m*)
SHOWMACS=Yes
g_showmacs=Yes
option=${option#m}
;;
f*)
FILEMODE=Yes
g_filemode=Yes
option=${option#f}
;;
t)
@@ -384,7 +413,7 @@ show_command() {
shift
;;
l*)
IPT_OPTIONS1="--line-numbers"
g_ipt_options1="--line-numbers"
option=${option#l}
;;
*)
@@ -400,56 +429,61 @@ show_command() {
esac
done
IPT_OPTIONS="$IPT_OPTIONS $IPT_OPTIONS1"
g_ipt_options="$g_ipt_options $g_ipt_options1"
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
case "$1" in
connections)
[ $# -gt 1 ] && usage 1
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
echo "$PRODUCT $version Connections ($count of $max) at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION Connections ($count of $max) at $g_hostname - $(date)"
echo
grep '^ipv6' /proc/net/nf_conntrack
;;
tos|mangle)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Mangle Table at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION Mangle Table at $g_hostname - $(date)"
echo
show_reset
$IP6TABLES -t mangle -L $IPT_OPTIONS
$IP6TABLES -t mangle -L $g_ipt_options
;;
raw)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version raw Table at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION raw Table at $g_hostname - $(date)"
echo
show_reset
$IP6TABLES -t raw -L $IPT_OPTIONS
$IP6TABLES -t raw -L $g_ipt_options
;;
log)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Log ($LOGFILE) at $HOSTNAME - $(date)"
[ $# -gt 2 ] && usage 1
echo "$g_product $SHOREWALL_VERSION Log ($LOGFILE) at $g_hostname - $(date)"
echo
show_reset
host=$(echo $HOSTNAME | sed 's/\..*$//')
packet_log 20
host=$(echo $g_hostname | sed 's/\..*$//')
if [ $# -eq 2 ]; then
search_log $2
else
packet_log 20
fi
;;
tc)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Traffic Control at $HOSTNAME - $(date)"
[ $# -gt 2 ] && usage 1
echo "$g_product $SHOREWALL_VERSION Traffic Control at $g_hostname - $(date)"
echo
show_tc
;;
classifiers|filters)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Classifiers at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION Classifiers at $g_hostname - $(date)"
echo
show_classifiers
;;
zones)
[ $# -gt 1 ] && usage 1
if [ -f ${VARDIR}/zones ]; then
echo "$PRODUCT $version Zones at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION Zones at $g_hostname - $(date)"
echo
while read zone type hosts; do
echo "$zone ($type)"
@@ -473,8 +507,8 @@ show_command() {
capabilities)
[ $# -gt 1 ] && usage 1
determine_capabilities
VERBOSE=2
if [ -n "$FILEMODE" ]; then
VERBOSITY=2
if [ -n "$g_filemode" ]; then
report_capabilities1
else
report_capabilities
@@ -482,13 +516,13 @@ show_command() {
;;
ip)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version IP at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION IP at $g_hostname - $(date)"
echo
ip -6 addr list
;;
routing)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Routing at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION Routing at $g_hostname - $(date)"
echo
show_routing
;;
@@ -499,15 +533,15 @@ show_command() {
;;
chain)
shift
echo "$PRODUCT $version $([ $# -gt 1 ] && echo "Chains " || [ $# -gt 0 ] && echo "Chain " || echo $table Table)$* at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION $([ $# -gt 1 ] && echo "Chains " || [ $# -gt 0 ] && echo "Chain " || echo $table Table)$* at $g_hostname - $(date)"
echo
show_reset
if [ $# -gt 0 ]; then
for chain in $*; do
$IP6TABLES -t $table -L $chain $IPT_OPTIONS
$IP6TABLES -t $table -L $chain $g_ipt_options
done
else
$IP6TABLES -t $table -L $IPT_OPTIONS
$IP6TABLES -t $table -L $g_ipt_options
fi
;;
vardir)
@@ -515,12 +549,12 @@ show_command() {
;;
policies)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Policies at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION Policies at $g_hostname - $(date)"
echo
[ -f ${VARDIR}/policies ] && cat ${VARDIR}/policies;
;;
*)
if [ "$PRODUCT" = Shorewall6 ]; then
if [ "$g_product" = Shorewall6 ]; then
case $1 in
actions)
[ $# -gt 1 ] && usage 1
@@ -567,23 +601,23 @@ show_command() {
if [ $# -gt 0 ]; then
[ -n "$table_given" ] || for chain in $*; do
if ! qt $IP6TABLES -t $table -L $chain $IPT_OPTIONS; then
echo "usage $(basename $0) show [ -x ] [ -m ] [-f] [ -t {filter|mangle} ] [ {chain [<chain> [ <chain> ... ]|actions|capabilities|classifiers|config|connections|filters|ip|log|macros|mangle|routing|tc|zones} ] " >&2
if ! qt $IP6TABLES -t $table -L $chain $g_ipt_options; then
error_message "ERROR: Chain '$chain' is not recognized by $IP6TABLES."
exit 1
fi
done
echo "$PRODUCT $version $([ $# -gt 1 ] && echo "Chains " || echo "Chain ")$* at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION $([ $# -gt 1 ] && echo "Chains " || echo "Chain ")$* at $g_hostname - $(date)"
echo
show_reset
for chain in $*; do
$IP6TABLES -t $table -L $chain $IPT_OPTIONS
$IP6TABLES -t $table -L $chain $g_ipt_options
done
else
echo "$PRODUCT $version $table Table at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION $table Table at $g_hostname - $(date)"
echo
show_reset
$IP6TABLES -t $table -L $IPT_OPTIONS
$IP6TABLES -t $table -L $g_ipt_options
fi
;;
esac
@@ -609,15 +643,15 @@ dump_command() {
option=
;;
x*)
IPT_OPTIONS="-xnv"
g_ipt_options="-xnv"
option=${option#x}
;;
m*)
SHOWMACS=Yes
g_showmacs=Yes
option=${option#m}
;;
l*)
IPT_OPTIONS1="--line-numbers"
g_ipt_options1="--line-numbers"
option=${option#l}
;;
*)
@@ -633,14 +667,14 @@ dump_command() {
esac
done
IPT_OPTIONS="$IPT_OPTIONS $IPT_OPTIONS1"
g_ipt_options="$g_ipt_options $g_ipt_options1"
[ $VERBOSE -lt 2 ] && VERBOSE=2
[ $VERBOSITY -lt 2 ] && VERBOSITY=2
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
[ $# -eq 0 ] || usage 1
clear_term
echo "$PRODUCT $version Dump at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION Dump at $g_hostname - $(date)"
echo
if [ -f /usr/share/shorewall/version ]; then
@@ -649,17 +683,21 @@ dump_command() {
fi
show_reset
host=$(echo $HOSTNAME | sed 's/\..*$//')
$IP6TABLES -L $IPT_OPTIONS
host=$(echo $g_hostname | sed 's/\..*$//')
$IP6TABLES -L $g_ipt_options
heading "Log ($LOGFILE)"
packet_log 20
heading "Mangle Table"
$IP6TABLES -t mangle -L $IPT_OPTIONS
if qt $IP6TABLES -t mangle -L -n; then
heading "Mangle Table"
$IP6TABLES -t mangle -L $g_ipt_options
fi
heading "Raw Table"
$IP6TABLES -t raw -L $IPT_OPTIONS
if qt $IP6TABLES -t raw -L -n; then
heading "Raw Table"
$IP6TABLES -t raw -L $g_ipt_options
fi
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
@@ -696,8 +734,8 @@ dump_command() {
show_routing
heading "ARP"
arp -na
heading "Neighbors"
ip -6 neigh ls
if qt mywhich lsmod; then
heading "Modules"
@@ -739,7 +777,7 @@ restore_command() {
option=
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
*)
@@ -772,27 +810,25 @@ restore_command() {
exit 2
fi
RESTOREPATH=${VARDIR}/$RESTOREFILE
export NOROUTES
g_restorepath=${VARDIR}/$RESTOREFILE
[ -n "$nolock" ] || mutex_on
if [ -x $RESTOREPATH ]; then
if [ -x ${RESTOREPATH}-ipsets ] ; then
if [ -x $g_restorepath ]; then
if [ -x ${g_restorepath}-ipsets ] ; then
echo Restoring Ipsets...
$IP6TABLES -F
$IP6TABLES -X
$SHOREWALL_SHELL ${RESTOREPATH}-ipsets
$SHOREWALL_SHELL ${g_restorepath}-ipsets
fi
progress_message3 "Restoring Shorewall6..."
$SHOREWALL_SHELL $RESTOREPATH restore && progress_message3 "$PRODUCT restored from ${VARDIR}/$RESTOREFILE"
run_it $g_restorepath restore && progress_message3 "$g_product restored from ${VARDIR}/$RESTOREFILE"
[ -n "$nolock" ] || mutex_off
else
echo "File $RESTOREPATH: file not found"
echo "File $g_restorepath: file not found"
[ -n "$nolock" ] || mutex_off
exit 2
fi
@@ -850,20 +886,20 @@ heading() {
#
make_verbose() {
local v
v=$VERBOSE_OFFSET
v=$g_verbose_offset
local option
option=-
if [ -n "$USE_VERBOSITY" ]; then
echo "-v$USE_VERBOSITY"
elif [ $VERBOSE_OFFSET -gt 0 ]; then
if [ -n "$g_use_verbosity" ]; then
echo "-v$g_use_verbosity"
elif [ $g_verbose_offset -gt 0 ]; then
while [ $v -gt 0 ]; do
option="${option}v"
v=$(($v - 1))
done
echo $option
elif [ $VERBOSE_OFFSET -lt 0 ]; then
elif [ $g_verbose_offset -lt 0 ]; then
while [ $v -lt 0 ]; do
option="${option}q"
v=$(($v + 1))
@@ -883,6 +919,12 @@ block() # $1 = command, $2 = Finished, $3 - $n addresses
local finished
finished=$2
if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
[ -n "$nolock" ] || mutex_off
exit 2
fi
shift 3
while [ $# -gt 0 ]; do
@@ -949,15 +991,15 @@ hits_command() {
[ $# -eq 0 ] || usage 1
clear_term
echo "$PRODUCT $version Hits at $HOSTNAME - $(date)"
echo "$g_product $SHOREWALL_VERSION Hits at $g_hostname - $(date)"
echo
timeout=30
if $LOGREAD | grep -q "${today}IN=.* OUT=" ; then
if $g_logread | grep -q "${today}IN=.* OUT=" ; then
echo " HITS IP DATE"
echo " ---- --------------- ------"
$LOGREAD | grep "${today}IN=.* OUT=" | sed 's/\(.\{6\}\)\(.*SRC=\)\(.*\)\( DST=.*\)/\3 \1/' | sort | uniq -c | sort -rn | while read count address month day; do
$g_logread | grep "${today}IN=.* OUT=" | sed 's/\(.\{6\}\)\(.*SRC=\)\(.*\)\( DST=.*\)/\3 \1/' | sort | uniq -c | sort -rn | while read count address month day; do
printf '%7d %-15s %3s %2d\n' $count $address $month $day
done
@@ -965,7 +1007,7 @@ hits_command() {
echo " HITS IP PORT"
echo " ---- --------------- -----"
$LOGREAD | grep "${today}IN=.* OUT=" | sed 's/\(.*SRC=\)\(.*\)\( DST=.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2 \4/
$g_logread | grep "${today}IN=.* OUT=" | sed 's/\(.*SRC=\)\(.*\)\( DST=.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2 \4/
t
s/\(.*SRC=\)\(.*\)\( DST=.*\)/\2/' | sort | uniq -c | sort -rn | while read count address port; do
printf '%7d %-15s %d\n' $count $address $port
@@ -975,7 +1017,7 @@ hits_command() {
echo " HITS DATE"
echo " ---- ------"
$LOGREAD | grep "${today}IN=.* OUT=" | sed 's/\(.\{6\}\)\(.*\)/\1/' | sort | uniq -c | sort -rn | while read count month day; do
$g_logread | grep "${today}IN=.* OUT=" | sed 's/\(.\{6\}\)\(.*\)/\1/' | sort | uniq -c | sort -rn | while read count month day; do
printf '%7d %3s %2d\n' $count $month $day
done
@@ -983,7 +1025,7 @@ hits_command() {
echo " HITS PORT SERVICE(S)"
echo " ---- ----- ----------"
$LOGREAD | grep "${today}IN=.* OUT=.*DPT" | sed 's/\(.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2/' | sort | uniq -c | sort -rn | while read count port ; do
$g_logread | grep "${today}IN=.* OUT=.*DPT" | sed 's/\(.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2/' | sort | uniq -c | sort -rn | while read count port ; do
# List all services defined for the given port
srv=$(grep "^[^#].*\\b$port/" /etc/services | cut -f 1 | cut -f 1 -d' ' | sort -u)
srv=$(echo $srv | sed 's/ /,/g')
@@ -1001,9 +1043,14 @@ hits_command() {
# 'allow' command executor
#
allow_command() {
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && usage 1
if shorewall6_is_started ; then
if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
exit 2
fi
[ -n "$nolock" ] || mutex_on
while [ $# -gt 1 ]; do
shift
@@ -1034,7 +1081,7 @@ allow_command() {
done
[ -n "$nolock" ] || mutex_off
else
error_message "ERROR: $PRODUCT is not started"
error_message "ERROR: $g_product is not started"
exit 2
fi
}
@@ -1058,15 +1105,15 @@ logwatch_command() {
while [ -n "$option" ]; do
case $option in
v*)
VERBOSE=$(($VERBOSE + 1 ))
VERBOSITY=$(($VERBOSITY + 1 ))
option=${option#v}
;;
q*)
VERBOSE=$(($VERBOSE - 1 ))
VERBOSITY=$(($VERBOSITY - 1 ))
option=${option#q}
;;
m*)
SHOWMACS=Yes
g_showmacs=Yes
option=${option#m}
;;
-)
@@ -1086,7 +1133,7 @@ logwatch_command() {
esac
done
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
if [ $# -eq 1 ]; then
logwatch $1
@@ -1096,3 +1143,321 @@ logwatch_command() {
usage 1
fi
}
#
# Determine which optional facilities are supported by iptables/netfilter
#
determine_capabilities() {
CONNTRACK_MATCH=
NEW_CONNTRACK_MATCH=
OLD_CONNTRACK_MATCH=
MULTIPORT=
XMULTIPORT=
POLICY_MATCH=
PHYSDEV_MATCH=
PHYSDEV_BRIDGE=
IPRANGE_MATCH=
RECENT_MATCH=
OWNER_MATCH=
IPSET_MATCH=
CONNMARK=
XCONNMARK=
CONNMARK_MATCH=
XCONNMARK_MATCH=
RAW_TABLE=
IPP2P_MATCH=
OLD_IPP2P_MATCH=
LENGTH_MATCH=
CLASSIFY_TARGET=
ENHANCED_REJECT=
USEPKTTYPE=
KLUDGEFREE=
MARK=
XMARK=
EXMARK=
TPROXY_TARGET=
MANGLE_FORWARD=
COMMENTS=
ADDRTYPE=
TCPMSS_MATCH=
HASHLIMIT_MATCH=
NFQUEUE_TARGET=
REALM_MATCH=
HELPER_MATCH=
CONNLIMIT_MATCH=
TIME_MATCH=
GOTO_TARGET=
IPMARK_TARGET=
LOG_TARGET=Yes
FLOW_FILTER=
chain=fooX$$
[ -n "$IP6TABLES" ] || IP6TABLES=$(mywhich ip6tables)
if [ -z "$IP6TABLES" ]; then
echo " ERROR: No executable iptables binary can be found on your PATH" >&2
exit 1
fi
[ -n "$IP" ] || IP=$(which ip)
[ -n "$IP" -a -x "$IP" ] || IP=
qt $IP6TABLES -t mangle -L -n && MANGLE_ENABLED=Yes || MANGLE_ENABLED=
qt $IP6TABLES -F $chain
qt $IP6TABLES -X $chain
if ! $IP6TABLES -N $chain; then
echo " ERROR: The command \"$IP6TABLES -N $chain\" failed" >&2
exit 1
fi
chain1=${chain}1
qt $IP6TABLES -F $chain1
qt $IP6TABLES -X $chain1
if ! $IP6TABLES -N $chain1; then
echo " ERROR: The command \"$IP6TABLES -N $chain1\" failed" >&2
exit 1
fi
if ! qt $IP6TABLES -A $chain -m state --state ESTABLISHED,RELATED -j ACCEPT &&
! qt $IP6TABLES -A $chain -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT; then
echo " ERROR: Your kernel lacks connection tracking and/or state matching -- Shorewall will not run on this system" >&2
exit 1
fi
qt $IP6TABLES -A $chain -m conntrack --ctorigdst ::1 -j ACCEPT && CONNTRACK_MATCH=Yes
if [ -n "$CONNTRACK_MATCH" ]; then
qt $IP6TABLES -A $chain -m conntrack -p tcp --ctorigdstport 22 -j ACCEPT && NEW_CONNTRACK_MATCH=Yes
qt $IP6TABLES -A $chain -m conntrack ! --ctorigdst ::1 || OLD_CONNTRACK_MATCH=Yes
fi
if qt $IP6TABLES -A $chain -p tcp -m multiport --dports 21,22 -j ACCEPT; then
MULTIPORT=Yes
qt $IP6TABLES -A $chain -p tcp -m multiport --sports 60 -m multiport --dports 99 -j ACCEPT && KLUDEFREE=Yes
fi
qt $IP6TABLES -A $chain -p tcp -m multiport --dports 21:22 -j ACCEPT && XMULTIPORT=Yes
qt $IP6TABLES -A $chain -m policy --pol ipsec --mode tunnel --dir in -j ACCEPT && POLICY_MATCH=Yes
if qt $IP6TABLES -A $chain -m physdev --physdev-out eth0 -j ACCEPT; then
PHYSDEV_MATCH=Yes
qt $IP6TABLES -A $chain -m physdev --physdev-is-bridged --physdev-in eth0 --physdev-out eth0 -j ACCEPT && PHYSDEV_BRIDGE=Yes
if [ -z "${KLUDGEFREE}" ]; then
qt $IP6TABLES -A $chain -m physdev --physdev-in eth0 -m physdev --physdev-out eth0 -j ACCEPT && KLUDGEFREE=Yes
fi
fi
if qt $IP6TABLES -A $chain -m iprange --src-range ::1-::2 -j ACCEPT; then
IPRANGE_MATCH=Yes
if [ -z "${KLUDGEFREE}" ]; then
qt $IP6TABLES -A $chain -m iprange --src-range ::1-::2 -m iprange --dst-range ::1-::2 -j ACCEPT && KLUDGEFREE=Yes
fi
fi
qt $IP6TABLES -A $chain -m recent --update -j ACCEPT && RECENT_MATCH=Yes
qt $IP6TABLES -A $chain -m owner --uid-owner 0 -j ACCEPT && OWNER_MATCH=Yes
if qt $IP6TABLES -A $chain -m connmark --mark 2 -j ACCEPT; then
CONNMARK_MATCH=Yes
qt $IP6TABLES -A $chain -m connmark --mark 2/0xFF -j ACCEPT && XCONNMARK_MATCH=Yes
fi
qt $IP6TABLES -A $chain -p tcp -m ipp2p --edk -j ACCEPT && IPP2P_MATCH=Yes
if [ -n "$IPP2P_MATCH" ]; then
qt $IP6TABLES -A $chain -p tcp -m ipp2p --ipp2p -j ACCEPT && OLD_IPP2P_MATCH=Yes
fi
qt $IP6TABLES -A $chain -m length --length 10:20 -j ACCEPT && LENGTH_MATCH=Yes
qt $IP6TABLES -A $chain -j REJECT --reject-with icmp6-adm-prohibited && ENHANCED_REJECT=Yes
qt $IP6TABLES -A $chain -j ACCEPT -m comment --comment "This is a comment" && COMMENTS=Yes
if [ -n "$MANGLE_ENABLED" ]; then
qt $IP6TABLES -t mangle -N $chain
if qt $IP6TABLES -t mangle -A $chain -j MARK --set-mark 1; then
MARK=Yes
qt $IP6TABLES -t mangle -A $chain -j MARK --and-mark 0xFF && XMARK=Yes
qt $IP6TABLES -t mangle -A $chain -j MARK --set-mark 1/0xFF && EXMARK=Yes
fi
if qt $IP6TABLES -t mangle -A $chain -j CONNMARK --save-mark; then
CONNMARK=Yes
qt $IP6TABLES -t mangle -A $chain -j CONNMARK --save-mark --mask 0xFF && XCONNMARK=Yes
fi
qt $IP6TABLES -t mangle -A $chain -j CLASSIFY --set-class 1:1 && CLASSIFY_TARGET=Yes
qt $IP6TABLES -t mangle -A $chain -j IPMARK --addr src && IPMARK_TARGET=Yes
qt $IP6TABLES -t mangle -A $chain -p tcp -j TPROXY --on-port 0 --tproxy-mark 1 && TPROXY_TARGET=Yes
qt $IP6TABLES -t mangle -F $chain
qt $IP6TABLES -t mangle -X $chain
qt $IP6TABLES -t mangle -L FORWARD -n && MANGLE_FORWARD=Yes
fi
qt $IP6TABLES -t raw -L -n && RAW_TABLE=Yes
if qt mywhich ipset; then
qt ipset -X $chain # Just in case something went wrong the last time
if qt ipset -N $chain iphash ; then
if qt $IP6TABLES -A $chain -m set --set $chain src -j ACCEPT; then
qt $IP6TABLES -D $chain -m set --set $chain src -j ACCEPT
IPSET_MATCH=Yes
fi
qt ipset -X $chain
fi
fi
qt $IP6TABLES -A $chain -m pkttype --pkt-type broadcast -j ACCEPT && USEPKTTYPE=Yes
qt $IP6TABLES -A $chain -m addrtype --src-type BROADCAST -j ACCEPT && ADDRTYPE=Yes
qt $IP6TABLES -A $chain -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1000:1500 -j ACCEPT && TCPMSS_MATCH=Yes
qt $IP6TABLES -A $chain -m hashlimit --hashlimit-upto 4 --hashlimit-burst 5 --hashlimit-name $chain --hashlimit-mode dstip -j ACCEPT && HASHLIMIT_MATCH=Yes
if [ -z "$HASHLIMIT_MATCH" ]; then
qt $IP6TABLES -A $chain -m hashlimit --hashlimit 4 --hashlimit-burst 5 --hashlimit-name $chain --hashlimit-mode dstip -j ACCEPT && OLD_HL_MATCH=Yes
HASHLIMIT_MATCH=$OLD_HL_MATCH
fi
qt $IP6TABLES -A $chain -j NFQUEUE --queue-num 4 && NFQUEUE_TARGET=Yes
qt $IP6TABLES -A $chain -m realm --realm 4 && REALM_MATCH=Yes
qt $IP6TABLES -A $chain -m helper --helper "ftp" && HELPER_MATCH=Yes
qt $IP6TABLES -A $chain -m connlimit --connlimit-above 8 -j DROP && CONNLIMIT_MATCH=Yes
qt $IP6TABLES -A $chain -m time --timestart 23:00 -j DROP && TIME_MATCH=Yes
qt $IP6TABLES -A $chain -g $chain1 && GOTO_TARGET=Yes
qt $IP6TABLES -A $chain -j LOG || LOG_TARGET=
qt $IP6TABLES -F $chain
qt $IP6TABLES -X $chain
qt $IP6TABLES -F $chain1
qt $IP6TABLES -X $chain1
[ -n "$IP" ] && $IP filter add flow help 2>&1 | grep -q ^Usage && FLOW_FILTER=Yes
CAPVERSION=$SHOREWALL_CAPVERSION
KERNELVERSION=$(printf "%d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g'))
}
report_capabilities() {
report_capability() # $1 = Capability Description , $2 Capability Setting (if any)
{
local setting
setting=
[ "x$2" = "xYes" ] && setting="Available" || setting="Not available"
echo " " $1: $setting
}
if [ $VERBOSITY -gt 1 ]; then
echo "Shorewall6 has detected the following ip6tables/netfilter capabilities:"
report_capability "Packet Mangling" $MANGLE_ENABLED
report_capability "Multi-port Match" $MULTIPORT
[ -n "$MULTIPORT" ] && report_capability "Extended Multi-port Match" $XMULTIPORT
report_capability "Connection Tracking Match" $CONNTRACK_MATCH
if [ -n "$CONNTRACK_MATCH" ]; then
report_capability "Extended Connection Tracking Match Support" $NEW_CONNTRACK_MATCH
[ -n "$OLD_CONNTRACK_MATCH" ] && report_capability "Old Connection Tracking Match Syntax" $OLD_CONNTRACK_MATCH
fi
report_capability "Packet Type Match" $USEPKTTYPE
report_capability "Policy Match" $POLICY_MATCH
report_capability "Physdev Match" $PHYSDEV_MATCH
report_capability "Physdev-is-bridged Support" $PHYSDEV_BRIDGE
report_capability "Packet length Match" $LENGTH_MATCH
report_capability "IP range Match" $IPRANGE_MATCH
report_capability "Recent Match" $RECENT_MATCH
report_capability "Owner Match" $OWNER_MATCH
report_capability "Ipset Match" $IPSET_MATCH
report_capability "CONNMARK Target" $CONNMARK
[ -n "$CONNMARK" ] && report_capability "Extended CONNMARK Target" $XCONNMARK
report_capability "Connmark Match" $CONNMARK_MATCH
[ -n "$CONNMARK_MATCH" ] && report_capability "Extended Connmark Match" $XCONNMARK_MATCH
report_capability "Raw Table" $RAW_TABLE
report_capability "IPP2P Match" $IPP2P_MATCH
[ -n "$OLD_IPP2P_MATCH" ] && report_capability "Old IPP2P Match Syntax" $OLD_IPP2P_MATCH
report_capability "CLASSIFY Target" $CLASSIFY_TARGET
report_capability "Extended REJECT" $ENHANCED_REJECT
report_capability "Repeat match" $KLUDGEFREE
report_capability "MARK Target" $MARK
[ -n "$MARK" ] && report_capability "Extended MARK Target" $XMARK
[ -n "$XMARK" ] && report_capability "Extended MARK Target 2" $EXMARK
report_capability "Mangle FORWARD Chain" $MANGLE_FORWARD
report_capability "Comments" $COMMENTS
report_capability "Address Type Match" $ADDRTYPE
report_capability "TCPMSS Match" $TCPMSS_MATCH
report_capability "Hashlimit Match" $HASHLIMIT_MATCH
[ -n "$OLD_HL_MATCH" ] && report_capability "Old Hashlimit Match" $OLD_HL_MATCH
report_capability "NFQUEUE Target" $NFQUEUE_TARGET
report_capability "Realm Match" $REALM_MATCH
report_capability "Helper Match" $HELPER_MATCH
report_capability "Connlimit Match" $CONNLIMIT_MATCH
report_capability "Time Match" $TIME_MATCH
report_capability "Goto Support" $GOTO_TARGET
report_capability "IPMARK Target" $IPMARK_TARGET
report_capability "LOG Target" $LOG_TARGET
report_capability "TPROXY Target" $TPROXY_TARGET
report_capability "FLOW Classifier" $FLOW_FILTER
fi
[ -n "$PKTTYPE" ] || USEPKTTYPE=
}
report_capabilities1() {
report_capability1() # $1 = Capability
{
eval echo $1=\$$1
}
echo "#"
echo "# Shorewall6 $SHOREWALL_VERSION detected the following ip6tables/netfilter capabilities - $(date)"
echo "#"
report_capability1 MANGLE_ENABLED
report_capability1 MULTIPORT
report_capability1 XMULTIPORT
report_capability1 CONNTRACK_MATCH
report_capability1 NEW_CONNTRACK_MATCH
report_capability1 OLD_CONNTRACK_MATCH
report_capability1 USEPKTTYPE
report_capability1 POLICY_MATCH
report_capability1 PHYSDEV_MATCH
report_capability1 PHYSDEV_BRIDGE
report_capability1 LENGTH_MATCH
report_capability1 IPRANGE_MATCH
report_capability1 RECENT_MATCH
report_capability1 OWNER_MATCH
report_capability1 IPSET_MATCH
report_capability1 CONNMARK
report_capability1 XCONNMARK
report_capability1 CONNMARK_MATCH
report_capability1 XCONNMARK_MATCH
report_capability1 RAW_TABLE
report_capability1 IPP2P_MATCH
report_capability1 OLD_IPP2P_MATCH
report_capability1 CLASSIFY_TARGET
report_capability1 ENHANCED_REJECT
report_capability1 KLUDGEFREE
report_capability1 MARK
report_capability1 XMARK
report_capability1 EXMARK
report_capability1 MANGLE_FORWARD
report_capability1 COMMENTS
report_capability1 ADDRTYPE
report_capability1 TCPMSS_MATCH
report_capability1 HASHLIMIT_MATCH
report_capability1 OLD_HL_MATCH
report_capability1 NFQUEUE_TARGET
report_capability1 REALM_MATCH
report_capability1 HELPER_MATCH
report_capability1 CONNLIMIT_MATCH
report_capability1 TIME_MATCH
report_capability1 GOTO_TARGET
report_capability1 IPMARK_TARGET
report_capability1 LOG_TARGET
report_capability1 TPROXY_TARGET
report_capability1 FLOW_FILTER
echo CAPVERSION=$SHOREWALL_CAPVERSION
echo KERNELVERSION=$KERNELVERSION
}

476
Shorewall6/lib.common Normal file
View File

@@ -0,0 +1,476 @@
#!/bin/sh
#
# Shorewall 4.4 -- /usr/share/shorewall6/lib.common.
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2010 - 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.
#
# This library contains the wrapper code for running a generated script.
#
#
# Get the Shorewall version of the passed script
#
get_script_version() { # $1 = script
local temp
local version
local ifs
local digits
temp=$( $SHOREWALL_SHELL $1 version | sed 's/-.*//' )
if [ $? -ne 0 ]; then
version=0
else
ifs=$IFS
IFS=.
temp=$(echo $temp)
IFS=$ifs
digits=0
for temp in $temp; do
version=${version}$(printf '%02d' $temp)
digits=$(($digits + 1))
[ $digits -eq 3 ] && break
done
fi
echo $version
}
#
# Do required exports and create the required option string and run the passed script using
# $SHOREWALL_SHELL
#
run_it() {
local script
local options
local version
export VARDIR
script=$1
shift
version=$(get_script_version $script)
if [ $version -lt 040408 ]; then
#
# Old script that doesn't understand 4.4.8 script options
#
export RESTOREFILE=
export VERBOSITY
export NOROUTES=$g_noroutes
export PURGE=$g_purge
export TIMESTAMP=$g_timestamp
export RECOVERING=$g_recovering
if [ "$g_product" != Shorewall6 ]; then
#
# Shorewall6 Lite
#
export LOGFORMAT
export IP6TABLES
fi
else
#
# 4.4.8 or later -- no additional exports required
#
options='-'
[ -n "$g_noroutes" ] && options=${options}n
[ -n "$g_timestamp" ] && options=${options}t
[ -n "$g_purge" ] && options=${options}p
[ -n "$g_recovering" ] && options=${options}r
options="${options}V $VERBOSITY"
[ -n "$RESTOREFILE" ] && options="${options} -R $RESTOREFILE"
fi
$SHOREWALL_SHELL $script $options $@
}
#
# Message to stderr
#
error_message() # $* = Error Message
{
echo " $@" >&2
}
#
# Split a colon-separated list into a space-separated list
#
split() {
local ifs
ifs=$IFS
IFS=:
echo $*
IFS=$ifs
}
#
# Undo the effect of 'split()'
#
join()
{
local f
local o
o=
for f in $* ; do
o="${o:+$o:}$f"
done
echo $o
}
#
# Return the number of elements in a list
#
list_count() # $* = list
{
return $#
}
#
# Search a list looking for a match -- returns zero if a match found
# 1 otherwise
#
list_search() # $1 = element to search for , $2-$n = list
{
local e
e=$1
while [ $# -gt 1 ]; do
shift
[ "x$e" = "x$1" ] && return 0
done
return 1
}
#
# Suppress all output for a command
#
qt()
{
"$@" >/dev/null 2>&1
}
qt1()
{
local status
while [ 1 ]; do
"$@" >/dev/null 2>&1
status=$?
[ $status -ne 4 ] && return $status
done
}
#
# Determine if Shorewall is "running"
#
shorewall6_is_started() {
qt1 $IP6TABLES -L shorewall -n
}
#
# Echos the fully-qualified name of the calling shell program
#
my_pathname() {
cd $(dirname $0)
echo $PWD/$(basename $0)
}
#
# Source a user exit file if it exists
#
run_user_exit() # $1 = file name
{
local user_exit
user_exit=$(find_file $1)
if [ -f $user_exit ]; then
progress_message "Processing $user_exit ..."
. $user_exit
fi
}
#
# Load a Kernel Module -- assumes that the variable 'moduledirectories' contains
# a space-separated list of directories to search for
# the module and that 'moduleloader' contains the
# module loader command.
#
loadmodule() # $1 = module name, $2 - * arguments
{
local modulename
modulename=$1
local modulefile
local suffix
if ! list_search $modulename $MODULES $DONT_LOAD ; then
shift
for suffix in $MODULE_SUFFIX ; do
for directory in $moduledirectories; do
modulefile=$directory/${modulename}.${suffix}
if [ -f $modulefile ]; then
case $moduleloader in
insmod)
insmod $modulefile $*
;;
*)
modprobe $modulename $*
;;
esac
break 2
fi
done
done
fi
}
#
# Reload the Modules
#
reload_kernel_modules() {
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv6/netfilter:/lib/modules/$(uname -r)/kernel/net/netfilter:/lib/modules/$(uname -r)/kernel/net/sched
MODULES=$(lsmod | cut -d ' ' -f1)
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
[ -n "$moduledirectories" ] && while read command; do
eval $command
done
MODULESDIR=$save_modules_dir
}
#
# Load kernel modules required for Shorewall
#
load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
{
local save_modules_dir
save_modules_dir=$MODULESDIR
local directory
local moduledirectories
moduledirectories=
local moduleloader
moduleloader=modprobe
local savemoduleinfo
savemoduleinfo=${1:-Yes} # So old compiled scripts still work
if ! qt mywhich modprobe; then
moduleloader=insmod
fi
[ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
[ -z "$MODULESDIR" ] && \
MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv6/netfilter:/lib/modules/$(uname -r)/kernel/net/netfilter:/lib/modules/$(uname -r)/kernel/net/sched
for directory in $(split $MODULESDIR); do
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
[ -n "$LOAD_HELPERS_ONLY" ] && modules=$(find_file helpers) || modules=$(find_file modules)
if [ -f $modules -a -n "$moduledirectories" ]; then
MODULES=$(lsmod | cut -d ' ' -f1)
progress_message "Loading Modules..."
. $modules
if [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir
cp -f $modules ${VARDIR}/.modules
fi
elif [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
> ${VARDIR}/.modulesdir
> ${VARDIR}/.modules
fi
MODULESDIR=$save_modules_dir
}
#
# Query NetFilter about the existence of a filter chain
#
chain_exists() # $1 = chain name
{
qt1 $IP6TABLES -L $1 -n
}
#
# Find the interface with the passed MAC address
#
find_interface_by_mac() {
local mac
mac=$1
local first
local second
local rest
local dev
$IP link list | while read first second rest; do
case $first in
*:)
dev=$second
;;
*)
if [ "$second" = $mac ]; then
echo ${dev%:}
return
fi
esac
done
}
#
# Find interface address--returns the first IP address assigned to the passed
# device
#
find_first_interface_address() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$(${IP:-ip} -f inet6 addr show $1 2> /dev/null | grep 'inet6 .* global' | head -n1)
#
# If there wasn't one, bail out now
#
[ -n "$addr" ] || startup_error "Can't determine the IPv6 address of $1"
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
echo $addr | sed 's/\s*inet6 //;s/\/.*//;s/ peer.*//'
}
find_first_interface_address_if_any() # $1 = interface
{
#
# get the line of output containing the first IP address
#
addr=$(${IP:-ip} -f inet6 addr show $1 2> /dev/null | grep 'inet6 2.* global' | head -n1)
#
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line
#
[ -n "$addr" ] && echo $addr | sed 's/\s*inet6 //;s/\/.*//;s/ peer.*//' || echo ::
}
#
# Internal version of 'which'
#
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
#
# Find a File -- For relative file name, look in each ${CONFIG_PATH} then ${CONFDIR}
#
find_file()
{
local saveifs
saveifs=
local directory
case $1 in
/*)
echo $1
;;
*)
for directory in $(split $CONFIG_PATH); do
if [ -f $directory/$1 ]; then
echo $directory/$1
return
fi
done
echo ${CONFDIR}/$1
;;
esac
}
#
# Set the Shorewall state
#
set_state () # $1 = state
{
echo "$1 ($(date))" > ${VARDIR}/state
}
#
# Perform variable substitution on the passed argument and echo the result
#
expand() # $@ = contents of variable which may be the name of another variable
{
eval echo \"$@\"
}
#
# Function for including one file into another
#
INCLUDE() {
. $(find_file $(expand $@))
}
# Function to truncate a string -- It uses 'cut -b -<n>'
# rather than ${v:first:last} because light-weight shells like ash and
# dash do not support that form of expansion.
#
truncate() # $1 = length
{
cut -b -${1}
}

15
Shorewall6/macro.mDNS Normal file
View File

@@ -0,0 +1,15 @@
#
# Shorewall version 4 - Multicast DNS Macro
#
# /usr/share/shorewall6/macro.mDNS
#
# This macro handles multicast DNS traffic.
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - <ff02::fb> udp 5353
PARAM - - udp 32768: 5353
PARAM - <ff02::fb> 2
PARAM DEST SOURCE:<ff02::fb> udp 5353
PARAM DEST SOURCE:<ff02::fb> 2

View File

@@ -56,6 +56,8 @@ loadmodule xt_sctp
loadmodule xt_tcpmss
loadmodule xt_TCPMSS
loadmodule xt_time
loadmodule xt_IPMARK
loadmodule xt_TPROXY
#
# Helpers
#

View File

@@ -62,19 +62,17 @@ get_config() {
ensure_config_path
if [ -z "$EXPORT" -a "$(id -u)" = 0 ]; then
if [ -z "$g_export" -a "$(id -u)" = 0 ]; then
#
# This block is avoided for compile for export and when the user isn't root
#
export CONFIG_PATH
if [ "$3" = Yes ]; then
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
LOGREAD="logread | tac"
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
LOGREAD="tac $LOGFILE"
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
@@ -94,8 +92,6 @@ get_config() {
fi
fi
export IP6TABLES
#
# Compile by non-root needs no restore file
#
@@ -103,8 +99,6 @@ get_config() {
validate_restorefile RESTOREFILE
export RESTOREFILE
if [ "$2" = Yes ]; then
case $STARTUP_ENABLED in
No|no|NO)
@@ -132,8 +126,6 @@ get_config() {
[ -n "$LOGFORMAT" ] && LOGFORMAT="${LOGFORMAT%%%*}"
export LOGFORMAT
if [ -n "$STARTUP_LOG" ]; then
if [ -n "$LOG_VERBOSITY" ]; then
case $LOG_VERBOSITY in
@@ -178,17 +170,15 @@ get_config() {
;;
esac
[ -n "$USE_VERBOSITY" ] && VERBOSE=$USE_VERBOSITY || VERBOSE=$(($VERBOSE_OFFSET + $VERBOSITY))
[ -n "$g_use_verbosity" ] && VERBOSITY=$g_use_verbosity || VERBOSITY=$(($g_verbose_offset + $VERBOSITY))
if [ $VERBOSE -lt -1 ]; then
VERBOSE=-1
elif [ $VERBOSE -gt 2 ]; then
VERBOSE=2
if [ $VERBOSITY -lt -1 ]; then
VERBOSITY=-1
elif [ $VERBOSITY -gt 2 ]; then
VERBOSITY=2
fi
export VERBOSE
[ -n "${HOSTNAME:=$(hostname)}" ]
g_hostname=$(hostname 2> /dev/null)
[ -n "$RSH_COMMAND" ] || RSH_COMMAND='ssh ${root}@${system} ${command}'
[ -n "$RCP_COMMAND" ] || RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
@@ -220,19 +210,37 @@ get_config() {
fi
;;
esac
case $LOAD_HELPERS_ONLY in
Yes|yes)
;;
No|no)
LOAD_HELPERS_ONLY=
;;
*)
if [ -n "$LOAD_HELPERS_ONLY" ]; then
echo " ERROR: Invalid LOAD_HELPERS_ONLY setting ($LOAD_HELPERS_ONLY)" >&2
exit 1
fi
;;
esac
}
#
# Issue an error message and die
#
startup_error() {
echo " ERROR: $@" >&2
kill $$
exit 1
}
#
# Run the appropriate compiler
#
compiler() {
pc=${PERLSHAREDIR}/compiler.pl
startup_error() {
echo " ERROR: $@" >&2
exit 1
}
local command
command=$1
@@ -248,7 +256,6 @@ compiler() {
#
ensure_config_path
compiler=perl
haveparams=
case $COMMAND in
@@ -263,8 +270,8 @@ compiler() {
[ $command = exec ] || command=
debugflags="-w"
[ -n "$DEBUG" ] && debugflags='-wd'
[ -n "$PROFILE" ] && debugflags='-wd:DProf'
[ -n "$g_debug" ] && debugflags='-wd'
[ -n "$g_profile" ] && debugflags='-wd:DProf'
# Perl compiler only takes the output file as a argument
@@ -272,15 +279,16 @@ compiler() {
[ "$1" = nolock ] && shift;
shift
options="--verbose=$VERBOSE --family=6"
options="--verbose=$VERBOSITY --family=6"
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
[ -n "$LOG_VERBOSITY" ] && options="$options --log_verbosity=$LOG_VERBOSITY";
[ -n "$EXPORT" ] && options="$options --export"
[ -n "$g_export" ] && options="$options --export"
[ -n "$SHOREWALL_DIR" ] && options="$options --directory=$SHOREWALL_DIR"
[ -n "$TIMESTAMP" ] && options="$options --timestamp"
[ -n "$TEST" ] && options="$options --test"
[ "$debugging" = trace ] && options="$options --debug"
[ -n "$REFRESHCHAINS" ] && options="$options --refresh=$REFRESHCHAINS"
[ -n "$g_timestamp" ] && options="$options --timestamp"
[ -n "$g_test" ] && options="$options --test"
[ -n "$g_preview" ] && options="$options --preview"
[ "$g_debugging" = trace ] && options="$options --debug"
[ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
[ -x $pc ] || startup_error "Shorewall6 requires the shorewall package which is not installed"
#
# Run the appropriate params file
@@ -308,15 +316,15 @@ start_command() {
if [ -n "$AUTOMAKE" ]; then
[ -n "$nolock" ] || mutex_on
${VARDIR}/firewall $debugging start
run_it ${VARDIR}/firewall $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
progress_message3 "Compiling..."
if compiler run $debugging $nolock compile ${VARDIR}/.start; then
if compiler run $g_debugging $nolock compile ${VARDIR}/.start; then
[ -n "$nolock" ] || mutex_on
${VARDIR}/.start $debugging start
run_it ${VARDIR}/.start $g_debugging start
rc=$?
[ -n "$nolock" ] || mutex_off
else
@@ -348,11 +356,11 @@ start_command() {
option=
;;
d*)
DEBUG=Yes
g_debug=Yes
option=${option#d}
;;
f*)
FAST=Yes
g_fast=Yes
option=${option#f}
;;
*)
@@ -372,7 +380,7 @@ start_command() {
0)
;;
1)
[ -n "$SHOREWALL_DIR" -o -n "$FAST" ] && usage 2
[ -n "$SHOREWALL_DIR" -o -n "$g_fast" ] && usage 2
if [ ! -d $1 ]; then
if [ -e $1 ]; then
@@ -383,7 +391,6 @@ start_command() {
fi
SHOREWALL_DIR=$(resolve_file $1)
export SHOREWALL_DIR
AUTOMAKE=
;;
*)
@@ -391,41 +398,37 @@ start_command() {
;;
esac
export NOROUTES
export PURGE
if [ -n "${FAST}${AUTOMAKE}" ]; then
if [ -n "${g_fast}${AUTOMAKE}" ]; then
if qt mywhich make; then
restorefile=$RESTOREFILE
#
# RESTOREFILE is exported by get_config()
#
if [ -z "$FAST" ]; then
if [ -z "$g_fast" ]; then
#
# Autofast -- use the last compiled script
#
RESTOREFILE=firewall
fi
if ! make -qf ${CONFDIR}/Makefile; then
FAST=
export RESTOREFILE
if make -qf ${CONFDIR}/Makefile; then
g_fast=
AUTOMAKE=
fi
RESTOREFILE=$restorefile
else
FAST=
g_fast=
AUTOMAKE=
fi
if [ -n "$FAST" ]; then
RESTOREPATH=${VARDIR}/$RESTOREFILE
if [ -n "$g_fast" ]; then
g_restorepath=${VARDIR}/$RESTOREFILE
if [ -x $RESTOREPATH ]; then
if [ -x $g_restorepath ]; then
echo Restoring Shorewall6...
$SHOREWALL_SHELL $RESTOREPATH restore
run_it $g_restorepath restore
date > ${VARDIR}/restarted
progress_message3 Shorewall6 restored from $RESTOREPATH
progress_message3 Shorewall6 restored from $g_restorepath
else
do_it
fi
@@ -457,19 +460,19 @@ compile_command() {
while [ -n "$option" ]; do
case $option in
e*)
EXPORT=Yes
g_export=Yes
option=${option#e}
;;
p*)
PROFILE=Yes
g_profile=Yes
option=${option#p}
;;
t*)
TEST=Yes
g_test=Yes
option=${option#t}
;;
d*)
DEBUG=Yes;
g_debug=Yes;
option=${option#d}
;;
-)
@@ -510,7 +513,6 @@ compile_command() {
fi
SHOREWALL_DIR=$(resolve_file $1)
export SHOREWALL_DIR
file=$2
;;
*)
@@ -518,11 +520,9 @@ compile_command() {
;;
esac
export EXPORT
[ "x$file" = x- ] || progress_message3 "Compiling..."
compiler exec $debugging compile $file
compiler exec $g_debugging compile $file
}
#
@@ -545,15 +545,19 @@ check_command() {
option=
;;
e*)
EXPORT=Yes
g_export=Yes
option=${option#e}
;;
p*)
PROFILE=Yes
g_profile=Yes
option=${option#p}
;;
r*)
g_preview=Yes;
option=${option#r}
;;
d*)
DEBUG=Yes;
g_debug=Yes;
option=${option#d}
;;
*)
@@ -584,18 +588,15 @@ check_command() {
fi
SHOREWALL_DIR=$(resolve_file $1)
export SHOREWALL_DIR
;;
*)
usage 1
;;
esac
export EXPORT
progress_message3 "Checking..."
compiler exec $debugging $nolock check
compiler exec $g_debugging $nolock check
}
#
@@ -621,20 +622,20 @@ restart_command() {
option=
;;
d*)
DEBUG=Yes
g_debug=Yes
option=${option#d}
;;
f*)
FAST=Yes
g_fast=Yes
option=${option#f}
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
p*)
[ -n "$(which conntrack)" ] || fatal_error "The '-p' option requires the conntrack utility which does not appear to be installed on this system"
PURGE=Yes
g_purge=Yes
option=${option%p}
;;
*)
@@ -665,8 +666,7 @@ restart_command() {
fi
SHOREWALL_DIR=$(resolve_file $1)
[ -n "$FAST" ] && fatal_error "Directory may not be specified with the -f option"
export SHOREWALL_DIR
[ -n "$g_fast" ] && fatal_error "Directory may not be specified with the -f option"
AUTOMAKE=
;;
*)
@@ -676,27 +676,24 @@ restart_command() {
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
export NOROUTES
export PURGE
if [ -z "$FAST" -a -n "$AUTOMAKE" ]; then
if [ -z "$g_fast" -a -n "$AUTOMAKE" ]; then
if qt mywhich make; then
#
# RESTOREFILE is exported by get_config()
#
restorefile=$RESTOREFILE
RESTOREFILE=firewall
make -qf ${CONFDIR}/Makefile && FAST=Yes
make -qf ${CONFDIR}/Makefile && g_fast=Yes
RESTOREFILE=$restorefile
fi
fi
if [ -z "$FAST" ]; then
if [ -z "$g_fast" ]; then
progress_message3 "Compiling..."
if compiler run $debugging $nolock compile ${VARDIR}/.restart; then
if compiler run $g_debugging $nolock compile ${VARDIR}/.restart; then
[ -n "$nolock" ] || mutex_on
$SHOREWALL_SHELL ${VARDIR}/.restart $debugging restart
run_it ${VARDIR}/.restart $g_debugging restart
rc=$?
[ -n "$nolock" ] || mutex_off
else
@@ -706,7 +703,7 @@ restart_command() {
else
[ -x ${VARDIR}/firewall ] || fatal_error "No ${VARDIR}/firewall file found"
[ -n "$nolock" ] || mutex_on
$SHOREWALL_SHELL ${VARDIR}/firewall $debugging restart
run_it ${VARDIR}/firewall $g_debugging restart
rc=$?
[ -n "$nolock" ] || mutex_off
fi
@@ -747,11 +744,11 @@ refresh_command() {
done
if [ $# -gt 0 ]; then
REFRESHCHAINS=$1
g_refreshchains=$1
shift
while [ $# -gt 0 ]; do
REFRESHCHAINS="$REFRESHCHAINS,$1"
g_refreshchains="$g_refreshchains,$1"
shift
done
fi
@@ -760,13 +757,11 @@ refresh_command() {
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
export NOROUTES
progress_message3 "Compiling..."
if compiler run $debugging $nolock compile ${VARDIR}/.refresh; then
if compiler run $g_debugging $nolock compile ${VARDIR}/.refresh; then
[ -n "$nolock" ] || mutex_on
$SHOREWALL_SHELL ${VARDIR}/.refresh $debugging refresh
run_it ${VARDIR}/.refresh $g_debugging refresh
rc=$?
[ -n "$nolock" ] || mutex_off
else
@@ -803,7 +798,7 @@ safe_commands() {
option=
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
*)
@@ -834,7 +829,6 @@ safe_commands() {
fi
SHOREWALL_DIR=$(resolve_file $1)
export SHOREWALL_DIR
;;
*)
usage 1
@@ -865,19 +859,19 @@ safe_commands() {
progress_message3 "Compiling..."
if ! compiler run $debugging nolock compile ${VARDIR}/.$command; then
if ! compiler run $g_debugging nolock compile ${VARDIR}/.$command; then
status=$?
exit $status
fi
case $command in
start)
export RESTOREFILE=NONE
RESTOREFILE=NONE
progress_message3 "Starting..."
;;
restart)
export RESTOREFILE=.safe
RESTOREPATH=${VARDIR}/.safe
RESTOREFILE=.safe
g_restorepath=${VARDIR}/.safe
save_config
progress_message3 "Restarting..."
;;
@@ -885,7 +879,7 @@ safe_commands() {
[ -n "$nolock" ] || mutex_on
if ${VARDIR}/.$command $command; then
if run_it ${VARDIR}/.$command $command; then
echo -n "Do you want to accept the new firewall configuration? [y/n] "
@@ -893,9 +887,9 @@ safe_commands() {
echo "New configuration has been accepted"
else
if [ "$command" = "restart" ]; then
${VARDIR}/.safe restore
run_it ${VARDIR}/.safe restore
else
${VARDIR}/.$command clear
run_it ${VARDIR}/.$command clear
fi
[ -n "$nolock" ] || mutex_off
@@ -930,7 +924,6 @@ try_command() {
fi
SHOREWALL_DIR=$(resolve_file $1)
export SHOREWALL_DIR
}
while [ $finished -eq 0 -a $# -gt 0 ]; do
@@ -946,7 +939,7 @@ try_command() {
option=
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
*)
@@ -1002,19 +995,19 @@ try_command() {
progress_message3 "Compiling..."
if ! compiler run $debugging $nolock compile ${VARDIR}/.$command; then
if ! compiler run $g_debugging $nolock compile ${VARDIR}/.$command; then
status=$?
exit $status
fi
case $command in
start)
export RESTOREFILE=NONE
RESTOREFILE=NONE
progress_message3 "Starting..."
;;
restart)
export RESTOREFILE=.try
RESTOREPATH=${VARDIR}/.try
RESTOREFILE=.try
g_restorepath=${VARDIR}/.try
save_config
progress_message3 "Restarting..."
;;
@@ -1022,13 +1015,13 @@ try_command() {
[ -n "$nolock" ] || mutex_on
if ${VARDIR}/.$command $command && [ -n "$timeout" ]; then
if run_it ${VARDIR}/.$command $command && [ -n "$timeout" ]; then
sleep $timeout
if [ "$command" = "restart" ]; then
${VARDIR}/.try restore
run_it ${VARDIR}/.try restore
else
${VARDIR}/.$command clear
run_it ${VARDIR}/.$command clear
fi
fi
@@ -1075,7 +1068,7 @@ reload_command() # $* = original arguments less the command.
local compiler
compiler=
LITEDIR=/var/lib/shorewall6-lite
litedir=/var/lib/shorewall6-lite
while [ $finished -eq 0 -a $# -gt 0 ]; do
option=$1
@@ -1130,9 +1123,9 @@ reload_command() # $* = original arguments less the command.
;;
esac
litedir=$(rsh_command /sbin/shorewall6-lite show config 2> /dev/null | grep ^LITEDIR | sed 's/LITEDIR is //')
temp=$(rsh_command /sbin/shorewall6-lite show config 2> /dev/null | grep ^LITEDIR | sed 's/LITEDIR is //')
[ -n "$litedir" ] && LITEDIR=$litedir
[ -n "$temp" ] && litedir=$temp
if [ -z "$getcaps" ]; then
SHOREWALL_DIR=$(resolve_file $directory)
@@ -1155,11 +1148,11 @@ reload_command() # $* = original arguments less the command.
file=$(resolve_file $directory/firewall)
[ -n "$TIMESTAMP" ] && timestamp='-t' || timestamp=
[ -n "$g_timestamp" ] && timestamp='-t' || timestamp=
if shorewall6 $debugging $verbose $timestamp compile -e $compiler $directory $directory/firewall && \
progress_message3 "Copying $file and ${file}.conf to ${system}:${LITEDIR}..." && \
rcp_command "$directory/firewall $directory/firewall.conf" ${LITEDIR}
if shorewall6 $g_debugging $verbose $timestamp compile -e $compiler $directory $directory/firewall && \
progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..." && \
rcp_command "$directory/firewall $directory/firewall.conf" ${litedir}
then
save=$(find_file save);
@@ -1167,15 +1160,15 @@ reload_command() # $* = original arguments less the command.
progress_message3 "Copy complete"
if [ $COMMAND = reload ]; then
rsh_command "/sbin/shorewall6-lite $debugging $verbose $timestamp restart" && \
rsh_command "/sbin/shorewall6-lite $g_debugging $verbose $timestamp restart" && \
progress_message3 "System $system reloaded" || saveit=
else
rsh_command "/sbin/shorewall6-lite $debugging $verbose $timestamp start" && \
rsh_command "/sbin/shorewall6-lite $g_debugging $verbose $timestamp start" && \
progress_message3 "System $system loaded" || saveit=
fi
if [ -n "$saveit" ]; then
rsh_command "/sbin/shorewall6-lite $debugging $verbose $timestamp save" && \
rsh_command "/sbin/shorewall6-lite $g_debugging $verbose $timestamp save" && \
progress_message3 "Configuration on system $system saved"
fi
fi
@@ -1246,7 +1239,7 @@ export_command() # $* = original arguments less the command.
file=$(resolve_file $directory/firewall)
if shorewall6 $debugging $verbose compile -e $compiler $directory $directory/firewall && \
if shorewall6 $g_debugging $verbose compile -e $compiler $directory $directory/firewall && \
echo "Copying $file and ${file}.conf to ${target#*@}..." && \
scp $directory/firewall $directory/firewall.conf $target
then
@@ -1267,8 +1260,8 @@ usage() # $1 = exit status
echo "where <command> is one of:"
echo " add <interface>[:<host-list>] ... <zone>"
echo " allow <address> ..."
echo " check [ -e ] [ <directory> ]"
echo " clear [ -f ]"
echo " check [ -e ] [ -r ] [ <directory> ]"
echo " clear"
echo " compile [ -e ] [ -d ] [ <directory name> ] [ <path name> ]"
echo " delete <interface>[:<host-list>] ... <zone>"
echo " drop <address> ..."
@@ -1289,9 +1282,9 @@ usage() # $1 = exit status
echo " restart [ -n ] [ -f ] [ <directory> ]"
echo " restore [ -n ] [ <file name> ]"
echo " save [ <file name> ]"
echo " show [ -x ] [ -m ] [-f] [ -t {filter|mangle} ] [ {chain [<chain> [ <chain> ... ]|actions|capabilities|classifiers|config|connections|filters|ip|log|macros|mangle|nat|policies|raw|routing|tc|vardir|zones} ]"
echo " show [ -x ] [ -m ] [-f] [ -t {filter|mangle} ] [ {chain [<chain> [ <chain> ... ]|actions|capabilities|classifiers|config|connections|filters|ip|log [<regex>]|macros|mangle|nat|policies|raw|routing|tc|vardir|zones} ]"
echo " start [ -f ] [ -n ] [ <directory> ]"
echo " stop [ -f ]"
echo " stop"
echo " status"
echo " try <directory> [ <timeout> ]"
echo " version [ -a ]"
@@ -1304,10 +1297,10 @@ usage() # $1 = exit status
#
# Execution begins here
#
debugging=
g_debugging=
if [ $# -gt 0 ] && [ "x$1" = "xdebug" -o "x$1" = "xtrace" ]; then
debugging=$1
g_debugging=$1
shift
fi
@@ -1319,15 +1312,16 @@ if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
fi
SHOREWALL_DIR=
IPT_OPTIONS="-nv"
FAST=
VERBOSE_OFFSET=0
USE_VERBOSITY=
NOROUTES=
PURGE=
EXPORT=
export TIMESTAMP=
noroutes=
g_ipt_options="-nv"
g_fast=
g_verbose_offset=0
g_use_verbosity=
g_debug=
g_export=
g_noroutes=
g_purge=
g_timestamp=
finished=0
@@ -1359,52 +1353,52 @@ while [ $finished -eq 0 ]; do
shift
;;
e*)
EXPORT=Yes
g_export=Yes
option=${option#e}
;;
x*)
IPT_OPTIONS="-xnv"
g_ipt_options="-xnv"
option=${option#x}
;;
q*)
VERBOSE_OFFSET=$(($VERBOSE_OFFSET - 1 ))
g_verbose_offset=$(($g_verbose_offset - 1 ))
option=${option#q}
;;
f*)
FAST=Yes
g_fast=Yes
option=${option#f}
;;
v*)
option=${option#v}
case $option in
-1*)
USE_VERBOSITY=-1
g_use_verbosity=-1
option=${option#-1}
;;
0*)
USE_VERBOSITY=0
g_use_verbosity=0
option=${option#0}
;;
1*)
USE_VERBOSITY=1
g_use_verbosity=1
option=${option#1}
;;
2*)
USE_VERBOSITY=2
g_use_verbosity=2
option=${option#2}
;;
*)
VERBOSE_OFFSET=$(($VERBOSE_OFFSET + 1 ))
USE_VERBOSITY=
g_verbose_offset=$(($g_verbose_offset + 1 ))
g_use_verbosity=
;;
esac
;;
n*)
NOROUTES=Yes
g_noroutes=Yes
option=${option#n}
;;
t*)
TIMESTAMP=Yes
g_timestamp=Yes
option=${option#t}
;;
-)
@@ -1461,12 +1455,14 @@ version_command() {
[ $# -gt 0 ] && usage 1
echo $version
echo $SHOREWALL_VERSION
if [ -n "$all" ]; then
if [ -f /usr/share/shorewall/version ]; then
echo "Shorewall $(cat /usr/share/shorewall/version)"
fi
for product in shorewall shorewall-lite shorewall6-lite shorewall-init; do
if [ -f /usr/share/$product/version ]; then
echo "$product: $(cat /usr/share/$product/version)"
fi
done
fi
}
@@ -1474,14 +1470,13 @@ if [ $# -eq 0 ]; then
usage 1
fi
[ -n "$SHOREWALL_DIR" ] && export SHOREWALL_DIR
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
export PATH
MUTEX_TIMEOUT=
SHAREDIR=/usr/share/shorewall6
CONFDIR=/etc/shorewall6
export PRODUCT="Shorewall6"
g_product="Shorewall6"
g_recovering=
[ -f ${CONFDIR}/vardir ] && . ${CONFDIR}/vardir
@@ -1491,47 +1486,40 @@ if [ ! -f ${VARDIR}/firewall ]; then
[ -f ${VARDIR}/.restore ] && cp -f ${VARDIR}/.restore ${VARDIR}/firewall
fi
FIREWALL=${VARDIR}/firewall
LIBRARIES="$SHAREDIR/lib.base $SHAREDIR/lib.cli"
VERSION_FILE=$SHAREDIR/version
REFRESHCHAINS=
g_firewall=${VARDIR}/firewall
for library in $LIBRARIES; do
if [ -f $library ]; then
. $library
else
echo "$library does not exist!" >&2
exit 2
fi
for library in base cli; do
. ${SHAREDIR}/lib.$library
done
if [ -f $VERSION_FILE ]; then
version=$(cat $VERSION_FILE)
version_file=$SHAREDIR/version
if [ -f $version_file ]; then
SHOREWALL_VERSION=$(cat $version_file)
else
echo " ERROR: Shorewall6 is not properly installed" >&2
echo " The file $VERSION_FILE does not exist" >&2
echo " The file $version_file does not exist" >&2
exit 1
fi
banner="Shorewall6-$version Status at $HOSTNAME -"
banner="Shorewall6-$SHOREWALL_VERSION Status at $g_hostname -"
case $(echo -e) in
-e*)
RING_BELL="echo \a"
ECHO_E="echo"
g_ring_bell="echo \a"
g_echo_e="echo"
;;
*)
RING_BELL="echo -e \a"
ECHO_E="echo -e"
g_ring_bell="echo -e \a"
g_echo_e="echo -e"
;;
esac
case $(echo -n "Testing") in
-n*)
ECHO_N=
g_echo_n=
;;
*)
ECHO_N=-n
g_echo_n=-n
;;
esac
@@ -1546,19 +1534,17 @@ case "$COMMAND" in
stop|clear)
[ $# -ne 1 ] && usage 1
get_config
[ -x $FIREWALL ] || fatal_error "Shorewall6 has never been started"
export NOROUTES
[ -x $g_firewall ] || fatal_error "Shorewall6 has never been started"
mutex_on
$SHOREWALL_SHELL $FIREWALL $debugging $nolock $COMMAND
run_it $g_firewall $g_debugging $nolock $COMMAND
mutex_off
;;
reset)
get_config
export NOROUTES
shift
mutex_on
[ -x $FIREWALL ] || fatal_error "Shorewall6 has never been started"
$SHOREWALL_SHELL $FIREWALL $debugging $nolock reset $@
[ -x $g_firewall ] || fatal_error "Shorewall6 has never been started"
run_it $g_firewall $g_debugging $nolock reset $@
mutex_off
;;
compile)
@@ -1600,7 +1586,7 @@ case "$COMMAND" in
[ $# -eq 1 ] || usage 1
[ "$(id -u)" != 0 ] && fatal_error "ERROR: The status command may only be run by root"
get_config
echo "Shorewall6-$version Status at $HOSTNAME - $(date)"
echo "Shorewall6-$SHOREWALL_VERSION Status at $g_hostname - $(date)"
echo
if shorewall6_is_started ; then
echo "Shorewall6 is running"
@@ -1613,7 +1599,7 @@ case "$COMMAND" in
if [ -f ${VARDIR}/state ]; then
state="$(cat ${VARDIR}/state)"
case $state in
Stopped*|Clear*)
Stopped*|Closed*|Clear*)
status=3
;;
esac
@@ -1640,12 +1626,12 @@ case "$COMMAND" in
;;
logwatch)
get_config Yes Yes Yes
banner="Shorewall6-$version Logwatch at $HOSTNAME -"
banner="Shorewall6-$SHOREWALL_VERSION Logwatch at $g_hostname -"
logwatch_command $@
;;
drop)
get_config
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && usage 1
if shorewall6_is_started ; then
[ -n "$nolock" ] || mutex_on
@@ -1657,7 +1643,7 @@ case "$COMMAND" in
;;
logdrop)
get_config
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && usage 1
if shorewall6_is_started ; then
[ -n "$nolock" ] || mutex_on
@@ -1669,7 +1655,7 @@ case "$COMMAND" in
;;
reject|logreject)
get_config
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && usage 1
if shorewall6_is_started ; then
[ -n "$nolock" ] || mutex_on
@@ -1685,7 +1671,7 @@ case "$COMMAND" in
;;
save)
get_config
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
case $# in
1)
@@ -1699,7 +1685,7 @@ case "$COMMAND" in
;;
esac
RESTOREPATH=${VARDIR}/$RESTOREFILE
g_restorepath=${VARDIR}/$RESTOREFILE
[ -n "$nolock" ] || mutex_on
@@ -1725,21 +1711,20 @@ case "$COMMAND" in
;;
esac
g_restorepath=${VARDIR}/$RESTOREFILE
RESTOREPATH=${VARDIR}/$RESTOREFILE
if [ -x $g_restorepath ]; then
if [ -x $RESTOREPATH ]; then
if [ -x ${RESTOREPATH}-ipsets ]; then
rm -f ${RESTOREPATH}-ipsets
echo " ${RESTOREPATH}-ipsets removed"
if [ -x ${g_restorepath}-ipsets ]; then
rm -f ${g_restorepath}-ipsets
echo " ${g_restorepath}-ipsets removed"
fi
rm -f $RESTOREPATH
rm -f ${RESTOREPATH}-iptables
echo " $RESTOREPATH removed"
elif [ -f $RESTOREPATH ]; then
echo " $RESTOREPATH exists and is not a saved Shorewall6 configuration"
rm -f $g_restorepath
rm -f ${g_restorepath}-iptables
echo " $g_restorepath removed"
elif [ -f $g_restorepath ]; then
echo " $g_restorepath exists and is not a saved Shorewall6 configuration"
fi
rm -f ${VARDIR}/save
;;
@@ -1750,7 +1735,7 @@ case "$COMMAND" in
;;
call)
get_config
[ -n "$debugging" ] && set -x
[ -n "$g_debugging" ] && set -x
#
# Undocumented way to call functions in ${SHAREDIR}/functions directly
#

View File

@@ -1,19 +1,11 @@
###############################################################################
# /etc/shorewalls/shorewall6.conf Version 4 - Change the following variables to
# match your setup
#
# This program is under GPL
# [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# This file should be placed in /etc/shorewall
#
# (c) 1999,2000,2001,2002,2003,2004,2005,
# 2006,2007,2008 - Tom Eastep (teastep@shorewall.net)
# Shorewall Version 4 -- /etc/shorewall6/shorewall6.conf
#
# For information about the settings in this file, type "man shorewall6.conf"
#
# Additional information is available at
# http://www.shorewall.net/Documentation.htm#Conf
# Manpage also online at
# http://www.shorewall.net/manpages6/shorewall6.conf.html
###############################################################################
# S T A R T U P E N A B L E D
###############################################################################
@@ -105,6 +97,8 @@ TC_ENABLED=No
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=No
MARK_IN_FORWARD_CHAIN=No
@@ -117,7 +111,7 @@ ADMINISABSENTMINDED=Yes
BLACKLISTNEWONLY=Yes
MODULE_SUFFIX=
MODULE_SUFFIX=ko
FASTACCEPT=No
@@ -149,6 +143,14 @@ TRACK_PROVIDERS=No
ZONE2ZONE=2
ACCOUNTING=Yes
OPTIMIZE_ACCOUNTING=No
DYNAMIC_BLACKLIST=Yes
LOAD_HELPERS_ONLY=No
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

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