Compare commits

..

306 Commits

Author SHA1 Message Date
Tom Eastep
a258de3c9d Update known problems
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-21 07:50:13 -07:00
Tom Eastep
a796623dde Rename DESTIFAC_DISALLOW -> DESTIFACE_DISALLOW
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-20 09:40:31 -07:00
Tom Eastep
f6f840bebf Misc cleanup for 4.4.13
1. Replace statement with equivalent function call in promote_blacklist_rules()
2. Bump version of Tunnels.pm
3. Fix typo in comment in Zones.pm

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-20 08:15:24 -07:00
Tom Eastep
59905e8744 Set version to 4.4.13 2010-09-20 07:25:33 -07:00
Tom Eastep
7d2f6379e0 Document fix for '*' in interface names.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-19 15:19:48 -07:00
Tom Eastep
8bdd9828fd Don't allow '*' in interface names 2010-09-19 15:13:54 -07:00
Tom Eastep
c7fc4ce1f5 Correct order of release note entries 2010-09-19 12:54:54 -07:00
Tom Eastep
35a686eaa1 Add delete_reference() function.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-19 08:28:29 -07:00
Tom Eastep
9ba82bec1f Add warning about redundant 'blacklist' option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-19 08:28:05 -07:00
Tom Eastep
e06ca34298 Add redundancy warning re 'blacklst' 2010-09-19 08:03:01 -07:00
Tom Eastep
b3d6ae78ba Add redundancy warning re 'blacklst' 2010-09-19 07:57:36 -07:00
Tom Eastep
940ccf2c34 Document for tcfilter port ranges
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 15:11:41 -07:00
Tom Eastep
c0382b8cb9 Adjust reference count in move rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 15:11:17 -07:00
Tom Eastep
ce9b5ee944 Make blacklist rule promotion much more effecient.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 13:35:24 -07:00
Tom Eastep
74abd4ad54 In copy_rules(), handle the unlikely case where both chains have blacklist jumps.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 12:26:07 -07:00
Tom Eastep
f7db24f756 Merge branch '4.4.13'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 09:29:50 -07:00
Tom Eastep
f25b9e1967 Allow :<port> in tcfilters
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 09:26:29 -07:00
Tom Eastep
0e9c704069 Don't scan the filter table for jumps to 'blacklst' if the 'blacklst' chain does not exist
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 08:42:21 -07:00
Tom Eastep
c3299d5f89 Enable blacklist rule promotion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 08:38:22 -07:00
Tom Eastep
6f0893cd7a Correct Chains::promote_blacklist_rules()
- Interate through chains that jump to 'blacklst' until no rule is promoted
  This is required to promote jumps past exclusion chains
- Correct reference counting; the first cut was horribly wrong

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 08:38:14 -07:00
Tom Eastep
c040344bc1 Promote 'in' blacklist rules to the head of the interface chain
- Added Chains::promote_blacklist_rules()
- Called the function from Rules::generate_matrix()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 08:38:02 -07:00
Tom Eastep
2fa16f6d08 Enable blacklist rule promotion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 08:36:59 -07:00
Tom Eastep
578fc6c521 Correct Chains::promote_blacklist_rules()
- Interate through chains that jump to 'blacklst' until no rule is promoted
  This is required to promote jumps past exclusion chains
