Compare commits

..

410 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
Tom Eastep
e4d35ee3cb Add 'yes' to valid ipsec options in /etc/shorewall/masq 2010-07-14 07:01:18 -07:00
Tom Eastep
f92f75196c Correct accidental modification of action.Drop 2010-07-14 06:27:27 -07:00
Tom Eastep
a29921c9d2 Reverse order of ICMPv6 and Multicast/anycast filtering 2010-07-13 13:03:55 -07:00
Tom Eastep
d447482dd6 Fix typo in rules manpages 2010-07-13 07:37:14 -07:00
Tom Eastep
b52b7c422f Drop multicast and anycast in Drop and Reject actions 2010-07-12 16:44:34 -07:00
Tom Eastep
c1b212225e Use uniform coding style in latest changes 2010-07-12 13:07:11 -07:00
Tom Eastep
328e1b7f6a Don't generate rules to link local net from vserver zones 2010-07-12 12:39:51 -07:00
Tom Eastep
59189d6324 Don't generate rules from link local net to vserver zones 2010-07-12 11:52:56 -07:00
Tom Eastep
eff84ae8a6 Add warning about ff80::/10 in shorewall6-interfaces manpage 2010-07-12 11:19:11 -07:00
Tom Eastep
4792d1e5f1 Fix nets= in Shorewall6 2010-07-11 19:52:18 -07:00
Tom Eastep
5a5546ef1b Set version to 4.4.11 2010-07-09 09:01:08 -07:00
Tom Eastep
d0c1c3d69c Change comment to clarify assumption about function arguments 2010-07-08 17:45:18 -07:00
Tom Eastep
9eca7fb37b Simplify logic in loopback helper functions 2010-07-08 17:11:27 -07:00
Tom Eastep
8d5f04d5a5 Correct TC_PRIO description in shorewall.conf and shorewall6.conf manpages 2010-07-07 15:35:26 -07:00
Tom Eastep
591a4bc7f6 Revert version of modules with only whitespace changes; rename a couple of functions for clarity 2010-07-07 06:43:07 -07:00
Tom Eastep
74092a9b14 Restrict Shorewall6 netstat call to IPv6 only 2010-07-06 06:42:37 -07:00
Tom Eastep
ecd22d34fa Reword warning message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-05 13:15:13 -07:00
Tom Eastep
35a4b8e7f4 Update Vserver FAQ
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-05 13:12:06 -07:00
Tom Eastep
02fab09a14 Add PERL= option to shorewall.conf and shorewall6.conf
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-05 13:11:52 -07:00
Tom Eastep
4547067da9 Document fix for missing closing quote 2010-07-05 11:43:37 -07:00
Tom Eastep
31a9d24164 Fix missing quote when REQUIRE_INTERFACE=Yes 2010-07-05 09:47:03 -07:00
Tom Eastep
f977631af9 Just reset provider bits in FORWARD chain 2010-07-05 09:46:24 -07:00
Tom Eastep
b445b4fdd9 Fix compiler detection of FWMARK_RT_MASK -- take 2 2010-07-05 08:51:13 -07:00
Tom Eastep
0e87ccbcfd Fix compiler detection of FWMARK_RT_MASK 2010-07-05 08:39:32 -07:00
Tom Eastep
542557069e Back out a couple of harmless but unintended changes 2010-07-05 08:02:51 -07:00
Tom Eastep
aa6bb6e911 Improve wording of FORWARD_CLEAR_MARK description 2010-07-05 07:53:31 -07:00
Tom Eastep
898c3a045f Bump version to RC1 2010-07-05 07:08:06 -07:00
Tom Eastep
6a644716c9 Unconditionally use /usr/bin/perl 2010-07-04 17:13:33 -07:00
Tom Eastep
312624cef5 Fix NET3 bug (netmap) 2010-07-04 15:58:37 -07:00
Tom Eastep
7689831cd7 Minor cleanup of 4.4.11 Beta 3.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-04 09:29:16 -07:00
Tom Eastep
2ee4fd8f5a Add FWMARK_RT_MASK capability.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-04 09:08:04 -07:00
Tom Eastep
d3e30b5fe4 Add FORWARD_CLEAR_MARK option 2010-07-03 17:03:42 -07:00
Tom Eastep
5d1e19364a Bump version to Beta 3 2010-07-03 10:54:39 -07:00
Tom Eastep
148b251766 Only send loopback traffic to the 'loopback' chain 2010-07-03 10:53:25 -07:00
Tom Eastep
21ce6f9b84 Add new zone-list function to return all but firewall zone.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-03 08:33:10 -07:00
Tom Eastep
c8274f0538 Minor vserver doc update 2010-07-02 13:34:21 -07:00
Tom Eastep
63154367ad Forbid 'ipsec' in a vserver host entry
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-02 13:12:23 -07:00
Tom Eastep
e5d3ce582a Correct Old Defect in ipsec match generation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-02 13:11:57 -07:00
Tom Eastep
9e81a5101f Cleaner fix for ipsec/vserver issue
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-02 12:24:58 -07:00
Tom Eastep
261af19b4e Fix invalid policy match with vserver zone.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-02 12:18:18 -07:00
Tom Eastep
364cddf99b Update release documents for find_hosts_by_option() fix
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-02 07:40:30 -07:00
Tom Eastep
f2ca9e25c9 Make find_hosts_by_option() work with options specified on the interface 2010-07-02 07:19:52 -07:00
Tom Eastep
db8dba66db Correct defect in the handling of 'trace' and 'debug'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-01 15:56:57 -07:00
Tom Eastep
ba535b8937 Correct IPv6 zones file in Vserver doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-07-01 15:56:34 -07:00
Tom Eastep
f538aecd82 Update the Vserver article with IPv6 and a graphic 2010-07-01 15:13:29 -07:00
Tom Eastep
338c021272 Fix refression in handling of mss= 2010-07-01 09:05:25 -07:00
Tom Eastep
7dbf829e9b Clean up Vserver doc 2010-07-01 07:22:54 -07:00
Tom Eastep
64decb25fe Bump version to 4.4.11-Beta2 2010-07-01 07:08:11 -07:00
Tom Eastep
9f15ccb24f Update Raw.pm version.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-30 20:40:26 -07:00
Tom Eastep
e4afc15370 Finish Vserver Implementation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-30 20:35:46 -07:00
Tom Eastep
ac4349e930 Add more IPv6 configuration info 2010-06-27 17:46:12 -07:00
Tom Eastep
236269eafc Add IPv6 example to the OpenVPN doc 2010-06-27 16:26:40 -07:00
Tom Eastep
de3c28ded3 Add 6to4 to documented tunnel types
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-27 08:12:14 -07:00
Tom Eastep
9e37fe1ffa Deimplement flawed rate limiting with simple TC
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-26 07:42:08 -07:00
Tom Eastep
fc95cb8dc6 Run insserv when installed on Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-26 07:34:34 -07:00
Tom Eastep
914d752f1d Fix latency parsing 2010-06-25 16:10:26 -07:00
Tom Eastep
ed72afd8a0 Add comment about the unfortunate name of the tcrules file 2010-06-25 06:33:14 -07:00
Tom Eastep
fe27554fd0 Document undefined value issue
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-24 14:18:48 -07:00
Tom Eastep
2909b6fd92 Quiet down the Perl interpreter on some boxen 2010-06-24 13:58:46 -07:00
Tom Eastep
cc376ab72e Update release documents for REQUIRE_INTERFACE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-23 13:00:00 -07:00
Tom Eastep
3cda3d0315 Add REQUIRE_INTERFACE to shorewall*.conf
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-23 12:58:35 -07:00
Tom Eastep
1cb22d0bcf First feeble steps toward vserver zones 2010-06-22 16:42:20 -07:00
Tom Eastep
d5aaa97d4e Update release documents for changes ported from the 4.4.10 branch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-22 08:40:07 -07:00
Tom Eastep
2d6647c445 Make 'shorewall6 show connections' more readable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-22 08:32:15 -07:00
Tom Eastep
055ac41a23 Make IPv6 log output readable 2010-06-21 15:38:47 -07:00
Tom Eastep
6d6b8cf7d6 Fix crazy Debian start priority for shorewall-init 2010-06-21 15:38:25 -07:00
Tom Eastep
efa4cfa921 Update release documents for 4.4.11 Beta 1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-18 12:09:43 -07:00
Tom Eastep
dbbe6b264d Fix the IPSET fix 2010-06-18 12:06:12 -07:00
Tom Eastep
e7340dabc0 Fix IPSET issue 2010-06-18 12:05:44 -07:00
Tom Eastep
503b1cf795 Update release note version banner 2010-06-16 16:46:56 -07:00
Tom Eastep
40f57bf926 Update Squid Document 2010-06-16 09:24:01 -07:00
Tom Eastep
32d8a9d996 Allow patch from Gabriel 2010-06-12 14:10:40 -07:00
Tom Eastep
d58127e51c Allow networks to be specified in a NETMAP rule 2010-06-12 13:50:58 -07:00
Tom Eastep
9acec39898 Fix a couple of issues with Simple TC 2010-06-12 13:50:11 -07:00
Tom Eastep
625f254d02 Add tcfilters to manpage index 2010-06-10 06:15:15 -07:00
Tom Eastep
6040f02bb0 Don't set variables needlessly 2010-06-08 16:33:54 -07:00
Tom Eastep
32d575a8c8 Remove extra logic 2010-06-08 16:18:23 -07:00
Tom Eastep
dcd64cd096 Move ipset-load code to Chains.pm. Better there than in Compiler.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 16:18:14 -07:00
Tom Eastep
a5816c23d4 Move save_dynamic_chains to Chains.pm where it belongs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 16:17:57 -07:00
Tom Eastep
6537c1e55a Improve readability 2010-06-08 16:16:23 -07:00
Tom Eastep
f50a609d1d Update the UPnP document with the 4.4.10 changes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 11:34:37 -07:00
Tom Eastep
e061d15baf Update blacklisting doc with 4.4.10 behavior.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 11:32:39 -07:00
Tom Eastep
52a80e69a9 More tweaks to saving/restoring dynamic chains
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 11:27:09 -07:00
Tom Eastep
ec3fdbde98 More changes having to do with with dynamic chains
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-08 11:26:53 -07:00
Tom Eastep
aa4b0f71af Much cleaner implementation of save_dynamic_chains()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 10:11:33 -07:00
Tom Eastep
0978f3d41a More periodic removal of trailing white space 2010-06-07 09:16:56 -07:00
Tom Eastep
3467969c26 Periodic removal of trailing white space 2010-06-07 07:30:56 -07:00
Tom Eastep
04de6fac6d Make dynamic chain saving work with IPv6
Also, use hidden files to save the chain contents.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-07 07:18:21 -07:00
Tom Eastep
b741ff2a81 Document first 4.4.11 features 2010-06-06 20:40:39 -07:00
Tom Eastep
db138edbd1 Update versions of modified modules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-06 13:49:26 -07:00
Tom Eastep
b3370dfd78 Initiate 4.4.11
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-06 13:36:45 -07:00
Tom Eastep
17b6e370af Purge saved dynamic blacklist if the chain doesn't exist 2010-06-06 13:24:09 -07:00
Tom Eastep
25c0e3c7b3 Retain UPnP and dynamic blacklist over 'restart' 2010-06-06 13:23:49 -07:00
Tom Eastep
f412f96153 Add introduction to config file basics document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-06 08:24:28 -07:00
Tom Eastep
ca7d145746 Don't enter command mode for upnpclient rule for non-optional interface
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-06 08:05:19 -07:00
Tom Eastep
99a0226a43 Slight improvement of regular expression used to insert chain name into rules after '-A'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-06 08:04:28 -07:00
Tom Eastep
fdc3b698a9 Version to 4.4.10 (again) 2010-06-05 15:58:23 -07:00
Tom Eastep
d388b29d70 Let Zones.pm export chain_base rather than Chains.pm 2010-06-05 08:40:00 -07:00
Tom Eastep
0e995d65ac Version to 4.4.10-RC2 2010-06-04 16:19:15 -07:00
Tom Eastep
742a3b2eef Make wait and required work on wildcard interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-04 10:35:45 -07:00
Tom Eastep
82a74d7534 Resolve Optional/Required interfaces with wildcard names
Optional is allowed
Required is not

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-04 08:46:29 -07:00
Tom Eastep
165535cd8b Disallow wildcard optional/required interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-04 07:18:55 -07:00
Tom Eastep
7625b4069b Delete references to prenet subsystem locks.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-06-03 12:31:39 -07:00
Tom Eastep
43afd03b9b Bump version to 4.4.10 2010-06-03 11:18:02 -07:00
180 changed files with 7850 additions and 2039 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 LOGTAGONLY=No
LOGRATE= LOGLIMIT=
LOGBURST=
LOGALLNEW= LOGALLNEW=
@@ -70,6 +68,8 @@ TC=
IPSET= IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh SHOREWALL_SHELL=/bin/sh
@@ -205,6 +205,12 @@ OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes LOAD_HELPERS_ONLY=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 # 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 LOGTAGONLY=No
LOGRATE= LOGLIMIT=
LOGBURST=
LOGALLNEW= LOGALLNEW=
@@ -70,6 +68,8 @@ TC=
IPSET= IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh SHOREWALL_SHELL=/bin/sh
@@ -205,6 +205,12 @@ OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes LOAD_HELPERS_ONLY=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 # 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 LOGTAGONLY=No
LOGRATE= LOGLIMIT=
LOGBURST=
LOGALLNEW= LOGALLNEW=
@@ -77,6 +75,8 @@ TC=
IPSET= IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh SHOREWALL_SHELL=/bin/sh
@@ -212,6 +212,12 @@ OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes LOAD_HELPERS_ONLY=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 # 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 LOGTAGONLY=No
LOGRATE= LOGLIMIT=
LOGBURST=
LOGALLNEW= LOGALLNEW=
@@ -58,6 +56,8 @@ SMURF_LOG_LEVEL=info
IP6TABLES= IP6TABLES=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh SHOREWALL_SHELL=/bin/sh
@@ -153,6 +153,12 @@ OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes LOAD_HELPERS_ONLY=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 # 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 LOGTAGONLY=No
LOGRATE= LOGLIMIT=
LOGBURST=
LOGALLNEW= LOGALLNEW=
@@ -58,6 +56,8 @@ SMURF_LOG_LEVEL=info
IP6TABLES= IP6TABLES=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh SHOREWALL_SHELL=/bin/sh
@@ -153,6 +153,12 @@ OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes LOAD_HELPERS_ONLY=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 # 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 # Copyright (C) 2006 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
@@ -40,9 +40,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No LOGTAGONLY=No
LOGRATE= LOGLIMIT=
LOGBURST=
LOGALLNEW= LOGALLNEW=
@@ -58,6 +56,8 @@ SMURF_LOG_LEVEL=info
IP6TABLES= IP6TABLES=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh SHOREWALL_SHELL=/bin/sh
@@ -153,6 +153,12 @@ OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes LOAD_HELPERS_ONLY=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 # 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 VARDIR=/var/lib/$PRODUCT
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir [ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
if [ -x $VARDIR/firewall ]; then 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 fi
done done

View File

@@ -84,7 +84,20 @@ shorewall_start () {
VARDIR=/var/lib/$product VARDIR=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir [ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then 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 fi
done done
@@ -103,7 +116,11 @@ shorewall_stop () {
VARDIR=/var/lib/$product VARDIR=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir [ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then 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 fi
done done

View File

@@ -55,15 +55,17 @@ fi
# Initialize the firewall # Initialize the firewall
shorewall_start () { shorewall_start () {
local product local PRODUCT
local vardir local VARDIR
echo -n "Initializing \"Shorewall-based firewalls\": " echo -n "Initializing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
vardir=/var/lib/$product VARDIR=/var/lib/$PRODUCT
[ -f /etc/$product/vardir ] && . /etc/$product/vardir [ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
if [ -x ${vardir}/firewall ]; then if [ -x ${VARDIR}/firewall ]; then
${vardir}/firewall stop || exit 1 if ! /sbin/$PRODUCT status > /dev/null 2>&1; then
${VARDIR}/firewall stop || echo_notdone
fi
fi fi
done done
@@ -72,15 +74,15 @@ shorewall_start () {
# Clear the firewall # Clear the firewall
shorewall_stop () { shorewall_stop () {
local product local PRODUCT
local vardir local VARDIR
echo -n "Clearing \"Shorewall-based firewalls\": " echo -n "Clearing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
vardir=/var/lib/$PRODUCT VARDIR=/var/lib/$PRODUCT
[ -f /etc/$product/vardir ] && . /etc/$product/vardir [ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
if [ -x ${vardir}/firewall ]; then if [ -x ${VARDIR}/firewall ]; then
${vardir}/firewall clear || exit 1 ${VARDIR}/firewall clear || exit 1
fi fi
done done

View File

@@ -23,7 +23,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status usage() # $1 = exit status
{ {
@@ -285,7 +285,12 @@ fi
if [ -z "$DESTDIR" ]; then if [ -z "$DESTDIR" ]; then
if [ -n "$first_install" ]; then if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then if [ -n "$DEBIAN" ]; then
ln -sf ../init.d/shorewall-init /etc/rcS.d/S38shorewall-init if [ -x /sbin/insserv ]; then
insserv /etc/init.d/shorewall-init
else
ln -sf ../init.d/shorewall-init /etc/rcS.d/S38shorewall-init
fi
echo "Shorewall Init will start automatically at boot" echo "Shorewall Init will start automatically at boot"
else else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then

View File

@@ -1,6 +1,6 @@
%define name shorewall-init %define name shorewall-init
%define version 4.4.10 %define version 4.4.13
%define release 0RC1 %define release 0base
Summary: Shorewall-init adds functionality to Shoreline Firewall (Shorewall). Summary: Shorewall-init adds functionality to Shoreline Firewall (Shorewall).
Name: %{name} Name: %{name}
@@ -99,6 +99,48 @@ fi
%doc COPYING changelog.txt releasenotes.txt %doc COPYING changelog.txt releasenotes.txt
%changelog %changelog
* 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
- Updated to 4.4.11-0RC1
* Sat Jul 03 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta3
* Thu Jul 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta2
* Sun Jun 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta1
* Sat Jun 05 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net * Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1 - Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net * Wed May 26 2010 Tom Eastep tom@shorewall.net

View File

@@ -26,7 +26,7 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status usage() # $1 = exit status
{ {

View File

@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status usage() # $1 = exit status
{ {
@@ -354,7 +354,13 @@ if [ -z "$DESTDIR" ]; then
if [ -n "$first_install" ]; then if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall-lite run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall-lite
ln -s ../init.d/shorewall-lite /etc/rcS.d/S40shorewall-lite
if [ -x /sbin/insserv ]; then
insserv /etc/init.d/shorewall-lite
else
ln -s ../init.d/shorewall-lite /etc/rcS.d/S40shorewall-lite
fi
echo "Shorewall Lite will start automatically at boot" echo "Shorewall Lite will start automatically at boot"
else else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then

View File

@@ -628,14 +628,12 @@ case "$COMMAND" in
shift shift
start_command $@ start_command $@
;; ;;
stop|clear) stop|reset|clear)
[ $# -ne 1 ] && usage 1 [ $# -ne 1 ] && usage 1
verify_firewall_script verify_firewall_script
run_it $g_firewall $debugging $nolock $COMMAND [ -n "$nolock" ] || mutex_on
;; run_it $g_firewall $debugging $COMMAND
reset) [ -n "$nolock" ] || mutex_off
verify_firewall_script
run_it $SHOREWALL_SHELL $g_firewall $debugging $nolock $@
;; ;;
restart) restart)
shift shift
@@ -777,14 +775,9 @@ case "$COMMAND" in
g_restorepath=${VARDIR}/$RESTOREFILE g_restorepath=${VARDIR}/$RESTOREFILE
if [ -x $g_restorepath ]; then if [ -x $g_restorepath ]; then
if [ -x ${g_restorepath}-ipsets ]; then
rm -f ${g_restorepath}-ipsets
echo " ${g_restorepath}-ipsets removed"
fi
rm -f $g_restorepath rm -f $g_restorepath
rm -f ${g_restorepath}-iptables rm -f ${g_restorepath}-iptables
rm -f ${g_restorepath}-ipsets
echo " $g_restorepath removed" echo " $g_restorepath removed"
elif [ -f $g_restorepath ]; then elif [ -f $g_restorepath ]; then
echo " $g_restorepath exists and is not a saved Shorewall configuration" echo " $g_restorepath exists and is not a saved Shorewall configuration"

View File

@@ -1,6 +1,6 @@
%define name shorewall-lite %define name shorewall-lite
%define version 4.4.10 %define version 4.4.13
%define release 0RC1 %define release 0base
Summary: Shoreline Firewall Lite is an iptables-based firewall for Linux systems. Summary: Shoreline Firewall Lite is an iptables-based firewall for Linux systems.
Name: %{name} Name: %{name}
@@ -102,6 +102,48 @@ fi
%doc COPYING changelog.txt releasenotes.txt %doc COPYING changelog.txt releasenotes.txt
%changelog %changelog
* 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
- Updated to 4.4.11-0RC1
* Sat Jul 03 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta3
* Thu Jul 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta2
* Sun Jun 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta1
* Sat Jun 05 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net * Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1 - Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net * Wed May 26 2010 Tom Eastep tom@shorewall.net

View File

@@ -26,7 +26,7 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status usage() # $1 = exit status
{ {

View File

@@ -35,7 +35,7 @@ use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( setup_accounting ); our @EXPORT = qw( setup_accounting );
our @EXPORT_OK = qw( ); 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 # Called by the compiler to [re-]initialize this module's state
@@ -52,7 +52,7 @@ sub process_accounting_rule( ) {
our $jumpchainref; 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' ) { if ( $action eq 'COMMENT' ) {
process_comment; process_comment;
@@ -61,6 +61,16 @@ sub process_accounting_rule( ) {
our $disposition = ''; 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( $ ) { sub check_chain( $ ) {
my $chainref = shift; my $chainref = shift;
fatal_error "A non-accounting chain ($chainref->{name}) may not appear in the accounting file" if $chainref->{policy}; 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( $ ) { sub jump_to_chain( $ ) {
my $jumpchain = $_[0]; 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 ); check_chain( $jumpchainref );
$disposition = $jumpchain; $disposition = $jumpchain;
"-j $jumpchain"; $jumpchain;
} }
my $target = ''; 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 $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} );
my $rule2 = 0; my $rule2 = 0;
my $jump = 0;
unless ( $action eq 'COUNT' ) { unless ( $action eq 'COUNT' ) {
if ( $action eq 'DONE' ) { if ( $action eq 'DONE' ) {
$target = '-j RETURN'; $target = 'RETURN';
} else { } else {
( $action, my $cmd ) = split /:/, $action; ( $action, my $cmd ) = split /:/, $action;
if ( $cmd ) { if ( $cmd ) {
if ( $cmd eq 'COUNT' ) { if ( $cmd eq 'COUNT' ) {
$rule2=1; $rule2 = 1;
} elsif ( $cmd ne 'JUMP' ) { } elsif ( $cmd eq 'JUMP' ) {
$jump = 1;
} else {
accounting_error; accounting_error;
} }
} }
@@ -137,7 +151,31 @@ sub process_accounting_rule( ) {
$dest = ALLIP if $dest eq 'any' || $dest eq 'all'; $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 expand_rule
$chainref , $chainref ,
@@ -151,6 +189,22 @@ sub process_accounting_rule( ) {
$disposition , $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 ) { if ( $rule2 ) {
expand_rule expand_rule
$jumpchainref , $jumpchainref ,
@@ -178,8 +232,6 @@ sub setup_accounting() {
$nonEmpty |= process_accounting_rule while read_a_line; $nonEmpty |= process_accounting_rule while read_a_line;
fatal_error "Accounring rules are isolated" if $nonEmpty && ! $filter_table->{accounting};
clear_comment; clear_comment;
if ( have_bridges ) { if ( have_bridges ) {
@@ -192,13 +244,28 @@ sub setup_accounting() {
if ( $filter_table->{accountout} ) { if ( $filter_table->{accountout} ) {
add_jump( $filter_table->{OUTPUT}, 'accountout', 0, '', 0, 0 ); add_jump( $filter_table->{OUTPUT}, 'accountout', 0, '', 0, 0 );
} }
} else { } elsif ( $filter_table->{accounting} ) {
if ( $filter_table->{accounting} ) { for my $chain ( qw/INPUT FORWARD OUTPUT/ ) {
for my $chain ( qw/INPUT FORWARD OUTPUT/ ) { add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 );
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; 1;

View File

@@ -28,6 +28,7 @@ require Exporter;
use Shorewall::Config qw(:DEFAULT :internal); use Shorewall::Config qw(:DEFAULT :internal);
use Shorewall::Zones; use Shorewall::Zones;
use Shorewall::Chains qw(:DEFAULT :internal); use Shorewall::Chains qw(:DEFAULT :internal);
use Shorewall::IPAddrs;
use strict; use strict;
@@ -57,7 +58,7 @@ our @EXPORT = qw( merge_levels
$macro_commands $macro_commands
); );
our @EXPORT_OK = qw( initialize ); our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_9'; our $VERSION = '4.4_13';
# #
# Used Actions. Each action that is actually used has an entry with value 1. # Used Actions. Each action that is actually used has an entry with value 1.
@@ -178,9 +179,27 @@ sub find_macro( $ )
# #
sub split_action ( $ ) { sub split_action ( $ ) {
my $action = $_[0]; 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 ); my @a = split( /:/ , $action, 4 );
fatal_error "Invalid ACTION ($action)" if ( $action =~ /::/ ) || ( @a > 3 ); fatal_error "Invalid ACTION ($action)" if ( $action =~ /::/ ) || ( @a > $max );
( shift @a, join ":", @a ); $target = shift @a unless $target;
( $target, join ":", @a );
} }
# #
@@ -617,7 +636,7 @@ sub process_action( $$$$$$$$$$$ ) {
$source , $source ,
$dest , $dest ,
'', #Original Dest '', #Original Dest
$action ? "-j $action" : '', $action ,
$level , $level ,
$action , $action ,
'' ); '' );
@@ -776,7 +795,7 @@ sub dropBcast( $$$ ) {
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -d 224.0.0.0/4 '; log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -d 224.0.0.0/4 ';
} else { } else {
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -d ff00::/10 -j DROP '; log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', join( ' ', ' -d' , IPv6_MULTICAST , '-j DROP ' );
} }
} }
@@ -801,7 +820,7 @@ sub dropBcast( $$$ ) {
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
add_rule $chainref, '-d 224.0.0.0/4 -j DROP'; add_rule $chainref, '-d 224.0.0.0/4 -j DROP';
} else { } else {
add_rule $chainref, '-d ff00::/10 -j DROP'; add_rule $chainref, join( ' ', '-d', IPv6_MULTICAST, '-j DROP' );
} }
} }
@@ -833,8 +852,8 @@ sub allowBcast( $$$ ) {
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d 224.0.0.0/4 ' if $level ne ''; log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d 224.0.0.0/4 ' if $level ne '';
add_rule $chainref, '-d 224.0.0.0/4 -j ACCEPT'; add_rule $chainref, '-d 224.0.0.0/4 -j ACCEPT';
} else { } else {
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d ff00::/10 ' if $level ne ''; log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d ' . IPv6_MULTICAST . ' ' if $level ne '';
add_rule $chainref, '-d ff00:/10 -j ACCEPT'; add_rule $chainref, join ( ' ', '-d', IPv6_MULTICAST, '-j ACCEPT' );
} }
} }
} }
@@ -868,7 +887,8 @@ sub allowInvalid ( $$$ ) {
} }
sub forwardUPnP ( $$$ ) { sub forwardUPnP ( $$$ ) {
dont_optimize 'forwardUPnP'; my $chainref = dont_optimize 'forwardUPnP';
add_commands( $chainref , '[ -f ${VARDIR}/.forwardUPnP ] && cat ${VARDIR}/.forwardUPnP >&3' );
} }
sub allowinUPnP ( $$$ ) { sub allowinUPnP ( $$$ ) {

File diff suppressed because it is too large Load Diff

View File

@@ -43,7 +43,7 @@ use Shorewall::Raw;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( compiler ); our @EXPORT = qw( compiler );
our @EXPORT_OK = qw( $export ); our @EXPORT_OK = qw( $export );
our $VERSION = '4.4_9'; our $VERSION = '4.4_12';
our $export; our $export;
@@ -271,7 +271,7 @@ sub generate_script_2() {
set_global_variables(1); set_global_variables(1);
handle_optional_interfaces; handle_optional_interfaces(0);
emit ';;'; emit ';;';
@@ -284,7 +284,7 @@ sub generate_script_2() {
set_global_variables(0); set_global_variables(0);
handle_optional_interfaces; handle_optional_interfaces(0);
emit ';;'; emit ';;';
} }
@@ -294,7 +294,7 @@ sub generate_script_2() {
emit ( 'esac' ) , emit ( 'esac' ) ,
} else { } else {
emit( 'true' ) unless handle_optional_interfaces; emit( 'true' ) unless handle_optional_interfaces(1);
} }
pop_indent; pop_indent;
@@ -303,7 +303,6 @@ sub generate_script_2() {
} }
#
# Final stage of script generation. # Final stage of script generation.
# #
# Generate code for loading the various files in /var/lib/shorewall[6][-lite] # Generate code for loading the various files in /var/lib/shorewall[6][-lite]
@@ -354,80 +353,17 @@ sub generate_script_3($) {
} }
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
my @ipsets = all_ipsets; load_ipsets;
if ( @ipsets || $config{SAVE_IPSETS} ) {
emit ( '',
'local hack',
'',
'case $IPSET in',
' */*)',
' [ -x "$IPSET" ] || startup_error "IPSET=$IPSET does not exist or is not executable"',
' ;;',
' *)',
' IPSET="$(mywhich $IPSET)"',
' [ -n "$IPSET" ] || startup_error "The ipset utility cannot be located"' ,
' ;;',
'esac',
'',
'if [ "$COMMAND" = start ]; then' ,
' if [ -f ${VARDIR}/ipsets.save ]; then' ,
' $IPSET -F' ,
' $IPSET -X' ,
' $IPSET -R < ${VARDIR}/ipsets.save' ,
' fi' ,
'elif [ "$COMMAND" = restore -a -z "$g_recovering" ]; then' ,
' if [ -f $(my_pathname)-ipsets ]; then' ,
' if chain_exists shorewall; then' ,
' startup_error "Cannot restore $(my_pathname)-ipsets with Shorewall running"' ,
' else' ,
' $IPSET -F' ,
' $IPSET -X' ,
' $IPSET -R < $(my_pathname)-ipsets' ,
' fi' ,
' fi' ,
);
if ( @ipsets ) {
emit '';
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( '' ,
'elif [ "$COMMAND" = restart ]; then' ,
'' );
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( '' ,
' if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then' ,
' #',
' # The \'grep -v\' is a hack for a bug in ipset\'s nethash implementation when xtables-addons is applied to Lenny' ,
' #',
' hack=\'| grep -v /31\'' ,
' else' ,
' hack=' ,
' fi' ,
'',
' if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then' ,
' grep -q "^-N" ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save' ,
' fi' );
}
emit ( 'fi',
'' );
}
emit ( 'if [ "$COMMAND" = refresh ]; then' , emit ( 'if [ "$COMMAND" = refresh ]; then' ,
' run_refresh_exit' ); ' run_refresh_exit' ,
'else' ,
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( 'else' ,
' run_init_exit', ' run_init_exit',
'fi', 'fi',
'' ); '' );
save_dynamic_chains;
mark_firewall_not_started; mark_firewall_not_started;
emit ('', emit ('',
@@ -450,6 +386,7 @@ sub generate_script_3($) {
} else { } else {
emit ( '[ "$COMMAND" = refresh ] && run_refresh_exit || run_init_exit', emit ( '[ "$COMMAND" = refresh ] && run_refresh_exit || run_init_exit',
'' ); '' );
save_dynamic_chains;
mark_firewall_not_started; mark_firewall_not_started;
emit ''; emit '';
} }
@@ -505,33 +442,37 @@ EOF
setup_forwarding( $family , 1 ); setup_forwarding( $family , 1 );
push_indent; push_indent;
emit<<'EOF'; my $config_dir = $globals{CONFIGDIR};
set_state "Started"
emit<<"EOF";
set_state Started $config_dir
run_restored_exit run_restored_exit
else else
if [ $COMMAND = refresh ]; then if [ \$COMMAND = refresh ]; then
chainlist_reload chainlist_reload
EOF EOF
setup_forwarding( $family , 0 ); setup_forwarding( $family , 0 );
emit<<'EOF'; emit<<"EOF";
run_refreshed_exit run_refreshed_exit
do_iptables -N shorewall do_iptables -N shorewall
set_state "Started" set_state Started $config_dir
else else
setup_netfilter setup_netfilter
restore_dynamic_rules
conditionally_flush_conntrack conditionally_flush_conntrack
EOF EOF
setup_forwarding( $family , 0 ); setup_forwarding( $family , 0 );
emit<<'EOF'; emit<<"EOF";
run_start_exit run_start_exit
do_iptables -N shorewall do_iptables -N shorewall
set_state "Started" set_state Started $config_dir
run_started_exit run_started_exit
fi fi
EOF
emit<<'EOF';
[ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall
fi fi

View File

@@ -114,6 +114,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
$product $product
$Product $Product
$toolname
$command $command
$doing $doing
$done $done
@@ -131,7 +132,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
Exporter::export_ok_tags('internal'); Exporter::export_ok_tags('internal');
our $VERSION = '4.4_9'; our $VERSION = '4.4_13';
# #
# describe the current command, it's present progressive, and it's completion. # 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', RECENT_MATCH => 'Recent Match',
OWNER_MATCH => 'Owner Match', OWNER_MATCH => 'Owner Match',
IPSET_MATCH => 'Ipset Match', IPSET_MATCH => 'Ipset Match',
OLD_IPSET_MATCH => 'Old Ipset Match',
CONNMARK => 'CONNMARK Target', CONNMARK => 'CONNMARK Target',
XCONNMARK => 'Extended CONNMARK Target', XCONNMARK => 'Extended CONNMARK Target',
CONNMARK_MATCH => 'Connmark Match', CONNMARK_MATCH => 'Connmark Match',
@@ -249,6 +251,8 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
OLD_HL_MATCH => 'Old Hash Limit Match', OLD_HL_MATCH => 'Old Hash Limit Match',
TPROXY_TARGET => 'TPROXY Target', TPROXY_TARGET => 'TPROXY Target',
FLOW_FILTER => 'Flow Classifier', FLOW_FILTER => 'Flow Classifier',
FWMARK_RT_MASK => 'fwmark route mask',
MARK_ANYWHERE => 'Mark in any table',
CAPVERSION => 'Capability Version', CAPVERSION => 'Capability Version',
KERNELVERSION => 'Kernel Version', KERNELVERSION => 'Kernel Version',
); );
@@ -288,6 +292,7 @@ our $sillyname; # Name of temporary filter chains for testing capa
our $sillyname1; our $sillyname1;
our $iptables; # Path to iptables/ip6tables our $iptables; # Path to iptables/ip6tables
our $tc; # Path to tc our $tc; # Path to tc
our $ip; # Path to ip
use constant { MIN_VERBOSITY => -1, use constant { MIN_VERBOSITY => -1,
MAX_VERBOSITY => 2 , MAX_VERBOSITY => 2 ,
@@ -335,14 +340,15 @@ sub initialize( $ ) {
# #
%globals = ( SHAREDIR => '/usr/share/shorewall' , %globals = ( SHAREDIR => '/usr/share/shorewall' ,
SHAREDIRPL => '/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 => '', LOGPARMS => '',
TC_SCRIPT => '', TC_SCRIPT => '',
EXPORT => 0, EXPORT => 0,
STATEMATCH => '-m state --state', STATEMATCH => '-m state --state',
UNTRACKED => 0, UNTRACKED => 0,
VERSION => "4.4.10-RC1", VERSION => "4.4.13",
CAPVERSION => 40408 , CAPVERSION => 40413 ,
); );
# #
@@ -360,6 +366,7 @@ sub initialize( $ ) {
LOGFILE => undef, LOGFILE => undef,
LOGFORMAT => undef, LOGFORMAT => undef,
LOGTAGONLY => undef, LOGTAGONLY => undef,
LOGLIMIT => undef,
LOGRATE => undef, LOGRATE => undef,
LOGBURST => undef, LOGBURST => undef,
LOGALLNEW => undef, LOGALLNEW => undef,
@@ -378,6 +385,7 @@ sub initialize( $ ) {
IP => undef, IP => undef,
TC => undef, TC => undef,
IPSET => undef, IPSET => undef,
PERL => undef,
# #
#PATH is inherited #PATH is inherited
# #
@@ -461,6 +469,8 @@ sub initialize( $ ) {
DYNAMIC_BLACKLIST => undef, DYNAMIC_BLACKLIST => undef,
LOAD_HELPERS_ONLY => undef, LOAD_HELPERS_ONLY => undef,
REQUIRE_INTERFACE => undef, REQUIRE_INTERFACE => undef,
FORWARD_CLEAR_MARK => undef,
COMPLETE => undef,
# #
# Packet Disposition # Packet Disposition
# #
@@ -505,6 +515,7 @@ sub initialize( $ ) {
LOGFILE => undef, LOGFILE => undef,
LOGFORMAT => undef, LOGFORMAT => undef,
LOGTAGONLY => undef, LOGTAGONLY => undef,
LOGLIMIT => undef,
LOGRATE => undef, LOGRATE => undef,
LOGBURST => undef, LOGBURST => undef,
LOGALLNEW => undef, LOGALLNEW => undef,
@@ -520,6 +531,7 @@ sub initialize( $ ) {
IP => undef, IP => undef,
TC => undef, TC => undef,
IPSET => undef, IPSET => undef,
PERL => undef,
# #
#PATH is inherited #PATH is inherited
# #
@@ -582,6 +594,8 @@ sub initialize( $ ) {
DYNAMIC_BLACKLIST => undef, DYNAMIC_BLACKLIST => undef,
LOAD_HELPERS_ONLY => undef, LOAD_HELPERS_ONLY => undef,
REQUIRE_INTERFACE => undef, REQUIRE_INTERFACE => undef,
FORWARD_CLEAR_MARK => undef,
COMPLETE => undef,
# #
# Packet Disposition # Packet Disposition
# #
@@ -631,6 +645,7 @@ sub initialize( $ ) {
RECENT_MATCH => undef, RECENT_MATCH => undef,
OWNER_MATCH => undef, OWNER_MATCH => undef,
IPSET_MATCH => undef, IPSET_MATCH => undef,
OLD_IPSET_MATCH => undef,
CONNMARK => undef, CONNMARK => undef,
XCONNMARK => undef, XCONNMARK => undef,
CONNMARK_MATCH => undef, CONNMARK_MATCH => undef,
@@ -662,6 +677,8 @@ sub initialize( $ ) {
PERSISTENT_SNAT => undef, PERSISTENT_SNAT => undef,
OLD_HL_MATCH => undef, OLD_HL_MATCH => undef,
FLOW_FILTER => undef, FLOW_FILTER => undef,
FWMARK_RT_MASK => undef,
MARK_ANYWHERE => undef,
CAPVERSION => undef, CAPVERSION => undef,
KERNELVERSION => undef, KERNELVERSION => undef,
); );
@@ -1462,10 +1479,12 @@ sub split_list1( $$ ) {
fatal_error "Invalid $type list ($list)" if $count > 1; fatal_error "Invalid $type list ($list)" if $count > 1;
push @list2 , $_; push @list2 , $_;
} else { } else {
s/\(//;
$element = $_; $element = $_;
} }
} elsif ( ( $count = tr/)/)/ ) > 0 ) { } elsif ( ( $count = tr/)/)/ ) > 0 ) {
fatal_error "Invalid $type list ($list)" unless $element && $count == 1; fatal_error "Invalid $type list ($list)" unless $element && $count == 1;
s/\)//;
push @list2, join ',', $element, $_; push @list2, join ',', $element, $_;
$element = ''; $element = '';
} elsif ( $element ) { } elsif ( $element ) {
@@ -1764,7 +1783,9 @@ sub embedded_perl( $ ) {
# - Handle INCLUDE <filename> # - Handle INCLUDE <filename>
# #
sub read_a_line() { sub read_a_line(;$) {
my $embedded_enabled = defined $_[0] ? shift : 1;
while ( $currentfile ) { while ( $currentfile ) {
$currentline = ''; $currentline = '';
@@ -1810,53 +1831,59 @@ sub read_a_line() {
# #
# Must check for shell/perl before doing variable expansion # Must check for shell/perl before doing variable expansion
# #
if ( $currentline =~ s/^\s*(BEGIN\s+)?SHELL\s*;?// ) { if ( $embedded_enabled ) {
embedded_shell( $1 ); if ( $currentline =~ s/^\s*(BEGIN\s+)?SHELL\s*;?// ) {
} elsif ( $currentline =~ s/^\s*(BEGIN\s+)?PERL\s*\;?// ) { embedded_shell( $1 );
embedded_perl( $1 ); next;
} else {
my $count = 0;
#
# Expand Shell Variables using %ENV
#
# $1 $2 $3 - $4
while ( $currentline =~ m( ^(.*?) \$({)? ([a-zA-Z]\w*) (?(2)}) (.*)$ )x ) {
my $val = $ENV{$3};
unless ( defined $val ) {
fatal_error "Undefined shell variable (\$$3)" unless exists $ENV{$3};
$val = '';
}
$currentline = join( '', $1 , $val , $4 );
fatal_error "Variable Expansion Loop" if ++$count > 100;
} }
if ( $currentline =~ /^\s*INCLUDE\s/ ) { if ( $currentline =~ s/^\s*(BEGIN\s+)?PERL\s*\;?// ) {
embedded_perl( $1 );
next;
}
}
my @line = split ' ', $currentline; my $count = 0;
#
# Expand Shell Variables using %ENV
#
# $1 $2 $3 - $4
while ( $currentline =~ m( ^(.*?) \$({)? ([a-zA-Z]\w*) (?(2)}) (.*)$ )x ) {
my $val = $ENV{$3};
fatal_error "Invalid INCLUDE command" if @line != 2; unless ( defined $val ) {
fatal_error "INCLUDEs/Scripts nested too deeply" if @includestack >= 4; fatal_error "Undefined shell variable (\$$3)" unless exists $ENV{$3};
$val = '';
}
my $filename = find_file $line[1]; $currentline = join( '', $1 , $val , $4 );
fatal_error "Variable Expansion Loop" if ++$count > 100;
}
fatal_error "INCLUDE file $filename not found" unless -f $filename; if ( $currentline =~ /^\s*INCLUDE\s/ ) {
fatal_error "Directory ($filename) not allowed in INCLUDE" if -d _;
if ( -s _ ) { my @line = split ' ', $currentline;
push @includestack, [ $currentfile, $currentfilename, $currentlinenumber ];
$currentfile = undef;
do_open_file $filename;
} else {
$currentlinenumber = 0;
}
$currentline = ''; fatal_error "Invalid INCLUDE command" if @line != 2;
fatal_error "INCLUDEs/Scripts nested too deeply" if @includestack >= 4;
my $filename = find_file $line[1];
fatal_error "INCLUDE file $filename not found" unless -f $filename;
fatal_error "Directory ($filename) not allowed in INCLUDE" if -d _;
if ( -s _ ) {
push @includestack, [ $currentfile, $currentfilename, $currentlinenumber ];
$currentfile = undef;
do_open_file $filename;
} else { } else {
print "IN===> $currentline\n" if $debug; $currentlinenumber = 0;
return 1;
} }
$currentline = '';
} else {
print "IN===> $currentline\n" if $debug;
return 1;
} }
} }
@@ -1899,9 +1926,11 @@ sub default ( $$ ) {
sub default_yes_no ( $$ ) { sub default_yes_no ( $$ ) {
my ( $var, $val ) = @_; my ( $var, $val ) = @_;
my $curval = "\L$config{$var}"; my $curval = $config{$var};
if ( defined $curval && $curval ne '' ) { if ( defined $curval && $curval ne '' ) {
$curval = lc $curval;
if ( $curval eq 'no' ) { if ( $curval eq 'no' ) {
$config{$var} = ''; $config{$var} = '';
} else { } else {
@@ -2300,7 +2329,11 @@ sub Comments() {
} }
sub Hashlimit_Match() { 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() { sub Old_Hashlimit_Match() {
@@ -2347,11 +2380,11 @@ sub Raw_Table() {
qt1( "$iptables -t raw -L -n" ); qt1( "$iptables -t raw -L -n" );
} }
sub IPSet_Match() { sub Old_IPSet_Match() {
my $ipset = $config{IPSET} || 'ipset'; my $ipset = $config{IPSET} || 'ipset';
my $result = 0; my $result = 0;
$ipset = which $ipset unless $ipset =~ '//'; $ipset = which $ipset unless $ipset =~ '/';
if ( $ipset && -x $ipset ) { if ( $ipset && -x $ipset ) {
qt( "$ipset -X $sillyname" ); qt( "$ipset -X $sillyname" );
@@ -2359,7 +2392,31 @@ sub IPSet_Match() {
if ( qt( "$ipset -N $sillyname iphash" ) ) { if ( qt( "$ipset -N $sillyname iphash" ) ) {
if ( qt1( "$iptables -A $sillyname -m set --set $sillyname src -j ACCEPT" ) ) { if ( qt1( "$iptables -A $sillyname -m set --set $sillyname src -j ACCEPT" ) ) {
qt1( "$iptables -D $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" ); qt( "$ipset -X $sillyname" );
@@ -2417,6 +2474,14 @@ sub Flow_Filter() {
$tc && system( "$tc filter add flow add help 2>&1 | grep -q ^Usage" ) == 0; $tc && system( "$tc filter add flow add help 2>&1 | grep -q ^Usage" ) == 0;
} }
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 = our %detect_capability =
( ADDRTYPE => \&Addrtype, ( ADDRTYPE => \&Addrtype,
CLASSIFY_TARGET => \&Classify_Target, CLASSIFY_TARGET => \&Classify_Target,
@@ -2428,6 +2493,7 @@ our %detect_capability =
ENHANCED_REJECT => \&Enhanced_Reject, ENHANCED_REJECT => \&Enhanced_Reject,
EXMARK => \&Exmark, EXMARK => \&Exmark,
FLOW_FILTER => \&Flow_Filter, FLOW_FILTER => \&Flow_Filter,
FWMARK_RT_MASK => \&Fwmark_Rt_Mask,
GOTO_TARGET => \&Goto_Target, GOTO_TARGET => \&Goto_Target,
HASHLIMIT_MATCH => \&Hashlimit_Match, HASHLIMIT_MATCH => \&Hashlimit_Match,
HELPER_MATCH => \&Helper_Match, HELPER_MATCH => \&Helper_Match,
@@ -2435,6 +2501,7 @@ our %detect_capability =
IPP2P_MATCH => \&Ipp2p_Match, IPP2P_MATCH => \&Ipp2p_Match,
IPRANGE_MATCH => \&IPRange_Match, IPRANGE_MATCH => \&IPRange_Match,
IPSET_MATCH => \&IPSet_Match, IPSET_MATCH => \&IPSet_Match,
OLD_IPSET_MATCH => \&Old_IPSet_Match,
KLUDGEFREE => \&Kludgefree, KLUDGEFREE => \&Kludgefree,
LENGTH_MATCH => \&Length_Match, LENGTH_MATCH => \&Length_Match,
LOGMARK_TARGET => \&Logmark_Target, LOGMARK_TARGET => \&Logmark_Target,
@@ -2442,6 +2509,7 @@ our %detect_capability =
MANGLE_ENABLED => \&Mangle_Enabled, MANGLE_ENABLED => \&Mangle_Enabled,
MANGLE_FORWARD => \&Mangle_Forward, MANGLE_FORWARD => \&Mangle_Forward,
MARK => \&Mark, MARK => \&Mark,
MARK_ANYWHERE => \&Mark_Anywhere,
MULTIPORT => \&Multiport, MULTIPORT => \&Multiport,
NAT_ENABLED => \&Nat_Enabled, NAT_ENABLED => \&Nat_Enabled,
NEW_CONNTRACK_MATCH => \&New_Conntrack_Match, NEW_CONNTRACK_MATCH => \&New_Conntrack_Match,
@@ -2585,6 +2653,8 @@ sub determine_capabilities() {
$capabilities{LOG_TARGET} = detect_capability( 'LOG_TARGET' ); $capabilities{LOG_TARGET} = detect_capability( 'LOG_TARGET' );
$capabilities{LOGMARK_TARGET} = detect_capability( 'LOGMARK_TARGET' ); $capabilities{LOGMARK_TARGET} = detect_capability( 'LOGMARK_TARGET' );
$capabilities{FLOW_FILTER} = detect_capability( 'FLOW_FILTER' ); $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" ); qt1( "$iptables -F $sillyname" );
@@ -2662,12 +2732,15 @@ sub process_shorewall_conf() {
my $file = find_file "$product.conf"; my $file = find_file "$product.conf";
if ( -f $file ) { if ( -f $file ) {
$globals{CONFIGDIR} = $file;
$globals{CONFIGDIR} =~ s/$product.conf//;
if ( -r _ ) { if ( -r _ ) {
open_file $file; open_file $file;
first_entry "Processing $file..."; first_entry "Processing $file...";
while ( read_a_line ) { while ( read_a_line(0) ) {
if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*?)\s*$/ ) { if ( $currentline =~ /^\s*([a-zA-Z]\w*)=(.*?)\s*$/ ) {
my ($var, $val) = ($1, $2); my ($var, $val) = ($1, $2);
unless ( exists $config{$var} ) { unless ( exists $config{$var} ) {
@@ -2742,12 +2815,18 @@ sub get_capabilities( $ ) {
fatal_error "$iptables_restore does not exist or is not executable" unless -x $iptables_restore; fatal_error "$iptables_restore does not exist or is not executable" unless -x $iptables_restore;
$tc = $config{TC}; $tc = $config{TC} || which 'tc';
if ( $tc ) { if ( $tc ) {
fatal_error "TC=$tc does not exist or is not executable" unless -x $tc; fatal_error "TC=$tc does not exist or is not executable" unless -x $tc;
} }
$ip = $config{IP} || which 'ip';
if ( $ip ) {
fatal_error "IP=$ip does not exist or is not executable" unless -x $ip;
}
load_kernel_modules; load_kernel_modules;
if ( open_file 'capabilities' ) { if ( open_file 'capabilities' ) {
@@ -2820,7 +2899,60 @@ sub get_configuration( $ ) {
$globals{STATEMATCH} = '-m conntrack --ctstate' if have_capability 'CONNTRACK_MATCH'; $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} ) { if ( defined $config{LOGRATE} ) {
fatal_error"Invalid LOGRATE ($config{LOGRATE})" unless $config{LOGRATE} =~ /^\d+\/(second|minute)$/; fatal_error"Invalid LOGRATE ($config{LOGRATE})" unless $config{LOGRATE} =~ /^\d+\/(second|minute)$/;
} }
@@ -2939,7 +3071,7 @@ sub get_configuration( $ ) {
default_yes_no 'AUTO_COMMENT' , 'Yes'; default_yes_no 'AUTO_COMMENT' , 'Yes';
default_yes_no 'MULTICAST' , ''; default_yes_no 'MULTICAST' , '';
default_yes_no 'MARK_IN_FORWARD_CHAIN' , ''; 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 'NULL_ROUTE_RFC1918' , '';
default_yes_no 'USE_DEFAULT_RT' , ''; default_yes_no 'USE_DEFAULT_RT' , '';
default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes'; default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes';
@@ -2950,6 +3082,10 @@ sub get_configuration( $ ) {
default_yes_no 'OPTIMIZE_ACCOUNTING' , ''; default_yes_no 'OPTIMIZE_ACCOUNTING' , '';
default_yes_no 'DYNAMIC_BLACKLIST' , 'Yes'; default_yes_no 'DYNAMIC_BLACKLIST' , 'Yes';
default_yes_no 'REQUIRE_INTERFACE' , ''; 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};
numeric_option 'TC_BITS', $config{WIDE_TC_MARKS} ? 14 : 8 , 0; numeric_option 'TC_BITS', $config{WIDE_TC_MARKS} ? 14 : 8 , 0;
numeric_option 'MASK_BITS', $config{WIDE_TC_MARKS} ? 16 : 8, $config{TC_BITS}; numeric_option 'MASK_BITS', $config{WIDE_TC_MARKS} ? 16 : 8, $config{TC_BITS};
@@ -2958,7 +3094,12 @@ sub get_configuration( $ ) {
if ( $config{PROVIDER_OFFSET} ) { if ( $config{PROVIDER_OFFSET} ) {
$config{PROVIDER_OFFSET} = $config{MASK_BITS} if $config{PROVIDER_OFFSET} < $config{MASK_BITS}; $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} ); $globals{TC_MAX} = make_mask( $config{TC_BITS} );
@@ -2966,6 +3107,12 @@ sub get_configuration( $ ) {
$globals{PROVIDER_MIN} = 1 << $config{PROVIDER_OFFSET}; $globals{PROVIDER_MIN} = 1 << $config{PROVIDER_OFFSET};
$globals{PROVIDER_MASK} = make_mask( $config{PROVIDER_BITS} ) << $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} ) ) { if ( defined ( $val = $config{ZONE2ZONE} ) ) {
fatal_error "Invalid ZONE2ZONE value ( $val )" unless $val =~ /^[2-]$/; fatal_error "Invalid ZONE2ZONE value ( $val )" unless $val =~ /^[2-]$/;
} else { } else {

View File

@@ -73,7 +73,7 @@ our @EXPORT = qw( ALLIPv4
validate_icmp6 validate_icmp6
); );
our @EXPORT_OK = qw( ); our @EXPORT_OK = qw( );
our $VERSION = '4.4_7'; our $VERSION = '4.4_12';
# #
# Some IPv4/6 useful stuff # Some IPv4/6 useful stuff
@@ -87,18 +87,19 @@ our $validate_address;
our $validate_net; our $validate_net;
our $validate_range; our $validate_range;
our $validate_host; our $validate_host;
our $family;
use constant { ALLIPv4 => '0.0.0.0/0' , use constant { ALLIPv4 => '0.0.0.0/0' ,
ALLIPv6 => '::/0' , ALLIPv6 => '::/0' ,
IPv4_MULTICAST => '224.0.0.0/4' , IPv4_MULTICAST => '224.0.0.0/4' ,
IPv6_MULTICAST => 'FF00::/10' , IPv6_MULTICAST => 'ff00::/8' ,
IPv6_LINKLOCAL => 'FF80::/10' , IPv6_LINKLOCAL => 'fe80::/10' ,
IPv6_SITELOCAL => 'FFC0::/10' , IPv6_SITELOCAL => 'feC0::/10' ,
IPv6_LOOPBACK => '::1' , IPv6_LOOPBACK => '::1' ,
IPv6_LINK_ALLNODES => 'FF01::1' , IPv6_LINK_ALLNODES => 'ff01::1' ,
IPv6_LINK_ALLRTRS => 'FF01::2' , IPv6_LINK_ALLRTRS => 'ff01::2' ,
IPv6_SITE_ALLNODES => 'FF02::1' , IPv6_SITE_ALLNODES => 'ff02::1' ,
IPv6_SITE_ALLRTRS => 'FF02::2' , IPv6_SITE_ALLRTRS => 'ff02::2' ,
ICMP => 1, ICMP => 1,
TCP => 6, TCP => 6,
UDP => 17, UDP => 17,
@@ -123,8 +124,8 @@ sub valid_4address( $ ) {
my @address = split /\./, $address; my @address = split /\./, $address;
return 0 unless @address == 4; return 0 unless @address == 4;
for my $a ( @address ) { for ( @address ) {
return 0 unless $a =~ /^\d+$/ && $a < 256; return 0 unless /^\d+$/ && $_ < 256;
} }
1; 1;
@@ -157,8 +158,8 @@ sub decodeaddr( $ ) {
my $result = shift @address; my $result = shift @address;
for my $a ( @address ) { for ( @address ) {
$result = ( $result << 8 ) | $a; $result = ( $result << 8 ) | $_;
} }
$result; $result;
@@ -292,6 +293,11 @@ sub resolve_proto( $ ) {
$number = numeric_value ( $proto ); $number = numeric_value ( $proto );
defined $number && $number <= 65535 ? $number : undef; defined $number && $number <= 65535 ? $number : undef;
} else { } 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; defined( $number = $nametoproto{$proto} ) ? $number : scalar getprotobyname $proto;
} }
} }
@@ -332,7 +338,7 @@ sub validate_portpair( $$ ) {
my @ports = split /:/, $portpair, 2; my @ports = split /:/, $portpair, 2;
$_ = validate_port( $proto, $_) for ( @ports ); $_ = validate_port( $proto, $_) for ( grep $_, @ports );
if ( @ports == 2 ) { if ( @ports == 2 ) {
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1]; fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
@@ -439,7 +445,7 @@ sub expand_port_range( $$ ) {
# #
# Validate the ports # 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. $last++; #Increment last address for limit testing.
# #
@@ -682,7 +688,7 @@ sub validate_host ($$ ) {
# able to re-initialize its dependent modules' state. # able to re-initialize its dependent modules' state.
# #
sub initialize( $ ) { sub initialize( $ ) {
my $family = shift; $family = shift;
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
$allip = ALLIPv4; $allip = ALLIPv4;

View File

@@ -36,7 +36,7 @@ use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( setup_masq setup_nat setup_netmap add_addresses ); our @EXPORT = qw( setup_masq setup_nat setup_netmap add_addresses );
our @EXPORT_OK = (); our @EXPORT_OK = ();
our $VERSION = '4.4_9'; our $VERSION = '4.4_13';
our @addresses_to_add; our @addresses_to_add;
our %addresses_to_add; our %addresses_to_add;
@@ -49,56 +49,6 @@ sub initialize() {
%addresses_to_add = (); %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 # 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' ); fatal_error "Non-empty IPSEC column requires policy match support in your kernel and iptables" unless have_capability( 'POLICY_MATCH' );
if ( $ipsec =~ /^yes$/i ) { if ( $ipsec =~ /^yes$/i ) {
$baserule .= '-m policy --pol ipsec --dir out '; $baserule .= do_ipsec_options 'out', 'ipsec', '';
} elsif ( $ipsec =~ /^no$/i ) { } elsif ( $ipsec =~ /^no$/i ) {
$baserule .= '-m policy --pol none --dir out '; $baserule .= do_ipsec_options 'out', 'none', '';
} else { } else {
$baserule .= do_ipsec_options $ipsec; $baserule .= do_ipsec_options 'out', 'ipsec', $ipsec;
} }
} elsif ( have_ipsec ) { } elsif ( have_ipsec ) {
$baserule .= '-m policy --pol none --dir out '; $baserule .= '-m policy --pol none --dir out ';
@@ -175,7 +125,7 @@ sub process_one_masq( )
for my $fullinterface (split_list $interfacelist, 'interface' ) { for my $fullinterface (split_list $interfacelist, 'interface' ) {
my $rule = ''; my $rule = '';
my $target = '-j MASQUERADE '; my $target = 'MASQUERADE ';
# #
# Isolate and verify the interface part # Isolate and verify the interface part
# #
@@ -221,7 +171,7 @@ sub process_one_masq( )
fatal_error "The SAME target is no longer supported"; fatal_error "The SAME target is no longer supported";
} elsif ( $addresses eq 'detect' ) { } elsif ( $addresses eq 'detect' ) {
my $variable = get_interface_address $interface; my $variable = get_interface_address $interface;
$target = "-j SNAT --to-source $variable"; $target = "SNAT --to-source $variable";
if ( interface_is_optional $interface ) { if ( interface_is_optional $interface ) {
add_commands( $chainref, add_commands( $chainref,
@@ -231,13 +181,13 @@ sub process_one_masq( )
$detectaddress = 1; $detectaddress = 1;
} }
} elsif ( $addresses eq 'NONAT' ) { } elsif ( $addresses eq 'NONAT' ) {
$target = '-j RETURN'; $target = 'RETURN';
$add_snat_aliases = 0; $add_snat_aliases = 0;
} else { } else {
my $addrlist = ''; my $addrlist = '';
for my $addr ( split_list $addresses , 'address' ) { for my $addr ( split_list $addresses , 'address' ) {
if ( $addr =~ /^.*\..*\..*\./ ) { if ( $addr =~ /^.*\..*\..*\./ ) {
$target = '-j SNAT '; $target = 'SNAT ';
my ($ipaddr, $rest) = split ':', $addr; my ($ipaddr, $rest) = split ':', $addr;
if ( $ipaddr =~ /^(.+)-(.+)$/ ) { if ( $ipaddr =~ /^(.+)-(.+)$/ ) {
validate_range( $1, $2 ); validate_range( $1, $2 );
@@ -448,7 +398,9 @@ sub setup_netmap() {
while ( read_a_line ) { while ( read_a_line ) {
my ( $type, $net1, $interfacelist, $net2 ) = split_line 4, 4, 'netmap file'; my ( $type, $net1, $interfacelist, $net2, $net3 ) = split_line 4, 5, 'netmap file';
$net3 = ALLIP if $net3 eq '-';
for my $interface ( split_list $interfacelist, 'interface' ) { for my $interface ( split_list $interfacelist, 'interface' ) {
@@ -459,15 +411,15 @@ sub setup_netmap() {
fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface ); fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface );
unless ( $interfaceref->{root} ) { unless ( $interfaceref->{root} ) {
$rulein = match_source_dev $interface; $rulein = match_source_dev( $interface );
$ruleout = match_dest_dev $interface; $ruleout = match_dest_dev( $interface );
$interface = $interfaceref->{name}; $interface = $interfaceref->{name};
} }
if ( $type eq 'DNAT' ) { if ( $type eq 'DNAT' ) {
add_rule ensure_chain( 'nat' , input_chain $interface ) , $rulein . "-d $net1 -j NETMAP --to $net2"; add_rule ensure_chain( 'nat' , input_chain $interface ) , $rulein . match_source_net( $net3 ) . "-d $net1 -j NETMAP --to $net2";
} elsif ( $type eq 'SNAT' ) { } elsif ( $type eq 'SNAT' ) {
add_rule ensure_chain( 'nat' , output_chain $interface ) , $ruleout . "-s $net1 -j NETMAP --to $net2"; add_rule ensure_chain( 'nat' , output_chain $interface ) , $ruleout . match_dest_net( $net3 ) . "-s $net1 -j NETMAP --to $net2";
} else { } else {
fatal_error "Invalid type ($type)"; fatal_error "Invalid type ($type)";
} }

View File

@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter); 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 = qw( validate_policy apply_policy_rules complete_standard_chain setup_syn_flood_chains save_policies optimize_policy_chains);
our @EXPORT_OK = qw( ); our @EXPORT_OK = qw( );
our $VERSION = '4.4_9'; our $VERSION = '4.4_12';
# @policy_chains is a list of references to policy chains in the filter table # @policy_chains is a list of references to policy chains in the filter table
@@ -246,7 +246,7 @@ sub process_a_policy() {
$chainref->{synchain} = $chain $chainref->{synchain} = $chain
} }
$chainref->{default} = $default if $default; $chainref->{default} = $default if $default;
if ( $clientwild ) { if ( $clientwild ) {
if ( $serverwild ) { if ( $serverwild ) {
@@ -307,6 +307,7 @@ sub validate_policy()
NFQUEUE_DEFAULT => 'NFQUEUE' ); NFQUEUE_DEFAULT => 'NFQUEUE' );
my $zone; my $zone;
my $firewall = firewall_zone;
our @zonelist = $config{EXPAND_POLICIES} ? all_zones : ( all_zones, 'all' ); our @zonelist = $config{EXPAND_POLICIES} ? all_zones : ( all_zones, 'all' );
for my $option qw/DROP_DEFAULT REJECT_DEFAULT ACCEPT_DEFAULT QUEUE_DEFAULT NFQUEUE_DEFAULT/ { for my $option qw/DROP_DEFAULT REJECT_DEFAULT ACCEPT_DEFAULT QUEUE_DEFAULT NFQUEUE_DEFAULT/ {
@@ -332,7 +333,9 @@ sub validate_policy()
push @policy_chains, ( new_policy_chain $zone, $zone, 'ACCEPT', PROVISIONAL ); push @policy_chains, ( new_policy_chain $zone, $zone, 'ACCEPT', PROVISIONAL );
push @policy_chains, ( new_policy_chain firewall_zone, $zone, 'NONE', PROVISIONAL ) if zone_type( $zone ) == BPORT; push @policy_chains, ( new_policy_chain firewall_zone, $zone, 'NONE', PROVISIONAL ) if zone_type( $zone ) == BPORT;
if ( $config{IMPLICIT_CONTINUE} && ( @{find_zone( $zone )->{parents}} ) ) { my $zoneref = find_zone( $zone );
if ( $config{IMPLICIT_CONTINUE} && ( @{$zoneref->{parents}} || $zoneref->{type} == VSERVER ) ) {
for my $zone1 ( all_zones ) { for my $zone1 ( all_zones ) {
unless( $zone eq $zone1 ) { unless( $zone eq $zone1 ) {
add_or_modify_policy_chain( $zone, $zone1 ); add_or_modify_policy_chain( $zone, $zone1 );
@@ -415,13 +418,14 @@ sub apply_policy_rules() {
for my $chainref ( @policy_chains ) { for my $chainref ( @policy_chains ) {
my $policy = $chainref->{policy}; my $policy = $chainref->{policy};
my $loglevel = $chainref->{loglevel};
my $provisional = $chainref->{provisional};
my $default = $chainref->{default};
my $name = $chainref->{name};
my $synparms = $chainref->{synparms};
if ( $policy ne 'NONE' ) { unless ( $policy eq 'NONE' ) {
my $loglevel = $chainref->{loglevel};
my $provisional = $chainref->{provisional};
my $default = $chainref->{default};
my $name = $chainref->{name};
my $synparms = $chainref->{synparms};
unless ( $chainref->{referenced} || $provisional || $policy eq 'CONTINUE' ) { unless ( $chainref->{referenced} || $provisional || $policy eq 'CONTINUE' ) {
if ( $config{OPTIMIZE} & 2 ) { if ( $config{OPTIMIZE} & 2 ) {
# #
@@ -492,7 +496,14 @@ sub setup_syn_flood_chains() {
my $level = $chainref->{loglevel}; my $level = $chainref->{loglevel};
my $synchainref = new_chain 'filter' , syn_flood_chain $chainref; my $synchainref = new_chain 'filter' , syn_flood_chain $chainref;
add_rule $synchainref , "${limit}-j RETURN"; 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 ''; if $level ne '';
add_rule $synchainref, '-j DROP'; add_rule $synchainref, '-j DROP';
} }

View File

@@ -35,7 +35,7 @@ use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( setup_providers @routemarked_interfaces handle_stickiness handle_optional_interfaces ); our @EXPORT = qw( setup_providers @routemarked_interfaces handle_stickiness handle_optional_interfaces );
our @EXPORT_OK = qw( initialize lookup_provider ); our @EXPORT_OK = qw( initialize lookup_provider );
our $VERSION = '4.4_9'; our $VERSION = '4.4_13';
use constant { LOCAL_TABLE => 255, use constant { LOCAL_TABLE => 255,
MAIN_TABLE => 254, MAIN_TABLE => 254,
@@ -275,7 +275,7 @@ sub add_a_provider( ) {
require_capability 'REALM_MATCH', "Configuring multiple providers through one interface", "s"; 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; fatal_error "A bridge port ($interface) may not be configured as a provider interface" if port_to_bridge $interface;
my $physical = get_physical $interface; my $physical = get_physical $interface;
@@ -435,10 +435,12 @@ sub add_a_provider( ) {
} }
if ( $mark ne '-' ) { if ( $mark ne '-' ) {
emit ( "qt \$IP -$family rule del fwmark $mark" ) if $config{DELETE_THEN_ADD}; my $mask = have_capability 'FWMARK_RT_MASK' ? '/' . in_hex $globals{PROVIDER_MASK} : '';
emit ( "run_ip rule add fwmark $mark pref $pref table $number", emit ( "qt \$IP -$family rule del fwmark ${mark}${mask}" ) if $config{DELETE_THEN_ADD};
"echo \"qt \$IP -$family rule del fwmark $mark\" >> \${VARDIR}/undo_routing"
emit ( "run_ip rule add fwmark ${mark}${mask} pref $pref table $number",
"echo \"qt \$IP -$family rule del fwmark ${mark}${mask}\" >> \${VARDIR}/undo_routing"
); );
} }
@@ -841,52 +843,101 @@ sub lookup_provider( $ ) {
# #
# Returns true if there were required or optional interfaces # Returns true if there were required or optional interfaces
# #
sub handle_optional_interfaces() { sub handle_optional_interfaces( $ ) {
my $returnvalue = verify_required_interfaces; my ( $interfaces, $wildcards ) = find_interfaces_by_option1 'optional';
my $interfaces = find_interfaces_by_option 'optional';
if ( @$interfaces ) { if ( @$interfaces ) {
for my $interface ( @$interfaces ) { my $require = $config{REQUIRE_INTERFACE};
my $provider = $provider_interfaces{$interface};
my $physical = get_physical $interface;
my $base = uc chain_base( $physical );
emit( '' ); verify_required_interfaces( shift );
if ( $config{REQUIRE_INTERFACE} ) { emit( 'HAVE_INTERFACE=', '' ) if $require;
emit( 'HAVE_INTERFACE=' ); #
emit( '' ); # Clear the '_IS_USABLE' variables
} #
emit( join( '_', 'SW', uc chain_base( get_physical( $_ ) ) , 'IS_USABLE=' ) ) for @$interfaces;
if ( $provider ) { if ( $wildcards ) {
# #
# This interface is associated with a non-shared provider -- get the provider table entry # We must consider all interfaces with an address in $family -- generate a list of such addresses.
# #
my $providerref = $providers{$provider}; emit( '',
'for interface in $(find_all_interfaces1); do',
);
if ( $providerref->{gatewaycase} eq 'detect' ) { push_indent;
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then); emit ( 'case "$interface" in' );
} else { push_indent;
emit qq(if interface_is_usable $physical; then); } else {
} emit '';
}
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 { } else {
#
# Not a provider interface
#
emit qq(if interface_is_usable $physical; then); 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" , emit( " SW_${base}_IS_USABLE=Yes" ,
'else' ,
" SW_${base}_IS_USABLE=" ,
'fi' ); '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( '', emit( '',
'if [ -z "$HAVE_INTERFACE" ]; then' , 'if [ -z "$HAVE_INTERFACE" ]; then' ,
' case "$COMMAND" in', ' case "$COMMAND" in',
@@ -901,7 +952,7 @@ sub handle_optional_interfaces() {
emit( ' fatal_error "No network interface available"', emit( ' fatal_error "No network interface available"',
' else', ' else',
' startup_error "No network interface available', ' startup_error "No network interface available"',
' fi', ' fi',
' ;;', ' ;;',
' esac', ' esac',
@@ -909,10 +960,10 @@ sub handle_optional_interfaces() {
); );
} }
$returnvalue = 1; return 1;
} }
$returnvalue; verify_required_interfaces( shift );
} }
# #
@@ -951,14 +1002,14 @@ sub handle_stickiness( $ ) {
} else { } else {
$rule1 = $_; $rule1 = $_;
$rule1 =~ s/-j sticky/-m mark --mark $mark\/$mask -m recent --name $list --set/; $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; add_rule $chainref, $rule1;
if ( $rule2 ) { if ( $rule2 ) {
$rule2 =~ s/-A tcpre //; assert ( $rule2 =~ s/^-A // );
add_rule $chainref, $rule2; add_rule $chainref, $rule2;
} }
} }
@@ -978,14 +1029,14 @@ sub handle_stickiness( $ ) {
} else { } else {
$rule1 = $_; $rule1 = $_;
$rule1 =~ s/-j sticko/-m mark --mark $mark -m recent --name $list --rdest --set/; $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; add_rule $chainref, $rule1;
if ( $rule2 ) { if ( $rule2 ) {
$rule2 =~ s/-A tcout //; $rule2 =~ s/-A //;
add_rule $chainref, $rule2; add_rule $chainref, $rule2;
} }
} }

View File

@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( setup_notrack ); our @EXPORT = qw( setup_notrack );
our @EXPORT_OK = qw( ); our @EXPORT_OK = qw( );
our $VERSION = '4.3_7'; our $VERSION = '4.4_13';
# #
# Notrack # Notrack
@@ -50,9 +50,9 @@ sub process_notrack_rule( $$$$$$ ) {
( my $zone, $source) = split /:/, $source, 2; ( my $zone, $source) = split /:/, $source, 2;
my $zoneref = find_zone $zone; my $zoneref = find_zone $zone;
my $chainref = ensure_raw_chain( notrack_chain $zone ); my $chainref = ensure_raw_chain( notrack_chain $zone );
my $restriction = $zone eq firewall_zone ? OUTPUT_RESTRICT : PREROUTE_RESTRICT; my $restriction = $zoneref->{type} == FIREWALL || $zoneref->{type} == VSERVER ? OUTPUT_RESTRICT : PREROUTE_RESTRICT;
fatal_error 'USER/GROUP is not allowed unless the SOURCE zone is $FW' if $user ne '-' && $restriction != OUTPUT_RESTRICT; fatal_error 'USER/GROUP is not allowed unless the SOURCE zone is $FW or a Vserver zone' if $user ne '-' && $restriction != OUTPUT_RESTRICT;
require_capability 'RAW_TABLE', 'Notrack rules', ''; require_capability 'RAW_TABLE', 'Notrack rules', '';
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ); my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user );
@@ -64,7 +64,7 @@ sub process_notrack_rule( $$$$$$ ) {
$source , $source ,
$dest , $dest ,
'' , '' ,
'-j NOTRACK' , 'NOTRACK' ,
'' , '' ,
'NOTRACK' , 'NOTRACK' ,
'' ; '' ;

File diff suppressed because it is too large Load Diff

View File

@@ -40,37 +40,44 @@ use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( setup_tc ); our @EXPORT = qw( setup_tc );
our @EXPORT_OK = qw( process_tc_rule initialize ); our @EXPORT_OK = qw( process_tc_rule initialize );
our $VERSION = '4.4_9'; our $VERSION = '4.4_13';
our %tcs = ( T => { chain => 'tcpost', our %tcs = ( T => { chain => 'tcpost',
connmark => 0, connmark => 0,
fw => 1 fw => 1,
fwi => 0,
} , } ,
CT => { chain => 'tcpost' , CT => { chain => 'tcpost' ,
target => 'CONNMARK --set-mark' , target => 'CONNMARK --set-mark' ,
connmark => 1 , connmark => 1 ,
fw => 1 fw => 1 ,
fwi => 0,
} , } ,
C => { target => 'CONNMARK --set-mark' , C => { target => 'CONNMARK --set-mark' ,
connmark => 1 , connmark => 1 ,
fw => 1 fw => 1 ,
fwi => 1 ,
} , } ,
P => { chain => 'tcpre' , P => { chain => 'tcpre' ,
connmark => 0 , connmark => 0 ,
fw => 0 fw => 0 ,
fwi => 0 ,
} , } ,
CP => { chain => 'tcpre' , CP => { chain => 'tcpre' ,
target => 'CONNMARK --set-mark' , target => 'CONNMARK --set-mark' ,
connmark => 1 , connmark => 1 ,
fw => 0 fw => 0 ,
fwi => 0 ,
} , } ,
F => { chain => 'tcfor' , F => { chain => 'tcfor' ,
connmark => 0 , connmark => 0 ,
fw => 0 fw => 0 ,
fwi => 0 ,
} , } ,
CF => { chain => 'tcfor' , CF => { chain => 'tcfor' ,
connmark => 1 , connmark => 1 ,
fw => 0 , fw => 0 ,
fwi => 0 ,
} , } ,
); );
@@ -158,6 +165,7 @@ our %tcclasses;
our %restrictions = ( tcpre => PREROUTE_RESTRICT , our %restrictions = ( tcpre => PREROUTE_RESTRICT ,
tcpost => POSTROUTE_RESTRICT , tcpost => POSTROUTE_RESTRICT ,
tcfor => NO_RESTRICT , tcfor => NO_RESTRICT ,
tcin => INPUT_RESTRICT ,
tcout => OUTPUT_RESTRICT ); tcout => OUTPUT_RESTRICT );
our $family; 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 ) { if ( $designator ) {
$tcsref = $tcs{$designator}; $tcsref = $tcs{$designator};
if ( $tcsref ) { if ( $tcsref ) {
if ( $chain eq 'tcout' ) { if ( $chain eq 'tcout' ) {
fatal_error "Invalid chain designator for source $fw" unless $tcsref->{fw}; 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}; $chain = $tcsref->{chain} if $tcsref->{chain};
@@ -250,6 +269,8 @@ sub process_tc_rule( ) {
$list = ''; $list = '';
my $restriction = 0;
unless ( $classid ) { unless ( $classid ) {
MARK: MARK:
{ {
@@ -259,7 +280,7 @@ sub process_tc_rule( ) {
require_capability ('CONNMARK' , "SAVE/RESTORE Rules", '' ) if $tccmd->{connmark}; require_capability ('CONNMARK' , "SAVE/RESTORE Rules", '' ) if $tccmd->{connmark};
$target = "$tccmd->{target} "; $target = $tccmd->{target};
my $marktype = $tccmd->{mark}; my $marktype = $tccmd->{mark};
if ( $marktype == NOMARK ) { if ( $marktype == NOMARK ) {
@@ -268,15 +289,19 @@ sub process_tc_rule( ) {
$mark =~ s/^[|&]//; $mark =~ s/^[|&]//;
} }
if ( $target eq 'sticky ' ) { if ( $target eq 'sticky' ) {
if ( $chain eq 'tcout' ) { if ( $chain eq 'tcout' ) {
$target = 'sticko'; $target = 'sticko';
} else { } else {
fatal_error "SAME rules are only allowed in the PREROUTING and OUTPUT chains" if $chain ne 'tcpre'; 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++; $sticky++;
} elsif ( $target eq 'IPMARK ' ) { } elsif ( $target eq 'IPMARK' ) {
my ( $srcdst, $mask1, $mask2, $shift ) = ('src', 255, 0, 0 ); my ( $srcdst, $mask1, $mask2, $shift ) = ('src', 255, 0, 0 );
require_capability 'IPMARK_TARGET', 'IPMARK', 's'; 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"; $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'); require_capability( 'TPROXY_TARGET', 'Use of TPROXY', 's');
fatal_error "Invalid TPROXY specification( $cmd/$rest )" if $rest; fatal_error "Invalid TPROXY specification( $cmd/$rest )" if $rest;
@@ -371,14 +396,16 @@ sub process_tc_rule( ) {
my $val = numeric_value( $cmd ); my $val = numeric_value( $cmd );
fatal_error "Invalid MARK/CLASSIFY ($cmd)" unless defined $val; fatal_error "Invalid MARK/CLASSIFY ($cmd)" unless defined $val;
my $limit = $globals{TC_MASK}; my $limit = $globals{TC_MASK};
fatal_error "Marks <= $limit may not be set in the PREROUTING or OUTPUT chains when HIGH_ROUTE_MARKS=Yes" unless ( have_capability 'FWMARK_RT_MASK' ) {
if $cmd && ( $chain eq 'tcpre' || $chain eq 'tcout' ) && $val <= $limit; fatal_error "Marks <= $limit may not be set in the PREROUTING or OUTPUT chains when HIGH_ROUTE_MARKS=Yes"
if $cmd && ( $chain eq 'tcpre' || $chain eq 'tcout' ) && $val <= $limit;
}
} }
} }
} }
if ( ( my $result = expand_rule( ensure_chain( 'mangle' , $chain ) , if ( ( my $result = expand_rule( ensure_chain( 'mangle' , $chain ) ,
$restrictions{$chain} , $restrictions{$chain} | $restriction,
do_proto( $proto, $ports, $sports) . do_proto( $proto, $ports, $sports) .
do_user( $user ) . do_user( $user ) .
do_test( $testval, $globals{TC_MASK} ) . do_test( $testval, $globals{TC_MASK} ) .
@@ -389,9 +416,9 @@ sub process_tc_rule( ) {
$source , $source ,
$dest , $dest ,
'' , '' ,
"-j $target $mark" , $mark ? "$target $mark" : $target,
'' ,
'' , '' ,
$target ,
'' ) ) '' ) )
&& $device ) { && $device ) {
# #
@@ -408,11 +435,11 @@ sub rate_to_kbit( $ ) {
my $rate = $_[0]; my $rate = $_[0];
return 0 if $rate eq '-'; return 0 if $rate eq '-';
return $1 if $rate =~ /^(\d+)kbit$/i; return $1 if $rate =~ /^((\d+)(\.\d+)?)kbit$/i;
return $1 * 1000 if $rate =~ /^(\d+)mbit$/i; return $1 * 1000 if $rate =~ /^((\d+)(\.\d+)?)mbit$/i;
return $1 * 8000 if $rate =~ /^(\d+)mbps$/i; return $1 * 8000 if $rate =~ /^((\d+)(\.\d+)?)mbps$/i;
return $1 * 8 if $rate =~ /^(\d+)kbps$/i; return $1 * 8 if $rate =~ /^((\d+)(\.\d+)?)kbps$/i;
return int($1/125) if $rate =~ /^(\d+)(bps)?$/; return ($1/125) if $rate =~ /^((\d+)(\.\d+)?)(bps)?$/;
fatal_error "Invalid Rate ($rate)"; fatal_error "Invalid Rate ($rate)";
} }
@@ -431,8 +458,6 @@ sub calculate_quantum( $$ ) {
sub process_flow($) { sub process_flow($) {
my $flow = shift; my $flow = shift;
$flow =~ s/^\(// if $flow =~ s/\)$//;
my @flow = split /,/, $flow; my @flow = split /,/, $flow;
for ( @flow ) { for ( @flow ) {
@@ -443,7 +468,7 @@ sub process_flow($) {
} }
sub process_simple_device() { sub process_simple_device() {
my ( $device , $type , $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 "Duplicate INTERFACE ($device)" if $tcdevices{$device};
fatal_error "Invalid INTERFACE name ($device)" if $device =~ /[:+]/; fatal_error "Invalid INTERFACE name ($device)" if $device =~ /[:+]/;
@@ -463,7 +488,21 @@ sub process_simple_device() {
} }
} }
$bandwidth = rate_to_kbit( $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"; emit "if interface_is_up $physical; then";
@@ -475,10 +514,50 @@ sub process_simple_device() {
); );
emit ( "run_tc qdisc add dev $physical handle ffff: ingress", emit ( "run_tc qdisc add dev $physical handle ffff: ingress",
"run_tc filter add dev $physical parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${bandwidth}kbit burst 10k drop flowid :1\n" "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 $bandwidth; ) 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++ ) { for ( my $i = 1; $i <= 3; $i++ ) {
emit "run_tc qdisc add dev $physical parent $number:$i handle ${number}${i}: sfq quantum 1875 limit 127 perturb 10"; emit "run_tc qdisc add dev $physical parent $number:$i handle ${number}${i}: sfq quantum 1875 limit 127 perturb 10";
@@ -1228,11 +1307,26 @@ sub setup_traffic_shaping() {
qq(fi) ); 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 ) { if ( $inband ) {
emit ( "run_tc qdisc add dev $device handle ffff: ingress", 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"
); );
} }
@@ -1350,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 # Process the tcrules file and setup traffic shaping
# #
@@ -1362,6 +1518,7 @@ sub setup_tc() {
if ( have_capability( 'MANGLE_FORWARD' ) ) { if ( have_capability( 'MANGLE_FORWARD' ) ) {
ensure_mangle_chain 'tcfor'; ensure_mangle_chain 'tcfor';
ensure_mangle_chain 'tcpost'; ensure_mangle_chain 'tcpost';
ensure_mangle_chain 'tcin';
} }
my $mark_part = ''; my $mark_part = '';
@@ -1383,9 +1540,12 @@ sub setup_tc() {
add_jump $mangle_table->{OUTPUT} , 'tcout', 0, $mark_part; add_jump $mangle_table->{OUTPUT} , 'tcout', 0, $mark_part;
if ( have_capability( 'MANGLE_FORWARD' ) ) { if ( have_capability( 'MANGLE_FORWARD' ) ) {
add_rule( $mangle_table->{FORWARD}, '-j MARK --set-mark 0' ) if have_capability 'MARK'; my $mask = have_capability 'EXMARK' ? have_capability 'FWMARK_RT_MASK' ? '/' . in_hex $globals{PROVIDER_MASK} : '' : '';
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->{FORWARD} , 'tcfor', 0;
add_jump $mangle_table->{POSTROUTING} , 'tcpost', 0; add_jump $mangle_table->{POSTROUTING} , 'tcpost', 0;
add_jump $mangle_table->{INPUT} , 'tcin' , 0;
} }
} }
@@ -1434,7 +1594,7 @@ sub setup_tc() {
mark => HIGHMARK , mark => HIGHMARK ,
mask => '' } , mask => '' } ,
{ match => sub ( $ ) { $_[0] =~ '&.*' }, { match => sub ( $ ) { $_[0] =~ '&.*' },
target => 'MARK --and-mark ' , target => 'MARK --and-mark' ,
mark => HIGHMARK , mark => HIGHMARK ,
mask => '' , mask => '' ,
connmark => 0 connmark => 0
@@ -1456,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; 1;

View File

@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( setup_tunnels ); our @EXPORT = qw( setup_tunnels );
our @EXPORT_OK = ( ); 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... # 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 $inchainref, "-p 50 $source -j ACCEPT";
add_tunnel_rule $outchainref, "-p 50 $dest -j ACCEPT"; add_tunnel_rule $outchainref, "-p 50 $dest -j ACCEPT";

View File

@@ -37,6 +37,7 @@ our @EXPORT = qw( NOTHING
IPSECPROTO IPSECPROTO
IPSECMODE IPSECMODE
FIREWALL FIREWALL
VSERVER
IP IP
BPORT BPORT
IPSEC IPSEC
@@ -52,8 +53,11 @@ our @EXPORT = qw( NOTHING
all_zones all_zones
all_parent_zones all_parent_zones
complex_zones complex_zones
vserver_zones
off_firewall_zones
non_firewall_zones non_firewall_zones
single_interface single_interface
chain_base
validate_interfaces_file validate_interfaces_file
all_interfaces all_interfaces
all_bridges all_bridges
@@ -67,18 +71,20 @@ our @EXPORT = qw( NOTHING
source_port_to_bridge source_port_to_bridge
interface_is_optional interface_is_optional
find_interfaces_by_option find_interfaces_by_option
find_interfaces_by_option1
get_interface_option get_interface_option
set_interface_option set_interface_option
verify_required_interfaces verify_required_interfaces
compile_updown compile_updown
validate_hosts_file validate_hosts_file
find_hosts_by_option find_hosts_by_option
find_zones_by_option
all_ipsets all_ipsets
have_ipsec have_ipsec
); );
our @EXPORT_OK = qw( initialize ); our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_9'; our $VERSION = '4.4_13';
# #
# IPSEC Option types # IPSEC Option types
@@ -89,7 +95,6 @@ use constant { NOTHING => 'NOTHING',
IPSECPROTO => 'ah|esp|ipcomp', IPSECPROTO => 'ah|esp|ipcomp',
IPSECMODE => 'tunnel|transport' IPSECMODE => 'tunnel|transport'
}; };
# #
# Zone Table. # Zone Table.
# #
@@ -150,21 +155,29 @@ our %reservedName = ( all => 1,
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ] # broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
# number => <ordinal position in the interfaces file> # number => <ordinal position in the interfaces file>
# physical => <physical interface name> # 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 %interfaces; our %interfaces;
our @bport_zones; our @bport_zones;
our %ipsets; our %ipsets;
our %physical; our %physical;
our %basemap;
our %mapbase;
our $family; our $family;
our $have_ipsec; our $have_ipsec;
our $baseseq;
use constant { FIREWALL => 1, use constant { FIREWALL => 1,
IP => 2, IP => 2,
BPORT => 3, BPORT => 3,
IPSEC => 4 }; IPSEC => 4,
VSERVER => 5 };
use constant { SIMPLE_IF_OPTION => 1, use constant { SIMPLE_IF_OPTION => 1,
BINARY_IF_OPTION => 2, BINARY_IF_OPTION => 2,
@@ -178,6 +191,7 @@ use constant { SIMPLE_IF_OPTION => 1,
IF_OPTION_ZONEONLY => 8, IF_OPTION_ZONEONLY => 8,
IF_OPTION_HOST => 16, IF_OPTION_HOST => 16,
IF_OPTION_VSERVER => 32,
}; };
our %validinterfaceoptions; our %validinterfaceoptions;
@@ -210,6 +224,9 @@ sub initialize( $ ) {
@bport_zones = (); @bport_zones = ();
%ipsets = (); %ipsets = ();
%physical = (); %physical = ();
%basemap = ();
%mapbase = ();
$baseseq = 0;
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION, %validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
@@ -220,13 +237,13 @@ sub initialize( $ ) {
dhcp => SIMPLE_IF_OPTION, dhcp => SIMPLE_IF_OPTION,
maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST, maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
logmartians => BINARY_IF_OPTION, logmartians => BINARY_IF_OPTION,
nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY, nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_VSERVER,
norfc1918 => OBSOLETE_IF_OPTION, norfc1918 => OBSOLETE_IF_OPTION,
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST, nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
optional => SIMPLE_IF_OPTION, optional => SIMPLE_IF_OPTION,
proxyarp => BINARY_IF_OPTION, proxyarp => BINARY_IF_OPTION,
required => SIMPLE_IF_OPTION, required => SIMPLE_IF_OPTION,
routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST, routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER,
routefilter => NUMERIC_IF_OPTION , routefilter => NUMERIC_IF_OPTION ,
sourceroute => BINARY_IF_OPTION, sourceroute => BINARY_IF_OPTION,
tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST, tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST,
@@ -251,12 +268,12 @@ sub initialize( $ ) {
bridge => SIMPLE_IF_OPTION, bridge => SIMPLE_IF_OPTION,
dhcp => SIMPLE_IF_OPTION, dhcp => SIMPLE_IF_OPTION,
maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST, maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY, nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_VSERVER,
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST, nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
optional => SIMPLE_IF_OPTION, optional => SIMPLE_IF_OPTION,
proxyndp => BINARY_IF_OPTION, proxyndp => BINARY_IF_OPTION,
required => SIMPLE_IF_OPTION, required => SIMPLE_IF_OPTION,
routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST, routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER,
sourceroute => BINARY_IF_OPTION, sourceroute => BINARY_IF_OPTION,
tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST, tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST,
mss => NUMERIC_IF_OPTION, mss => NUMERIC_IF_OPTION,
@@ -282,6 +299,7 @@ sub initialize( $ ) {
sub parse_zone_option_list($$) sub parse_zone_option_list($$)
{ {
my %validoptions = ( mss => NUMERIC, my %validoptions = ( mss => NUMERIC,
blacklist => NOTHING,
strict => NOTHING, strict => NOTHING,
next => NOTHING, next => NOTHING,
reqid => NUMERIC, reqid => NUMERIC,
@@ -291,10 +309,12 @@ sub parse_zone_option_list($$)
"tunnel-src" => NETWORK, "tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK, "tunnel-dst" => NETWORK,
); );
use constant { UNRESTRICTED => 1, NOFW => 2 };
# #
# Hash of options that have their own key in the returned hash. # 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 ( $list, $zonetype ) = @_;
my %h; my %h;
@@ -327,7 +347,8 @@ sub parse_zone_option_list($$)
} }
if ( $key{$e} ) { 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 { } else {
fatal_error "The \"$e\" option may only be specified for ipsec zones" unless $zonetype == IPSEC; fatal_error "The \"$e\" option may only be specified for ipsec zones" unless $zonetype == IPSEC;
$options .= $invert; $options .= $invert;
@@ -374,6 +395,7 @@ sub process_zone( \$ ) {
fatal_error "Invalid Parent List ($2)" unless $p; fatal_error "Invalid Parent List ($2)" unless $p;
fatal_error "Unknown parent zone ($p)" unless $zones{$p}; fatal_error "Unknown parent zone ($p)" unless $zones{$p};
fatal_error 'Subzones of firewall zone not allowed' if $zones{$p}{type} == FIREWALL; fatal_error 'Subzones of firewall zone not allowed' if $zones{$p}{type} == FIREWALL;
fatal_error 'Subzones of a Vserver zone not allowed' if $zones{$p}{type} == VSERVER;
push @{$zones{$p}{children}}, $zone; push @{$zones{$p}{children}}, $zone;
} }
} }
@@ -400,11 +422,14 @@ sub process_zone( \$ ) {
$firewall_zone = $zone; $firewall_zone = $zone;
$ENV{FW} = $zone; $ENV{FW} = $zone;
$type = FIREWALL; $type = FIREWALL;
} elsif ( $type eq 'vserver' ) {
fatal_error 'Vserver zones may not be nested' if @parents;
$type = VSERVER;
} elsif ( $type eq '-' ) { } elsif ( $type eq '-' ) {
$type = IP; $type = IP;
$$ip = 1; $$ip = 1;
} else { } else {
fatal_error "Invalid zone type ($type)" ; fatal_error "Invalid zone type ($type)";
} }
if ( $type eq IPSEC ) { if ( $type eq IPSEC ) {
@@ -414,20 +439,30 @@ sub process_zone( \$ ) {
} }
} }
$zones{$zone} = { type => $type, my $zoneref = $zones{$zone} = { type => $type,
parents => \@parents, parents => \@parents,
bridge => '', bridge => '',
options => { in_out => parse_zone_option_list( $options || '', $type ) , options => { in_out => parse_zone_option_list( $options || '', $type ) ,
in => parse_zone_option_list( $in_options || '', $type ) , in => parse_zone_option_list( $in_options || '', $type ) ,
out => parse_zone_option_list( $out_options || '', $type ) , out => parse_zone_option_list( $out_options || '', $type ) ,
complex => ( $type == IPSEC || $options ne '-' || $in_options ne '-' || $out_options ne '-' ) , complex => ( $type == IPSEC || $options ne '-' || $in_options ne '-' || $out_options ne '-' ) ,
nested => @parents > 0 , nested => @parents > 0 ,
super => 0 , super => 0 ,
} , } ,
interfaces => {} , interfaces => {} ,
children => [] , children => [] ,
hosts => {} 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; return $zone;
@@ -493,9 +528,9 @@ sub zone_report()
my @translate; my @translate;
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
@translate = ( undef, 'firewall', 'ipv4', 'bport4', 'ipsec4' ); @translate = ( undef, 'firewall', 'ipv4', 'bport4', 'ipsec4', 'vserver' );
} else { } else {
@translate = ( undef, 'firewall', 'ipv6', 'bport6', 'ipsec6' ); @translate = ( undef, 'firewall', 'ipv6', 'bport6', 'ipsec6', 'vserver' );
} }
for my $zone ( @zones ) for my $zone ( @zones )
@@ -552,9 +587,9 @@ sub dump_zone_contents()
my @xlate; my @xlate;
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
@xlate = ( undef, 'firewall', 'ipv4', 'bport4', 'ipsec4' ); @xlate = ( undef, 'firewall', 'ipv4', 'bport4', 'ipsec4', 'vserver' );
} else { } else {
@xlate = ( undef, 'firewall', 'ipv6', 'bport6', 'ipsec6' ); @xlate = ( undef, 'firewall', 'ipv6', 'bport6', 'ipsec6', 'vserver' );
} }
for my $zone ( @zones ) for my $zone ( @zones )
@@ -631,7 +666,9 @@ sub add_group_to_zone($$$$$)
my $allip = 0; my $allip = 0;
for my $host ( @$networks ) { for my $host ( @$networks ) {
$interfaces{$interface}{nets}++; $interfaceref = $interfaces{$interface};
$interfaceref->{nets}++;
fatal_error "Invalid Host List" unless defined $host and $host ne ''; fatal_error "Invalid Host List" unless defined $host and $host ne '';
@@ -648,6 +685,13 @@ sub add_group_to_zone($$$$$)
if ( $host eq ALLIP ) { if ( $host eq ALLIP ) {
fatal_error "Duplicate Host Group ($interface:$host) in zone $zone" if @newnetworks; fatal_error "Duplicate Host Group ($interface:$host) in zone $zone" if @newnetworks;
$interfaces{$interface}{zone} = $zone; $interfaces{$interface}{zone} = $zone;
#
# Make 'find_hosts_by_option()' work correctly for this zone
#
for ( qw/blacklist maclist nosmurfs tcpflags/ ) {
$options->{$_} = $interfaceref->{options}{$_} if $interfaceref->{options}{$_};
}
$allip = 1; $allip = 1;
} }
} }
@@ -711,18 +755,30 @@ sub all_zones() {
@zones; @zones;
} }
sub off_firewall_zones() {
grep ( ! ( $zones{$_}{type} == FIREWALL || $zones{$_}{type} == VSERVER ) , @zones );
}
sub non_firewall_zones() { sub non_firewall_zones() {
grep ( $zones{$_}{type} != FIREWALL , @zones ); grep ( $zones{$_}{type} != FIREWALL , @zones );
} }
sub all_parent_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() { sub complex_zones() {
grep( $zones{$_}{options}{complex} , @zones ); grep( $zones{$_}{options}{complex} , @zones );
} }
sub vserver_zones() {
grep ( $zones{$_}{type} == VSERVER, @zones );
}
sub firewall_zone() { sub firewall_zone() {
$firewall_zone; $firewall_zone;
} }
@@ -734,6 +790,55 @@ sub is_a_bridge( $ ) {
which 'brctl' && qt( "brctl show | tail -n+2 | grep -q '^$_[0]\[\[:space:\]\]'" ); which 'brctl' && qt( "brctl show | tail -n+2 | grep -q '^$_[0]\[\[:space:\]\]'" );
} }
#
# Transform the passed interface name into a legal shell variable name.
#
sub chain_base($) {
my $chain = $_[0];
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 =~ 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;
}
# #
# Process a record in the interfaces file # Process a record in the interfaces file
# #
@@ -774,6 +879,8 @@ sub process_interface( $$ ) {
} else { } else {
$zoneref->{bridge} = $interface; $zoneref->{bridge} = $interface;
} }
fatal_error "Vserver zones may not be associated with bridge ports" if $zoneref->{type} == VSERVER;
} }
$bridge = $interface; $bridge = $interface;
@@ -781,6 +888,8 @@ sub process_interface( $$ ) {
} else { } else {
fatal_error "Duplicate Interface ($interface)" if $interfaces{$interface}; fatal_error "Duplicate Interface ($interface)" if $interfaces{$interface};
fatal_error "Zones of type 'bport' may only be associated with bridge ports" if $zone && $zoneref->{type} == BPORT; fatal_error "Zones of type 'bport' may only be associated with bridge ports" if $zone && $zoneref->{type} == BPORT;
fatal_error "Vserver zones may not be associated with interfaces" if $zone && $zoneref->{type} == VSERVER;
$bridge = $interface; $bridge = $interface;
} }
@@ -794,6 +903,8 @@ sub process_interface( $$ ) {
$root = $interface; $root = $interface;
} }
fatal_error "Invalid interface name ($interface)" if $interface =~ /\*/;
my $physical = $interface; my $physical = $interface;
my $broadcasts; my $broadcasts;
@@ -817,7 +928,11 @@ sub process_interface( $$ ) {
my $hostoptionsref = {}; my $hostoptionsref = {};
$options{ignore} = 1, $options = '-' if $options eq 'ignore'; if ( $options eq 'ignore' ) {
fatal_error "Ignored interfaces may not be associated with a zone" if $zone;
$options{ignore} = 1;
$options = '-';
}
if ( $options ne '-' ) { if ( $options ne '-' ) {
@@ -830,7 +945,11 @@ sub process_interface( $$ ) {
fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option}; fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option};
fatal_error "The \"$option\" option may not be specified on a multi-zone interface" if $type & IF_OPTION_ZONEONLY && ! $zone; if ( $zone ) {
fatal_error qq(The "$option" option may not be specified for a Vserver zone") if $zoneref->{type} == VSERVER && ! ( $type & IF_OPTION_VSERVER );
} else {
fatal_error "The \"$option\" option may not be specified on a multi-zone interface" if $type & IF_OPTION_ZONEONLY;
}
my $hostopt = $type & IF_OPTION_HOST; my $hostopt = $type & IF_OPTION_HOST;
@@ -840,8 +959,16 @@ sub process_interface( $$ ) {
if ( $type == SIMPLE_IF_OPTION ) { if ( $type == SIMPLE_IF_OPTION ) {
fatal_error "Option $option does not take a value" if defined $value; fatal_error "Option $option does not take a value" if defined $value;
$options{$option} = 1; if ( $option eq 'blacklist' ) {
$hostoptions{$option} = 1 if $hostopt; 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 ) { } elsif ( $type == BINARY_IF_OPTION ) {
$value = 1 unless defined $value; $value = 1 unless defined $value;
fatal_error "Option value for '$option' must be 0 or 1" unless ( $value eq '0' || $value eq '1' ); fatal_error "Option value for '$option' must be 0 or 1" unless ( $value eq '0' || $value eq '1' );
@@ -849,8 +976,8 @@ sub process_interface( $$ ) {
$options{$option} = $value; $options{$option} = $value;
$hostoptions{$option} = $value if $hostopt; $hostoptions{$option} = $value if $hostopt;
} elsif ( $type == ENUM_IF_OPTION ) { } elsif ( $type == ENUM_IF_OPTION ) {
fatal_error "The '$option' option may not be used with a wild-card interface name" if $wildcard;
if ( $option eq 'arp_ignore' ) { 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 ( defined $value ) {
if ( $value =~ /^[1-3,8]$/ ) { if ( $value =~ /^[1-3,8]$/ ) {
$options{arp_ignore} = $value; $options{arp_ignore} = $value;
@@ -873,10 +1000,6 @@ sub process_interface( $$ ) {
} elsif ( $type == IPLIST_IF_OPTION ) { } elsif ( $type == IPLIST_IF_OPTION ) {
fatal_error "The '$option' option requires a value" unless defined $value; 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 '!' # Add all IP to the front of a list if the list begins with '!'
# #
$value = join ',' , ALLIP , $value if $value =~ /^!/; $value = join ',' , ALLIP , $value if $value =~ /^!/;
@@ -909,7 +1032,7 @@ sub process_interface( $$ ) {
fatal_error "The '$option' option requires a value" unless defined $value; fatal_error "The '$option' option requires a value" unless defined $value;
if ( $option eq 'physical' ) { 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 ); fatal_error "Duplicate physical interface name ($value)" if ( $physical{$value} && ! $port );
@@ -955,7 +1078,8 @@ sub process_interface( $$ ) {
broadcasts => $broadcasts , broadcasts => $broadcasts ,
options => \%options , options => \%options ,
zone => '', zone => '',
physical => $physical physical => $physical ,
base => chain_base( $physical )
}; };
if ( $zone ) { if ( $zone ) {
@@ -964,7 +1088,7 @@ sub process_interface( $$ ) {
add_group_to_zone( $zone, add_group_to_zone( $zone,
$zoneref->{type}, $zoneref->{type},
$interface, $interface,
[ IPv4_MULTICAST ], $family == F_IPV4 ? [ IPv4_MULTICAST ] : [ IPv6_MULTICAST ] ,
{ destonly => 1 } ) if $hostoptionsref->{multicast} && $interfaces{$interface}{zone} ne $zone; { destonly => 1 } ) if $hostoptionsref->{multicast} && $interfaces{$interface}{zone} ne $zone;
} }
@@ -1011,6 +1135,27 @@ sub validate_interfaces_file( $ ) {
# Be sure that we have at least one interface # Be sure that we have at least one interface
# #
fatal_error "No network interfaces defined" unless @interfaces; fatal_error "No network interfaces defined" unless @interfaces;
if ( vserver_zones ) {
#
# While the user thinks that vservers are associated with a particular interface, they really are not.
# We create an interface to associated them with.
#
my $interface = '%vserver%';
$interfaces{$interface} = { name => $interface ,
bridge => $interface ,
nets => 0 ,
number => $nextinum ,
root => $interface ,
broadcasts => undef ,
options => {} ,
zone => '',
physical => 'lo',
};
push @interfaces, $interface;
}
} }
# #
@@ -1030,28 +1175,35 @@ sub map_physical( $$ ) {
# #
# Returns true if passed interface matches an entry in /etc/shorewall/interfaces # 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}; my $interfaceref = $interfaces{$interface};
return $interfaceref if $interfaceref; return $interfaceref if $interfaceref;
fatal_error "Invalid interface ($interface)" if $interface =~ /\*/;
for my $i ( @interfaces ) { for my $i ( @interfaces ) {
$interfaceref = $interfaces{$i}; $interfaceref = $interfaces{$i};
my $root = $interfaceref->{root}; my $root = $interfaceref->{root};
if ( $i ne $root && substr( $interface, 0, length $root ) eq $root ) { if ( $i ne $root && substr( $interface, 0, length $root ) eq $root ) {
# my $physical = map_physical( $interface, $interfaceref );
# 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;
# my $copyref = { options => $interfaceref->{options},
return $interfaces{$interface} = { options => $interfaceref->{options}, bridge => $interfaceref->{bridge} ,
bridge => $interfaceref->{bridge} , name => $i ,
name => $i , number => $interfaceref->{number} ,
number => $interfaceref->{number} , physical => $physical ,
physical => map_physical( $interface, $interfaceref ) base => chain_base( $physical ) ,
}; };
$interfaces{$interface} = $copyref if $cache;
return $copyref;
} }
} }
@@ -1161,6 +1313,36 @@ sub find_interfaces_by_option( $ ) {
\@ints; \@ints;
} }
#
# Returns reference to array of interfaces with the passed option. Unlike the preceding function, this one:
#
# - All entries in %interfaces are searched.
# - Returns a two-element list; the second element indicates whether any members of the list have wildcard physical names
#
sub find_interfaces_by_option1( $ ) {
my $option = $_[0];
my @ints = ();
my $wild = 0;
for my $interface ( sort { $interfaces{$a}->{number} <=> $interfaces{$b}->{number} }
keys %interfaces ) {
my $interfaceref = $interfaces{$interface};
next unless defined $interfaceref->{physical};
my $optionsref = $interfaceref->{options};
if ( $optionsref && defined $optionsref->{$option} ) {
$wild ||= ( $interfaceref->{physical} =~ /\+$/ );
push @ints , $interface
}
}
return unless defined wantarray;
wantarray ? ( \@ints, $wild ) : \@ints;
}
# #
# Return the value of an option for an interface # Return the value of an option for an interface
# #
@@ -1182,54 +1364,123 @@ sub set_interface_option( $$$ ) {
# #
# Verify that all required interfaces are available after waiting for any that specify the 'wait' option. # Verify that all required interfaces are available after waiting for any that specify the 'wait' option.
# #
sub verify_required_interfaces() { sub verify_required_interfaces( $ ) {
my $generate_case = shift;
my $returnvalue = 0; my $returnvalue = 0;
my $interfaces = find_interfaces_by_option 'wait'; my $interfaces = find_interfaces_by_option 'wait';
if ( @$interfaces ) { if ( @$interfaces ) {
my $first = 1;
emit( "local waittime\n" );
emit( 'case "$COMMAND" in' );
push_indent;
emit( 'start|restart|restore)' );
push_indent;
for my $interface (@$interfaces ) { for my $interface (@$interfaces ) {
my $wait = $interfaces{$interface}{options}{wait}; my $wait = $interfaces{$interface}{options}{wait};
emit q() unless $first-- > 0;
if ( $wait ) { if ( $wait ) {
my $physical = get_physical $interface; my $physical = get_physical $interface;
emit qq(if ! interface_is_usable $physical; then); if ( $physical =~ /\+$/ ) {
emit q( local waittime); my $base = uc chain_base $physical;
emit qq( waittime=$wait);
emit ''; $physical =~ s/\+$/*/;
emit q( while [ $waittime -gt 0 ]; do);
emit qq( interface_is_usable $physical && break); emit( 'for interface in $(find_all_interfaces); do',
emit q( sleep 1); ' case $interface in',
emit ' waittime=$(($waittime - 1))'; " $physical)",
emit q( done); " waittime=$wait",
emit qq(fi\n); ' while [ $waittime -gt 0 ]; do',
' interface_is_usable $interface && break',
' waittime=$(($waittime - 1))',
' done',
' ;;',
' esac',
'done',
'',
);
} else {
emit qq(if ! interface_is_usable $physical; then);
emit qq( waittime=$wait);
emit '';
emit q( while [ $waittime -gt 0 ]; do);
emit qq( interface_is_usable $physical && break);
emit q( sleep 1);
emit ' waittime=$(($waittime - 1))';
emit q( done);
emit q(fi);
}
$returnvalue = 1; $returnvalue = 1;
} }
} }
emit( ";;\n" );
pop_indent;
pop_indent;
emit( "esac\n" );
} }
$interfaces = find_interfaces_by_option 'required'; $interfaces = find_interfaces_by_option 'required';
if ( @$interfaces ) { if ( @$interfaces ) {
emit( 'case "$COMMAND" in' );
push_indent; if ( $generate_case ) {
emit( 'start|restart|restore|refresh)' ); emit( 'case "$COMMAND" in' );
push_indent; push_indent;
emit( 'start|restart|restore|refresh)' );
push_indent;
}
for my $interface (@$interfaces ) { for my $interface (@$interfaces ) {
my $physical = get_physical $interface; my $physical = get_physical $interface;
emit qq(if ! interface_is_usable $physical; then); if ( $physical =~ /\+$/ ) {
emit qq( startup_error "Required interface $physical not available"); my $base = uc chain_base $physical;
emit qq(fi\n);
$physical =~ s/\+$/*/;
emit( "SW_${base}_IS_UP=\n",
'for interface in $(find_all_interfaces); do',
' case $interface in',
" $physical)",
" interface_is_usable \$interface && SW_${base}_IS_UP=Yes && break",
' ;;',
' esac',
'done',
'',
"if [ -z \"\$SW_${base}_IS_UP\" ]; then",
" startup_error \"None of the required interfaces $physical are available\"",
"fi\n"
);
} else {
emit qq(if ! interface_is_usable $physical; then);
emit qq( startup_error "Required interface $physical not available");
emit qq(fi\n);
}
} }
emit( ';;' ); if ( $generate_case ) {
pop_indent; emit( ';;' );
pop_indent; pop_indent;
emit( 'esac' ); pop_indent;
emit( 'esac' );
}
$returnvalue = 1; $returnvalue = 1;
} }
@@ -1255,6 +1506,9 @@ sub compile_updown() {
'state=cleared', 'state=cleared',
'' ); '' );
emit 'progress_message3 "$g_product $COMMAND triggered by $1"';
emit '';
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
emit 'if shorewall_is_started; then'; emit 'if shorewall_is_started; then';
} else { } else {
@@ -1293,6 +1547,7 @@ sub compile_updown() {
$interfaces =~ s/\+/*/; $interfaces =~ s/\+/*/;
emit( "$interfaces)", emit( "$interfaces)",
' progress_message3 "$COMMAND on interface $1 ignored"',
' exit 0', ' exit 0',
' ;;' ' ;;'
); );
@@ -1301,18 +1556,40 @@ sub compile_updown() {
if ( @$required ) { if ( @$required ) {
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$required; my $interfaces = join '|', map $interfaces{$_}->{physical}, @$required;
$interfaces =~ s/\+/*/; my $wildcard = ( $interfaces =~ s/\+/*/ );
emit( "$interfaces)", emit( "$interfaces)",
' if [ "$COMMAND" = up ]; then', ' if [ "$COMMAND" = up ]; then' );
' COMMAND=start',
if ( $wildcard ) {
emit( ' if [ "$state" = started ]; then',
' COMMAND=restart',
' else',
' COMMAND=start',
' fi' );
} else {
emit( ' COMMAND=start' );
}
emit( ' progress_message3 "$g_product attempting $COMMAND"',
' detect_configuration', ' detect_configuration',
' define_firewall', ' define_firewall' );
' else',
' COMMAND=stop', if ( $wildcard ) {
' detect_configuration', emit( ' elif [ "$state" = started ]; then',
' stop_firewall', ' progress_message3 "$g_product attempting restart"',
' fi', ' COMMAND=restart',
' detect_configuration',
' define_firewall' );
} else {
emit( ' else',
' COMMAND=stop',
' progress_message3 "$g_product attempting stop"',
' detect_configuration',
' stop_firewall' );
}
emit( ' fi',
' ;;' ' ;;'
); );
} }
@@ -1331,12 +1608,16 @@ sub compile_updown() {
'', '',
' if [ "$state" = started ]; then', ' if [ "$state" = started ]; then',
' COMMAND=restart', ' COMMAND=restart',
' progress_message3 "$g_product attempting restart"',
' detect_configuration', ' detect_configuration',
' define_firewall', ' define_firewall',
' elif [ "$state" = stopped ]; then', ' elif [ "$state" = stopped ]; then',
' COMMAND=start', ' COMMAND=start',
' progress_message3 "$g_product attempting start"',
' detect_configuration', ' detect_configuration',
' define_firewall', ' define_firewall',
' else',
' progress_message3 "$COMMAND on interface $1 ignored"',
' fi', ' fi',
' ;;', ' ;;',
); );
@@ -1346,9 +1627,13 @@ sub compile_updown() {
' case $state in', ' case $state in',
' started)', ' started)',
' COMMAND=restart', ' COMMAND=restart',
' progress_message3 "$g_product attempting restart"',
' detect_configuration', ' detect_configuration',
' define_firewall', ' define_firewall',
' ;;', ' ;;',
' *)',
' progress_message3 "$COMMAND on interface $1 ignored"',
' ;;',
' esac', ' esac',
); );
@@ -1418,14 +1703,19 @@ sub process_host( ) {
$zoneref->{options}{complex} = 1; $zoneref->{options}{complex} = 1;
$ipsec = 1; $ipsec = 1;
} elsif ( $option eq 'norfc1918' ) { } 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}) { } 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; $options{$option} = 1;
} else { } else {
fatal_error "Invalid option ($option)"; fatal_error "Invalid option ($option)";
} }
} }
fatal_error q(A host entry for a Vserver zone may not specify the 'ipsec' option) if $ipsec && $zoneref->{type} == VSERVER;
$optionsref = \%options; $optionsref = \%options;
} }
@@ -1445,6 +1735,7 @@ sub process_host( ) {
$hosts = join( '', ALLIP , $hosts ) if substr($hosts, 0, 2 ) eq ',!'; $hosts = join( '', ALLIP , $hosts ) if substr($hosts, 0, 2 ) eq ',!';
if ( $hosts eq 'dynamic' ) { if ( $hosts eq 'dynamic' ) {
fatal_error "Vserver zones may not be dynamic" if $type == VSERVER;
require_capability( 'IPSET_MATCH', 'Dynamic nets', ''); require_capability( 'IPSET_MATCH', 'Dynamic nets', '');
my $physical = physical_name $interface; my $physical = physical_name $interface;
$hosts = "+${zone}_${physical}"; $hosts = "+${zone}_${physical}";
@@ -1452,6 +1743,10 @@ sub process_host( ) {
$ipsets{"${zone}_${physical}"} = 1; $ipsets{"${zone}_${physical}"} = 1;
} }
#
# We ignore the user's notion of what interface vserver addresses are on and simply invent one for all of the vservers.
#
$interface = '%vserver%' if $type == VSERVER;
add_group_to_zone( $zone, $type , $interface, [ split_list( $hosts, 'host' ) ] , $optionsref); add_group_to_zone( $zone, $type , $interface, [ split_list( $hosts, 'host' ) ] , $optionsref);
@@ -1515,6 +1810,21 @@ sub find_hosts_by_option( $ ) {
\@hosts; \@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() { sub all_ipsets() {
sort keys %ipsets; sort keys %ipsets;
} }

View File

@@ -218,6 +218,7 @@ case "$COMMAND" in
else else
error_message "$g_product is not running" error_message "$g_product is not running"
progress_message3 "Starting $g_product...." progress_message3 "Starting $g_product...."
COMMAND=start
fi fi
detect_configuration detect_configuration
@@ -256,7 +257,6 @@ case "$COMMAND" in
clear_firewall clear_firewall
status=0 status=0
if [ -n "$SUBSYSLOCK" ]; then if [ -n "$SUBSYSLOCK" ]; then
rm -f ${SUBSYSLOCK}-prenet
rm -f $SUBSYSLOCK rm -f $SUBSYSLOCK
fi fi
progress_message3 "done." progress_message3 "done."

View File

@@ -219,6 +219,7 @@ else
else else
error_message "$g_product is not running" error_message "$g_product is not running"
progress_message3 "Starting $g_product...." progress_message3 "Starting $g_product...."
COMMAND=start
fi fi
detect_configuration detect_configuration
@@ -257,7 +258,6 @@ else
clear_firewall clear_firewall
status=0 status=0
if [ -n "$SUBSYSLOCK" ]; then if [ -n "$SUBSYSLOCK" ]; then
rm -f ${SUBSYSLOCK}-prenet
rm -f $SUBSYSLOCK rm -f $SUBSYSLOCK
fi fi
progress_message3 "done." progress_message3 "done."

View File

@@ -89,35 +89,17 @@ setpolicy() # $1 = name of chain, $2 = policy
} }
# #
# Set a standard chain to enable established and related connections # Generate a list of all network interfaces on the system
# #
setcontinue() # $1 = name of chain find_all_interfaces() {
{ ${IP:-ip} link list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed -r 's/(@.*)?:$//'
run_iptables -A $1 -m state --state ESTABLISHED,RELATED -j ACCEPT
} }
# #
# Flush one of the NAT table chains # Generate a list of all network interfaces on the system that have an ipv4 address
# #
flushnat() # $1 = name of chain find_all_interfaces1() {
{ ${IP:-ip} -4 addr list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed -r 's/(@.*)?:$//'
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
} }
# #
@@ -526,11 +508,12 @@ undo_routing() {
# Restore the default route that was in place before the initial 'shorewall start' # Restore the default route that was in place before the initial 'shorewall start'
# #
restore_default_route() { restore_default_route() {
local result
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
local default_route local default_route
default_route= default_route=
local route local route
local result
result=1 result=1
while read route ; do while read route ; do
@@ -615,9 +598,9 @@ delete_proxyarp() {
f=/proc/sys/net/ipv4/conf/$interface/proxy_arp f=/proc/sys/net/ipv4/conf/$interface/proxy_arp
[ -f $f ] && echo 0 > $f [ -f $f ] && echo 0 > $f
done < ${VARDIR}/proxyarp done < ${VARDIR}/proxyarp
fi
rm -f ${VARDIR}/proxyarp rm -f ${VARDIR}/proxyarp
fi
} }
# #
@@ -631,6 +614,7 @@ clear_firewall() {
setpolicy OUTPUT ACCEPT setpolicy OUTPUT ACCEPT
run_iptables -F run_iptables -F
qt $IPTABLES -t raw -F
echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/ip_forward
@@ -690,7 +674,7 @@ startup_error() # $* = Error Message
;; ;;
esac esac
if [ $LOG_VERBOSITY -gt 1 ]; then if [ $LOG_VERBOSITY -ge 0 ]; then
timestamp="$(date +'%_b %d %T') " timestamp="$(date +'%_b %d %T') "
case $COMMAND in case $COMMAND in
@@ -767,34 +751,6 @@ run_tc() {
fi fi
} }
#
# Restore the rules generated by 'drop','reject','logdrop', etc.
#
restore_dynamic_rules() {
if [ -f ${VARDIR}/save ]; then
progress_message2 "Setting up dynamic rules..."
rangematch='source IP range'
while read target ignore1 ignore2 address ignore3 rest; do
case $target in
DROP|reject|logdrop|logreject)
case $rest in
$rangematch*)
run_iptables -A dynamic -m iprange --src-range ${rest#source IP range} -j $target
;;
*)
if [ -z "$rest" ]; then
run_iptables -A dynamic -s $address -j $target
else
error_message "WARNING: Unable to restore dynamic rule \"$target $ignore1 $ignore2 $address $ignore3 $rest\""
fi
;;
esac
;;
esac
done < ${VARDIR}/save
fi
}
# #
# Get a list of all configured broadcast addresses on the system # Get a list of all configured broadcast addresses on the system
# #

View File

@@ -89,27 +89,17 @@ setpolicy() # $1 = name of chain, $2 = policy
} }
# #
# Set a standard chain to enable established and related connections # Generate a list of all network interfaces on the system
# #
setcontinue() # $1 = name of chain find_all_interfaces() {
{ ${IP:-ip} link list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed -r 's/(@.*)?:$//'
run_iptables -A $1 -m state --state ESTABLISHED,RELATED -j ACCEPT
} }
# #
# Flush one of the Mangle table chains # Generate a list of all network interfaces on the system that have an ipv6 address
# #
flushmangle() # $1 = name of chain find_all_interfaces1() {
{ ${IP:-ip} -6 addr list | egrep '^[[:digit:]]+:' | cut -d ' ' -f2 | sed -r 's/(@.*)?:$//'
run_iptables -t mangle -F $1
}
#
# Flush and delete all user-defined chains in the filter table
#
deleteallchains() {
run_iptables -F
run_iptables -X
} }
# #
@@ -506,11 +496,12 @@ undo_routing() {
# Restore the default route that was in place before the initial 'shorewall start' # Restore the default route that was in place before the initial 'shorewall start'
# #
restore_default_route() { restore_default_route() {
local result
if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then if [ -z "$g_noroutes" -a -f ${VARDIR}/default_route ]; then
local default_route local default_route
default_route= default_route=
local route local route
local result
result=1 result=1
while read route ; do while read route ; do
@@ -593,6 +584,7 @@ clear_firewall() {
setpolicy OUTPUT ACCEPT setpolicy OUTPUT ACCEPT
run_iptables -F run_iptables -F
qt $IP6TABLES -t raw -F
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
@@ -721,34 +713,6 @@ run_tc() {
fi fi
} }
#
# Restore the rules generated by 'drop','reject','logdrop', etc.
#
restore_dynamic_rules() {
if [ -f ${VARDIR}/save ]; then
progress_message2 "Setting up dynamic rules..."
rangematch='source IP range'
while read target ignore1 ignore2 address ignore3 rest; do
case $target in
DROP|reject|logdrop|logreject)
case $rest in
$rangematch*)
run_iptables -A dynamic -m iprange --src-range ${rest#source IP range} -j $target
;;
*)
if [ -z "$rest" ]; then
run_iptables -A dynamic -s $address -j $target
else
error_message "WARNING: Unable to restore dynamic rule \"$target $ignore1 $ignore2 $address $ignore3 $rest\""
fi
;;
esac
;;
esac
done < ${VARDIR}/save
fi
}
# #
# Run the .iptables_restore_input as a set of discrete iptables commands # Run the .iptables_restore_input as a set of discrete iptables commands
# #

View File

@@ -1,3 +1,102 @@
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) Add ADD/DEL support.
4) Allow :random to work with REDIRECT
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
1) Apply patch from Gabriel.
2) Fix IPSET match detection when a pathname is specified for IPSET.
3) Fix start priority of shorewall-init on Debian
4) Make IPv6 log and connections output readable.
5) Add REQUIRE_INTERFACE to shorewall*.conf
6) Avoid run-time warnings when options are not listed in
shorewall.conf.
7) Implement Vserver zones.
8) Make find_hosts_by_option() work correctly where ALL_IP appears in
hosts file.
9) Add CLEAR_FORWARD_MARK option.
10) Avoid missing closing quote when REQUIRE_INTERFACE=Yes.
11) Add PERL option.
12) Fix nets= in Shorewall6
Changes in Shorewall 4.4.10 Changes in Shorewall 4.4.10
1) Fix regression with scripts. 1) Fix regression with scripts.
@@ -14,6 +113,8 @@ Changes in Shorewall 4.4.10
7) Rename PREFIX to DESTDIR in install scripts 7) Rename PREFIX to DESTDIR in install scripts
8) Correct handling of optional/required interfaces with wildcard names.
Changes in Shorewall 4.4.9 Changes in Shorewall 4.4.9
1) Auto-detection of bridges. 1) Auto-detection of bridges.

View File

@@ -6,6 +6,6 @@
# Please see http://shorewall.net/Accounting.html for examples and # Please see http://shorewall.net/Accounting.html for examples and
# additional information about how to use this file. # 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 # PORT(S) PORT(S) GROUP

View File

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

View File

@@ -7,5 +7,5 @@
# http://www.shorewall.net/manpages/shorewall-masq.html # 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 # GROUP

View File

@@ -7,4 +7,4 @@
# information. # information.
# #
############################################################################### ###############################################################################
#TYPE NET1 INTERFACE NET2 #TYPE NET1 INTERFACE NET2 NET3

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 LOGTAGONLY=No
LOGRATE= LOGLIMIT=
LOGBURST=
LOGALLNEW= LOGALLNEW=
@@ -59,6 +57,8 @@ TC=
IPSET= IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh SHOREWALL_SHELL=/bin/sh
@@ -194,6 +194,12 @@ OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=No LOAD_HELPERS_ONLY=No
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 # 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 #INTERFACE TYPE IN-BANDWIDTH

View File

@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status 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" echo "TC Filters file installed as ${DESTDIR}/etc/shorewall/tcfilters"
fi 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 # Install the default config path file
# #
@@ -745,7 +755,7 @@ fi
# #
# Install the Makefiles # 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 if [ -z "$SPARSE" ]; then
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}/etc/shorewall run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}/etc/shorewall
@@ -867,7 +877,13 @@ fi
if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then
if [ -n "$DEBIAN" ]; then if [ -n "$DEBIAN" ]; then
install_file default.debian /etc/default/shorewall 0644 install_file default.debian /etc/default/shorewall 0644
ln -s ../init.d/shorewall /etc/rcS.d/S40shorewall
if [ -x /sbin/insserv ]; then
insserv /etc/init.d/shorewall
else
ln -s ../init.d/shorewall /etc/rcS.d/S40shorewall
fi
echo "shorewall will start automatically at boot" echo "shorewall will start automatically at boot"
echo "Set startup=1 in /etc/default/shorewall to enable" echo "Set startup=1 in /etc/default/shorewall to enable"
touch /var/log/shorewall-init.log touch /var/log/shorewall-init.log

View File

@@ -1 +1,2 @@
There are no known problems in Shorewall 4.4.9 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_LIBVERSION=40407
SHOREWALL_CAPVERSION=40408 SHOREWALL_CAPVERSION=40413
[ -n "${VARDIR:=/var/lib/shorewall}" ] [ -n "${VARDIR:=/var/lib/shorewall}" ]
[ -n "${SHAREDIR:=/usr/share/shorewall}" ] [ -n "${SHAREDIR:=/usr/share/shorewall}" ]

View File

@@ -226,6 +226,18 @@ show_classifiers() {
logwatch() # $1 = timeout -- if negative, prompt each time that logwatch() # $1 = timeout -- if negative, prompt each time that
# an 'interesting' packet count changes # 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/\..*$//') host=$(echo $g_hostname | sed 's/\..*$//')
oldrejects=$($IPTABLES -L -v -n | grep 'LOG') oldrejects=$($IPTABLES -L -v -n | grep 'LOG')
@@ -362,17 +374,7 @@ save_config() {
;; ;;
*) *)
validate_restorefile RESTOREFILE validate_restorefile RESTOREFILE
do_save && rm -f ${VARDIR}/save
if chain_exists dynamic; then
if $IPTABLES -L dynamic -n > ${VARDIR}/save; then
echo " Dynamic Rules Saved"
do_save
else
echo "Error Saving the Dynamic Rules" >&2
fi
else
do_save && rm -f ${VARDIR}/save
fi
;; ;;
esac esac
fi fi
@@ -551,6 +553,20 @@ show_command() {
;; ;;
log) log)
[ $# -gt 2 ] && usage 1 [ $# -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 "$g_product $SHOREWALL_VERSION Log ($LOGFILE) at $g_hostname - $(date)"
echo echo
show_reset show_reset
@@ -791,6 +807,19 @@ dump_command() {
esac esac
done 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" g_ipt_options="$g_ipt_options $g_ipt_options1"
[ $VERBOSITY -lt 2 ] && VERBOSITY=2 [ $VERBOSITY -lt 2 ] && VERBOSITY=2
@@ -1037,6 +1066,10 @@ block() # $1 = command, $2 = Finished, $3 - $n addresses
chain=$1 chain=$1
local finished local finished
finished=$2 finished=$2
local which
which='-s'
local range
range='--src-range'
if ! chain_exists dynamic; then if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2 echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
@@ -1048,19 +1081,31 @@ block() # $1 = command, $2 = Finished, $3 - $n addresses
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case $1 in 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 $range $1 -j reject
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j DROP qt $IPTABLES -D dynamic -m iprange $range $1 -j DROP
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j logreject qt $IPTABLES -D dynamic -m iprange $range $1 -j logreject
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j logdrop qt $IPTABLES -D dynamic -m iprange $range $1 -j logdrop
$IPTABLES -A dynamic -m iprange --src-range $1 -j $chain || break 1 $IPTABLES -A dynamic -m iprange $range $1 -j $chain || break 1
;; ;;
*) *)
qt $IPTABLES -D dynamic -s $1 -j reject qt $IPTABLES -D dynamic $which $1 -j reject
qt $IPTABLES -D dynamic -s $1 -j DROP qt $IPTABLES -D dynamic $which $1 -j DROP
qt $IPTABLES -D dynamic -s $1 -j logreject qt $IPTABLES -D dynamic $which $1 -j logreject
qt $IPTABLES -D dynamic -s $1 -j logdrop qt $IPTABLES -D dynamic $which $1 -j logdrop
$IPTABLES -A dynamic -s $1 -j $chain || break 1 $IPTABLES -A dynamic $which $1 -j $chain || break 1
;; ;;
esac esac
@@ -1350,6 +1395,11 @@ allow_command() {
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && usage 1 [ $# -eq 1 ] && usage 1
if shorewall_is_started ; then if shorewall_is_started ; then
local which
which='-s'
local range
range='--src-range'
if ! chain_exists dynamic; then if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2 echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
exit 2 exit 2
@@ -1359,11 +1409,21 @@ allow_command() {
while [ $# -gt 1 ]; do while [ $# -gt 1 ]; do
shift shift
case $1 in 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 ||\ if qt $IPTABLES -D dynamic -m iprange $range $1 -j reject ||\
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j DROP ||\ qt $IPTABLES -D dynamic -m iprange $range $1 -j DROP ||\
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j logdrop ||\ qt $IPTABLES -D dynamic -m iprange $range $1 -j logdrop ||\
qt $IPTABLES -D dynamic -m iprange --src-range $1 -j logreject qt $IPTABLES -D dynamic -m iprange $range $1 -j logreject
then then
echo "$1 Allowed" echo "$1 Allowed"
else else
@@ -1371,10 +1431,10 @@ allow_command() {
fi fi
;; ;;
*) *)
if qt $IPTABLES -D dynamic -s $1 -j reject ||\ if qt $IPTABLES -D dynamic $which $1 -j reject ||\
qt $IPTABLES -D dynamic -s $1 -j DROP ||\ qt $IPTABLES -D dynamic $which $1 -j DROP ||\
qt $IPTABLES -D dynamic -s $1 -j logdrop ||\ qt $IPTABLES -D dynamic $which $1 -j logdrop ||\
qt $IPTABLES -D dynamic -s $1 -j logreject qt $IPTABLES -D dynamic $which $1 -j logreject
then then
echo "$1 Allowed" echo "$1 Allowed"
else else
@@ -1459,6 +1519,10 @@ determine_capabilities() {
exit 1 exit 1
fi fi
[ "$IP" = ip -o -z "$IP" ] && IP=$(which ip)
[ -n "$IP" -a -x "$IP" ] || IP=
[ "$TC" = tc -o -z "$TC" ] && TC=$(which tc) [ "$TC" = tc -o -z "$TC" ] && TC=$(which tc)
[ -n "$TC" -a -x "$TC" ] || TC= [ -n "$TC" -a -x "$TC" ] || TC=
@@ -1478,6 +1542,7 @@ determine_capabilities() {
RECENT_MATCH= RECENT_MATCH=
OWNER_MATCH= OWNER_MATCH=
IPSET_MATCH= IPSET_MATCH=
OLD_IPSET_MATCH=
CONNMARK= CONNMARK=
XCONNMARK= XCONNMARK=
CONNMARK_MATCH= CONNMARK_MATCH=
@@ -1510,6 +1575,8 @@ determine_capabilities() {
LOG_TARGET=Yes LOG_TARGET=Yes
PERSISTENT_SNAT= PERSISTENT_SNAT=
FLOW_FILTER= FLOW_FILTER=
FWMARK_RT_MASK=
MARK_ANYWHERE=
chain=fooX$$ chain=fooX$$
@@ -1619,9 +1686,13 @@ determine_capabilities() {
qt ipset -X $chain # Just in case something went wrong the last time qt ipset -X $chain # Just in case something went wrong the last time
if qt ipset -N $chain iphash ; then 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 qt $IPTABLES -D $chain -m set --set $chain src -j ACCEPT
IPSET_MATCH=Yes IPSET_MATCH=Yes
OLD_IPSET_MATCH=Yes
fi fi
qt ipset -X $chain qt ipset -X $chain
fi fi
@@ -1643,6 +1714,7 @@ determine_capabilities() {
qt $IPTABLES -A $chain -g $chain1 && GOTO_TARGET=Yes qt $IPTABLES -A $chain -g $chain1 && GOTO_TARGET=Yes
qt $IPTABLES -A $chain -j LOGMARK && LOGMARK_TARGET=Yes qt $IPTABLES -A $chain -j LOGMARK && LOGMARK_TARGET=Yes
qt $IPTABLES -A $chain -j LOG || LOG_TARGET= 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 -F $chain
qt $IPTABLES -X $chain qt $IPTABLES -X $chain
@@ -1650,6 +1722,7 @@ determine_capabilities() {
qt $IPTABLES -X $chain1 qt $IPTABLES -X $chain1
[ -n "$TC" ] && $TC filter add flow help 2>&1 | grep -q ^Usage && FLOW_FILTER=Yes [ -n "$TC" ] && $TC filter add flow help 2>&1 | grep -q ^Usage && FLOW_FILTER=Yes
[ -n "$IP" ] && $IP rule add help 2>&1 | grep -q /MASK && FWMARK_RT_MASK=Yes
CAPVERSION=$SHOREWALL_CAPVERSION CAPVERSION=$SHOREWALL_CAPVERSION
KERNELVERSION=$(printf "%d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g')) KERNELVERSION=$(printf "%d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g'))
@@ -1685,7 +1758,10 @@ report_capabilities() {
report_capability "IP range Match" $IPRANGE_MATCH report_capability "IP range Match" $IPRANGE_MATCH
report_capability "Recent Match" $RECENT_MATCH report_capability "Recent Match" $RECENT_MATCH
report_capability "Owner Match" $OWNER_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 report_capability "CONNMARK Target" $CONNMARK
[ -n "$CONNMARK" ] && report_capability "Extended CONNMARK Target" $XCONNMARK [ -n "$CONNMARK" ] && report_capability "Extended CONNMARK Target" $XCONNMARK
report_capability "Connmark Match" $CONNMARK_MATCH report_capability "Connmark Match" $CONNMARK_MATCH
@@ -1717,6 +1793,8 @@ report_capabilities() {
report_capability "Persistent SNAT" $PERSISTENT_SNAT report_capability "Persistent SNAT" $PERSISTENT_SNAT
report_capability "TPROXY Target" $TPROXY_TARGET report_capability "TPROXY Target" $TPROXY_TARGET
report_capability "FLOW Classifier" $FLOW_FILTER report_capability "FLOW Classifier" $FLOW_FILTER
report_capability "fwmark route mask" $FWMARK_RT_MASK
report_capability "Mark in any table" $MARK_ANYWHERE
fi fi
[ -n "$PKTTYPE" ] || USEPKTTYPE= [ -n "$PKTTYPE" ] || USEPKTTYPE=
@@ -1748,6 +1826,7 @@ report_capabilities1() {
report_capability1 RECENT_MATCH report_capability1 RECENT_MATCH
report_capability1 OWNER_MATCH report_capability1 OWNER_MATCH
report_capability1 IPSET_MATCH report_capability1 IPSET_MATCH
report_capability1 OLD_IPSET_MATCH
report_capability1 CONNMARK report_capability1 CONNMARK
report_capability1 XCONNMARK report_capability1 XCONNMARK
report_capability1 CONNMARK_MATCH report_capability1 CONNMARK_MATCH
@@ -1779,6 +1858,8 @@ report_capabilities1() {
report_capability1 PERSISTENT_SNAT report_capability1 PERSISTENT_SNAT
report_capability1 TPROXY_TARGET report_capability1 TPROXY_TARGET
report_capability1 FLOW_FILTER report_capability1 FLOW_FILTER
report_capability1 FWMARK_RT_MASK
report_capability1 MARK_ANYWHERE
echo CAPVERSION=$SHOREWALL_CAPVERSION echo CAPVERSION=$SHOREWALL_CAPVERSION
echo KERNELVERSION=$KERNELVERSION echo KERNELVERSION=$KERNELVERSION

View File

@@ -94,7 +94,12 @@ run_it() {
# #
# 4.4.8 or later -- no additional exports required # 4.4.8 or later -- no additional exports required
# #
options='-' if [ x$1 = xtrace -o x$1 = xdebug ]; then
options="$1 -"
shift;
else
options='-'
fi
[ -n "$g_noroutes" ] && options=${options}n [ -n "$g_noroutes" ] && options=${options}n
[ -n "$g_timestamp" ] && options=${options}t [ -n "$g_timestamp" ] && options=${options}t
@@ -509,9 +514,13 @@ find_file()
# #
# Set the Shorewall state # 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,17 +1,266 @@
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
S H O R E W A L L 4 . 4 . 10 S H O R E W A L L 4 . 4 . 1 3
R C 1
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
I. RELEASE 4.4 HIGHLIGHTS I. PROBLEMS CORRECTED IN THIS RELEASE
II. MIGRATION ISSUES II. KNOWN PROBLEMS REMAINING
III. PROBLEMS CORRECTED IN THIS RELEASE III. NEW FEATURES IN THIS RELEASE
IV. KNOWN PROBLEMS REMAINING IV. RELEASE 4.4 HIGHLIGHTS
V. NEW FEATURES IN THIS RELEASE V. MIGRATION ISSUES
VI. PROBLEMS CORRECTED AND NEW FEATURES IN PRIOR RELEASES 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 1) Support for Shorewall-shell has been discontinued. Shorewall-perl
@@ -68,8 +317,14 @@ VI. PROBLEMS CORRECTED AND NEW FEATURES IN PRIOR RELEASES
15) TPROXY support has been added. 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: 1) If you are currently using Shorewall-shell:
@@ -215,10 +470,258 @@ VI. PROBLEMS CORRECTED AND NEW FEATURES IN PRIOR RELEASES
where 'iface' is a capitalized interface name (e.g., ETH0) and where 'iface' is a capitalized interface name (e.g., ETH0) and
'provider' is the capitalized name of a provider. '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
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
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 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) 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.
2) If IPSET=<pathname> was specified in shorewall.conf, then when an
ipset was used in a configuration file entry, the following
fatal compilation error occurred:
ERROR: ipset names in Shorewall configuration files require Ipset
Match in your kernel and iptables : /etc/shorewall/rules (line nn)
If you applied the workaround given in the "Known Problems", then
you should remove /etc/shorewall/capabilities after installing
this fix.
3) The start priority of shorewall-init on Debian and Debian-based
distributions was previously too low, making it start too late.
4) The log output from IPv6 logs was almost unreadable due to display
of IPv6 addresses in uncompressed format. A similar problem
occurred with 'shorewall6 show connections'. This update makes the
displays much clearer at the expense of opening the slight
possibility of two '::' sequences being incorrectly shown in the
same address.
5) The new REQUIRE_INTERFACE was inadvertently omitted from
shorewall.conf and shorewall6.conf. It has been added.
6) Under some versions of Perl, a Perl run-time diagnostic was produced
when options were omitted from shorewall.conf or shorewall6.conf.
7) If the following options were specified in /etc/shorewall/interfaces
for an interface with '-' in the ZONE column, then these options
would be ignored if there was an entry in the hosts file for the
interface with an explicit or implicit 0.0.0.0/0 (0.0.0.0/0 is
implied when the host list begins with '!').
blacklist
maclist
nosmurfs
tcpflags
Note: for IPv6, the network is ::/0 rather than 0.0.0.0/0.
8) The generated script was missing a closing quote when
REQUIRE_INTERFACE=Yes.
9) Previously, if nets= was specified under Shorewall6, this error
would result:
ERROR: Invalid IPv6 address (224.0.0.0) :
/etc/shorewall6/interfaces (line 16)
----------------------------------------------------------------------------
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'
zone type. This zone type is used with Shorewall running on a
Linux-vserver host system and allows you to define zones that
represent a set of Linux-vserver hosts.
See http://www.shorewall.net/Vserver.html for details.
2) A new FORWARD_CLEAR_MARK option has been added to shorewall.conf
and shorewall6.conf.
Traditionally, Shorewall has cleared the packet mark in the first
rule in the mangle FORWARD chain. This behavior is maintained with
the default setting (FORWARD_CLEAR_MARK=Yes). If the new option is
set to No, packet marks set in the PREROUTING chain are retained in
the FORWARD chains.
As part of this change, a new "fwmark route mask" capability has
been added. If your version of iproute2 supports this capability,
fwmark routing rules may specify a mask to be applied to the mark
prior to comparison with the mark value in the rule. The presence
of this capability allows Shorewall to relax the restriction that
small mark values may not be set in the PREROUTING chain when
HIGH_ROUTE_MARKS is in effect. If you take advantage of this
capability, be sure that you logically OR mark values in PREROUTING
makring rules rather then simply setting them unless you are able
to set both the high and low bits in the mark in a single rule.
As always when a new capability has been introduced, be sure to
regenerate your capabilities file(s) after installing this release.
3) A new column (NET3) has been added to the /etc/shorewall/netmap
file. This new column can qualify the INTERFACE column by
specifying a SOURCE network (DNAT rule) or DEST network (SNAT rule)
associated with the interface.
4) To accomodate systems with more than one version of Perl installed,
the shorewall.conf and shorewall6.conf files now support a PERL
option. If the program specified by that option does not exist or
is not executable, Shorewall (and Shorewall6) fall back to
/usr/bin/perl.
----------------------------------------------------------------------------
P R O B L E M S C O R R E C T E D I N 4 . 4 . 1 0
----------------------------------------------------------------------------
1) Startup Errors (those that are detected before the state of the 1) Startup Errors (those that are detected before the state of the
system has been altered), were previously not sent to the system has been altered), were previously not sent to the
STARTUP_LOG. STARTUP_LOG.
@@ -244,14 +747,28 @@ 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
`sys2sys':/usr/local/libexec/xtables/libipt_sys2sys.so: `sys2sys':/usr/local/libexec/xtables/libipt_sys2sys.so:
cannot open shared object file: No such file or directory cannot open shared object file: No such file or directory
---------------------------------------------------------------------------- 4) Previously, if the 'optional' option was given to an interface with
I V. K N O W N P R O B L E M S R E M A I N I N G a wildcard physical name, specific instances of the interface were
---------------------------------------------------------------------------- never considered usable.
None. Example:
/etc/shorewall/interfaces:
#ZONE INTERFACE BROADCAST OPTIONS
net ppp+ - optional
/etc/shorewall/providers:
#PROVIDER NUMBER MARK DUPLICATE INTERFACE ...
XYZTEL 1 - main ppp0
The XYZTEL provider was never usable.
This configuration now works correctly.
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
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 0
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
1) Shorewall 4.4.10 includes a new 'Shorewall Init' package. This new 1) Shorewall 4.4.10 includes a new 'Shorewall Init' package. This new
@@ -314,7 +831,11 @@ None.
b) In your Shorewall interfaces file(s), set the 'required' option b) In your Shorewall interfaces file(s), set the 'required' option
on any interfaces that must be up in order for the firewall to on any interfaces that must be up in order for the firewall to
start. At least one interface must have the 'required' or start. At least one interface must have the 'required' or
'optional' option if you perform the next optional step. 'optional' option if you perform the next optional step. If
'required' is specified on an interface with a wildcard name
(the physical name ends with '+'), then at least one interface
that matches the name must be in a usable state for the
firewall to start successfully.
c) (Optional) -- If you have specified at least one 'required' c) (Optional) -- If you have specified at least one 'required'
or 'optional interface, you can then disable automatic firewall or 'optional interface, you can then disable automatic firewall
@@ -387,9 +908,6 @@ None.
shorewall-init: 4.4.10-RC1 shorewall-init: 4.4.10-RC1
gateway:~# gateway:~#
----------------------------------------------------------------------------
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 . 9 P R O B L E M S C O R R E C T E D I N 4 . 4 . 9
---------------------------------------------------------------------------- ----------------------------------------------------------------------------

View File

@@ -67,15 +67,15 @@ get_config() {
# This block is avoided for compile for export and when the user isn't root # This block is avoided for compile for export and when the user isn't root
# #
if [ "$3" = Yes ]; then if [ "$3" = Yes ]; then
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages if [ -n "$LOGFILE" ]; then
if [ -n "$(syslog_circular_buffer)" ]; then
if [ -n "$(syslog_circular_buffer)" ]; then g_logread="logread | tac"
g_logread="logread | tac" elif [ -r $LOGFILE ]; then
elif [ -r $LOGFILE ]; then g_logread="tac $LOGFILE"
g_logread="tac $LOGFILE" else
else echo "LOGFILE ($LOGFILE) does not exist!" >&2
echo "LOGFILE ($LOGFILE) does not exist!" >&2 exit 2
exit 2 fi
fi fi
fi fi
@@ -360,7 +360,16 @@ compiler() {
run_user_exit params run_user_exit params
set +a set +a
perl $debugflags /usr/share/shorewall/compiler.pl $options $@ if [ -n "$PERL" ]; then
if [ ! -x "$PERL" ]; then
echo " WARNING: The program specified in the PERL option does not exist or is not executable; falling back to /usr/bin/perl" >&2
PERL=/usr/bin/perl
fi
else
PERL=/usr/bin/perl
fi
$PERL $debugflags /usr/share/shorewall/compiler.pl $options $@
} }
# #
@@ -477,7 +486,7 @@ start_command() {
export RESTOREFILE export RESTOREFILE
if make -qf ${CONFDIR}/Makefile; then if ! make -qf ${CONFDIR}/Makefile; then
g_fast= g_fast=
AUTOMAKE= AUTOMAKE=
fi fi
@@ -1622,17 +1631,17 @@ case "$COMMAND" in
get_config get_config
[ $# -ne 1 ] && usage 1 [ $# -ne 1 ] && usage 1
[ -x $g_firewall ] || fatal_error "Shorewall has never been started" [ -x $g_firewall ] || fatal_error "Shorewall has never been started"
mutex_on [ -n "$nolock" ] || mutex_on
run_it $g_firewall $g_debugging $nolock $COMMAND run_it $g_firewall $g_debugging $COMMAND
mutex_off [ -n "$nolock" ] || mutex_off
;; ;;
reset) reset)
get_config get_config
shift shift
mutex_on [ -n "$nolock" ] || mutex_on
[ -x $g_firewall ] || fatal_error "Shorewall has never been started" [ -x $g_firewall ] || fatal_error "Shorewall has never been started"
run_it $g_firewall $g_debugging $nolock reset $@ run_it $g_firewall $g_debugging reset $@
mutex_off [ -n "$nolock" ] || mutex_off
;; ;;
compile) compile)
get_config Yes get_config Yes
@@ -1829,6 +1838,7 @@ case "$COMMAND" in
if [ -x $g_restorepath ]; then if [ -x $g_restorepath ]; then
rm -f $g_restorepath rm -f $g_restorepath
rm -f ${g_restorepath}-iptables rm -f ${g_restorepath}-iptables
rm -f ${g_restorepath}-ipsets
echo " $g_restorepath removed" echo " $g_restorepath removed"
elif [ -f $g_restorepath ]; then elif [ -f $g_restorepath ]; then
echo " $g_restorepath exists and is not a saved Shorewall configuration" echo " $g_restorepath exists and is not a saved Shorewall configuration"

View File

@@ -1,6 +1,6 @@
%define name shorewall %define name shorewall
%define version 4.4.10 %define version 4.4.13
%define release 0RC1 %define release 0base
Summary: Shoreline Firewall is an iptables-based firewall for Linux systems. Summary: Shoreline Firewall is an iptables-based firewall for Linux systems.
Name: %{name} Name: %{name}
@@ -108,6 +108,48 @@ fi
%doc COPYING INSTALL changelog.txt releasenotes.txt Contrib/* Samples %doc COPYING INSTALL changelog.txt releasenotes.txt Contrib/* Samples
%changelog %changelog
* 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
- Updated to 4.4.11-0RC1
* Sat Jul 03 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta3
* Thu Jul 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta2
* Sun Jun 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta1
* Sat Jun 05 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net * Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1 - Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net * Wed May 26 2010 Tom Eastep tom@shorewall.net

View File

@@ -26,7 +26,7 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status usage() # $1 = exit status
{ {

View File

@@ -22,7 +22,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status usage() # $1 = exit status
{ {
@@ -350,7 +350,13 @@ if [ -z "$DESTDIR" ]; then
if [ -n "$first_install" ]; then if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall6-lite run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall6-lite
ln -s ../init.d/shorewall6-lite /etc/rcS.d/S40shorewall6-lite
if [ -x /sbin/insserv ]; then
insserv /etc/init.d/shorewall6-lite
else
ln -s ../init.d/shorewall6-lite /etc/rcS.d/S40shorewall6-lite
fi
echo "Shorewall6 Lite will start automatically at boot" echo "Shorewall6 Lite will start automatically at boot"
else else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then

View File

@@ -58,7 +58,7 @@ g_product="Shorewall Lite"
SHOREWALL_VERSION=$(cat /usr/share/shorewall6-lite/version) SHOREWALL_VERSION=$(cat /usr/share/shorewall6-lite/version)
[ -n "$IP6TABLES" ] || IP6TABLES=$(mywhich iptables) [ -n "$IP6TABLES" ] || IP6TABLES=$(mywhich ip6tables)
VERBOSITY=0 VERBOSITY=0
load_kernel_modules No load_kernel_modules No

View File

@@ -615,7 +615,9 @@ case "$COMMAND" in
stop|reset|clear) stop|reset|clear)
[ $# -ne 1 ] && usage 1 [ $# -ne 1 ] && usage 1
verify_firewall_script verify_firewall_script
run_it $g_firewall $debugging $nolock $COMMAND [ -n "$nolock" ] || mutex_on
run_it $g_firewall $debugging $COMMAND
[ -n "$nolock" ] || mutex_off
;; ;;
restart) restart)
shift shift

View File

@@ -1,6 +1,6 @@
%define name shorewall6-lite %define name shorewall6-lite
%define version 4.4.10 %define version 4.4.13
%define release 0RC1 %define release 0base
Summary: Shoreline Firewall 6 Lite is an ip6tables-based firewall for Linux systems. Summary: Shoreline Firewall 6 Lite is an ip6tables-based firewall for Linux systems.
Name: %{name} Name: %{name}
@@ -93,6 +93,48 @@ fi
%doc COPYING changelog.txt releasenotes.txt %doc COPYING changelog.txt releasenotes.txt
%changelog %changelog
* 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
- Updated to 4.4.11-0RC1
* Sat Jul 03 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta3
* Thu Jul 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta2
* Sun Jun 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta1
* Sat Jun 05 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net * Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1 - Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net * Wed May 26 2010 Tom Eastep tom@shorewall.net

View File

@@ -26,7 +26,7 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status usage() # $1 = exit status
{ {

View File

@@ -28,6 +28,11 @@ Auth(REJECT)
# #
AllowICMPs - - ipv6-icmp AllowICMPs - - ipv6-icmp
# #
# Drop Broadcasts so they don't clutter up the log
# (broadcasts must *not* be rejected).
#
dropBcast
#
# Drop packets that are in the INVALID state -- these are usually ICMP packets # Drop packets that are in the INVALID state -- these are usually ICMP packets
# and just confuse people when they appear in the log. # and just confuse people when they appear in the log.
# #

View File

@@ -20,10 +20,16 @@
# #
Auth(REJECT) Auth(REJECT)
# #
# ACCEPT critical ICMP types # Drop Multicasts so they don't clutter up the log
# (broadcasts must *not* be rejected).
# #
AllowICMPs - - ipv6-icmp AllowICMPs - - ipv6-icmp
# #
# Drop Broadcasts so they don't clutter up the log
# (broadcasts must *not* be rejected).
#
dropBcast
#
# Drop packets that are in the INVALID state -- these are usually ICMP packets # Drop packets that are in the INVALID state -- these are usually ICMP packets
# and just confuse people when they appear in the log (these ICMPs cannot be # and just confuse people when they appear in the log (these ICMPs cannot be
# rejected). # rejected).

View File

@@ -7,4 +7,4 @@
# information. # 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. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status 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.tc
delete_file ${DESTDIR}/usr/share/shorewall6/lib.tcrules delete_file ${DESTDIR}/usr/share/shorewall6/lib.tcrules
delete_file ${DESTDIR}/usr/share/shorewall6/lib.tunnels delete_file ${DESTDIR}/usr/share/shorewall6/lib.tunnels
delete_file ${DESTDIR}/usr/share/shorewall6/prog.header delete_file ${DESTDIR}/usr/share/shorewall6/prog.header6
delete_file ${DESTDIR}/usr/share/shorewall6/prog.footer delete_file ${DESTDIR}/usr/share/shorewall6/prog.footer6
# #
# Install wait4ifup # 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 run_install $OWNERSHIP -m 0600 notrack ${DESTDIR}/etc/shorewall6/notrack
echo "Notrack file installed as ${DESTDIR}/etc/shorewall6/notrack" echo "Notrack file installed as ${DESTDIR}/etc/shorewall6/notrack"
fi 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 # Install the default config path file
# #
@@ -718,7 +728,13 @@ fi
if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then
if [ -n "$DEBIAN" ]; then if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall6 run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall6
ln -s ../init.d/shorewall6 /etc/rcS.d/S40shorewall6
if [ -x /sbin/insserv ]; then
insserv /etc/init.d/shorewall6
else
ln -s ../init.d/shorewall6 /etc/rcS.d/S40shorewall6
fi
echo "shorewall6 will start automatically at boot" echo "shorewall6 will start automatically at boot"
echo "Set startup=1 in /etc/default/shorewall6 to enable" echo "Set startup=1 in /etc/default/shorewall6 to enable"
touch /var/log/shorewall6-init.log touch /var/log/shorewall6-init.log

View File

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

View File

@@ -134,18 +134,18 @@ syslog_circular_buffer() {
packet_log() # $1 = number of messages packet_log() # $1 = number of messages
{ {
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/ $g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed -r 's/ kernel://; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
else else
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/ $g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed -r 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi fi
} }
search_log() # $1 = IP address to search for search_log() # $1 = IP address to search for
{ {
if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then if [ -n "$g_showmacs" -o $VERBOSITY -gt 2 ]; then
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/ $g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed -r 's/ kernel://; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
else else
$g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/ $g_logread | grep 'IN=.* OUT=.*SRC=.*\..*DST=' | grep "$1" | tac | sed -r 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] //; s/0000:/:/g; s/:::+/::/g; s/:0+/:/g' | sed s/" $host $LOGFORMAT"/" "/
fi fi
} }
@@ -208,6 +208,19 @@ logwatch() # $1 = timeout -- if negative, prompt each time that
# an 'interesting' packet count changes # 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/\..*$//') host=$(echo $g_hostname | sed 's/\..*$//')
oldrejects=$($IP6TABLES -L -v -n | grep 'LOG') oldrejects=$($IP6TABLES -L -v -n | grep 'LOG')
@@ -439,7 +452,7 @@ show_command() {
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max) local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
echo "$g_product $SHOREWALL_VERSION Connections ($count of $max) at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION Connections ($count of $max) at $g_hostname - $(date)"
echo echo
grep '^ipv6' /proc/net/nf_conntrack grep '^ipv6' /proc/net/nf_conntrack | sed -r 's/0000:/:/g; s/:::+/::/g; s/:0+/:/g'
;; ;;
tos|mangle) tos|mangle)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
@@ -457,6 +470,20 @@ show_command() {
;; ;;
log) log)
[ $# -gt 2 ] && usage 1 [ $# -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 "$g_product $SHOREWALL_VERSION Log ($LOGFILE) at $g_hostname - $(date)"
echo echo
show_reset show_reset
@@ -667,6 +694,19 @@ dump_command() {
esac esac
done 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" g_ipt_options="$g_ipt_options $g_ipt_options1"
[ $VERBOSITY -lt 2 ] && VERBOSITY=2 [ $VERBOSITY -lt 2 ] && VERBOSITY=2
@@ -747,7 +787,7 @@ dump_command() {
report_capabilities report_capabilities
echo echo
netstat -tunap netstat -6tunap
if [ -n "$TC_ENABLED" ]; then if [ -n "$TC_ENABLED" ]; then
heading "Traffic Control" heading "Traffic Control"
@@ -918,6 +958,10 @@ block() # $1 = command, $2 = Finished, $3 - $n addresses
chain=$1 chain=$1
local finished local finished
finished=$2 finished=$2
local which
which='-s'
local range
range='--src-range'
if ! chain_exists dynamic; then if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2 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 while [ $# -gt 0 ]; do
case $1 in 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 $range $1 -j reject
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j DROP qt $IP6TABLES -D dynamic -m iprange $range $1 -j DROP
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j logreject qt $IP6TABLES -D dynamic -m iprange $range $1 -j logreject
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j logdrop qt $IP6TABLES -D dynamic -m iprange $range $1 -j logdrop
$IP6TABLES -A dynamic -m iprange --src-range $1 -j $chain || break 1 $IP6TABLES -A dynamic -m iprange $range $1 -j $chain || break 1
;; ;;
*) *)
qt $IP6TABLES -D dynamic -s $1 -j reject qt $IP6TABLES -D dynamic $which $1 -j reject
qt $IP6TABLES -D dynamic -s $1 -j DROP qt $IP6TABLES -D dynamic $which $1 -j DROP
qt $IP6TABLES -D dynamic -s $1 -j logreject qt $IP6TABLES -D dynamic $which $1 -j logreject
qt $IP6TABLES -D dynamic -s $1 -j logdrop qt $IP6TABLES -D dynamic $which $1 -j logdrop
$IP6TABLES -A dynamic -s $1 -j $chain || break 1 $IP6TABLES -A dynamic $which $1 -j $chain || break 1
;; ;;
esac esac
@@ -1046,6 +1102,11 @@ allow_command() {
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && usage 1 [ $# -eq 1 ] && usage 1
if shorewall6_is_started ; then if shorewall6_is_started ; then
local which
which='-s'
local range
range='--src-range'
if ! chain_exists dynamic; then if ! chain_exists dynamic; then
echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2 echo "Dynamic blacklisting is not enabled in the current $g_product configuration" >&2
exit 2 exit 2
@@ -1055,11 +1116,21 @@ allow_command() {
while [ $# -gt 1 ]; do while [ $# -gt 1 ]; do
shift shift
case $1 in 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 ||\ if qt $IP6TABLES -D dynamic -m iprange $range $1 -j reject ||\
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j DROP ||\ qt $IP6TABLES -D dynamic -m iprange $range $1 -j DROP ||\
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j logdrop ||\ qt $IP6TABLES -D dynamic -m iprange $range $1 -j logdrop ||\
qt $IP6TABLES -D dynamic -m iprange --src-range $1 -j logreject qt $IP6TABLES -D dynamic -m iprange $range $1 -j logreject
then then
echo "$1 Allowed" echo "$1 Allowed"
else else
@@ -1067,10 +1138,10 @@ allow_command() {
fi fi
;; ;;
*) *)
if qt $IP6TABLES -D dynamic -s $1 -j reject ||\ if qt $IP6TABLES -D dynamic $which $1 -j reject ||\
qt $IP6TABLES -D dynamic -s $1 -j DROP ||\ qt $IP6TABLES -D dynamic $which $1 -j DROP ||\
qt $IP6TABLES -D dynamic -s $1 -j logdrop ||\ qt $IP6TABLES -D dynamic $which $1 -j logdrop ||\
qt $IP6TABLES -D dynamic -s $1 -j logreject qt $IP6TABLES -D dynamic $which $1 -j logreject
then then
echo "$1 Allowed" echo "$1 Allowed"
else else
@@ -1160,6 +1231,7 @@ determine_capabilities() {
RECENT_MATCH= RECENT_MATCH=
OWNER_MATCH= OWNER_MATCH=
IPSET_MATCH= IPSET_MATCH=
OLD_IPSET_MATCH=
CONNMARK= CONNMARK=
XCONNMARK= XCONNMARK=
CONNMARK_MATCH= CONNMARK_MATCH=
@@ -1190,6 +1262,8 @@ determine_capabilities() {
IPMARK_TARGET= IPMARK_TARGET=
LOG_TARGET=Yes LOG_TARGET=Yes
FLOW_FILTER= FLOW_FILTER=
FWMARK_RT_MASK=
MARK_ANYWHERE=
chain=fooX$$ chain=fooX$$
@@ -1204,6 +1278,10 @@ determine_capabilities() {
[ -n "$IP" -a -x "$IP" ] || IP= [ -n "$IP" -a -x "$IP" ] || IP=
[ "$TC" = tc -o -z "$TC" ] && TC=$(which tc)
[ -n "$TC" -a -x "$TC" ] || TC=
qt $IP6TABLES -t mangle -L -n && MANGLE_ENABLED=Yes || MANGLE_ENABLED= qt $IP6TABLES -t mangle -L -n && MANGLE_ENABLED=Yes || MANGLE_ENABLED=
qt $IP6TABLES -F $chain qt $IP6TABLES -F $chain
@@ -1327,13 +1405,15 @@ determine_capabilities() {
qt $IP6TABLES -A $chain -m time --timestart 23:00 -j DROP && TIME_MATCH=Yes qt $IP6TABLES -A $chain -m time --timestart 23:00 -j DROP && TIME_MATCH=Yes
qt $IP6TABLES -A $chain -g $chain1 && GOTO_TARGET=Yes qt $IP6TABLES -A $chain -g $chain1 && GOTO_TARGET=Yes
qt $IP6TABLES -A $chain -j LOG || LOG_TARGET= 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 -F $chain
qt $IP6TABLES -X $chain qt $IP6TABLES -X $chain
qt $IP6TABLES -F $chain1 qt $IP6TABLES -F $chain1
qt $IP6TABLES -X $chain1 qt $IP6TABLES -X $chain1
[ -n "$IP" ] && $IP filter add flow help 2>&1 | grep -q ^Usage && FLOW_FILTER=Yes [ -n "$TC" ] && $TC filter add flow help 2>&1 | grep -q ^Usage && FLOW_FILTER=Yes
[ -n "$IP" ] && $IP rule add help 2>&1 | grep -q /MASK && FWMARK_RT_MASK=Yes
CAPVERSION=$SHOREWALL_CAPVERSION CAPVERSION=$SHOREWALL_CAPVERSION
KERNELVERSION=$(printf "%d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g')) KERNELVERSION=$(printf "%d%02d%02d" $(uname -r 2> /dev/null | sed -e 's/-.*//' -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g'))
@@ -1368,7 +1448,10 @@ report_capabilities() {
report_capability "IP range Match" $IPRANGE_MATCH report_capability "IP range Match" $IPRANGE_MATCH
report_capability "Recent Match" $RECENT_MATCH report_capability "Recent Match" $RECENT_MATCH
report_capability "Owner Match" $OWNER_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 report_capability "CONNMARK Target" $CONNMARK
[ -n "$CONNMARK" ] && report_capability "Extended CONNMARK Target" $XCONNMARK [ -n "$CONNMARK" ] && report_capability "Extended CONNMARK Target" $XCONNMARK
report_capability "Connmark Match" $CONNMARK_MATCH report_capability "Connmark Match" $CONNMARK_MATCH
@@ -1398,6 +1481,8 @@ report_capabilities() {
report_capability "LOG Target" $LOG_TARGET report_capability "LOG Target" $LOG_TARGET
report_capability "TPROXY Target" $TPROXY_TARGET report_capability "TPROXY Target" $TPROXY_TARGET
report_capability "FLOW Classifier" $FLOW_FILTER report_capability "FLOW Classifier" $FLOW_FILTER
report_capability "fwmark route mask" $FWMARK_RT_MASK
report_capability "Mark in any table" $MARK_ANYWHERE
fi fi
[ -n "$PKTTYPE" ] || USEPKTTYPE= [ -n "$PKTTYPE" ] || USEPKTTYPE=
@@ -1428,6 +1513,7 @@ report_capabilities1() {
report_capability1 RECENT_MATCH report_capability1 RECENT_MATCH
report_capability1 OWNER_MATCH report_capability1 OWNER_MATCH
report_capability1 IPSET_MATCH report_capability1 IPSET_MATCH
report_capability1 OLD_IPSET_MATCH
report_capability1 CONNMARK report_capability1 CONNMARK
report_capability1 XCONNMARK report_capability1 XCONNMARK
report_capability1 CONNMARK_MATCH report_capability1 CONNMARK_MATCH
@@ -1457,6 +1543,8 @@ report_capabilities1() {
report_capability1 LOG_TARGET report_capability1 LOG_TARGET
report_capability1 TPROXY_TARGET report_capability1 TPROXY_TARGET
report_capability1 FLOW_FILTER report_capability1 FLOW_FILTER
report_capability1 FWMARK_RT_MASK
report_capability1 MARK_ANYWHERE
echo CAPVERSION=$SHOREWALL_CAPVERSION echo CAPVERSION=$SHOREWALL_CAPVERSION
echo KERNELVERSION=$KERNELVERSION echo KERNELVERSION=$KERNELVERSION

View File

@@ -92,7 +92,12 @@ run_it() {
# #
# 4.4.8 or later -- no additional exports required # 4.4.8 or later -- no additional exports required
# #
options='-' if [ x$1 = xtrace -o x$1 = xdebug ]; then
options="$1 -"
shift;
else
options='-'
fi
[ -n "$g_noroutes" ] && options=${options}n [ -n "$g_noroutes" ] && options=${options}n
[ -n "$g_timestamp" ] && options=${options}t [ -n "$g_timestamp" ] && options=${options}t
@@ -447,7 +452,11 @@ find_file()
# #
set_state () # $1 = state 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 # This block is avoided for compile for export and when the user isn't root
# #
if [ "$3" = Yes ]; then if [ "$3" = Yes ]; then
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages if [ -n "$LOGFILE" ]; then
if [ -n "$(syslog_circular_buffer)" ]; then
if [ -n "$(syslog_circular_buffer)" ]; then g_logread="logread | tac"
g_logread="logread | tac" elif [ -r $LOGFILE ]; then
elif [ -r $LOGFILE ]; then g_logread="tac $LOGFILE"
g_logread="tac $LOGFILE" else
else echo "LOGFILE ($LOGFILE) does not exist!" >&2
echo "LOGFILE ($LOGFILE) does not exist!" >&2 exit 2
exit 2 fi
fi fi
fi fi
@@ -299,7 +299,16 @@ compiler() {
set +a set +a
fi fi
$command perl $debugflags $pc $options $@ if [ -n "$PERL" ]; then
if [ ! -x "$PERL" ]; then
echo " WARNING: The program specified in the PERL option does not exist or is not executable; falling back to /usr/bin/perl" >&2
PERL=/usr/bin/perl
fi
else
PERL=/usr/bin/perl
fi
$command $PERL $debugflags $pc $options $@
} }
# #
@@ -410,7 +419,7 @@ start_command() {
export RESTOREFILE export RESTOREFILE
if make -qf ${CONFDIR}/Makefile; then if ! make -qf ${CONFDIR}/Makefile; then
g_fast= g_fast=
AUTOMAKE= AUTOMAKE=
fi fi
@@ -1535,17 +1544,17 @@ case "$COMMAND" in
[ $# -ne 1 ] && usage 1 [ $# -ne 1 ] && usage 1
get_config get_config
[ -x $g_firewall ] || fatal_error "Shorewall6 has never been started" [ -x $g_firewall ] || fatal_error "Shorewall6 has never been started"
mutex_on [ -n "$nolock" ] || mutex_on
run_it $g_firewall $g_debugging $nolock $COMMAND run_it $g_firewall $g_debugging $COMMAND
mutex_off [ -n "$nolock" ] || mutex_off
;; ;;
reset) reset)
get_config get_config
shift shift
mutex_on [ -n "$nolock" ] || mutex_on
[ -x $g_firewall ] || fatal_error "Shorewall6 has never been started" [ -x $g_firewall ] || fatal_error "Shorewall6 has never been started"
run_it $g_firewall $g_debugging $nolock reset $@ run_it $g_firewall $g_debugging reset $@
mutex_off [ -n "$nolock" ] || mutex_off
;; ;;
compile) compile)
get_config Yes get_config Yes

View File

@@ -32,9 +32,7 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No LOGTAGONLY=No
LOGRATE= LOGLIMIT=
LOGBURST=
LOGALLNEW= LOGALLNEW=
@@ -56,6 +54,8 @@ TC=
IPSET= IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh SHOREWALL_SHELL=/bin/sh
@@ -151,6 +151,12 @@ DYNAMIC_BLACKLIST=Yes
LOAD_HELPERS_ONLY=No LOAD_HELPERS_ONLY=No
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 # 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 name shorewall6
%define version 4.4.10 %define version 4.4.13
%define release 0RC1 %define release 0base
Summary: Shoreline Firewall 6 is an ip6tables-based firewall for Linux systems. Summary: Shoreline Firewall 6 is an ip6tables-based firewall for Linux systems.
Name: %{name} Name: %{name}
@@ -98,6 +98,48 @@ fi
%doc COPYING INSTALL changelog.txt releasenotes.txt tunnel ipsecvpn ipv6 Samples6 %doc COPYING INSTALL changelog.txt releasenotes.txt tunnel ipsecvpn ipv6 Samples6
%changelog %changelog
* 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
- Updated to 4.4.11-0RC1
* Sat Jul 03 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta3
* Thu Jul 01 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta2
* Sun Jun 06 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.11-0Beta1
* Sat Jun 05 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0base
* Fri Jun 04 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC2
* Thu May 27 2010 Tom Eastep tom@shorewall.net * Thu May 27 2010 Tom Eastep tom@shorewall.net
- Updated to 4.4.10-0RC1 - Updated to 4.4.10-0RC1
* Wed May 26 2010 Tom Eastep tom@shorewall.net * Wed May 26 2010 Tom Eastep tom@shorewall.net

View File

@@ -26,7 +26,7 @@
# You may only use this script to uninstall the version # You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall # shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.10-RC1 VERSION=4.4.13
usage() # $1 = exit status usage() # $1 = exit status
{ {

View File

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

View File

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

View File

@@ -57,11 +57,9 @@
<row> <row>
<entry></entry> <entry></entry>
<entry><ulink url="KVM.html">KVM (Kernel-mode Virtual <entry><ulink url="Vserver.html">Linux-vserver</ulink></entry>
Machine)</ulink></entry>
<entry><ulink url="Laptop.html">Shorewall on a <entry></entry>
Laptop</ulink></entry>
</row> </row>
<row> <row>
@@ -104,8 +102,8 @@
</row> </row>
<row> <row>
<entry><ulink url="Anatomy.html">Anatomy of Shorewall</ulink> <entry><ulink url="Anatomy.html">Anatomy of
(<ulink url="Anatomy_ru.html">Russian</ulink>)</entry> Shorewall</ulink></entry>
<entry><ulink url="Manpages.html">Man Pages</ulink></entry> <entry><ulink url="Manpages.html">Man Pages</ulink></entry>
@@ -114,8 +112,8 @@
</row> </row>
<row> <row>
<entry><ulink url="traffic_shaping.htm">Bandwidth Control</ulink> <entry><ulink url="traffic_shaping.htm">Bandwidth
(<ulink url="traffic_shaping_ru.html">Russian</ulink>)</entry> Control</ulink></entry>
<entry><ulink url="ManualChains.html">Manual <entry><ulink url="ManualChains.html">Manual
Chains</ulink></entry> Chains</ulink></entry>
@@ -125,9 +123,8 @@
</row> </row>
<row> <row>
<entry><ulink url="blacklisting_support.htm">Blacklisting</ulink> <entry><ulink
(<ulink url="blacklisting_support.htm">Blacklisting</ulink></entry>
url="blacklisting_support_ru.html">Russian</ulink>)</entry>
<entry><ulink <entry><ulink
url="two-interface.htm#SNAT">Masquerading</ulink></entry> url="two-interface.htm#SNAT">Masquerading</ulink></entry>
@@ -187,7 +184,7 @@
<entry><ulink url="netmap.html">Network Mapping</ulink></entry> <entry><ulink url="netmap.html">Network Mapping</ulink></entry>
<entry> <ulink url="simple_traffic_shaping.html">Traffic <entry><ulink url="simple_traffic_shaping.html">Traffic
Shaping/QOS - Simple</ulink></entry> Shaping/QOS - Simple</ulink></entry>
</row> </row>
@@ -199,8 +196,7 @@
NAT)</entry> NAT)</entry>
<entry><ulink url="traffic_shaping.htm">Traffic Shaping/QOS - <entry><ulink url="traffic_shaping.htm">Traffic Shaping/QOS -
Complex</ulink> (<ulink Complex</ulink></entry>
url="traffic_shaping_ru.html">Russian</ulink>)</entry>
</row> </row>
<row> <row>
@@ -322,8 +318,8 @@
</row> </row>
<row> <row>
<entry><ulink url="Install.htm">Installation/Upgrade</ulink> <entry><ulink
(<ulink url="Install_fr.html">Français</ulink>)</entry> url="Install.htm">Installation/Upgrade</ulink></entry>
<entry><ulink url="ReleaseModel.html">Release <entry><ulink url="ReleaseModel.html">Release
Model</ulink></entry> Model</ulink></entry>
@@ -386,6 +382,16 @@
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry><ulink url="KVM.html">KVM (Kernel-mode Virtual
Machine)</ulink></entry>
<entry><ulink url="Laptop.html">Shorewall on a
Laptop</ulink></entry>
<entry></entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>

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 <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 works of course if you have a static external IP address. If you
have a dynamic IP address then include this in have a dynamic IP address then include this in
<filename>/etc/shorewall/params</filename> (or your <filename>/etc/shorewall/params</filename>.</para>
<filename>&lt;export directory&gt;/init</filename> file if you are
using Shorewall Lite on the firewall system):</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> <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; will return 0.0.0.0 if the interface has no configured IP address;
the latter terminates the calling program.</para> the latter terminates the calling program.</para>
</note> </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> </listitem>
</itemizedlist> </itemizedlist>
@@ -1182,6 +1188,18 @@ to debug/develop the newnat interface.</programlisting></para>
<section id="Logging"> <section id="Logging">
<title>Logging</title> <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"> <section id="faq6">
<title>(FAQ 6) Where are the log messages written and how do I change <title>(FAQ 6) Where are the log messages written and how do I change
the destination?</title> 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 <filename>/etc/shorewall/params</filename> when processing the <emphasis
role="bold">restore</emphasis> command.</para> role="bold">restore</emphasis> command.</para>
</section> </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>
<section id="MultiISP"> <section id="MultiISP">
@@ -2324,9 +2393,13 @@ We have an error talking to the kernel
subzones? I've got a system with Linux-VServers, it's one interface subzones? I've got a system with Linux-VServers, it's one interface
(eth0) with multiple IPs</title> (eth0) with multiple IPs</title>
<para><emphasis role="bold">Answer</emphasis>: There is no way to create <para><emphasis role="bold">Answer</emphasis>: Beginning with Shorewall
sub-zones of the firewall zone. But you can use shell variables to make 4.4.11 Beta 2, you can <ulink url="Vserver.html">create vserver
vservers easier to deal with.</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
to deal with.</para>
<para><filename>/etc/shorewall/params</filename>:</para> <para><filename>/etc/shorewall/params</filename>:</para>

View File

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

View File

@@ -5,7 +5,7 @@
<!--$Id: template.xml 5908 2007-04-12 23:04:36Z teastep $--> <!--$Id: template.xml 5908 2007-04-12 23:04:36Z teastep $-->
<articleinfo> <articleinfo>
<title>Shorewall 4.4/4.5 Manpages</title> <title>Shorewall 4.4 Manpages</title>
<authorgroup> <authorgroup>
<author> <author>
@@ -129,6 +129,9 @@
<member><ulink url="manpages/shorewall-rules.html">rules</ulink> - <member><ulink url="manpages/shorewall-rules.html">rules</ulink> -
Specify exceptions to policies, including DNAT and REDIRECT.</member> 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 <member><ulink
url="manpages/shorewall-tcclasses.html">tcclasses</ulink> - Define htb url="manpages/shorewall-tcclasses.html">tcclasses</ulink> - Define htb
classes for traffic shaping.</member> classes for traffic shaping.</member>
@@ -137,6 +140,11 @@
url="manpages/shorewall-tcdevices.html">tcdevices</ulink> - Specify url="manpages/shorewall-tcdevices.html">tcdevices</ulink> - Specify
speed of devices for traffic shaping.</member> speed of devices for traffic shaping.</member>
<member><ulink
url="manpages/shorewall-tcfilters.html">tcfilters</ulink> - Classify
traffic for shaping; often used with an IFB to shape ingress
traffic.</member>
<member><ulink <member><ulink
url="manpages/shorewall-tcinterfaces.html">tcinterfaces</ulink> - url="manpages/shorewall-tcinterfaces.html">tcinterfaces</ulink> -
Specify devices for simplified traffic shaping.</member> Specify devices for simplified traffic shaping.</member>
@@ -184,6 +192,11 @@
<member><ulink url="manpages/shorewall.html">shorewall</ulink> - <member><ulink url="manpages/shorewall.html">shorewall</ulink> -
/sbin/shorewall command syntax and semantics.</member> /sbin/shorewall 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 <member><ulink
url="manpages/shorewall-lite.html">shorewall-lite</ulink> - url="manpages/shorewall-lite.html">shorewall-lite</ulink> -
/sbin/shorewall-lite command syntax and semantics.</member> /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 $--> <!--$Id: template.xml 5908 2007-04-12 23:04:36Z teastep $-->
<articleinfo> <articleinfo>
<title>Shorewall6 4.4/4.5 Manpages</title> <title>Shorewall6 4.4 Manpages</title>
<authorgroup> <authorgroup>
<author> <author>
@@ -114,6 +114,10 @@
<member><ulink url="manpages6/shorewall6-rules.html">rules</ulink> - <member><ulink url="manpages6/shorewall6-rules.html">rules</ulink> -
Specify exceptions to policies, including DNAT and REDIRECT.</member> 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 <member><ulink
url="manpages6/shorewall6-tcclasses.html">tcclasses</ulink> - Define url="manpages6/shorewall6-tcclasses.html">tcclasses</ulink> - Define
htb classes for traffic shaping.</member> 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> </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"> <section id="USE_DEFAULT_RT">
<title>USE_DEFAULT_RT</title> <title>USE_DEFAULT_RT</title>
@@ -1527,7 +1561,7 @@ connection {
connection { connection {
name=Comcast name=Comcast
checkip=${ETH0_GATEWAY:-71.231.152.1} checkip=${SW_ETH0_GATEWAY:-71.231.152.1}
device=$COM_IF device=$COM_IF
ttl=1 ttl=1
} }
@@ -1543,9 +1577,14 @@ EOF
/usr/sbin/lsm /etc/lsm/lsm.conf &gt;&gt; /var/log/lsm /usr/sbin/lsm /etc/lsm/lsm.conf &gt;&gt; /var/log/lsm
}</programlisting> }</programlisting>
<para>eth3 has a dynamic IP address so I need to use the <para>eth0 has a dynamic IP address so I need to use the
Shorewall-detected gateway address ($ETH3_GATEWAY). I supply a default Shorewall-detected gateway address ($SW_ETH1_GATEWAY). I supply a
value to be used in the event that detection fails.</para> 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> <para><filename>/etc/shorewall/started</filename>:</para>

View File

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

View File

@@ -498,6 +498,202 @@ DNAT 172.20.1.0/24 tun1 192.168.1.0/24
the right as 172.20.1.0/24.</para> the right as 172.20.1.0/24.</para>
</section> </section>
<section>
<title>Roadwarrior with IPv6</title>
<para>While OpenVPN supports tunneling of IPv6 packets, the version of the
code that I run under OS X on my Macbook Pro does not support that option.
Nevertheless, I am able to take IPv6 on the road with me by creating a
6to4 tunnel through the OpenVPN IPv6 tunnel. In this configuration, the
IPv4 address pair (172.20.0.10,172.20.0.11) is used for the OpenVPN tunnel
and (2001:470:e857:2::1,2001:470:e857:2::2) is used for the 6to4
tunnel.</para>
<para>Here are my config files:</para>
<para>Server (conventional routed server config):</para>
<blockquote>
<programlisting>dev tun
local 70.90.191.121
server 172.20.0.0 255.255.255.128
dh dh1024.pem
ca /etc/certs/cacert.pem
crl-verify /etc/certs/crl.pem
cert /etc/certs/gateway.pem
key /etc/certs/gateway_key.pem
port 1194
comp-lzo
user nobody
group nogroup
keepalive 15 45
ping-timer-rem
persist-tun
persist-key
client-config-dir /etc/openvpn/clients
ccd-exclusive
client-to-client
push "route 172.20.1.0 255.255.255.0"
verb 3</programlisting>
<para>In the CCD file for the Macbook Pro:</para>
<programlisting>ifconfig-push <emphasis role="bold">172.20.0.11 172.20.0.10</emphasis></programlisting>
<para>From <filename>/etc/network/interfaces</filename> (very standard
<ulink url="6to4.htm#SixInFour">6to4 tunnel
configuration</ulink>):</para>
<programlisting>auto mac
iface mac inet6 v4tunnel
address <emphasis role="bold">2001:470:e857:2::1</emphasis>
netmask 64
endpoint <emphasis role="bold">172.20.0.11</emphasis>
local <emphasis role="bold">172.20.1.254</emphasis></programlisting>
<para>Note that while the remote endpoint (172.20.0.11) is also the
remote endpoint of the OpenVPN tunnel, the local endpoint (172.20.1.254)
of the 6to4 tunnel is not the local endpoint of the OpenVPN tunnel
(that;s 172.20.0.10). 172.20.1.254 is the IPv4 address of the Shorewall
firewall's LAN interface.</para>
<para>The following excerpts from the Shorewall configuration show the
parts of that configuration that are relevant to these two tunnels (bold
font). <emphasis role="bold">This is not a complete
configuration.</emphasis></para>
<para><filename>/etc/shorewall/zones</filename>:</para>
<programlisting>#ZONE TYPE
fw firewall
loc ip #Local Zone
drct:loc ipv4 #Direct internet access
net ipv4 #Internet
<emphasis role="bold">vpn ipv4 </emphasis> #OpenVPN clients</programlisting>
<para><filename>/etc/shorewall/interfaces</filename>:</para>
<programlisting>#ZONE INTERFACE BROADCAST OPTIONS
loc INT_IF detect dhcp,logmartians=1,routefilter=1,physical=$INT_IF,required,wait=5
net COM_IF detect dhcp,blacklist,optional,routefilter=0,logmartians,proxyarp=0,physical=$COM_IF,nosmurfs
<emphasis role="bold">vpn TUN_IF+ detect physical=tun+,routeback</emphasis>
- sit1 - ignore
<emphasis role="bold">- mac - ignore</emphasis>
- EXT_IF - ignore
- lo - ignore</programlisting>
<para><filename>/etc/shorewall/tunnels</filename>:</para>
<programlisting>#TYPE ZONE GATEWAY GATEWAY
# ZONE
<emphasis role="bold">openvpnserver:udp net</emphasis>
6to4 net
<emphasis role="bold">6to4 vpn</emphasis></programlisting>
<para>Similarly, here are exerpts from the Shorewall6
configuration.</para>
<para><filename>/etc/shorewall6/zones</filename>:</para>
<programlisting>#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
net ipv6
<emphasis role="bold">loc ipv6</emphasis>
rest ipv6</programlisting>
<para><filename>/etc/shorewall6/interfaces</filename>:</para>
<programlisting>#ZONE INTERFACE BROADCAST OPTIONS
net sit1 detect tcpflags,forward=1,nosmurfs,routeback
loc eth4 detect tcpflags,forward=1
<emphasis role="bold">loc mac detect tcpflags,forward=1</emphasis>
rest eth+</programlisting>
<para>Note that in the IPv6 firewall configuration, the remove Macbook
Pro is considered to be part of the local zone (loc).</para>
</blockquote>
<para>Client (conventional routed client config):</para>
<blockquote>
<programlisting>client
dev tun
proto udp
remote gateway.shorewall.net 1194
resolv-retry infinite
nobind
persist-key
persist-tun
mute-replay-warnings
ca ca.crt
cert mac.crt
key mac.key
ns-cert-type server
comp-lzo
verb 3
up /Users/teastep/bin/up
down /Users/teastep/bin/down
</programlisting>
<para><filename>/Users/teastep/bin/up</filename>:</para>
<programlisting>#!/bin/bash
LOCAL_IP=<emphasis role="bold">172.20.0.11</emphasis>
LOCAL_IPV6=<emphasis role="bold">2001:470:e857:2::2</emphasis>
REMOTE_IP=<emphasis role="bold">172.20.1.254</emphasis>
REMOTE_IPV6=<emphasis role="bold">2001:470:e857:2::1</emphasis>
TUNNEL_IF=gif0
if [ $(ifconfig gif0 | wc -l ) -eq 1 ]; then
#
# Tunnel interface is not configured yet
#
/sbin/ifconfig $TUNNEL_IF tunnel $LOCAL_IP $REMOTE_IP
/sbin/ifconfig $TUNNEL_IF inet6 $LOCAL_IPV6 $REMOTE_IPV6 prefixlen 128
else
/sbin/ifconfig $TUNNEL_IF up
fi
/sbin/route -n add -inet6 default $REMOTE_IPV6 &gt; /dev/null 2&gt;&amp;1</programlisting>
<para><filename>/Users/teastep/bin/down</filename>:</para>
<programlisting>#!/bin/bash
TUNNEL_IF=gif0
/sbin/ifconfig $TUNNEL_IF down
/sbin/route -n delete -inet6 default &gt; /dev/null 2&gt;&amp;1
</programlisting>
</blockquote>
</section>
<section> <section>
<title>Bridged Roadwarrior</title> <title>Bridged Roadwarrior</title>

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> <para>Connection marking rules use a mask value of 0xff.</para>
</listitem> </listitem>
</itemizedlist> </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>
<section id="Shorewall"> <section id="Shorewall">

View File

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

View File

@@ -320,7 +320,7 @@ ACCEPT $FW net tcp 80,443</programlisting></para>
url="http://wiki.squid-cache.org/Features/Tproxy4">http://wiki.squid-cache.org/Features/Tproxy4</ulink>.</para> url="http://wiki.squid-cache.org/Features/Tproxy4">http://wiki.squid-cache.org/Features/Tproxy4</ulink>.</para>
<para>The following configuration works with Squid running on the firewall <para>The following configuration works with Squid running on the firewall
itself.</para> itself (assume that Squid is listening on port 3128).</para>
<para><filename>/etc/shorewall/interfaces:</filename></para> <para><filename>/etc/shorewall/interfaces:</filename></para>
@@ -332,7 +332,7 @@ ACCEPT $FW net tcp 80,443</programlisting></para>
<programlisting>#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY <programlisting>#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY OPTIONS COPY
Tproxy 1 1 - lo - local</programlisting> Tproxy 1 1 - lo - local</programlisting>
<para><filename>/etc/shorewall/tcrules</filename> (assume Z interface is <para><filename>/etc/shorewall/tcrules</filename> (assume loc interface is
eth1):</para> eth1):</para>
<programlisting>MARK SOURCE DEST PROTO PORT(S) <programlisting>MARK SOURCE DEST PROTO PORT(S)
@@ -341,7 +341,7 @@ TPROXY(1,3128) eth1 0.0.0.0/0 tcp 80</programlisting>
<para>/etc/shorewall/rules:</para> <para>/etc/shorewall/rules:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT(S) <programlisting>#ACTION SOURCE DEST PROTO DEST PORT(S)
ACCEPT Z $FW tcp SP ACCEPT loc $FW tcp 3128
ACCEPT $FW net tcp 80</programlisting> ACCEPT $FW net tcp 80</programlisting>
</section> </section>
</article> </article>

View File

@@ -109,6 +109,11 @@ forwardUPnP net loc</programlisting>
this route during <command>start</command> and deletes it during this route during <command>start</command> and deletes it during
<command>stop</command>.</para> <command>stop</command>.</para>
</note> </note>
<caution>
<para>Shorewall versions prior to 4.4.10 do not retain the dynamic rules
added by linux-idg over a <command>shorewall restart</command>.</para>
</caution>
</section> </section>
<section> <section>

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>

172
docs/Vserver.xml Normal file
View File

@@ -0,0 +1,172 @@
<?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>Shorewall and Linux-vserver</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>Introduction</title>
<para>Formal support for Linux-vserver was added in Shorewall 4.4.11
Beta2. The centerpiece of that support is the
<firstterm>vserver</firstterm> zone type. Vserver zones have the following
characteristics:</para>
<itemizedlist>
<listitem>
<para>They are defined on the Linux-vserver host.</para>
</listitem>
<listitem>
<para>The $FW zone is their implicit parent.</para>
</listitem>
<listitem>
<para>Their contents must be defined using the <ulink
url="manpages/shorewall-hosts.html">shorewall-hosts </ulink>(5) file.
The <emphasis role="bold">ipsec</emphasis> option may not be
specified.</para>
</listitem>
<listitem>
<para>They may not appear in the ZONE column of the <ulink
url="manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>
(5) file.</para>
</listitem>
</itemizedlist>
<para>If you use these zones, keep in mind that Linux-vserver implements a
very weak form of network virtualization:</para>
<itemizedlist>
<listitem>
<para>From a networking point of view, vservers live on the host
system. So if you don't use care, Vserver traffic to/from zone z will
be controlled by the fw-&gt;z and z-&gt;fw rules and policies rather
than by vserver-&gt;z and z-&gt;vserver rules and policies.</para>
</listitem>
<listitem>
<para>Outgoing connections from a vserver will not use the Vserver's
address as the SOURCE IP address unless you configure applications
running in the Vserver properly. This is especially true for IPv6
applications. Such connections will appear to come from the $FW zone
rather than the intended Vserver zone.</para>
</listitem>
<listitem>
<para>While you can define the vservers to be associated with the
network interface where their IP addresses are added at vserver
startup time, Shorewall internally associates all vservers with the
loopback interface (<emphasis role="bold">lo</emphasis>). Here's an
example of how that association can show up:</para>
<programlisting>gateway:~# shorewall show zones
Shorewall 4.4.11-Beta2 Zones at gateway - Fri Jul 2 12:26:30 PDT 2010
fw (firewall)
drct (ipv4)
eth4:+drct_eth4
loc (ipv4)
eth4:0.0.0.0/0
net (ipv4)
eth1:0.0.0.0/0
vpn (ipv4)
tun+:0.0.0.0/0
dmz (<emphasis role="bold">vserver</emphasis>)
<emphasis role="bold">lo</emphasis>:70.90.191.124/31
gateway:~#</programlisting>
</listitem>
</itemizedlist>
</section>
<section>
<title>Vserver Zones</title>
<para>Here is a diagram of the network configuration here at Shorewall.net
during the summer of 2010:</para>
<graphic align="center" fileref="images/Network2010a.png" />
<para>I created a zone for the vservers as follows:</para>
<para><filename>/etc/shorewall/zones</filename>:</para>
<programlisting>#ZONE TYPE OPTIONS ...
fw firewall
loc ip #Local Zone
drct:loc ipv4 #Direct internet access
net ipv4 #Internet
vpn ipv4 #OpenVPN clients
<emphasis role="bold">dmz vserver #Vservers</emphasis></programlisting>
<para><filename>/etc/shorewall/hosts</filename>:</para>
<programlisting>#ZONE HOST(S) OPTIONS
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
configured on eth1, the actual interface name is irrelevate so long as the
interface is defined in <ulink
url="manpages/shorewall-interfaces.html">shorewall-interfaces</ulink> (5).
Shorewall will consider all vserver zones to be associated with the
loopback interface (<emphasis role="bold">lo</emphasis>).</para>
<para>Once a vserver zone is defined, it can be used like any other zone
type.</para>
<para>Here is the corresponding IPv6 configuration.</para>
<para><filename>/etc/shorewall6/zones</filename></para>
<programlisting>#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
net ipv6
loc ipv6
vpn ipv6
<emphasis role="bold">dmz vserver</emphasis>
</programlisting>
<para><filename>/etc/shorewall6/hosts</filename>:</para>
<programlisting>#ZONE HOST(S) OPTIONS
dmz sit1:[2001:470:e857:1::/64]</programlisting>
<para>Note that I choose to place the Vservers on sit1 (the IPv6 net
interface) rather than on eth1. Again, it really doesn't matter
much.</para>
</section>
</article>

View File

@@ -20,6 +20,8 @@
<copyright> <copyright>
<year>2002-2006</year> <year>2002-2006</year>
<year>2010</year>
<holder>Thomas M. Eastep</holder> <holder>Thomas M. Eastep</holder>
</copyright> </copyright>
@@ -34,6 +36,13 @@
</legalnotice> </legalnotice>
</articleinfo> </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"> <section id="Intro">
<title>Introduction</title> <title>Introduction</title>
@@ -61,6 +70,20 @@
the blacklists</emphasis>. Blacklists only stop blacklisted hosts from the blacklists</emphasis>. Blacklists only stop blacklisted hosts from
connecting to you — they do not stop you or your users from connecting connecting to you — they do not stop you or your users from connecting
to blacklisted hosts .</para> 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>
<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> Prior to that release, the feature is always enabled.</para>
<para>Once enabled, dynamic blacklisting doesn't use any configuration <para>Once enabled, dynamic blacklisting doesn't use any configuration
parameters but is rather controlled using /sbin/shorewall[-lite] parameters but is rather controlled using /sbin/shorewall[-lite] commands.
commands:</para> <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> <itemizedlist>
<listitem> <listitem>
<para>drop <emphasis>&lt;ip address list&gt;</emphasis> - causes <para>drop [to|from] <emphasis>&lt;ip address list&gt;</emphasis> -
packets from the listed IP addresses to be silently dropped by the 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> firewall.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>reject <emphasis>&lt;ip address list&gt;</emphasis> - causes <para>allow [to|from] <emphasis>&lt;ip address list&gt;</emphasis> -
packets from the listed IP addresses to be rejected by the re-enables receipt of packets from hosts previously blacklisted by a
firewall.</para>
</listitem>
<listitem>
<para>allow <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> <emphasis>drop</emphasis> or <emphasis>reject</emphasis>
command.</para> command.</para>
</listitem> </listitem>
@@ -188,6 +214,11 @@ ipset -B Blacklist 206.124.146.177 -b SMTP</programlisting>
<para>save - save the dynamic blacklisting configuration so that it <para>save - save the dynamic blacklisting configuration so that it
will be automatically restored the next time that the firewall is will be automatically restored the next time that the firewall is
restarted.</para> restarted.</para>
<para><emphasis role="bold">Update:</emphasis> Beginning with
Shorewall 4.4.10, the dynamic blacklist is automatically retained over
<command>stop/start</command> sequences and over
<command>restart</command>.</para>
</listitem> </listitem>
<listitem> <listitem>
@@ -196,19 +227,19 @@ ipset -B Blacklist 206.124.146.177 -b SMTP</programlisting>
</listitem> </listitem>
<listitem> <listitem>
<para>logdrop <emphasis>&lt;ip address list&gt;</emphasis> - causes <para>logdrop [to|from] <emphasis>&lt;ip address list&gt;</emphasis> -
packets from the listed IP addresses to be dropped and logged by the causes packets from the listed IP addresses to be dropped and logged
firewall. Logging will occur at the level specified by the by the firewall. Logging will occur at the level specified by the
BLACKLIST_LOGLEVEL setting at the last [re]start (logging will be at BLACKLIST_LOGLEVEL setting at the last [re]start (logging will be at
the 'info' level if no BLACKLIST_LOGLEVEL was given).</para> the 'info' level if no BLACKLIST_LOGLEVEL was given).</para>
</listitem> </listitem>
<listitem> <listitem>
<para>logreject <emphasis>&lt;ip address list&gt;</emphasis> - causes <para>logreject [to|from}<emphasis>&lt;ip address list&gt;</emphasis>
packets from the listed IP addresses to be rejected and logged by the - causes packets from the listed IP addresses to be rejected and
firewall. Logging will occur at the level specified by the logged by the firewall. Logging will occur at the level specified by
BLACKLIST_LOGLEVEL setting at the last [re]start (logging will be at the BLACKLIST_LOGLEVEL setting at the last [re]start (logging will be
the 'info' level if no BLACKLIST_LOGLEVEL was given).</para> at the 'info' level if no BLACKLIST_LOGLEVEL was given).</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>

View File

@@ -48,6 +48,17 @@
before you use them with Shorewall.</para> before you use them with Shorewall.</para>
</caution> </caution>
<section>
<title id="Intro">Introduction</title>
<para>This article offers hints about how to accomplish common tasks with
Shorewall. The <ulink url="Introduction.html">Introduction to
Shorewall</ulink> is required reading for being able to use this article
effectively. For information about setting up your first Shorewall-based
firewall, see the <ulink url="GettingStarted.html">Quickstart
Guides</ulink>.</para>
</section>
<section id="Files"> <section id="Files">
<title>Files</title> <title>Files</title>
@@ -111,8 +122,9 @@
</listitem> </listitem>
<listitem> <listitem>
<para><filename>/etc/shorewall/tcrules </filename>- defines marking <para><filename>/etc/shorewall/tcrules </filename>- The file has a
of packets for later use by traffic control/shaping or policy rather unfortunate name because it is used to define marking of
packets for later use by both traffic control/shaping and policy
routing.</para> routing.</para>
</listitem> </listitem>
@@ -201,6 +213,12 @@
shaping.</para> shaping.</para>
</listitem> </listitem>
<listitem>
<para><filename>/etc/shorewall/secmarks</filename> - Added in
Shorewall 4.4.13. Attach an SELinux context to selected
packets.</para>
</listitem>
<listitem> <listitem>
<para><filename>/etc/shorewall/vardir</filename> - Determines the <para><filename>/etc/shorewall/vardir</filename> - Determines the
directory where Shorewall maintains its state.</para> directory where Shorewall maintains its state.</para>
@@ -278,6 +296,30 @@ ACCEPT net $FW tcp www #This is an end-of-line comment</progra
</example> </example>
</section> </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"> <section id="COMMENT">
<title>Attach Comment to Netfilter Rules</title> <title>Attach Comment to Netfilter Rules</title>
@@ -307,6 +349,10 @@ ACCEPT net $FW tcp www #This is an end-of-line comment</progra
<para><filename>/etc/shorewall/rules</filename></para> <para><filename>/etc/shorewall/rules</filename></para>
</listitem> </listitem>
<listitem>
<para><filename>/etc/shorewall/secmarks</filename></para>
</listitem>
<listitem> <listitem>
<para><filename>/etc/shorewall/tcrules</filename></para> <para><filename>/etc/shorewall/tcrules</filename></para>
</listitem> </listitem>
@@ -384,7 +430,7 @@ gateway:~ #
COMMENT SSH COMMENT SSH
PARAM - - tcp 22 </programlisting> PARAM - - tcp 22 </programlisting>
<filename>/etc/shorewall/rules</filename>:<programlisting>COMMENT Allow SSH from home <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</programlisting>The comment line in macro.SSH will not override the
COMMENT line in the rules file and the generated rule will show <emphasis COMMENT line in the rules file and the generated rule will show <emphasis
role="bold">/* Allow SSH from home */</emphasis> when displayed through role="bold">/* Allow SSH from home */</emphasis> when displayed through
@@ -474,8 +520,9 @@ ACCEPT net:\
<listitem> <listitem>
<para>ADDRESS LIST — A list of one or more addresses (host or network) <para>ADDRESS LIST — A list of one or more addresses (host or network)
or address ranges, separated by commas. In an IPv6 configuration, this or address ranges, separated by commas. In an IPv6 configuration, this
list must be includes in angled brackets ("&lt;...&gt;"). The list may list must be includef in square or angled brackets ("[...]" or
have <link linkend="Exclusion">exclusion</link>.</para> "&lt;...&gt;"). The list may have <link
linkend="Exclusion">exclusion</link>.</para>
</listitem> </listitem>
</orderedlist> </orderedlist>
@@ -514,7 +561,7 @@ ACCEPT net:\
<listitem> <listitem>
<para>Host 2002:ce7c:92b4:1:a00:27ff:feb1:46a9 in the <emphasis <para>Host 2002:ce7c:92b4:1:a00:27ff:feb1:46a9 in the <emphasis
role="bold">loc</emphasis> zone — <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> </listitem>
</orderedlist> </orderedlist>
</section> </section>
@@ -738,9 +785,7 @@ SHELL cat /etc/shorewall/rules.d/*.rules</programlisting></para>
</listitem> </listitem>
<listitem> <listitem>
<para>Should not depend on where the code is called from (the params <para>Should not depend on where the code is called from.</para>
file is sourced by both /sbin/shorewall and
/usr/lib/shorewall/firewall).</para>
</listitem> </listitem>
<listitem> <listitem>
@@ -1306,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 <para>Beginning with Shorewall 4.4.4, you can use logical interface names
which are mapped to the actual interface using the which are mapped to the actual interface using the
<option>physical</option> option in <ulink <option>physical</option> option in <ulink
url="manpages/shorewall-interfaces.html">shorewall-interfraces</ulink> url="manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>
(5).</para> (5).</para>
<para>Here is an example:</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.

After

Width:  |  Height:  |  Size: 99 KiB

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