- Correct reference counting; the first cut was horribly wrong

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 08:36:35 -07:00
Tom Eastep
fd6ff1849a Promote 'in' blacklist rules to the head of the interface chain
- Added Chains::promote_blacklist_rules()
- Called the function from Rules::generate_matrix()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-18 07:37:42 -07:00
Tom Eastep
801c1cb6b3 Update release docs 2010-09-17 17:44:05 -07:00
Tom Eastep
fd568ece47 Clear raw table on 'clear' 2010-09-17 17:43:57 -07:00
Tom Eastep
1588c700c5 Fix blacklisting vs vservers 2010-09-17 17:43:40 -07:00
Tom Eastep
6106dd3ada Zero out {frozen} in a deleted chain entry 2010-09-17 17:43:04 -07:00
Tom Eastep
9946fbd3b5 Update release docs 2010-09-17 17:37:07 -07:00
Tom Eastep
580c561a51 Clear raw table on 'clear' 2010-09-17 17:12:34 -07:00
Tom Eastep
a42576aef8 Fix blacklisting vs vservers 2010-09-17 16:38:34 -07:00
Tom Eastep
79bb47582a Zero out {frozen} in a deleted chain entry 2010-09-17 16:00:36 -07:00
Tom Eastep
596d207dfc Simplify a test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-17 15:43:56 -07:00
Tom Eastep
8cdbe5f88d Fix an optimization bug with the new blacklisting code 2010-09-17 15:43:47 -07:00
Tom Eastep
402b3b929e Restore trace output in move_rules()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-17 15:43:03 -07:00
Tom Eastep
c5bb3ecfac Simplify a test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-17 15:42:05 -07:00
Tom Eastep
c9e876fcf5 Fix an optimization bug with the new blacklisting code 2010-09-17 15:10:02 -07:00
Tom Eastep
85430e459c Restore trace output in move_rules()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-17 14:35:25 -07:00
Tom Eastep
ad660d7fe5 Simplify move_rules() 2010-09-17 13:53:10 -07:00
Tom Eastep
3d0f8e962e Simplify move_rules() 2010-09-17 13:49:32 -07:00
Tom Eastep
7a6943fa54 Disallow mss and blacklist on firewall and vserver zones 2010-09-17 12:54:58 -07:00
Tom Eastep
b76ee408a5 Emit clearer error messages 2010-09-17 12:54:54 -07:00
Tom Eastep
2e3635ff50 Be sure that {frozen} is defined 2010-09-17 12:54:44 -07:00
Tom Eastep
28aa7b8267 Re-add OPTIONS column to blacklist templates 2010-09-17 12:54:38 -07:00
Tom Eastep
ab78aac3a4 Disallow mss and blacklist on firewall and vserver zones 2010-09-17 12:46:38 -07:00
Tom Eastep
330afe1701 Emit clearer error messages 2010-09-17 12:35:34 -07:00
Tom Eastep
239b4a2356 Be sure that {frozen} is defined 2010-09-17 12:08:48 -07:00
Tom Eastep
65de1e4e6e Re-add OPTIONS column to blacklist templates 2010-09-17 11:56:47 -07:00
Tom Eastep
7175f8a63e Revert versions on Rules and Zones modules 2010-09-17 11:08:45 -07:00
Tom Eastep
d898c87617 Eliminate a parameter to add_jump() 2010-09-17 11:08:12 -07:00
Tom Eastep
07930fc535 Revert versions on Rules and Zones modules 2010-09-17 11:06:32 -07:00
Tom Eastep
5357f4c347 Eliminate a parameter to add_jump() 2010-09-17 11:05:35 -07:00
Tom Eastep
c7373ada46 Add advice about SAVE/RESTORE 2010-09-17 09:22:48 -07:00
Tom Eastep
af24baaecd Update version to RC1 (one more time) 2010-09-17 09:14:56 -07:00
Tom Eastep
e61230a3db Update version to Beta 6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-17 08:23:24 -07:00
Tom Eastep
8e2c8e5a8f Document use of state match for NOTRACK
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-17 08:21:16 -07:00
Tom Eastep
882970a598 Use state match for UNTRACKED 2010-09-17 07:58:21 -07:00
Tom Eastep
2ce3c8aa88 Ensure that blacklist rules are before the other interface-oriented rules 2010-09-16 18:19:16 -07:00
Tom Eastep
27c445381e Treat 'blacklist' uniformly in hosts and zones 2010-09-16 15:48:12 -07:00
Tom Eastep
67b9ae0d2c Update release documents 2010-09-16 15:47:05 -07:00
Tom Eastep
1c870b532a Preserve dynamic blacklist during stop/clear/restore 2010-09-16 12:17:04 -07:00
Tom Eastep
44665775b2 Documentation corrections to the blacklist files 2010-09-16 09:46:46 -07:00
Tom Eastep
a8c9fc1859 Implement new Blacklisting Scheme 2010-09-16 09:40:28 -07:00
Tom Eastep
3c1cff0794 First steps toward zone-based blacklisting 2010-09-16 06:55:48 -07:00
Tom Eastep
1d650b41cd Remove blacklisting by destination IP address support
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-15 15:24:58 -07:00
Tom Eastep
bea4ce4ca6 Add tc-tbf link to tcinterfaces manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-15 14:07:42 -07:00
Tom Eastep
3ad3f0d9e0 Allow floating point numbers in tcinterfaces fields other than <rate>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-15 14:07:21 -07:00
Tom Eastep
ba89ec39b5 Add :<burst> to /etc/shorewall/tcdevices 2010-09-15 11:56:14 -07:00
Tom Eastep
69a2fa1907 Replace to/from with dst/src 2010-09-15 11:25:46 -07:00
Tom Eastep
8147671eb2 Document JUMP 2010-09-15 09:49:37 -07:00
Tom Eastep
f925b335ef Ignore the 'blacklist' host option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-15 08:10:57 -07:00
Tom Eastep
373fc87165 More blacklisting wrapup
- Deprecate 'blacklist' in the hosts file
- Base blacklisting on interfaces alone

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-15 07:38:20 -07:00
Tom Eastep
4d0e8d129b Add dup blacklist message 2010-09-14 18:04:27 -07:00
Tom Eastep
10a9ae496a More manpage updates for 4.4.13 2010-09-14 16:47:45 -07:00
Tom Eastep
94cdc73ec2 Restore setpolicy() to prog.header*
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-14 13:50:22 -07:00
Tom Eastep
c4a40d8c7b Set version to RC1 (again) 2010-09-14 13:09:50 -07:00
Tom Eastep
2ff06f5f0a Update simple TC doc 2010-09-14 07:59:01 -07:00
Tom Eastep
c6960f1ac2 Edit release notes 2010-09-14 07:36:29 -07:00
Tom Eastep
1f2691b052 Another fix for blacklisting; correct composition of $hosts1 2010-09-14 06:47:29 -07:00
Tom Eastep
0f913fca2f Don't create blackout unnecessarily 2010-09-13 18:15:50 -07:00
Tom Eastep
82bccf16b5 Avoid internal error when there are no 'to' entries 2010-09-13 17:55:20 -07:00
Tom Eastep
bb38ed16b0 Document ipset creation fix 2010-09-13 15:54:44 -07:00
Tom Eastep
b1e9bff382 Create new ipsets on 'start' 2010-09-13 15:46:04 -07:00
Tom Eastep
a6194fabd2 Delete blank line 2010-09-13 14:15:47 -07:00
Tom Eastep
33adbe7a27 Update documentation for net TC features 2010-09-13 13:51:25 -07:00
Tom Eastep
3f93ebdda8 Update blacklist manpages 2010-09-13 13:23:32 -07:00
Tom Eastep
1729da87f1 Allow both 'to' and 'from' in blacklist 2010-09-13 12:51:10 -07:00
Tom Eastep
9b4c3e22dd Allow floating point numbers in TC rates 2010-09-13 12:50:50 -07:00
Tom Eastep
cb1f7adea3 Add :<burst> to IN-BANDWIDTH 2010-09-13 11:23:37 -07:00
Tom Eastep
283eda2fa5 Cosmetic change to OUT-BANDWIDTH code 2010-09-12 16:33:19 -07:00
Tom Eastep
bd9041306c Add undocumented OUT-BANDWIDTH column to tcinterfaces 2010-09-12 16:25:45 -07:00
Tom Eastep
a3b7b9c11b Delete unused functions from prog.header*
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-12 10:07:26 -07:00
Tom Eastep
52592b4cfb Remove prog.*6 during installation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-12 10:07:07 -07:00
Tom Eastep
47ad42659c Mention ipsets in the secmarks manpage 2010-09-12 08:12:41 -07:00
Tom Eastep
9f786b7c59 Delete mention of triggers in ipset doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-12 08:01:54 -07:00
Tom Eastep
b937290740 Add version cautions to blacklisting doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-12 07:58:13 -07:00
Tom Eastep
931c5a8d0a Add an assertion 2010-09-11 16:24:27 -07:00
Tom Eastep
50fc972d2a Fix another SAME defect :-( 2010-09-11 16:15:09 -07:00
Tom Eastep
512cd7b08e Bump version to 4.4.13 RC 1 2010-09-11 15:46:14 -07:00
Tom Eastep
aad7b70e18 Rename constant 2010-09-11 15:31:43 -07:00
Tom Eastep
c6c6503d83 Clean up a remaining issue with SAME 2010-09-11 15:24:01 -07:00
Tom Eastep
f004916055 Disallow a DEST interface in mangle OUTPUT rules 2010-09-11 14:10:05 -07:00
Tom Eastep
3ea7808b38 Disallow a DEST interface in mangle PREROUTING rules 2010-09-11 14:02:09 -07:00
Tom Eastep
37a5a01185 Correct INPUT marking documentation 2010-09-11 12:47:32 -07:00
Tom Eastep
e93a7fe9df Avoid recent problems by not padding $target in process_tc_rule() 2010-09-11 11:03:28 -07:00
Tom Eastep
d9ced1051a One more fix for SAME 2010-09-11 10:35:45 -07:00
Tom Eastep
367fc041b8 Correct handling of SAME -- Take 2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-11 09:36:19 -07:00
Tom Eastep
83ae6d6eba Document fix for 'SAME'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-11 09:04:42 -07:00
Tom Eastep
dbc9f6ac8f Correct handling of SAME
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-11 08:56:22 -07:00
Tom Eastep
05b6947aac Document fix for ipset invocation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-11 08:55:35 -07:00
Tom Eastep
8dd42c9e19 Correct handling of dst/src list in ipset invocation 2010-09-11 07:41:01 -07:00
Tom Eastep
99f8f84024 Fix name of F chain in secmarks 2010-09-10 16:45:22 -07:00
Tom Eastep
69817007bf Some more fixes for blacklisting 2010-09-09 14:53:12 -07:00
Tom Eastep
50300a60b7 A number of corrections to split blacklisting.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-09 11:20:49 -07:00
Tom Eastep
64544f4ab5 Correct comparison in 'blacklist' handling 2010-09-09 10:22:48 -07:00
Tom Eastep
cd4b5d80ed Reduce patch footprint by two lines 2010-09-09 09:00:28 -07:00
Tom Eastep
df1e17eaa8 Re-enable 'blacklist' on bridge ports 2010-09-09 07:09:08 -07:00
Tom Eastep
7e8979157c Update Features Page re: Virtualization
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-08 15:47:23 -07:00
Tom Eastep
2cb5aaeb07 Correct interface reference 2010-09-08 13:12:19 -07:00
Tom Eastep
a4606bee80 Pretty up Network Diagram -- exchange caption location 2010-09-08 12:57:35 -07:00
Tom Eastep
bbe5dae9b0 Pretty up Network Diagram some more 2010-09-08 12:44:40 -07:00
Tom Eastep
0907a7b6c2 Pretty up Network Diagram 2010-09-08 12:38:14 -07:00
Tom Eastep
7f72d66b90 A couple of documentation updates 2010-09-08 11:55:16 -07:00
Tom Eastep
b091169ed9 Remove deprecated syntax from examples 2010-09-08 06:04:57 -07:00
Tom Eastep
828d190436 Change example 2010-09-07 19:14:43 -07:00
Tom Eastep
8853de0c2e Fix links to secmark manpages 2010-09-07 15:03:05 -07:00
Tom Eastep
46bbb26b6b Tweak secmarks example to use ESTABLISHED,RELATED 2010-09-07 13:59:33 -07:00
Tom Eastep
ee83b7f022 Add link to James Morris blog re SECMARK 2010-09-07 13:52:43 -07:00
Tom Eastep
ab87d8800a List secmarks as SEE ALSO 2010-09-07 12:27:39 -07:00
Tom Eastep
7dbd994f51 Update installers for secmarks 2010-09-07 07:56:11 -07:00
Tom Eastep
8d63e04926 Yet more docunentation updates 2010-09-06 20:37:34 -07:00
Tom Eastep
50b4bd8dfe More Blacklist and Secmark documentation updates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-06 17:26:49 -07:00
Tom Eastep
f3255cd83a Rework blacklisting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-06 15:29:20 -07:00
Tom Eastep
c6f58ba924 Enhance SELinux support:
- Add state match
- Add user/group match
- Add examples to the man pages
2010-09-06 09:06:40 -07:00
Tom Eastep
33dc8de8fb Allow dash's in ipset names 2010-09-05 11:41:35 -07:00
Tom Eastep
23e94e136c Allow COMMENT, SAVE and RESTORE to work correctly in secmarks
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-05 08:17:58 -07:00
Tom Eastep
629290259d Allow secmarks without TC_ENABLED
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-05 07:49:03 -07:00
Tom Eastep
b139ff7e90 Update docs and implementation of SECMARK 2010-09-04 16:08:29 -07:00
Tom Eastep
28ff3548ff Bump version to 4.4.13-Beta4 2010-09-04 15:30:02 -07:00
Tom Eastep
15d8d6d8b7 Add SECMARK and CONNSECMARK support 2010-09-04 15:12:08 -07:00
Tom Eastep
6caff51c98 Modify a comment are delete a silly identity assignment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-09-01 11:24:19 -07:00
Tom Eastep
62fcf1ae8b Adjust version of Raw.pm 2010-08-31 16:52:48 -07:00
Tom Eastep
dfebe5a35e Correct error message 2010-08-31 16:33:15 -07:00
Tom Eastep
f93413b2a7 Update Multi-ISP doc for variable name change in 4.4.8.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-31 15:33:22 -07:00
Tom Eastep
8f94137007 Fix last change 2010-08-30 16:47:45 -07:00
Tom Eastep
1da6d51d1a Reduce the Beta3 patch footprint by making the second arg to known_interface() optional 2010-08-30 16:43:30 -07:00
Tom Eastep
add76ed14e Bump version to 4.4.13 Beta 3
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-30 12:33:10 -07:00
Tom Eastep
7f0f4516d7 Rework handle_optional_interfaces() somewhat
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-30 12:29:39 -07:00
Tom Eastep
8077c9e1c3 Add FAQ 91 2010-08-30 11:07:37 -07:00
Tom Eastep
c18d206726 Use a function to generate the list of interfaces with an L3 address 2010-08-29 20:13:56 -07:00
Tom Eastep
57c54af6ed Re-implement optional interface handling
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-29 12:32:44 -07:00
Tom Eastep
d94f2cc86d Insure that the mapping to base names is deterministic
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-29 07:28:06 -07:00
Tom Eastep
be0231578f Insure uniqueness of chain_base mapping 2010-08-28 20:47:39 -07:00
Tom Eastep
95a09b996f Fix test for KLUDGEFREE 2010-08-28 20:47:15 -07:00
Tom Eastep
1531ad3bcd Re-implement interface->shell-variable mapping 2010-08-28 15:15:41 -07:00
Tom Eastep
3a36a9de4b Fix shell-variable creation 2010-08-28 14:48:47 -07:00
Tom Eastep
d8846b92d8 Fix optional 'upnpclient' interfaces - take 2 2010-08-28 14:46:29 -07:00
Tom Eastep
a440e7023e Fix optional 'upnpclient' interfaces 2010-08-28 14:18:48 -07:00
Tom Eastep
f45879c4f4 split_list1 removes () -- take 2 2010-08-28 13:40:44 -07:00
Tom Eastep
2a54e8cd24 split_list1 removes () 2010-08-28 13:37:19 -07:00
Tom Eastep
c2558af9c8 Document and correct implementation of EXCLUSION_MASK
1. Require KLUDGEFREE if existing rule uses mark match
2. Pretty up the code
3. Use MASK_BITS rather than TC_BITS when calculating the offset of EXCLUSION_MASK

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-28 08:29:47 -07:00
Tom Eastep
c98cf8aea6 Re-implement exclusion in CONTINUE/NONAT/ACCEPT+ rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-27 10:09:42 -07:00
Tom Eastep
57bcfee559 Add 'Mark in any table' capability 2010-08-27 08:35:33 -07:00
Tom Eastep
a1cd2ba0f3 Bring 'multiple space before comment' fix forward to master
Probably unneeded but better be safe

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-27 06:59:52 -07:00
Tom Eastep
12f48e1b97 Don't pass '-j' in target arg to expand_rule()
- use the target to locate chain for reference tracking

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-26 10:37:07 -07:00
Tom Eastep
15fbbdaac7 Fix exclusion in blacklist
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-26 10:33:57 -07:00
Tom Eastep
bd8bcabdf0 Use the 'disposition' argument to expand_rule() to specify the target chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-26 08:40:24 -07:00
Tom Eastep
dc74b88445 Fix typo in release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-26 07:16:28 -07:00
Tom Eastep
75e12148ac Bump version to Beta 2 2010-08-25 09:58:07 -07:00
Tom Eastep
4a865e0a6d Pretty up some come 2010-08-24 13:08:21 -07:00
Tom Eastep
91c5a2f80b Fix old ipset detection bug 2010-08-24 13:08:06 -07:00
Tom Eastep
5c49aa843c Generate warning when a rules file entry generates no iptables-restore input
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-24 08:38:49 -07:00
Tom Eastep
383e792807 Restore wildcard properties to zone lists 2010-08-24 06:52:53 -07:00
Tom Eastep
5a92c3262f Fix REQUIRE_INTERFACE=Yes 2010-08-23 17:19:41 -07:00
Tom Eastep
d74af30368 Fix zone-exclusion bug 2010-08-23 16:31:46 -07:00
Tom Eastep
8f94240e8f Fix a couple of optimization bugs 2010-08-23 16:00:40 -07:00
Tom Eastep
160ad231df Fix an old optimization bug 2010-08-23 15:14:09 -07:00
Tom Eastep
ec09b92c4c Correct Release Notes 2010-08-23 12:38:58 -07:00
Tom Eastep
5aceddbf37 Update Accounting Documents 2010-08-22 16:40:04 -07:00
Tom Eastep
647f4bf6eb Update release notes 2010-08-22 14:35:01 -07:00
Tom Eastep
335ac8cdca Improve IPSEC accounting.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-20 10:07:19 -07:00
Tom Eastep
e70d9c82d8 Revise and document IPSEC Accounting
- Place accounting rules in accipsecin and accipsecout
- Add warning when rule inserted into unreferenced accounting chain
- Add warning when an accounting chain has no references

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-20 08:24:45 -07:00
Tom Eastep
33ee9b1481 Add IPSEC Accounting (again) 2010-08-20 06:53:31 -07:00
Tom Eastep
d9d31ff132 Remove another 'our' variable 2010-08-19 15:34:04 -07:00
Tom Eastep
c80b1b3585 Correct types in do_ipsec() 2010-08-19 15:33:49 -07:00
Tom Eastep
6b0fa8b4e2 Change note about MARK_IN_FORWARD_CHAIN 2010-08-19 15:33:12 -07:00
Tom Eastep
af77eb08bc Back out IPSEC accounting rules 2010-08-19 15:13:01 -07:00
Tom Eastep
2a9bbbfe62 Eliminate an ugly 'our' variable.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-19 12:00:52 -07:00
Tom Eastep
676da7a2f1 More reorganization of process_rule()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-19 11:53:26 -07:00
Tom Eastep
d997ef1653 First cut at IPSEC support in the accounting file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-19 11:46:26 -07:00
Tom Eastep
4322d7b2af Zone exclusion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-18 16:10:58 -07:00
Tom Eastep
4460b49842 Complete Zone list Support
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-18 14:38:53 -07:00
Tom Eastep
fafb0dea73 Update version to 4.4.13-Beta1 2010-08-18 12:40:34 -07:00
Tom Eastep
66d4379962 Reorder sections of the Release Notes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-18 12:22:42 -07:00
Tom Eastep
255cd6cf9c Implement zone lists in rules file entries
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-18 12:18:58 -07:00
Tom Eastep
7a17b65368 Allow simple zone lists in rules 2010-08-18 07:26:38 -07:00
Tom Eastep
baf8e21a80 Add reference to manual chains article for the compile extension 2010-08-17 09:23:43 -07:00
Tom Eastep
12aecdef37 Use '&' trick to avoid prototype matching 2010-08-17 09:17:25 -07:00
Tom Eastep
a0dffa787d Add an assertion 2010-08-16 19:17:44 -07:00
Tom Eastep
2919c48ba0 Avoid forward reference to ensure_chain() 2010-08-16 13:25:01 -07:00
Tom Eastep
00837ed503 Add Shorewall::Chains::find_chain() 2010-08-16 13:12:12 -07:00
Tom Eastep
633eba6c90 Set version to 4.4.12 2010-08-15 08:50:45 -07:00
Tom Eastep
42362ea318 Document fix for AUTOMAKE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-14 07:55:45 -07:00
Tom Eastep
72b8393c3a Fix AUTOMAKE=Yes 2010-08-14 07:32:53 -07:00
Tom Eastep
bc19a80ac4 Correct FAQ 2 for Shorewall-lite 2010-08-14 07:14:52 -07:00
Tom Eastep
1510e111c4 Fix typo in conf basics doc 2010-08-13 20:27:14 -07:00
Tom Eastep
b7f638ddb3 Document status command change 2010-08-12 19:46:57 -07:00
Tom Eastep
7281c9166e Record the config directory in the state file 2010-08-12 17:54:07 -07:00
Tom Eastep
36054b7784 Add additional vserver notes in rules manpages 2010-08-12 17:52:22 -07:00
Tom Eastep
e35e9d2c99 Clarify nesting of vserver zones
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-12 15:26:30 -07:00
Tom Eastep
15eec24672 Simplify logic for generating all parent zones
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-12 15:15:19 -07:00
Tom Eastep
7168257152 Document port range editing fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-12 11:52:43 -07:00
Tom Eastep
49053afdcb Fix port range validate issue 2010-08-12 09:49:26 -07:00
Tom Eastep
92eed0d23c Document fix for any bug 2010-08-12 07:35:45 -07:00
Tom Eastep
69eaf84078 Fix bug with 'any' 2010-08-12 07:31:37 -07:00
Tom Eastep
aa00acc310 Correct typo in release notes 2010-08-11 16:09:12 -07:00
Tom Eastep
000873575e Update Shorewall Lite Doc 2010-08-11 15:59:24 -07:00
Tom Eastep
e0780b9a84 Rename the first column of the masq file for clarity 2010-08-11 15:34:27 -07:00
Tom Eastep
965ad7ced1 Minor tweaks to the IPAddrs module 2010-08-11 11:46:26 -07:00
Tom Eastep
0234564a1b Add destination IP blacklisting 2010-08-10 17:33:50 -07:00
Tom Eastep
d9cbbea36a Delete extra item in enhancement list 2010-08-07 14:06:20 -07:00
Tom Eastep
da91ef8d2c Fix typo in install.sh 2010-08-07 10:56:15 -07:00
Tom Eastep
1a4d84d502 Document fix to install.sh 2010-08-07 09:34:19 -07:00
Tom Eastep
8d4498c9b8 Update Version to 4.4.12 RC 1 2010-08-06 19:31:36 -07:00
Tom Eastep
59829565f5 Add COMPLETE to release notes 2010-08-06 19:30:33 -07:00
Tom Eastep
0f02ee2628 Fix issue with set match generation 2010-08-06 10:17:54 -07:00
Tom Eastep
1efa50e6fa Try to make the masq manpage more obvious 2010-08-05 16:50:48 -07:00
Tom Eastep
364ad41cf5 Add support for new ipset match syntax 2010-08-03 21:06:17 -07:00
Tom Eastep
2774ee1bd6 Make 'icmp' a synonym for 'ipv6-icmp' in IPv6 compilations 2010-08-02 08:04:55 -07:00
Tom Eastep
c0dcb0edbf Tweak Universal .conf files 2010-08-02 06:40:45 -07:00
Tom Eastep
e31f80dce6 Fix Universal interfaces to include 'optional 2010-08-01 16:27:31 -07:00
Tom Eastep
3ce8ff5741 Bump version to Beta 4 2010-08-01 16:10:32 -07:00
Tom Eastep
f75c5809b5 Advocate use of 'ip' to examine routing tables 2010-08-01 11:56:06 -07:00
Tom Eastep
967629569b Taylor Universal config to work with Shorewall-init and streamline ruleset
- Make interface 'all' optional and set REQUIRE_INTERFACE=Yes
- Add COMPLETE option
- Set FASTACCEPT in Universal samples
- Reset SUBSYSLOCK in Universal samples

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-08-01 08:36:56 -07:00
Tom Eastep
a88e2afa69 Tweak the Universal documentation 2010-07-31 18:43:54 -07:00
Tom Eastep
c6404f1a74 Reword last title in Universal ruleset doc 2010-07-31 14:51:52 -07:00
Tom Eastep
2f08ec4dd6 Update version in release notes 2010-07-31 14:06:49 -07:00
Tom Eastep
0b9aa0f84b Fix the dump command 2010-07-31 13:52:28 -07:00
Tom Eastep
ee5d2a56da Add Universal doc 2010-07-31 13:52:09 -07:00
Tom Eastep
0b3dfcc844 Revert version to Beta 3 2010-07-31 13:23:53 -07:00
Tom Eastep
fdcc263023 Fix a couple of minor bugs 2010-07-31 13:11:46 -07:00
Tom Eastep
bebeba8cae Document Universal Configuration and allow for empty LOGFILE 2010-07-31 12:45:43 -07:00
Tom Eastep
4e02031985 Document Universal Configuration 2010-07-31 11:59:25 -07:00
Tom Eastep
375010d602 Add IPv6 'Universal' configuration 2010-07-31 11:40:28 -07:00
Tom Eastep
1765474fab Tweaks to 'Universal' configuration 2010-07-31 11:34:21 -07:00
Tom Eastep
ddba116e54 Add 'Univeral' Sample 2010-07-31 10:52:58 -07:00
Tom Eastep
0174045181 Fixes for Universal Sample 2010-07-31 10:49:49 -07:00
Tom Eastep
beeeb6efbc Allow '+' as a physical interface 2010-07-31 10:08:45 -07:00
Tom Eastep
fdeb9006fa Correct module versions 2010-07-31 09:02:51 -07:00
Tom Eastep
005b6f7b45 Use new hashlimit match syntax if available 2010-07-31 07:19:41 -07:00
Tom Eastep
637cfdaa14 Handle case where old hashlimit match is no longer supported 2010-07-29 17:14:36 -07:00
Tom Eastep
e598dc77b7 Correct/improve LOGLIMIT handling 2010-07-29 16:50:17 -07:00
Tom Eastep
d483725474 Update Accounting doc 2010-07-29 16:49:40 -07:00
Tom Eastep
0b8ddeeed4 Correct typo in release notes 2010-07-29 12:49:26 -07:00
Tom Eastep
8f531355c9 Update known problems for RC1 2010-07-29 12:40:46 -07:00
Tom Eastep
a639b75e36 Bump version to RC1 2010-07-29 11:40:15 -07:00
Tom Eastep
e00517f075 Add Vserver support as a release highlight 2010-07-29 11:38:43 -07:00
Tom Eastep
6a1fea3a40 Add 'user marks' 2010-07-27 11:02:36 -07:00
Tom Eastep
aac343b476 Document mark geometry capability 2010-07-27 08:05:54 -07:00
Tom Eastep
0c38ba815c Add LOGLIMIT to .conf files while deleting LOGRATE and LOGBURST 2010-07-27 06:44:10 -07:00
Tom Eastep
f1a8da61bc Use global log rate limiting, if any, for synflood logging 2010-07-26 14:58:38 -07:00
Tom Eastep
8f27a2461d Fix syntax diagram 2010-07-25 13:08:15 -07:00
Tom Eastep
bd5facda30 Implement per-IP log rate limiting 2010-07-25 12:42:39 -07:00
Tom Eastep
9bf06caa35 Bump version to Beta 2 2010-07-25 08:11:49 -07:00
Tom Eastep
7f4a7372ef Remove nic registration requirement for IRC channel 2010-07-24 16:04:21 -07:00
Tom Eastep
1528cc2094 Correct RE in split_action() 2010-07-24 11:50:10 -07:00
Tom Eastep
a9a19c4da6 Remove another link to a Russian-language page 2010-07-24 11:08:06 -07:00
Tom Eastep
242f13f6bd Delete foreign language links -- docs are very out of date 2010-07-24 09:33:47 -07:00
Tom Eastep
e956068959 Make default setting of MANGLE_ENABLED depend on the capability with the same name 2010-07-24 09:27:21 -07:00
Tom Eastep
9ab66c3b07 More config basic doc tweaks 2010-07-24 07:09:02 -07:00
Tom Eastep
039ac17fe6 Correct SOURCE/DEST section 2010-07-23 14:32:11 -07:00
Tom Eastep
93e5fc2deb Correct SOURCE/DEST section 2010-07-23 14:19:05 -07:00
Tom Eastep
c2717b9eec Correct SOURCE/DEST section 2010-07-23 14:17:38 -07:00
Tom Eastep
9817be72f8 Fix another couple of more locking bugs -- ported from 4.4.11.1 2010-07-23 13:58:40 -07:00
Tom Eastep
e5a7d2ae69 Fix syntax error in generated script 2010-07-23 11:24:42 -07:00
Tom Eastep
9eedf155bc Fix syntax error in generated script 2010-07-23 11:23:23 -07:00
Tom Eastep
55b596ddb2 Update release notes version and document Shorewall-init fixes 2010-07-23 11:09:05 -07:00
Tom Eastep
d161f4cd1f Fix updown script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-23 09:47:08 -07:00
Tom Eastep
2c6d1c8d14 Many fixes for Shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-23 09:26:47 -07:00
Tom Eastep
00352baba7 Add warning about Upstart 2010-07-23 07:38:28 -07:00
Tom Eastep
898274dd77 Syncronize shorewall-lite activities 2010-07-22 17:00:34 -07:00
Tom Eastep
3248fc8ab1 Add additional progress messages to updown() 2010-07-22 15:11:19 -07:00
Tom Eastep
49a8861f5b Pretty up the code 2010-07-22 13:57:34 -07:00
Tom Eastep
7db9645225 Avoid an extra blank line 2010-07-22 13:51:47 -07:00
Tom Eastep
666cc35b46 Don't slow down stop with 'wait' 2010-07-22 12:56:49 -07:00
Tom Eastep
055f92c3d2 Document fix for :random with REDIRECT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-22 07:28:43 -07:00
Tom Eastep
4e33efd8a6 Allow :random to work with REDIRECT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-22 07:26:38 -07:00
Tom Eastep
8959245375 Update version to 4.4.12-Beta1 2010-07-21 20:35:36 -07:00
Tom Eastep
411d392ccd Additional progress messages during up/down processing 2010-07-21 20:35:03 -07:00
Tom Eastep
c536680bd6 Add FAQ 90 2010-07-21 13:31:43 -07:00
Tom Eastep
eb2dcb46cd Remove mention of 4.5 from Manpages6 index
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-21 12:36:18 -07:00
Tom Eastep
46644a0336 Add instructions for disabling existing firewalls 2010-07-21 11:49:37 -07:00
Tom Eastep
d897635af5 Allow bizarre overriding of SOURCE/DEST with ipsets
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-20 16:03:12 -07:00
Tom Eastep
1de257be19 Make ADD and DELETE work with any type of ipset.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-20 15:42:11 -07:00
Tom Eastep
c9423491f2 Don't mention 4.5 on Manpages page 2010-07-19 15:11:55 -07:00
Tom Eastep
8eeb71dc1b Fix inconsistencies in manpages 2010-07-19 14:45:05 -07:00
Tom Eastep
79128605b1 Validate all IPSET Names 2010-07-18 17:18:10 -07:00
Tom Eastep
cbb524b067 Implement ADD/DEL commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-18 08:46:38 -07:00
Tom Eastep
d2bb96be88 Emphasize that you must have a Nic to post on the Shorewall channel 2010-07-18 07:34:03 -07:00
Tom Eastep
47961f3fd5 Update release notes to mention link local network error
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-16 10:19:29 -07:00
Tom Eastep
d99aff5e09 Use Perl Constants rather literals for IPv6 Networks
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-16 10:06:29 -07:00
Tom Eastep
27937f32e3 Document IPv6 multicast network fix 2010-07-16 09:37:38 -07:00
Tom Eastep
17bdcc1360 Eradicate incorrect multicast network address 2010-07-16 09:33:17 -07:00
Tom Eastep
e0ae48f4c4 Document fix for IPv6 shorecap program
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-15 13:32:10 -07:00
Tom Eastep
4768b0890e Fix bug in Shorewall6-lite/shorecap 2010-07-15 12:50:35 -07:00
Tom Eastep
9977f778ad Link to a better Netfilter Diagram 2010-07-15 11:07:14 -07:00
163 changed files with 5956 additions and 1566 deletions

View File

@@ -0,0 +1,12 @@
#
# Shorewall version 4 - Interfaces File
#
# For information about entries in this file, type "man shorewall-interfaces"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-interfaces.html
#
###############################################################################
#ZONE INTERFACE BROADCAST OPTIONS
- lo - ignore
net all - dhcp,physical=+,routeback,optional

13
Samples/Universal/policy Normal file
View File

@@ -0,0 +1,13 @@
#
# Shorewall version 4 - Policy File
#
# For information about entries in this file, type "man shorewall-policy"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-policy.html
#
###############################################################################
#SOURCE DEST POLICY LOG LIMIT: CONNLIMIT:
# LEVEL BURST MASK
$FW net ACCEPT
net all DROP

17
Samples/Universal/rules Normal file
View File

@@ -0,0 +1,17 @@
#
# Shorewall version 4 - Rules File
#
# For information on the settings in this file, type "man shorewall-rules"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-rules.html
#
####################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME
# PORT PORT(S) DEST LIMIT GROUP
#SECTION ESTABLISHED
#SECTION RELATED
SECTION NEW
SSH(ACCEPT) net $FW
Ping(ACCEPT) net $FW

View File

@@ -0,0 +1,213 @@
###############################################################################
#
# Shorewall Version 4 -- /etc/shorewall/shorewall.conf
#
# For information about the settings in this file, type "man shorewall.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
###############################################################################
STARTUP_ENABLED=Yes
###############################################################################
# V E R B O S I T Y
###############################################################################
VERBOSITY=1
###############################################################################
# L O G G I N G
###############################################################################
LOGFILE=
STARTUP_LOG=/var/log/shorewall-init.log
LOG_VERBOSITY=2
LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGALLNEW=
BLACKLIST_LOGLEVEL=
MACLIST_LOG_LEVEL=info
TCP_FLAGS_LOG_LEVEL=info
SMURF_LOG_LEVEL=info
LOG_MARTIANS=Yes
###############################################################################
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
###############################################################################
IPTABLES=
IP=
TC=
IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
SUBSYSLOCK=
MODULESDIR=
CONFIG_PATH=/etc/shorewall:/usr/share/shorewall
RESTOREFILE=
IPSECFILE=zones
LOCKFILE=
###############################################################################
# D E F A U L T A C T I O N S / M A C R O S
###############################################################################
DROP_DEFAULT="Drop"
REJECT_DEFAULT="Reject"
ACCEPT_DEFAULT="none"
QUEUE_DEFAULT="none"
NFQUEUE_DEFAULT="none"
###############################################################################
# R S H / R C P C O M M A N D S
###############################################################################
RSH_COMMAND='ssh ${root}@${system} ${command}'
RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
###############################################################################
# F I R E W A L L O P T I O N S
###############################################################################
IP_FORWARDING=On
ADD_IP_ALIASES=No
ADD_SNAT_ALIASES=No
RETAIN_ALIASES=No
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
CLAMPMSS=No
ROUTE_FILTER=No
DETECT_DNAT_IPADDRS=No
MUTEX_TIMEOUT=60
ADMINISABSENTMINDED=Yes
BLACKLISTNEWONLY=Yes
DELAYBLACKLISTLOAD=No
MODULE_SUFFIX=ko
DISABLE_IPV6=No
BRIDGING=No
DYNAMIC_ZONES=No
PKTTYPE=Yes
NULL_ROUTE_RFC1918=No
MACLIST_TABLE=filter
MACLIST_TTL=
SAVE_IPSETS=No
MAPOLDACTIONS=No
FASTACCEPT=Yes
IMPLICIT_CONTINUE=No
HIGH_ROUTE_MARKS=No
USE_ACTIONS=Yes
OPTIMIZE=15
EXPORTPARAMS=Yes
EXPAND_POLICIES=Yes
KEEP_RT_TABLES=No
DELETE_THEN_ADD=Yes
MULTICAST=No
DONT_LOAD=
AUTO_COMMENT=Yes
MANGLE_ENABLED=Yes
USE_DEFAULT_RT=No
RESTORE_DEFAULT_ROUTE=Yes
AUTOMAKE=No
WIDE_TC_MARKS=Yes
TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
REQUIRE_INTERFACE=Yes
FORWARD_CLEAR_MARK=Yes
COMPLETE=Yes
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################
BLACKLIST_DISPOSITION=DROP
MACLIST_DISPOSITION=REJECT
TCP_FLAGS_DISPOSITION=DROP
#LAST LINE -- DO NOT REMOVE

14
Samples/Universal/zones Normal file
View File

@@ -0,0 +1,14 @@
#
# Shorewall version 4 - Zones File
#
# For information about this file, type "man shorewall-zones"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-zones.html
#
###############################################################################
#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
net ip

View File

@@ -42,9 +42,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGRATE=
LOGBURST=
LOGLIMIT=
LOGALLNEW=
@@ -211,6 +209,8 @@ REQUIRE_INTERFACE=No
FORWARD_CLEAR_MARK=Yes
COMPLETE=No
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -42,9 +42,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGRATE=
LOGBURST=
LOGLIMIT=
LOGALLNEW=
@@ -211,6 +209,8 @@ REQUIRE_INTERFACE=No
FORWARD_CLEAR_MARK=Yes
COMPLETE=No
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -49,9 +49,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGRATE=
LOGBURST=
LOGLIMIT=
LOGALLNEW=
@@ -218,6 +216,8 @@ REQUIRE_INTERFACE=No
FORWARD_CLEAR_MARK=Yes
COMPLETE=No
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -0,0 +1,13 @@
#
# Shorewall version 4 - Interfaces File
#
# For information about entries in this file, type "man shorewall-interfaces"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-interfaces.html
#
###############################################################################
#ZONE INTERFACE BROADCAST OPTIONS
- lo - ignore
net all - dhcp,physical=+,routeback

14
Samples6/Universal/policy Normal file
View File

@@ -0,0 +1,14 @@
#
# Shorewall version 4 - Policy File
#
# For information about entries in this file, type "man shorewall-policy"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-policy.html
#
###############################################################################
#SOURCE DEST POLICY LOG LIMIT: CONNLIMIT:
# LEVEL BURST MASK
fw net ACCEPT
net all DROP

17
Samples6/Universal/rules Normal file
View File

@@ -0,0 +1,17 @@
#
# Shorewall version 4 - Rules File
#
# For information on the settings in this file, type "man shorewall-rules"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-rules.html
#
####################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME
# PORT PORT(S) DEST LIMIT GROUP
#SECTION ESTABLISHED
#SECTION RELATED
SECTION NEW
SSH(ACCEPT) net $FW
Ping(ACCEPT) net $FW

View File

@@ -0,0 +1,168 @@
###############################################################################
#
# Shorewall Version 4 -- /etc/shorewall6/shorewall6.conf
#
# For information about the settings in this file, type "man shorewall6.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
###############################################################################
STARTUP_ENABLED=Yes
###############################################################################
# V E R B O S I T Y
###############################################################################
VERBOSITY=1
###############################################################################
# L O G G I N G
###############################################################################
LOGFILE=
STARTUP_LOG=/var/log/shorewall6-init.log
LOG_VERBOSITY=2
LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGALLNEW=
BLACKLIST_LOGLEVEL=
TCP_FLAGS_LOG_LEVEL=info
SMURF_LOG_LEVEL=info
###############################################################################
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
###############################################################################
IP6TABLES=
IP=
TC=
IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
SUBSYSLOCK=
MODULESDIR=
CONFIG_PATH=/usr/share/shorewall6:/usr/share/shorewall
RESTOREFILE=
LOCKFILE=
###############################################################################
# D E F A U L T A C T I O N S / M A C R O S
###############################################################################
DROP_DEFAULT="Drop"
REJECT_DEFAULT="Reject"
ACCEPT_DEFAULT="none"
QUEUE_DEFAULT="none"
NFQUEUE_DEFAULT="none"
###############################################################################
# R S H / R C P C O M M A N D S
###############################################################################
RSH_COMMAND='ssh ${root}@${system} ${command}'
RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
###############################################################################
# F I R E W A L L O P T I O N S
###############################################################################
IP_FORWARDING=Off
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
CLAMPMSS=No
MUTEX_TIMEOUT=60
ADMINISABSENTMINDED=Yes
BLACKLISTNEWONLY=Yes
MODULE_SUFFIX=ko
FASTACCEPT=Yes
IMPLICIT_CONTINUE=No
HIGH_ROUTE_MARKS=No
OPTIMIZE=15
EXPORTPARAMS=Yes
EXPAND_POLICIES=Yes
KEEP_RT_TABLES=Yes
DELETE_THEN_ADD=Yes
DONT_LOAD=
AUTO_COMMENT=Yes
MANGLE_ENABLED=Yes
AUTOMAKE=No
WIDE_TC_MARKS=Yes
TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
OPTIMIZE_ACCOUNTING=No
DYNAMIC_BLACKLIST=Yes
LOAD_HELPERS_ONLY=Yes
REQUIRE_INTERFACE=Yes
FORWARD_CLEAR_MARK=Yes
COMPLETE=Yes
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################
BLACKLIST_DISPOSITION=DROP
TCP_FLAGS_DISPOSITION=DROP
#LAST LINE -- DO NOT REMOVE

14
Samples6/Universal/zones Normal file
View File

@@ -0,0 +1,14 @@
#
# Shorewall version 4 - Zones File
#
# For information about this file, type "man shorewall-zones"
#
# The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-zones.html
#
###############################################################################
#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
net ip

View File

@@ -40,9 +40,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGRATE=
LOGBURST=
LOGLIMIT=
LOGALLNEW=
@@ -159,6 +157,8 @@ REQUIRE_INTERFACE=No
FORWARD_CLEAR_MARK=Yes
COMPLETE=No
##############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -40,9 +40,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGRATE=
LOGBURST=
LOGLIMIT=
LOGALLNEW=
@@ -159,6 +157,8 @@ REQUIRE_INTERFACE=No
FORWARD_CLEAR_MARK=Yes
COMPLETE=No
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -1,6 +1,6 @@
###############################################################################
#
# Shorewall version 3.4 - Sample shorewall.conf for one-interface configuration.
# Shorewall version 4.4 - Sample shorewall.conf for one-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
@@ -40,9 +40,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGRATE=
LOGBURST=
LOGLIMIT=
LOGALLNEW=
@@ -159,6 +157,8 @@ REQUIRE_INTERFACE=No
FORWARD_CLEAR_MARK=Yes
COMPLETE=No
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -93,7 +93,11 @@ 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
( . /usr/share/$PRODUCT/lib.base
mutex_on
${VARDIR}/firewall -V0 $COMMAND $IFACE || echo_notdone
mutex_off
)
fi
done

View File

@@ -84,7 +84,20 @@ shorewall_start () {
VARDIR=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then
${VARDIR}/firewall stop || echo_notdone
#
# Run in a sub-shell to avoid name collisions
#
(
. /usr/share/$product/lib.base
#
# Get mutex so the firewall state is stable
#
mutex_on
if ! ${VARDIR}/firewall status > /dev/null 2>&1; then
${VARDIR}/firewall stop || echo_notdone
fi
mutex_off
)
fi
done
@@ -103,7 +116,11 @@ shorewall_stop () {
VARDIR=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then
${VARDIR}/firewall clear || echo_notdone
( . /usr/share/$product/lib.base
mutex_on
${VARDIR}/firewall clear || echo_notdone
mutex_off
)
fi
done

View File

@@ -55,15 +55,17 @@ fi
# Initialize the firewall
shorewall_start () {
local product
local vardir
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
for PRODUCT in $PRODUCTS; do
VARDIR=/var/lib/$PRODUCT
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
if [ -x ${VARDIR}/firewall ]; then
if ! /sbin/$PRODUCT status > /dev/null 2>&1; then
${VARDIR}/firewall stop || echo_notdone
fi
fi
done
@@ -72,15 +74,15 @@ shorewall_start () {
# Clear the firewall
shorewall_stop () {
local product
local vardir
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
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

View File

@@ -23,7 +23,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.11.1
VERSION=4.4.13
usage() # $1 = exit status
{

View File

@@ -1,6 +1,6 @@
%define name shorewall-init
%define version 4.4.11
%define release 1
%define version 4.4.13
%define release 0base
Summary: Shorewall-init adds functionality to Shoreline Firewall (Shorewall).
Name: %{name}
@@ -99,8 +99,34 @@ fi
%doc COPYING changelog.txt releasenotes.txt
%changelog
* Wed Jul 14 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-1
* Mon Sep 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0base
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0RC1
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta6
* Mon Sep 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta5
* Sat Sep 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta4
* Mon Aug 30 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta3
* Wed Aug 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta2
* Wed Aug 18 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta1
* Sun Aug 15 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0base
* Fri Aug 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0RC1
* Sun Aug 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta4
* Sat Jul 31 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta3
* Sun Jul 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta2
* Wed Jul 21 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta1
* Fri Jul 09 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0base
* Mon Jul 05 2010 Tom Eastep tom@shorewall.net

View File

@@ -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.11.1
VERSION=4.4.13
usage() # $1 = exit status
{

View File

@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.11.1
VERSION=4.4.13
usage() # $1 = exit status
{

View File

@@ -628,19 +628,13 @@ case "$COMMAND" in
shift
start_command $@
;;
stop|clear)
stop|reset|clear)
[ $# -ne 1 ] && usage 1
verify_firewall_script
[ -n "$nolock" ] || mutex_on
run_it $g_firewall $debugging $COMMAND
[ -n "$nolock" ] || mutex_off
;;
reset)
verify_firewall_script
[ -n "$nolock" ] || mutex_on
run_it $SHOREWALL_SHELL $g_firewall $debugging $@
[ -n "$nolock" ] || mutex_off
;;
restart)
shift
restart_command

View File

@@ -1,6 +1,6 @@
%define name shorewall-lite
%define version 4.4.11
%define release 1
%define version 4.4.13
%define release 0base
Summary: Shoreline Firewall Lite is an iptables-based firewall for Linux systems.
Name: %{name}
@@ -102,8 +102,34 @@ fi
%doc COPYING changelog.txt releasenotes.txt
%changelog
* Wed Jul 14 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-1
* Mon Sep 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0base
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0RC1
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta6
* Mon Sep 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta5
* Sat Sep 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta4
* Mon Aug 30 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta3
* Wed Aug 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta2
* Wed Aug 18 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta1
* Sun Aug 15 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0base
* Fri Aug 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0RC1
* Sun Aug 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta4
* Sat Jul 31 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta3
* Sun Jul 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta2
* Wed Jul 21 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta1
* Fri Jul 09 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0base
* Mon Jul 05 2010 Tom Eastep tom@shorewall.net

View File

@@ -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.11.1
VERSION=4.4.13
usage() # $1 = exit status
{

View File

@@ -35,7 +35,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_accounting );
our @EXPORT_OK = qw( );
our $VERSION = '4.4.7';
our $VERSION = '4.4.13';
#
# Called by the compiler to [re-]initialize this module's state
@@ -52,7 +52,7 @@ sub process_accounting_rule( ) {
our $jumpchainref;
my ($action, $chain, $source, $dest, $proto, $ports, $sports, $user, $mark ) = split_line1 1, 9, 'Accounting File';
my ($action, $chain, $source, $dest, $proto, $ports, $sports, $user, $mark, $ipsec ) = split_line1 1, 10, 'Accounting File';
if ( $action eq 'COMMENT' ) {
process_comment;
@@ -61,6 +61,16 @@ sub process_accounting_rule( ) {
our $disposition = '';
sub reserved_chain_name($) {
$_[0] =~ /^acc(?:ount(?:ing|out)|ipsecin|ipsecout)$/;
}
sub ipsec_chain_name($) {
if ( $_[0] =~ /^accipsec(in|out)$/ ) {
$1;
}
}
sub check_chain( $ ) {
my $chainref = shift;
fatal_error "A non-accounting chain ($chainref->{name}) may not appear in the accounting file" if $chainref->{policy};
@@ -72,10 +82,11 @@ sub process_accounting_rule( ) {
sub jump_to_chain( $ ) {
my $jumpchain = $_[0];
$jumpchainref = ensure_accounting_chain( $jumpchain );
fatal_error "Jumps to the $jumpchain chain are not allowed" if reserved_chain_name( $jumpchain );
$jumpchainref = ensure_accounting_chain( $jumpchain, 0 );
check_chain( $jumpchainref );
$disposition = $jumpchain;
"-j $jumpchain";
$jumpchain;
}
my $target = '';
@@ -86,16 +97,19 @@ sub process_accounting_rule( ) {
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} );
my $rule2 = 0;
my $jump = 0;
unless ( $action eq 'COUNT' ) {
if ( $action eq 'DONE' ) {
$target = '-j RETURN';
$target = 'RETURN';
} else {
( $action, my $cmd ) = split /:/, $action;
if ( $cmd ) {
if ( $cmd eq 'COUNT' ) {
$rule2=1;
} elsif ( $cmd ne 'JUMP' ) {
$rule2 = 1;
} elsif ( $cmd eq 'JUMP' ) {
$jump = 1;
} else {
accounting_error;
}
}
@@ -137,7 +151,31 @@ sub process_accounting_rule( ) {
$dest = ALLIP if $dest eq 'any' || $dest eq 'all';
}
my $chainref = ensure_accounting_chain $chain;
my $chainref = $filter_table->{$chain};
my $dir;
if ( ! $chainref ) {
$chainref = ensure_accounting_chain $chain, 0;
$dir = ipsec_chain_name( $chain );
if ( $ipsec ne '-' ) {
if ( $dir ) {
$rule .= do_ipsec( $dir, $ipsec );
$chainref->{ipsec} = $dir;
} else {
fatal_error "Adding an IPSEC rule to an unreferenced accounting chain is not allowed";
}
} else {
warning_message "Adding rule to unreferenced accounting chain $chain" unless reserved_chain_name( $chain );
$chainref->{ipsec} = $dir;
}
} elsif ( $ipsec ne '-' ) {
$dir = $chainref->{ipsec};
fatal_error "Adding an IPSEC rule into a non-IPSEC chain is not allowed" unless $dir;
$rule .= do_ipsec( $dir , $ipsec );
}
$restriction = $dir eq 'in' ? INPUT_RESTRICT : OUTPUT_RESTRICT if $dir;
expand_rule
$chainref ,
@@ -151,6 +189,22 @@ sub process_accounting_rule( ) {
$disposition ,
'' ;
if ( $rule2 || $jump ) {
if ( $chainref->{ipsec} ) {
if ( $jumpchainref->{ipsec} ) {
fatal_error "IPSEC in/out mismatch on chains $chain and $jumpchainref->{name}";
} else {
fatal_error "$jumpchainref->{name} is not an IPSEC chain" if keys %{$jumpchainref->{references}} > 1;
$jumpchainref->{ipsec} = $chainref->{ipsec};
}
} elsif ( $jumpchainref->{ipsec} ) {
fatal_error "Jump from a non-IPSEC chain to an IPSEC chain not allowed";
} else {
$jumpchainref->{ipsec} = $chainref->{ipsec};
}
}
if ( $rule2 ) {
expand_rule
$jumpchainref ,
@@ -178,8 +232,6 @@ sub setup_accounting() {
$nonEmpty |= process_accounting_rule while read_a_line;
fatal_error "Accounring rules are isolated" if $nonEmpty && ! $filter_table->{accounting};
clear_comment;
if ( have_bridges ) {
@@ -192,13 +244,28 @@ sub setup_accounting() {
if ( $filter_table->{accountout} ) {
add_jump( $filter_table->{OUTPUT}, 'accountout', 0, '', 0, 0 );
}
} else {
if ( $filter_table->{accounting} ) {
for my $chain ( qw/INPUT FORWARD OUTPUT/ ) {
add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 );
}
} elsif ( $filter_table->{accounting} ) {
for my $chain ( qw/INPUT FORWARD OUTPUT/ ) {
add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 );
}
}
if ( $filter_table->{accipsecin} ) {
for my $chain ( qw/INPUT FORWARD/ ) {
add_jump( $filter_table->{$chain}, 'accipsecin', 0, '', 0, 0 );
}
}
if ( $filter_table->{accipsecout} ) {
for my $chain ( qw/FORWARD OUTPUT/ ) {
add_jump( $filter_table->{$chain}, 'accipsecout', 0, '', 0, 0 );
}
}
for ( accounting_chainrefs ) {
warning_message "Accounting chain $_->{name} has no references" unless keys %{$_->{references}};
}
}
1;

View File

@@ -58,7 +58,7 @@ our @EXPORT = qw( merge_levels
$macro_commands
);
our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_11';
our $VERSION = '4.4_13';
#
# Used Actions. Each action that is actually used has an entry with value 1.
@@ -179,9 +179,27 @@ sub find_macro( $ )
#
sub split_action ( $ ) {
my $action = $_[0];
my $target = '';
my $max = 3;
#
# The following rather grim RE, when matched, breaks the action into two parts:
#
# basicaction(param)
# logging part (may be empty)
#
# The param may contain one or more ':' characters
#
if ( $action =~ /^([^(:]+\(.*?\))(:(.*))?$/ ) {
$target = $1;
$action = $2 ? $3 : '';
$max = 2;
}
my @a = split( /:/ , $action, 4 );
fatal_error "Invalid ACTION ($action)" if ( $action =~ /::/ ) || ( @a > 3 );
( shift @a, join ":", @a );
fatal_error "Invalid ACTION ($action)" if ( $action =~ /::/ ) || ( @a > $max );
$target = shift @a unless $target;
( $target, join ":", @a );
}
#
@@ -618,7 +636,7 @@ sub process_action( $$$$$$$$$$$ ) {
$source ,
$dest ,
'', #Original Dest
$action ? "-j $action" : '',
$action ,
$level ,
$action ,
'' );

File diff suppressed because it is too large Load Diff

View File

@@ -43,7 +43,7 @@ use Shorewall::Raw;
our @ISA = qw(Exporter);
our @EXPORT = qw( compiler );
our @EXPORT_OK = qw( $export );
our $VERSION = '4.4_10';
our $VERSION = '4.4_12';
our $export;
@@ -442,32 +442,37 @@ EOF
setup_forwarding( $family , 1 );
push_indent;
emit<<'EOF';
set_state "Started"
my $config_dir = $globals{CONFIGDIR};
emit<<"EOF";
set_state Started $config_dir
run_restored_exit
else
if [ $COMMAND = refresh ]; then
if [ \$COMMAND = refresh ]; then
chainlist_reload
EOF
setup_forwarding( $family , 0 );
emit<<'EOF';
emit<<"EOF";
run_refreshed_exit
do_iptables -N shorewall
set_state "Started"
set_state Started $config_dir
else
setup_netfilter
conditionally_flush_conntrack
EOF
setup_forwarding( $family , 0 );
emit<<'EOF';
emit<<"EOF";
run_start_exit
do_iptables -N shorewall
set_state "Started"
set_state Started $config_dir
run_started_exit
fi
EOF
emit<<'EOF';
[ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall
fi

View File

@@ -114,6 +114,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
$product
$Product
$toolname
$command
$doing
$done
@@ -131,7 +132,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
Exporter::export_ok_tags('internal');
our $VERSION = '4.4_11';
our $VERSION = '4.4_13';
#
# describe the current command, it's present progressive, and it's completion.
@@ -218,6 +219,7 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
RECENT_MATCH => 'Recent Match',
OWNER_MATCH => 'Owner Match',
IPSET_MATCH => 'Ipset Match',
OLD_IPSET_MATCH => 'Old Ipset Match',
CONNMARK => 'CONNMARK Target',
XCONNMARK => 'Extended CONNMARK Target',
CONNMARK_MATCH => 'Connmark Match',
@@ -250,6 +252,7 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
TPROXY_TARGET => 'TPROXY Target',
FLOW_FILTER => 'Flow Classifier',
FWMARK_RT_MASK => 'fwmark route mask',
MARK_ANYWHERE => 'Mark in any table',
CAPVERSION => 'Capability Version',
KERNELVERSION => 'Kernel Version',
);
@@ -337,14 +340,15 @@ sub initialize( $ ) {
#
%globals = ( SHAREDIR => '/usr/share/shorewall' ,
SHAREDIRPL => '/usr/share/shorewall/' ,
CONFDIR => '/etc/shorewall',
CONFDIR => '/etc/shorewall', # Run-time configuration directory
CONFIGDIR => '', # Compile-time configuration directory (location of $product.conf)
LOGPARMS => '',
TC_SCRIPT => '',
EXPORT => 0,
STATEMATCH => '-m state --state',
UNTRACKED => 0,
VERSION => "4.4.11.1",
CAPVERSION => 40411 ,
VERSION => "4.4.13",
CAPVERSION => 40413 ,
);
#
@@ -362,6 +366,7 @@ sub initialize( $ ) {
LOGFILE => undef,
LOGFORMAT => undef,
LOGTAGONLY => undef,
LOGLIMIT => undef,
LOGRATE => undef,
LOGBURST => undef,
LOGALLNEW => undef,
@@ -465,6 +470,7 @@ sub initialize( $ ) {
LOAD_HELPERS_ONLY => undef,
REQUIRE_INTERFACE => undef,
FORWARD_CLEAR_MARK => undef,
COMPLETE => undef,
#
# Packet Disposition
#
@@ -509,6 +515,7 @@ sub initialize( $ ) {
LOGFILE => undef,
LOGFORMAT => undef,
LOGTAGONLY => undef,
LOGLIMIT => undef,
LOGRATE => undef,
LOGBURST => undef,
LOGALLNEW => undef,
@@ -524,6 +531,7 @@ sub initialize( $ ) {
IP => undef,
TC => undef,
IPSET => undef,
PERL => undef,
#
#PATH is inherited
#
@@ -587,6 +595,7 @@ sub initialize( $ ) {
LOAD_HELPERS_ONLY => undef,
REQUIRE_INTERFACE => undef,
FORWARD_CLEAR_MARK => undef,
COMPLETE => undef,
#
# Packet Disposition
#
@@ -636,6 +645,7 @@ sub initialize( $ ) {
RECENT_MATCH => undef,
OWNER_MATCH => undef,
IPSET_MATCH => undef,
OLD_IPSET_MATCH => undef,
CONNMARK => undef,
XCONNMARK => undef,
CONNMARK_MATCH => undef,
@@ -668,6 +678,7 @@ sub initialize( $ ) {
OLD_HL_MATCH => undef,
FLOW_FILTER => undef,
FWMARK_RT_MASK => undef,
MARK_ANYWHERE => undef,
CAPVERSION => undef,
KERNELVERSION => undef,
);
@@ -1468,10 +1479,12 @@ sub split_list1( $$ ) {
fatal_error "Invalid $type list ($list)" if $count > 1;
push @list2 , $_;
} else {
s/\(//;
$element = $_;
}
} elsif ( ( $count = tr/)/)/ ) > 0 ) {
fatal_error "Invalid $type list ($list)" unless $element && $count == 1;
s/\)//;
push @list2, join ',', $element, $_;
$element = '';
} elsif ( $element ) {
@@ -2316,7 +2329,11 @@ sub Comments() {
}
sub Hashlimit_Match() {
have_capability 'OLD_HL_MATCH' || qt1( "$iptables -A $sillyname -m hashlimit --hashlimit-upto 3/min --hashlimit-burst 3 --hashlimit-name $sillyname --hashlimit-mode srcip -j ACCEPT" );
if ( qt1( "$iptables -A $sillyname -m hashlimit --hashlimit-upto 3/min --hashlimit-burst 3 --hashlimit-name $sillyname --hashlimit-mode srcip -j ACCEPT" ) ) {
! ( $capabilities{OLD_HL_MATCH} = 0 );
} else {
have_capability 'OLD_HL_MATCH';
}
}
sub Old_Hashlimit_Match() {
@@ -2363,7 +2380,7 @@ sub Raw_Table() {
qt1( "$iptables -t raw -L -n" );
}
sub IPSet_Match() {
sub Old_IPSet_Match() {
my $ipset = $config{IPSET} || 'ipset';
my $result = 0;
@@ -2375,7 +2392,31 @@ sub IPSet_Match() {
if ( qt( "$ipset -N $sillyname iphash" ) ) {
if ( qt1( "$iptables -A $sillyname -m set --set $sillyname src -j ACCEPT" ) ) {
qt1( "$iptables -D $sillyname -m set --set $sillyname src -j ACCEPT" );
$result = 1;
$result = $capabilities{IPSET_MATCH} = 1;
}
qt( "$ipset -X $sillyname" );
}
}
$result;
}
sub IPSet_Match() {
my $ipset = $config{IPSET} || 'ipset';
my $result = 0;
$ipset = which $ipset unless $ipset =~ '/';
if ( $ipset && -x $ipset ) {
qt( "$ipset -X $sillyname" );
if ( qt( "$ipset -N $sillyname iphash" ) ) {
if ( qt1( "$iptables -A $sillyname -m set --match-set $sillyname src -j ACCEPT" ) ) {
qt1( "$iptables -D $sillyname -m set --match-set $sillyname src -j ACCEPT" );
$result = ! ( $capabilities{OLD_IPSET_MATCH} = 0 );
} else {
$result = have_capability 'OLD_IPSET_MATCH';
}
qt( "$ipset -X $sillyname" );
@@ -2437,6 +2478,10 @@ sub Fwmark_Rt_Mask() {
$ip && system( "$ip rule add help 2>&1 | grep -q /MASK" ) == 0;
}
sub Mark_Anywhere() {
qt1( "$iptables -A $sillyname -j MARK --set-mark 5" );
}
our %detect_capability =
( ADDRTYPE => \&Addrtype,
CLASSIFY_TARGET => \&Classify_Target,
@@ -2456,6 +2501,7 @@ our %detect_capability =
IPP2P_MATCH => \&Ipp2p_Match,
IPRANGE_MATCH => \&IPRange_Match,
IPSET_MATCH => \&IPSet_Match,
OLD_IPSET_MATCH => \&Old_IPSet_Match,
KLUDGEFREE => \&Kludgefree,
LENGTH_MATCH => \&Length_Match,
LOGMARK_TARGET => \&Logmark_Target,
@@ -2463,6 +2509,7 @@ our %detect_capability =
MANGLE_ENABLED => \&Mangle_Enabled,
MANGLE_FORWARD => \&Mangle_Forward,
MARK => \&Mark,
MARK_ANYWHERE => \&Mark_Anywhere,
MULTIPORT => \&Multiport,
NAT_ENABLED => \&Nat_Enabled,
NEW_CONNTRACK_MATCH => \&New_Conntrack_Match,
@@ -2606,6 +2653,8 @@ sub determine_capabilities() {
$capabilities{LOG_TARGET} = detect_capability( 'LOG_TARGET' );
$capabilities{LOGMARK_TARGET} = detect_capability( 'LOGMARK_TARGET' );
$capabilities{FLOW_FILTER} = detect_capability( 'FLOW_FILTER' );
$capabilities{FWMARK_RT_MASK} = detect_capability( 'FWMARK_RT_MASK' );
$capabilities{MARK_ANYWHERE} = detect_capability( 'MARK_ANYWHERE' );
qt1( "$iptables -F $sillyname" );
@@ -2683,6 +2732,9 @@ sub process_shorewall_conf() {
my $file = find_file "$product.conf";
if ( -f $file ) {
$globals{CONFIGDIR} = $file;
$globals{CONFIGDIR} =~ s/$product.conf//;
if ( -r _ ) {
open_file $file;
@@ -2847,7 +2899,60 @@ sub get_configuration( $ ) {
$globals{STATEMATCH} = '-m conntrack --ctstate' if have_capability 'CONNTRACK_MATCH';
if ( $config{LOGRATE} || $config{LOGBURST} ) {
if ( my $rate = $config{LOGLIMIT} ) {
my $limit;
if ( $rate =~ /^[sd]:/ ) {
require_capability 'HASHLIMIT_MATCH', 'Per-ip log rate limiting' , 's';
$limit = "-m hashlimit ";
my $match = have_capability( 'OLD_HL_MATCH' ) ? 'hashlimit' : 'hashlimit-upto';
my $units;
if ( $rate =~ /^[sd]:((\d+)(\/(sec|min|hour|day))):(\d+)$/ ) {
fatal_error "Invalid rate ($1)" unless $2;
fatal_error "Invalid burst value ($5)" unless $5;
$limit .= "--$match $1 --hashlimit-burst $5 --hashlimit-name lograte --hashlimit-mode ";
$units = $4;
} elsif ( $rate =~ /^[sd]:((\d+)(\/(sec|min|hour|day))?)$/ ) {
fatal_error "Invalid rate ($1)" unless $2;
$limit .= "--$match $1 --hashlimit-name lograte --hashlimit-mode ";
$units = $4;
} else {
fatal_error "Invalid rate ($rate)";
}
$limit .= $rate =~ /^s:/ ? 'srcip ' : 'dstip ';
if ( $units && $units ne 'sec' ) {
my $expire = 60000; # 1 minute in milliseconds
if ( $units ne 'min' ) {
$expire *= 60; #At least an hour
$expire *= 24 if $units eq 'day';
}
$limit .= "--hashlimit-htable-expire $expire ";
}
} elsif ( $rate =~ /^((\d+)(\/(sec|min|hour|day))):(\d+)$/ ) {
fatal_error "Invalid rate ($1)" unless $2;
fatal_error "Invalid burst value ($5)" unless $5;
$limit = "-m limit --limit $1 --limit-burst $5 ";
} elsif ( $rate =~ /^(\d+)(\/(sec|min|hour|day))?$/ ) {
fatal_error "Invalid rate (${1}${2})" unless $1;
$limit = "-m limit --limit $rate ";
} else {
fatal_error "Invalid rate ($rate)";
}
$globals{LOGLIMIT} = $limit;
warning_message "LOGRATE Ignored when LOGLIMIT is specified" if $config{LOGRATE};
warning_message "LOGBURST Ignored when LOGLIMIT is specified" if $config{LOGBURST};
} elsif ( $config{LOGRATE} || $config{LOGBURST} ) {
if ( defined $config{LOGRATE} ) {
fatal_error"Invalid LOGRATE ($config{LOGRATE})" unless $config{LOGRATE} =~ /^\d+\/(second|minute)$/;
}
@@ -2966,7 +3071,7 @@ sub get_configuration( $ ) {
default_yes_no 'AUTO_COMMENT' , 'Yes';
default_yes_no 'MULTICAST' , '';
default_yes_no 'MARK_IN_FORWARD_CHAIN' , '';
default_yes_no 'MANGLE_ENABLED' , 'Yes';
default_yes_no 'MANGLE_ENABLED' , have_capability 'MANGLE_ENABLED' ? 'Yes' : '';
default_yes_no 'NULL_ROUTE_RFC1918' , '';
default_yes_no 'USE_DEFAULT_RT' , '';
default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes';
@@ -2978,6 +3083,7 @@ sub get_configuration( $ ) {
default_yes_no 'DYNAMIC_BLACKLIST' , 'Yes';
default_yes_no 'REQUIRE_INTERFACE' , '';
default_yes_no 'FORWARD_CLEAR_MARK' , have_capability 'MARK' ? 'Yes' : '';
default_yes_no 'COMPLETE' , '';
require_capability 'MARK' , 'FOREWARD_CLEAR_MARK=Yes', 's', if $config{FORWARD_CLEAR_MARK};
@@ -2988,7 +3094,12 @@ sub get_configuration( $ ) {
if ( $config{PROVIDER_OFFSET} ) {
$config{PROVIDER_OFFSET} = $config{MASK_BITS} if $config{PROVIDER_OFFSET} < $config{MASK_BITS};
fatal_error 'PROVIDER_BITS + PROVIDER_OFFSET > 32' if $config{PROVIDER_BITS} + $config{PROVIDER_OFFSET} > 32;
fatal_error 'PROVIDER_BITS + PROVIDER_OFFSET > 31' if $config{PROVIDER_BITS} + $config{PROVIDER_OFFSET} > 31;
$globals{EXCLUSION_MASK} = 1 << ( $config{PROVIDER_OFFSET} + $config{PROVIDER_BITS} );
} elsif ( $config{MASK_BITS} >= $config{PROVIDER_BITS} ) {
$globals{EXCLUSION_MASK} = 1 << $config{MASK_BITS};
} else {
$globals{EXCLUSION_MASK} = 1 << $config{PROVIDER_BITS};
}
$globals{TC_MAX} = make_mask( $config{TC_BITS} );
@@ -2996,6 +3107,12 @@ sub get_configuration( $ ) {
$globals{PROVIDER_MIN} = 1 << $config{PROVIDER_OFFSET};
$globals{PROVIDER_MASK} = make_mask( $config{PROVIDER_BITS} ) << $config{PROVIDER_OFFSET};
if ( ( my $userbits = $config{PROVIDER_OFFSET} - $config{TC_BITS} ) > 0 ) {
$globals{USER_MASK} = make_mask( $userbits ) << $config{TC_BITS};
} else {
$globals{USER_MASK} = 0;
}
if ( defined ( $val = $config{ZONE2ZONE} ) ) {
fatal_error "Invalid ZONE2ZONE value ( $val )" unless $val =~ /^[2-]$/;
} else {

View File

@@ -73,7 +73,7 @@ our @EXPORT = qw( ALLIPv4
validate_icmp6
);
our @EXPORT_OK = qw( );
our $VERSION = '4.4_11';
our $VERSION = '4.4_12';
#
# Some IPv4/6 useful stuff
@@ -87,6 +87,7 @@ our $validate_address;
our $validate_net;
our $validate_range;
our $validate_host;
our $family;
use constant { ALLIPv4 => '0.0.0.0/0' ,
ALLIPv6 => '::/0' ,
@@ -123,8 +124,8 @@ sub valid_4address( $ ) {
my @address = split /\./, $address;
return 0 unless @address == 4;
for my $a ( @address ) {
return 0 unless $a =~ /^\d+$/ && $a < 256;
for ( @address ) {
return 0 unless /^\d+$/ && $_ < 256;
}
1;
@@ -157,8 +158,8 @@ sub decodeaddr( $ ) {
my $result = shift @address;
for my $a ( @address ) {
$result = ( $result << 8 ) | $a;
for ( @address ) {
$result = ( $result << 8 ) | $_;
}
$result;
@@ -292,6 +293,11 @@ sub resolve_proto( $ ) {
$number = numeric_value ( $proto );
defined $number && $number <= 65535 ? $number : undef;
} else {
#
# Allow 'icmp' as a synonym for 'ipv6-icmp' in IPv6 compilations
#
$proto= 'ipv6-icmp' if $proto eq 'icmp' && $family == F_IPV6;
defined( $number = $nametoproto{$proto} ) ? $number : scalar getprotobyname $proto;
}
}
@@ -332,7 +338,7 @@ sub validate_portpair( $$ ) {
my @ports = split /:/, $portpair, 2;
$_ = validate_port( $proto, $_) for ( @ports );
$_ = validate_port( $proto, $_) for ( grep $_, @ports );
if ( @ports == 2 ) {
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
@@ -439,7 +445,7 @@ sub expand_port_range( $$ ) {
#
# Validate the ports
#
( $first , $last ) = ( validate_port( $proto, $first ) , validate_port( $proto, $last ) );
( $first , $last ) = ( validate_port( $proto, $first || 1 ) , validate_port( $proto, $last ) );
$last++; #Increment last address for limit testing.
#
@@ -682,7 +688,7 @@ sub validate_host ($$ ) {
# able to re-initialize its dependent modules' state.
#
sub initialize( $ ) {
my $family = shift;
$family = shift;
if ( $family == F_IPV4 ) {
$allip = ALLIPv4;

View File

@@ -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_11';
our $VERSION = '4.4_13';
our @addresses_to_add;
our %addresses_to_add;
@@ -49,56 +49,6 @@ sub initialize() {
%addresses_to_add = ();
}
#
# Handle IPSEC Options in a masq record
#
sub do_ipsec_options($)
{
my %validoptions = ( strict => NOTHING,
next => NOTHING,
reqid => NUMERIC,
spi => NUMERIC,
proto => IPSECPROTO,
mode => IPSECMODE,
"tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK,
);
my $list=$_[0];
my $options = '-m policy --pol ipsec --dir out ';
my $fmt;
for my $e ( split_list $list, 'option' ) {
my $val = undef;
my $invert = '';
if ( $e =~ /([\w-]+)!=(.+)/ ) {
$val = $2;
$e = $1;
$invert = '! ';
} elsif ( $e =~ /([\w-]+)=(.+)/ ) {
$val = $2;
$e = $1;
}
$fmt = $validoptions{$e};
fatal_error "Invalid Option ($e)" unless $fmt;
if ( $fmt eq NOTHING ) {
fatal_error "Option \"$e\" does not take a value" if defined $val;
} else {
fatal_error "Missing value for option \"$e\"" unless defined $val;
fatal_error "Invalid value ($val) for option \"$e\"" unless $val =~ /^($fmt)$/;
}
$options .= $invert;
$options .= "--$e ";
$options .= "$val " if defined $val;
}
$options;
}
#
# Process a single rule from the the masq file
#
@@ -153,11 +103,11 @@ sub process_one_masq( )
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 ';
$baserule .= do_ipsec_options 'out', 'ipsec', '';
} elsif ( $ipsec =~ /^no$/i ) {
$baserule .= '-m policy --pol none --dir out ';
$baserule .= do_ipsec_options 'out', 'none', '';
} else {
$baserule .= do_ipsec_options $ipsec;
$baserule .= do_ipsec_options 'out', 'ipsec', $ipsec;
}
} elsif ( have_ipsec ) {
$baserule .= '-m policy --pol none --dir out ';
@@ -175,7 +125,7 @@ sub process_one_masq( )
for my $fullinterface (split_list $interfacelist, 'interface' ) {
my $rule = '';
my $target = '-j MASQUERADE ';
my $target = 'MASQUERADE ';
#
# Isolate and verify the interface part
#
@@ -221,7 +171,7 @@ sub process_one_masq( )
fatal_error "The SAME target is no longer supported";
} elsif ( $addresses eq 'detect' ) {
my $variable = get_interface_address $interface;
$target = "-j SNAT --to-source $variable";
$target = "SNAT --to-source $variable";
if ( interface_is_optional $interface ) {
add_commands( $chainref,
@@ -231,13 +181,13 @@ sub process_one_masq( )
$detectaddress = 1;
}
} elsif ( $addresses eq 'NONAT' ) {
$target = '-j RETURN';
$target = 'RETURN';
$add_snat_aliases = 0;
} else {
my $addrlist = '';
for my $addr ( split_list $addresses , 'address' ) {
if ( $addr =~ /^.*\..*\..*\./ ) {
$target = '-j SNAT ';
$target = 'SNAT ';
my ($ipaddr, $rest) = split ':', $addr;
if ( $ipaddr =~ /^(.+)-(.+)$/ ) {
validate_range( $1, $2 );

View File

@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter);
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_11';
our $VERSION = '4.4_12';
# @policy_chains is a list of references to policy chains in the filter table
@@ -496,7 +496,14 @@ sub setup_syn_flood_chains() {
my $level = $chainref->{loglevel};
my $synchainref = new_chain 'filter' , syn_flood_chain $chainref;
add_rule $synchainref , "${limit}-j RETURN";
log_rule_limit $level , $synchainref , $chainref->{name} , 'DROP', '-m limit --limit 5/min --limit-burst 5 ' , '' , 'add' , ''
log_rule_limit( $level ,
$synchainref ,
$chainref->{name} ,
'DROP',
$globals{LOGLIMIT} || '-m limit --limit 5/min --limit-burst 5 ' ,
'' ,
'add' ,
'' )
if $level ne '';
add_rule $synchainref, '-j DROP';
}

View File

@@ -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_11';
our $VERSION = '4.4_13';
use constant { LOCAL_TABLE => 255,
MAIN_TABLE => 254,
@@ -275,7 +275,7 @@ sub add_a_provider( ) {
require_capability 'REALM_MATCH', "Configuring multiple providers through one interface", "s";
}
fatal_error "Unknown Interface ($interface)" unless known_interface $interface;
fatal_error "Unknown Interface ($interface)" unless known_interface( $interface, 1 );
fatal_error "A bridge port ($interface) may not be configured as a provider interface" if port_to_bridge $interface;
my $physical = get_physical $interface;
@@ -845,54 +845,99 @@ sub lookup_provider( $ ) {
#
sub handle_optional_interfaces( $ ) {
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';
my ( $interfaces, $wildcards ) = find_interfaces_by_option1 'optional';
if ( @$interfaces ) {
for my $interface ( @$interfaces ) {
my $provider = $provider_interfaces{$interface};
my $physical = get_physical $interface;
my $base = uc chain_base( $physical );
my $require = $config{REQUIRE_INTERFACE};
verify_required_interfaces( shift );
emit( '' );
emit( 'HAVE_INTERFACE=', '' ) if $require;
#
# Clear the '_IS_USABLE' variables
#
emit( join( '_', 'SW', uc chain_base( get_physical( $_ ) ) , 'IS_USABLE=' ) ) for @$interfaces;
if ( $config{REQUIRE_INTERFACE} ) {
emit( 'HAVE_INTERFACE=' );
emit( '' );
}
if ( $wildcards ) {
#
# We must consider all interfaces with an address in $family -- generate a list of such addresses.
#
emit( '',
'for interface in $(find_all_interfaces1); do',
);
if ( $provider ) {
#
# This interface is associated with a non-shared provider -- get the provider table entry
#
my $providerref = $providers{$provider};
push_indent;
emit ( 'case "$interface" in' );
push_indent;
} else {
emit '';
}
if ( $providerref->{gatewaycase} eq 'detect' ) {
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
} else {
emit qq(if interface_is_usable $physical; then);
}
for my $interface ( grep $provider_interfaces{$_}, @$interfaces ) {
my $provider = $provider_interfaces{$interface};
my $physical = get_physical $interface;
my $base = uc chain_base( $physical );
my $providerref = $providers{$provider};
emit( "$physical)" ), push_indent if $wildcards;
if ( $providerref->{gatewaycase} eq 'detect' ) {
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
} else {
#
# Not a provider interface
#
emit qq(if interface_is_usable $physical; then);
}
emit( ' HAVE_INTERFACE=Yes' ) if $config{REQUIRE_INTERFACE};
emit( ' HAVE_INTERFACE=Yes' ) if $require;
emit( " SW_${base}_IS_USABLE=Yes" ,
'else' ,
" SW_${base}_IS_USABLE=" ,
'fi' );
emit( ';;' ), pop_indent if $wildcards;
}
if ( $config{REQUIRE_INTERFACE} ) {
for my $interface ( grep ! $provider_interfaces{$_}, @$interfaces ) {
my $physical = get_physical $interface;
my $base = uc chain_base( $physical );
my $case = $physical;
my $wild = $case =~ s/\+$/*/;
if ( $wildcards ) {
emit( "$case)" );
push_indent;
if ( $wild ) {
emit( qq(if [ -z "\$SW_${base}_IS_USABLE" ]; then) );
push_indent;
emit ( 'if interface_is_usable $interface; then' );
} else {
emit ( "if interface_is_usable $physical; then" );
}
} else {
emit ( "if interface_is_usable $physical; then" );
}
emit ( ' HAVE_INTERFACE=Yes' ) if $require;
emit ( " SW_${base}_IS_USABLE=Yes" ,
'fi' );
if ( $wildcards ) {
pop_indent, emit( 'fi' ) if $wild;
emit( ';;' );
pop_indent;
}
}
if ( $wildcards ) {
emit( '*)' ,
' ;;'
);
pop_indent;
emit( 'esac' );
pop_indent;
emit('done' );
}
if ( $require ) {
emit( '',
'if [ -z "$HAVE_INTERFACE" ]; then' ,
' case "$COMMAND" in',
@@ -915,10 +960,10 @@ sub handle_optional_interfaces( $ ) {
);
}
$returnvalue = 1;
return 1;
}
$returnvalue;
verify_required_interfaces( shift );
}
#
@@ -957,14 +1002,14 @@ sub handle_stickiness( $ ) {
} else {
$rule1 = $_;
$rule1 =~ s/-j sticky/-m mark --mark $mark\/$mask -m recent --name $list --set/;
$rule2 = '';
}
$rule1 =~ s/-A tcpre //;
assert ( $rule1 =~ s/^-A // );
add_rule $chainref, $rule1;
if ( $rule2 ) {
$rule2 =~ s/-A tcpre //;
assert ( $rule2 =~ s/^-A // );
add_rule $chainref, $rule2;
}
}
@@ -984,14 +1029,14 @@ sub handle_stickiness( $ ) {
} else {
$rule1 = $_;
$rule1 =~ s/-j sticko/-m mark --mark $mark -m recent --name $list --rdest --set/;
$rule2 = '';
}
$rule1 =~ s/-A tcout //;
assert( $rule1 =~ s/-A // );
add_rule $chainref, $rule1;
if ( $rule2 ) {
$rule2 =~ s/-A tcout //;
$rule2 =~ s/-A //;
add_rule $chainref, $rule2;
}
}

View File

@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_notrack );
our @EXPORT_OK = qw( );
our $VERSION = '4.4_11';
our $VERSION = '4.4_13';
#
# Notrack
@@ -64,7 +64,7 @@ sub process_notrack_rule( $$$$$$ ) {
$source ,
$dest ,
'' ,
'-j NOTRACK' ,
'NOTRACK' ,
'' ,
'NOTRACK' ,
'' ;

View File

@@ -46,17 +46,12 @@ our @EXPORT = qw( process_tos
compile_stop_firewall
);
our @EXPORT_OK = qw( process_rule process_rule1 initialize );
our $VERSION = '4.4_11';
our $VERSION = '4.4_13';
#
# Set to one if we find a SECTION
#
our $sectioned;
our $macro_nest_level;
our $current_param;
our @param_stack;
our $family;
#
# When splitting a line in the rules file, don't pad out the columns with '-' if the first column contains one of these
#
@@ -76,7 +71,6 @@ my %rules_commands = ( COMMENT => 0,
#
sub initialize( $ ) {
$family = shift;
$sectioned = 0;
$macro_nest_level = 0;
$current_param = '';
@param_stack = ();
@@ -150,9 +144,9 @@ sub process_tos() {
$src ,
$dst ,
'' ,
"-j TOS --set-tos $tos" ,
'' ,
"TOS --set-tos $tos" ,
'' ,
'TOS' ,
'';
}
@@ -219,16 +213,19 @@ sub add_rule_pair( $$$$ ) {
sub setup_blacklist() {
my $hosts = find_hosts_by_option 'blacklist';
my $zones = find_zones_by_option 'blacklist', 'in';
my $zones1 = find_zones_by_option 'blacklist', 'out';
my $chainref;
my $chainref1;
my ( $level, $disposition ) = @config{'BLACKLIST_LOGLEVEL', 'BLACKLIST_DISPOSITION' };
my $target = $disposition eq 'REJECT' ? 'reject' : $disposition;
#
# We go ahead and generate the blacklist chain and jump to it, even if it turns out to be empty. That is necessary
# We go ahead and generate the blacklist chains and jump to them, even if they turn out to be empty. That is necessary
# for 'refresh' to work properly.
#
if ( @$hosts ) {
$chainref = dont_delete new_standard_chain 'blacklst';
if ( @$zones || @$zones1 ) {
$chainref = dont_delete new_standard_chain 'blacklst' if @$zones;
$chainref1 = dont_delete new_standard_chain 'blackout' if @$zones1;
if ( defined $level && $level ne '' ) {
my $logchainref = new_standard_chain 'blacklog';
@@ -252,8 +249,8 @@ sub setup_blacklist() {
while ( read_a_line ) {
if ( $first_entry ) {
unless ( @$hosts ) {
warning_message qq(The entries in $fn have been ignored because there are no 'blacklist' interfaces);
unless ( @$zones || @$zones1 ) {
warning_message qq(The entries in $fn have been ignored because there are no 'blacklist' zones);
close_file;
last BLACKLIST;
}
@@ -261,46 +258,64 @@ sub setup_blacklist() {
$first_entry = 0;
}
my ( $networks, $protocol, $ports ) = split_line 1, 3, 'blacklist file';
my ( $networks, $protocol, $ports, $options ) = split_line 1, 4, 'blacklist file';
expand_rule(
$chainref ,
NO_RESTRICT ,
do_proto( $protocol , $ports, '' ) ,
$networks ,
'' ,
'' ,
"-j $target" ,
'' ,
$disposition ,
'' );
$options = 'src' if $options eq '-';
my ( $to, $from ) = ( 0, 0 );
for ( split /,/, $options ) {
if ( $_ =~ /^(?:from|src)$/ ) {
if ( $from++ ) {
warning_message "Duplicate 'src' ignored";
} else {
if ( @$zones ) {
expand_rule(
$chainref ,
NO_RESTRICT ,
do_proto( $protocol , $ports, '' ) ,
$networks,
'',
'' ,
$target ,
'' ,
$target ,
'' );
} else {
warning_message '"src" entry ignored because there are no "blacklist in" zones';
}
}
} elsif ( $_ =~ /^(?:dst|to)$/ ) {
if ( $to++ ) {
warning_message "Duplicate 'dst' ignored";
} else {
if ( @$zones1 ) {
expand_rule(
$chainref1 ,
NO_RESTRICT ,
do_proto( $protocol , $ports, '' ) ,
'',
$networks,
'' ,
$target ,
'' ,
$target ,
'' );
} else {
warning_message '"dst" entry ignored because there are no "blacklist out" zones';
}
}
} else {
fatal_error "Invalid blacklist option($_)";
}
}
progress_message " \"$currentline\" added to blacklist";
}
warning_message q(There are interfaces or hosts with the 'blacklist' option but the 'blacklist' file is empty) if $first_entry && @$hosts;
} elsif ( @$hosts ) {
warning_message q(There are interfaces or hosts with the 'blacklist' option, but the 'blacklist' file is either missing or has zero size);
}
my $state = $config{BLACKLISTNEWONLY} ? $globals{UNTRACKED} ? "$globals{STATEMATCH} NEW,INVALID,UNTRACKED " : "$globals{STATEMATCH} NEW,INVALID " : '';
for my $hostref ( @$hosts ) {
my $interface = $hostref->[0];
my $ipsec = $hostref->[1];
my $policy = have_ipsec ? "-m policy --pol $ipsec --dir in " : '';
my $network = $hostref->[2];
my $source = match_source_net $network;
my $target = source_exclusion( $hostref->[3], $chainref );
for my $chain ( first_chains $interface ) {
add_jump $filter_table->{$chain} , $chainref, 0, "${source}${state}${policy}";
}
set_interface_option $interface, 'use_input_chain', 1;
set_interface_option $interface, 'use_forward_chain', 1;
progress_message " Blacklisting enabled on ${interface}:${network}";
warning_message q(There are interfaces or zones with the 'blacklist' option but the 'blacklist' file is empty) if $first_entry && @$zones;
} elsif ( @$zones || @$zones1 ) {
warning_message q(There are interfaces or zones with the 'blacklist' option, but the 'blacklist' file is either missing or has zero size);
}
}
}
@@ -434,7 +449,7 @@ sub add_common_rules() {
my $list;
my $chain;
my $state = $config{BLACKLISTNEWONLY} ? $globals{UNTRACKED} ? "$globals{STATEMATCH} NEW,INVALID,UNTRACKED " : "$globals{STATEMATCH} NEW,INVALID " : '';
my $state = $config{BLACKLISTNEWONLY} ? $globals{UNTRACKED} ? "-m state --state NEW,INVALID,UNTRACKED " : "$globals{STATEMATCH} NEW,INVALID " : '';
my $level = $config{BLACKLIST_LOGLEVEL};
my $rejectref = dont_move new_standard_chain 'reject';
@@ -512,7 +527,7 @@ sub add_common_rules() {
add_jump( $chainref, $smurfdest, 1, '-s ' . IPv6_MULTICAST . ' ' );
}
my $state = $globals{UNTRACKED} ? 'NEW,INVALID,UNTRACKED' : 'NEW,INVALID';
my $state = $globals{UNTRACKED} ? '-m state --state NEW,INVALID,UNTRACKED ' : "$globals{STATEMATCH} NEW,INVALID ";
for my $hostref ( @$list ) {
$interface = $hostref->[0];
@@ -521,7 +536,7 @@ sub add_common_rules() {
my $target = source_exclusion( $hostref->[3], $chainref );
for $chain ( first_chains $interface ) {
add_jump $filter_table->{$chain} , $target, 0, join( '', "$globals{STATEMATCH} $state ", match_source_net( $hostref->[2] ), $policy );
add_jump $filter_table->{$chain} , $target, 0, join( '', $state, match_source_net( $hostref->[2] ), $policy );
}
set_interface_option $interface, 'use_input_chain', 1;
@@ -666,12 +681,12 @@ sub add_common_rules() {
for $interface ( @$list ) {
my $chainref = $filter_table->{input_chain $interface};
my $base = uc chain_base $interface;
my $base = uc chain_base get_physical $interface;
my $variable = get_interface_gateway $interface;
if ( interface_is_optional $interface ) {
add_commands( $chainref,
qq(if [ -n "\$${base}_IS_USABLE" -a -n "$variable" ]; then) ,
qq(if [ -n "SW_\$${base}_IS_USABLE" -a -n "$variable" ]; then) ,
' echo "-A ' . match_source_dev( $interface ) . qq(-s $variable -p udp -j ACCEPT" >&3) ,
qq(fi) );
} else {
@@ -801,20 +816,20 @@ sub setup_mac_lists( $ ) {
my $policy = have_ipsec ? "-m policy --pol $ipsec --dir in " : '';
my $source = match_source_net $hostref->[2];
my $state = $globals{UNTRACKED} ? 'NEW,UNTRACKED' : 'NEW';
my $state = $globals{UNTRACKED} ? '-m state --state NEW,UNTRACKED' : "$globals{STATEMATCH} NEW";
if ( $table eq 'filter' ) {
my $chainref = source_exclusion( $hostref->[3], $filter_table->{mac_chain $interface} );
for my $chain ( first_chains $interface ) {
add_jump $filter_table->{$chain} , $chainref, 0, "${source}$globals{STATEMATCH} ${state} ${policy}";
add_jump $filter_table->{$chain} , $chainref, 0, "${source}${state} ${policy}";
}
set_interface_option $interface, 'use_input_chain', 1;
set_interface_option $interface, 'use_forward_chain', 1;
} else {
my $chainref = source_exclusion( $hostref->[3], $mangle_table->{mac_chain $interface} );
add_jump $mangle_table->{PREROUTING}, $chainref, 0, match_source_dev( $interface ) . "${source}$globals{STATEMATCH} ${state} ${policy}";
add_jump $mangle_table->{PREROUTING}, $chainref, 0, match_source_dev( $interface ) . "${source}${state} ${policy}";
}
}
} else {
@@ -883,6 +898,8 @@ sub process_macro ( $$$$$$$$$$$$$$$ ) {
my $format = 1;
my $generated = 0;
macro_comment $macro;
my $macrofile = $macros{$macro};
@@ -954,21 +971,21 @@ sub process_macro ( $$$$$$$$$$$$$$$ ) {
$mdest = '';
}
process_rule1(
$mtarget,
$msource,
$mdest,
merge_macro_column( $mproto, $proto ) ,
merge_macro_column( $mports, $ports ) ,
merge_macro_column( $msports, $sports ) ,
merge_macro_column( $morigdest, $origdest ) ,
merge_macro_column( $mrate, $rate ) ,
merge_macro_column( $muser, $user ) ,
merge_macro_column( $mmark, $mark ) ,
merge_macro_column( $mconnlimit, $connlimit) ,
merge_macro_column( $mtime, $time ),
$wildcard
);
$generated |= process_rule1(
$mtarget,
$msource,
$mdest,
merge_macro_column( $mproto, $proto ) ,
merge_macro_column( $mports, $ports ) ,
merge_macro_column( $msports, $sports ) ,
merge_macro_column( $morigdest, $origdest ) ,
merge_macro_column( $mrate, $rate ) ,
merge_macro_column( $muser, $user ) ,
merge_macro_column( $mmark, $mark ) ,
merge_macro_column( $mconnlimit, $connlimit) ,
merge_macro_column( $mtime, $time ),
$wildcard
);
progress_message " Rule \"$currentline\" $done";
}
@@ -979,6 +996,8 @@ sub process_macro ( $$$$$$$$$$$$$$$ ) {
clear_comment unless $nocomment;
return $generated;
}
#
# Once a rule has been expanded via wildcards (source and/or dest zone eq 'all'), it is processed by this function. If
@@ -1016,33 +1035,36 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
$current_param = $param;
}
process_macro( $basictarget,
$target ,
$current_param,
$source,
$dest,
$proto,
$ports,
$sports,
$origdest,
$ratelimit,
$user,
$mark,
$connlimit,
$time,
$wildcard );
my $generated = process_macro( $basictarget,
$target ,
$current_param,
$source,
$dest,
$proto,
$ports,
$sports,
$origdest,
$ratelimit,
$user,
$mark,
$connlimit,
$time,
$wildcard );
$macro_nest_level--;
$current_param = pop @param_stack if $param ne '';
return;
return $generated;
} elsif ( $actiontype & NFQ ) {
require_capability( 'NFQUEUE_TARGET', 'NFQUEUE Rules', '' );
my $paramval = $param eq '' ? 0 : numeric_value( $param );
fatal_error "Invalid value ($param) for NFQUEUE queue number" unless defined($paramval) && $paramval <= 65535;
$action = "NFQUEUE --queue-num $paramval";
} elsif ( $actiontype & SET ) {
require_capability( 'IPSET_MATCH', 'SET and UNSET rules', '' );
fatal_error "$action rules require a set name parameter" unless $param;
} else {
fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq '';
}
@@ -1079,6 +1101,14 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
$action = '';
} elsif ( $actiontype & LOGRULE ) {
fatal_error 'LOG requires a log level' unless defined $loglevel and $loglevel ne '';
} elsif ( $actiontype & SET ) {
my %xlate = ( ADD => 'add-set' , DEL => 'del-set' );
my ( $setname, $flags, $rest ) = split ':', $param, 3;
fatal_error "Invalid ADD/DEL parameter ($param)" if $rest;
fatal_error "Expected ipset name ($setname)" unless $setname =~ s/^\+// && $setname =~ /^[a-zA-Z]\w*$/;
fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/;
$action = join( ' ', 'SET --' . $xlate{$basictarget} , $setname , $flags );
}
#
# Isolate and validate source and destination zones
@@ -1155,7 +1185,7 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
#
if ( $destref->{type} == BPORT ) {
unless ( $sourceref->{bridge} eq $destref->{bridge} || single_interface( $sourcezone ) eq $destref->{bridge} ) {
return 1 if $wildcard;
return 0 if $wildcard;
fatal_error "Rules with a DESTINATION Bridge Port zone must have a SOURCE zone on the same bridge";
}
}
@@ -1168,7 +1198,7 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
$policy = $chainref->{policy};
if ( $policy eq 'NONE' ) {
return 1 if $wildcard;
return 0 if $wildcard;
fatal_error "Rules may not override a NONE policy";
}
#
@@ -1177,9 +1207,9 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
if ( $optimize > 0 ) {
my $loglevel = $filter_table->{$chainref->{policychain}}{loglevel};
if ( $loglevel ne '' ) {
return 1 if $target eq "${policy}:$loglevel}";
return 0 if $target eq "${policy}:$loglevel}";
} else {
return 1 if $basictarget eq $policy;
return 0 if $basictarget eq $policy;
}
}
#
@@ -1277,7 +1307,7 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
if ( $actiontype & REDIRECT ) {
fatal_error "A server IP address may not be specified in a REDIRECT rule" if $server;
$target = '-j REDIRECT ';
$target = 'REDIRECT ';
$target .= "--to-port $serverport " if $serverport;
if ( $origdest eq '' || $origdest eq '-' ) {
$origdest = ALLIP;
@@ -1301,7 +1331,7 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
}
if ( $action eq 'DNAT' ) {
$target = '-j DNAT ';
$target = 'DNAT ';
if ( $server ) {
$serverport = ":$serverport" if $serverport;
for my $serv ( split /,/, $server ) {
@@ -1407,7 +1437,7 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
'', # Source
'', # Dest
'', # Original dest
'-j ACCEPT',
'ACCEPT',
$loglevel,
$log_action,
'',
@@ -1425,7 +1455,7 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
$source ,
$dest ,
$origdest ,
"-j $tgt",
$tgt,
$loglevel ,
$log_action ,
'' ,
@@ -1471,46 +1501,118 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
$source ,
$dest ,
$origdest ,
$action ? "-j $action " : '' ,
$action ,
$loglevel ,
$log_action ,
'' );
}
return 1;
}
#
# Helper functions for process_rule(). That function deals with the ugliness of wildcard zones ('all' and 'any') and zone lists.
#
# Process a SECTION header
#
sub process_section ($) {
my $sect = shift;
#
# read_a_line has already verified that there are exactly two tokens on the line
#
fatal_error "Invalid SECTION ($sect)" unless defined $sections{$sect};
fatal_error "Duplicate or out of order SECTION $sect" if $sections{$sect};
$sections{$sect} = 1;
if ( $sect eq 'RELATED' ) {
$sections{ESTABLISHED} = 1;
finish_section 'ESTABLISHED';
} elsif ( $sect eq 'NEW' ) {
@sections{'ESTABLISHED','RELATED'} = ( 1, 1 );
finish_section ( ( $section eq 'RELATED' ) ? 'RELATED' : 'ESTABLISHED,RELATED' );
}
$section = $sect;
}
#
# Build a source or destination zone list
#
sub build_zone_list( $$$\$\$ ) {
my ($fw, $input, $which, $intrazoneref, $wildref ) = @_;
my $any = ( $input =~ s/^any/all/ );
my $exclude;
my $rest;
my %exclude;
my @result;
#
# Handle Wildcards
#
if ( $input =~ /^(all[-+]*)(![^:]+)?(:.*)?/ ) {
$input = $1;
$exclude = $2;
$rest = $3;
$$wildref = 1;
if ( defined $exclude ) {
$exclude =~ s/!//;
fatal_error "Invalid exclusion list (!$exclude)" if $exclude =~ /^,|!|,,|,$/;
for ( split /,/, $exclude ) {
fatal_error "Unknown zone ($_)" unless defined_zone $_;
$exclude{$_} = 1;
}
}
unless ( $input eq 'all' ) {
if ( $input eq 'all+' ) {
$$intrazoneref = 1;
} elsif ( ( $input eq 'all+-' ) || ( $input eq 'all-+' ) ) {
$$intrazoneref = 1;
$exclude{$fw} = 1;
} elsif ( $input eq 'all-' ) {
$exclude{$fw} = 1;
} else {
fatal_error "Invalid $which ($input)";
}
}
@result = grep ! $exclude{$_}, $any ? all_parent_zones : non_firewall_zones;
unshift @result, $fw unless $exclude{$fw};
} elsif ( $input =~ /^([^:]+,[^:]+)(:.*)?$/ ) {
$input = $1;
$rest = $2;
$$wildref = 1;
$$intrazoneref = ( $input =~ s/\+$// );
@result = split_list $input, 'zone';
} else {
@result = ( $input );
}
if ( defined $rest ) {
$_ .= $rest for @result;
}
@result;
}
#
# Process a Record in the rules file
#
# Deals with the ugliness of wildcard zones ('all' in SOURCE and/or DEST column).
#
sub process_rule ( ) {
my ( $target, $source, $dest, $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time ) = split_line1 1, 12, 'rules file', \%rules_commands;
if ( $target eq 'COMMENT' ) {
process_comment;
return 1;
}
if ( $target eq 'SECTION' ) {
#
# read_a_line has already verified that there are exactly two tokens on the line
#
fatal_error "Invalid SECTION ($source)" unless defined $sections{$source};
fatal_error "Duplicate or out of order SECTION $source" if $sections{$source};
$sectioned = 1;
$sections{$source} = 1;
if ( $source eq 'RELATED' ) {
$sections{ESTABLISHED} = 1;
finish_section 'ESTABLISHED';
} elsif ( $source eq 'NEW' ) {
@sections{'ESTABLISHED','RELATED'} = ( 1, 1 );
finish_section ( ( $section eq 'RELATED' ) ? 'RELATED' : 'ESTABLISHED,RELATED' );
}
$section = $source;
return 1;
}
process_comment, return 1 if $target eq 'COMMENT';
process_section( $source ), return 1 if $target eq 'SECTION';
#
# Section Names are optional so once we get to an actual rule, we need to be sure that
# we close off any missing sections.
#
process_section( 'NEW' ) unless $section;
if ( $source =~ /^none(:.*)?$/i || $dest =~ /^none(:.*)?$/i ) {
progress_message "Rule \"$currentline\" ignored.";
@@ -1518,113 +1620,30 @@ sub process_rule ( ) {
}
my $intrazone = 0;
my $includesrcfw = 1;
my $includedstfw = 1;
my $thisline = $currentline;
my $anysource = ( $source =~ s/^any/all/ );
my $anydest = ( $dest =~ s/^any/all/ );
#
# Section Names are optional so once we get to an actual rule, we need to be sure that
# we close off any missing sections.
#
unless ( $sectioned ) {
finish_section 'ESTABLISHED,RELATED';
$sections{$section = 'NEW'} = 1;
$sectioned = 1;
}
#
# Handle Wildcards
#
if ( $source =~ /^all[-+]/ ) {
if ( $source eq 'all+' ) {
$source = 'all';
$intrazone = 1;
} elsif ( ( $source eq 'all+-' ) || ( $source eq 'all-+' ) ) {
$source = 'all';
$intrazone = 1;
$includesrcfw = 0;
} elsif ( $source eq 'all-' ) {
$source = 'all';
$includesrcfw = 0;
} else {
fatal_error "Invalid SOURCE ($source)";
}
}
if ( $dest =~ /^all[-+]/ ) {
if ( $dest eq 'all+' ) {
$dest = 'all';
$intrazone = 1;
} elsif ( ( $dest eq 'all+-' ) || ( $dest eq 'all-+' ) ) {
$dest = 'all';
$intrazone = 1;
$includedstfw = 0;
} elsif ( $dest eq 'all-' ) {
$dest = 'all';
$includedstfw = 0;
} else {
fatal_error "Invalid DEST ($dest)";
}
}
my $action = isolate_basic_target $target;
my @source;
my @dest;
if ( $source eq 'all' ) {
if ( $anysource ) {
@source = ( all_parent_zones );
} else {
@source = ( non_firewall_zones )
}
unshift @source, firewall_zone if $includesrcfw;
}
if ( $dest eq 'all' ) {
if ( $anydest ) {
@dest = ( all_parent_zones );
} else {
@dest = ( non_firewall_zones )
}
unshift @dest, firewall_zone if $includedstfw;
}
my $wild = 0;
my $thisline = $currentline; #We must save $currentline because it is overwritten by macro expansion
my $action = isolate_basic_target $target;
my $fw = firewall_zone;
my @source = build_zone_list ( $fw, $source, 'SOURCE', $intrazone, $wild );
my @dest = build_zone_list ( $fw, $dest, 'DEST' , $intrazone, $wild );
my $generated = 0;
fatal_error "Invalid or missing ACTION ($target)" unless defined $action;
if ( $source eq 'all' ) {
for my $zone ( @source ) {
if ( $dest eq 'all' ) {
for my $zone1 ( @dest ) {
if ( $intrazone || ( $zone ne $zone1 ) ) {
process_rule1 $target, $zone, $zone1 , $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time, 1;
}
}
} else {
my $destzone = (split( /:/, $dest, 2 ) )[0];
$destzone = $action =~ /^REDIRECT/ ? firewall_zone : '' unless defined_zone $destzone;
if ( $intrazone || ( $zone ne $destzone ) ) {
process_rule1 $target, $zone, $dest , $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time, 1;
}
for $source ( @source ) {
for $dest ( @dest ) {
my $sourcezone = (split( /:/, $source, 2 ) )[0];
my $destzone = (split( /:/, $dest, 2 ) )[0];
$destzone = $action =~ /^REDIRECT/ ? $fw : '' unless defined_zone $destzone;
if ( ! $wild || $intrazone || ( $sourcezone ne $destzone ) ) {
$generated |= process_rule1 $target, $source, $dest , $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time, $wild;
}
}
} elsif ( $dest eq 'all' ) {
for my $zone ( @dest ) {
my $sourcezone = ( split( /:/, $source, 2 ) )[0];
if ( ( $sourcezone ne $zone ) || $intrazone ) {
process_rule1 $target, $source, $zone , $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time, 1;
}
}
} else {
process_rule1 $target, $source, $dest, $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time, 0;
}
progress_message " Rule \"$thisline\" $done";
warning_message qq(Entry generated no $toolname rules) unless $generated;
progress_message qq( Rule "$thisline" $done);
}
#
@@ -1832,6 +1851,7 @@ sub generate_matrix() {
my $preroutingref = ensure_chain 'nat', 'dnat';
my $fw = firewall_zone;
my $notrackref = $raw_table->{notrack_chain $fw};
my $state = $config{BLACKLISTNEWONLY} ? $globals{UNTRACKED} ? "-m state --state NEW,INVALID,UNTRACKED " : "$globals{STATEMATCH} NEW,INVALID " : '';
my @zones = off_firewall_zones;
my @vservers = vserver_zones;
my $interface_jumps_added = 0;
@@ -1852,6 +1872,26 @@ sub generate_matrix() {
#
my $frwd_ref = new_standard_chain zone_forward_chain( $zone );
if ( $zoneref->{options}{in}{blacklist} ) {
my $blackref = $filter_table->{blacklst};
add_jump $frwd_ref , $blackref, 0, $state, 0, -1;
add_jump ensure_filter_chain( rules_chain( $zone, $_ ), 1 ) , $blackref , 0, $state, 0, -1 for firewall_zone, @vservers;
}
if ( $zoneref->{options}{out}{blacklist} ) {
my $blackref = $filter_table->{blackout};
add_jump ensure_filter_chain( rules_chain( firewall_zone, $zone ), 1 ) , $blackref , 0, $state, 0, -1;
for my $zone1 ( @zones, @vservers ) {
my $ruleschain = rules_chain( $zone1, $zone );
my $ruleschainref = $filter_table->{$ruleschain};
if ( $zone ne $zone1 || ( $ruleschainref && $ruleschainref->{referenced} ) ) {
add_jump( ensure_filter_chain( $ruleschain, 1 ), $blackref, 0, $state, 0, -1 );
}
}
}
if ( have_ipsec ) {
#
# Because policy match only matches an 'in' or an 'out' policy (but not both), we have to place the
@@ -1955,7 +1995,7 @@ sub generate_matrix() {
for my $interface ( sort { interface_number( $a ) <=> interface_number( $b ) } keys %$typeref ) {
my $arrayref = $typeref->{$interface};
if ( $interface eq '+' ) {
if ( get_physical( $interface ) eq '+' ) {
#
# Insert the interface-specific jumps before this one which is not interface-specific
#
@@ -1966,7 +2006,7 @@ sub generate_matrix() {
my $ipsec_in_match = match_ipsec_in $zone , $hostref;
my $ipsec_out_match = match_ipsec_out $zone , $hostref;
my $exclusions = $hostref->{exclusions};
for my $net ( @{$hostref->{hosts}} ) {
my $dest = match_dest_net $net;
@@ -2038,6 +2078,7 @@ sub generate_matrix() {
my $interfacechainref = $filter_table->{input_chain $interface};
my $interfacematch = '';
my $use_input;
my $blacklist = $zoneref->{options}{in}{blacklist};
if ( @vservers || use_input_chain( $interface, $interfacechainref ) || ! $chain2 || ( @{$interfacechainref->{rules}} && ! $chain2ref ) ) {
$inputchainref = $interfacechainref;
@@ -2246,13 +2287,17 @@ sub generate_matrix() {
add_interface_jumps @interfaces unless $interface_jumps_added;
promote_blacklist_rules;
my %builtins = ( mangle => [ qw/PREROUTING INPUT FORWARD POSTROUTING/ ] ,
nat=> [ qw/PREROUTING OUTPUT POSTROUTING/ ] ,
filter=> [ qw/INPUT FORWARD OUTPUT/ ] );
complete_standard_chain $filter_table->{INPUT} , 'all' , firewall_zone , 'DROP';
complete_standard_chain $filter_table->{OUTPUT} , firewall_zone , 'all', 'REJECT';
complete_standard_chain $filter_table->{FORWARD} , 'all' , 'all', 'REJECT';
unless ( $config{COMPLETE} ) {
complete_standard_chain $filter_table->{INPUT} , 'all' , firewall_zone , 'DROP';
complete_standard_chain $filter_table->{OUTPUT} , firewall_zone , 'all', 'REJECT';
complete_standard_chain $filter_table->{FORWARD} , 'all' , 'all', 'REJECT';
}
if ( $config{LOGALLNEW} ) {
for my $table qw/mangle nat filter/ {
@@ -2344,22 +2389,38 @@ EOF
$output->{policy} = 'ACCEPT' if $config{ADMINISABSENTMINDED};
if ( $family == F_IPV4 ) {
emit( ' deletechain() {',
' qt $IPTABLES -L $1 -n && qt $IPTABLES -F $1 && qt $IPTABLES -X $1' );
} else {
emit( ' deletechain() {',
' qt $IP6TABLES -L $1 -n && qt $IP6TABLES -F $1 && qt $IP6TABLES -X $1' );
}
emit <<'EOF';
emit <<'EOF';
deletechain() {
qt $IPTABLES -L $1 -n && qt $IPTABLES -F $1 && qt $IPTABLES -X $1
}
case $COMMAND in
stop|clear|restore)
;;
*)
set +x
stop|clear|restore)
if chain_exists dynamic; then
${IPTABLES}-save -t filter | grep '^-A dynamic' > ${VARDIR}/.dynamic
fi
;;
*)
set +x
EOF
} else {
emit <<'EOF';
deletechain() {
qt $IPTABLES -L $1 -n && qt $IPTABLES -F $1 && qt $IPTABLES -X $1
}
case $COMMAND in
stop|clear|restore)
if chain_exists dynamic; then
${IP6TABLES}-save -t filter | grep '^-A dynamic' > ${VARDIR}/.dynamic
fi
;;
*)
set +x
EOF
}
emit <<'EOF';
case $COMMAND in
start)
logger -p kern.err "ERROR:$g_product start failed"

View File

@@ -40,37 +40,44 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_tc );
our @EXPORT_OK = qw( process_tc_rule initialize );
our $VERSION = '4.4_11';
our $VERSION = '4.4_13';
our %tcs = ( T => { chain => 'tcpost',
connmark => 0,
fw => 1
fw => 1,
fwi => 0,
} ,
CT => { chain => 'tcpost' ,
target => 'CONNMARK --set-mark' ,
connmark => 1 ,
fw => 1
fw => 1 ,
fwi => 0,
} ,
C => { target => 'CONNMARK --set-mark' ,
connmark => 1 ,
fw => 1
fw => 1 ,
fwi => 1 ,
} ,
P => { chain => 'tcpre' ,
connmark => 0 ,
fw => 0
fw => 0 ,
fwi => 0 ,
} ,
CP => { chain => 'tcpre' ,
target => 'CONNMARK --set-mark' ,
connmark => 1 ,
fw => 0
fw => 0 ,
fwi => 0 ,
} ,
F => { chain => 'tcfor' ,
connmark => 0 ,
fw => 0
fw => 0 ,
fwi => 0 ,
} ,
CF => { chain => 'tcfor' ,
connmark => 1 ,
fw => 0 ,
fwi => 0 ,
} ,
);
@@ -158,6 +165,7 @@ our %tcclasses;
our %restrictions = ( tcpre => PREROUTE_RESTRICT ,
tcpost => POSTROUTE_RESTRICT ,
tcfor => NO_RESTRICT ,
tcin => INPUT_RESTRICT ,
tcout => OUTPUT_RESTRICT );
our $family;
@@ -218,12 +226,23 @@ sub process_tc_rule( ) {
}
}
if ( $dest ) {
if ( $dest eq $fw ) {
$chain = 'tcin';
$dest = '';
} else {
$chain = 'tcin' if $dest =~ s/^($fw)://;
}
}
if ( $designator ) {
$tcsref = $tcs{$designator};
if ( $tcsref ) {
if ( $chain eq 'tcout' ) {
fatal_error "Invalid chain designator for source $fw" unless $tcsref->{fw};
} elsif ( $chain eq 'tcin' ) {
fatal_error "Invalid chain designator for dest $fw" unless $tcsref->{fwi};
}
$chain = $tcsref->{chain} if $tcsref->{chain};
@@ -250,6 +269,8 @@ sub process_tc_rule( ) {
$list = '';
my $restriction = 0;
unless ( $classid ) {
MARK:
{
@@ -259,7 +280,7 @@ sub process_tc_rule( ) {
require_capability ('CONNMARK' , "SAVE/RESTORE Rules", '' ) if $tccmd->{connmark};
$target = "$tccmd->{target} ";
$target = $tccmd->{target};
my $marktype = $tccmd->{mark};
if ( $marktype == NOMARK ) {
@@ -268,15 +289,19 @@ sub process_tc_rule( ) {
$mark =~ s/^[|&]//;
}
if ( $target eq 'sticky ' ) {
if ( $target eq 'sticky' ) {
if ( $chain eq 'tcout' ) {
$target = 'sticko';
} else {
fatal_error "SAME rules are only allowed in the PREROUTING and OUTPUT chains" if $chain ne 'tcpre';
}
$restriction = DESTIFACE_DISALLOW;
ensure_mangle_chain($target);
$sticky++;
} elsif ( $target eq 'IPMARK ' ) {
} elsif ( $target eq 'IPMARK' ) {
my ( $srcdst, $mask1, $mask2, $shift ) = ('src', 255, 0, 0 );
require_capability 'IPMARK_TARGET', 'IPMARK', 's';
@@ -313,7 +338,7 @@ sub process_tc_rule( ) {
}
$target = "IPMARK --addr $srcdst --and-mask $mask1 --or-mask $mask2 --shift $shift";
} elsif ( $target eq 'TPROXY ' ) {
} elsif ( $target eq 'TPROXY' ) {
require_capability( 'TPROXY_TARGET', 'Use of TPROXY', 's');
fatal_error "Invalid TPROXY specification( $cmd/$rest )" if $rest;
@@ -380,7 +405,7 @@ sub process_tc_rule( ) {
}
if ( ( my $result = expand_rule( ensure_chain( 'mangle' , $chain ) ,
$restrictions{$chain} ,
$restrictions{$chain} | $restriction,
do_proto( $proto, $ports, $sports) .
do_user( $user ) .
do_test( $testval, $globals{TC_MASK} ) .
@@ -391,9 +416,9 @@ sub process_tc_rule( ) {
$source ,
$dest ,
'' ,
"-j $target $mark" ,
'' ,
$mark ? "$target $mark" : $target,
'' ,
$target ,
'' ) )
&& $device ) {
#
@@ -410,11 +435,11 @@ sub rate_to_kbit( $ ) {
my $rate = $_[0];
return 0 if $rate eq '-';
return $1 if $rate =~ /^(\d+)kbit$/i;
return $1 * 1000 if $rate =~ /^(\d+)mbit$/i;
return $1 * 8000 if $rate =~ /^(\d+)mbps$/i;
return $1 * 8 if $rate =~ /^(\d+)kbps$/i;
return int($1/125) if $rate =~ /^(\d+)(bps)?$/;
return $1 if $rate =~ /^((\d+)(\.\d+)?)kbit$/i;
return $1 * 1000 if $rate =~ /^((\d+)(\.\d+)?)mbit$/i;
return $1 * 8000 if $rate =~ /^((\d+)(\.\d+)?)mbps$/i;
return $1 * 8 if $rate =~ /^((\d+)(\.\d+)?)kbps$/i;
return ($1/125) if $rate =~ /^((\d+)(\.\d+)?)(bps)?$/;
fatal_error "Invalid Rate ($rate)";
}
@@ -433,8 +458,6 @@ sub calculate_quantum( $$ ) {
sub process_flow($) {
my $flow = shift;
$flow =~ s/^\(// if $flow =~ s/\)$//;
my @flow = split /,/, $flow;
for ( @flow ) {
@@ -445,7 +468,7 @@ sub process_flow($) {
}
sub process_simple_device() {
my ( $device , $type , $in_bandwidth ) = split_line 1, 3, 'tcinterfaces';
my ( $device , $type , $in_bandwidth , $out_part ) = split_line 1, 4, 'tcinterfaces';
fatal_error "Duplicate INTERFACE ($device)" if $tcdevices{$device};
fatal_error "Invalid INTERFACE name ($device)" if $device =~ /[:+]/;
@@ -465,7 +488,21 @@ sub process_simple_device() {
}
}
$in_bandwidth = rate_to_kbit( $in_bandwidth );
my $in_burst = '10kb';
if ( $in_bandwidth =~ /:/ ) {
my ( $in_band, $burst ) = split /:/, $in_bandwidth, 2;
if ( defined $burst && $burst ne '' ) {
fatal_error "Invalid IN-BANDWIDTH" if $burst =~ /:/;
fatal_error "Invalid burst ($burst)" unless $burst =~ /^\d+(k|kb|m|mb|mbit|kbit|b)?$/;
$in_burst = $burst;
}
$in_bandwidth = rate_to_kbit( $in_band );
} else {
$in_bandwidth = rate_to_kbit( $in_bandwidth );
}
emit "if interface_is_up $physical; then";
@@ -477,10 +514,50 @@ sub process_simple_device() {
);
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 ${in_bandwidth}kbit burst 10k drop flowid :1\n"
"run_tc filter add dev $physical parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${in_bandwidth}kbit burst $in_burst drop flowid :1\n"
) if $in_bandwidth;
emit "run_tc qdisc add dev $physical root handle $number: prio bands 3 priomap $config{TC_PRIOMAP}";
if ( $out_part ne '-' ) {
my ( $out_bandwidth, $burst, $latency, $peak, $minburst ) = split ':', $out_part;
fatal_error "Invalid Out-BANDWIDTH ($out_part)" if ( defined $minburst && $minburst =~ /:/ ) || $out_bandwidth eq '';
$out_bandwidth = rate_to_kbit( $out_bandwidth );
my $command = "run_tc qdisc add dev $physical root handle $number: tbf rate ${out_bandwidth}kbit";
if ( defined $burst && $burst ne '' ) {
fatal_error "Invalid burst ($burst)" unless $burst =~ /^\d+(?:\.\d+)?(k|kb|m|mb|mbit|kbit|b)?$/;
$command .= " burst $burst";
} else {
$command .= ' burst 10kb';
}
if ( defined $latency && $latency ne '' ) {
fatal_error "Invalid latency ($latency)" unless $latency =~ /^\d+(?:\.\d+)?(s|sec|secs|ms|msec|msecs|us|usec|usecs)?$/;
$command .= " latency $latency";
} else {
$command .= ' latency 200ms';
}
if ( defined $peak && $peak ne '' ) {
fatal_error "Invalid peak ($peak)" unless $peak =~ /^\d+(?:\.\d+)?(k|kb|m|mb|mbit|kbit|b)?$/;
$command .= " peakrate $peak";
}
if ( defined $minburst && $minburst ne '' ) {
fatal_error "Invalid minburst ($minburst)" unless $minburst =~ /^\d+(?:\.\d+)?(k|kb|m|mb|mbit|kbit|b)?$/;
$command .= " minburst $minburst";
}
emit $command;
my $id = $number; $number = in_hexp( $devnum | 0x100 );
emit "run_tc qdisc add dev $physical parent $id: handle $number: prio bands 3 priomap $config{TC_PRIOMAP}";
} else {
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";
@@ -1230,11 +1307,26 @@ sub setup_traffic_shaping() {
qq(fi) );
}
my $inband = rate_to_kbit $devref->{in_bandwidth};
my $in_burst = '10kb';
my $inband;
if ( $devref->{in_bandwidth} =~ /:/ ) {
my ( $in_band, $burst ) = split /:/, $devref->{in_bandwidth}, 2;
if ( defined $burst && $burst ne '' ) {
fatal_error "Invalid IN-BANDWIDTH" if $burst =~ /:/;
fatal_error "Invalid burst ($burst)" unless $burst =~ /^\d+(k|kb|m|mb|mbit|kbit|b)?$/;
$in_burst = $burst;
}
$inband = rate_to_kbit( $in_band );
} else {
$inband = rate_to_kbit $devref->{in_bandwidth};
}
if ( $inband ) {
emit ( "run_tc qdisc add dev $device handle ffff: ingress",
"run_tc filter add dev $device parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${inband}kbit burst 10k drop flowid :1"
"run_tc filter add dev $device parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${inband}kbit burst $in_burst drop flowid :1"
);
}
@@ -1352,6 +1444,68 @@ sub setup_traffic_shaping() {
}
}
#
# Process a record in the secmarks file
#
sub process_secmark_rule() {
my ( $secmark, $chainin, $source, $dest, $proto, $dport, $sport, $user, $mark ) = split_line1( 2, 9 , 'Secmarks file' );
if ( $secmark eq 'COMMENT' ) {
process_comment;
return;
}
my %chns = ( T => 'tcpost' ,
P => 'tcpre' ,
F => 'tcfor' ,
I => 'tcin' ,
O => 'tcout' , );
my %state = ( N => 'NEW' ,
E => 'ESTABLISHED' ,
ER => 'ESTABLISHED,RELATED' );
my ( $chain , $state, $rest) = split ':', $chainin , 3;
fatal_error "Invalid CHAIN:STATE ($chainin)" if $rest || ! $chain;
my $chain1= $chns{$chain};
fatal_error "Invalid or missing CHAIN ( $chain )" unless $chain1;
fatal_error "USER/GROUP may only be used in the OUTPUT chain" if $user ne '-' && $chain1 ne 'tcout';
if ( ( $state ||= '' ) ne '' ) {
my $state1;
fatal_error "Invalid STATE ( $state )" unless $state1 = $state{$state};
$state = "$globals{STATEMATCH} $state1 ";
}
my $target = $secmark eq 'SAVE' ? 'CONNSECMARK --save' :
$secmark eq 'RESTORE' ? 'CONNSECMARK --restore' :
"SECMARK --selctx $secmark";
my $disposition = $target;
$disposition =~ s/ .*//;
expand_rule( ensure_mangle_chain( $chain1 ) ,
$restrictions{$chain1} ,
$state .
do_proto( $proto, $dport, $sport ) .
do_user( $user ) .
do_test( $mark, $globals{TC_MASK} ) ,
$source ,
$dest ,
'' ,
$target ,
'' ,
$disposition,
'' );
progress_message "Secmarks rule \"$currentline\" $done";
}
#
# Process the tcrules file and setup traffic shaping
#
@@ -1364,6 +1518,7 @@ sub setup_tc() {
if ( have_capability( 'MANGLE_FORWARD' ) ) {
ensure_mangle_chain 'tcfor';
ensure_mangle_chain 'tcpost';
ensure_mangle_chain 'tcin';
}
my $mark_part = '';
@@ -1390,6 +1545,7 @@ sub setup_tc() {
add_rule( $mangle_table->{FORWARD}, "-j MARK --set-mark 0${mask}" ) if $config{FORWARD_CLEAR_MARK};
add_jump $mangle_table->{FORWARD} , 'tcfor', 0;
add_jump $mangle_table->{POSTROUTING} , 'tcpost', 0;
add_jump $mangle_table->{INPUT} , 'tcin' , 0;
}
}
@@ -1438,7 +1594,7 @@ sub setup_tc() {
mark => HIGHMARK ,
mask => '' } ,
{ match => sub ( $ ) { $_[0] =~ '&.*' },
target => 'MARK --and-mark ' ,
target => 'MARK --and-mark' ,
mark => HIGHMARK ,
mask => '' ,
connmark => 0
@@ -1460,9 +1616,20 @@ sub setup_tc() {
}
}
add_rule ensure_chain( 'mangle' , 'tcpost' ), $_ for @deferred_rules;
if ( $config{MANGLE_ENABLED} ) {
if ( my $fn = open_file 'secmarks' ) {
handle_stickiness( $sticky );
first_entry "$doing $fn...";
process_secmark_rule while read_a_line;
clear_comment;
}
add_rule ensure_chain( 'mangle' , 'tcpost' ), $_ for @deferred_rules;
handle_stickiness( $sticky );
}
}
1;

View File

@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_tunnels );
our @EXPORT_OK = ( );
our $VERSION = '4.4_9';
our $VERSION = '4.4_13';
#
# Here starts the tunnel stuff -- we really should get rid of this crap...
@@ -61,7 +61,7 @@ sub setup_tunnels() {
}
}
my $options = $globals{UNTRACKED} ? "$globals{STATEMATCH} NEW,UNTRACKED -j ACCEPT" : "$globals{STATEMATCH} NEW -j ACCEPT";
my $options = $globals{UNTRACKED} ? "-m state --state 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";

View File

@@ -78,12 +78,13 @@ our @EXPORT = qw( NOTHING
compile_updown
validate_hosts_file
find_hosts_by_option
find_zones_by_option
all_ipsets
have_ipsec
);
our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_11';
our $VERSION = '4.4_13';
#
# IPSEC Option types
@@ -94,7 +95,6 @@ use constant { NOTHING => 'NOTHING',
IPSECPROTO => 'ah|esp|ipcomp',
IPSECMODE => 'tunnel|transport'
};
#
# Zone Table.
#
@@ -155,16 +155,23 @@ our %reservedName = ( all => 1,
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
# number => <ordinal position in the interfaces file>
# physical => <physical interface name>
# base => <shell variable base representing this interface>
# }
# }
#
# The purpose of the 'base' member is to ensure that the base names associated with the physical interfaces are assigned in
# the same order as the interfaces are encountered in the configuration files.
#
our @interfaces;
our %interfaces;
our @bport_zones;
our %ipsets;
our %physical;
our %basemap;
our %mapbase;
our $family;
our $have_ipsec;
our $baseseq;
use constant { FIREWALL => 1,
IP => 2,
@@ -217,6 +224,9 @@ sub initialize( $ ) {
@bport_zones = ();
%ipsets = ();
%physical = ();
%basemap = ();
%mapbase = ();
$baseseq = 0;
if ( $family == F_IPV4 ) {
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
@@ -289,6 +299,7 @@ sub initialize( $ ) {
sub parse_zone_option_list($$)
{
my %validoptions = ( mss => NUMERIC,
blacklist => NOTHING,
strict => NOTHING,
next => NOTHING,
reqid => NUMERIC,
@@ -298,10 +309,12 @@ sub parse_zone_option_list($$)
"tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK,
);
use constant { UNRESTRICTED => 1, NOFW => 2 };
#
# Hash of options that have their own key in the returned hash.
#
my %key = ( mss => 'mss' );
my %key = ( mss => UNRESTRICTED , blacklist => NOFW );
my ( $list, $zonetype ) = @_;
my %h;
@@ -334,7 +347,8 @@ sub parse_zone_option_list($$)
}
if ( $key{$e} ) {
$h{$e} = $val;
fatal_error "Option '$e' not permitted with this zone type " if $key{$e} == NOFW && ($zonetype == FIREWALL || $zonetype == VSERVER);
$h{$e} = $val || 1;
} else {
fatal_error "The \"$e\" option may only be specified for ipsec zones" unless $zonetype == IPSEC;
$options .= $invert;
@@ -425,20 +439,30 @@ sub process_zone( \$ ) {
}
}
$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 ne '-' || $in_options ne '-' || $out_options ne '-' ) ,
nested => @parents > 0 ,
super => 0 ,
} ,
interfaces => {} ,
children => [] ,
hosts => {}
};
my $zoneref = $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 ne '-' || $in_options ne '-' || $out_options ne '-' ) ,
nested => @parents > 0 ,
super => 0 ,
} ,
interfaces => {} ,
children => [] ,
hosts => {}
};
if ( $zoneref->{options}{in_out}{blacklist} ) {
for ( qw/in out/ ) {
unless ( $zoneref->{options}{$_}{blacklist} ) {
$zoneref->{options}{$_}{blacklist} = 1;
} else {
warning_message( "Redundant 'blacklist' in " . uc( $_ ) . '_OPTIONS' );
}
}
}
return $zone;
@@ -665,7 +689,7 @@ sub add_group_to_zone($$$$$)
# Make 'find_hosts_by_option()' work correctly for this zone
#
for ( qw/blacklist maclist nosmurfs tcpflags/ ) {
$options->{$_} = 1 if $interfaceref->{options}{$_};
$options->{$_} = $interfaceref->{options}{$_} if $interfaceref->{options}{$_};
}
$allip = 1;
@@ -740,7 +764,11 @@ sub non_firewall_zones() {
}
sub all_parent_zones() {
grep ( ! @{$zones{$_}{parents}} , @zones );
#
# Although the firewall zone is technically a parent zone, we let the caller decide
# if it is to be included or not.
#
grep ( ! @{$zones{$_}{parents}} , off_firewall_zones );
}
sub complex_zones() {
@@ -767,11 +795,48 @@ sub is_a_bridge( $ ) {
#
sub chain_base($) {
my $chain = $_[0];
$chain =~ s/^@/at_/;
$chain =~ tr/[.\-%@]/_/;
my $name = $basemap{$chain};
#
# Return existing mapping, if any
#
return $name if $name;
#
# Remember initial value
#
my $key = $chain;
#
# Handle VLANs and wildcards
#
$chain =~ s/\+$//;
$chain;
$chain =~ tr/./_/;
if ( $chain =~ /^[0-9]/ || $chain =~ /[^\w]/ ) {
#
# Must map. Remove all illegal characters
#
$chain =~ s/[^\w]//g;
#
# Prefix with if_ if it begins with a digit
#
$chain = join( '' , 'if_', $chain ) if $chain =~ /^[0-9]/;
#
# Create a new unique name
#
1 while $mapbase{$name = join ( '_', $chain, ++$baseseq )};
} else {
#
# We'll store the identity mapping if it is unique
#
$chain = join( '_', $key , ++$baseseq ) while $mapbase{$name = $chain};
}
#
# Store the reverse mapping
#
$mapbase{$name} = $key;
#
# Store the mapping
#
$basemap{$key} = $name;
}
#
@@ -838,6 +903,8 @@ sub process_interface( $$ ) {
$root = $interface;
}
fatal_error "Invalid interface name ($interface)" if $interface =~ /\*/;
my $physical = $interface;
my $broadcasts;
@@ -892,8 +959,16 @@ sub process_interface( $$ ) {
if ( $type == SIMPLE_IF_OPTION ) {
fatal_error "Option $option does not take a value" if defined $value;
$options{$option} = 1;
$hostoptions{$option} = 1 if $hostopt;
if ( $option eq 'blacklist' ) {
if ( $zone ) {
$zoneref->{options}{in}{blacklist} = 1;
} else {
warning_message "The 'blacklist' option is ignored on multi-zone interfaces";
}
} else {
$options{$option} = 1;
$hostoptions{$option} = 1 if $hostopt;
}
} elsif ( $type == BINARY_IF_OPTION ) {
$value = 1 unless defined $value;
fatal_error "Option value for '$option' must be 0 or 1" unless ( $value eq '0' || $value eq '1' );
@@ -901,8 +976,8 @@ sub process_interface( $$ ) {
$options{$option} = $value;
$hostoptions{$option} = $value if $hostopt;
} elsif ( $type == ENUM_IF_OPTION ) {
fatal_error "The '$option' option may not be used with a wild-card interface name" if $wildcard;
if ( $option eq 'arp_ignore' ) {
fatal_error q(The 'arp_ignore' option may not be used with a wild-card interface name) if $wildcard;
if ( defined $value ) {
if ( $value =~ /^[1-3,8]$/ ) {
$options{arp_ignore} = $value;
@@ -925,10 +1000,6 @@ sub process_interface( $$ ) {
} elsif ( $type == IPLIST_IF_OPTION ) {
fatal_error "The '$option' option requires a value" unless defined $value;
#
# Remove parentheses from address list if present
#
$value =~ s/\)$// if $value =~ s/^\(//;
#
# Add all IP to the front of a list if the list begins with '!'
#
$value = join ',' , ALLIP , $value if $value =~ /^!/;
@@ -961,7 +1032,7 @@ sub process_interface( $$ ) {
fatal_error "The '$option' option requires a value" unless defined $value;
if ( $option eq 'physical' ) {
fatal_error "Invalid Physical interface name ($value)" unless $value =~ /^[\w.@%-]+\+?$/;
fatal_error "Invalid Physical interface name ($value)" unless $value && $value !~ /%/;
fatal_error "Duplicate physical interface name ($value)" if ( $physical{$value} && ! $port );
@@ -991,7 +1062,6 @@ sub process_interface( $$ ) {
$hostoptions{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export || $options{routeback};
$hostoptionsref = \%hostoptions;
} else {
#
@@ -1008,7 +1078,8 @@ sub process_interface( $$ ) {
broadcasts => $broadcasts ,
options => \%options ,
zone => '',
physical => $physical
physical => $physical ,
base => chain_base( $physical )
};
if ( $zone ) {
@@ -1104,28 +1175,35 @@ sub map_physical( $$ ) {
#
# Returns true if passed interface matches an entry in /etc/shorewall/interfaces
#
# 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.
# If the passed name matches a wildcard and 'cache' is true, an entry for the name is added in
# %interfaces.
#
sub known_interface($)
sub known_interface($;$)
{
my $interface = $_[0];
my ( $interface, $cache ) = @_;
my $interfaceref = $interfaces{$interface};
return $interfaceref if $interfaceref;
fatal_error "Invalid interface ($interface)" if $interface =~ /\*/;
for my $i ( @interfaces ) {
$interfaceref = $interfaces{$i};
my $root = $interfaceref->{root};
if ( $i ne $root && substr( $interface, 0, length $root ) eq $root ) {
#
# Cache this result for future reference. We set the 'name' to the name of the entry that appears in /etc/shorewall/interfaces and we do not set the root;
#
return $interfaces{$interface} = { options => $interfaceref->{options},
bridge => $interfaceref->{bridge} ,
name => $i ,
number => $interfaceref->{number} ,
physical => map_physical( $interface, $interfaceref )
};
my $physical = map_physical( $interface, $interfaceref );
my $copyref = { options => $interfaceref->{options},
bridge => $interfaceref->{bridge} ,
name => $i ,
number => $interfaceref->{number} ,
physical => $physical ,
base => chain_base( $physical ) ,
};
$interfaces{$interface} = $copyref if $cache;
return $copyref;
}
}
@@ -1236,25 +1314,33 @@ sub find_interfaces_by_option( $ ) {
}
#
# Returns reference to array of interfaces with the passed option
# Returns reference to array of interfaces with the passed option. Unlike the preceding function, this one:
#
# - All entries in %interfaces are searched.
# - Returns a two-element list; the second element indicates whether any members of the list have wildcard physical names
#
sub find_interfaces_by_option1( $ ) {
my $option = $_[0];
my @ints = ();
my $wild = 0;
for my $interface ( keys %interfaces ) {
for my $interface ( sort { $interfaces{$a}->{number} <=> $interfaces{$b}->{number} }
keys %interfaces ) {
my $interfaceref = $interfaces{$interface};
next unless defined $interfaceref->{physical};
next if $interfaceref->{physical} =~ /\+/;
my $optionsref = $interfaceref->{options};
if ( $optionsref && defined $optionsref->{$option} ) {
$wild ||= ( $interfaceref->{physical} =~ /\+$/ );
push @ints , $interface
}
}
\@ints;
return unless defined wantarray;
wantarray ? ( \@ints, $wild ) : \@ints;
}
#
@@ -1287,6 +1373,8 @@ sub verify_required_interfaces( $ ) {
my $interfaces = find_interfaces_by_option 'wait';
if ( @$interfaces ) {
my $first = 1;
emit( "local waittime\n" );
emit( 'case "$COMMAND" in' );
@@ -1300,6 +1388,8 @@ sub verify_required_interfaces( $ ) {
for my $interface (@$interfaces ) {
my $wait = $interfaces{$interface}{options}{wait};
emit q() unless $first-- > 0;
if ( $wait ) {
my $physical = get_physical $interface;
@@ -1330,7 +1420,7 @@ sub verify_required_interfaces( $ ) {
emit q( sleep 1);
emit ' waittime=$(($waittime - 1))';
emit q( done);
emit qq(fi\n);
emit q(fi);
}
$returnvalue = 1;
@@ -1342,7 +1432,7 @@ sub verify_required_interfaces( $ ) {
pop_indent;
pop_indent;
emit( 'esac' );
emit( "esac\n" );
}
@@ -1365,16 +1455,16 @@ sub verify_required_interfaces( $ ) {
$physical =~ s/\+$/*/;
emit( "${base}_IS_UP=\n",
emit( "SW_${base}_IS_UP=\n",
'for interface in $(find_all_interfaces); do',
' case $interface in',
" $physical)",
" interface_is_usable \$interface && ${base}_IS_UP=Yes && break",
" interface_is_usable \$interface && SW_${base}_IS_UP=Yes && break",
' ;;',
' esac',
'done',
'',
"if [ -z \"\$${base}_IS_UP\" ]; then",
"if [ -z \"\$SW_${base}_IS_UP\" ]; then",
" startup_error \"None of the required interfaces $physical are available\"",
"fi\n"
);
@@ -1613,7 +1703,9 @@ sub process_host( ) {
$zoneref->{options}{complex} = 1;
$ipsec = 1;
} elsif ( $option eq 'norfc1918' ) {
warning_message "The 'norfc1918' option is no longer supported"
warning_message "The 'norfc1918' host option is no longer supported"
} elsif ( $option eq 'blacklist' ) {
$zoneref->{options}{in}{blacklist} = 1;
} elsif ( $validhostoptions{$option}) {
fatal_error qq(The "$option" option is not allowed with Vserver zones) if $type == VSERVER && ! ( $validhostoptions{$option} & IF_OPTION_VSERVER );
$options{$option} = 1;
@@ -1718,6 +1810,21 @@ sub find_hosts_by_option( $ ) {
\@hosts;
}
#
# Returns a reference to a list of zones with the passed in/out option
#
sub find_zones_by_option( $$ ) {
my ($option, $in_out ) = @_;
my @zns;
for my $zone ( @zones ) {
push @zns, $zone if $zones{$zone}{options}{$in_out}{$option};
}
\@zns;
}
sub all_ipsets() {
sort keys %ipsets;
}

View File

@@ -88,43 +88,18 @@ setpolicy() # $1 = name of chain, $2 = policy
run_iptables -P $1 $2
}
#
# Set a standard chain to enable established and related connections
#
setcontinue() # $1 = name of chain
{
run_iptables -A $1 -m state --state ESTABLISHED,RELATED -j ACCEPT
}
#
# Flush one of the NAT table chains
#
flushnat() # $1 = name of chain
{
run_iptables -t nat -F $1
}
#
# Flush one of the Mangle table chains
#
flushmangle() # $1 = name of chain
{
run_iptables -t mangle -F $1
}
#
# Flush and delete all user-defined chains in the filter table
#
deleteallchains() {
run_iptables -F
run_iptables -X
}
#
# Generate a list of all network interfaces on the system
#
find_all_interfaces() {
${IP:-ip} link list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed 's/:$//'
${IP:-ip} link list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed -r 's/(@.*)?:$//'
}
#
# Generate a list of all network interfaces on the system that have an ipv4 address
#
find_all_interfaces1() {
${IP:-ip} -4 addr list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed -r 's/(@.*)?:$//'
}
#
@@ -533,11 +508,12 @@ undo_routing() {
# Restore the default route that was in place before the initial 'shorewall start'
#
restore_default_route() {
local result
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
local default_route
default_route=
local route
local result
result=1
while read route ; do
@@ -622,9 +598,9 @@ delete_proxyarp() {
f=/proc/sys/net/ipv4/conf/$interface/proxy_arp
[ -f $f ] && echo 0 > $f
done < ${VARDIR}/proxyarp
fi
rm -f ${VARDIR}/proxyarp
rm -f ${VARDIR}/proxyarp
fi
}
#
@@ -638,6 +614,7 @@ clear_firewall() {
setpolicy OUTPUT ACCEPT
run_iptables -F
qt $IPTABLES -t raw -F
echo 1 > /proc/sys/net/ipv4/ip_forward

View File

@@ -88,35 +88,18 @@ setpolicy() # $1 = name of chain, $2 = policy
run_iptables -P $1 $2
}
#
# Set a standard chain to enable established and related connections
#
setcontinue() # $1 = name of chain
{
run_iptables -A $1 -m state --state ESTABLISHED,RELATED -j ACCEPT
}
#
# Flush one of the Mangle table chains
#
flushmangle() # $1 = name of chain
{
run_iptables -t mangle -F $1
}
#
# Flush and delete all user-defined chains in the filter table
#
deleteallchains() {
run_iptables -F
run_iptables -X
}
#
# Generate a list of all network interfaces on the system
#
find_all_interfaces() {
${IP:-ip} link list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed 's/:$//'
${IP:-ip} link list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed -r 's/(@.*)?:$//'
}
#
# Generate a list of all network interfaces on the system that have an ipv6 address
#
find_all_interfaces1() {
${IP:-ip} -6 addr list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed -r 's/(@.*)?:$//'
}
#
@@ -513,11 +496,12 @@ undo_routing() {
# Restore the default route that was in place before the initial 'shorewall start'
#
restore_default_route() {
local result
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
local default_route
default_route=
local route
local result
result=1
while read route ; do
@@ -600,6 +584,7 @@ clear_firewall() {
setpolicy OUTPUT ACCEPT
run_iptables -F
qt $IP6TABLES -t raw -F
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding

View File

@@ -1,14 +1,73 @@
Changes in Shorewall 4.4.11.1
Changes in Shorewall 4.4.13
1) Allow zone lists in rules SOURCE and DEST.
2) Fix exclusion in the blacklist file.
3) Correct several old exclusion bugs.
4) Fix exclusion with CONTINUE/NONAT/ACCEPT+
5) Re-implement optional interface handling.
6) Add secmark config file.
7) Split in and out blacklisting.
8) Correct handling of [{src|dst},...] in ipset invocation
9) Correct SAME.
10) TC Enhancements:
<burst> in IN-BANDWIDTH columns.
OUT-BANDWIDTH column in tcinterfaces.
11) Create dynamic zone ipsets on 'start'.
12) Remove new blacklisting implementation.
13) Implement an alternative blacklisting scheme.
14) Use '-m state' for UNTRACKED.
15) Clear raw table on 'clear'
16) Correct port-range check in tcfilters.
17) Disallow '*' in interface names.
Changes in Shorewall 4.4.12
1) Fix IPv6 shorecap program.
2) Eradicate incorrect IPv6 Multicast Network
3) Allow :random to work with REDIRECT
3) Add ADD/DEL support.
4) Don't slow down 'stop' with 'wait'.
4) Allow :random to work with REDIRECT
5) Resolve mutex/nolock issues.
5) Add per-ip log rate limiting.
6) Use new hashlimit match syntax if available.
7) Add Universal sample.
8) Add COMPLETE option.
9) Make ICMP a synonym for IPV6-ICMP in ipv6 configs.
10) Support new set match syntax.
11) Blacklisting by DEST IP.
12) Fix duplicate rule generation with 'any'.
13) Fix port range editing problem.
14) Display the .conf file directory in response to the status command.
15) Correct AUTOMAKE
Changes in Shorewall 4.4.11
@@ -20,7 +79,7 @@ Changes in Shorewall 4.4.11
4) Make IPv6 log and connections output readable.
5) Add REQUIRE_INTERFACE to shorewall*.conf
5) Add REQUIRE_INTERFACE to shorewall*.conf
6) Avoid run-time warnings when options are not listed in
shorewall.conf.

View File

@@ -6,6 +6,6 @@
# Please see http://shorewall.net/Accounting.html for examples and
# additional information about how to use this file.
#
#####################################################################################
#ACTION CHAIN SOURCE DESTINATION PROTO DEST SOURCE USER/ MARK
#####################################################################################################
#ACTION CHAIN SOURCE DESTINATION PROTO DEST SOURCE USER/ MARK IPSEC
# PORT(S) PORT(S) GROUP

View File

@@ -7,4 +7,5 @@
# information.
#
###############################################################################
#ADDRESS/SUBNET PROTOCOL PORT
#ADDRESS/SUBNET PROTOCOL PORT OPTIONS

View File

@@ -7,5 +7,5 @@
# http://www.shorewall.net/manpages/shorewall-masq.html
#
###############################################################################
#INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/
#INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/
# GROUP

View File

@@ -0,0 +1,13 @@
#
# Shorewall version 4 - Secmarks File
#
# For information about entries in this file, type "man shorewall-secmarks"
#
############################################################################################################
#SECMARK CHAIN: SOURCE DEST PROTO DEST SOURCE USER/ MARK
# STATE PORT(S) PORT(S) GROUP

View File

@@ -31,9 +31,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGRATE=
LOGBURST=
LOGLIMIT=
LOGALLNEW=
@@ -200,6 +198,8 @@ REQUIRE_INTERFACE=No
FORWARD_CLEAR_MARK=Yes
COMPLETE=No
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

@@ -8,4 +8,3 @@
#
###############################################################################
#INTERFACE TYPE IN-BANDWIDTH

View File

@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.11.1
VERSION=4.4.13
usage() # $1 = exit status
{
@@ -586,6 +586,16 @@ if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall/tcfilters ]; then
echo "TC Filters file installed as ${DESTDIR}/etc/shorewall/tcfilters"
fi
#
# Install the secmarks file
#
run_install $OWNERSHIP -m 0644 configfiles/secmarks ${DESTDIR}/usr/share/shorewall/configfiles
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall/secmarks ]; then
run_install $OWNERSHIP -m 0600 configfiles/secmarks ${DESTDIR}/etc/shorewall
echo "Secmarks file installed as ${DESTDIR}/etc/shorewall/secmarks"
fi
#
# Install the default config path file
#
@@ -745,7 +755,7 @@ fi
#
# Install the Makefiles
#
install-file Makefile-lite ${DESTDIR}/usr/share/shorewall/configfiles/Makefile 0644
install_file Makefile-lite ${DESTDIR}/usr/share/shorewall/configfiles/Makefile 0644
if [ -z "$SPARSE" ]; then
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}/etc/shorewall

View File

@@ -1,50 +1,2 @@
1) In all versions of Shorewall6 lite, the 'shorecap' program is
using the 'iptables' program rather than the 'ip6tables' program.
This causes many capabilities that are not available in IPv6 to
be incorrectly reported as available.
This results in errors such as:
ip6tables-restore v1.4.2: Couldn't load match `addrtype':
/lib/xtables/libip6t_addrtype.so: cannot open shared
object file: No such file or directory
To work around this problem, on the administrative system:
a) Remove the incorrect capabilties file.
b) In shorewall6.conf, set the IP6TABLES option to the
path name of ip6tables on the firewall (example:
IP6TABLES=/sbin/ip6tables).
c) 'shorewall6 load <firewall>'.
Corrected in Shorewall 4.4.11.1
2) In a number of cases, Shorewall6 generates incorrect rules
involving the IPv6 multicast network. The rules specify
ff00::/10 where they should specify ff00::/8. Also, rules
instantiated when the IPv6 firewall is stopped use ff80::/10 rather
than fe80::/10 (IPv6 link local network).
Corrected in Shorewall 4.4.11.1
3) Using a destination port-range with :random produces a fatal
compilation error in REDIRECT rules unless the firewall zone is
explicitly specified (e.g., $FW::2000-2010:random).
Corrected in Shorewall 4.4.11.1
4) /sbin/shorewall and /sbin/shorewall6 sometimes fail to honor the
'nolock' option. In other cases, this option is incorrectly passed
on to the compiled script, causing the script to issue a usage
synopsis and to terminate.
Corrected in Shorewall 4.4.11.1
5) On systems that use the Upstart init system (such as Ubuntu and
Fedora), Shorewall-init is not reliable at starting the firewall
during boot when normal firewall startup is disabled and UPDOWN=1
is specified in /etc/default/shorewall-init.
Suggested workaround is to not disable normal startup (e.g., do not
set startup=0 on Debian-based systems and do not 'checkconfig
--del...' on Fedora).
1) On systems running Upstart, shorewall-init cannot reliably start the
firewall before interfaces are brought up.

View File

@@ -29,7 +29,7 @@
#
SHOREWALL_LIBVERSION=40407
SHOREWALL_CAPVERSION=40411
SHOREWALL_CAPVERSION=40413
[ -n "${VARDIR:=/var/lib/shorewall}" ]
[ -n "${SHAREDIR:=/usr/share/shorewall}" ]

View File

@@ -226,6 +226,18 @@ show_classifiers() {
logwatch() # $1 = timeout -- if negative, prompt each time that
# an 'interesting' packet count changes
{
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
fi
fi
host=$(echo $g_hostname | sed 's/\..*$//')
oldrejects=$($IPTABLES -L -v -n | grep 'LOG')
@@ -541,6 +553,20 @@ show_command() {
;;
log)
[ $# -gt 2 ] && usage 1
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
fi
fi
echo "$g_product $SHOREWALL_VERSION Log ($LOGFILE) at $g_hostname - $(date)"
echo
show_reset
@@ -781,6 +807,19 @@ dump_command() {
esac
done
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
fi
fi
g_ipt_options="$g_ipt_options $g_ipt_options1"
[ $VERBOSITY -lt 2 ] && VERBOSITY=2
@@ -1027,6 +1066,10 @@ block() # $1 = command, $2 = Finished, $3 - $n addresses
chain=$1
local finished
finished=$2
local which
which='-s'
local range
range='--src-range'
if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
@@ -1038,19 +1081,31 @@ block() # $1 = command, $2 = Finished, $3 - $n addresses
while [ $# -gt 0 ]; do
case $1 in
from)
which='-s'
range='--src-range'
shift
continue
;;
to)
which='-d'
range='--dst-range'
shift
continue
;;
*-*)
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j reject
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j DROP
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j logreject
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j logdrop
$IPTABLES -A dynamic -m iprange --src-range $1 -j $chain || break 1
qt $IPTABLES -D dynamic -m iprange $range $1 -j reject
qt $IPTABLES -D dynamic -m iprange $range $1 -j DROP
qt $IPTABLES -D dynamic -m iprange $range $1 -j logreject
qt $IPTABLES -D dynamic -m iprange $range $1 -j logdrop
$IPTABLES -A dynamic -m iprange $range $1 -j $chain || break 1
;;
*)
qt $IPTABLES -D dynamic -s $1 -j reject
qt $IPTABLES -D dynamic -s $1 -j DROP
qt $IPTABLES -D dynamic -s $1 -j logreject
qt $IPTABLES -D dynamic -s $1 -j logdrop
$IPTABLES -A dynamic -s $1 -j $chain || break 1
qt $IPTABLES -D dynamic $which $1 -j reject
qt $IPTABLES -D dynamic $which $1 -j DROP
qt $IPTABLES -D dynamic $which $1 -j logreject
qt $IPTABLES -D dynamic $which $1 -j logdrop
$IPTABLES -A dynamic $which $1 -j $chain || break 1
;;
esac
@@ -1340,6 +1395,11 @@ allow_command() {
[ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && usage 1
if shorewall_is_started ; then
local which
which='-s'
local range
range='--src-range'
if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
exit 2
@@ -1349,11 +1409,21 @@ allow_command() {
while [ $# -gt 1 ]; do
shift
case $1 in
from)
which='-s'
range='--src-range'
continue
;;
to)
which='-d'
range='--dst-range'
continue
;;
*-*)
if qt $IPTABLES -D dynamic -m iprange --src-range $1 -j reject ||\
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j DROP ||\
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j logdrop ||\
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j logreject
if qt $IPTABLES -D dynamic -m iprange $range $1 -j reject ||\
qt $IPTABLES -D dynamic -m iprange $range $1 -j DROP ||\
qt $IPTABLES -D dynamic -m iprange $range $1 -j logdrop ||\
qt $IPTABLES -D dynamic -m iprange $range $1 -j logreject
then
echo "$1 Allowed"
else
@@ -1361,10 +1431,10 @@ allow_command() {
fi
;;
*)
if qt $IPTABLES -D dynamic -s $1 -j reject ||\
qt $IPTABLES -D dynamic -s $1 -j DROP ||\
qt $IPTABLES -D dynamic -s $1 -j logdrop ||\
qt $IPTABLES -D dynamic -s $1 -j logreject
if qt $IPTABLES -D dynamic $which $1 -j reject ||\
qt $IPTABLES -D dynamic $which $1 -j DROP ||\
qt $IPTABLES -D dynamic $which $1 -j logdrop ||\
qt $IPTABLES -D dynamic $which $1 -j logreject
then
echo "$1 Allowed"
else
@@ -1472,6 +1542,7 @@ determine_capabilities() {
RECENT_MATCH=
OWNER_MATCH=
IPSET_MATCH=
OLD_IPSET_MATCH=
CONNMARK=
XCONNMARK=
CONNMARK_MATCH=
@@ -1505,6 +1576,7 @@ determine_capabilities() {
PERSISTENT_SNAT=
FLOW_FILTER=
FWMARK_RT_MASK=
MARK_ANYWHERE=
chain=fooX$$
@@ -1614,9 +1686,13 @@ determine_capabilities() {
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
if qt $IPTABLES -A $chain -m set --match-set $chain src -j ACCEPT; then
qt $IPTABLES -D $chain -m set --match-set $chain src -j ACCEPT
IPSET_MATCH=Yes
elif 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
OLD_IPSET_MATCH=Yes
fi
qt ipset -X $chain
fi
@@ -1638,6 +1714,7 @@ determine_capabilities() {
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 -A $chain -j MARK --set-mark 5 && MARK_ANYWHERE=Yes
qt $IPTABLES -F $chain
qt $IPTABLES -X $chain
@@ -1681,7 +1758,10 @@ report_capabilities() {
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
if [ -n "$IPSET_MATCH" ]; then
report_capability "Ipset Match" $IPSET_MATCH
[ -n "$OLD_IPSET_MATCH" ] && report_capability "OLD_Ipset Match" $OLD_IPSET_MATCH
fi
report_capability "CONNMARK Target" $CONNMARK
[ -n "$CONNMARK" ] && report_capability "Extended CONNMARK Target" $XCONNMARK
report_capability "Connmark Match" $CONNMARK_MATCH
@@ -1714,6 +1794,7 @@ report_capabilities() {
report_capability "TPROXY Target" $TPROXY_TARGET
report_capability "FLOW Classifier" $FLOW_FILTER
report_capability "fwmark route mask" $FWMARK_RT_MASK
report_capability "Mark in any table" $MARK_ANYWHERE
fi
[ -n "$PKTTYPE" ] || USEPKTTYPE=
@@ -1745,6 +1826,7 @@ report_capabilities1() {
report_capability1 RECENT_MATCH
report_capability1 OWNER_MATCH
report_capability1 IPSET_MATCH
report_capability1 OLD_IPSET_MATCH
report_capability1 CONNMARK
report_capability1 XCONNMARK
report_capability1 CONNMARK_MATCH
@@ -1777,6 +1859,7 @@ report_capabilities1() {
report_capability1 TPROXY_TARGET
report_capability1 FLOW_FILTER
report_capability1 FWMARK_RT_MASK
report_capability1 MARK_ANYWHERE
echo CAPVERSION=$SHOREWALL_CAPVERSION
echo KERNELVERSION=$KERNELVERSION

View File

@@ -514,9 +514,13 @@ find_file()
#
# Set the Shorewall state
#
set_state () # $1 = state
set_state () # $1 = state $2
{
echo "$1 ($(date))" > ${VARDIR}/state
if [ $# -gt 1 ]; then
echo "$1 ($(date)) from $2" > ${VARDIR}/state
else
echo "$1 ($(date))" > ${VARDIR}/state
fi
}
#

View File

@@ -1,16 +1,266 @@
----------------------------------------------------------------------------
S H O R E W A L L 4 . 4 . 1 1 . 1
S H O R E W A L L 4 . 4 . 1 3
----------------------------------------------------------------------------
I. RELEASE 4.4 HIGHLIGHTS
II. MIGRATION ISSUES
III. PROBLEMS CORRECTED IN THIS RELEASE
IV. KNOWN PROBLEMS REMAINING
V. NEW FEATURES IN THIS RELEASE
I. PROBLEMS CORRECTED IN THIS RELEASE
II. KNOWN PROBLEMS REMAINING
III. NEW FEATURES IN THIS RELEASE
IV. RELEASE 4.4 HIGHLIGHTS
V. MIGRATION ISSUES
VI. PROBLEMS CORRECTED AND NEW FEATURES IN PRIOR RELEASES
----------------------------------------------------------------------------
I. R E L E A S E 4 . 4 H I G H L I G H T S
I. P R O B L E M S C O R R E C T E D I N T H I S R E L E A S E
----------------------------------------------------------------------------
1) Under rare circumstances where COMMENT is used to attach comments
to rules, OPTIMIZE 8 through 15 could result in invalid
iptables-restore (ip6tables-restore) input.
2) Under rare circumstances involving exclusion, OPTIMIZE 8 through 15
could result in invalid iptables-restore (ip6tables-restore) input.
3) The change in 4.4.12 to detect and use the new ipset match syntax
broke the ability to detect the old ipset match capability. Now,
both versions of the capability can be correctly detected.
4) Previously, if REQUIRE_INTERFACE=Yes then start/restart would fail
if the last optional interface tested was not available.
5) Exclusion in the blacklist file was correctly validated but was then
ignored when generating iptables (ip6tables) rules.
6) Previously, non-trivial exclusion (more than one excluded
address/net) in CONTINUE, NONAT and ACCEPT+ rules generated
valid but incorrect iptables input. This has been corrected but
requires that your iptables/kernel support marking rules in any
Netfilter table (CONTINUE in the tcrules file does not require this
support).
This fix implements a new 'Mark in any table' capability; those
who utilize a capabilities file should re-generate the file using
this release.
7) Interface handling has been extensively modified in this release
to correct a number of problems with the earlier
implementation. Among those problems:
- Invalid shell variable names could be generated in the firewall
script. The generated firewall script uses shell variables to
track the availability of optional and required interfaces and
to record detected gateways, detected addresses, etc.
- The same shell variable name could be generated by two different
interface names.
- Entries in the interfaces file with a wildcard physical name
(physical name ends with "+") and with the 'optional' option were
handled strangely.
o If there were references to specific interfaces that matched
the wildcard, those entries were handled as if they had been
defined as optional in the interfaces file.
o If there were no references matching the wildcard, then the
'optional' option was effectively ignored.
The new implementation:
- Insures valid shell variable names.
- Insures that shell variable names are unique.
- Handles interface names appearing in the INTERFACE column of the
providers file as a special case for 'optional'. If the name
matches a wildcard entry in the interfaces file then the
usability of the specific interface is tracked individually.
- Handles the availabilty of other interfaces matching a wildcard
as a group; if there is one useable interface in the group then
the wildcard itself is considered usable.
The following example illustrates this use case:
/etc/shorewall/interfaces
net ppp+ - optional
/etc/shorewall/shorewall.conf
REQUIRE_INTERFACE=Yes
If there is any usable PPP interface then the firewall will be
allowed to start. Previously, the firewall would never be allowed
to start.
8) When a comma-separated list of 'src' and/or 'dst' was specified in
an ipset invocation (e.g., "+fooset[src,src]), all but the first 'src'
or 'dst' was previously ignored when generating the resulting
iptables rule.
9) Beginning with Shorewall 4.4.9, the SAME target in tcrules has
generated invalid iptables (ip6tables) input. That target now
generates correct input.
10) Ipsets associated with 'dynamic' zones were being created during
'restart' but not during 'start'.
11) To work around an issue in Netfilter/iptables, Shorewall now uses
state match rather than conntrack match for UNTRACKED state
matching.
12) If the routestopped files contains NOTRACK rules, 'shorewall* clear'
did not clear the raw table.
13) An error message was incorrectly generated if a port range of the
form :<port> (e.g., :22) appeared.
14) An error is now generated if '*' appears in an interface name.
----------------------------------------------------------------------------
I I. K N O W N P R O B L E M S R E M A I N I N G
----------------------------------------------------------------------------
1) On systems running Upstart, shorewall-init cannot reliably start the
firewall before interfaces are brought up.
----------------------------------------------------------------------------
I I I. N E W F E A T U R E S I N T H I S R E L E A S E
----------------------------------------------------------------------------
1) Entries in the rules file (both Shorewall and Shorewall6) may now
contain zone lists in the SOURCE and DEST column. A zone list is a
comma-separated list of zone names where each name appears in the
zones file. A zone list may be optionally followed by a plus sign
("+") to indicate that the rule should apply to intra-zone traffic
as well as to inter-zone traffic.
Zone lists behave like 'all' and 'any' with respect to Optimization
1. If the rule matches the applicable policy for a given (source
zone, dest zone), then the rule will be suppessed for that pair of
zones unless overridden by the '!' suffix on the target in the
ACTION column (e.g., ACCEPT!, DROP!:info, etc.).
Additionally, 'any', 'all' and zone lists may be qualified in the
same way as a single zone.
Examples:
fw,dmz:90.90.191.120/29
all:+blacklist
The 'all' and 'any' keywords now support exclusion in the form of a
comma-separated list of excluded zones.
Examples:
all!fw (same as all-).
any+!dmz,loc (All zones except 'dmz' and 'loc' and
include intra-zone rules).
2) An IPSEC column has been added to the accounting file, allowing you
to segregate IPSEC traffic from non-IPSEC traffic. See 'man
shorewall-accounting' (man shorewall6-accounting) for details.
With this change, there are now three trees of accounting chains:
- The one rooted in the 'accounting' chain.
- The one rooted in the 'accipsecin' chain. This tree handles
traffic that has been decrypted on the firewall. Rules in this
tree cannot specify an interface name in the DEST column.
- The one rooted in the 'accipsecout' chain. This tree handles
traffic that will be encrypted on the firewall. Rules in this
tree cannot specify an interface name in the SOURCE column.
In reality, when there are bridges defined in the configuration,
there is a fourth tree rooted in the 'accountout' chain. That chain
handles traffic that originates on the firewall (both IPSEC and
non-IPSEC).
This change also implements a couple of new warnings:
- WARNING: Adding rule to unreferenced accounting chain <name>
The first reference to user-defined accounting chain <name> is
not a JUMP or COUNT from an already-defined chain.
- WARNING: Accounting chain <name> has o references
The named chain contains accounting rules but no JUMP or COUNT
specifies that chain as the target.
3) Shorewall now supports the SECMARK and CONNSECMARK targets for
manipulating the SELinux context of packets.
See the shorewall-secmarks and shorewall6-secmarks manpages for
details.
As part of this change, the tcrules file now accepts $FW in the
DEST column for marking packets in the INPUT chain.
4) Blacklisting has undergone considerable change in Shorewall 4.4.13.
a) Blacklisting is now based on zones rather than on interfaces and
host groups.
b) Near compatibility with earlier releases is maintained.
c) The keywords 'src' and 'dst' are now preferred in the OPTIONS
column in /etc/shoreawll/blacklist, replacing 'from' and 'to'
respectively. The old keywords are still supported.
d) The 'blacklist' keyword may now appear in the OPTIONS,
IN_OPTIONS and OUT_OPTIONS fields in /etc/shorewall/zones.
i) In the IN_OPTIONS column, it indicates that packets received
on the interface are checked against the 'src' entries in
/etc/shorewall/blacklist.
ii) In the OUT_OPTIONS column, it indicates that packets being
sent to the interface are checked against the 'dst' entries.
iii) Placing 'blacklist' in the OPTIONS column is equivalent to
placing in in both the IN_OPTIONS and OUT_OPTIONS columns.
e) The 'blacklist' option in the OPTIONS column of
/etc/shorewall/interfaces or /etc/shorewall/hosts is now
equivalent to placing it in the IN_OPTIONS column of the
associates record in /etc/shorewall/zones. If no zone is given
in the ZONE column of /etc/shorewall/interfaces, the 'blacklist'
option is ignored with a warning (it was previously ignored
silently).
f) The 'blacklist' option in the /etc/shorewall/interfaces and
/etc/shorewall/hosts files is now deprecated but will continue
to be supported for several releases. A warning will be added at
least one release before support is removed.
5) There is now an OUT-BANDWIDTH column in
/etc/shorewall/tcinterfaces.
The format of this column is:
<rate>[:[<burst>][:[<latency>][:[<peak>][:[<minburst>]]]]]
These terms are described in tc-tbf(8). Shorewall supplies default
values as follows:
<burst> = 10kb
<latency> = 200ms
The remaining options are defaulted by tc.
6) The IN-BANDWIDTH column in both /etc/shorewall/tcdevices and
/etc/shorewall/tcinterfaces now accepts an optional burst parameter.
<rate>[:<burst>]
The default <burst> is 10kb. A larger <burst> can help make the
<rate> more accurate; often for fast lines, the enforced rate is
well below the specified <rate>.
----------------------------------------------------------------------------
I V. R E L E A S E 4 . 4 H I G H L I G H T S
----------------------------------------------------------------------------
1) Support for Shorewall-shell has been discontinued. Shorewall-perl
@@ -67,8 +317,14 @@ VI. PROBLEMS CORRECTED AND NEW FEATURES IN PRIOR RELEASES
15) TPROXY support has been added.
16) Explicit support for Linux-vserver has been added. It is now
possible to define sub-zones of $FW.
17) A 'Universal' sample configuration is now availale for a
'plug-and-play' firewall.
----------------------------------------------------------------------------
I I. M I G R A T I O N I S S U E S
V. M I G R A T I O N I S S U E S
----------------------------------------------------------------------------
1) If you are currently using Shorewall-shell:
@@ -214,31 +470,158 @@ VI. PROBLEMS CORRECTED AND NEW FEATURES IN PRIOR RELEASES
where 'iface' is a capitalized interface name (e.g., ETH0) and
'provider' is the capitalized name of a provider.
15) Support for the OPTIONS column in /etc/shorewall/blacklist
(/etc/shorewall6/blacklist) has been removed. Blacklisting by
destination IP address will be included in a later Shorewall
release.
----------------------------------------------------------------------------
I I I. P R O B L E M S C O R R E C T E D I N T H I S R E L E A S E
V I. P R O B L E M S C O R R E C T E D A N D N E W F E A T U R E S
I N P R I O R R E L E A S E S
----------------------------------------------------------------------------
P R O B L E M S C O R R E C T E D I N 4 . 4 . 1 2
----------------------------------------------------------------------------
4.4.11.1
1) Previously, the Shoreall6-lite version of shorecap was using
1) Previously, the Shorewall6-lite version of shorecap was using
iptables rather than ip6tables, with the result that many capabilities
that are only available in IPv4 were being reported as available.
2) In a number of cases, Shorewall6 generated incorrect rules
involving the IPv6 multicast network. The rules specify
ff00::/10 where they should specify ff00::/8. Also, rules
instantiated when the IPv6 firewall is stopped used ff80::/10 rather
than fe80::/10 (Ipv6 Link Local network).
involving the IPv6 multicast network. The rules specified
ff00::/10 where they should have specified ff00::/8. Also, rules
instantiated when the firewall was stopped used ff80::/10 rather
than fe80::/10 (IPv6 Link Local network).
3) Previously, using a destination port-range with :random produced a
fatal compilation error in REDIRECT rules.
4) /sbin/shorewall and /sbin/shorewall6 sometimes failed to honor the
'nolock' option. In other cases, this option was incorrectly passed
on to the compiled script, causing the script to issue a usage
synopsis and to terminate.
4.4.11
4) A number of problems associated with Shorewall-init and Upstart
have been corrected.
If you use Shorewall-init, then when upgrading to this version, be
sure to recompile all firewall scripts before you take interfaces
down or reboot.
5) Previously, the Shorewall installer (install.sh) failed to install
/usr/share/shorewall/configfiles/Makefile and rather issued the
following message:
install-file: command not found
This caused the Makefile to be omitted from RPMs as well.
6) When 'any' was used in the SOURCE column, a duplicate rule was
generated in all "fw2*" ("fw-* if ZONE2ZONE="-"). If 'any' was used
in the DEST column, then a duplicate rule appeared in all "*2fw"
(*-fw) chains.
7) A port range that omitted the first port number (e.g., ":80") was
rejected with the following error:
ERROR: Invalid/Unknown tcp port/service (0) : ......
8) AUTOMAKE=Yes has been broken for some time. It is now working
correctly.
----------------------------------------------------------------------------
N E W F E A T U R E S I N 4 . 4 . 1 2
----------------------------------------------------------------------------
1) Support has been added for ADD and DEL rules in
/etc/shorewall/rules. ADD allows either the SOURCE or DESTINATION
IP address to be added to an ipset; DEL deletes an address
previously added.
2) Per-ip log rate limiting has been added in the form of the LOGLIMIT
option in shorewall.conf. When LOGLIMIT is specified, LOGRATE and
LOGBURST are ignored.
LOGRATE and LOGBURST are now deprecated.
LOGLIMIT value format is [{s|d}:]<rate>[/<unit>][:<burst>]
If the value starts with 's:' then logging is limited per source
IP. If the value starts with 'd:', then logging is limited per
destination IP. Otherwise, the overall logging rate is limited.
<unit> is one of sec, min, hour, day.
If <burst> is not specified, then a value of 5 is assumed.
3) The sample configurations now include a 'Universal' configuration
that will start on any system and protect that system while
allowing the system to forward traffic.
As part of this change, several additional features were added:
- You may now specify "physical=+" in the interfaces file.
- A 'COMPLETE' option is added to shorewall.conf and
shorewall6.conf. When you set this option to Yes, you are
asserting that the configuration is complete so that your set of
zones encompasses any hosts that can send or receive traffic
to/from/through the firewall. This causes Shorewall to omit the
rules that catch packets in which the source or destination IP
address is outside of any of your zones. Default is No. It is
recommended that this option only be set to Yes if:
o You have defined an interface whose effective physical setting
is '+'
o That interface is assigned to a zone.
o You have no CONTINUE policies or rules.
4) 'icmp' is now accepted as a synonym for 'ipv6-icmp' in IPv6
compilations.
5) Shorewall now detects the presence of a recent ipset iptables
module and uses its new syntax. This avoids a warning on iptables
1.4.9. This change involves a new capabilities file version so if
you use a capabilities file, be sure to regenerate it with 4.4.12
shorewall-lite or shorewall6-lite.
6) Blacklisting can now be done by destination IP address as well as
by source address.
The /etc/shorewall/blacklist and /etc/shorewall6/blacklist files
now have an optional OPTIONS column. Initially, this column can
contain either 'from' (the default) or 'to'; the latter causes the
address(es) in the ADDRESS/SUBNET column to be interpreted as a
DESTINATION address rather than a source address.
Note that static blacklisting is still restricted to traffic
ARRIVING on an interface that has the 'blacklist' option set. So to
block traffic from your local network to an internet host, you must
specify 'blacklist' on your internal interface.
Similarly, dynamic blacklisting has been enhanced to recognize the
'from' and 'to' keywords.
Example:
shorewall drop to 1.2.3.4
This command will silently drop connection requests to1.2.3.4.
The reciprocal of that command would be:
shorewall allow to 1.2.3.4
7) The status command now displays the directory containing the .conf
file (shorewall.conf or shorewall6.conf) when the running
configuration was compiled.
Example:
gateway:/etc/shorewall# shorewall status
Shorewall-4.4.12-RC1 Status at gateway - Thu Aug 12 19:41:51 PDT 2010
Shorewall is running
State:Started (Thu Aug 12 19:41:48 PDT 2010) from /etc/shorewall/
gateway:/etc/shorewall#
----------------------------------------------------------------------------
P R O B L E M S C O R R E C T E D I N 4 . 4 . 1 1
----------------------------------------------------------------------------
1) The IPv6 allowBcast action generated an invalid rule.
@@ -292,20 +675,7 @@ I I I. P R O B L E M S C O R R E C T E D I N T H I S R E L E A S E
/etc/shorewall6/interfaces (line 16)
----------------------------------------------------------------------------
I V. K N O W N P R O B L E M S R E M A I N I N G
----------------------------------------------------------------------------
1) On systems that use the Upstart init system (such as Ubuntu and
Fedora), Shorewall-init is not reliable at starting the firewall
during boot when normal firewall startup is disabled and UPDOWN=1
is specified in /etc/default/shorewall-init.
Suggested workaround is to not disable normal startup (e.g., do not
set startup=0 on Debian-based systems and do not 'checkconfig
--del...' on Fedora).
----------------------------------------------------------------------------
V. N E W F E A T U R E S I N T H I S R E L E A S E
N E W F E A T U R E S I N 4 . 4 . 1 1
----------------------------------------------------------------------------
1) Beginning with this release, Shorewall supports a 'vserver'
@@ -349,9 +719,6 @@ I I I. P R O B L E M S C O R R E C T E D I N T H I S R E L E A S E
is not executable, Shorewall (and Shorewall6) fall back to
/usr/bin/perl.
----------------------------------------------------------------------------
V I. P R O B L E M S C O R R E C T E D A N D N E W F E A T U R E S
I N P R I O R R E L E A S E S
----------------------------------------------------------------------------
P R O B L E M S C O R R E C T E D I N 4 . 4 . 1 0
----------------------------------------------------------------------------

View File

@@ -67,15 +67,15 @@ get_config() {
# This block is avoided for compile for export and when the user isn't root
#
if [ "$3" = Yes ]; then
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
if [ -n "$LOGFILE" ]; then
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
fi
fi
fi
@@ -486,7 +486,7 @@ start_command() {
export RESTOREFILE
if make -qf ${CONFDIR}/Makefile; then
if ! make -qf ${CONFDIR}/Makefile; then
g_fast=
AUTOMAKE=
fi

View File

@@ -1,6 +1,6 @@
%define name shorewall
%define version 4.4.11
%define release 1
%define version 4.4.13
%define release 0base
Summary: Shoreline Firewall is an iptables-based firewall for Linux systems.
Name: %{name}
@@ -108,8 +108,34 @@ fi
%doc COPYING INSTALL changelog.txt releasenotes.txt Contrib/* Samples
%changelog
* Wed Jul 14 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-1
* Mon Sep 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0base
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0RC1
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta6
* Mon Sep 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta5
* Sat Sep 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta4
* Mon Aug 30 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta3
* Wed Aug 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta2
* Wed Aug 18 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta1
* Sun Aug 15 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0base
* Fri Aug 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0RC1
* Sun Aug 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta4
* Sat Jul 31 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta3
* Sun Jul 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta2
* Wed Jul 21 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta1
* Fri Jul 09 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0base
* Mon Jul 05 2010 Tom Eastep tom@shorewall.net

View File

@@ -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.11.1
VERSION=4.4.13
usage() # $1 = exit status
{

View File

@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.11.1
VERSION=4.4.13
usage() # $1 = exit status
{

View File

@@ -617,7 +617,7 @@ case "$COMMAND" in
verify_firewall_script
[ -n "$nolock" ] || mutex_on
run_it $g_firewall $debugging $COMMAND
[ -n "$nolock" ] || mutex_on
[ -n "$nolock" ] || mutex_off
;;
restart)
shift

View File

@@ -1,6 +1,6 @@
%define name shorewall6-lite
%define version 4.4.11
%define release 1
%define version 4.4.13
%define release 0base
Summary: Shoreline Firewall 6 Lite is an ip6tables-based firewall for Linux systems.
Name: %{name}
@@ -93,8 +93,34 @@ fi
%doc COPYING changelog.txt releasenotes.txt
%changelog
* Wed Jul 14 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-1
* Mon Sep 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0base
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0RC1
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta6
* Mon Sep 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta5
* Sat Sep 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta4
* Mon Aug 30 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta3
* Wed Aug 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta2
* Wed Aug 18 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta1
* Sun Aug 15 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0base
* Fri Aug 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0RC1
* Sun Aug 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta4
* Sat Jul 31 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta3
* Sun Jul 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta2
* Wed Jul 21 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta1
* Fri Jul 09 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0base
* Mon Jul 05 2010 Tom Eastep tom@shorewall.net

View File

@@ -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.11.1
VERSION=4.4.13
usage() # $1 = exit status
{

View File

@@ -7,4 +7,4 @@
# information.
#
###############################################################################
#ADDRESS/SUBNET PROTOCOL PORT
#ADDRESS/SUBNET PROTOCOL PORT OPTIONS

View File

@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.11.1
VERSION=4.4.13
usage() # $1 = exit status
{
@@ -311,8 +311,8 @@ 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
delete_file ${DESTDIR}/usr/share/shorewall6/prog.header6
delete_file ${DESTDIR}/usr/share/shorewall6/prog.footer6
#
# Install wait4ifup
@@ -507,6 +507,16 @@ 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 Secmarks file
#
run_install $OWNERSHIP -m 0644 secmarks ${DESTDIR}/usr/share/shorewall6/configfiles/secmarks
if [ -z "$SPARSE" -a ! -f ${DESTDIR}/etc/shorewall6/secmarks ]; then
run_install $OWNERSHIP -m 0600 secmarks ${DESTDIR}/etc/shorewall6/secmarks
echo "Secmarks file installed as ${DESTDIR}/etc/shorewall6/secmarks"
fi
#
# Install the default config path file
#

View File

@@ -33,7 +33,7 @@
#
SHOREWALL_LIBVERSION=40407
SHOREWALL_CAPVERSION=40411
SHOREWALL_CAPVERSION=40413
[ -n "${VARDIR:=/var/lib/shorewall6}" ]
[ -n "${SHAREDIR:=/usr/share/shorewall6}" ]

View File

@@ -208,6 +208,19 @@ logwatch() # $1 = timeout -- if negative, prompt each time that
# an 'interesting' packet count changes
{
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
fi
fi
host=$(echo $g_hostname | sed 's/\..*$//')
oldrejects=$($IP6TABLES -L -v -n | grep 'LOG')
@@ -457,6 +470,20 @@ show_command() {
;;
log)
[ $# -gt 2 ] && usage 1
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
fi
fi
echo "$g_product $SHOREWALL_VERSION Log ($LOGFILE) at $g_hostname - $(date)"
echo
show_reset
@@ -667,6 +694,19 @@ dump_command() {
esac
done
if [ -z "$LOGFILE" ]; then
LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
fi
fi
g_ipt_options="$g_ipt_options $g_ipt_options1"
[ $VERBOSITY -lt 2 ] && VERBOSITY=2
@@ -918,6 +958,10 @@ block() # $1 = command, $2 = Finished, $3 - $n addresses
chain=$1
local finished
finished=$2
local which
which='-s'
local range
range='--src-range'
if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
@@ -929,19 +973,31 @@ block() # $1 = command, $2 = Finished, $3 - $n addresses
while [ $# -gt 0 ]; do
case $1 in
from)
which='-s'
range='--src-range'
shift
continue
;;
to)
which='-d'
range='--dst-range'
shift
continue
;;
*-*)
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j reject
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j DROP
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j logreject
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j logdrop
$IP6TABLES -A dynamic -m iprange --src-range $1 -j $chain || break 1
qt $IP6TABLES -D dynamic -m iprange $range $1 -j reject
qt $IP6TABLES -D dynamic -m iprange $range $1 -j DROP
qt $IP6TABLES -D dynamic -m iprange $range $1 -j logreject
qt $IP6TABLES -D dynamic -m iprange $range $1 -j logdrop
$IP6TABLES -A dynamic -m iprange $range $1 -j $chain || break 1
;;
*)
qt $IP6TABLES -D dynamic -s $1 -j reject
qt $IP6TABLES -D dynamic -s $1 -j DROP
qt $IP6TABLES -D dynamic -s $1 -j logreject
qt $IP6TABLES -D dynamic -s $1 -j logdrop
$IP6TABLES -A dynamic -s $1 -j $chain || break 1
qt $IP6TABLES -D dynamic $which $1 -j reject
qt $IP6TABLES -D dynamic $which $1 -j DROP
qt $IP6TABLES -D dynamic $which $1 -j logreject
qt $IP6TABLES -D dynamic $which $1 -j logdrop
$IP6TABLES -A dynamic $which $1 -j $chain || break 1
;;
esac
@@ -1046,6 +1102,11 @@ allow_command() {
[ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && usage 1
if shorewall6_is_started ; then
local which
which='-s'
local range
range='--src-range'
if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
exit 2
@@ -1055,11 +1116,21 @@ allow_command() {
while [ $# -gt 1 ]; do
shift
case $1 in
from)
which='-s'
range='--src-range'
continue
;;
to)
which='-d'
range='--dst-range'
continue
;;
*-*)
if qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j reject ||\
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j DROP ||\
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j logdrop ||\
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j logreject
if qt $IP6TABLES -D dynamic -m iprange $range $1 -j reject ||\
qt $IP6TABLES -D dynamic -m iprange $range $1 -j DROP ||\
qt $IP6TABLES -D dynamic -m iprange $range $1 -j logdrop ||\
qt $IP6TABLES -D dynamic -m iprange $range $1 -j logreject
then
echo "$1 Allowed"
else
@@ -1067,10 +1138,10 @@ allow_command() {
fi
;;
*)
if qt $IP6TABLES -D dynamic -s $1 -j reject ||\
qt $IP6TABLES -D dynamic -s $1 -j DROP ||\
qt $IP6TABLES -D dynamic -s $1 -j logdrop ||\
qt $IP6TABLES -D dynamic -s $1 -j logreject
if qt $IP6TABLES -D dynamic $which $1 -j reject ||\
qt $IP6TABLES -D dynamic $which $1 -j DROP ||\
qt $IP6TABLES -D dynamic $which $1 -j logdrop ||\
qt $IP6TABLES -D dynamic $which $1 -j logreject
then
echo "$1 Allowed"
else
@@ -1160,6 +1231,7 @@ determine_capabilities() {
RECENT_MATCH=
OWNER_MATCH=
IPSET_MATCH=
OLD_IPSET_MATCH=
CONNMARK=
XCONNMARK=
CONNMARK_MATCH=
@@ -1191,6 +1263,7 @@ determine_capabilities() {
LOG_TARGET=Yes
FLOW_FILTER=
FWMARK_RT_MASK=
MARK_ANYWHERE=
chain=fooX$$
@@ -1332,6 +1405,7 @@ determine_capabilities() {
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 -A $chain -j MARK --set-mark 5 && MARK_ANYWHERE=Yes
qt $IP6TABLES -F $chain
qt $IP6TABLES -X $chain
@@ -1374,7 +1448,10 @@ report_capabilities() {
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
if [ -n "$IPSET_MATCH" ]; then
report_capability "Ipset Match" $IPSET_MATCH
[ -n "$OLD_IPSET_MATCH" ] && report_capability "OLD_Ipset Match" $OLD_IPSET_MATCH
fi
report_capability "CONNMARK Target" $CONNMARK
[ -n "$CONNMARK" ] && report_capability "Extended CONNMARK Target" $XCONNMARK
report_capability "Connmark Match" $CONNMARK_MATCH
@@ -1405,6 +1482,7 @@ report_capabilities() {
report_capability "TPROXY Target" $TPROXY_TARGET
report_capability "FLOW Classifier" $FLOW_FILTER
report_capability "fwmark route mask" $FWMARK_RT_MASK
report_capability "Mark in any table" $MARK_ANYWHERE
fi
[ -n "$PKTTYPE" ] || USEPKTTYPE=
@@ -1435,6 +1513,7 @@ report_capabilities1() {
report_capability1 RECENT_MATCH
report_capability1 OWNER_MATCH
report_capability1 IPSET_MATCH
report_capability1 OLD_IPSET_MATCH
report_capability1 CONNMARK
report_capability1 XCONNMARK
report_capability1 CONNMARK_MATCH
@@ -1465,6 +1544,7 @@ report_capabilities1() {
report_capability1 TPROXY_TARGET
report_capability1 FLOW_FILTER
report_capability1 FWMARK_RT_MASK
report_capability1 MARK_ANYWHERE
echo CAPVERSION=$SHOREWALL_CAPVERSION
echo KERNELVERSION=$KERNELVERSION

View File

@@ -452,7 +452,11 @@ find_file()
#
set_state () # $1 = state
{
echo "$1 ($(date))" > ${VARDIR}/state
if [ $# -gt 1 ]; then
echo "$1 ($(date)) from $2" > ${VARDIR}/state
else
echo "$1 ($(date))" > ${VARDIR}/state
fi
}
#

8
Shorewall6/secmarks Normal file
View File

@@ -0,0 +1,8 @@
#
# Shorewall6 version 4 - Secmarks File
#
# For information about entries in this file, type "man shorewall-secmarks"
#
############################################################################################################
#SECMARK CHAIN SOURCE DEST PROTO DEST SOURCE MARK
# PORT(S) PORT(S)

View File

@@ -67,15 +67,15 @@ get_config() {
# This block is avoided for compile for export and when the user isn't root
#
if [ "$3" = Yes ]; then
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
if [ -n "$LOGFILE" ]; then
if [ -n "$(syslog_circular_buffer)" ]; then
g_logread="logread | tac"
elif [ -r $LOGFILE ]; then
g_logread="tac $LOGFILE"
else
echo "LOGFILE ($LOGFILE) does not exist!" >&2
exit 2
fi
fi
fi
@@ -419,7 +419,7 @@ start_command() {
export RESTOREFILE
if make -qf ${CONFDIR}/Makefile; then
if ! make -qf ${CONFDIR}/Makefile; then
g_fast=
AUTOMAKE=
fi

View File

@@ -32,9 +32,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGRATE=
LOGBURST=
LOGLIMIT=
LOGALLNEW=
@@ -153,7 +151,11 @@ DYNAMIC_BLACKLIST=Yes
LOAD_HELPERS_ONLY=No
FORWARD_CLEAR_MARK=yes
REQUIRE_INTERFACE=No
FORWARD_CLEAR_MARK=Yes
COMPLETE=No
###############################################################################
# P A C K E T D I S P O S I T I O N

View File

@@ -1,6 +1,6 @@
%define name shorewall6
%define version 4.4.11
%define release 1
%define version 4.4.13
%define release 0base
Summary: Shoreline Firewall 6 is an ip6tables-based firewall for Linux systems.
Name: %{name}
@@ -98,8 +98,34 @@ fi
%doc COPYING INSTALL changelog.txt releasenotes.txt tunnel ipsecvpn ipv6 Samples6
%changelog
* Wed Jul 14 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-1
* Mon Sep 20 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0base
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0RC1
* Fri Sep 17 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta6
* Mon Sep 13 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta5
* Sat Sep 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta4
* Mon Aug 30 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta3
* Wed Aug 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta2
* Wed Aug 18 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.13-0Beta1
* Sun Aug 15 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0base
* Fri Aug 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0RC1
* Sun Aug 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta4
* Sat Jul 31 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta3
* Sun Jul 25 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta2
* Wed Jul 21 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.12-0Beta1
* Fri Jul 09 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0base
* Mon Jul 05 2010 Tom Eastep tom@shorewall.net

View File

@@ -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.11.1
VERSION=4.4.13
usage() # $1 = exit status
{

View File

@@ -119,8 +119,7 @@
(from <filename>/etc/protocols</filename>), a protocol number or
<quote>ipp2p</quote>. For <quote>ipp2p</quote>, your kernel and
iptables must have ipp2p match support from <ulink
url="http://www.netfilter.org">Netfilter
Patch_o_matic_ng</ulink>.</para>
url="http://xtables-addons.sourceforge.net/">xtables-addons</ulink>.</para>
</listitem>
<listitem>
@@ -146,7 +145,7 @@
only be non-empty if the CHAIN is OUTPUT. The column may
contain:</para>
<programlisting>[!][&lt;user name or number&gt;][:&lt;group name or number&gt;][+&lt;program name&gt;]</programlisting>
<programlisting>[!][&lt;user name or number&gt;][:&lt;group name or number&gt;]</programlisting>
<para>When this column is non-empty, the rule applies only if the
program generating the output is running under the effective
@@ -163,9 +162,6 @@
<member>!:kids #program must not be run by a member of the
<quote>kids</quote> group</member>
<member>+upnpd #program named upnpd (This feature was removed from
Netfilter in kernel version 2.6.14).</member>
</simplelist>
</listitem>

View File

@@ -18,7 +18,7 @@
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
<copyright>
<year>2006-2007</year>
<year>2006-2010</year>
<holder>Thomas M. Eastep</holder>
</copyright>
@@ -180,11 +180,11 @@
disable startup of Shorewall in your init scripts. For ease of
reference, we call this system the 'administrative system'.</para>
<para>The administrative system may be a Windows system running <ulink
url="http://www.cygwin.com/">Cygwin</ulink> or an <ulink
url="http://www.apple.com/mac/">Apple MacIntosh</ulink> running OS X.
Install from a shell prompt <ulink url="Install.htm">using the
install.sh script</ulink>.</para>
<para>The administrative system may be a GNU/Linux system, a Windows
system running <ulink url="http://www.cygwin.com/">Cygwin</ulink> or
an <ulink url="http://www.apple.com/mac/">Apple MacIntosh</ulink>
running OS X. Install from a shell prompt <ulink
url="Install.htm">using the install.sh script</ulink>.</para>
</listitem>
<listitem>
@@ -241,8 +241,10 @@
<orderedlist>
<listitem>
<para>modify the files in the corresponding export directory
appropriately. It's a good idea to include the IP address of the
administrative system in the <ulink
appropriately (i.e., <emphasis>just as you would if you were
configuring Shorewall on the firewall system itself</emphasis>).
It's a good idea to include the IP address of the administrative
system in the <ulink
url="manpages/shorewall-routestopped.html"><filename>routestopped</filename>
file</ulink>.</para>
@@ -283,26 +285,29 @@
<listitem>
<programlisting><command>cd &lt;export directory&gt;</command>
<command>/sbin/shorewall load -c firewall</command></programlisting>
<command>/sbin/shorewall load firewall</command></programlisting>
<para>The <ulink
url="starting_and_stopping_shorewall.htm#Load"><command>load</command></ulink>
command compiles a firewall script from the configuration files in
the current working directory (using <command>shorewall compile
-e</command>), copies that file to the remote system via scp and
starts Shorewall Lite on the remote system via ssh. The -c option
causes the capabilities of the remote system to be generated and
copied to a file named <filename>capabilities</filename> in the
export directory. See <link
linkend="Shorecap">below</link>.</para>
starts Shorewall Lite on the remote system via ssh.</para>
<para>Example (firewall's DNS name is 'gateway'):</para>
<para><command>/sbin/shorewall load -c gateway</command><note>
<para><command>/sbin/shorewall load gateway</command><note>
<para>Although scp and ssh are used by default, you can use
other utilities by setting RSH_COMMAND and RCP_COMMAND in
<filename>/etc/shorewall/shorewall.conf</filename>.</para>
</note></para>
<para>The first time that you issue a <command>load</command>
command, Shorewall will use ssh to run
<filename>/usr/share/shorewall-lite/shorecap</filename> on the
remote firewall to create a capabilities file in the firewall's
administrative direction. See <link
linkend="Shorecap">below</link>.</para>
</listitem>
</orderedlist>
</listitem>
@@ -456,7 +461,7 @@ clean:
</simplelist>
</blockquote>
<para>You will normally not need to touch
<para>You will normally never touch
<filename>/etc/shorewall-lite/shorewall-lite.conf</filename> unless you
run Debian or one of its derivatives (see <link
linkend="Debian">above</link>).</para>
@@ -559,11 +564,11 @@ clean:
<blockquote>
<para>Before editing:</para>
<programlisting>CONFIG_PATH=/etc/shorewall:/usr/share/shorewall</programlisting>
<programlisting>CONFIG_PATH=<emphasis role="bold">/etc/shorewall</emphasis>:/usr/share/shorewall</programlisting>
<para>After editing:</para>
<programlisting>CONFIG_PATH=/usr/share/shorewall/configfiles:/usr/share/shorewall</programlisting>
<programlisting>CONFIG_PATH=<emphasis role="bold">/usr/share/shorewall/configfiles</emphasis>:/usr/share/shorewall</programlisting>
</blockquote>
<para>Changing CONFIG_PATH will ensure that subsequent compilations
@@ -596,14 +601,21 @@ clean:
<blockquote>
<programlisting><command>cd &lt;export directory&gt;</command>
<command>/sbin/shorewall load -c &lt;firewall system&gt;</command>
<command>/sbin/shorewall load &lt;firewall system&gt;</command>
</programlisting>
<para>Example (firewall's DNS name is 'gateway'):</para>
<para><command>/sbin/shorewall load -c gateway</command></para>
<para><command>/sbin/shorewall load gateway</command></para>
</blockquote>
<para>The first time that you issue a <command>load</command>
command, Shorewall will use ssh to run
<filename>/usr/share/shorewall-lite/shorecap</filename> on the
remote firewall to create a capabilities file in the firewall's
administrative direction. See <link
linkend="Shorecap">below</link>.</para>
<para>The <ulink
url="starting_and_stopping_shorewall.htm#Load"><command>load</command></ulink>
command compiles a firewall script from the configuration files in
@@ -640,7 +652,8 @@ clean:
<command>scp capabilities &lt;admin system&gt;:&lt;this system's config dir&gt;</command></programlisting>
<para>Or simply use the -c option the next time that you use the
<command>reload</command> command.</para>
<command>reload</command> command (e.g., <command>shorewall reload
-c gateway</command>).</para>
</listitem>
</orderedlist>
</section>

View File

@@ -102,8 +102,8 @@
</row>
<row>
<entry><ulink url="Anatomy.html">Anatomy of Shorewall</ulink>
(<ulink url="Anatomy_ru.html">Russian</ulink>)</entry>
<entry><ulink url="Anatomy.html">Anatomy of
Shorewall</ulink></entry>
<entry><ulink url="Manpages.html">Man Pages</ulink></entry>
@@ -112,8 +112,8 @@
</row>
<row>
<entry><ulink url="traffic_shaping.htm">Bandwidth Control</ulink>
(<ulink url="traffic_shaping_ru.html">Russian</ulink>)</entry>
<entry><ulink url="traffic_shaping.htm">Bandwidth
Control</ulink></entry>
<entry><ulink url="ManualChains.html">Manual
Chains</ulink></entry>
@@ -123,9 +123,8 @@
</row>
<row>
<entry><ulink url="blacklisting_support.htm">Blacklisting</ulink>
(<ulink
url="blacklisting_support_ru.html">Russian</ulink>)</entry>
<entry><ulink
url="blacklisting_support.htm">Blacklisting</ulink></entry>
<entry><ulink
url="two-interface.htm#SNAT">Masquerading</ulink></entry>
@@ -197,8 +196,7 @@
NAT)</entry>
<entry><ulink url="traffic_shaping.htm">Traffic Shaping/QOS -
Complex</ulink> (<ulink
url="traffic_shaping_ru.html">Russian</ulink>)</entry>
Complex</ulink></entry>
</row>
<row>
@@ -320,8 +318,8 @@
</row>
<row>
<entry><ulink url="Install.htm">Installation/Upgrade</ulink>
(<ulink url="Install_fr.html">Français</ulink>)</entry>
<entry><ulink
url="Install.htm">Installation/Upgrade</ulink></entry>
<entry><ulink url="ReleaseModel.html">Release
Model</ulink></entry>

View File

@@ -687,11 +687,9 @@ eth1:192.168.1.5 eth1 <emphasis role="bold">130.151.100.69</em
<para>That rule (and the second one in the previous bullet) only
works of course if you have a static external IP address. If you
have a dynamic IP address then include this in
<filename>/etc/shorewall/params</filename> (or your
<filename>&lt;export directory&gt;/init</filename> file if you are
using Shorewall Lite on the firewall system):</para>
<filename>/etc/shorewall/params</filename>.</para>
<programlisting><command>ETH0_IP=`find_first_interface_address eth0`</command> </programlisting>
<programlisting><command>ETH0_IP=$(find_first_interface_address eth0)</command> </programlisting>
<para>and make your DNAT rule:</para>
@@ -712,6 +710,14 @@ DNAT loc loc:192.168.1.5 tcp www - <emph
will return 0.0.0.0 if the interface has no configured IP address;
the latter terminates the calling program.</para>
</note>
<note>
<para>If you run Shorewall-lite on your firewall, you must use the
following in the firewall's configuration directory
<filename>params</filename> file:</para>
<programlisting><command>ETH0_IP=$(ssh root@firewall "/sbin/shorewall-lite call find_first_interface_address eth0")</command></programlisting>
</note>
</listitem>
</itemizedlist>
@@ -1182,6 +1188,18 @@ to debug/develop the newnat interface.</programlisting></para>
<section id="Logging">
<title>Logging</title>
<section id="faq91">
<title>(FAQ 91) I changed the shorewall.conf file in /etc/shorewall/ to
spit out logs to /var/log/shorewall.log and it's not happening after I
restart shorewall. LOGFILE=/var/log/shorewall.log &lt;-- that should be
the correct line, right? </title>
<para><emphasis role="bold">Answer</emphasis>: No, that is not correct.
The LOGFILE setting tells Shorewall where to find the log; it does not
determine where messages are written. See <link linkend="faq6">the next
FAQ</link>.</para>
</section>
<section id="faq6">
<title>(FAQ 6) Where are the log messages written and how do I change
the destination?</title>
@@ -2090,6 +2108,57 @@ shorewall status &gt; /dev/null 2&gt;&amp;1 || shorewall start # Start Shorewall
<filename>/etc/shorewall/params</filename> when processing the <emphasis
role="bold">restore</emphasis> command.</para>
</section>
<section id="faq90">
<title>(FAQ 90) Shorewall starts fine but after several minutes, it
stops. Why is it doing that?</title>
<para><emphasis role="bold">Answer:</emphasis> Shorewall uses the
presence of a chain named <emphasis>shorewall</emphasis> to indicate
whether is started or stopped. That chain is created during execution of
a successful <emphasis role="bold">start</emphasis>, <emphasis
role="bold">restart</emphasis> or <emphasis
role="bold">restore</emphasis> command and is removed during <emphasis
role="bold">stop</emphasis> and <emphasis role="bold">clear</emphasis>.
If <emphasis role="bold">shorewall status</emphasis> indicates that
Shorewall is stopped, then something has deleted that chain. Look at the
output of <emphasis role="bold">shorewall status</emphasis>; if it looks
like this:</para>
<blockquote>
<programlisting>gateway:~# shorewall status
Shorewall-4.4.11 Status at gateway - Wed Jul 21 13:21:41 PDT 2010
Shorewall is <emphasis role="bold">stopped</emphasis>
State:<emphasis role="bold">Started</emphasis> (Tue Jul 20 16:01:49 PDT 2010)
gateway:~#
</programlisting>
</blockquote>
<para>then it means that somehing outside of Shorewall has deleted the
chain. This usually means that you were running another firewall package
before you installed Shorewall and that other package has replaced
Shorewall's Netfilter configuration with its own. You must remove (or at
least disable) the other firewall package and restart Shorewall.</para>
<blockquote>
<programlisting>gateway:~# shorewall status
Shorewall-4.4.11 Status at gateway - Wed Jul 21 13:26:29 PDT 2010
Shorewall is <emphasis role="bold">stopped</emphasis>
State:<emphasis role="bold">Stopped</emphasis> (Wed Jul 21 13:26:26 PDT 2010)
gateway:~# </programlisting>
</blockquote>
<para>then a <emphasis role="bold">shorewall stop</emphasis> command has
been executed (if the State shown in the output is <emphasis
role="bold">Cleared</emphasis>, then a <emphasis role="bold">shorewall
clear</emphasis> command was executed). Most likely, you have installed
and configured the <emphasis>shorewall-init</emphasis> package and a
required interface has gone down.</para>
</section>
</section>
<section id="MultiISP">
@@ -2326,7 +2395,7 @@ We have an error talking to the kernel
<para><emphasis role="bold">Answer</emphasis>: Beginning with Shorewall
4.4.11 Beta 2, you can <ulink url="Vserver.html">create vserver
zones</ulink> that are nested within the firewall zone. </para>
zones</ulink> that are nested within the firewall zone.</para>
<para>Prior to 4.4.11 Beta 2, there is no way to create sub-zones of the
firewall zone. But you can use shell variables to make vservers easier

View File

@@ -22,6 +22,8 @@
<year>2007</year>
<year>2010</year>
<holder>Thomas M. Eastep</holder>
</copyright>
@@ -45,33 +47,41 @@
</listitem>
</itemizedlist>
<para>Now, <ulink url="Install.htm">install Shorewall</ulink>.</para>
<para>Next, read the QuickStart Guide that is appropriate for your
configuration:</para>
<para><emphasis role="bold">If you just want to protect a system: (Requires
Shorewall 4.4.12-Beta3 or later)</emphasis></para>
<itemizedlist>
<listitem>
<para><ulink url="Universal.html">Universal</ulink> configuration --
requires no configuration to protect a single system.</para>
</listitem>
</itemizedlist>
<para><emphasis role="bold">If you have only one public IP
address:</emphasis></para>
<itemizedlist>
<listitem>
<para><ulink url="standalone.htm">Standalone</ulink> Linux System with a
single network interface (<ulink url="standalone_fr.html">Version
Française</ulink>) <ulink url="standalone_ru.html">(Russian
Version)</ulink> <ulink url="standalone_es.html">Version en
Español</ulink></para>
single network interface (if you are running Shorewall 4.4.12 Beta 3 or
later, use the <ulink url="Universal.html">Universal</ulink>
configuration instead).</para>
</listitem>
<listitem>
<para><ulink url="two-interface.htm">Two-interface</ulink> Linux System
acting as a firewall/router for a small local network (<ulink
url="two-interface_fr.html">Version Française</ulink>) (<ulink
url="two-interface_ru.html">Russian Version</ulink>)</para>
acting as a firewall/router for a small local network</para>
</listitem>
<listitem>
<para><ulink url="three-interface.htm">Three-interface</ulink> Linux
System acting as a firewall/router for a small local network and a DMZ..
(<ulink url="three-interface_fr.html">Version Française</ulink>) (<ulink
url="three-interface_ru.html">Russian Version</ulink>)</para>
System acting as a firewall/router for a small local network and a
DMZ.</para>
</listitem>
</itemizedlist>
@@ -81,11 +91,10 @@
<itemizedlist>
<listitem>
<para>The <ulink url="shorewall_setup_guide.htm">Shorewall Setup
Guide</ulink> (<ulink url="shorewall_setup_guide_fr.htm">Version
Française</ulink>) outlines the steps necessary to set up a firewall
where there are multiple public IP addresses involved or if you want to
learn more about Shorewall than is explained in the single-address
guides above.</para>
Guide</ulink> outlines the steps necessary to set up a firewall where
there are multiple public IP addresses involved or if you want to learn
more about Shorewall than is explained in the single-address guides
above.</para>
</listitem>
</itemizedlist>

View File

@@ -5,7 +5,7 @@
<!--$Id: template.xml 5908 2007-04-12 23:04:36Z teastep $-->
<articleinfo>
<title>Shorewall 4.4/4.5 Manpages</title>
<title>Shorewall 4.4 Manpages</title>
<authorgroup>
<author>
@@ -129,6 +129,9 @@
<member><ulink url="manpages/shorewall-rules.html">rules</ulink> -
Specify exceptions to policies, including DNAT and REDIRECT.</member>
<member><ulink url="manpages/shorewall-secmarks.html">secmarks</ulink>
- Attach an SELinux context to a packet.</member>
<member><ulink
url="manpages/shorewall-tcclasses.html">tcclasses</ulink> - Define htb
classes for traffic shaping.</member>
@@ -189,6 +192,11 @@
<member><ulink url="manpages/shorewall.html">shorewall</ulink> -
/sbin/shorewall command syntax and semantics.</member>
<member><ulink
url="manpages/shorewall-init.html">shorewall-init</ulink> - Companion
package that allows for automatic start/stop of other Shorewall
products based on network events.</member>
<member><ulink
url="manpages/shorewall-lite.html">shorewall-lite</ulink> -
/sbin/shorewall-lite command syntax and semantics.</member>

View File

@@ -5,7 +5,7 @@
<!--$Id: template.xml 5908 2007-04-12 23:04:36Z teastep $-->
<articleinfo>
<title>Shorewall6 4.4/4.5 Manpages</title>
<title>Shorewall6 4.4 Manpages</title>
<authorgroup>
<author>
@@ -114,6 +114,10 @@
<member><ulink url="manpages6/shorewall6-rules.html">rules</ulink> -
Specify exceptions to policies, including DNAT and REDIRECT.</member>
<member><ulink
url="manpages6/shorewall6-secmarks.html">secmarks</ulink> - Attached
an SELinux context to a packet.</member>
<member><ulink
url="manpages6/shorewall6-tcclasses.html">tcclasses</ulink> - Define
htb classes for traffic shaping.</member>

View File

@@ -1100,6 +1100,40 @@ gateway:~ #</programlisting>Note that because we used a priority of 1000, the
</section>
</section>
<section>
<title>Looking at the routing tables</title>
<para>To look at the various routing tables, you must use the <emphasis
role="bold">ip</emphasis> utility. To see the entire routing
configuration (including rules), the command is <command>shorewall show
routing</command>. To look at an individual provider's table use
<command>ip route ls table <replaceable>provider</replaceable></command>
where <replaceable>provider</replaceable> can be either the provider
name or number.</para>
<para>Example:</para>
<programlisting>lillycat:- #<command>ip route ls</command>
144.77.167.142 dev ppp0 proto kernel scope link src 144.177.121.199
71.190.227.208 dev ppp1 proto kernel scope link src 71.24.88.151
192.168.7.254 dev eth1 scope link src 192.168.7.1
192.168.7.253 dev eth1 scope link src 192.168.7.1
192.168.7.0/24 dev eth1 proto kernel scope link src 192.168.7.1
192.168.5.0/24 via 192.168.4.2 dev eth0
192.168.4.0/24 dev eth0 proto kernel scope link src 192.168.4.223
192.168.1.0/24 via 192.168.4.222 dev eth0
default
nexthop dev ppp1 weight 2
nexthop dev ppp0 weight 1
lillycat: #ip <command>route ls provider 1</command>
144.77.167.142 dev ppp0 proto kernel scope link src 144.177.121.199
192.168.5.0/24 via 192.168.4.2 dev eth0
192.168.4.0/24 dev eth0 proto kernel scope link src 192.168.4.223
192.168.1.0/24 via 192.168.4.222 dev eth0
default dev ppp0 scope link
lillycat: #</programlisting>
</section>
<section id="USE_DEFAULT_RT">
<title>USE_DEFAULT_RT</title>
@@ -1527,7 +1561,7 @@ connection {
connection {
name=Comcast
checkip=${ETH0_GATEWAY:-71.231.152.1}
checkip=${SW_ETH0_GATEWAY:-71.231.152.1}
device=$COM_IF
ttl=1
}
@@ -1543,9 +1577,14 @@ EOF
/usr/sbin/lsm /etc/lsm/lsm.conf &gt;&gt; /var/log/lsm
}</programlisting>
<para>eth3 has a dynamic IP address so I need to use the
Shorewall-detected gateway address ($ETH3_GATEWAY). I supply a default
value to be used in the event that detection fails.</para>
<para>eth0 has a dynamic IP address so I need to use the
Shorewall-detected gateway address ($SW_ETH1_GATEWAY). I supply a
default value to be used in the event that detection fails.</para>
<note>
<para>In Shorewall 4.4.7 and earlier, the variable name is
ETH1_GATEWAY.</para>
</note>
<para><filename>/etc/shorewall/started</filename>:</para>

View File

@@ -89,8 +89,8 @@
Shorewall system itself.</para>
<para>A more elaborate version of this flow is available <ulink
url="http://shorewall.net/pub/shorewall/misc/netfilterflow.pdf">here</ulink>
and <ulink url="http://www.docum.org/docum.org/kptd/">this one</ulink>
url="http://jengelh.medozas.de/images/nf-packet-flow.png">here</ulink> and
<ulink url="http://www.docum.org/docum.org/kptd/">this one</ulink>
contrasts the Netfilter flow with that of ipchains.</para>
<para>In the above diagram are boxes similar to this:</para>

View File

@@ -267,6 +267,108 @@ tcp 6 19 TIME_WAIT src=206.124.146.176 dst=192.136.34.98 sport=58597 dport=
<para>Connection marking rules use a mask value of 0xff.</para>
</listitem>
</itemizedlist>
<para>Shorewall actually allows you to have complete control over the
layout of the 32-bit mark using the following options in <ulink
url="manpages/shorewall.conf.html">shorewall.conf</ulink> (5):</para>
<variablelist>
<varlistentry>
<term>TC_BITS</term>
<listitem>
<para>The number of bits at the low end of the mark to be used for
traffic shaping marking. May be zero.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PROVIDER_BITS</term>
<listitem>
<para>The number of bits in the mark to be used for provider
numbers. May be zero.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PROVIDER_OFFSET</term>
<listitem>
<para>The offset from the right (low-order end) of the provider
number field. If non-zero, must be &gt;= TC_BITS (Shorewall
automatically adjusts PROVIDER_OFFSET's value). PROVIDER_OFFSET +
PROVIDER_BITS must be &lt;= 32.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MASK_BITS</term>
<listitem>
<para>Number of bits on the right of the mark to be masked when
clearing the traffic shaping mark. Must be &gt;= TC_BITS and &lt;=
PROVIDER_OFFSET (if PROVIDER_OFFSET &gt; 0)</para>
</listitem>
</varlistentry>
</variablelist>
<para>The relationship between these options is shown in this
diagram.</para>
<graphic align="left" fileref="images/MarkGeometry.png" valign="top" />
<para></para>
<para>The default values of these options are determined by the settings
of other options as follows:</para>
<table>
<title>Default Values</title>
<tgroup cols="2">
<tbody>
<row>
<entry>WIDE_TC_MARKS=No, HIGH_ROUTE_MARKS=No</entry>
<entry>TC_BITS=8, PROVIDER_BITS=8, PROVIDER_OFFSET=0,
MASK_BITS=8</entry>
</row>
<row>
<entry>WIDE_TC_MARKS=No, HIGH_ROUTE_MARKS=Yes</entry>
<entry>TC_BITS=8, PROVIDER_BITS=8, PROVIDER_OFFSET=8,
MASK_BITS=8</entry>
</row>
<row>
<entry>WIDE_TC_MARKS=Yes, HIGH_ROUTE_MARKS=No</entry>
<entry>TC_BITS=14, PROVIDER_BITS=8, PROVIDER_OFFSET=0,
MASK_BITS=16</entry>
</row>
<row>
<entry>WIDE_TC_MARKS=Yes, HIGH_ROUTE_MARKS=Yes</entry>
<entry>TC_BITS=14, PROVIDER_BITS=8, PROVIDER_OFFSET=16,
MASK_BITS=16</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The existence of both TC_BITS and MASK_BITS is owed to the way that
WIDE_TC_MARKS was originally implemented. Note that TC_BITS is 14 rather
than 16 when WIDE_TC_MARKS=Yes.</para>
<para>Beginning with Shorewall 4.4.12, the field between MASK_BITS and
PROVIDER_OFFSET can be used for any purpose you want.</para>
<para>Beginning with Shorewall 4.4.13, The first unused bit on the left is
used by Shorewall as an <firstterm>exclusion mark</firstterm>, allowing
exclusion in CONTINUE, NONAT and ACCEPT+ rules.</para>
</section>
<section id="Shorewall">

View File

@@ -74,13 +74,13 @@
<title>Closing the Firewall before the Network Interfaces are brought
up</title>
<para> When Shorewall-init is first installed, it does nothing until you
<para>When Shorewall-init is first installed, it does nothing until you
configure it.</para>
<para>The configuration file is <filename>/etc/default/shorewall-init
</filename>on Debian-based systems and
<filename>/etc/sysconfig/shorewall-init</filename> otherwise. There are
two settings in the file: </para>
two settings in the file:</para>
<variablelist>
<varlistentry>
@@ -115,7 +115,7 @@
<listitem>
<para>Be sure that your current firewall script(s) (normally in
<filename>/var/lib/&lt;product&gt;/firewall</filename>) is(are)
compiled with the 4.4.10 compiler. </para>
compiled with the 4.4.10 compiler.</para>
<para>Shorewall and Shorewall6 users can execute these
commands:</para>
@@ -139,7 +139,7 @@
</listitem>
</orderedlist>
<para>That's all that is required. </para>
<para>That's all that is required.</para>
</section>
<section id="NM">
@@ -147,7 +147,7 @@
<para>To integrate with NetworkManager and ifup/ifdown, additional steps
are required. You probably don't want to enable this feature if you run a
link status monitor like swping or LSM. </para>
link status monitor like swping or LSM.</para>
<orderedlist numeration="loweralpha">
<listitem>
@@ -165,15 +165,21 @@
<listitem>
<para>Optional) -- If you have specified at least one
<option>required</option> or <option>optional</option> interface, you
can then disable automatic firewall startup at boot time. On
Debian-based systems, set startup=0 in
can then disable automatic firewall startup at boot time. On Debian
systems, set startup=0 in
<filename>/etc/default/<replaceable>product</replaceable></filename>.
On other systems, use your service startup configuration tool
(chkconfig, insserv, ...) to disable startup. </para>
(chkconfig, insserv, ...) to disable startup.</para>
<warning>
<para>If your system uses Upstart as it's system initialization
daemon, you should not disable startup. Upstart is standard on
recent Ubuntu and Fedora releases and is optional on Debian.</para>
</warning>
</listitem>
</orderedlist>
<para>The following actions occur when an interface comes up: </para>
<para>The following actions occur when an interface comes up:</para>
<informaltable>
<tgroup cols="3">
@@ -253,7 +259,7 @@
</tgroup>
</informaltable>
<para> For optional interfaces, the
<para>For optional interfaces, the
<filename>/var/lib/<replaceable>product</replaceable>/<replaceable>interface</replaceable>.state</filename>
files are maintained to reflect the state of the interface so that they
may be used by the standard <firstterm>isusable</firstterm> script. Please
@@ -272,13 +278,13 @@
<para>Similarly, if an optional interface goes down and there are no
optional interfaces remaining in the up state, then the firewall is
stopped. </para>
stopped.</para>
<para>On Debian-based systems, during system shutdown the firewall is
opened prior to network shutdown (<command>/etc/init.d/shorewall
stop</command> performs a 'clear' operation rather than a 'stop'). This is
required by Debian standards. You can change this default behavior by
setting SAFESTOP=1 in <filename>/etc/default/shorewall</filename>
(<filename>/etc/default/shorewall6</filename>, ...). </para>
(<filename>/etc/default/shorewall6</filename>, ...).</para>
</section>
</article>

352
docs/Universal.xml Normal file
View File

@@ -0,0 +1,352 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<article>
<!--$Id$-->
<articleinfo>
<title>Universal Configuration</title>
<authorgroup>
<author>
<firstname>Tom</firstname>
<surname>Eastep</surname>
</author>
</authorgroup>
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
<copyright>
<year>2010</year>
<holder>Thomas M. Eastep</holder>
</copyright>
<legalnotice>
<para>Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version
1.2 or any later version published by the Free Software Foundation; with
no Invariant Sections, with no Front-Cover, and with no Back-Cover
Texts. A copy of the license is included in the section entitled
<quote><ulink url="GnuCopyright.htm">GNU Free Documentation
License</ulink></quote>.</para>
</legalnotice>
</articleinfo>
<section>
<title>Configuring Shorewall</title>
<para>Once you have installed the Shorewall software, you must configure
it. The easiest way to do that is to use one of Shorewall's
<firstterm>Sample Configurations</firstterm>. The Universal Configuration
is one of those samples.</para>
</section>
<section>
<title>What the Universal Configuration does</title>
<para>The Universal Shorewall configuration requires that you simply copy
the configuration to <filename class="directory">/etc/shorewall</filename>
and start Shorewall. This sample configuation:</para>
<itemizedlist>
<listitem>
<para>Allows all outgoing traffic.</para>
</listitem>
<listitem>
<para>Blocks all incoming connections except:</para>
<itemizedlist>
<listitem>
<para>Secure Shell</para>
</listitem>
<listitem>
<para>Ping</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Allows forwarding of traffic, provided that the system has more
than one interface or is set up to route between networks on a single
interface.</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>How to Install it</title>
<para>The location of the sample configuration files is dependent on your
distribution and <ulink url="Install.htm">how you installed
Shorewall</ulink>.</para>
<orderedlist>
<listitem>
<para>If you installed using an <acronym>RPM</acronym>, the samples
will be in the <filename
class="directory">Samples/Universal</filename> subdirectory of the
Shorewall documentation directory. If you don't know where the
Shorewall documentation directory is, you can find the samples using
this command:</para>
<programlisting>~# rpm -ql shorewall-common | fgrep Universal
/usr/share/doc/packages/shorewall/Samples/Universal
/usr/share/doc/packages/shorewall/Samples/Universal/interfaces
/usr/share/doc/packages/shorewall/Samples/Universal/policy
/usr/share/doc/packages/shorewall/Samples/Universal/rules
/usr/share/doc/packages/shorewall/Samples/Universal/zones
~#</programlisting>
</listitem>
<listitem>
<para>If you installed using the tarball, the samples are in the
<filename class="directory">Samples/Universal</filename> directory in
the tarball.</para>
</listitem>
<listitem>
<para>If you installed using a Shorewall 4.x .deb, the samples are in
<filename
class="directory">/usr/share/doc/shorewall-common/examples/Universal</filename>..
You do not need the shorewall-doc package to have access to the
samples.</para>
</listitem>
</orderedlist>
<para>Simple copy the files from the Universal directory to
/etc/shorewall.</para>
</section>
<section>
<title>How to Start the firewall</title>
<para>Before starting Shorewall for the first time, it's a good idea to
stop your existing firewall. On Redhat/CentOS/Fedora, at a root prompt
type:</para>
<blockquote>
<para><command>service iptables stop</command></para>
</blockquote>
<para>If you are running SuSE, use Yast or Yast2 to stop
SuSEFirewall.</para>
<para>Once you have Shorewall running to your satisfaction, you should
totally disable your existing firewall. On /Redhat/CentOS/Fedora:</para>
<blockquote>
<para><command>chkconfig --del iptables</command></para>
</blockquote>
<para>At a root prompt, type:</para>
<blockquote>
<para><command>/sbin/shorewall start</command></para>
</blockquote>
<para>That's it. Shorewall will automatically start again when you
reboot.</para>
</section>
<section>
<title>Now that it is running, ...</title>
<section>
<title>How do I stop the firewall?</title>
<para>At a root prompt, type:</para>
<blockquote>
<para><command>/sbin/shorewall clear</command></para>
</blockquote>
<para>The system is now 'wide open'.</para>
</section>
<section>
<title>How do I prevent it from responding to ping?</title>
<para>Edit <filename>/etc/shorewall/rules</filename> and remove the line
that reads:</para>
<blockquote>
<para>Ping(ACCEPT) net $FW</para>
</blockquote>
<para>and at a root prompt, type:</para>
<blockquote>
<para><command>/sbin/shorewall restart</command></para>
</blockquote>
</section>
<section>
<title>How do I allow other kinds of incoming connections?</title>
<para>Shorewall includes a collection of <firstterm>macros</firstterm>
that can be used to quickly allow or deny services. You can find a list
of the macros included in your version of Shorewall using the command
<command>ls <filename>/usr/share/shorewall/macro.*</filename></command>
or at a shell prompt type:</para>
<blockquote>
<para><command>/sbin/shorewall show macros</command></para>
</blockquote>
<para>If you wish to enable connections from the Internet to your
firewall and you find an appropriate macro in
<filename>/etc/shorewall/macro.*</filename>, the general format of a
rule in <filename>/etc/shorewall/rules</filename> is:</para>
<programlisting>#ACTION SOURCE DESTINATION PROTO DEST PORT(S)
&lt;<emphasis>macro</emphasis>&gt;(ACCEPT) net $FW</programlisting>
<important>
<para>Be sure to add your rules after the line that reads <emphasis
role="bold">SECTION NEW.</emphasis></para>
</important>
<example id="Example1">
<title>You want to run a Web Server and a IMAP Server on your firewall
system:</title>
<programlisting>#ACTION SOURCE DESTINATION PROTO DEST PORT(S)
Web(ACCEPT) net $FW
IMAP(ACCEPT)net $FW</programlisting>
</example>
<para>You may also choose to code your rules directly without using the
pre-defined macros. This will be necessary in the event that there is
not a pre-defined macro that meets your requirements. In that case the
general format of a rule in <filename>/etc/shorewall/rules</filename>
is:</para>
<programlisting>#ACTION SOURCE DESTINATION PROTO DEST PORT(S)
ACCEPT net $FW <emphasis>&lt;protocol&gt;</emphasis> <emphasis>&lt;port&gt;</emphasis></programlisting>
<example id="Example2">
<title>You want to run a Web Server and a IMAP Server on your firewall
system:</title>
<para><programlisting>#ACTION SOURCE DESTINATION PROTO DEST PORT(S)
ACCEPT net $FW tcp 80
ACCEPT net $FW tcp 143</programlisting></para>
</example>
<para>If you don't know what port and protocol a particular application
uses, see <ulink url="ports.htm">here</ulink>.</para>
</section>
<section>
<title>How do I make the firewall log a message when it disallows an
incoming connection?</title>
<para>Shorewall does not maintain a log itself but rather relies on your
<ulink url="shorewall_logging.html">system's logging
configuration</ulink>. The following <ulink
url="manpages/shorewall.html">commands</ulink> rely on knowing where
Netfilter messages are logged:</para>
<itemizedlist>
<listitem>
<para><command>shorewall show log</command> (Displays the last 20
Netfilter log messages)</para>
</listitem>
<listitem>
<para><command>shorewall logwatch</command> (Polls the log at a
settable interval</para>
</listitem>
<listitem>
<para><command>shorewall dump</command> (Produces an extensive
report for inclusion in Shorewall problem reports)</para>
</listitem>
</itemizedlist>
<para>It is important that these commands work properly because when you
encounter connection problems when Shorewall is running, the first thing
that you should do is to look at the Netfilter log; with the help of
<ulink url="FAQ.htm#faq17">Shorewall FAQ 17</ulink>, you can usually
resolve the problem quickly.</para>
<para>The Netfilter log location is distribution-dependent:</para>
<itemizedlist>
<listitem>
<para>Debian and its derivatives log Netfilter messages to
<filename>/var/log/kern.log</filename>.</para>
</listitem>
<listitem>
<para>Recent <trademark>SuSE/OpenSuSE</trademark> releases come
preconfigured with syslog-ng and log netfilter messages to
<filename>/var/log/firewall</filename>.</para>
</listitem>
<listitem>
<para>For other distributions, Netfilter messages are most commonly
logged to <filename>/var/log/messages</filename>.</para>
</listitem>
</itemizedlist>
<para>Modify the LOGFILE setting in
<filename>/etc/shorewall/shorewall.conf</filename> to specify the name
of your log.</para>
<important>
<para>The LOGFILE setting does not control where the Netfilter log is
maintained -- it simply tells the /sbin/<filename>shorewall</filename>
utility where to find the log.</para>
</important>
<para>Now, edit <filename>/etc/shorewall/policy</filename> and modify
the line that reads:</para>
<blockquote>
<para>net all DROP</para>
</blockquote>
<para>to</para>
<blockquote>
<para>net all DROP <emphasis role="bold">info</emphasis></para>
</blockquote>
<para>Then at a root prompt, type:</para>
<blockquote>
<para><command>/sbin/shorewall restart</command></para>
</blockquote>
</section>
<section>
<title>How do I prevent the firewall from forwarding connection
requests?</title>
<para>Edit /etc/shorewall/interfaces, and remove the routeback option
from the interface. e.g., change the line that reads:</para>
<blockquote>
<para>net all - dhcp,physical=+<emphasis
role="bold">,routeback</emphasis>,optional</para>
</blockquote>
<para>to</para>
<blockquote>
<para>net all - dhcp,physical=+,optional</para>
</blockquote>
<para>Then at a root prompt, type:</para>
<blockquote>
<para><command>/sbin/shorewall restart</command></para>
</blockquote>
</section>
</section>
</article>

View File

@@ -134,7 +134,7 @@ vpn ipv4 #OpenVPN clients
<para><filename>/etc/shorewall/hosts</filename>:</para>
<programlisting>#ZONE HOST(S) OPTIONS
drct eth3:dynamic
drct eth4:dynamic
<emphasis role="bold">dmz eth1:70.90.191.124/31</emphasis></programlisting>
<para>While the IP addresses 70.90.191.124 and 70.90.191.125 are

View File

@@ -20,6 +20,8 @@
<copyright>
<year>2002-2006</year>
<year>2010</year>
<holder>Thomas M. Eastep</holder>
</copyright>
@@ -34,6 +36,13 @@
</legalnotice>
</articleinfo>
<caution>
<para><emphasis role="bold">This article applies to Shorewall 4.4 and
later. If you are running a version of Shorewall earlier than Shorewall
4.3.5 then please see the documentation for that
release.</emphasis></para>
</caution>
<section id="Intro">
<title>Introduction</title>
@@ -61,6 +70,20 @@
the blacklists</emphasis>. Blacklists only stop blacklisted hosts from
connecting to you — they do not stop you or your users from connecting
to blacklisted hosts .</para>
<variablelist>
<varlistentry>
<term>UPDATE</term>
<listitem>
<para>Beginning with Shorewall 4.4.12, you can also blacklist by
destination address. See <ulink
url="manpages/shorewall-blacklist.html">shorewall-blacklist</ulink>
(5) and <ulink url="manpages/shorewall.html">shorewall</ulink> (8)
for details.</para>
</listitem>
</varlistentry>
</variablelist>
</important>
<important>
@@ -161,25 +184,28 @@ ipset -B Blacklist 206.124.146.177 -b SMTP</programlisting>
Prior to that release, the feature is always enabled.</para>
<para>Once enabled, dynamic blacklisting doesn't use any configuration
parameters but is rather controlled using /sbin/shorewall[-lite]
commands:</para>
parameters but is rather controlled using /sbin/shorewall[-lite] commands.
<emphasis role="bold">Note</emphasis> that <emphasis
role="bold">to</emphasis> and <emphasis role="bold">from</emphasis> may
only be specified when running <emphasis role="bold">Shorewall 4.4.12 or
later</emphasis>.</para>
<itemizedlist>
<listitem>
<para>drop <emphasis>&lt;ip address list&gt;</emphasis> - causes
packets from the listed IP addresses to be silently dropped by the
<para>drop [to|from] <emphasis>&lt;ip address list&gt;</emphasis> -
causes packets from the listed IP addresses to be silently dropped by
the firewall.</para>
</listitem>
<listitem>
<para>reject [to|from]<emphasis>&lt;ip address list&gt;</emphasis> -
causes packets from the listed IP addresses to be rejected by the
firewall.</para>
</listitem>
<listitem>
<para>reject <emphasis>&lt;ip address list&gt;</emphasis> - causes
packets from the listed IP addresses to be rejected by the
firewall.</para>
</listitem>
<listitem>
<para>allow <emphasis>&lt;ip address list&gt;</emphasis> - re-enables
receipt of packets from hosts previously blacklisted by a
<para>allow [to|from] <emphasis>&lt;ip address list&gt;</emphasis> -
re-enables receipt of packets from hosts previously blacklisted by a
<emphasis>drop</emphasis> or <emphasis>reject</emphasis>
command.</para>
</listitem>
@@ -201,19 +227,19 @@ ipset -B Blacklist 206.124.146.177 -b SMTP</programlisting>
</listitem>
<listitem>
<para>logdrop <emphasis>&lt;ip address list&gt;</emphasis> - causes
packets from the listed IP addresses to be dropped and logged by the
firewall. Logging will occur at the level specified by the
<para>logdrop [to|from] <emphasis>&lt;ip address list&gt;</emphasis> -
causes packets from the listed IP addresses to be dropped and logged
by the firewall. Logging will occur at the level specified by the
BLACKLIST_LOGLEVEL setting at the last [re]start (logging will be at
the 'info' level if no BLACKLIST_LOGLEVEL was given).</para>
</listitem>
<listitem>
<para>logreject <emphasis>&lt;ip address list&gt;</emphasis> - causes
packets from the listed IP addresses to be rejected and logged by the
firewall. Logging will occur at the level specified by the
BLACKLIST_LOGLEVEL setting at the last [re]start (logging will be at
the 'info' level if no BLACKLIST_LOGLEVEL was given).</para>
<para>logreject [to|from}<emphasis>&lt;ip address list&gt;</emphasis>
- causes packets from the listed IP addresses to be rejected and
logged by the firewall. Logging will occur at the level specified by
the BLACKLIST_LOGLEVEL setting at the last [re]start (logging will be
at the 'info' level if no BLACKLIST_LOGLEVEL was given).</para>
</listitem>
</itemizedlist>

View File

@@ -213,6 +213,12 @@
shaping.</para>
</listitem>
<listitem>
<para><filename>/etc/shorewall/secmarks</filename> - Added in
Shorewall 4.4.13. Attach an SELinux context to selected
packets.</para>
</listitem>
<listitem>
<para><filename>/etc/shorewall/vardir</filename> - Determines the
directory where Shorewall maintains its state.</para>
@@ -290,6 +296,30 @@ ACCEPT net $FW tcp www #This is an end-of-line comment</progra
</example>
</section>
<section id="Names">
<title>Names</title>
<para>When you define an object in Shorewall (<ulink
url="manpages/shorewall-zones.html">Zone</ulink>, <link
linkend="Logical">Logical Interface</link>, <ulink
url="ipsets.html">ipsets</ulink>, <ulink
url="Actions.html">Actions</ulink>, etc., you give it a name. Shorewall
names start with a letter and consist of letters, digits or underscores
("_"). Except for Zone names, Shorewall does not impose a limit on name
length.</para>
<para>When an ipset is referenced, the name must be preceded by a plus
sign ("+").</para>
<para>The last character of an interface may also be a plus sign to
indicate a wildcard name.</para>
<para>Physical interface names match names shown by 'ip link ls'; if the
name includes an at sign ("@"), do not include that character or any
character that follows. For example, "sit1@NONE" is referred to as simply
'sit1".</para>
</section>
<section id="COMMENT">
<title>Attach Comment to Netfilter Rules</title>
@@ -319,6 +349,10 @@ ACCEPT net $FW tcp www #This is an end-of-line comment</progra
<para><filename>/etc/shorewall/rules</filename></para>
</listitem>
<listitem>
<para><filename>/etc/shorewall/secmarks</filename></para>
</listitem>
<listitem>
<para><filename>/etc/shorewall/tcrules</filename></para>
</listitem>
@@ -396,7 +430,7 @@ gateway:~ #
COMMENT SSH
PARAM - - tcp 22 </programlisting>
<filename>/etc/shorewall/rules</filename>:<programlisting>COMMENT Allow SSH from home
SSH/ALLOW net:$MYIP $FW
SSH(ACCEPT) net:$MYIP $FW
COMMENT</programlisting>The comment line in macro.SSH will not override the
COMMENT line in the rules file and the generated rule will show <emphasis
role="bold">/* Allow SSH from home */</emphasis> when displayed through
@@ -486,8 +520,9 @@ ACCEPT net:\
<listitem>
<para>ADDRESS LIST — A list of one or more addresses (host or network)
or address ranges, separated by commas. In an IPv6 configuration, this
list must be includes in angled brackets ("&lt;...&gt;"). The list may
have <link linkend="Exclusion">exclusion</link>.</para>
list must be includef in square or angled brackets ("[...]" or
"&lt;...&gt;"). The list may have <link
linkend="Exclusion">exclusion</link>.</para>
</listitem>
</orderedlist>
@@ -526,7 +561,7 @@ ACCEPT net:\
<listitem>
<para>Host 2002:ce7c:92b4:1:a00:27ff:feb1:46a9 in the <emphasis
role="bold">loc</emphasis> zone — <emphasis
role="bold">loc:&lt;2002:ce7c:92b4:1:a00:27ff:feb1:46a9&gt;</emphasis></para>
role="bold">loc:[2002:ce7c:92b4:1:a00:27ff:feb1:46a9]</emphasis></para>
</listitem>
</orderedlist>
</section>
@@ -750,9 +785,7 @@ SHELL cat /etc/shorewall/rules.d/*.rules</programlisting></para>
</listitem>
<listitem>
<para>Should not depend on where the code is called from (the params
file is sourced by both /sbin/shorewall and
/usr/lib/shorewall/firewall).</para>
<para>Should not depend on where the code is called from.</para>
</listitem>
<listitem>
@@ -1318,7 +1351,7 @@ DNAT net loc:192.168.1.3 tcp 4000:4100</programlisting>
<para>Beginning with Shorewall 4.4.4, you can use logical interface names
which are mapped to the actual interface using the
<option>physical</option> option in <ulink
url="manpages/shorewall-interfaces.html">shorewall-interfraces</ulink>
url="manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>
(5).</para>
<para>Here is an example:</para>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 99 KiB

View File

@@ -22,6 +22,8 @@
<year>2008</year>
<year>2010</year>
<holder>Thomas M. Eastep</holder>
</copyright>
@@ -36,6 +38,13 @@
</legalnotice>
</articleinfo>
<caution>
<para><emphasis role="bold">This article applies to Shorewall 4.4 and
later. If you are running a version of Shorewall earlier than Shorewall
4.4.0 then please see the documentation appropriate for your
version.</emphasis></para>
</caution>
<section id="Ipsets">
<title>What are Ipsets?</title>
@@ -104,49 +113,41 @@
<para><filename>/etc/shorewall/rules</filename><programlisting>#ACTION SOURCE DEST PROTO DEST PORT(S)
ACCEPT net:+sshok $FW tcp 22</programlisting></para>
<para>Shorewall is not in the ipset load/reload business because the
Netfilter rule set is never cleared. That means that there is no
opportunity for Shorewall to load/reload your ipsets since that cannot be
done while there are any current rules using ipsets.</para>
<para>The name of the ipset can be optionally followed by a
comma-separated list of flags enclosed in square brackets ([...]). Each
flag is either <emphasis role="bold">src</emphasis> or <emphasis
role="bold">dst</emphasis> and specifies whether it is the SOURCE address
or port number or the DESTINATION address or port number that should be
matched. The number of flags must be appropriate for the type of ipset. If
no flags are given, Shorewall assumes that the set takes a single flag and
will select the flag based on the context. For example, in the blacklist
file and when the ipset appears in the SOURCE column of the rules file,
<emphasis role="bold">src</emphasis> is assumed. If the ipset appears in
the DEST column of the rules file, <emphasis role="bold">dst</emphasis> is
assumed. Note that by using <emphasis role="bold">[dst]</emphasis> in the
blacklist file, you can coerce the rule into matching the destination IP
address rather than the source.</para>
<para>So:</para>
<para>Shorewall can save/restore your ipset contents with certain
restrictions:</para>
<orderedlist numeration="upperroman">
<orderedlist>
<listitem>
<para>Your ipsets must be loaded before Shorewall starts. You are free
to try to do that with the following code in
<filename>/etc/shorewall/init (it works for me; your mileage may
vary)</filename>:</para>
<programlisting>if [ "$COMMAND" = start ]; then
ipset -F
ipset -X
ipset -R &lt; /etc/shorewall/ipsets
fi</programlisting>
<para>The file <filename>/etc/shorewall/ipsets</filename> will
normally be produced using the <command>ipset -S</command>
command.</para>
<para>The above will work most of the time but will fail in a
<command>shorewall stop</command> - <command>shorewall start</command>
sequence if you use ipsets in your routestopped file (see
below).</para>
<para>You must set SAVE_IPSETS=Yes in <ulink
url="manpages/shorewall.conf.html">shorewall.conf</ulink> (5).</para>
</listitem>
<listitem>
<para>Your ipsets may not be reloaded until Shorewall is stopped or
cleared.</para>
<para>You cannot use an ipset in <ulink
url="manpages/shorewall-routestopped.html">shorewall-routestopped</ulink>
(5).</para>
</listitem>
<listitem>
<para>If you specify ipsets in your routestopped file then Shorewall
must be cleared in order to reload your ipsets.</para>
<para>The <command>restore</command> command cannot restore ipset
contents saved by the <command>save</command> command unless the
firewall is first stopped.</para>
</listitem>
</orderedlist>
<para>As a consequence, scripts generated by the Perl-based compiler will
ignore <filename>/etc/shorewall/ipsets</filename> and will issue a warning
if you set SAVE_IPSETS=Yes in <filename>shorewall.conf</filename></para>
</section>
</article>

View File

@@ -18,7 +18,7 @@
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
<copyright>
<year>2001-2007</year>
<year>2001-2010</year>
<holder>Thomas M. Eastep</holder>
</copyright>
@@ -596,6 +596,9 @@ esac</programlisting><caution>
<para>Example:</para>
<programlisting>my $chainref = $filter_table-&gt;{INPUT}; #Same as above with a few less keystrokes; runs faster too</programlisting>
<para>For imformation about the 'compile' extension script, see the
<ulink url="ManualChains.html">Manual Chains article</ulink>.</para>
</section>
</section>
</article>

View File

@@ -16,7 +16,7 @@
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
<copyright>
<year>2001-2009</year>
<year>2001-2010</year>
<holder>Thomas M Eastep</holder>
</copyright>
@@ -246,6 +246,37 @@
<para><ulink url="IPv6Support.html"><emphasis
role="bold">IPv6</emphasis> Support</ulink></para>
</listitem>
<listitem>
<para>Works with a wide range of <emphasis
role="bold">Virtualization</emphasis> Solutions:</para>
<itemizedlist>
<listitem>
<para><ulink url="KVM.html"><emphasis
role="bold">KVM</emphasis></ulink></para>
</listitem>
<listitem>
<para><ulink url="XenMyWay-Routed.html"><emphasis
role="bold">Xen</emphasis></ulink></para>
</listitem>
<listitem>
<para><ulink url="Vserver.html"><emphasis
role="bold">Linux-Vserver</emphasis></ulink></para>
</listitem>
<listitem>
<para><ulink url="OpenVZ.html"><emphasis
role="bold">OpenVZ</emphasis></ulink></para>
</listitem>
<listitem>
<para>VirtualBox</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</section>
</article>

View File

@@ -62,7 +62,7 @@
<para>Assuming that your external interface is eth0:</para>
<programlisting>#INTERFACE TYPE IN-BANDWIDTH
<programlisting>#INTERFACE TYPE IN-BANDWIDTH OUT-BANDWIDTH
eth0 External</programlisting>
<note>
@@ -214,13 +214,13 @@ eth0 External</programlisting>
is NO space between the number and the unit (it is 100kbit not 100 kbit).
<emphasis role="bold">mbit</emphasis>, <emphasis
role="bold">mbps</emphasis> or a raw number (which means bytes) can be
used, but note that only integer numbers are supported (0.5 is not valid).
To pick an appropriate setting, we recommend that you start by setting
IN-BANDWIDTH significantly below your measured download bandwidth (20% or
so). While downloading, measure the ping response time from the firewall
to the upstream router as you gradually increase the setting. The optimal
setting is at the point beyond which the ping time increases sharply as
you increase the setting.</para>
used, but note that before Shorewall 4.4.13 only integer numbers were
supported (0.5 was not valid). To pick an appropriate setting, we
recommend that you start by setting IN-BANDWIDTH significantly below your
measured download bandwidth (20% or so). While downloading, measure the
ping response time from the firewall to the upstream router as you
gradually increase the setting. The optimal setting is at the point beyond
which the ping time increases sharply as you increase the setting.</para>
<para>Simple Traffic Shaping is only appropriate on interfaces where
output queuing occurs. As a consequence, you usually only use it on
@@ -231,6 +231,19 @@ eth0 External</programlisting>
<programlisting>#INTERFACE TYPE IN-BANDWIDTH
tun0 Internal</programlisting>
<para>For fast lines, the actual download rate may be significantly less
than the specified IN-BANDWIDTH. Beginning with Shoreall 4.4.13, you can
specify an optional burst </para>
<para>Also beginning with Shorewall 4.4.13, an OUT-BANDWIDTH column is
available in <ulink
url="manpages/shorewall-tcpri.html">shorewall-tcpri</ulink>(5). Limiting
to outgoing bandwidth can have a positive effect on latency for
applications like VOIP. We recommend that you begin with a setting that is
at least 20% less than your measured upload rate and then gradually
increase it until latency becomes unacceptable. Then reduce it back to the
point where latency is acceptable.</para>
</section>
<section>

View File

@@ -428,9 +428,7 @@ State:Stopped (Thu Mar 30 14:08:11 PDT 2006)</programlisting>
below).</para>
<para>For <emphasis role="bold">quick questions</emphasis>, there is also
a #shorewall channel at irc.freenode.net. <emphasis role="bold">You must
have a registered Nic on freenode in order to post on the
channel.</emphasis></para>
a #shorewall channel at irc.freenode.net. </para>
</section>
<section id="Users">

View File

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

View File

@@ -428,11 +428,12 @@
<listitem>
<para>REDIRECTED INTERFACES — Entries are appropriate in this column
only if the device in the INTERFACE column names a <link
linkend="IFB">Intermediate Functional Block (IFB)</link>. It lists the
physical interfaces that will have their input shaped using classes
defined on the IFB. Neither the IFB nor any of the interfaces listed
in this column may have an IN-BANDWIDTH specified. You may specify
zero (0) or a dash ("-:) in the IN-BANDWIDTH column.</para>
linkend="IFB">Intermediate Functional Block (IFB)</link>. It lists
the physical interfaces that will have their input shaped using
classes defined on the IFB. Neither the IFB nor any of the
interfaces listed in this column may have an IN-BANDWIDTH specified.
You may specify zero (0) or a dash ("-:) in the IN-BANDWIDTH
column.</para>
<para>IFB devices automatically get the <emphasis
role="bold">classify</emphasis> option.</para>
@@ -816,12 +817,9 @@ ppp0 6000kbit 500kbit</programlisting>
in-depth look at the packet marking facility in Netfilter/Shorewall,
please see <ulink url="PacketMarking.html">this article</ulink>.</para>
<para>Normally, packet marking occurs in the PREROUTING chain before any
address rewriting takes place. This makes it impossible to mark inbound
packets based on their destination address when SNAT or Masquerading are
being used. You can cause packet marking to occur in the FORWARD chain
by using the MARK_IN_FORWARD_CHAIN option in shorewall.conf or by using
the :F qualifier (see below).</para>
<para><emphasis role="bold">For marking forwarded traffic, you must
either set MARK_IN_FORWARD_CHAIN=Yes shorewall.conf or by using the :F
qualifier (see below).</emphasis></para>
<para>Columns in the file are as follows:</para>

View File

@@ -35,7 +35,8 @@
<term><emphasis role="bold">ACTION</emphasis> - {<emphasis
role="bold">COUNT</emphasis>|<emphasis
role="bold">DONE</emphasis>|<emphasis>chain</emphasis>[:<emphasis
role="bold">COUNT</emphasis>]}</term>
role="bold">{COUNT</emphasis>:JUMP}]|COUNT
<emphasis>comment</emphasis>}</term>
<listitem>
<para>What to do when a matching packet is found.</para>
@@ -76,6 +77,15 @@
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>chain</emphasis>:JUMP</term>
<listitem>
<para>Like the previous option without the <emphasis
role="bold">:COUNT</emphasis> part.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>COMMENT</term>
@@ -306,6 +316,147 @@
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">IPSEC - <emphasis>option-list</emphasis>
(Optional - Added in Shorewall 4.4.13 )</emphasis></term>
<listitem>
<para>The option-list consists of a comma-separated list of options
from the following list. Only packets that will be encrypted or have
been de-crypted via an SA that matches these options will have their
source address changed.</para>
<variablelist>
<varlistentry>
<term><emphasis
role="bold">reqid=</emphasis><emphasis>number</emphasis></term>
<listitem>
<para>where <emphasis>number</emphasis> is specified using
setkey(8) using the 'unique:<emphasis>number</emphasis> option
for the SPD level.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">spi=</emphasis>&lt;number&gt;</term>
<listitem>
<para>where <emphasis>number</emphasis> is the SPI of the SA
used to encrypt/decrypt packets.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">proto=</emphasis><emphasis
role="bold">ah</emphasis>|<emphasis
role="bold">esp</emphasis>|<emphasis
role="bold">ipcomp</emphasis></term>
<listitem>
<para>IPSEC Encapsulation Protocol</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">mss=</emphasis><emphasis>number</emphasis></term>
<listitem>
<para>sets the MSS field in TCP packets</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">mode=</emphasis><emphasis
role="bold">transport</emphasis>|<emphasis
role="bold">tunnel</emphasis></term>
<listitem>
<para>IPSEC mode</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">tunnel-src=</emphasis><emphasis>address</emphasis>[/<emphasis>mask</emphasis>]</term>
<listitem>
<para>only available with mode=tunnel</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis
role="bold">tunnel-dst=</emphasis><emphasis>address</emphasis>[/<emphasis>mask</emphasis>]</term>
<listitem>
<para>only available with mode=tunnel</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">strict</emphasis></term>
<listitem>
<para>Means that packets must match all rules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">next</emphasis></term>
<listitem>
<para>Separates rules; can only be used with strict</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">yes</emphasis> or <emphasis
role="bold">ipsec</emphasis></term>
<listitem>
<para>When used by itself, causes all traffic that will be
encrypted/encapsulated or has been decrypted/un-encapsulted to
match the rule.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">no</emphasis> or <emphasis
role="bold">none</emphasis></term>
<listitem>
<para>When used by itself, causes all traffic that will not be
encrypted/encapsulated or has been decrypted/un-encapsulted to
match the rule.</para>
</listitem>
</varlistentry>
</variablelist>
<para>If this column is non-empty, then:</para>
<itemizedlist>
<listitem>
<para>A chain NAME may appearing in the ACTION column must be a
chain branched either directly or indirectly from the <emphasis
role="bold">accountin</emphasis> or <emphasis
role="bold">accountout</emphasis> chain.</para>
</listitem>
<listitem>
<para>The CHAIN column must contain either <emphasis
role="bold">accountin</emphasis> or <emphasis
role="bold">accountout</emphasis> or a chain branched either
directly or indirectly from those chains.</para>
</listitem>
</itemizedlist>
<para>These rules will NOT appear in the <emphasis
role="bold">accounting</emphasis> chain.</para>
</listitem>
</varlistentry>
</variablelist>
<para>In all of the above columns except <emphasis
@@ -330,12 +481,13 @@
</ulink></para>
<para>shorewall(8), shorewall-actions(5), shorewall-blacklist(5),
shorewall-hosts(5), shorewall-interfaces(5), shorewall-ipsec(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-route_rules(5),
shorewall-hosts(5), shorewall-interfaces(5), shorewall-maclist(5),
shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5),
shorewall-params(5), shorewall-policy(5), shorewall-providers(5),
shorewall-proxyarp(5), shorewall-route_rules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-tcrules(5),
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para>
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
shorewall-tcrules(5), shorewall-tos(5), shorewall-tunnels(5),
shorewall-zones(5)</para>
</refsect1>
</refentry>

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<refentry>
<refmeta>
<refentrytitle>shorewall-actions</refentrytitle>
@@ -48,11 +50,11 @@
url="http://shorewall.net/Actions.html">http://shorewall.net/Actions.html</ulink></para>
<para>shorewall(8), shorewall-accounting(5), shorewall-blacklist(5),
shorewall-hosts(5), shorewall-interfaces(5), shorewall-ipsec(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-route_rules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
shorewall-hosts(5), shorewall-interfaces(5), shorewall-maclist(5),
shorewall-masq(5), shorewall-nat(5), shorewall-netmap(5),
shorewall-params(5), shorewall-policy(5), shorewall-providers(5),
shorewall-proxyarp(5), shorewall-route_rules(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5),
shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-tcrules(5),
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1>

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