Compare commits

..

750 Commits

Author SHA1 Message Date
Tom Eastep
4d064d6713 Replace spaces with tabs in rules files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-07 16:48:55 -08:00
Tom Eastep
6ab5cfd63a Use split_list2 in isolate_basic_target()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-06 19:12:44 -08:00
Tom Eastep
7190cd1265 Handle nested parens when pushing action parameters.
- Add an optional argument to split_list1 that causes parens to be retained.

Signed-off-by: Tom Eastep <teastep@shorewall.net>

Conflicts:

	Shorewall/Perl/Shorewall/Config.pm
2012-12-06 15:20:10 -08:00
Tom Eastep
61d67a4741 Remove extraneous comment from the rule generated by action.RST
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-06 15:13:46 -08:00
Tom Eastep
4ec47783f1 Detect missing target in merge_levels()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-05 07:52:07 -08:00
Tom Eastep
60012d1208 Add additional space for the OPTIONS column
- actions and actions.std problem

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-04 10:54:32 -08:00
Tom Eastep
a7b8b53f72 Small change to the Actions document.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-04 10:40:22 -08:00
Tom Eastep
fc3606a489 Prepare for multiple options in actions files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-03 08:17:55 -08:00
Tom Eastep
ad4709cb6d Small effeciency improvement
- Don't check for 'bad match' until it is known that the matches are the same.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-03 06:54:44 -08:00
Tom Eastep
c0abdc1fe8 Add some comments in and around delete_duplicates()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-02 17:31:13 -08:00
Tom Eastep
d5405757dd Merge branch '4.5.10'
Conflicts:
	Shorewall/Perl/Shorewall/Chains.pm
	Shorewall/manpages/shorewall.conf.xml
	Shorewall6/manpages/shorewall6.conf.xml
2012-12-02 13:18:33 -08:00
Tom Eastep
cd5e9be467 Carefully suppress duplicate rules in all tables
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-02 12:20:24 -08:00
Tom Eastep
334bdd16d6 Carefully suppress duplicate rules in all tables
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-02 10:40:14 -08:00
Tom Eastep
c05c928c6c Delete adjacent duplicate rules in tables other than 'raw'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-02 09:21:04 -08:00
Tom Eastep
a33cf5cc91 Fix AUTOCOMMENT=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-02 08:26:54 -08:00
Tom Eastep
9da507ae98 Remove error messages from 6 actions regarding in-line.
- The compiler now ignores 'inline' for these actions.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-02 07:13:09 -08:00
Tom Eastep
e0e7b2a9f2 Correct action.DropSmurfs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-02 07:11:58 -08:00
Tom Eastep
65676cb865 Support passing log levels inside parameters.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 15:06:51 -08:00
Tom Eastep
8ebbdee20f Only look for numerics if a shell variable begins with a number.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 12:52:26 -08:00
Tom Eastep
6c1a5b8051 Be more agressive about detecting action recursion.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 12:10:06 -08:00
Tom Eastep
cc657e571d Update action templates with new columns.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 10:25:10 -08:00
Tom Eastep
f358a78eca Revise the description of 'noinline' to match the changed implementation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 09:33:38 -08:00
Tom Eastep
b9adc2ebec Remove another vestage of CONDITION_INIT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 09:33:01 -08:00
Tom Eastep
44f00cd0aa Restore original $actionfile logic in process_actions()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 08:09:20 -08:00
Tom Eastep
ae5680401f Remove questionable autocreate of an action in createlogactionchain()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 08:04:29 -08:00
Tom Eastep
8cbe26e32c Ignore 'inline' for certain actions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-12-01 07:54:42 -08:00
Tom Eastep
146402d9be Yet another correction to the same line :-(
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-30 09:55:24 -08:00
Tom Eastep
70f26d8bb2 Correct line in prior commit.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-30 09:30:27 -08:00
Tom Eastep
893d054cb8 Reduce the block levels in define_firewall()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-30 08:46:49 -08:00
Tom Eastep
53fd0e7c8c Don't require functions called from Shorewall::Compiler::compiler to know the current indentation.
Also, add an optional 'times' parameter to push_indent() and pop_indent().

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-30 07:49:42 -08:00
Tom Eastep
87e205208d Merge branch '4.5.10' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall into 4.5.10 2012-11-30 07:32:15 -08:00
Tom Eastep
6702bb1989 Revert condition initialization patch.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-30 07:31:29 -08:00
Tom Eastep
1fe1c2209c Revert condition initialization patch.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 17:06:08 -08:00
Tom Eastep
e60369728a Only initialize switches that survived optimization
- Also use push_indent to make things more readable

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 15:25:28 -08:00
Tom Eastep
7d4bc568d8 Include initialization in condition match if supported
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 14:54:09 -08:00
Tom Eastep
11d4e92a29 Correct check for leading zeros in action variables.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 14:39:02 -08:00
Tom Eastep
409c427134 Add support for future condition initial values.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 12:15:15 -08:00
Tom Eastep
7bdce1bc97 Disallow superfluous leading zeros in action parameter numbers.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 08:29:20 -08:00
Tom Eastep
e1524763ad Also substute the chain name for '@0'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 08:28:52 -08:00
Tom Eastep
15121e0743 Also substitute the chain name for '@0' in SWITCH names.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 08:05:49 -08:00
Tom Eastep
172c1a5b44 Update the alternative column specification table.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 07:43:48 -08:00
Tom Eastep
9c0d8a2533 Use '@{0}' as the chain name surrogate in SWITCH columns
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-29 07:17:13 -08:00
Tom Eastep
bff91cd325 Allow overriding 'inline' on some standard actions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-28 15:03:08 -08:00
Tom Eastep
8006d150f1 Allow switch initialization.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-27 16:17:43 -08:00
Tom Eastep
e44acdc6af Corrections to in-line actions.
- Avoid reference to uninitialized variable.
- Remove another vestage of multi-parameter macros.
- Correct a typo.
- Correct handling of SOURCE and DEST in an in-line action body.
- Correct a comment.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-27 12:56:14 -08:00
Tom Eastep
e2297f2582 Remove meaningless type from an error message.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-27 12:53:47 -08:00
Tom Eastep
d7096ae52e Back out default-action macros and document in-line actions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-27 10:53:18 -08:00
Tom Eastep
6bf996d4b8 Implement inline actions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-27 10:32:48 -08:00
Tom Eastep
85a46690c0 Improve optimize level 16 fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-26 15:11:07 -08:00
Tom Eastep
a4dcd1071a Revert change to macro level merging.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-26 13:41:12 -08:00
Tom Eastep
78ba8bac50 Replace '@' by the chain name in SWITCH columns.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-26 13:28:23 -08:00
Tom Eastep
bf75b2b919 $0 expands to the current action chain name.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-26 13:23:20 -08:00
Tom Eastep
7673b1ac4b Support multiple parameters in macros.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-26 11:04:19 -08:00
Tom Eastep
fc87576005 Back out silly change for output interfaces in the conntrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-26 09:47:42 -08:00
Tom Eastep
3f550622bd Only use routing table for OUTPUT interface in the raw table.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-26 07:51:55 -08:00
Tom Eastep
21c2963691 Correct Format-3 syntax for the SOURCE column of the conntrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-26 07:48:43 -08:00
Tom Eastep
e7dee420ee Allow interfaces in the DEST column of the conntrack file when the chain is OUTPUT.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 18:37:23 -08:00
Tom Eastep
e45fe53705 Correct another optimizer defect.
- Don't declare command-mode rules as duplicates.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 18:00:26 -08:00
Tom Eastep
697fc001c3 Return to zone-based handling of 'all'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 16:31:05 -08:00
Tom Eastep
642f192b3d Disallow destination interface in the OUTPUT chain.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 15:37:53 -08:00
Tom Eastep
dd0f42c462 Mention Macros as default actions in the Actions and Macros docs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 12:09:41 -08:00
Tom Eastep
7b0578fa84 Fix AUDIT on IPv6.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 12:09:18 -08:00
Tom Eastep
5acf0f60e7 Only apply log level to bare LOG rules in default-action macro.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 10:17:03 -08:00
Tom Eastep
fb3194d96b Correct handling of default-action macro when specified as "macro.Name"
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 10:16:43 -08:00
Tom Eastep
629717f7cc Correct policy manpages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 09:33:46 -08:00
Tom Eastep
8e239c90c1 Update columns in the macro template file.
- It was missing SWITCH and HELPER
2012-11-25 08:54:19 -08:00
Tom Eastep
8c2db40783 Correct errors in the conntrack manpages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 08:52:51 -08:00
Tom Eastep
066a017420 Correct typo in Raw.pm
- The OUTPUT chain designator test was using '0' (zero) rather than 'O'.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 08:52:33 -08:00
Tom Eastep
1870c281a9 Make AUDIT support params again.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 08:26:44 -08:00
Tom Eastep
dbfc805707 Add 'IU' state in secmarks
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-25 08:10:53 -08:00
Tom Eastep
748d532175 Correct the explaination of ULOG and NFLOG in the manpages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-24 09:11:28 -08:00
Tom Eastep
b7e2b28562 Transfer tag when merging into an NFLOG/ULOG rule.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-24 09:04:56 -08:00
Tom Eastep
67e1e6cf91 Allow WHITELIST in IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-23 14:19:14 -08:00
Tom Eastep
cd2854cad0 Fix NFLOG/ULOG implementation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-23 13:49:43 -08:00
Tom Eastep
75c148a2dd Enable 'debug' on the try, stop and clear commands.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-23 11:46:14 -08:00
Tom Eastep
71bbc632ce Handle 'fw' correctly in the SOURCE column of the stoppedrules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-23 08:35:51 -08:00
Tom Eastep
b6a1a7d538 Make NFLOG and ULOG built-ins.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-23 08:14:24 -08:00
Tom Eastep
30de211bda Implement format-3 conntrack files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-22 20:56:56 -08:00
Tom Eastep
3f7425b6a0 Purge %renamed before each table is processed.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-22 17:27:09 -08:00
Tom Eastep
47ef3db53c Add SWITCH column to sample IPv6 conntrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-22 09:10:30 -08:00
Tom Eastep
8a744de906 Document semantic change to 'all' handling in the conntrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-22 09:10:07 -08:00
Tom Eastep
059095e366 Corrected shorewall6-rules(8)
- delete A_ACCEPT+
- correct a typo

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-22 09:09:35 -08:00
Tom Eastep
26dee73895 Support the audited targets on IPv6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-22 08:24:51 -08:00
Tom Eastep
df7ce1a7d1 Add the AUDIT built-in and delete the Audit action.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-22 08:24:33 -08:00
Tom Eastep
4a05571e7e Add forward prototype for process_macro()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-22 08:00:15 -08:00
Tom Eastep
b89e05740d Insure that nested zone exclusions go in the proper place in raw PREROUTING
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 14:49:21 -08:00
Tom Eastep
3040156981 Add SWITCH column to the conntrack file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 14:20:56 -08:00
Tom Eastep
54dadcc546 Ensure that zone-specific rules come before 'all' rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 14:20:30 -08:00
Tom Eastep
952aed225d Improve handling of 'all' in the conntrack file.
- Also added 'all-' to represent all off-firewall zones.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 13:07:01 -08:00
Tom Eastep
7bfbf522bc Document that parameters are allowed in default actions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 11:12:55 -08:00
Tom Eastep
1efd47a7e9 Apply Tuomo Soini's fix for RHEL5
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 10:34:00 -08:00
Tom Eastep
c0a2f19500 Add an Audit action.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 10:24:14 -08:00
Tom Eastep
374489c3cf Revert "Fix RHEL5 issue with route marking."
This reverts commit 77f342b0e0.
2012-11-21 10:19:24 -08:00
Tom Eastep
77f342b0e0 Fix RHEL5 issue with route marking.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 09:08:15 -08:00
Tom Eastep
8f52c9744e Correct some issues with default action macros.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-21 08:29:35 -08:00
Tom Eastep
1957af04fd Don't create a _weight file for an optional non-provider interface.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-20 16:10:30 -08:00
Tom Eastep
a0faba2a03 Correct interface/provider handling.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-20 13:27:15 -08:00
Tom Eastep
9a8cf60857 Recomment disabling route filtering on fallback interfaces.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-20 12:45:19 -08:00
Tom Eastep
c798200b20 Another correction to CHECKSUM detection.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-20 10:09:28 -08:00
Tom Eastep
67ae9df0f8 Correct handling of unknown interfaces in TC.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-20 08:07:42 -08:00
Tom Eastep
ebb4e1f6e4 Don't generate start/stop functions for wildcard optional interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-20 07:06:27 -08:00
Tom Eastep
f458e99390 Correct the compiler's CHECKSUM detection
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-20 06:59:40 -08:00
Tom Eastep
5b049d7e9e Improve readability in Rules module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-20 06:59:13 -08:00
Tom Eastep
3b20c0db54 Allow Macros to be used as Default Actions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-19 16:52:10 -08:00
Tom Eastep
0d8931e49f Don't use ':' as a join character in contatenated macro ACTION expansion.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-19 12:58:29 -08:00
Tom Eastep
47791add99 Fix formatting of a line of code.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-19 12:30:25 -08:00
Tom Eastep
be587726f4 Merge branch '4.5.9' 2012-11-19 08:22:05 -08:00
Tom Eastep
60a509c926 Add new macros and alphabetize the ACTION list in the rules manpages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-19 08:19:12 -08:00
Tom Eastep
b25ece75de Don't leave temporary chain in the raw table when LOAD_HELPERS_ONLY=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-19 08:18:32 -08:00
Tom Eastep
e9ef03f723 Add a ULOG Macro.
- Also remove 'DEFAULT' from NFLOG macro.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-19 07:15:50 -08:00
Tom Eastep
37779038da More expunging of USE_ACTIONS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 20:54:24 -08:00
Tom Eastep
0db7b6c58a Don't require a parameter with '&'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 15:45:58 -08:00
Tom Eastep
57e913d86e Merge branch '4.5.9' 2012-11-18 15:02:46 -08:00
Tom Eastep
263f4e57cb Add an NFLOG Macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 14:52:53 -08:00
Tom Eastep
a4294658b6 Add a capability to use log levels as a target.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 14:50:59 -08:00
Tom Eastep
65e1b1c9e7 Allow NFLOG as a target
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 13:15:24 -08:00
Tom Eastep
a07cfb0885 Allow NFLOG as a target
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 13:13:43 -08:00
Tom Eastep
9dac330756 Remove references to USE_ACTIONS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 13:13:20 -08:00
Tom Eastep
dfd02c932e Correct typo in shorewall(8) and shorewall6(8).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 13:12:03 -08:00
Tom Eastep
c6ffdd67e2 Add DROP target to the conntrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 11:35:40 -08:00
Tom Eastep
5265cd5bb7 Add UNTRACKED match to the secmarks file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 11:01:49 -08:00
Tom Eastep
ab381ed95e Expand the description of enable/disable on optional non-provider interfaces.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 09:01:38 -08:00
Tom Eastep
0277d6628e Correct typo in shorewall(8) and shorewall6(8).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-18 08:30:47 -08:00
Tom Eastep
5712438bcb Eliminate Shell syntax error when a provider and its interface have the same name.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-16 09:50:36 -08:00
Tom Eastep
a2b14c37ed Treat optional interfaces as pseudo-providers.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-16 09:48:21 -08:00
Tom Eastep
054248d2cb Merge branch '4.5.9' 2012-11-14 11:51:51 -08:00
Tom Eastep
a484cb848f Document TPROXY IPv6 gotcha.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-14 11:51:30 -08:00
Tom Eastep
b1ffcd8628 Apply provider mask in 'routemark' chain.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-14 11:20:30 -08:00
Tom Eastep
34e3e4bf82 Merge branch '4.5.9' 2012-11-14 11:17:18 -08:00
Tom Eastep
06a4994488 Make exclusion work correctly with TPROXY.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-14 11:16:52 -08:00
Tom Eastep
391113dfe3 Apply provider mask in 'routemark' chain.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-13 06:55:59 -08:00
Tom Eastep
3c58d2180d Improve the efficiency of tcrule processing.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-13 06:55:35 -08:00
Tom Eastep
32c9e4274f Rename 'mysplit' to 'split_host_list'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-11 08:42:01 -08:00
Tom Eastep
896d874aab Set VARLIB in the script's initialize() function.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-09 12:29:19 -08:00
Tom Eastep
5fcdfd779c Don't default IPSET to 'ipset'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-09 08:54:54 -08:00
Tom Eastep
860ee6de27 Eliminate nonsensical warning message.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-06 07:36:36 -08:00
Tom Eastep
4b6fdf8b72 Update masq manpage to expunge exclusion with an interface name in the SOURCE column.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-04 09:11:37 -08:00
Tom Eastep
0e7a4d56fd Mention IMPLICIT_CONTINUE in the bridge doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-04 07:07:19 -08:00
Tom Eastep
ec17ea1dee Remove superfluous check
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-03 08:19:46 -07:00
Tom Eastep
2e211bc2b6 Correct handling of wildcard interfaces in rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-03 07:24:41 -07:00
Tom Eastep
6e4632663b Correct heading comments in action.TCPFlags.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-11-01 07:20:50 -07:00
Tom Eastep
5f0b85b5b9 Replace a couple of more hard-coded directory names.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-30 09:49:53 -07:00
Tom Eastep
86ae74005a Correct invalid information in shorewall[6]-tcclasses.
- Delete part about an interface only appearing once.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-29 12:46:58 -07:00
Tom Eastep
e11dac3fe2 Replace wireless router image in the 2012 Network diagram.
- Correct a typo in the 4.4 upgrade issues

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-29 07:18:28 -07:00
Tom Eastep
d3c63a2d97 Merge branch '4.5.9'
Conflicts:
	docs/MultiISP.xml
	docs/images/Network2012a.dia
	docs/images/Network2012a.png
2012-10-28 12:45:51 -07:00
Tom Eastep
39c0991940 More updates to the Multi-ISP doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-28 12:34:27 -07:00
Tom Eastep
9e984b10f6 More updates to the Multi-ISP doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-28 12:10:06 -07:00
Tom Eastep
19048b6a18 Recover Network Diagram
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-28 09:06:48 -07:00
Tom Eastep
2fcbeb9ddf Update Multi-ISP doc with my current config
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-27 20:43:13 -07:00
Tom Eastep
8397244fd6 Update Multi-ISP doc with my current config
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-27 20:28:52 -07:00
Tom Eastep
ef3652fc98 Update migration issues document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-27 08:01:16 -07:00
Tom Eastep
b9139a4ec8 Add additional steps to creating a dump file.
- Ubuntu Precise with 4.4.26.1 -- use bash
- ipsec-tools required if IPSEC-related issue

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-26 12:42:35 -07:00
Tom Eastep
1e7a196b3d correct a typo
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-26 12:41:29 -07:00
Tom Eastep
3f1aeb33be Correct mark range with shifted mask.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-26 12:41:06 -07:00
Tom Eastep
e908473d29 Clean up description of CHECKSUM in the manpages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-26 11:22:54 -07:00
Tom Eastep
e177916c12 Implement statistical marking in the tcrules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-26 07:10:26 -07:00
Tom Eastep
d0e03bb03a Sort IPv6 routing tables.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-23 11:53:19 -07:00
Tom Eastep
0387b16983 Implement CHECKSUM action in the tcrules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-22 15:42:13 -07:00
Tom Eastep
f24e194819 Don't display chains with no matched entries when -b
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-22 14:15:37 -07:00
Paul Gear
59a75512be Add Teredo macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-21 07:20:29 -07:00
Tom Eastep
5a103e8ec5 Make options consistent (add a '-' before 't')
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-20 07:15:44 -07:00
Paul Gear
cf68379c4c Document brief option for show command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-20 07:11:56 -07:00
Paul Gear
6c06302d2a Make formatting of interface options consistent
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-20 07:11:48 -07:00
Paul Gear
ca5a0f4b15 Fix option parsing for brief option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-20 07:11:40 -07:00
Paul Gear
baf42f2ac0 Add brief option to shorewall show
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-20 07:11:31 -07:00
Tom Eastep
30066062d1 Move SHOREWALL_CAPVERSION declaration to lib.cli
- Make 'shorwall' the default g_program in lib.cli
- Initialize g_tool in lib.cli for shorewall and shorewall6 to
  facilitate use of the library without reading shorewall[6].conf.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-19 07:12:49 -07:00
Tom Eastep
b00dc658b2 Correct error messages in action.RST
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-15 07:17:17 -07:00
Tom Eastep
6af16e0cda Allow quotes in parameter to run_iptables()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-14 13:26:08 -07:00
Tom Eastep
ab7975539c Correct typo in get_params()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-14 09:30:27 -07:00
Tom Eastep
49acc84f05 Add URL to the "Log message doesn't exist" message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-13 11:16:59 -07:00
Tom Eastep
47de98ff44 Rename crvsn -> vlsm in sort_routes()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-13 09:58:34 -07:00
Tom Eastep
dfd0692176 Omit IPv6-specific code from checkkernelversion() in IPv4 script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-13 07:28:37 -07:00
Tom Eastep
8b650358d6 Don't shout in compiler directives
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-13 07:14:51 -07:00
Paul Gear
78aab70dfb Add Puppet macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-13 07:04:55 -07:00
Paul Gear
b082ca2331 Spelling fix
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-12 16:50:55 -07:00
Tom Eastep
50ceb877f8 Merge branch 'master' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall
Conflicts:
	docs/Dynamic.xml
2012-10-12 10:09:26 -07:00
Tom Eastep
cc90a06958 Add RESTORE_ROUTEMARKS option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-11 07:34:57 -07:00
Tom Eastep
2a175c627e Merge branch '4.5.8' 2012-10-09 16:54:22 -07:00
Tom Eastep
4bb86d8126 Correct typo in shorewallrc.default
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-09 16:53:49 -07:00
Tom Eastep
18f981d7cc Update formatting in Dynamic Zones doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-09 07:08:35 -07:00
Tom Eastep
f53618fc0c Re-order logic in add_group_to_zone
- Need to normalize the address prior to comparing it with ALLIP

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-08 08:55:20 -07:00
Tom Eastep
54e066ec3a Re-order logic in add_group_to_zone
- Need to normalize the address prior to comparing it with ALLIP

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-08 08:54:54 -07:00
Tom Eastep
edd9360b41 Make the -lite installers consistent with the others WRT SYSTEMD and INITFILE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-08 07:53:18 -07:00
Tom Eastep
880e63064b Make the -lite installers consistent with the others WRT SYSTEMD and INITFILE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-08 07:35:47 -07:00
Tom Eastep
620f88b339 Merge branch '4.5.8' 2012-10-07 17:41:01 -07:00
Tom Eastep
b7e6b1aa41 Allow IP range in the hosts file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 17:40:42 -07:00
Tom Eastep
c84603cdc6 Merge branch '4.5.8'
Conflicts:
	Shorewall/Perl/Shorewall/Zones.pm

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 17:04:27 -07:00
Tom Eastep
e2b029b0ba More hosts file corrections.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 17:00:35 -07:00
Tom Eastep
0efc0451c1 Allow IP range in the hosts file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 15:59:30 -07:00
Tom Eastep
9dd66fc6ff Allow IP range in the hosts file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 15:55:00 -07:00
Tom Eastep
1195661264 Document new Dynamic Zone implementation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 12:20:36 -07:00
Tom Eastep
c942bf01dc Document new Dynamic Zone implementation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 12:11:28 -07:00
Tom Eastep
0c9cc4a233 Change the 'dynamic' zone option to 'dynamic_shared'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 09:18:18 -07:00
Tom Eastep
1df48b46ef Enable 'show dynamic' for dynamic zones.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 08:36:28 -07:00
Tom Eastep
8c97681421 Merge branch '4.5.8'
Conflicts:
	Shorewall-core/lib.cli
2012-10-07 08:24:04 -07:00
Tom Eastep
431309678a Enable dynamic zones to work with all ipset versions
- Re-add lost logic from 4.5.8.1 fix.
- create separate variables for add/delete and LIST

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 08:10:57 -07:00
Tom Eastep
7ca1a43118 Fix 'show dynamic'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-07 07:15:43 -07:00
Tom Eastep
8091ad6c70 Modify lib.cli to run the 'add' and 'delete' to allow the zone name to come first
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-06 09:22:14 -07:00
Tom Eastep
c228668500 Implement logic associated with 'dynamic' zone option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-06 07:52:06 -07:00
Tom Eastep
afaba46aa3 Add 'dynamic' zone option.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-06 07:21:49 -07:00
Tom Eastep
25c445830b Merge branch '4.5.8' 2012-10-05 14:49:24 -07:00
Tom Eastep
73b70a86d2 Correct syntax error in Shorewall-init installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-05 07:24:40 -07:00
Tom Eastep
1f38a36acf Delete extraneous logic
Signed-off-by: Tom Eastep <teastep@shorewall.net>

Conflicts:

	Shorewall/Perl/Shorewall/Zones.pm
2012-10-04 09:45:25 -07:00
Tom Eastep
526f72216a Correct handling of dash characters in interface/ipset names.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-04 07:34:41 -07:00
Tom Eastep
642ff1be15 Correct handling of dash characters in interface/ipset names.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-02 10:09:23 -07:00
Tom Eastep
c12985b75b Correct typo in error message.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-01 07:17:39 -07:00
Tom Eastep
22c3766b47 Correct typo in error message.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-01 07:17:03 -07:00
Tom Eastep
92d39dc56d Expunge the g_perllib variable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-01 06:59:39 -07:00
Tom Eastep
a8e9296473 Expunge the g_sbindir variable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-01 06:55:48 -07:00
Tom Eastep
749e239d15 Expunge the g_libexec variable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-01 06:51:36 -07:00
Tom Eastep
526ad75c49 Expunge the g_vardir variable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-10-01 06:44:52 -07:00
Tom Eastep
30d4ba67cc Revert "Allow '-' in the interface for dynamic zone."
This reverts commit b68b34b820.
2012-09-30 16:25:35 -07:00
Tom Eastep
4ef81041be Delete extraneous logic
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-30 16:09:34 -07:00
Tom Eastep
8d35c1b9d8 Merge branch '4.5.8'
Conflicts:
	Shorewall-core/lib.cli
2012-09-30 16:09:12 -07:00
Tom Eastep
b68b34b820 Allow '-' in the interface for dynamic zone.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-30 16:04:38 -07:00
Tom Eastep
a12f1f9fbb Always set IPSET in get_config()
- Previously, lib.cli-std set the variable but lib.cli did not.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-30 11:36:40 -07:00
Tom Eastep
d1bf727127 Allow dynamic zones to work with ipset V5
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-30 08:52:56 -07:00
Tom Eastep
4311dc5ddf Merge branch '4.5.8' 2012-09-29 09:03:12 -07:00
Tom Eastep
38faa3e071 Correct handling of new ipv6 net syntax in the hosts file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-29 09:01:17 -07:00
Tom Eastep
81f92546d8 Merge branch '4.5.8' 2012-09-29 08:08:00 -07:00
Tom Eastep
91e2c31a58 Correct handling of new ipv6 net syntax in the hosts file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-27 14:51:28 -07:00
Tom Eastep
e2eba9468d Update IPv6 doc with new syntax.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-27 14:30:26 -07:00
Tom Eastep
9c893a0e21 Restore the original calling sequences of validate_[46]net()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-27 07:22:40 -07:00
Tom Eastep
c8c1585dfc Merge branch '4.5.8' 2012-09-26 15:48:44 -07:00
Tom Eastep
ffcf262de4 Ensure that the 1:1 NAT chain jumps always come last in PREROUTING.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-26 15:46:52 -07:00
Tom Eastep
ca79147db3 Merge branch '4.5.8' 2012-09-25 11:07:49 -07:00
Tom Eastep
bac0f36818 Yet another fix for TTL/HL
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-24 16:23:15 -07:00
Tom Eastep
a8f324b25c Ensure that the .service files run the utility in ${SBINDIR}
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-24 14:32:20 -07:00
Tom Eastep
b451e10dd8 More fixes for HL and TTL
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-24 14:25:31 -07:00
Togan Muftuoglu
58e277f48b Systemd service files usrmove
On 09/24/2012 10:19 PM, Tom Eastep wrote:
> On 09/24/2012 02:31 AM, Jonathan Underwood wrote:
>> Such a change is something I've been meaning to submit a (trivial) patch
>> for - from a fedora perspective this would be a welcome change.
>
> Okay -- if one of you would send me a patch, I'll apply it. 4.5.8 is
> about to be released, so I would like the patch ASAP if you want it
> included in 4.5.8.

Hope not late and it works, see attached

Togan

>From 3ec45217b6ac93437d002315c56a1b3354160ff2 Mon Sep 17 00:00:00 2001
From: Togan Muftuoglu <toganm@opensuse.org>
Date: Sun, 23 Sep 2012 14:26:07 +0200
Subject: [PATCH] Fix sbin

The service files need to be executed from /usr/sbin not from /sbin

Signed-off-by: Togan Muftuoglu <toganm@opensuse.org>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-24 14:03:55 -07:00
Tom Eastep
6d0142525c Merge branch '4.5.8' 2012-09-24 08:44:07 -07:00
Tom Eastep
cf130a7e16 Correct handling of {+-}0 in the TTL and HL tcrule actions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-24 07:14:44 -07:00
Tom Eastep
e1309b06b1 Correct PPTP Macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-23 12:19:41 -07:00
Tom Eastep
70c76f577c Permit "[<ipv6 address>]/vlsm" in addition to "[<ipv6 address>/vlsm]"
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-23 12:16:17 -07:00
Tom Eastep
86c35339cd Merge branch '4.5.8' 2012-09-23 07:07:37 -07:00
Tom Eastep
f23fb1535d Correct PPTP control port number in conntrack files (1729->1723).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-23 07:04:43 -07:00
Tom Eastep
607c93125c Don't unconditionally detect helpers when LOAD_HELPERS_ONLY=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>

Conflicts:
	docs/Internals.xml
2012-09-23 06:55:00 -07:00
Tom Eastep
2d01af8256 Correct typos (omma -> comma) in the stoppedrules manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-23 06:52:32 -07:00
Tom Eastep
9dd5f73581 Replace IPv4 addresses in shorewall6-stoppedrules(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-23 06:52:26 -07:00
Tom Eastep
83d3d04afb Correct typos (omma -> comma) in the stoppedrules manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-23 06:51:56 -07:00
Tom Eastep
693c573fc3 Replace IPv4 addresses in shorewall6-stoppedrules(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-23 06:46:50 -07:00
Tom Eastep
88caf5c9df Correct header in the STOPPEDRULES files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-22 11:51:23 -07:00
Tom Eastep
32f89fa24b Don't unconditionally detect helpers when LOAD_HELPERS_ONLY=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-22 09:27:13 -07:00
Tom Eastep
97cdc390c3 Continue work on Internals document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-21 15:06:29 -07:00
Tom Eastep
8bd5ee355c Merge branch '4.5.8' 2012-09-21 08:56:19 -07:00
Tom Eastep
af5eb575c2 Add tcfilter example with PRIORITY
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-21 07:40:33 -07:00
Tom Eastep
669dbc7238 Merge branch '4.5.8' 2012-09-21 07:28:56 -07:00
Tom Eastep
4c906dc3d1 Add UDP conntrack FAQ 1j.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-21 07:28:37 -07:00
Tom Eastep
4aeebb0b15 Merge branch '4.5.8' 2012-09-19 10:07:31 -07:00
Tom Eastep
e14f5e5199 Swicth from postincrement to preincrement when bumping 'filterpri'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-17 10:46:31 -07:00
Tom Eastep
abbd1b2c35 Combine two identical cases in the Redhat/Fedora shorewall-init script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-17 10:23:18 -07:00
Tom Eastep
483374d356 Continue development of the Internals document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-17 07:52:18 -07:00
Tom Eastep
fc361afbc3 Disallow ':' as the only contents of the USER/GROUP column
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-16 16:25:41 -07:00
Tom Eastep
124dafbf52 Delete IPAddrs dependency from Compiler.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-16 15:48:06 -07:00
Tom Eastep
f8c2e129c9 Additional content in the Internals document.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-16 15:47:29 -07:00
Tom Eastep
78f3255bf0 Correct getparams.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-16 09:06:32 -07:00
Tom Eastep
92ed56bbbc More content in the Internals doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-16 07:29:53 -07:00
Tom Eastep
cd2205a325 Upgrade down-rev rc file during install
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-15 08:09:37 -07:00
Tom Eastep
adc983bccb Issue progress messages to display the priority of Shorewall-generated filters
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-15 07:25:16 -07:00
Tom Eastep
664dc0b71e Another case of incorrect quoting.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-14 08:20:54 -07:00
Tom Eastep
0400cedc6c More TC manpage updates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-14 08:01:08 -07:00
Tom Eastep
a581958042 Document filter priority algorithm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-13 16:31:39 -07:00
Tom Eastep
e0f85edab3 Assign sequential priorities to filters
- Also remove a redundant 0x prefix from a table number.

Signed-off-by: Tom Eastep <teastep@shorewall.net
2012-09-13 09:30:11 -07:00
Tom Eastep
14073e8943 Change TOS priority offset from 10 to 15
- Make it distinct from tcp-ack

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-13 08:25:05 -07:00
Tom Eastep
e02906e4f9 Add TOS to classification priority enumeration
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-13 07:46:52 -07:00
Tom Eastep
75953a87cb Optional priority on hfsc classes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-12 13:39:54 -07:00
Tom Eastep
e9b0e2f912 Revert "Improve handling of mutex contention when 'lockfile' is installed."
This reverts commit 2f56caf8fd.

The change only worked on very recent distributions.
2012-09-12 10:03:09 -07:00
Tom Eastep
a223245c01 Don't create classic blacklist chains if no blacklist file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-12 07:30:34 -07:00
Tom Eastep
89289f95ba Allow specification of priority for Shorewall-generated tc filters.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-12 07:22:07 -07:00
Tom Eastep
2f56caf8fd Improve handling of mutex contention when 'lockfile' is installed.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-12 07:18:26 -07:00
Tom Eastep
e431d5ab53 Document changes to filter priorities
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-10 17:12:59 -07:00
Tom Eastep
8c7b8c9390 Correct missing VARLIB handling in the installers.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-10 11:12:43 -07:00
Tom Eastep
f6e3107c00 Redefine tc filter priorities
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-10 10:03:16 -07:00
Tom Eastep
b4098ff5dd Appease the Fedora 17 version of emacs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-10 10:02:47 -07:00
Tom Eastep
9d6e0fd9ed Add a PRIORITY column to the tcfilters file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-09 14:48:32 -07:00
Tom Eastep
0e1e38b035 Adjust VARDIR/VARLIB for old shorewallrc files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-09 13:12:32 -07:00
Tom Eastep
5c62bf297a Document multiple GID/UIDs in the USER/GROUP column
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-09 08:18:25 -07:00
Tom Eastep
0dd7ad7920 Re-organize Squid document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-08 08:08:16 -07:00
Tom Eastep
c13bdbd316 Correct 'setstatedir' functions in the init scripts
- Replaced g_program with PRODUCT
- Added setstatedir and call to ifupdown.sh

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-05 07:37:12 -07:00
Tom Eastep
d7354aca14 Add a warning regarding the blacklist option being deprecated.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-05 07:19:48 -07:00
Tom Eastep
ebc4ad2f1e Add warning message when an OUTPUT stopped rule is ignored due to ADMINISABSENTMINDED
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-05 07:16:40 -07:00
Tom Eastep
6614239b32 Allow multiple USER/GROUPs in a rule.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 17:03:26 -07:00
Tom Eastep
3993abad4e Revert routestopped changes.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 17:03:02 -07:00
Tom Eastep
ae1c2cb0ff Use VARLIB rather than VARDIR in the ifupdown script.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 15:42:15 -07:00
Tom Eastep
5e07ad8caa Allow a directory to be specified with -e.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 14:05:52 -07:00
Tom Eastep
6aaf06c2e8 Add stoppedrules files to the samples
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 09:06:45 -07:00
Tom Eastep
eb854f1dbe Only process routestopped when stoppedrules does not exist or is empty
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 08:46:04 -07:00
Tom Eastep
2050d566b8 Handle PRODUCT correctly at run-time.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 07:36:47 -07:00
Tom Eastep
188f05e130 Make ./firewall the default file when compile -e
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 07:35:03 -07:00
Tom Eastep
4260e5f6ba Correctly handle the product name in export shorewallrc.
- Also re-arranged the processing of the shorewallrc file to eliminate
  the kludgy shuffling of hashes.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-04 06:59:16 -07:00
Tom Eastep
7235d4da11 Update manpage indexes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 20:25:15 -07:00
Tom Eastep
bdd66e68c9 Have separate hashes for the two shorewallrc files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 20:09:20 -07:00
Tom Eastep
55e3b11a28 Pass both shorewallrc files to the compiler from lib.cli-std
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 15:07:50 -07:00
Tom Eastep
b8e6a812bd Specify the cwd when compiling or checking for export
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 11:33:58 -07:00
Tom Eastep
09ce6239a7 Install stoppedrules rather than routestopped
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 11:00:22 -07:00
Tom Eastep
5645d66719 Add VARDIR to the shorewallrc files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 10:52:40 -07:00
Tom Eastep
afd9875d3a Update Manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 10:52:22 -07:00
Tom Eastep
5b953cc1dd Handle different layouts on the admin system and remote firewall(s)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 09:50:07 -07:00
Tom Eastep
8e5bd3637d Implement stoppedrules file (less manpages)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 08:44:03 -07:00
Tom Eastep
01696e7298 Remove empty paragraph in shorewall-rules(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-03 05:52:40 -07:00
Tom Eastep
b922177769 Handle missing VARDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 15:51:35 -07:00
Tom Eastep
c16dfc609d Documentation updates for VARLIB
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 15:43:52 -07:00
Tom Eastep
88ab423b2a Correct 'postcompile' patch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 14:55:56 -07:00
Tom Eastep
e66d9e3418 Rename VARDIR to VARLIB in shorewallrc
- Done so that existing shorewallrc files are still valid.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 14:36:11 -07:00
Tom Eastep
bf70f6e71e More Shorewall-init init script corrections
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 13:43:43 -07:00
Tom Eastep
7279553be4 Revert "Add GROUP zones"
This reverts commit 4f2a4c0c6c.
2012-09-02 11:08:38 -07:00
Tom Eastep
a6740c6c53 Revert "Assign marks to according to GROUP zones"
This reverts commit 3fbfafb6e3.
2012-09-02 11:06:28 -07:00
Tom Eastep
c31c9bca9c Handle ${CONFDIR}/$PRODUCT/vardir consistently in Shorewall-init init scripts
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 10:23:11 -07:00
Tom Eastep
f5e1a42ac9 Update the Shorewall-Lite article
- Mention shorewallrc
- Mention that /etc/shorewall/shorewall.conf is no longer read when the
  configuration directory has a shorewall.conf file.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 09:10:19 -07:00
Tom Eastep
9c6d4f90fb Compile the firewall script if it doesn't exist
- Also cleaned up a number of defects in the init scripts

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 08:35:42 -07:00
Tom Eastep
4f54cb34df Add a postcompile script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-02 08:28:02 -07:00
Tom Eastep
3fbfafb6e3 Assign marks to according to GROUP zones
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-01 18:13:49 -07:00
Tom Eastep
34ee00a986 Document the <directory> argument to the 'try' command.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-01 10:53:35 -07:00
Tom Eastep
156fa5ab01 Some fixes to the Fedora Shorewall-init init script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-01 10:52:59 -07:00
Tom Eastep
353915fc8b Allow ipsets in the routestopped file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-01 10:52:37 -07:00
Tom Eastep
02e7d13710 Load iptables_raw in modules.essential
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-01 08:27:03 -07:00
Tom Eastep
e2c7284529 Correct handling of 'source' with ADMINISABSENTMINDED=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-01 08:26:31 -07:00
Tom Eastep
092c2ef8f7 No longer process the local shorewall.conf when compiling from a directory
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-09-01 08:21:45 -07:00
Tom Eastep
4f2a4c0c6c Add GROUP zones
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-31 17:37:01 -07:00
Tom Eastep
deea614677 Placate the latest Emacs WRT qw/.../
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-31 17:36:38 -07:00
Tom Eastep
1119d64b29 Break SNMP Macro into two macros
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-31 06:53:05 -07:00
Tom Eastep
053797a85e Merge branch '4.5.7' 2012-08-30 14:27:01 -07:00
Tom Eastep
48706695b6 Make the SNMP bi-directional with traps allowed in the reverse direction
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-30 14:25:51 -07:00
Tom Eastep
9b05146a85 New documents (WIP)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-30 10:06:58 -07:00
Tom Eastep
09a6f8bc16 Revert non-fatal error implementation
- In the end, I didn't like the way this worked.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-29 11:35:11 -07:00
Tom Eastep
303dc65d13 Merge branch '4.5.7' 2012-08-28 11:46:04 -07:00
Tom Eastep
d838cf41bf Allow TTL and HL in the PREROUTING chain.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-28 11:45:32 -07:00
Tom Eastep
40b21560d8 Merge branch '4.5.7' 2012-08-28 07:50:27 -07:00
Tom Eastep
899bce13c3 Some doc updates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-27 13:22:05 -07:00
Tom Eastep
84e24325de Merge branch '4.5.7' 2012-08-27 07:30:21 -07:00
Tom Eastep
3aca90811c Clear the current comment at the end of the blrules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-27 07:29:47 -07:00
Tom Eastep
7b12558249 Merge branch '4.5.7' 2012-08-26 09:18:16 -07:00
Tom Eastep
341dec0711 Another fix for the NOTRACK patch
- 3 defects in a two-line patch :-(
2012-08-26 09:17:57 -07:00
Tom Eastep
54fcc33adf Merge branch '4.5.7' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall into 4.5.7 2012-08-26 08:28:30 -07:00
Tom Eastep
01b58bf66f Merge branch '4.5.7' 2012-08-26 08:27:39 -07:00
Tom Eastep
dc21d015da Clean up white-space in Togan's patch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-26 08:27:24 -07:00
Tom Eastep
f2cecfc33a Merge branch '4.5.7' 2012-08-26 08:15:05 -07:00
Tom Eastep
6392a4514d Clean up white-space in Togan's patch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-26 08:14:23 -07:00
Tom Eastep
9e5d1cc1ce Merge branch '4.5.7' 2012-08-26 08:11:40 -07:00
Tom Eastep
779243094e Map NOTRACK to 'CT --notrack' if CT_TARGET is available.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-26 08:08:57 -07:00
Tom Eastep
15fd345545 FAQ update
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-25 09:06:37 -07:00
Togan Muftuoglu
1a324fa37f Suse specific patches
Hi Tom,

I have been patching shorewall packages for the opensuse releases, but I
guess it is better to send them to you . the upstream so it gets
incorporated into shorewall itself and I do not have to patch it ;)

I believe I have incorparted most of my patches in to this one. If you
can review them and if appropriate apply them that would be great

Thanks

Togan

>From 6072c08de753e7d1cc31bb758295dee198197e41 Mon Sep 17 00:00:00 2001
From: Togan Muftuoglu <toganm@opensuse.org>
Date: Fri, 24 Aug 2012 13:17:12 +0200
Subject: [PATCH] suse-specific

Signed-off-by: Togan Muftuoglu <toganm@opensuse.org>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-25 08:45:57 -07:00
Tom Eastep
b45d15eec6 Revert "Apply Togan Muftuoglu's SuSE-specific init patches"
This reverts commit 2412998b57.
2012-08-25 08:45:18 -07:00
Togan Muftuoglu
906795a4d7 Suse specific patches
Hi Tom,

I have been patching shorewall packages for the opensuse releases, but I
guess it is better to send them to you . the upstream so it gets
incorporated into shorewall itself and I do not have to patch it ;)

I believe I have incorparted most of my patches in to this one. If you
can review them and if appropriate apply them that would be great

Thanks

Togan

>From 6072c08de753e7d1cc31bb758295dee198197e41 Mon Sep 17 00:00:00 2001
From: Togan Muftuoglu <toganm@opensuse.org>
Date: Fri, 24 Aug 2012 13:17:12 +0200
Subject: [PATCH] suse-specific

Signed-off-by: Togan Muftuoglu <toganm@opensuse.org>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-25 08:41:28 -07:00
Tom Eastep
000c478ef7 FAQ update
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-25 08:10:26 -07:00
Tom Eastep
7208464c68 Change "Compilation aborted..." to "Check aborted ..."
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-25 08:10:12 -07:00
Tom Eastep
519e799ef1 Unify the mode of init files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-24 06:59:11 -07:00
Tom Eastep
e5d63f4212 Merge branch '4.5.7' 2012-08-24 06:56:01 -07:00
Tom Eastep
2412998b57 Apply Togan Muftuoglu's SuSE-specific init patches
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-24 06:32:30 -07:00
Tom Eastep
1067f8a9bb Use the non-fatal error reporting feature for missing capabilities
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-24 06:25:29 -07:00
Tom Eastep
3006452cea Unconditionally restore route mark in PREROUTING and OUTPUT.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-23 12:23:29 -07:00
Tom Eastep
0f7d96a5ec Move routing output closer to the IP output in 'dump'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-23 12:23:21 -07:00
Tom Eastep
e17010018c Unconditionally restore route mark in PREROUTING and OUTPUT.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-23 12:15:14 -07:00
Tom Eastep
5326f35789 Move routing output closer to the IP output in 'dump'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-23 09:16:45 -07:00
Tom Eastep
112312f2ee Add non-fatal error capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-23 05:50:36 -07:00
Tom Eastep
dffd98dff7 Revert change that added CONTINUE as a valid content of the ADDRESSES column
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-21 10:51:01 -07:00
Tom Eastep
a789b18615 Merge branch 'master' into 4.5.7 2012-08-21 07:55:11 -07:00
Tom Eastep
64edd30a76 Correct link in shorewall[6].conf manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-21 07:54:51 -07:00
Tom Eastep
c20611b6c0 Add CONTINUE keyword to the masq file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-20 18:09:59 -07:00
Tom Eastep
59524d0d64 Merge branch 'master' into 4.5.7
Conflicts:
	docs/Manpages6.xml
2012-08-20 11:38:18 -07:00
Tom Eastep
0423769f59 Update docs for info added/changed in 4.5.7
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-20 11:36:32 -07:00
Tom Eastep
46e57d67d8 Merge branch 'master' into 4.5.7 2012-08-20 11:14:08 -07:00
Tom Eastep
8c8af31b7a Update docs for info added/changed in 4.5.7
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-20 11:13:39 -07:00
Tom Eastep
1fd9e5e95c Compensate for silly RHEL bug
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-20 07:20:21 -07:00
Tom Eastep
e4830f6342 Compensate for silly RHEL bug
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-19 06:43:25 -07:00
Tom Eastep
99efb518bd Add the HELPER column to the rules files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-18 12:05:42 -07:00
Tom Eastep
f273fdfda8 Merge branch 'master' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-18 08:00:56 -07:00
Tom Eastep
1b7a7d0fdf Remove some more hard-coded directory names from the installers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-17 14:24:52 -07:00
Tom Eastep
7ac9e46e1f Add a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-16 15:49:33 -07:00
Tom Eastep
0a4f26a318 Correct handling of existing notrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-16 14:46:48 -07:00
Tom Eastep
8d3cf6428f Install the conntrack file unconditionally.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-16 10:50:23 -07:00
Tom Eastep
f6c4650624 Allow a notrack with nothing but FORMAT and COMMENT lines to be removed.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-16 10:49:59 -07:00
Tom Eastep
3c35af9d8c Merge branch 'master' into 4.5.7 2012-08-16 08:34:54 -07:00
Tom Eastep
1e11109bb2 Don't combine rules with '-m policy'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-16 08:34:30 -07:00
Tom Eastep
f59612671b Don't optimize chains with '-m ipsec'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-16 07:33:01 -07:00
Tom Eastep
da4f7ee524 Handle ppp devices correctly in the 'enable' command.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-16 06:59:35 -07:00
Tom Eastep
b132176dae Correct reference adjustment in new opt4 code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-14 13:36:39 -07:00
Tom Eastep
1f59e4f449 Update case in conditionals.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-14 11:42:46 -07:00
Tom Eastep
8487c78a0a Adjust reference counts when splicing in short chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-14 08:34:51 -07:00
Tom Eastep
fdc45a990d Arrange for HELPER to match in the RELATED section.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-13 15:44:19 -07:00
Tom Eastep
44a550870c Add HELPER action.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-13 13:23:38 -07:00
Tom Eastep
bd3295b0e3 Remove temporary hack
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-13 08:55:43 -07:00
Tom Eastep
f1fbb95d48 Update documentation for content merged from the 4.5.8 (master) path
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-13 08:16:36 -07:00
Tom Eastep
45288f5927 Revise notrack/conntrack handling:
- Purge empty notrack files.
- Process both files.
2012-08-13 07:28:07 -07:00
Tom Eastep
75b830b10e Merge branch 'master' into 4.5.7 2012-08-13 06:57:54 -07:00
Tom Eastep
4b2d48d621 Hardwire AUTOHELPERS until 4.5.8.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-13 06:48:19 -07:00
Tom Eastep
50362040d7 Enable automatic helper association during 'stop'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-12 08:46:06 -07:00
Tom Eastep
2f1d59366c Unconditionally disable kernel automatic helper association during start.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-12 08:43:28 -07:00
Tom Eastep
b372163122 Enable automatic helper association during 'stop'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-12 08:42:53 -07:00
Tom Eastep
50bd1d6398 Add AUTOHELPER option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-12 07:25:11 -07:00
Tom Eastep
e6ef32ebc2 Make conditional directives case insensitive
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-11 08:48:35 -07:00
Tom Eastep
a5824dc2d4 Optimize extension
- Eliminate short chains with a single reference.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-11 08:47:10 -07:00
Tom Eastep
b5af6f03fb Create better rules when a HELPER appears in an action
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-11 07:48:03 -07:00
Tom Eastep
50dfffec94 Eliminate duplicate rules in raw-table chains when optimize level 16.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-10 07:09:01 -07:00
Tom Eastep
ad818c071a Generate omnibus tracking rules when NAT/ACCEPT with helper appears in an action.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-10 06:55:18 -07:00
Tom Eastep
e84ee76c7d Add helpers to macros
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-09 10:32:34 -07:00
Tom Eastep
2ab50e65d7 Make conditional directives case insensitive
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-09 10:30:02 -07:00
Tom Eastep
2690243e3c Add helpers in the macros
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-09 07:36:04 -07:00
Tom Eastep
8f71797a48 Update upgrade doc to mention both SHA and SHA1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-08 10:51:06 -07:00
Tom Eastep
4d3fbd1dfa Allow '?IF 0'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-08 07:24:17 -07:00
Tom Eastep
e8a4728981 Allow '?IF 0'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-08 07:23:43 -07:00
Tom Eastep
ee28638604 Add HELPERS to rules file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-08 07:23:20 -07:00
Tom Eastep
a8495626b0 Merge branch '4.5.6' into 4.5.7 2012-08-07 15:10:15 -07:00
Tom Eastep
c6186571e5 Handle raw table zones from VSERVERS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-07 15:09:40 -07:00
Tom Eastep
ccf517307e Handle raw table zones from VSERVERS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-07 14:51:58 -07:00
Tom Eastep
88dabde9c9 Update upgrade-issues doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-07 09:10:21 -07:00
Tom Eastep
e00616a1fe Don't release blacklist files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-07 07:56:16 -07:00
Tom Eastep
c007f847a0 Handle disabled helpers in pre-3.5 kernels.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-06 15:54:45 -07:00
Tom Eastep
4b4e30d4e1 Handle disabled helpers in pre-3.5 kernels.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-06 13:10:15 -07:00
Tom Eastep
56caf3687f Factor out the ?IF __CT_TARGET tests in the conntrack files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-06 09:26:14 -07:00
Tom Eastep
b4c812b676 Correct helper parsing in the Raw module.
- Require (...) around multiple ctevents
- Detect invalid options

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-05 08:09:17 -07:00
Tom Eastep
9a0d53194a Correct Helper detection in the compiler.
Use CT_MATCH when available.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-05 08:08:20 -07:00
Tom Eastep
49fb2799e9 Correct detection of 'netbios-ns' in the CLIs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-05 08:07:19 -07:00
Tom Eastep
6c97e13107 Use -j CT for helper detection, when available
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-04 11:36:03 -07:00
Tom Eastep
cfe2f36320 Delete duplicate entry in the Shorewall[6] install.sh
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-04 08:23:08 -07:00
Tom Eastep
6fbb578ce6 Add Helpers Document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-04 07:28:13 -07:00
Tom Eastep
093985dd93 Use HELPERS to enable/disable helper association.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-03 19:26:02 -07:00
Tom Eastep
72307df6d2 Replace the AUTOHELPERS option with the HELPERS option.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-03 10:53:20 -07:00
Tom Eastep
7689b1e84b Remove the 'zone' helper option for now.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-03 06:39:58 -07:00
Tom Eastep
9ceff3c213 Display KERNELVERSION and CAPVERSION in 'show capabilities'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 17:38:41 -07:00
Tom Eastep
82c057d1ed Fix *VERSION handling.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 16:44:02 -07:00
Tom Eastep
21770a89d6 Detect which matches are available.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 15:38:23 -07:00
Tom Eastep
223ed5b3a3 More additions to the helper table and to the conntrack files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 13:25:44 -07:00
Tom Eastep
2ae59bb3cd Add COMMENT directives to conntrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 11:58:00 -07:00
Tom Eastep
c2cd031285 Mention the conntrack file in the config basics doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 11:31:25 -07:00
Tom Eastep
9ba0c07956 Redesign the CT:helper feature.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 11:10:08 -07:00
Tom Eastep
7d32258e6e Correct Helpers Module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 11:09:34 -07:00
Tom Eastep
07e56d129a Add AUTOHELPERS option.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 11:09:18 -07:00
Tom Eastep
62d6d2558e Rename AUTO_COMMENT to AUTOCOMMENT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 11:06:41 -07:00
Tom Eastep
833e54c9c3 Rename the notrack file to conntrack
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-02 11:02:17 -07:00
Tom Eastep
f2dd43855e Correct typo in warning message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-01 13:13:18 -07:00
Tom Eastep
eaf238fa66 Merge branch '4.5.6' 2012-08-01 10:37:45 -07:00
Tom Eastep
542f279544 Don't allow a source interface in a DNAT/REDIRECT rule with source == firewall
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-08-01 10:01:08 -07:00
Tom Eastep
917e2980a4 Correct error message generation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-30 09:22:43 -07:00
Tom Eastep
c8ea03bf8c Update help text
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-30 07:23:53 -07:00
Tom Eastep
ac6e67e371 Correct typo in rules manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-30 07:23:40 -07:00
Tom Eastep
735b7c2cf5 Add support for nfacct
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-28 11:21:16 -07:00
Tom Eastep
87c0f934aa Add NFacct Match capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-28 08:19:05 -07:00
Tom Eastep
55519bd9ac Revise instructions for disabling iptables
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-17 16:48:15 -07:00
Tom Eastep
c0e4d4093c Clarify TOS value
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-16 15:53:22 -07:00
Tom Eastep
55b527d065 Eliminate a local variable.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-15 20:22:19 -07:00
Tom Eastep
620d8f1cd0 Add an Anti-spoofing document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-15 11:26:16 -07:00
Tom Eastep
e1e7ab42c1 Make 'routefilter' and 'sfilter' mutually exclusive
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-15 10:37:56 -07:00
Tom Eastep
65b16a1acf Compensate for bugs in the latest CPerl emacs extension
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-15 10:07:06 -07:00
Tom Eastep
1db79a91eb 'rpfilter' option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-15 10:05:32 -07:00
Tom Eastep
e7cd84a72c Implement rpfilter match capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-15 07:54:46 -07:00
Tom Eastep
691a9bf793 Correct installation on systems with systemd
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-14 14:38:30 -07:00
Tom Eastep
2cce81cfc1 Revert 83a8c7eda3
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-09 10:58:15 -07:00
Tom Eastep
9f4ca3ebc5 Additional simplification of evaluate_expression()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-08 07:48:27 -07:00
Tom Eastep
3c2385de06 Merge branch '4.5.6' 2012-07-08 07:36:15 -07:00
Tom Eastep
6ce3d0180e Ensure a defined value for __IPV[46]
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-07 09:47:10 -07:00
Tom Eastep
83a8c7eda3 When TC_ENABLED=No, require providers to process tcrules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-07 08:02:57 -07:00
Tom Eastep
aa652fda1b Add FAQ 99
- Empty ruleset after boot even though Shorewall runs.
2012-07-07 07:55:17 -07:00
Tom Eastep
66f3df4570 Correct typo in ISO 366O doc.
- changed tcrules to rules

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-07 07:38:27 -07:00
Tom Eastep
5616c96745 Merge branch '4.5.6' 2012-07-06 12:30:52 -07:00
Tom Eastep
18f947eb2f Apply patch from Daniel Meißner
- Corrects STARTUP_ENABLED=No error message

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-06 07:28:29 -07:00
Tom Eastep
83df8a4e39 Avoid a call to eval() for simple expressions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-06 07:26:54 -07:00
Tom Eastep
e9d8228b6f Simplify handling of __IPVn in conditional directives.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-06 06:43:15 -07:00
Tom Eastep
65d8341c6c Correct a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-05 15:43:20 -07:00
Tom Eastep
61a9584433 Only require MANGLE_ENABLED to process the tcrules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-04 14:45:24 -07:00
Tom Eastep
1b1d38a808 Merge branch '4.5.6' 2012-07-03 08:07:54 -07:00
Tom Eastep
000cc6978a Add missing 'sleep' when waiting for wildcard interface to come up
- Also reverse the order of test and sleep when waiting for a regular
  interface to come up.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-03 08:06:30 -07:00
Tom Eastep
a073258e15 Add missing 'sleep' when waiting for wildcard interface to come up
- Also reverse the order of test and sleep when waiting for a regular
  interface to come up.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-03 07:16:16 -07:00
Tom Eastep
e4d66fb5fc Back out redundant part of recent patch
- setup_traffic_shaping is only called when there are tc devices so the
  test of @tcdevices in that function is redundant.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-03 06:33:46 -07:00
Tom Eastep
537f6c157c Allow the compiler version to be tested in ?IF/?ELSIF
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-02 11:53:32 -07:00
Tom Eastep
a5b637b2a7 Use the correct filename in ?IF/?ELSIF exec call.
- Also extend a comment in the TC module

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-02 11:53:01 -07:00
Tom Eastep
74f831a73e Improve the readability of the ?ELSIF example
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-02 11:51:14 -07:00
Tom Eastep
f0b5ee4cdb Correct a typo in NewRelease.xml
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-02 11:50:38 -07:00
Tom Eastep
09c00cf425 Don't print phoney progress message
- The 'Setting up Traffic Shaping' progress message was being issued when
  traffic shaping was not enabled.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-07-01 08:27:07 -07:00
Tom Eastep
6ddaa0190e Improve USER/GROUP validation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-30 14:46:50 -07:00
Tom Eastep
5c176c64b7 Add an ORIGINAL DEST column to /etc/shorewall/masq
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-29 15:32:01 -07:00
Tom Eastep
b195884b1f Insure that the correct filename/linenumber are printed in error messages out of process_conditional()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-29 09:01:26 -07:00
Tom Eastep
56d5ae2d41 Ensure that exclusion chains have DONT_MOVE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-27 18:06:38 -07:00
Tom Eastep
41c7c8f923 Make the Invalid Drop rules uniform across sample files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-27 15:16:16 -07:00
Tom Eastep
0bf2753472 Re-implement conditional inclusion
- Correct defects
- Add ?ELSIF support
- Allow Perl-compatible expressions in ?IF
2012-06-27 15:15:44 -07:00
Tom Eastep
c90006ecf8 Correct another logical name bug -- this time in TC
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-27 11:34:19 -07:00
Tom Eastep
17d22fb5b8 Prevent multiple 'tproxy' providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-23 17:26:18 -07:00
Tom Eastep
af302900c6 Prevent multiple 'tproxy' providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-23 17:09:46 -07:00
Tom Eastep
9aa78656ec Add TPROXY_MARK to the output of 'shorewall show marks'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-23 07:57:39 -07:00
Tom Eastep
b9d59bc60c Document that 'classify' with marks is now allowed.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-22 10:17:26 -07:00
Tom Eastep
1b7601cb19 Update all samples to specify OPTIMIZE=31
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-21 11:48:48 -07:00
Tom Eastep
640d34cecd Remove old advice from the Aliased Interface Article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-20 16:39:12 -07:00
Tom Eastep
9d3766b77f Allow fwmarks with 'classify' interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-20 14:04:48 -07:00
Tom Eastep
24ddae6ede Don't use '--ctmark' when saving marks
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-20 13:30:27 -07:00
Tom Eastep
7b6f329830 Document UID/GID ranges
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-19 14:05:38 -07:00
Tom Eastep
4d336ed8d6 Rewrite handling of the USER/GROUP column
- Remove code that handled '+program' as that support was removed from
  the kernel in 2.6.14.
2012-06-19 08:14:31 -07:00
Tom Eastep
da3e1b720c Apply user/group Id range patch from Gergely Risko
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-19 06:17:13 -07:00
Tom Eastep
a38f773ab1 Clarify comment in macro.mDNS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-18 14:20:10 -07:00
Tom Eastep
7b4e5828e0 Clean up handling of RED options.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-18 12:17:22 -07:00
Tom Eastep
a2f6236e82 Add bi-directional mDNS macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-18 09:16:30 -07:00
Tom Eastep
50bd126b11 Reverse change to macro.mDNS and add a comment about $FW being the SOURCE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-18 09:16:11 -07:00
Tom Eastep
4a55705b9a Update tcclasses manpages titles to include HFSC
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-18 07:54:25 -07:00
Tom Eastep
0a928cb034 Add tc-red(8) as reference to the tcclasses manpages. 2012-06-17 10:03:19 -07:00
Tom Eastep
d1627efe5a Add a complex QOS Example
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-17 09:57:31 -07:00
Tom Eastep
4c10fcd503 Complain if a RED_NONE option has a value specified.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-16 15:51:20 -07:00
Tom Eastep
2807502836 More tcclasses manpage cleanup.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-16 06:50:23 -07:00
Tom Eastep
5f81ab7b31 make mDNS macro bi-directional
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-15 10:39:11 -07:00
Tom Eastep
780e7014d4 Cleanup of tcclasses manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-15 10:34:09 -07:00
Tom Eastep
5fc295e8cc Fix handling of stab 'tsize' option.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-14 15:44:15 -07:00
Tom Eastep
c5ba167a3e Make CEIL optional
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-14 13:10:09 -07:00
Tom Eastep
9159372897 Fix a typo in the tcfilters manpages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-14 13:08:37 -07:00
Tom Eastep
6c47349689 Support 'red' queuing discipline
- Also added 'ls' support for HFSC

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-13 14:29:13 -07:00
Tom Eastep
d2c415c580 Make IFB work with logical interface names.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-13 13:48:12 -07:00
Tom Eastep
28ab3749ca Allow fractional delays in TC
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-13 13:47:31 -07:00
Tom Eastep
a29dbf4ff8 Fix for linklayer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-12 11:48:12 -07:00
Tom Eastep
f92a9fa0d6 Update traffic shaping doc with linklayer options
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-12 09:40:33 -07:00
Tom Eastep
cbba5741ce Correct typos in tcdevices manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-12 09:40:15 -07:00
Tom Eastep
4a51241c40 Merge branch '4.5.5' 2012-06-12 08:12:26 -07:00
Tom Eastep
b2c96970ee Add cls_basic to recommended TC modules in FAQ 67
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-12 08:11:17 -07:00
Tom Eastep
19cace7e8d Merge branch '4.5.5'
Conflicts:
	Shorewall/Perl/Shorewall/Providers.pm
2012-06-11 17:02:59 -07:00
Tom Eastep
4791a8ca66 Don't delete default routes when 'fallback' is specified.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-11 16:57:49 -07:00
Tom Eastep
844f6c63e4 Add support for TC size tables.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-11 15:45:47 -07:00
Tom Eastep
08db919479 Merge branch '4.5.5' 2012-06-11 13:55:47 -07:00
Tom Eastep
2dd9e6c91f Don't delete default routes when 'fallback' is specified.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-11 13:53:53 -07:00
Tom Eastep
2e05b81443 Apply patch from Ronan Amicel
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-11 11:26:49 -07:00
Tom Eastep
c57f627a21 Add some comments.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-11 11:25:19 -07:00
Tom Eastep
1d0ab43fbb Change indentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-10 15:38:09 -07:00
Tom Eastep
5f051fc61b Unify document indexes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-10 15:31:31 -07:00
Tom Eastep
61d4363865 Update Netfilter overview with Raw and Rawpost tables
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-10 15:30:39 -07:00
Tom Eastep
705744fd8c Convert Frequently-used Articles section into a table
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-10 07:36:32 -07:00
Tom Eastep
b5bba40344 Merge branch '4.5.5' 2012-06-10 07:35:51 -07:00
Tom Eastep
724f3cbd76 Unify documentation indexes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-10 07:22:14 -07:00
Tom Eastep
1f54d19981 Split add_input_jumps() into two functions
- Added add_forward_jump()
- Added lots of comments

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 17:21:59 -07:00
Tom Eastep
00f7b9d0dd More useful trace of enable/disable optimization
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 15:36:29 -07:00
Tom Eastep
6d3ebd5b56 Improve DIGEST handling.
- Compile compiler.pl when DIGEST specified.
- Report the digest being used.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 09:34:28 -07:00
Tom Eastep
bc5e0f4851 Don't store the DIGEST setting in shorewallrc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 08:32:15 -07:00
Tom Eastep
2bf16016c1 Add --digest to configure scripts.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 07:24:23 -07:00
Tom Eastep
f86476a43c Remove SYSCONFDIR aliasing from Install.xml
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 07:18:53 -07:00
Tom Eastep
1ed6769b14 Fix broken URL in logging doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 07:18:17 -07:00
Tom Eastep
73325c579e Merge branch '4.5.4' 2012-06-09 06:27:53 -07:00
Tom Eastep
9197cdc9bd Merge branch '4.5.4' into 4.5.5 2012-06-09 06:27:22 -07:00
Tom Eastep
9c486e62e5 Correct handling of SYSCONFDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 06:26:03 -07:00
Tom Eastep
a2f32f25c5 Add some comments.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-09 06:20:40 -07:00
Tom Eastep
ae66d7d7a5 Eliminate the hideously complex forwarding code in generate_matrix()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-08 08:29:36 -07:00
Tom Eastep
63eb0bee5b Break up and eliminate handle_pio_jumps()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-08 07:40:26 -07:00
Tom Eastep
8a9427ebff Merge branch '4.5.4' 2012-06-07 14:12:48 -07:00
Tom Eastep
4a383540be Merge branch '4.5.4' into 4.5.5 2012-06-07 14:12:10 -07:00
Tom Eastep
db6a7276ec Don't optimize chains with commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-07 14:11:44 -07:00
Tom Eastep
d771c6b2c2 Delete the 'dnat' nat-table chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-07 13:44:03 -07:00
Tom Eastep
fe7d0730d5 Break up generate_matrix()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-07 07:47:33 -07:00
Tom Eastep
38adf3d186 Set 'sourceroute=0' on all sample net interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-06 14:30:00 -07:00
Tom Eastep
a2a9ef0958 Rename OPTIMIZE_MASK1 to OPTIMIZE_MASK2n4
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-06 13:08:45 -07:00
Tom Eastep
21eda5daec Fix multiple iprange matches without kludgefree.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-06 11:26:52 -07:00
Tom Eastep
58a0ebccb2 Clarify CONFIG_PATH setting using -lite products
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-06 11:26:40 -07:00
Tom Eastep
6cd71ef4dd Fix IPv6 shorecap
- copied the CLI program initialization steps to shorecap
- Modified install.sh to modify the location of shrorewallrc if needed
2012-06-06 11:26:17 -07:00
Tom Eastep
49d361e44f Correct another problem with the Shorewall-core installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-06 11:25:58 -07:00
Tom Eastep
6bd81145e9 Fix single-line embedded Perl
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-06 11:23:33 -07:00
Tom Eastep
49050e61de Fix multiple iprange matches without kludgefree.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-06 10:50:16 -07:00
Tom Eastep
5c7a4b579c Clarify CONFIG_PATH setting using -lite products
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-05 17:23:13 -07:00
Tom Eastep
bc2e7487db Fix IPv6 shorecap
- copied the CLI program initialization steps to shorecap
- Modified install.sh to modify the location of shrorewallrc if needed
2012-06-05 15:22:08 -07:00
Tom Eastep
9faaab41f4 Correct another problem with the Shorewall-core installer
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-05 12:52:12 -07:00
Tom Eastep
225101b802 Rename OPTIMIZE_MASK1 to OPTIMIZE_MASK2n4
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-05 12:51:52 -07:00
Tom Eastep
fa3164fb1b Re-enable single-line embedded SHELL and PERL
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-05 12:51:16 -07:00
Tom Eastep
3294f7c4c3 Add a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-05 09:02:29 -07:00
Tom Eastep
654f7dd805 Fix single-line embedded Perl
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-05 09:02:12 -07:00
Tom Eastep
ee467a4877 Allow embedded shell/Perl directives to have leading '?'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-05 07:32:43 -07:00
Tom Eastep
170875c7dd Convert the 'ignore' interface to be multi-valued
-Allows 'ignore=1' to only exempt interface from updown processing

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-05 07:23:23 -07:00
Tom Eastep
c8156cfdb1 Correct typo
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-04 08:18:57 -07:00
Tom Eastep
57a9feaf2f Correct typo
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-04 08:00:07 -07:00
Tom Eastep
92a13ec87c Merge branch '4.5.4'
Conflicts:
	Shorewall/Perl/Shorewall/Config.pm
2012-06-03 18:51:03 -07:00
Tom Eastep
040f693583 Cosmetic changes in code from when I was still learning Perl
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-03 17:50:34 -07:00
Tom Eastep
69387b9099 Make 'check -r' work like 'compile' WRT optimization
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-03 15:43:43 -07:00
Tom Eastep
28f0a066da Make 'check -r' work like 'compile' WRT optimization
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-03 15:15:11 -07:00
Tom Eastep
621aa3fc6a Another approach to reporting errors from process_conditional()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-03 13:47:38 -07:00
Tom Eastep
9869420106 Check for conditional directives prior to continuation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-03 09:05:09 -07:00
Tom Eastep
39b3a0da65 Check for conditional directives prior to continuation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-03 08:43:48 -07:00
Tom Eastep
121d34aed0 Add constant LOG_OPTIONS capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-02 14:06:31 -07:00
Tom Eastep
4b69216c83 Relocate lib.core in the Source Tree
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-02 12:46:35 -07:00
Tom Eastep
7ff15b0625 Merge branch '4.5.4'
Conflicts:
	Shorewall/Perl/Shorewall/Zones.pm
2012-06-02 11:41:45 -07:00
Tom Eastep
41dcd5826f Minimize the list of plain interfaces
Omit bridge ports and interfaces that match a wildcard.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-02 11:39:16 -07:00
Tom Eastep
26502034ec Minimize the list of plain interfaces
Omit bridge ports and interfaces that match a wildcard.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-02 11:17:10 -07:00
Tom Eastep
baa2c4f5eb Merge branch '4.5.4' 2012-06-02 09:30:47 -07:00
Tom Eastep
9e9c44d4ac Handle Debian pre-down/post-down correctly
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-02 09:26:00 -07:00
Tom Eastep
579104833e Restore installation of the ifupdown script in if-post-down.d on Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-02 09:25:20 -07:00
Tom Eastep
099133f7ff Clear PHASE on non-Debian systems in the ifupdown script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-02 09:23:31 -07:00
Tom Eastep
67883a369c Add logrotate file to Shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-02 08:26:06 -07:00
Tom Eastep
01eb1a580b Merge branch '4.5.4' 2012-06-02 08:20:40 -07:00
Tom Eastep
b3316d755a Correct silly typo in Providers.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 17:14:08 -07:00
Tom Eastep
73274b9b0b Correct progress message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 15:55:22 -07:00
Tom Eastep
f7104b3d26 Add LOGFILE option to Shorewall-init configuration.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 15:54:03 -07:00
Tom Eastep
c823b0e41e More Shorewall-init fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 14:04:08 -07:00
Tom Eastep
fe5d89b243 Install the ifupdown script in if-down.d rather than if-post-down.d on Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 14:03:57 -07:00
Tom Eastep
78f9b76dae Move mutex handling to the main program.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 14:03:47 -07:00
Tom Eastep
402e155148 More Shorewall-init fixes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 14:01:58 -07:00
Tom Eastep
f266d9a4dc Install the ifupdown script in if-down.d rather than if-post-down.d on Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 11:56:48 -07:00
Tom Eastep
9c4a01bcdd Move mutex handling to the main program.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 11:47:58 -07:00
Tom Eastep
21b9a194ca Merge branch '4.5.4' 2012-06-01 11:30:35 -07:00
Tom Eastep
312efe5c7b Use enable/disable for up and down of provider interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 11:27:57 -07:00
Tom Eastep
f25187adb1 Move compile_updown() from the Zones module to the Providers module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 08:12:07 -07:00
Tom Eastep
70e6bda3bb Fix a couple of problems in Shorewall-init
- Remove fly speck from installer
- Don't bother to save/restore VARDIR

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-06-01 08:10:41 -07:00
Tom Eastep
df1efb2a25 Merge branch '4.5.4' 2012-05-31 19:24:33 -07:00
Tom Eastep
02006288b0 Fixes for Shorewall-init
- Enable at boot on debian
- Clear environment for each product
2012-05-31 19:15:23 -07:00
Tom Eastep
9866bcbc9e Correct install of shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-31 16:54:30 -07:00
Tom Eastep
eb03168685 Cleanup of process_rules1() breakup
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-31 15:32:16 -07:00
Tom Eastep
69badac72f Merge branch '4.5.4'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-30 14:43:05 -07:00
Tom Eastep
de184b32bc Fix sectioned IPSEC accounting.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-30 14:37:29 -07:00
Tom Eastep
ea173ab628 Correct IPSEC accounting manpages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-30 14:09:41 -07:00
Tom Eastep
303c661409 Eliminate bogus term in an expression.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-30 12:49:18 -07:00
Tom Eastep
e88c2c8cd3 Move rules file nat handling to the Nat module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-30 09:01:24 -07:00
Tom Eastep
67932f2d42 Break up expand_rule()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-30 06:49:00 -07:00
Tom Eastep
eb63745352 Merge branch '4.5.4' 2012-05-29 06:48:04 -07:00
Tom Eastep
32e0f154b5 Correct pptpserver tunnel configuration.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-29 06:46:40 -07:00
Tom Eastep
db50454afc Complete removal of optimize level 4 when level 4 is set.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-25 15:42:34 -07:00
Tom Eastep
ed352f60b6 Complete removal of optimize level 4 when level 4 is set.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-25 15:41:55 -07:00
Tom Eastep
3a5875dc73 Add MSSQL Macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-25 07:09:23 -07:00
Tom Eastep
5211b32aa6 Remove quotes from GEOIPDIR setting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-25 07:09:07 -07:00
Tom Eastep
c37beacd95 Add MSSQL Macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-25 07:07:14 -07:00
Tom Eastep
5b891f1072 Remove quotes from GEOIPDIR setting
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-25 07:05:38 -07:00
Tom Eastep
fc97f6d00e Implement LOG target option control.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-24 13:54:59 -07:00
Tom Eastep
6142d4d535 Fix typo
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-23 07:55:07 -07:00
Tom Eastep
1f2ca30ebd Infrastructure for iRule-based logging.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-22 16:46:11 -07:00
Tom Eastep
92ce190bf0 Remove Geoip from Shorewall6/actions.std.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-21 12:31:01 -07:00
Tom Eastep
182a4c3080 Correct 'compile' usage text
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-21 07:10:38 -07:00
Tom Eastep
ab2376d61d Document 15-cc limit.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-21 07:03:53 -07:00
Tom Eastep
f147046288 Change 'cc' to 'country-code' in invalid cc list error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-21 07:01:07 -07:00
Tom Eastep
daaf3c031f Change the 'no isocodes' error message to include the address family.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-20 09:40:37 -07:00
Tom Eastep
73e5bb0374 Expand the GEOIP documentation to describe GEOIPDIR option.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-20 09:40:00 -07:00
Tom Eastep
6b23eff650 Add a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-20 09:05:42 -07:00
Tom Eastep
ef974b5c8d Clear the DEFAULT table if no FALLBACK providers are up.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-20 09:00:22 -07:00
Tom Eastep
d8ec051114 Load the geoip cc's dynamically.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-20 08:59:59 -07:00
Tom Eastep
84f92aa87c Don't capture result of an RE match. Correct a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-20 07:06:59 -07:00
Tom Eastep
70e4c26df1 Delete a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-19 16:46:57 -07:00
Tom Eastep
db96f6ead2 Reject long CC lists.
- include offending CC in 'Invalid or Unknown' error

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-19 12:44:24 -07:00
Tom Eastep
f0a3e1652a Bracket non-trivial cc lists with [...]
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-19 09:39:49 -07:00
Tom Eastep
56b8a9b9fa Some code cleanup:
- Store config value in a local rather than repeatedly referencing the
  %config hash.
- Centralize generation of the valid table array

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-19 09:02:44 -07:00
Tom Eastep
231c5dbca0 Eliminate need to call optimize_policy_chains() when OPTIMIZE 4 is selected
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-19 08:15:20 -07:00
Tom Eastep
1a9789a3da Optimization tracing
- Correct tracing in optimize_chain()
- Add tracing to new level 4 optimization

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-19 07:54:50 -07:00
Tom Eastep
f15e6d3995 Additional optimization in level 4.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-18 16:50:08 -07:00
Tom Eastep
3f42350a7b Don't overwrite empty mark geometry settings.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-18 11:37:49 -07:00
Tom Eastep
e8648c993d Use blackhole routes rather than unreachable.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-18 10:50:13 -07:00
Tom Eastep
cb72948739 Add Geoip match to config basics doc. Clarify variable search algorithm.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-18 07:27:33 -07:00
Tom Eastep
55c88e8e81 Replace curly brace enclosure with a preceding caret to avoid ambiguity.
- {...} is used to enclose a set of column/value pairs and it is certain
  that the two will become confused.
2012-05-17 15:26:16 -07:00
Tom Eastep
e086067567 Reverse logic in the installer to allow for Digest::SHA being the default now
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-17 14:29:57 -07:00
Tom Eastep
f5f80d2ccc Re-arrange enforcement of restrictions on geoip.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-17 13:59:56 -07:00
Tom Eastep
d1519345c4 Add TOC Link to ISO-3661.html; Correct typo in ISO-3661 page.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-17 12:26:02 -07:00
Tom Eastep
3436fbd6ad Don't use ?INCLUDE in modules files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-17 10:45:12 -07:00
Tom Eastep
d220d3d9d5 Abandon action.GeoIP in favor of extended syntax in the SOURCE and DEST columns.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-17 10:44:02 -07:00
Tom Eastep
6148c909f2 fix multiple ipsets in an imatch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-16 19:52:41 -07:00
Tom Eastep
cc07e74532 Correct typo in TPROXY documentation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-16 15:56:19 -07:00
Tom Eastep
2eb25f3f6a Correct the grammar in an error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-16 07:52:42 -07:00
Tom Eastep
0673898e85 GeoIP tweaks:
- Error if no CC
- switch an 'if' expression to 'unless'.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-16 07:52:19 -07:00
Tom Eastep
43d882db2b Cosmetic cleanup
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-15 16:44:35 -07:00
Tom Eastep
78af118b9a Quote original list when a translated list is ill-formed.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-15 16:39:46 -07:00
Tom Eastep
85f58d6906 Avoid funny-looking ERROR: messages out of Embedded Perl.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-15 16:38:56 -07:00
Tom Eastep
885830b67c Correct configure and configure.pl to output SPARSE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-15 12:27:16 -07:00
Tom Eastep
17e25932f0 Fixes for GeoIP
- Correct check for valid ACTION
- Add to Shorewall6/actions.std
- Only use geoip once per invocation

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-15 11:14:28 -07:00
Tom Eastep
63ae00e4a4 Fix bug in 'interface_is_usable'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-15 06:58:03 -07:00
Tom Eastep
ac2ed505bb Add GeoIP support
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-14 17:12:46 -07:00
Tom Eastep
926e589414 Exit the tcpost chain if a connection mark is restored
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-14 10:35:42 -07:00
Tom Eastep
9f1c920a39 Don't allow RSTs to be REJECTed 2012-05-14 10:34:11 -07:00
Tom Eastep
9ea233d55f Split a couple of functions with address-family dependent logic.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-13 15:53:02 -07:00
Tom Eastep
60bde6231a Improve interface_is_usable()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-13 13:49:59 -07:00
Tom Eastep
3d575a45bd Re-code interface_is_usable()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-13 11:56:52 -07:00
Tom Eastep
1f621002b7 Ignore 'isusable' on 'enable'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-12 19:38:18 -07:00
Tom Eastep
cd150af790 Update .status file on disable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-12 07:44:46 -07:00
Tom Eastep
cd98266396 Correct add of default IPv6 route when no gateway specified
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-12 07:15:24 -07:00
Tom Eastep
3d541f50c8 Use "(S)" consistently in column headings.
- add synonyms so both the singular and plural forms are accepted.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-11 12:42:04 -07:00
Tom Eastep
bad8b9bddb Improve TPROXY documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-11 11:39:15 -07:00
Tom Eastep
f77b350a7b Clear the 'balance' table if no balanced providers.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-11 11:28:06 -07:00
Tom Eastep
bed4457e0e Delete jump to 'tproxy'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-11 09:00:09 -07:00
Tom Eastep
2d5269be7b Fix another conditional compilation bug.
?IF $false
   ?IF $false
      ...
   ?ENDIF
   foo <------- This line is not omitted!
?ENDIF

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-11 07:44:46 -07:00
Tom Eastep
a05b3afd7f Eliminate the 'tproxy' chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-11 07:42:44 -07:00
Tom Eastep
9e743451f6 Add FORMAT 2 to tcrules files. Initialize $format in Tc.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-11 07:08:06 -07:00
Tom Eastep
cb7fc31f0b Restore 4.5.3 compatibility
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-10 14:23:33 -07:00
Tom Eastep
69d735ea0a Make TPROXY actually work!
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-10 11:19:23 -07:00
Tom Eastep
4d4fc315e0 More TPROXY changes
- Combine identical DIVERT chains.
- Add --transparent to -m socket
- Reserve a TPROXY bit in the fwmark

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-10 07:25:07 -07:00
Tom Eastep
820c965b72 Allow Shorewall::Config::in_hex() to accept an argument already expressed in hex.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-09 13:51:49 -07:00
Tom Eastep
605ef6ef86 Tweak to DIVERT plus correct TPROXY in man pages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-09 13:10:51 -07:00
Tom Eastep
2eb7af23dc Merge branch 'master' into 4.5.3 2012-05-09 10:03:43 -07:00
Tom Eastep
582d025f58 Add DIVERT action to tcrules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-09 09:41:58 -07:00
Tom Eastep
b55d8c04e4 Do logical->physical mapping in rtrules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-08 14:52:18 -07:00
Tom Eastep
3b6f5b2d8a Finish alternative balancing
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-08 13:55:13 -07:00
Tom Eastep
6639b3534e Close all input files in Shorewall::Config::cleanup()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-08 08:58:14 -07:00
Tom Eastep
59bf343521 Leave first filename and linenumber on the same line as error text.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-08 08:55:24 -07:00
Tom Eastep
089d980dae Document the --shorewallrc parameter to compiler.pl
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-08 07:59:22 -07:00
Tom Eastep
1d6e6b65db Finish a comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 17:06:35 -07:00
Tom Eastep
2224fdbc65 Correct help text in compiler.pl
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 16:55:51 -07:00
Tom Eastep
fd1d6cf935 Handle default shorewallrc location
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 16:55:17 -07:00
Tom Eastep
5d7442e9e9 Correct typo in converted blrules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 12:13:26 -07:00
Tom Eastep
ef90006334 Avoid reference to unitialized variable on bogus FORMAT in interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 12:00:21 -07:00
Tom Eastep
2cbf1e86ad Allow synonyms for column names in alternate specification formats
- gateway and gateways in the tunnels file
- mark and action in the tcrules file

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 11:59:47 -07:00
Tom Eastep
dd8e9ff09d Fix 'COMMENT' along in the tunnels file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 11:58:37 -07:00
Tom Eastep
4320150dc4 Add alternate specification in tunnels file ('gateways')
- Make similar change in tcrules file with 'action'

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 07:43:11 -07:00
Tom Eastep
7453b70666 Add emphasis to the 'required' option in the config basics doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-07 07:14:56 -07:00
Tom Eastep
003daec41c Remove a couple of hard-coded '/usr/share' in Shorewall::Config
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-06 17:30:17 -07:00
Tom Eastep
cb159eba2e Add RST action.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-06 12:14:30 -07:00
Tom Eastep
aac00c3cc7 Pop open stack in run_user_exit1 and run_user_exit2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-05 10:31:55 -07:00
Tom Eastep
cd35b6a13f Modify macro.BLACKLIST to use blacklog when appropriate
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-05 08:56:55 -07:00
Tom Eastep
af228806fc Allow manual changes to be used in macros.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-05 08:56:26 -07:00
Tom Eastep
69f6aae982 Delete extra copy of macro.BLACKLIST
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-05 08:40:25 -07:00
Tom Eastep
53d66833b2 Document how to avoid dhcp client setting default route
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-04 08:28:06 -07:00
Tom Eastep
1d90ee174c Cleanup of ERROR/WARNING message enhancement.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-04 07:01:08 -07:00
Tom Eastep
097ab853db Apply Tuomo Soini's tunnels patch
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-04 06:18:22 -07:00
Tom Eastep
3e37f47fb5 Print out the include/open stack in WARNING and ERROR messages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-03 17:17:55 -07:00
Tom Eastep
bd30d59f3d Fix annotated interfaces files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-03 14:09:49 -07:00
Tom Eastep
e4c4900b32 Add recent changes to a couple of config files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-03 12:32:47 -07:00
Tom Eastep
4d23ec2c48 Belatedly document FORMAT-2 interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-03 10:07:36 -07:00
Tom Eastep
15aa1dae62 Enhancements to the 'refresh' command.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-02 13:48:18 -07:00
Tom Eastep
894931731b Merge branch 'master' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall 2012-05-02 07:04:30 -07:00
Tom Eastep
3333486c9d Another change to Debian startup at boot
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-01 10:55:29 -07:00
Tom Eastep
2dd82a9898 Update Multi-ISP documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-01 10:28:12 -07:00
Tom Eastep
45c637ad6b Fix Debian boot startup (again)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-05-01 10:15:39 -07:00
Tom Eastep
731b310359 Use --hashlimit-upto when available.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-30 13:45:09 -07:00
Tom Eastep
35c08c109e Fix IPv4 'reset'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-30 07:54:40 -07:00
Tom Eastep
766771d812 Remove absurd test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-30 07:48:07 -07:00
Tom Eastep
b9e6349994 Add some comments
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-29 09:07:34 -07:00
Tom Eastep
9efb60c53a Move init.slackware.firewall.sh to Shorewall-core
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-27 16:15:04 -07:00
Tom Eastep
e0570cc35e Install fixes for Slackware
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-27 07:16:11 -07:00
Tom Eastep
9612044933 Make products start automatically at boot on Debian and derivatives
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-25 11:49:22 -07:00
Tom Eastep
3a362a7004 Update FAQ 17
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-25 09:44:24 -07:00
Tom Eastep
c9b4d3d8c8 Add/improve comments.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-25 09:44:08 -07:00
Tom Eastep
dc63efdbfd Use ?INCLUDE in modules files.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-25 07:33:40 -07:00
Tom Eastep
d904a2de86 Search and destroy trailing whitespace
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-24 14:52:57 -07:00
Tom Eastep
f860cd037d Change a comment in generate_matrix() to acknowledge 'KLUDGEFREE'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-24 13:34:56 -07:00
Tom Eastep
0f53c3cc7d Convert all interfaces files to format-2 only
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-24 10:53:09 -07:00
Tom Eastep
3bdf703522 Allow TC experts to SAVE/RESTORE all parts of the packet mark
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-24 09:19:38 -07:00
Tom Eastep
8211c5de35 Add a comment about 'find_tables()'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-24 09:15:29 -07:00
Tom Eastep
dc85d4a844 Do SHA/SHA1 test if $BUILD = $TEST, independent of $DESTDIR
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-24 08:52:17 -07:00
Tom Eastep
a50bb407aa Patch from Roberto
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-21 17:51:54 -07:00
Tom Eastep
f40144f6af Corret tcrules manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-21 09:53:00 -07:00
Tom Eastep
0adbdbb101 Add TCP to macro.Amanda
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-20 09:46:13 -07:00
Tom Eastep
34f5838365 Allow multiple GATEWAYS to be listed in the tunnels file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-18 09:28:37 -07:00
Tom Eastep
2b7e5dd9d8 Suppress duplicate option when not KLUDGEFREE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-17 07:35:37 -07:00
Tom Eastep
44c8ef2ede Correct ill-advised change to push_matches()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-17 07:30:17 -07:00
Tom Eastep
52ebca3fe1 Merge branch '4.5.2'
Conflicts:
	Shorewall-core/lib.cli
	Shorewall/Perl/Shorewall/Config.pm

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-16 13:47:05 -07:00
Tom Eastep
02342d5833 Make 'show routing work with iproute 20111117
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-16 08:20:21 -07:00
Tom Eastep
805166a354 Ressurect LOCKFILE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-16 07:21:06 -07:00
Tom Eastep
aaab505006 Improve the debuggability of failed assertions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-14 17:57:49 -07:00
Tom Eastep
c3e575baf7 Merge branch 'master' of ssh://shorewall.git.sourceforge.net/gitroot/shorewall/shorewall 2012-04-14 15:58:42 -07:00
Tom Eastep
63a2a32b4b Suppress trailing whitespace.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-14 13:50:59 -07:00
Tom Eastep
eb7a21030d Correct Makefiles
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-14 12:03:51 -07:00
Tom Eastep
1bc03123b9 Delete code to modify Makefile
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-14 12:03:08 -07:00
Tom Eastep
e6aabec7ef Install correct Makefile
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-14 12:03:00 -07:00
Tom Eastep
31752d9ee1 Move macro.BLACKLIST to where it belongs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-14 08:14:45 -07:00
Tom Eastep
24e2fe4a04 Make options argument to read_a_line manditory
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-14 08:04:28 -07:00
Tom Eastep
2d1a12f016 Correct the output of 'version -a'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-12 18:56:36 -07:00
Tom Eastep
f88584b916 Merge branch '4.5.2'
Conflicts:
	Shorewall-core/configure.pl

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-12 14:48:56 -07:00
Tom Eastep
4ff93bccf0 Remove blank line in shorewallrc.suse
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-12 06:54:19 -07:00
Tom Eastep
355f8e195c Fix configure.pl
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-12 06:53:58 -07:00
Tom Eastep
439fe77d1c Merge branch '4.5.2'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-12 06:26:56 -07:00
Tom Eastep
6b980d6e6a Merge branch '4.5.2' 2012-04-11 15:41:48 -07:00
Tom Eastep
59d1a57f06 Add the -T option to the load, reload, restart and start commands.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-11 14:28:44 -07:00
Tom Eastep
42950e53cd Use logical add rather than arithmetic add for uniformity
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-11 14:28:09 -07:00
Tom Eastep
ae9f538ef8 Simplify an assertion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-11 14:27:48 -07:00
Tom Eastep
e880d2fd84 Remove some whitespace
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-11 08:03:02 -07:00
Tom Eastep
6404c57cf8 Clean up configure.pl
- Remove blank lines at the end
- Simply the handling of vendor

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-11 08:01:49 -07:00
Tom Eastep
e791a63671 Merge branch '4.5.2'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-11 07:13:40 -07:00
Tom Eastep
07ff3f294d Fix INCLUDE inside an ?IF ... ?ENDIF
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-10 17:27:23 -07:00
Tom Eastep
6ba69c9540 Eliminate read_a_line1()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-10 17:01:38 -07:00
Tom Eastep
5ee554708c Control the proliferation of arguments to read_a_line() by using
a bit-mapped single argument.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2012-04-10 13:51:25 -07:00
265 changed files with 17242 additions and 6092 deletions

View File

@@ -56,7 +56,7 @@ getfileparams() {
esac esac
done done
return 0 return 0
} }
@@ -70,22 +70,19 @@ for p in $@; do
pv=${p#*=} pv=${p#*=}
if [ -n "${pn}" ]; then if [ -n "${pn}" ]; then
case ${pn} in case ${pn} in
VENDOR) VENDOR)
pn=HOST pn=HOST
;; ;;
SHAREDSTATEDIR) SHAREDSTATEDIR)
pn=VARDIR pn=VARLIB
;; ;;
DATADIR) DATADIR)
pn=SHAREDIR pn=SHAREDIR
;; ;;
SYSCONFDIR)
pn=CONFDIR
;;
esac esac
params[${pn}]="${pv}" params[${pn}]="${pv}"
else else
echo "ERROR: Invalid option ($p)" >&2 echo "ERROR: Invalid option ($p)" >&2
@@ -102,7 +99,7 @@ if [ -z "$vendor" ]; then
$params[HOST]=apple $params[HOST]=apple
rcfile=shorewallrc.apple rcfile=shorewallrc.apple
;; ;;
cygwin*) cygwin*)
$params[HOST]=cygwin $params[HOST]=cygwin
rcfile=shorewallrc.cygwin rcfile=shorewallrc.cygwin
@@ -132,7 +129,7 @@ if [ -z "$vendor" ]; then
vendor=${params[HOST]} vendor=${params[HOST]}
elif [ $vendor = linux ]; then elif [ $vendor = linux ]; then
rcfile=$shorewallrc.default; rcfile=shorewallrc.default;
else else
rcfile=shorewallrc.$vendor rcfile=shorewallrc.$vendor
if [ ! -f $rcfile ]; then if [ ! -f $rcfile ]; then
@@ -164,6 +161,17 @@ if [ $# -gt 0 ]; then
echo '#' >> shorewallrc echo '#' >> shorewallrc
fi fi
if [ -n "${options[VARLIB]}" ]; then
if [ -z "${options[VARDIR]}" ]; then
options[VARDIR]='${VARLIB}/${PRODUCT}'
fi
elif [ -n "${options[VARDIR]}" ]; then
if [ -z "{$options[VARLIB]}" ]; then
options[VARLIB]=${options[VARDIR]}
options[VARDIR]='${VARLIB}/${PRODUCT}'
fi
fi
for on in \ for on in \
HOST \ HOST \
PREFIX \ PREFIX \
@@ -181,7 +189,9 @@ for on in \
SYSTEMD \ SYSTEMD \
SYSCONFFILE \ SYSCONFFILE \
SYSCONFDIR \ SYSCONFDIR \
SPARSE \
ANNOTATED \ ANNOTATED \
VARLIB \
VARDIR VARDIR
do do
echo "$on=${options[${on}]}" echo "$on=${options[${on}]}"

View File

@@ -30,7 +30,7 @@ use strict;
# #
# Build updates this # Build updates this
# #
use constant { use constant {
VERSION => '4.5.2.1' VERSION => '4.5.2.1'
}; };
@@ -38,9 +38,8 @@ my %params;
my %options; my %options;
my %aliases = ( VENDOR => 'HOST', my %aliases = ( VENDOR => 'HOST',
SHAREDSTATEDIR => 'VARDIR', SHAREDSTATEDIR => 'VARLIB',
DATADIR => 'SHAREDIR', DATADIR => 'SHAREDIR' );
SYSCONFDIR => 'CONFDIR' );
for ( @ARGV ) { for ( @ARGV ) {
die "ERROR: Invalid option specification ( $_ )" unless /^(?:--)?(\w+)=(.*)$/; die "ERROR: Invalid option specification ( $_ )" unless /^(?:--)?(\w+)=(.*)$/;
@@ -124,6 +123,15 @@ printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d
print $outfile "# Input: @ARGV\n#\n" if @ARGV; print $outfile "# Input: @ARGV\n#\n" if @ARGV;
if ( $options{VARLIB} ) {
unless ( $options{VARDIR} ) {
$options{VARDIR} = '${VARLIB}/${PRODUCT}';
}
} elsif ( $options{VARDIR} ) {
$options{VARLIB} = $options{VARDIR};
$options{VARDIR} = '${VARLIB}/${PRODUCT}';
}
for ( qw/ HOST for ( qw/ HOST
PREFIX PREFIX
SHAREDIR SHAREDIR
@@ -131,7 +139,7 @@ for ( qw/ HOST
PERLLIBDIR PERLLIBDIR
CONFDIR CONFDIR
SBINDIR SBINDIR
MANDIR MANDIR
INITDIR INITDIR
INITSOURCE INITSOURCE
INITFILE INITFILE
@@ -140,7 +148,9 @@ for ( qw/ HOST
SYSTEMD SYSTEMD
SYSCONFFILE SYSCONFFILE
SYSCONFDIR SYSCONFDIR
SPARSE
ANNOTATED ANNOTATED
VARLIB
VARDIR / ) { VARDIR / ) {
my $val = $options{$_} || ''; my $val = $options{$_} || '';

View File

@@ -33,7 +33,7 @@ usage() # $1 = exit status
exit $1 exit $1
} }
fatal_error() fatal_error()
{ {
echo " ERROR: $@" >&2 echo " ERROR: $@" >&2
exit 1 exit 1
@@ -91,7 +91,7 @@ install_file() # $1 = source $2 = target $3 = mode
run_install $T $OWNERSHIP -m $3 $1 ${2} run_install $T $OWNERSHIP -m $3 $1 ${2}
} }
require() require()
{ {
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set" eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
} }
@@ -164,7 +164,18 @@ else
usage 1 usage 1
fi fi
for var in SHAREDIR LIBEXECDIR PERLLIBDIR CONFDIR SBINDIR VARDIR; do update=0
if [ -z "${VARLIB}" ]; then
VARLIB=${VARDIR}
VARDIR="${VARLIB}/${PRODUCT}"
update=1
elif [ -z "${VARDIR}" ]; then
VARDIR="${VARLIB}/${PRODUCT}"
update=2
fi
for var in SHAREDIR LIBEXECDIR PERLLIBDIR CONFDIR SBINDIR VARLIB VARDIR; do
require $var require $var
done done
@@ -307,6 +318,16 @@ chmod 755 ${DESTDIR}${SBINDIR}
mkdir -p ${DESTDIR}${MANDIR} mkdir -p ${DESTDIR}${MANDIR}
chmod 755 ${DESTDIR}${MANDIR} chmod 755 ${DESTDIR}${MANDIR}
if [ -n "${INITFILE}" ]; then
mkdir -p ${DESTDIR}${INITDIR}
chmod 755 ${DESTDIR}${INITDIR}
if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then
install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$AUXINITFILE
echo "$Product script installed in ${DESTDIR}${INITDIR}/$AUXINITFILE"
fi
fi
# #
# Note: ${VARDIR} is created at run-time since it has always been # Note: ${VARDIR} is created at run-time since it has always been
# a relocatable directory on a per-product basis # a relocatable directory on a per-product basis
@@ -336,9 +357,25 @@ ln -sf lib.base ${DESTDIR}${SHAREDIR}/shorewall/functions
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion
chmod 644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion chmod 644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion
[ $file != "${SHAREDIR}/shorewall/shorewallrc" ] && cp $file ${DESTDIR}${SHAREDIR}/shorewall/shorewallrc if [ -z "${DESTDIR}" ]; then
if [ $update -ne 0 ]; then
echo "Updating $file - original saved in $file.bak"
[ -z "${DESTDIR}" ] && [ ! -f ~/.shorewallrc ] && cp ${SHAREDIR}/shorewall/shorewallrc ~/.shorewallrc cp $file $file.bak
echo '#' >> $file
echo "# Updated by Shorewall-core $VERSION -" `date` >> $file
echo '#' >> $file
[ $update -eq 1 ] && sed -i 's/VARDIR/VARLIB/' $file
echo 'VARDIR=${VARLIB}/${PRODUCT}' >> $file
fi
[ ! -f ~/.shorewallrc ] && cp ${SHAREDIR}/shorewall/shorewallrc ~/.shorewallrc
fi
[ $file != "${DESTDIR}${SHAREDIR}/shorewall/shorewallrc" ] && cp $file ${DESTDIR}${SHAREDIR}/shorewall/shorewallrc
if [ ${SHAREDIR} != /usr/share ]; then if [ ${SHAREDIR} != /usr/share ]; then
for f in lib.*; do for f in lib.*; do

View File

@@ -20,15 +20,11 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# This library contains the code common to all Shorewall components. # This library contains the code common to all Shorewall components except the
# # generated scripts.
# - It is loaded by /sbin/shorewall.
# - It is released as part of Shorewall[6] Lite where it is used by /sbin/shorewall[6]-lite
# and /usr/share/shorewall[6]-lite/shorecap.
# #
SHOREWALL_LIBVERSION=40502 SHOREWALL_LIBVERSION=40509
SHOREWALL_CAPVERSION=40502
[ -n "${g_program:=shorewall}" ] [ -n "${g_program:=shorewall}" ]
@@ -38,11 +34,7 @@ if [ -z "$g_readrc" ]; then
# #
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc
g_libexec="$LIBEXECDIR"
g_sharedir="$SHAREDIR"/$g_program g_sharedir="$SHAREDIR"/$g_program
g_sbindir="$SBINDIR"
g_perllib="$PERLLIBDIR"
g_vardir="$VARDIR"
g_confdir="$CONFDIR"/$g_program g_confdir="$CONFDIR"/$g_program
g_readrc=1 g_readrc=1
fi fi
@@ -53,13 +45,13 @@ case $g_program in
shorewall) shorewall)
g_product="Shorewall" g_product="Shorewall"
g_family=4 g_family=4
g_tool= g_tool=iptables
g_lite= g_lite=
;; ;;
shorewall6) shorewall6)
g_product="Shorewall6" g_product="Shorewall6"
g_family=6 g_family=6
g_tool= g_tool=ip6tables
g_lite= g_lite=
;; ;;
shorewall-lite) shorewall-lite)
@@ -76,7 +68,12 @@ case $g_program in
;; ;;
esac esac
VARDIR=${VARDIR}/${g_program} if [ -z "${VARLIB}" ]; then
VARLIB=${VARDIR}
VARDIR=${VARLIB}/$g_program
elif [ -z "${VARDIR}" ]; then
VARDIR="${VARLIB}/${PRODUCT}"
fi
# #
# Conditionally produce message # Conditionally produce message
@@ -130,71 +127,6 @@ combine_list()
echo $o echo $o
} }
#
# Call this function to assert mutual exclusion with Shorewall. If you invoke the
# /sbin/shorewall program while holding mutual exclusion, you should pass "nolock" as
# the first argument. Example "shorewall nolock refresh"
#
# This function uses the lockfile utility from procmail if it exists.
# Otherwise, it uses a somewhat race-prone algorithm to attempt to simulate the
# behavior of lockfile.
#
mutex_on()
{
local try
try=0
local lockf
lockf=${LOCKFILE:=${VARDIR}/lock}
local lockpid
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
if [ $MUTEX_TIMEOUT -gt 0 ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
if [ -f $lockf ]; then
lockpid=`cat ${lockf} 2> /dev/null`
if [ -z "$lockpid" -o $lockpid = 0 ]; then
rm -f ${lockf}
error_message "WARNING: Stale lockfile ${lockf} removed"
elif ! qt ps p ${lockpid}; then
rm -f ${lockf}
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
fi
fi
if qt mywhich lockfile; then
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf}
chmod u+w ${lockf}
echo $$ > ${lockf}
chmod u-w ${lockf}
else
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
sleep 1
try=$((${try} + 1))
done
if [ ${try} -lt ${MUTEX_TIMEOUT} ] ; then
# Create the lockfile
echo $$ > ${lockf}
else
echo "Giving up on lock file ${lockf}" >&2
fi
fi
fi
}
#
# Call this function to release mutual exclusion
#
mutex_off()
{
rm -f ${LOCKFILE:=${VARDIR}/lock}
}
[ -z "$LEFTSHIFT" ] && . ${g_basedir}/lib.common
# #
# Validate an IP address # Validate an IP address
# #
@@ -323,6 +255,8 @@ ip_range_explicit() {
done done
} }
[ -z "$LEFTSHIFT" ] && . ${g_basedir}/lib.common
# #
# Netmask to VLSM # Netmask to VLSM
# #

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,7 @@ get_script_version() { # $1 = script
temp=$( $SHOREWALL_SHELL $1 version | tail -n 1 | sed 's/-.*//' ) temp=$( $SHOREWALL_SHELL $1 version | tail -n 1 | sed 's/-.*//' )
if [ $? -ne 0 ]; then if [ -z "$temp" ]; then
version=0 version=0
else else
ifs=$IFS ifs=$IFS
@@ -593,7 +593,7 @@ find_first_interface_address() # $1 = interface
# #
[ -n "$addr" ] || startup_error "Can't determine the IP address of $1" [ -n "$addr" ] || startup_error "Can't determine the IP address of $1"
# #
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link) # Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
# along with everything else on the line # along with everything else on the line
# #
echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//' echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//'
@@ -717,3 +717,69 @@ truncate() # $1 = length
{ {
cut -b -${1} cut -b -${1}
} }
#
# Call this function to assert mutual exclusion with Shorewall. If you invoke the
# /sbin/shorewall program while holding mutual exclusion, you should pass "nolock" as
# the first argument. Example "shorewall nolock refresh"
#
# This function uses the lockfile utility from procmail if it exists.
# Otherwise, it uses a somewhat race-prone algorithm to attempt to simulate the
# behavior of lockfile.
#
mutex_on()
{
local try
try=0
local lockf
lockf=${LOCKFILE:=${VARDIR}/lock}
local lockpid
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
if [ $MUTEX_TIMEOUT -gt 0 ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
if [ -f $lockf ]; then
lockpid=`cat ${lockf} 2> /dev/null`
if [ -z "$lockpid" -o $lockpid = 0 ]; then
rm -f ${lockf}
error_message "WARNING: Stale lockfile ${lockf} removed"
elif [ $lockpid -eq $$ ]; then
return 0
elif ! qt ps p ${lockpid}; then
rm -f ${lockf}
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
fi
fi
if qt mywhich lockfile; then
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf}
chmod u+w ${lockf}
echo $$ > ${lockf}
chmod u-w ${lockf}
else
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
sleep 1
try=$((${try} + 1))
done
if [ ${try} -lt ${MUTEX_TIMEOUT} ] ; then
# Create the lockfile
echo $$ > ${lockf}
else
echo "Giving up on lock file ${lockf}" >&2
fi
fi
fi
}
#
# Call this function to release mutual exclusion
#
mutex_off()
{
rm -f ${LOCKFILE:=${VARDIR}/lock}
}

View File

@@ -17,4 +17,4 @@ ANNOTATED= #Unused on OS X
SYSTEMD= #Unused on OS X SYSTEMD= #Unused on OS X
SYSCONFDIR= #Unused on OS X SYSCONFDIR= #Unused on OS X
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR. SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.
VARDIR=/var/lib #Unused on OS X VARLIB=/var/lib #Unused on OS X

View File

@@ -17,4 +17,5 @@ ANNOTATED= #If non-zero, annotated configuration fil
SYSCONFDIR= #Directory where SysV init parameter files are installed SYSCONFDIR= #Directory where SysV init parameter files are installed
SYSTEMD= #Directory where .service files are installed (systems running systemd only) SYSTEMD= #Directory where .service files are installed (systems running systemd only)
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
VARDIR=/var/lib #Directory where product variable data is stored. VARLIB=/var/lib #Directory where product variable data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.

View File

@@ -16,5 +16,5 @@ INITSOURCE= #Unused on Cygwin
ANNOTATED= #Unused on Cygwin ANNOTATED= #Unused on Cygwin
SYSTEMD= #Unused on Cygwin SYSTEMD= #Unused on Cygwin
SYSCONFDIR= #Unused on Cygwin SYSCONFDIR= #Unused on Cygwin
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR. SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.
VARDIR=/var/lib #Unused on Cygwin VARLIB=/var/lib #Unused on Cygwin

View File

@@ -18,4 +18,5 @@ SYSCONFFILE=default.debian #Name of the distributed file to be inst
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
SYSTEMD= #Directory where .service files are installed (systems running systemd only) SYSTEMD= #Directory where .service files are installed (systems running systemd only)
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
VARDIR=/var/lib #Directory where product variable data is stored. VARLIB=/var/lib #Directory where product variable data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.

View File

@@ -10,7 +10,7 @@ PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl mod
CONFDIR=/etc #Directory where subsystem configurations are installed CONFDIR=/etc #Directory where subsystem configurations are installed
SBINDIR=/sbin #Directory where system administration programs are installed SBINDIR=/sbin #Directory where system administration programs are installed
MANDIR=${PREFIX}/man #Directory where manpages are installed. MANDIR=${PREFIX}/man #Directory where manpages are installed.
INITDIR=etc/init.d #Directory where SysV init scripts are installed. INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
INITFILE=$PRODUCT #Name of the product's installed SysV init script INITFILE=$PRODUCT #Name of the product's installed SysV init script
INITSOURCE=init.sh #Name of the distributed file to be installed as the SysV init script INITSOURCE=init.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed ANNOTATED= #If non-zero, annotated configuration files are installed
@@ -18,4 +18,5 @@ SYSTEMD= #Directory where .service files are inst
SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR
SYSCONFDIR= #Directory where SysV init parameter files are installed SYSCONFDIR= #Directory where SysV init parameter files are installed
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
VARDIR=/var/lib #Directory where product variable data is stored. VARLIB=/var/lib #Directory where product variable data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.

View File

@@ -18,4 +18,5 @@ SYSTEMD=/lib/systemd/system #Directory where .service files are inst
SYSCONFFILE=sysconfig #Name of the distributed file to be installed as $SYSCONFDIR/$PRODUCT SYSCONFFILE=sysconfig #Name of the distributed file to be installed as $SYSCONFDIR/$PRODUCT
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
VARDIR=/var/lib #Directory where product variable data is stored. VARLIB=/var/lib #Directory where product variable data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.

View File

@@ -11,12 +11,13 @@ CONFDIR=/etc #Directory where subsystem configurat
SBINDIR=/sbin #Directory where system administration programs are installed SBINDIR=/sbin #Directory where system administration programs are installed
MANDIR=${PREFIX}/man #Directory where manpages are installed. MANDIR=${PREFIX}/man #Directory where manpages are installed.
INITDIR=/etc/rc.d #Directory where SysV init scripts are installed. INITDIR=/etc/rc.d #Directory where SysV init scripts are installed.
INITSOURCE=init.slackware.firewall.sh #Name of the distributed file to be installed as the SysV init script AUXINITSOURCE=init.slackware.firewall.sh #Name of the distributed file to be installed as the SysV init script
INITFILE=rc.firewall #Name of the product's installed SysV init script AUXINITFILE=rc.firewall #Name of the product's installed SysV init script
AUXINITSOURCE=init.slackware.$PRODUCT.sh #Name of the distributed file to be installed as a second SysV init script INITSOURCE=init.slackware.$PRODUCT.sh #Name of the distributed file to be installed as a second SysV init script
AUXINITFILE=rc.$PRODUCT #Name of the product's installed second init script INITFILE=rc.$PRODUCT #Name of the product's installed second init script
SYSTEMD= #Name of the directory where .service files are installed (systems running systemd only) SYSTEMD= #Name of the directory where .service files are installed (systems running systemd only)
SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR
SYSCONFDIR= #Name of the directory where SysV init parameter files are installed. SYSCONFDIR= #Name of the directory where SysV init parameter files are installed.
ANNOTATED= #If non-empty, install annotated configuration files ANNOTATED= #If non-empty, install annotated configuration files
VARDIR=/var/lib #Directory where product variable data is stored. VARLIB=/var/lib #Directory where product variable data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.

View File

@@ -12,10 +12,11 @@ SBINDIR=/sbin #Directory where system ad
MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed. MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed.
INITDIR=/etc/init.d #Directory where SysV init scripts are installed. INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
INITFILE=$PRODUCT #Name of the product's SysV init script INITFILE=$PRODUCT #Name of the product's SysV init script
INITSOURCE=init.sh #Name of the distributed file to be installed as the SysV init script INITSOURCE=init.suse.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed ANNOTATED= #If non-zero, annotated configuration files are installed
SYSTEMD= #Directory where .service files are installed (systems running systemd only) SYSTEMD= #Directory where .service files are installed (systems running systemd only)
SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
VARDIR=/var/lib #Directory where persistent product data is stored. VARLIB=/var/lib #Directory where persistent product data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.

View File

@@ -22,6 +22,21 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
setstatedir() {
local statedir
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile
fi
fi
}
Debian_SuSE_ppp() { Debian_SuSE_ppp() {
NEWPRODUCTS= NEWPRODUCTS=
INTERFACE="$1" INTERFACE="$1"
@@ -106,15 +121,11 @@ if [ -f /etc/debian_version ]; then
else else
exit 0 exit 0
fi fi
case "$PHASE" in
pre-*)
exit 0
;;
esac
;; ;;
esac esac
elif [ -f /etc/SuSE-release ]; then elif [ -f /etc/SuSE-release ]; then
PHASE=''
case $0 in case $0 in
/etc/ppp*) /etc/ppp*)
# #
@@ -146,6 +157,8 @@ else
# #
# Assume RedHat/Fedora/CentOS/Foobar/... # Assume RedHat/Fedora/CentOS/Foobar/...
# #
PHASE=''
case $0 in case $0 in
/etc/ppp*) /etc/ppp*)
INTERFACE="$1" INTERFACE="$1"
@@ -186,20 +199,14 @@ else
esac esac
fi fi
[ -n "$LOGFILE" ] || LOGFILE=/dev/null
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
# setstatedir
# For backward compatibility, lib.base appends the product name to VARDIR
# Save it here and restore it below if [ -x $VARLIB/$PRODUCT/firewall ]; then
# ( ${VARLIB}/$PRODUCT/firewall -V0 $COMMAND $INTERFACE >> $LOGFILE 2>&1 ) || true
save_vardir=${VARDIR}
if [ -x $VARDIR/$PRODUCT/firewall ]; then
( . ${SHAREDIR}/shorewall/lib.base
mutex_on
${VARDIR}/firewall -V0 $COMMAND $INTERFACE || echo_notdone
mutex_off
)
fi fi
VARDIR=${save_vardir}
done done
exit 0 exit 0

View File

@@ -62,11 +62,29 @@ not_configured () {
exit 0 exit 0
} }
# set the STATEDIR variable
setstatedir() {
local statedir
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile
fi
fi
}
# #
# The installer may alter this # The installer may alter this
# #
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc
vardir=$VARDIR
# check if shorewall-init is configured or not # check if shorewall-init is configured or not
if [ -f "$SYSCONFDIR/shorewall-init" ] if [ -f "$SYSCONFDIR/shorewall-init" ]
then then
@@ -81,27 +99,27 @@ fi
# Initialize the firewall # Initialize the firewall
shorewall_start () { shorewall_start () {
local product local PRODUCT
local VARDIR local STATEDIR
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 setstatedir
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile
fi
fi
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
# #
# Run in a sub-shell to avoid name collisions # Run in a sub-shell to avoid name collisions
# #
( (
. /usr/share/$product/lib.base if ! ${VARDIR}/$PRODUCT/firewall status > /dev/null 2>&1; then
# ${VARDIR}/$PRODUCT/firewall stop || echo_notdone
# 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 fi
mutex_off
) )
fi fi
done done
@@ -113,19 +131,21 @@ 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 setstatedir
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
( . /usr/share/$product/lib.base if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
mutex_on ${SBINDIR}/$PRODUCT compile
${VARDIR}/firewall clear || echo_notdone fi
mutex_off fi
)
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
${VARDIR}/$PRODUCT/firewall clear || echo_notdone
fi fi
done done

71
Shorewall-init/init.fedora.sh Normal file → Executable file
View File

@@ -14,13 +14,8 @@
# prior to bringing up the network. # prior to bringing up the network.
### END INIT INFO ### END INIT INFO
#determine where the files were installed #determine where the files were installed
if [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1 . /usr/share/shorewall/shorewallrc
else
SBINDIR=/sbin
SYSCONFDIR=/etc/default
VARDIR=/var/lib
fi
prog="shorewall-init" prog="shorewall-init"
logger="logger -i -t $prog" logger="logger -i -t $prog"
@@ -29,6 +24,8 @@ lockfile="/var/lock/subsys/shorewall-init"
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
vardir=$VARDIR
# Get startup options (override default) # Get startup options (override default)
OPTIONS= OPTIONS=
@@ -40,9 +37,25 @@ else
exit 6 exit 6
fi fi
# set the STATEDIR variable
setstatedir() {
local statedir
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile
fi
fi
}
# Initialize the firewall # Initialize the firewall
start () { start () {
local product local PRODUCT
local vardir local vardir
if [ -z "$PRODUCTS" ]; then if [ -z "$PRODUCTS" ]; then
@@ -52,11 +65,19 @@ start () {
fi fi
echo -n "Initializing \"Shorewall-based firewalls\": " echo -n "Initializing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if [ -x ${VARDIR}/$product/firewall ]; then setstatedir
${VARDIR}/$product/firewall stop 2>&1 | $logger
if [ ! -x ${VARDIR}/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile
fi
fi
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
${VARDIR}/$PRODUCT/firewall stop 2>&1 | $logger
retval=${PIPESTATUS[0]} retval=${PIPESTATUS[0]}
[ retval -ne 0 ] && break [ $retval -ne 0 ] && break
fi fi
done done
@@ -72,15 +93,23 @@ start () {
# Clear the firewall # Clear the firewall
stop () { 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
if [ -x ${VARDIR}/$product/firewall ]; then setstatedir
${VARDIR}/$product/firewall clear 2>&1 | $logger
if [ ! -x ${VARDIR}/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile
fi
fi
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
${VARDIR}/$PRODUCT/firewall clear 2>&1 | $logger
retval=${PIPESTATUS[0]} retval=${PIPESTATUS[0]}
[ retval -ne 0 ] && break [ $retval -ne 0 ] && break
fi fi
done done
@@ -107,19 +136,15 @@ case "$1" in
status_q || exit 0 status_q || exit 0
$1 $1
;; ;;
restart|reload|force-reload) restart|reload|force-reload|condrestart|try-restart)
echo "Not implemented" echo "Not implemented"
exit 3 exit 3
;; ;;
condrestart|try-restart)
echo "Not implemented"
exit 3
;;
status) status)
status $prog status $prog
;; ;;
*) *)
echo "Usage: /etc/init.d/shorewall-init {start|stop}" echo "Usage: /etc/init.d/shorewall-init {start|stop|status}"
exit 1 exit 1
esac esac

View File

@@ -58,16 +58,34 @@ fi
# #
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc
# Locate the current PRODUCT's statedir
setstatedir() {
local statedir
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile $STATEDIR/firewall
fi
fi
}
# Initialize the firewall # Initialize the firewall
shorewall_start () { shorewall_start () {
local PRODUCT local PRODUCT
local VARDIR local STATEDIR
echo -n "Initializing \"Shorewall-based firewalls\": " echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if [ -x ${VARDIR}/firewall ]; then setstatedir
if [ -x ${STATEDIR}/firewall ]; then
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
${VARDIR}/firewall stop || echo_notdone ${STATEDIR}/firewall stop || echo_notdone
fi fi
fi fi
done done
@@ -86,6 +104,14 @@ shorewall_stop () {
echo -n "Clearing \"Shorewall-based firewalls\": " echo -n "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
setstatedir
if [ ! -x ${VARDIR}/firewall ]; then
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile
fi
fi
if [ -x ${VARDIR}/firewall ]; then if [ -x ${VARDIR}/firewall ]; then
${VARDIR}/firewall clear || exit 1 ${VARDIR}/firewall clear || exit 1
fi fi

135
Shorewall-init/init.suse.sh Executable file
View File

@@ -0,0 +1,135 @@
#! /bin/bash
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2010,2012 - Tom Eastep (teastep@shorewall.net)
#
# On most distributions, this file should be called /etc/init.d/shorewall.
#
# Complete documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#
### BEGIN INIT INFO
# Provides: shorewall-init
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Initialize the firewall at boot time
# Description: Place the firewall in a safe state at boot time
# prior to bringing up the network.
### END INIT INFO
if [ "$(id -u)" != "0" ]
then
echo "You must be root to start, stop or restart \"Shorewall \"."
exit 1
fi
# check if shorewall-init is configured or not
if [ -f "/etc/sysconfig/shorewall-init" ]
then
. /etc/sysconfig/shorewall-init
if [ -z "$PRODUCTS" ]
then
exit 0
fi
else
exit 0
fi
#
# The installer may alter this
#
. /usr/share/shorewall/shorewallrc
# set the STATEDIR variable
setstatedir() {
local statedir
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
if [ ! -x $STATEDIR/firewall ]; then
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
${SBINDIR}/$PRODUCT compile
fi
fi
}
# Initialize the firewall
shorewall_start () {
local PRODUCT
local STATEDIR
echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x $STATEDIR/firewall ]; then
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
$STATEDIR/$PRODUCT/firewall stop || echo_notdone
fi
fi
done
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
ipset -R < "$SAVE_IPSETS"
fi
return 0
}
# Clear the firewall
shorewall_stop () {
local PRODUCT
local STATEDIR
echo -n "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
setstatedir
if [ -x ${STATEDIR}/firewall ]; then
${STATEDIR}/firewall clear || exit 1
fi
done
if [ -n "$SAVE_IPSETS" ]; then
mkdir -p $(dirname "$SAVE_IPSETS")
if ipset -S > "${SAVE_IPSETS}.tmp"; then
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
fi
fi
return 0
}
case "$1" in
start)
shorewall_start
;;
stop)
shorewall_stop
;;
*)
echo "Usage: /etc/init.d/shorewall-init {start|stop}"
exit 1
esac
exit 0

View File

@@ -160,7 +160,14 @@ else
usage 1 usage 1
fi fi
for var in SHAREDIR LIBEXECDIR CONFDIR SBINDIR VARDIR; do if [ -z "${VARLIB}" ]; then
VARLIB=${VARDIR}
VARDIR=${VARLIB}/${PRODUCT}
elif [ -z "${VARDIR}" ]; then
VARDIR=${VARLIB}/${PRODUCT}
fi
for var in SHAREDIR LIBEXECDIR CONFDIR SBINDIR VARLIB VARDIR; do
require $var require $var
done done
@@ -260,6 +267,11 @@ else
first_install="Yes" first_install="Yes"
fi fi
if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
fi
# #
# Install the Firewall Script # Install the Firewall Script
# #
@@ -280,6 +292,7 @@ fi
if [ -n "$SYSTEMD" ]; then if [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}${SYSTEMD} mkdir -p ${DESTDIR}${SYSTEMD}
run_install $OWNERSHIP -m 600 shorewall-init.service ${DESTDIR}${SYSTEMD}/shorewall-init.service run_install $OWNERSHIP -m 600 shorewall-init.service ${DESTDIR}${SYSTEMD}/shorewall-init.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SYSTEMD}/shorewall-init.service
echo "Service file installed as ${DESTDIR}${SYSTEMD}/shorewall-init.service" echo "Service file installed as ${DESTDIR}${SYSTEMD}/shorewall-init.service"
if [ -n "$DESTDIR" ]; then if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}${SBINDIR} mkdir -p ${DESTDIR}${SBINDIR}
@@ -292,27 +305,35 @@ fi
# #
# Create /usr/share/shorewall-init if needed # Create /usr/share/shorewall-init if needed
# #
mkdir -p ${DESTDIR}/usr/share/shorewall-init mkdir -p ${DESTDIR}${SHAREDIR}/shorewall-init
chmod 755 ${DESTDIR}/usr/share/shorewall-init chmod 755 ${DESTDIR}${SHAREDIR}/shorewall-init
#
# Install logrotate file
#
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
fi
# #
# Create the version file # Create the version file
# #
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall-init/version echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/shorewall-init/version
chmod 644 ${DESTDIR}/usr/share/shorewall-init/version chmod 644 ${DESTDIR}${SHAREDIR}/shorewall-init/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
if [ -z "$DESTDIR" ]; then if [ -z "$DESTDIR" ]; then
rm -f /usr/share/shorewall-init/init rm -f ${SHAREDIR}/shorewall-init/init
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/shorewall-init/init ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/shorewall-init/init
fi fi
if [ $HOST = debian ]; then if [ $HOST = debian ]; then
if [ -n "${DESTDIR}" ]; then if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}/etc/network/if-up.d/ mkdir -p ${DESTDIR}/etc/network/if-up.d/
mkdir -p ${DESTDIR}/etc/network/if-post-down.d/ mkdir -p ${DESTDIR}/etc/network/if-down.d/
fi fi
if [ ! -f ${DESTDIR}/etc/default/shorewall-init ]; then if [ ! -f ${DESTDIR}/etc/default/shorewall-init ]; then
@@ -347,7 +368,7 @@ fi
cp ifupdown.sh ifupdown cp ifupdown.sh ifupdown
d[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
@@ -360,6 +381,7 @@ fi
case $HOST in case $HOST in
debian) debian)
install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544 install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-down.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544 install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
;; ;;
suse) suse)
@@ -382,12 +404,12 @@ if [ -z "$DESTDIR" ]; then
if [ -n "$first_install" ]; then if [ -n "$first_install" ]; then
if [ $HOST = debian ]; then if [ $HOST = debian ]; then
update-rc.d shorewall-init defaults update-rc.d shorewall-init enable
echo "Shorewall Init will start automatically at boot" echo "Shorewall Init will start automatically at boot"
else else
if [ -n "$SYSTEMD" ]; then if [ -n "$SYSTEMD" ]; then
if systemctl enable shorewall-init; then if systemctl enable shorewall-init.service; then
echo "Shorewall Init will start automatically at boot" echo "Shorewall Init will start automatically at boot"
fi fi
elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then

5
Shorewall-init/logrotate Normal file
View File

@@ -0,0 +1,5 @@
/var/log/shorewall-ifupdown.log {
missingok
notifempty
create 0600 root root
}

View File

@@ -16,3 +16,8 @@ IFUPDOWN=0
# during 'start' and will save them there during 'stop'. # during 'start' and will save them there during 'stop'.
# #
SAVE_IPSETS="" SAVE_IPSETS=""
#
# Where Up/Down events get logged
#
LOGFILE=/var/log/shorewall-ifupdown.log

View File

@@ -23,7 +23,7 @@ export SHOREWALL_INIT_SCRIPT
test -x $SRWL || exit 0 test -x $SRWL || exit 0
test -x $WAIT_FOR_IFUP || exit 0 test -x $WAIT_FOR_IFUP || exit 0
test -n "$INITLOG" || { test -n "$INITLOG" || {
echo "INITLOG cannot be empty, please configure $0" ; echo "INITLOG cannot be empty, please configure $0" ;
exit 1; exit 1;
} }
@@ -35,9 +35,9 @@ fi
echo_notdone () { echo_notdone () {
if [ "$INITLOG" = "/dev/null" ] ; then if [ "$INITLOG" = "/dev/null" ] ; then
echo "not done." echo "not done."
else else
echo "not done (check $INITLOG)." echo "not done (check $INITLOG)."
fi fi

10
Shorewall-lite/init.fedora.sh Normal file → Executable file
View File

@@ -41,10 +41,10 @@ start() {
echo -n $"Starting Shorewall: " echo -n $"Starting Shorewall: "
$shorewall $OPTIONS start 2>&1 | $logger $shorewall $OPTIONS start 2>&1 | $logger
retval=${PIPESTATUS[0]} retval=${PIPESTATUS[0]}
if [[ $retval == 0 ]]; then if [[ $retval == 0 ]]; then
touch $lockfile touch $lockfile
success success
else else
failure failure
fi fi
echo echo
@@ -55,10 +55,10 @@ stop() {
echo -n $"Stopping Shorewall: " echo -n $"Stopping Shorewall: "
$shorewall $OPTIONS stop 2>&1 | $logger $shorewall $OPTIONS stop 2>&1 | $logger
retval=${PIPESTATUS[0]} retval=${PIPESTATUS[0]}
if [[ $retval == 0 ]]; then if [[ $retval == 0 ]]; then
rm -f $lockfile rm -f $lockfile
success success
else else
failure failure
fi fi
echo echo
@@ -71,7 +71,7 @@ restart() {
echo -n $"Restarting Shorewall: " echo -n $"Restarting Shorewall: "
$shorewall $OPTIONS restart 2>&1 | $logger $shorewall $OPTIONS restart 2>&1 | $logger
retval=${PIPESTATUS[0]} retval=${PIPESTATUS[0]}
if [[ $retval == 0 ]]; then if [[ $retval == 0 ]]; then
touch $lockfile touch $lockfile
success success
else # Failed to start, clean up lock file if present else # Failed to start, clean up lock file if present

92
Shorewall-lite/init.suse.sh Executable file
View File

@@ -0,0 +1,92 @@
#!/bin/sh
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012 - Tom Eastep (teastep@shorewall.net)
#
# On most distributions, this file should be called /etc/init.d/shorewall.
#
# Complete documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# If an error occurs while starting or restarting the firewall, the
# firewall is automatically stopped.
#
# Commands are:
#
# shorewall start Starts the firewall
# shorewall restart Restarts the firewall
# shorewall reload Reload the firewall
# (same as restart)
# shorewall stop Stops the firewall
# shorewall status Displays firewall status
#
### BEGIN INIT INFO
# Provides: shorewall-lite
# Required-Start: $network $remote_fs
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: starts and stops the shorewall firewall
# Short-Description: Packet filtering firewall
### END INIT INFO
################################################################################
# Give Usage Information #
################################################################################
usage() {
echo "Usage: $0 start|stop|reload|restart|status"
exit 1
}
################################################################################
# Get startup options (override default)
################################################################################
OPTIONS=
#
# The installer may alter this
#
. /usr/share/shorewall/shorewallrc
if [ -f ${SYSCONFDIR}/shorewall-lite ]; then
. ${SYSCONFDIR}/shorewall-lite
fi
SHOREWALL_INIT_SCRIPT=1
################################################################################
# E X E C U T I O N B E G I N S H E R E #
################################################################################
command="$1"
case "$command" in
start)
exec ${SBINDIR}/shorewall-lite $OPTIONS start $STARTOPTIONS
;;
restart|reload)
exec ${SBINDIR}/shorewall-lite $OPTIONS restart $RESTARTOPTIONS
;;
status|stop)
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $@
;;
*)
usage
;;
esac

View File

@@ -33,7 +33,7 @@ usage() # $1 = exit status
exit $1 exit $1
} }
fatal_error() fatal_error()
{ {
echo " ERROR: $@" >&2 echo " ERROR: $@" >&2
exit 1 exit 1
@@ -91,7 +91,7 @@ install_file() # $1 = source $2 = target $3 = mode
run_install $T $OWNERSHIP -m $3 $1 ${2} run_install $T $OWNERSHIP -m $3 $1 ${2}
} }
require() require()
{ {
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set" eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
} }
@@ -118,7 +118,7 @@ while [ $finished -eq 0 ] ; do
case "$1" in case "$1" in
-*) -*)
option=${option#-} option=${option#-}
while [ -n "$option" ]; do while [ -n "$option" ]; do
case $option in case $option in
h) h)
@@ -171,7 +171,14 @@ else
usage 1 usage 1
fi fi
for var in SHAREDIR LIBEXECDIRDIRDIR CONFDIR SBINDIR VARDIR; do if [ -z "${VARLIB}" ]; then
VARLIB=${VARDIR}
VARDIR=${VARLIB}/${PRODUCT}
elif [ -z "${VARDIR}" ]; then
VARDIR=${VARLIB}/${PRODUCT}
fi
for var in SHAREDIR LIBEXECDIRDIRDIR CONFDIR SBINDIR VARLIB VARDIR; do
require $var require $var
done done
@@ -182,7 +189,6 @@ PATH=${SBINDIR}:/bin:/usr${SBINDIR}:/usr/bin:/usr/local/bin:/usr/local${SBINDIR}
# #
cygwin= cygwin=
INSTALLD='-D' INSTALLD='-D'
INITFILE=$PRODUCT
T='-T' T='-T'
if [ -z "$BUILD" ]; then if [ -z "$BUILD" ]; then
@@ -253,7 +259,10 @@ case "$HOST" in
archlinux) archlinux)
echo "Installing ArchLinux-specific configuration..." echo "Installing ArchLinux-specific configuration..."
;; ;;
linux|suse) suse)
echo "Installing Suse-specific configuration..."
;;
linux)
;; ;;
*) *)
echo "ERROR: Unknown HOST \"$HOST\"" >&2 echo "ERROR: Unknown HOST \"$HOST\"" >&2
@@ -268,24 +277,14 @@ if [ -n "$DESTDIR" ]; then
echo "Not setting file owner/group permissions, not running as root." echo "Not setting file owner/group permissions, not running as root."
OWNERSHIP="" OWNERSHIP=""
fi fi
install -d $OWNERSHIP -m 755 ${DESTDIR}/${SBINDIR} install -d $OWNERSHIP -m 755 ${DESTDIR}/${SBINDIR}
install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR} install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
if [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}/lib/systemd/system
INITFILE=
fi
else else
if [ ! -f /usr/share/shorewall/coreversion ]; then if [ ! -f /usr/share/shorewall/coreversion ]; then
echo "$PRODUCT $VERSION requires Shorewall Core which does not appear to be installed" >&2 echo "$PRODUCT $VERSION requires Shorewall Core which does not appear to be installed" >&2
exit 1 exit 1
fi fi
if [ -f /lib/systemd/system ]; then
SYSTEMD=Yes
INITFILE=
fi
fi fi
echo "Installing $Product Version $VERSION" echo "Installing $Product Version $VERSION"
@@ -303,8 +302,8 @@ if [ -z "$DESTDIR" -a -d ${CONFDIR}/$PRODUCT ]; then
mv -f ${CONFDIR}/$PRODUCT/shorewall.conf ${CONFDIR}/$PRODUCT/$PRODUCT.conf mv -f ${CONFDIR}/$PRODUCT/shorewall.conf ${CONFDIR}/$PRODUCT/$PRODUCT.conf
else else
rm -rf ${DESTDIR}${CONFDIR}/$PRODUCT rm -rf ${DESTDIR}${CONFDIR}/$PRODUCT
rm -rf ${DESTDIR}/usr/share/$PRODUCT rm -rf ${DESTDIR}${SHAREDIR}/$PRODUCT
rm -rf ${DESTDIR}/var/lib/$PRODUCT rm -rf ${DESTDIR}${VARDIR}
[ "$LIBEXECDIR" = /usr/share ] || rm -rf ${DESTDIR}/usr/share/$PRODUCT/wait4ifup ${DESTDIR}/usr/share/$PRODUCT/shorecap [ "$LIBEXECDIR" = /usr/share ] || rm -rf ${DESTDIR}/usr/share/$PRODUCT/wait4ifup ${DESTDIR}/usr/share/$PRODUCT/shorecap
fi fi
@@ -327,9 +326,9 @@ echo "$Product control program installed in ${DESTDIR}${SBINDIR}/$PRODUCT"
# Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed # Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed
# #
mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT
mkdir -p ${DESTDIR}/usr/share/$PRODUCT mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT
mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT
mkdir -p ${DESTDIR}/var/lib/$PRODUCT mkdir -p ${DESTDIR}${VARDIR}
chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT
chmod 755 ${DESTDIR}/usr/share/$PRODUCT chmod 755 ${DESTDIR}/usr/share/$PRODUCT
@@ -354,7 +353,9 @@ fi
# Install the .service file # Install the .service file
# #
if [ -n "$SYSTEMD" ]; then if [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}${SYSTEMD}
run_install $OWNERSHIP -m 600 $PRODUCT.service ${DESTDIR}/${SYSTEMD}/$PRODUCT.service run_install $OWNERSHIP -m 600 $PRODUCT.service ${DESTDIR}/${SYSTEMD}/$PRODUCT.service
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SYSTEMD}/$PRODUCT.service
echo "Service file installed as ${DESTDIR}/lib/systemd/system/$PRODUCT.service" echo "Service file installed as ${DESTDIR}/lib/systemd/system/$PRODUCT.service"
fi fi
@@ -403,6 +404,7 @@ echo "Common functions linked through ${DESTDIR}${SHAREDIR}/$PRODUCT/functions"
# #
install_file shorecap ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap 0755 install_file shorecap ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap 0755
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${LIBEXECDIR}/$PRODUCT/shorecap
echo echo
echo "Capability file builder installed in ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap" echo "Capability file builder installed in ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap"
@@ -498,7 +500,7 @@ if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
perl -p -w -i -e 's/^STARTUP_ENABLED=No/STARTUP_ENABLED=Yes/;s/^IP_FORWARDING=On/IP_FORWARDING=Keep/;s/^SUBSYSLOCK=.*/SUBSYSLOCK=/;' ${CONFDIR}/${PRODUCT}/${PRODUCT}.conf perl -p -w -i -e 's/^STARTUP_ENABLED=No/STARTUP_ENABLED=Yes/;s/^IP_FORWARDING=On/IP_FORWARDING=Keep/;s/^SUBSYSLOCK=.*/SUBSYSLOCK=/;' ${CONFDIR}/${PRODUCT}/${PRODUCT}.conf
update-rc.d $PRODUCT enable defaults update-rc.d $PRODUCT enable defaults
elif [ -n "$SYSTEMD" ]; then elif [ -n "$SYSTEMD" ]; then
if systemctl enable $PRODUCT; then if systemctl enable ${PRODUCT}.service; then
echo "$Product will start automatically at boot" echo "$Product will start automatically at boot"
fi fi
elif mywhich insserv; then elif mywhich insserv; then

View File

@@ -337,6 +337,8 @@
<arg choice="plain"><option>show</option></arg> <arg choice="plain"><option>show</option></arg>
<arg><option>-b</option></arg>
<arg><option>-x</option></arg> <arg><option>-x</option></arg>
<arg><option>-l</option></arg> <arg><option>-l</option></arg>
@@ -841,6 +843,12 @@
Netfilter table to display. The default is <emphasis Netfilter table to display. The default is <emphasis
role="bold">filter</emphasis>.</para> role="bold">filter</emphasis>.</para>
<para>The <emphasis role="bold">-b</emphasis> ('brief') option
causes rules which have not been used (i.e. which have zero
packet and byte counts) to be omitted from the output. Chains
with no rules displayed are also omitted from the
output.</para>
<para>The <emphasis role="bold">-l</emphasis> option causes <para>The <emphasis role="bold">-l</emphasis> option causes
the rule number for each Netfilter rule to be the rule number for each Netfilter rule to be
displayed.</para> displayed.</para>

View File

@@ -45,17 +45,19 @@
# used during firewall compilation, then the generated firewall program will likewise not # used during firewall compilation, then the generated firewall program will likewise not
# require Shorewall to be installed. # require Shorewall to be installed.
SHAREDIR=/usr/share/shorewall-lite
VARDIR=/var/lib/shorewall-lite
CONFDIR=/etc/shorewall-lite
g_program=shorewall-lite
g_product="Shorewall Lite"
g_family=4
g_base=shorewall
g_basedir=/usr/share/shorewall-lite
. /usr/share/shorewall-lite/lib.base g_program=shorewall-lite
. /usr/share/shorewall/lib.cli
#
# This is modified by the installer when ${SHAREDIR} != /usr/share
#
. /usr/share/shorewall/shorewallrc
g_sharedir="$SHAREDIR"/shorewall-lite
g_confdir="$CONFDIR"/shorewall-lite
g_readrc=1
. ${SHAREDIR}/shorewall/lib.cli
. /usr/share/shorewall-lite/configpath . /usr/share/shorewall-lite/configpath
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin [ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin

View File

@@ -4,7 +4,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011 - # (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011 -
# Tom Eastep (teastep@shorewall.net) # Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at http://www.shorewall.net
@@ -25,17 +25,15 @@
# For a list of supported commands, type 'shorewall help' or 'shorewall6 help' # For a list of supported commands, type 'shorewall help' or 'shorewall6 help'
# #
################################################################################################ ################################################################################################
g_program=shorewall-lite PRODUCT=shorewall-lite
# #
# This is modified by the installer when ${SHAREDIR} != /usr/share # This is modified by the installer when ${SHAREDIR} != /usr/share
# #
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc
g_libexec="$LIBEXECDIR" g_program=$PRODUCT
g_sharedir="$SHAREDIR"/shorewall-lite g_sharedir="$SHAREDIR"/shorewall-lite
g_sbindir="$SBINDIR"
g_vardir="$VARDIR"
g_confdir="$CONFDIR"/shorewall-lite g_confdir="$CONFDIR"/shorewall-lite
g_readrc=1 g_readrc=1

View File

@@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# /etc/shorewall-lite/shorewall-lite.conf Version 4 - Change the following # /etc/shorewall-lite/shorewall-lite.conf Version 4 - Change the following
# variables to override the values in the shorewall.conf file used to # variables to override the values in the shorewall.conf file used to
# compile /var/lib/shorewall-lite/firewall. Those values may be found in # compile /var/lib/shorewall-lite/firewall. Those values may be found in
# /var/lib/shorewall-lite/firewall.conf. # /var/lib/shorewall-lite/firewall.conf.

View File

@@ -13,8 +13,8 @@ Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/shorewall-lite EnvironmentFile=-/etc/sysconfig/shorewall-lite
StandardOutput=syslog StandardOutput=syslog
ExecStart=/sbin/shorewall-lite $OPTIONS start ExecStart=/usr/sbin/shorewall-lite $OPTIONS start
ExecStop=/sbin/shorewall-lite $OPTIONS stop ExecStop=/usr/sbin/shorewall-lite $OPTIONS stop
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@@ -8,9 +8,16 @@
# files from those nodes. # files from those nodes.
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 10080
?if ( __CT_TARGET && ! $AUTOHELPERS && __AMANDA_HELPER )
PARAM - - udp 10080 ; helper=amanda
?else
PARAM - - udp 10080
?endif
PARAM - - tcp 10080 PARAM - - tcp 10080
# #
# You may also need this rule. With AMANDA 2.4.4 on Linux kernel 2.6, # You may also need this rule. With AMANDA 2.4.4 on Linux kernel 2.6,

View File

@@ -8,4 +8,8 @@
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
$BLACKLIST_DISPOSITION:$BLACKLIST_LOGLEVEL ?if $BLACKLIST_LOGLEVEL
blacklog
?else
$BLACKLIST_DISPOSITION
?endif

View File

@@ -6,6 +6,11 @@
# This macro handles FTP traffic. # This macro handles FTP traffic.
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 21 ?if ( __CT_TARGET && ! $AUTOHELPERS && __FTP_HELPER )
PARAM - - tcp 21 ; helper=ftp
?else
PARAM - - tcp 21
?endif

View File

@@ -6,6 +6,12 @@
# This macro handles IRC traffic (Internet Relay Chat). # This macro handles IRC traffic (Internet Relay Chat).
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 6667
?if ( __CT_TARGET && ! $AUTOHELPERS && __IRC_HELPER )
PARAM - - tcp 6667 ; helper=irc
?else
PARAM - - tcp 6667
?endif

View File

@@ -0,0 +1,11 @@
#
# Shorewall version 4 - MSSQL Macro
#
# /usr/share/shorewall/macro.MSSQL
#
# This macro handles MSSQL (Microsoft SQL Server)
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 1433

View File

@@ -6,8 +6,14 @@
# This macro handles PPTP traffic. # This macro handles PPTP traffic.
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - 47 PARAM - - 47
PARAM DEST SOURCE 47 PARAM DEST SOURCE 47
PARAM - - tcp 1723
?if ( __CT_TARGET && ! $AUTOHELPERS && __PPTP_HELPER )
PARAM - - tcp 1723 ; helper=pptp
?else
PARAM - - tcp 1723
?endif

View File

@@ -0,0 +1,12 @@
#
# Shorewall version 4 - Puppet Macro
#
# /usr/share/shorewall/macro.Puppet
#
# This macro handles client-to-server for the Puppet configuration
# management system.
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 8140

View File

@@ -6,9 +6,16 @@
# This macro handles SANE network scanning. # This macro handles SANE network scanning.
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 6566
?if ( __CT_TARGET && ! $AUTOHELPERS && __SANE_HELPER )
PARAM - - tcp 6566 ; helper=sane
?else
PARAM - - tcp 6566
?endif
# #
# Kernels 2.6.23+ has nf_conntrack_sane module which will handle # Kernels 2.6.23+ has nf_conntrack_sane module which will handle
# sane data connection. # sane data connection.

View File

@@ -0,0 +1,17 @@
#
# Shorewall version 4 - SIP Macro
#
# /usr/share/shorewall/macro.SIP
#
# This macro handles SIP traffic.
#
###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
?if ( __CT_TARGET && ! $AUTOHELPERS && __SIP_HELPER )
PARAM - - udp 5060 ; helper=sip
?else
PARAM - - udp 5060
?endif

View File

@@ -10,9 +10,17 @@
# between hosts you fully trust. # between hosts you fully trust.
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 135,445 PARAM - - udp 135,445
PARAM - - udp 137:139
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
PARAM - - udp 137 ; helper=netbios-ns
PARAM - - udp 138:139
?else
PARAM - - udp 137:139
?endif
PARAM - - udp 1024: 137 PARAM - - udp 1024: 137
PARAM - - tcp 135,139,445 PARAM - - tcp 135,139,445

View File

@@ -10,13 +10,28 @@
# allow SMB traffic between hosts you fully trust. # allow SMB traffic between hosts you fully trust.
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 135,445 PARAM - - udp 135,445
PARAM - - udp 137:139
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
PARAM - - udp 137 ; helper=netbios-ns
PARAM - - udp 138:139
?else
PARAM - - udp 137:139
?endif
PARAM - - udp 1024: 137 PARAM - - udp 1024: 137
PARAM - - tcp 135,139,445 PARAM - - tcp 135,139,445
PARAM DEST SOURCE udp 135,445 PARAM DEST SOURCE udp 135,445
PARAM DEST SOURCE udp 137:139
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
PARAM DEST SOURCE udp 137 ; helper=netbios-ns
PARAM DEST SOURCE udp 138:139
?else
PARAM DEST SOURCE udp 137:139
?endif
PARAM DEST SOURCE udp 1024: 137 PARAM DEST SOURCE udp 1024: 137
PARAM DEST SOURCE tcp 135,139,445 PARAM DEST SOURCE tcp 135,139,445

View File

@@ -3,10 +3,17 @@
# #
# /usr/share/shorewall/macro.SNMP # /usr/share/shorewall/macro.SNMP
# #
# This macro handles SNMP traffic (including traps). # This macro handles SNMP traffic.
#
# Note: To allow SNMP Traps, use the SNMPTrap macro
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 161:162
PARAM - - tcp 161 ?if ( __CT_TARGET && ! $AUTOHELPERS && __SNMP_HELPER )
PARAM - - udp 161 ; helper=snmp
?else
PARAM - - udp 161
?endif

View File

@@ -0,0 +1,12 @@
#
# Shorewall version 4 - SNMP Trap Macro
#
# /usr/share/shorewall/macro.SNMP
#
# This macro handles SNMP traps.
#
###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 162

View File

@@ -8,6 +8,12 @@
# Internet. # Internet.
# #
############################################################################### ###############################################################################
FORMAT 2
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP # PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 69
?if ( __CT_TARGET && ! $AUTOHELPERS && __TFTP_HELPER )
PARAM - - udp 69 ; helper=tftp
?else
PARAM - - udp 69
?endif

View File

@@ -0,0 +1,11 @@
#
# Shorewall version 4 - Teredo Macro
#
# /usr/share/shorewall/macro.Teredo
#
# This macro handles Teredo IPv6 over UDP tunneling traffic
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 3544

View File

@@ -1,9 +1,11 @@
# #
# Shorewall version 4 - Multicast DNS Macro # Shorewall version 4 - Multicast DNS Macro -- this macro assumes that only
# the DEST zone sends mDNS queries. If both zones send
# queries, use the mDNSbi macro.
# #
# /usr/share/shorewall/macro.mDNS # /usr/share/shorewall/macro.mDNS
# #
# This macro handles multicast DNS traffic. # This macro handles multicast DNS traffic
# #
############################################################################### ###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/ #ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/

View File

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

View File

@@ -71,9 +71,17 @@
# Remaining Any value in the rules file REPLACES the value # Remaining Any value in the rules file REPLACES the value
# columns given in the macro file. # columns given in the macro file.
# #
# Multiple parameters may be passed to a macro. Within this file, $1 refers to the first parameter,
# $2 to the second an so on. $1 is a synonym for PARAM but may be used anywhere in the file whereas
# PARAM may only be used in the ACTION column.
#
# You can specify default values for parameters by using DEFAULT or DEFAULTS entry:
#
# DEFAULTS <default for $1>,<default for $2>,...
#
####################################################################################################### #######################################################################################################
# DO NOT REMOVE THE FOLLOWING LINE # DO NOT REMOVE THE FOLLOWING LINE
FORMAT 2 FORMAT 2
#################################################################################################################################################################### #################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT PORT(S) DEST LIMIT GROUP # PORT PORT(S) DEST LIMIT GROUP

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<includepath />

View File

@@ -46,6 +46,7 @@ my $jumpchainref;
my %accountingjumps; my %accountingjumps;
my $asection; my $asection;
my $defaultchain; my $defaultchain;
my $ipsecdir;
my $defaultrestriction; my $defaultrestriction;
my $restriction; my $restriction;
my $accounting_commands = { COMMENT => 0, SECTION => 2 }; my $accounting_commands = { COMMENT => 0, SECTION => 2 };
@@ -85,13 +86,14 @@ sub initialize() {
# The section number is initialized to a value less thatn LEGACY. It will be set to LEGACY if a # The section number is initialized to a value less thatn LEGACY. It will be set to LEGACY if a
# the first non-commentary line in the accounting file isn't a section header # the first non-commentary line in the accounting file isn't a section header
# #
# This allows the section header processor to quickly check for correct order # This allows the section header processor to quickly check for correct order
# #
$asection = -1; $asection = -1;
# #
# These are the legacy values # These are the legacy values
# #
$defaultchain = 'accounting'; $defaultchain = 'accounting';
$ipsecdir = '';
$defaultrestriction = NO_RESTRICT; $defaultrestriction = NO_RESTRICT;
$sectionname = ''; $sectionname = '';
} }
@@ -111,20 +113,25 @@ sub process_section ($) {
if ( $sectionname eq 'INPUT' ) { if ( $sectionname eq 'INPUT' ) {
$defaultchain = 'accountin'; $defaultchain = 'accountin';
$ipsecdir = 'in';
$defaultrestriction = INPUT_RESTRICT; $defaultrestriction = INPUT_RESTRICT;
} elsif ( $sectionname eq 'OUTPUT' ) { } elsif ( $sectionname eq 'OUTPUT' ) {
$defaultchain = 'accountout'; $defaultchain = 'accountout';
$ipsecdir = 'out';
$defaultrestriction = OUTPUT_RESTRICT; $defaultrestriction = OUTPUT_RESTRICT;
} elsif ( $sectionname eq 'FORWARD' ) { } elsif ( $sectionname eq 'FORWARD' ) {
$defaultchain = 'accountfwd'; $defaultchain = 'accountfwd';
$ipsecdir = '';
$defaultrestriction = NO_RESTRICT; $defaultrestriction = NO_RESTRICT;
} else { } else {
fatal_error "The $sectionname SECTION is not allowed when ACCOUNTING_TABLE=filter" unless $acctable eq 'mangle'; fatal_error "The $sectionname SECTION is not allowed when ACCOUNTING_TABLE=filter" unless $acctable eq 'mangle';
if ( $sectionname eq 'PREROUTING' ) { if ( $sectionname eq 'PREROUTING' ) {
$defaultchain = 'accountpre'; $defaultchain = 'accountpre';
$ipsecdir = 'in';
$defaultrestriction = PREROUTE_RESTRICT; $defaultrestriction = PREROUTE_RESTRICT;
} else { } else {
$defaultchain = 'accountpost'; $defaultchain = 'accountpost';
$ipsecdir = 'out';
$defaultrestriction = POSTROUTE_RESTRICT; $defaultrestriction = POSTROUTE_RESTRICT;
} }
} }
@@ -194,7 +201,7 @@ sub process_accounting_rule( ) {
$ports = '' if $ports eq 'any' || $ports eq 'all'; $ports = '' if $ports eq 'any' || $ports eq 'all';
$sports = '' if $sports eq 'any' || $sports eq 'all'; $sports = '' if $sports eq 'any' || $sports eq 'all';
fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT; fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT;
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} ) . do_headers( $headers ); my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} ) . do_headers( $headers );
my $rule2 = 0; my $rule2 = 0;
@@ -229,6 +236,11 @@ sub process_accounting_rule( ) {
} }
} elsif ( $action =~ /^NFLOG/ ) { } elsif ( $action =~ /^NFLOG/ ) {
$target = validate_level $action; $target = validate_level $action;
} elsif ( $action =~ /^NFACCT\((\w+)\)$/ ) {
require_capability 'NFACCT_MATCH', 'The NFACCT action', 's';
$nfobjects{$1} = 1;
$target = '';
$rule .= "-m nfacct --nfacct-name $1 ";
} else { } else {
( $action, my $cmd ) = split /:/, $action; ( $action, my $cmd ) = split /:/, $action;
@@ -250,7 +262,7 @@ sub process_accounting_rule( ) {
if ( $source eq 'any' || $source eq 'all' ) { if ( $source eq 'any' || $source eq 'all' ) {
$source = ALLIP; $source = ALLIP;
} else { } else {
fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT || ! $asection ); fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT || ! $asection );
} }
@@ -285,11 +297,25 @@ sub process_accounting_rule( ) {
} }
my $chainref = $chain_table{$config{ACCOUNTING_TABLE}}{$chain}; my $chainref = $chain_table{$config{ACCOUNTING_TABLE}}{$chain};
my $dir; my $dir = $ipsecdir;
if ( $asection && $ipsec ne '-' ) {
if ( $ipsecdir ) {
fatal_error "Invalid IPSEC ($ipsec)" if $ipsec =~ /^(?:in|out)\b/;
} else {
if ( $ipsec =~ s/^(?:(in|out)\b)// ) {
$dir = $1;
} else {
fatal_error q(IPSEC rules in the $asection section require that the value begin with 'in' or 'out');
}
}
$rule .= do_ipsec( $dir, $ipsec );
}
if ( ! $chainref ) { if ( ! $chainref ) {
if ( reserved_chain_name( $chain ) ) { if ( reserved_chain_name( $chain ) ) {
fatal_error "May not use chain $chain in the $sectionname section" if $asection && $chain ne $defaultchain; fatal_error "May not use chain $chain in the $sectionname section" if $asection && $chain ne $defaultchain;
$chainref = ensure_accounting_chain $chain, 0 , $restriction; $chainref = ensure_accounting_chain $chain, 0 , $restriction;
} elsif ( $asection ) { } elsif ( $asection ) {
fatal_error "Unknown accounting chain ($chain)"; fatal_error "Unknown accounting chain ($chain)";
@@ -297,28 +323,32 @@ sub process_accounting_rule( ) {
$chainref = ensure_accounting_chain $chain, 0 , $restriction; $chainref = ensure_accounting_chain $chain, 0 , $restriction;
} }
$dir = ipsec_chain_name( $chain ); unless ( $asection ) {
$dir = ipsec_chain_name( $chain );
if ( $ipsec ne '-' ) { if ( $ipsec ne '-' ) {
if ( $dir ) { if ( $dir ) {
$rule .= do_ipsec( $dir, $ipsec ); $rule .= do_ipsec( $dir, $ipsec );
$chainref->{ipsec} = $dir; $chainref->{ipsec} = $dir;
} else {
fatal_error "Adding an IPSEC rule to an unreferenced accounting chain is not allowed";
}
} else { } else {
fatal_error "Adding an IPSEC rule to an unreferenced accounting chain is not allowed"; warning_message "Adding rule to unreferenced accounting chain $chain" unless reserved_chain_name( $chain );
$chainref->{ipsec} = $dir;
} }
} else {
warning_message "Adding rule to unreferenced accounting chain $chain" unless reserved_chain_name( $chain );
$chainref->{ipsec} = $dir;
} }
} else { } else {
fatal_error "$chain is not an accounting chain" unless $chainref->{accounting}; fatal_error "$chain is not an accounting chain" unless $chainref->{accounting};
if ( $ipsec ne '-' ) { unless ( $asection ) {
$dir = $chainref->{ipsec}; if ( $ipsec ne '-' ) {
fatal_error "Adding an IPSEC rule into a non-IPSEC chain is not allowed" unless $dir; $dir = $chainref->{ipsec};
$rule .= do_ipsec( $dir , $ipsec ); fatal_error "Adding an IPSEC rule into a non-IPSEC chain is not allowed" unless $dir;
} elsif ( $asection ) { $rule .= do_ipsec( $dir , $ipsec );
$restriction |= $chainref->{restriction}; } elsif ( $asection ) {
$restriction |= $chainref->{restriction};
}
} }
} }
@@ -338,7 +368,7 @@ sub process_accounting_rule( ) {
} }
fatal_error "$chain is not an accounting chain" unless $chainref->{accounting}; fatal_error "$chain is not an accounting chain" unless $chainref->{accounting};
$restriction = $dir eq 'in' ? INPUT_RESTRICT : OUTPUT_RESTRICT if $dir; $restriction = $dir eq 'in' ? INPUT_RESTRICT : OUTPUT_RESTRICT if $dir;
expand_rule expand_rule
@@ -366,7 +396,6 @@ sub process_accounting_rule( ) {
} else { } else {
$jumpchainref->{ipsec} = $chainref->{ipsec}; $jumpchainref->{ipsec} = $chainref->{ipsec};
} }
} }
if ( $rule2 ) { if ( $rule2 ) {
@@ -394,7 +423,7 @@ sub setup_accounting() {
my $nonEmpty = 0; my $nonEmpty = 0;
$nonEmpty |= process_accounting_rule while read_a_line; $nonEmpty |= process_accounting_rule while read_a_line( NORMAL_READ );
clear_comment; clear_comment;

File diff suppressed because it is too large Load Diff

View File

@@ -34,7 +34,6 @@ use Shorewall::Accounting;
use Shorewall::Rules; use Shorewall::Rules;
use Shorewall::Proc; use Shorewall::Proc;
use Shorewall::Proxyarp; use Shorewall::Proxyarp;
use Shorewall::IPAddrs;
use Shorewall::Raw; use Shorewall::Raw;
use Shorewall::Misc; use Shorewall::Misc;
@@ -54,8 +53,8 @@ my $family;
# #
# Initilize the package-globals in the other modules # Initilize the package-globals in the other modules
# #
sub initialize_package_globals( $$ ) { sub initialize_package_globals( $$$ ) {
Shorewall::Config::initialize($family, $_[1]); Shorewall::Config::initialize($family, $_[1], $_[2]);
Shorewall::Chains::initialize ($family, 1, $export ); Shorewall::Chains::initialize ($family, 1, $export );
Shorewall::Zones::initialize ($family, $_[0]); Shorewall::Zones::initialize ($family, $_[0]);
Shorewall::Nat::initialize; Shorewall::Nat::initialize;
@@ -158,7 +157,7 @@ sub generate_script_2() {
push_indent; push_indent;
if ( $shorewallrc{TEMPDIR} ) { if ( $shorewallrc1{TEMPDIR} ) {
emit( '', emit( '',
qq(TMPDIR="$shorewallrc{TEMPDIR}") , qq(TMPDIR="$shorewallrc{TEMPDIR}") ,
q(export TMPDIR) ); q(export TMPDIR) );
@@ -168,14 +167,14 @@ sub generate_script_2() {
emit( 'g_family=4' ); emit( 'g_family=4' );
if ( $export ) { if ( $export ) {
emit ( qq(g_confdir=$shorewallrc{CONFDIR}/shorewall-lite), emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall-lite),
'g_product="Shorewall Lite"', 'g_product="Shorewall Lite"',
'g_program=shorewall-lite', 'g_program=shorewall-lite',
'g_basedir=/usr/share/shorewall-lite', 'g_basedir=/usr/share/shorewall-lite',
qq(CONFIG_PATH="$shorewallrc{CONFDIR}/shorewall-lite:$shorewallrc{SHAREDIR}/shorewall-lite") , qq(CONFIG_PATH="$shorewallrc1{CONFDIR}/shorewall-lite:$shorewallrc1{SHAREDIR}/shorewall-lite") ,
); );
} else { } else {
emit ( qq(g_confdir=$shorewallrc{CONFDIR}/shorewall), emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall),
'g_product=Shorewall', 'g_product=Shorewall',
'g_program=shorewall', 'g_program=shorewall',
'g_basedir=/usr/share/shorewall', 'g_basedir=/usr/share/shorewall',
@@ -186,14 +185,14 @@ sub generate_script_2() {
emit( 'g_family=6' ); emit( 'g_family=6' );
if ( $export ) { if ( $export ) {
emit ( qq(g_confdir=$shorewallrc{CONFDIR}/shorewall6-lite), emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall6-lite),
'g_product="Shorewall6 Lite"', 'g_product="Shorewall6 Lite"',
'g_program=shorewall6-lite', 'g_program=shorewall6-lite',
'g_basedir=/usr/share/shorewall6', 'g_basedir=/usr/share/shorewall6',
qq(CONFIG_PATH="$shorewallrc{CONFDIR}/shorewall6-lite:$shorewallrc{SHAREDIR}/shorewall6-lite") , qq(CONFIG_PATH="$shorewallrc1{CONFDIR}/shorewall6-lite:$shorewallrc{SHAREDIR}/shorewall6-lite") ,
); );
} else { } else {
emit ( qq(g_confdir=$shorewallrc{CONFDIR}/shorewall6), emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall6),
'g_product=Shorewall6', 'g_product=Shorewall6',
'g_program=shorewall6', 'g_program=shorewall6',
'g_basedir=/usr/share/shorewall', 'g_basedir=/usr/share/shorewall',
@@ -202,21 +201,9 @@ sub generate_script_2() {
} }
} }
emit( '[ -f ${g_confdir}/vardir ] && . ${g_confdir}/vardir' ); emit ( '[ -f ${g_confdir}/vardir ] && . ${g_confdir}/vardir' );
emit ( qq([ -n "\${VARDIR:=$shorewallrc1{VARDIR}}" ]) );
if ( $family == F_IPV4 ) { emit ( qq([ -n "\${VARLIB:=$shorewallrc1{VARLIB}}" ]) );
if ( $export ) {
emit ( '[ -n "${VARDIR:=' . $shorewallrc{VARDIR} . '/shorewall-lite}" ]' );
} else {
emit ( '[ -n "${VARDIR:=' . $shorewallrc{VARDIR} . '/shorewall}" ]' );
}
} else {
if ( $export ) {
emit ( '[ -n "${VARDIR:=' . $shorewallrc{VARDIR} . '/shorewall6-lite}" ]' );
} else {
emit ( '[ -n "${VARDIR:=' . $shorewallrc{VARDIR} . '/shorewall6}" ]' );
}
}
emit 'TEMPFILE='; emit 'TEMPFILE=';
@@ -354,7 +341,7 @@ sub generate_script_3($) {
emit 'cat > ${VARDIR}/.modules << EOF'; emit 'cat > ${VARDIR}/.modules << EOF';
open_file $fn; open_file $fn;
emit_unindented $currentline while read_a_line; emit_unindented $currentline while read_a_line( NORMAL_READ );
emit_unindented 'EOF'; emit_unindented 'EOF';
emit '', 'reload_kernel_modules < ${VARDIR}/.modules'; emit '', 'reload_kernel_modules < ${VARDIR}/.modules';
@@ -368,6 +355,7 @@ sub generate_script_3($) {
emit ''; emit '';
load_ipsets; load_ipsets;
create_nfobjects;
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
emit ( 'if [ "$COMMAND" = refresh ]; then' , emit ( 'if [ "$COMMAND" = refresh ]; then' ,
@@ -425,7 +413,7 @@ sub generate_script_3($) {
emit 'cat > ${VARDIR}/proxyarp << __EOF__'; emit 'cat > ${VARDIR}/proxyarp << __EOF__';
} else { } else {
emit 'cat > ${VARDIR}/proxyndp << __EOF__'; emit 'cat > ${VARDIR}/proxyndp << __EOF__';
} }
dump_proxy_arp; dump_proxy_arp;
emit_unindented '__EOF__'; emit_unindented '__EOF__';
@@ -471,49 +459,56 @@ sub generate_script_3($) {
fatal_error "$iptables_save_file does not exist" fatal_error "$iptables_save_file does not exist"
fi fi
EOF EOF
pop_indent; push_indent;
setup_load_distribution; setup_load_distribution;
setup_forwarding( $family , 1 ); setup_forwarding( $family , 1 );
push_indent; pop_indent;
my $config_dir = $globals{CONFIGDIR}; my $config_dir = $globals{CONFIGDIR};
emit<<"EOF"; emit<<"EOF";
set_state Started $config_dir set_state Started $config_dir
run_restored_exit run_restored_exit
else elif [ \$COMMAND = refresh ]; then
if [ \$COMMAND = refresh ]; then chainlist_reload
chainlist_reload
EOF EOF
push_indent;
setup_load_distribution; setup_load_distribution;
setup_forwarding( $family , 0 ); setup_forwarding( $family , 0 );
pop_indent;
emit( ' run_refreshed_exit' , #
' do_iptables -N shorewall' , # Use a parameter list rather than 'here documents' to avoid an extra blank line
" set_state Started $config_dir" , #
' else' , emit(
' setup_netfilter' ); ' run_refreshed_exit',
' do_iptables -N shorewall',
" set_state Started $config_dir",
' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall',
'else',
' setup_netfilter'
);
push_indent;
setup_load_distribution; setup_load_distribution;
pop_indent;
emit<<"EOF"; emit<<'EOF';
conditionally_flush_conntrack conditionally_flush_conntrack
EOF EOF
push_indent;
initialize_switches;
setup_forwarding( $family , 0 ); setup_forwarding( $family , 0 );
pop_indent;
emit<<"EOF"; emit<<"EOF";
run_start_exit run_start_exit
do_iptables -N shorewall do_iptables -N shorewall
set_state Started $config_dir set_state Started $config_dir
run_started_exit [ \$0 = \${VARDIR}/firewall ] || cp -f \$(my_pathname) \${VARDIR}/firewall
fi run_started_exit
fi
EOF EOF
emit<<'EOF'; emit<<'EOF';
[ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall
fi
date > ${VARDIR}/restarted date > ${VARDIR}/restarted
case $COMMAND in case $COMMAND in
@@ -545,8 +540,8 @@ EOF
# #
sub compiler { sub compiler {
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path, $shorewallrc ) = my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path, $shorewallrc , $shorewallrc1 ) =
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '' , ''); ( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '' , '/usr/share/shorewall/shorewallrc', '' );
$export = 0; $export = 0;
$test = 0; $test = 0;
@@ -578,13 +573,14 @@ sub compiler {
log => { store => \$log }, log => { store => \$log },
log_verbosity => { store => \$log_verbosity, validate => \&validate_verbosity } , log_verbosity => { store => \$log_verbosity, validate => \&validate_verbosity } ,
test => { store => \$test }, test => { store => \$test },
preview => { store => \$preview, validate=> \&validate_boolean } , preview => { store => \$preview, validate=> \&validate_boolean } ,
confess => { store => \$confess, validate=> \&validate_boolean } , confess => { store => \$confess, validate=> \&validate_boolean } ,
update => { store => \$update, validate=> \&validate_boolean } , update => { store => \$update, validate=> \&validate_boolean } ,
convert => { store => \$convert, validate=> \&validate_boolean } , convert => { store => \$convert, validate=> \&validate_boolean } ,
annotate => { store => \$annotate, validate=> \&validate_boolean } , annotate => { store => \$annotate, validate=> \&validate_boolean } ,
config_path => { store => \$config_path } , config_path => { store => \$config_path } ,
shorewallrc => { store => \$shorewallrc } , shorewallrc => { store => \$shorewallrc } ,
shorewallrc1 => { store => \$shorewallrc1 } ,
); );
# #
# P A R A M E T E R P R O C E S S I N G # P A R A M E T E R P R O C E S S I N G
@@ -602,7 +598,7 @@ sub compiler {
# #
# Now that we know the address family (IPv4/IPv6), we can initialize the other modules' globals # Now that we know the address family (IPv4/IPv6), we can initialize the other modules' globals
# #
initialize_package_globals( $update, $shorewallrc ); initialize_package_globals( $update, $shorewallrc, $shorewallrc1 );
set_config_path( $config_path ) if $config_path; set_config_path( $config_path ) if $config_path;
@@ -665,11 +661,6 @@ sub compiler {
# (Produces no output to the compiled script) # (Produces no output to the compiled script)
# #
process_policies; process_policies;
#
# N O T R A C K
# (Produces no output to the compiled script)
#
setup_notrack;
enable_script; enable_script;
@@ -709,6 +700,14 @@ sub compiler {
# #
setup_proxy_arp; setup_proxy_arp;
emit( "#\n# Disable automatic helper association on kernel 3.5.0 and later\n#" ,
'if [ -f /proc/sys/net/netfilter/nf_conntrack_helper ]; then' ,
' progress_message "Disabling Kernel Automatic Helper Association"',
" echo 0 > /proc/sys/net/netfilter/nf_conntrack_helper",
'fi',
''
);
if ( $scriptfilename || $debug ) { if ( $scriptfilename || $debug ) {
emit 'return 0'; emit 'return 0';
pop_indent; pop_indent;
@@ -788,6 +787,10 @@ sub compiler {
# #
process_rules( $convert ); process_rules( $convert );
# #
# Process the conntrack file
#
setup_conntrack;
#
# Add Tunnel rules. # Add Tunnel rules.
# #
setup_tunnels; setup_tunnels;
@@ -812,16 +815,16 @@ sub compiler {
optimize_level0; optimize_level0;
if ( $config{OPTIMIZE} & 0x1E ) { if ( ( my $optimize = $config{OPTIMIZE} ) & 0x1E ) {
progress_message2 'Optimizing Ruleset...'; progress_message2 'Optimizing Ruleset...';
# #
# Optimize Policy Chains # Optimize Policy Chains
# #
optimize_policy_chains if $config{OPTIMIZE} & 2; optimize_policy_chains if ( $optimize & OPTIMIZE_POLICY_MASK2n4 ) == OPTIMIZE_POLICY_MASK; # Level 2 but not 4
# #
# More Optimization # More Optimization
# #
optimize_ruleset if $config{OPTIMIZE} & 0x1C; optimize_ruleset if $config{OPTIMIZE} & OPTIMIZE_RULESET_MASK;
} }
enable_script; enable_script;
@@ -877,16 +880,16 @@ sub compiler {
optimize_level0; optimize_level0;
if ( $config{OPTIMIZE} & OPTIMIZE_MASK ) { if ( ( my $optimize = $config{OPTIMIZE} & OPTIMIZE_MASK ) ) {
progress_message2 'Optimizing Ruleset...'; progress_message2 'Optimizing Ruleset...';
# #
# Optimize Policy Chains # Optimize Policy Chains
# #
optimize_policy_chains if $config{OPTIMIZE} & OPTIMIZE_POLICY_MASK; optimize_policy_chains if ( $optimize & OPTIMIZE_POLICY_MASK2n4 ) == OPTIMIZE_POLICY_MASK; # Level 2 but not 4
# #
# Ruleset Optimization # Ruleset Optimization
# #
optimize_ruleset if $config{OPTIMIZE} & OPTIMIZE_RULESET_MASK; optimize_ruleset if $optimize & OPTIMIZE_RULESET_MASK;
} }
enable_script if $debug; enable_script if $debug;
@@ -911,6 +914,7 @@ sub compiler {
# call that function during normal 'check', we must validate routestopped here. # call that function during normal 'check', we must validate routestopped here.
# #
process_routestopped; process_routestopped;
process_stoppedrules;
} }
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {

File diff suppressed because it is too large Load Diff

View File

@@ -26,13 +26,13 @@
# #
package Shorewall::IPAddrs; package Shorewall::IPAddrs;
require Exporter; require Exporter;
use Shorewall::Config qw( :DEFAULT split_list require_capability in_hex8 numeric_value F_IPV4 F_IPV6 ); use Shorewall::Config qw( :DEFAULT split_list require_capability in_hex8 numeric_value F_IPV4 F_IPV6 :protocols );
use Socket; use Socket;
use strict; use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( ALLIPv4 our @EXPORT = ( qw( ALLIPv4
ALLIPv6 ALLIPv6
NILIPv4 NILIPv4
NILIPv6 NILIPv6
@@ -48,14 +48,6 @@ our @EXPORT = qw( ALLIPv4
ALLIP ALLIP
NILIP NILIP
ALL ALL
TCP
UDP
UDPLITE
ICMP
DCCP
IPv6_ICMP
SCTP
GRE
validate_address validate_address
validate_net validate_net
@@ -80,7 +72,7 @@ our @EXPORT = qw( ALLIPv4
validate_port_list validate_port_list
validate_icmp validate_icmp
validate_icmp6 validate_icmp6
); ) );
our @EXPORT_OK = qw( ); our @EXPORT_OK = qw( );
our $VERSION = 'MODULEVERSION'; our $VERSION = 'MODULEVERSION';
@@ -115,14 +107,7 @@ use constant { ALLIPv4 => '0.0.0.0/0' ,
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, };
TCP => 6,
UDP => 17,
DCCP => 33,
GRE => 47,
IPv6_ICMP => 58,
SCTP => 132,
UDPLITE => 136 };
my @rfc1918_networks = ( "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" ); my @rfc1918_networks = ( "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" );
@@ -222,11 +207,13 @@ sub validate_4net( $$ ) {
} }
if ( defined wantarray ) { if ( defined wantarray ) {
assert ( ! $allow_name );
if ( wantarray ) { if ( wantarray ) {
assert( ! $allow_name );
( decodeaddr( $net ) , $vlsm ); ( decodeaddr( $net ) , $vlsm );
} elsif ( valid_4address $net ) {
$vlsm == 32 ? $net : "$net/$vlsm";
} else { } else {
"$net/$vlsm"; $net;
} }
} }
} }
@@ -241,6 +228,8 @@ sub validate_4range( $$ ) {
my $last = decodeaddr $high; my $last = decodeaddr $high;
fatal_error "Invalid IP Range ($low-$high)" unless $first <= $last; fatal_error "Invalid IP Range ($low-$high)" unless $first <= $last;
"$low-$high";
} }
sub validate_4host( $$ ) { sub validate_4host( $$ ) {
@@ -293,9 +282,9 @@ sub compare_nets( $$ ) {
@net1 = decompose_net( $_[0] ); @net1 = decompose_net( $_[0] );
@net2 = decompose_net( $_[1] ); @net2 = decompose_net( $_[1] );
$net1[0] eq $net2[0] && $net1[1] == $net2[1]; $net1[0] eq $net2[0] && $net1[1] == $net2[1];
} }
sub allipv4() { sub allipv4() {
@allipv4; @allipv4;
@@ -392,7 +381,7 @@ sub validate_portpair( $$ ) {
$what = 'port'; $what = 'port';
} }
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
defined $protonum && ( $protonum == TCP || defined $protonum && ( $protonum == TCP ||
$protonum == UDP || $protonum == UDP ||
$protonum == SCTP || $protonum == SCTP ||
@@ -423,7 +412,7 @@ sub validate_portpair1( $$ ) {
$what = 'port'; $what = 'port';
} }
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
defined $protonum && ( $protonum == TCP || defined $protonum && ( $protonum == TCP ||
$protonum == UDP || $protonum == UDP ||
$protonum == SCTP || $protonum == SCTP ||
@@ -623,7 +612,7 @@ sub validate_6address( $$ ) {
sub validate_6net( $$ ) { sub validate_6net( $$ ) {
my ($net, $vlsm, $rest) = split( '/', $_[0], 3 ); my ($net, $vlsm, $rest) = split( '/', $_[0], 3 );
my $allow_name = $_[1]; my $allow_name = $_[0];
if ( $net =~ /\+(\[?)/ ) { if ( $net =~ /\+(\[?)/ ) {
if ( $1 ) { if ( $1 ) {
@@ -635,22 +624,28 @@ sub validate_6net( $$ ) {
} }
} }
fatal_error "Invalid Network address ($_[0])" unless supplied $net;
$net = $1 if $net =~ /^\[(.*)\]$/;
if ( defined $vlsm ) { if ( defined $vlsm ) {
fatal_error "Invalid VLSM ($vlsm)" unless $vlsm =~ /^\d+$/ && $vlsm <= 128; fatal_error "Invalid VLSM ($vlsm)" unless $vlsm =~ /^\d+$/ && $vlsm <= 128;
fatal_error "Invalid Network address ($_[0])" if defined $rest; fatal_error "Invalid Network address ($_[0])" if defined $rest;
fatal_error "Invalid IPv6 address ($net)" unless valid_6address $net; fatal_error "Invalid IPv6 address ($net)" unless valid_6address $net;
} else { } else {
fatal_error "Invalid Network address ($_[0])" if $_[0] =~ '/' || ! defined $net; fatal_error "Invalid Network address ($_[0])" if $_[0] =~ '/';
validate_6address $net, $allow_name; validate_6address $net, $allow_name;
$vlsm = 128; $vlsm = 128;
} }
if ( defined wantarray ) { if ( defined wantarray ) {
assert ( ! $allow_name );
if ( wantarray ) { if ( wantarray ) {
assert( ! $allow_name );
( $net , $vlsm ); ( $net , $vlsm );
} elsif ( valid_6address ( $net ) ) {
$vlsm == 32 ? $net : "$net/$vlsm";
} else { } else {
"$net/$vlsm"; $net;
} }
} }
} }
@@ -697,11 +692,13 @@ sub validate_6range( $$ ) {
while ( @low ) { while ( @low ) {
my ( $l, $h) = ( shift @low, shift @high ); my ( $l, $h) = ( shift @low, shift @high );
next if hex "0x$l" == hex "0x$h"; next if hex "0x$l" == hex "0x$h";
return 1 if hex "0x$l" < hex "0x$h"; return "$low-$high" if hex "0x$l" < hex "0x$h";
last; last;
} }
fatal_error "Invalid IPv6 Range ($low-$high)"; fatal_error "Invalid IPv6 Range ($low-$high)";
} }
sub validate_6host( $$ ) { sub validate_6host( $$ ) {

File diff suppressed because it is too large Load Diff

View File

@@ -35,7 +35,11 @@ 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_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule ) ] );
our @EXPORT_OK = (); our @EXPORT_OK = ();
Exporter::export_ok_tags('rules');
our $VERSION = 'MODULEVERSION'; our $VERSION = 'MODULEVERSION';
my @addresses_to_add; my @addresses_to_add;
@@ -54,8 +58,8 @@ sub initialize() {
# #
sub process_one_masq( ) sub process_one_masq( )
{ {
my ($interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition ) = my ($interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest ) =
split_line1 'masq file', { interface => 0, source => 1, address => 2, proto => 3, port => 4, ipsec => 5, mark => 6, user => 7, switch => 8 }; split_line1 'masq file', { interface => 0, source => 1, address => 2, proto => 3, port => 4, ipsec => 5, mark => 6, user => 7, switch => 8, origdest => 9 };
if ( $interfacelist eq 'COMMENT' ) { if ( $interfacelist eq 'COMMENT' ) {
process_comment; process_comment;
@@ -119,7 +123,7 @@ sub process_one_masq( )
# #
# Handle Protocol, Ports and Condition # Handle Protocol, Ports and Condition
# #
$baserule .= do_proto( $proto, $ports, '' ) . do_condition( $condition ); $baserule .= do_proto( $proto, $ports, '' );
# #
# Handle Mark # Handle Mark
# #
@@ -154,6 +158,8 @@ sub process_one_masq( )
my $chainref = ensure_chain('nat', $pre_nat ? snat_chain $interface : masq_chain $interface); my $chainref = ensure_chain('nat', $pre_nat ? snat_chain $interface : masq_chain $interface);
$baserule .= do_condition( $condition , $chainref->{name} );
my $detectaddress = 0; my $detectaddress = 0;
my $exceptionrule = ''; my $exceptionrule = '';
my $randomize = ''; my $randomize = '';
@@ -208,7 +214,7 @@ sub process_one_masq( )
$addrlist .= "--to-source $addr "; $addrlist .= "--to-source $addr ";
$exceptionrule = do_proto( $proto, '', '' ) if $addr =~ /:/; $exceptionrule = do_proto( $proto, '', '' ) if $addr =~ /:/;
} else { } else {
my $ports = $addr; my $ports = $addr;
$ports =~ s/^://; $ports =~ s/^://;
validate_portpair1( $proto, $ports ); validate_portpair1( $proto, $ports );
$addrlist .= "--to-ports $ports "; $addrlist .= "--to-ports $ports ";
@@ -233,7 +239,7 @@ sub process_one_masq( )
$baserule . $rule , $baserule . $rule ,
$networks , $networks ,
$destnets , $destnets ,
'' , $origdest ,
$target , $target ,
'' , '' ,
'' , '' ,
@@ -276,7 +282,7 @@ sub setup_masq()
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , 'a non-empty masq file' , 's'; } ); first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , 'a non-empty masq file' , 's'; } );
process_one_masq while read_a_line; process_one_masq while read_a_line( NORMAL_READ );
clear_comment; clear_comment;
} }
@@ -373,7 +379,7 @@ sub setup_nat() {
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , 'a non-empty nat file' , 's'; } ); first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , 'a non-empty nat file' , 's'; } );
while ( read_a_line ) { while ( read_a_line( NORMAL_READ ) ) {
my ( $external, $interfacelist, $internal, $allints, $localnat ) = split_line1 'nat file', { external => 0, interface => 1, internal => 2, allints => 3, local => 4 }; my ( $external, $interfacelist, $internal, $allints, $localnat ) = split_line1 'nat file', { external => 0, interface => 1, internal => 2, allints => 3, local => 4 };
@@ -409,7 +415,7 @@ sub setup_netmap() {
first_entry "$doing $fn..."; first_entry "$doing $fn...";
while ( read_a_line ) { while ( read_a_line( NORMAL_READ ) ) {
my ( $type, $net1, $interfacelist, $net2, $net3, $proto, $dport, $sport ) = split_line 'netmap file', { type => 0, net1 => 1, interface => 2, net2 => 3, net3 => 4, proto => 5, dport => 6, sport => 7 }; my ( $type, $net1, $interfacelist, $net2, $net3, $proto, $dport, $sport ) = split_line 'netmap file', { type => 0, net1 => 1, interface => 2, net2 => 3, net3 => 4, proto => 5, dport => 6, sport => 7 };
@@ -426,9 +432,9 @@ sub setup_netmap() {
unless ( $type =~ /:/ ) { unless ( $type =~ /:/ ) {
my @rulein; my @rulein;
my @ruleout; my @ruleout;
validate_net $net1, 0; $net1 = validate_net $net1, 0;
validate_net $net2, 0; $net2 = validate_net $net2, 0;
unless ( $interfaceref->{root} ) { unless ( $interfaceref->{root} ) {
@rulein = imatch_source_dev( $interface ); @rulein = imatch_source_dev( $interface );
@@ -439,7 +445,7 @@ sub setup_netmap() {
require_capability 'NAT_ENABLED', 'Stateful NAT Entries', ''; require_capability 'NAT_ENABLED', 'Stateful NAT Entries', '';
if ( $type eq 'DNAT' ) { if ( $type eq 'DNAT' ) {
dest_iexclusion( ensure_chain( 'nat' , input_chain $interface ) , dest_iexclusion( ensure_chain( 'nat' , input_chain $interface ) ,
j => 'NETMAP' , j => 'NETMAP' ,
"--to $net2", "--to $net2",
$net1 , $net1 ,
@@ -462,13 +468,13 @@ sub setup_netmap() {
require_capability 'RAWPOST_TABLE', 'Stateless NAT Entries', ''; require_capability 'RAWPOST_TABLE', 'Stateless NAT Entries', '';
validate_net $net2, 0; $net2 = validate_net $net2, 0;
unless ( $interfaceref->{root} ) { unless ( $interfaceref->{root} ) {
@match = imatch_dest_dev( $interface ); @match = imatch_dest_dev( $interface );
$interface = $interfaceref->{name}; $interface = $interfaceref->{name};
} }
if ( $chain eq 'P' ) { if ( $chain eq 'P' ) {
$chain = prerouting_chain $interface; $chain = prerouting_chain $interface;
@match = imatch_source_dev( $iface ) unless $iface eq $interface; @match = imatch_source_dev( $iface ) unless $iface eq $interface;
@@ -481,7 +487,7 @@ sub setup_netmap() {
my $chainref = ensure_chain( $table, $chain ); my $chainref = ensure_chain( $table, $chain );
if ( $target eq 'DNAT' ) { if ( $target eq 'DNAT' ) {
dest_iexclusion( $chainref , dest_iexclusion( $chainref ,
j => 'RAWDNAT' , j => 'RAWDNAT' ,
@@ -504,7 +510,7 @@ sub setup_netmap() {
fatal_error 'TYPE must be specified' if $type eq '-'; fatal_error 'TYPE must be specified' if $type eq '-';
fatal_error "Invalid TYPE ($type)"; fatal_error "Invalid TYPE ($type)";
} }
progress_message " Network $net1 on $iface mapped to $net2 ($type)"; progress_message " Network $net1 on $iface mapped to $net2 ($type)";
} }
} }
@@ -514,6 +520,227 @@ sub setup_netmap() {
} }
#
# Called from process_rule1 to add a rule to the NAT table
#
sub handle_nat_rule( $$$$$$$$$$$$ ) {
my ( $dest, # <server>[:port]
$proto, # Protocol
$ports, # Destination port list
$origdest, # Original Destination
$action_target, # If the target is an action, the name of the log action chain to jump to
$action, # The Action
$sourceref, # Reference to the Source Zone's table entry in the Zones module
$action_chain, # Name of the action chain if the rule is in an action
$rule, # Matches
$source, # Source Address
$loglevel, # [<level>[:<tag>]]
$log_action, # Action name to include in the log message
) = @_;
my ( $server, $serverport , $origdstports ) = ( '', '', '' );
my $randomize = $dest =~ s/:random$// ? ' --random' : '';
#
# Isolate server port
#
if ( $dest =~ /^(.*)(?::(.+))$/ ) {
#
# Server IP and Port
#
$server = $1; # May be empty
$serverport = $2; # Not Empty due to RE
$origdstports = validate_port( $proto, $ports ) if $ports && $ports ne '-' && port_count( $ports ) == 1;
if ( $serverport =~ /^(\d+)-(\d+)$/ ) {
#
# Server Port Range
#
fatal_error "Invalid port range ($serverport)" unless $1 < $2;
my @ports = ( $1, $2 );
$_ = validate_port( proto_name( $proto ), $_) for ( @ports );
( $ports = $serverport ) =~ tr/-/:/;
} else {
$serverport = $ports = validate_port( proto_name( $proto ), $serverport );
}
} elsif ( $dest ne ':' ) {
#
# Simple server IP address (may be empty or "-")
#
$server = $dest;
}
#
# Generate the target
#
my $target = '';
if ( $action eq 'REDIRECT' ) {
fatal_error "A server IP address ($server) may not be specified in a REDIRECT rule" if $server;
$target = 'REDIRECT';
$target .= " --to-port $serverport" if $serverport;
if ( $origdest eq '' || $origdest eq '-' ) {
$origdest = ALLIP;
} elsif ( $origdest eq 'detect' ) {
fatal_error 'ORIGINAL DEST "detect" is invalid in an action' if $action_chain;
if ( $config{DETECT_DNAT_IPADDRS} ) {
my $interfacesref = $sourceref->{interfaces};
my @interfaces = keys %$interfacesref;
$origdest = @interfaces ? "detect:@interfaces" : ALLIP;
} else {
$origdest = ALLIP;
}
}
} elsif ( $action_target ) {
fatal_error "A server port ($serverport) is not allowed in $action rule" if $serverport;
$target = $action_target;
} else {
if ( $server eq '' ) {
fatal_error "A server and/or port must be specified in the DEST column in $action rules" unless $serverport;
} elsif ( $server =~ /^(.+)-(.+)$/ ) {
validate_range( $1, $2 );
} else {
unless ( $server eq ALLIP ) {
my @servers = validate_address $server, 1;
$server = join ',', @servers;
}
}
if ( $action eq 'DNAT' ) {
$target = $action;
if ( $server ) {
$serverport = ":$serverport" if $serverport;
for my $serv ( split /,/, $server ) {
$target .= " --to-destination ${serv}${serverport}";
}
} else {
$target .= " --to-destination :$serverport";
}
}
unless ( $origdest && $origdest ne '-' && $origdest ne 'detect' ) {
if ( ! $action_chain && $config{DETECT_DNAT_IPADDRS} ) {
my $interfacesref = $sourceref->{interfaces};
my @interfaces = keys %$interfacesref;
$origdest = @interfaces ? "detect:@interfaces" : ALLIP;
} else {
$origdest = ALLIP;
}
}
}
$target .= $randomize;
#
# And generate the nat table rule(s)
#
my $firewallsource = $sourceref && ( $sourceref->{type} & ( FIREWALL | VSERVER ) );
expand_rule ( ensure_chain ('nat' ,
( $action_chain ? $action_chain :
$firewallsource ? 'OUTPUT' :
dnat_chain $sourceref->{name} ) ) ,
$firewallsource ? OUTPUT_RESTRICT : PREROUTE_RESTRICT ,
$rule ,
$source ,
$origdest ,
'' ,
$target ,
$loglevel ,
$log_action ,
$serverport ? do_proto( $proto, '', '' ) : '',
);
( $ports, $origdstports, $server );
}
#
# Called from process_rule1() to handle the nat table part of the NONAT and ACCEPT+ actions
#
sub handle_nonat_rule( $$$$$$$$$$ ) {
my ( $action, $source, $dest, $origdest, $sourceref, $inaction, $chain, $loglevel, $log_action, $rule ) = @_;
my $sourcezone = $sourceref->{name};
#
# NONAT or ACCEPT+ may not specify a destination interface
#
fatal_error "Invalid DEST ($dest) in $action rule" if $dest =~ /:/;
$origdest = '' unless $origdest and $origdest ne '-';
if ( $origdest eq 'detect' ) {
my $interfacesref = $sourceref->{interfaces};
my $interfaces = [ ( keys %$interfacesref ) ];
$origdest = $interfaces ? "detect:@$interfaces" : ALLIP;
}
my $tgt = 'RETURN';
my $nonat_chain;
my $chn;
if ( $inaction ) {
$nonat_chain = ensure_chain( 'nat', $chain );
} elsif ( $sourceref->{type} == FIREWALL ) {
$nonat_chain = $nat_table->{OUTPUT};
} else {
$nonat_chain = ensure_chain( 'nat', dnat_chain( $sourcezone ) );
my @interfaces = keys %{zone_interfaces $sourcezone};
for ( @interfaces ) {
my $ichain = input_chain $_;
if ( $nat_table->{$ichain} ) {
#
# Static NAT is defined on this interface
#
$chn = new_chain( 'nat', newnonatchain ) unless $chn;
add_ijump $chn, j => $nat_table->{$ichain}, @interfaces > 1 ? imatch_source_dev( $_ ) : ();
}
}
if ( $chn ) {
#
# Call expand_rule() to correctly handle logging. Because
# the 'logname' argument is passed, expand_rule() will
# not create a separate logging chain but will rather emit
# any logging rule in-line.
#
expand_rule( $chn,
PREROUTE_RESTRICT,
'', # Rule
'', # Source
'', # Dest
'', # Original dest
'ACCEPT',
$loglevel,
$log_action,
'',
dnat_chain( $sourcezone ) );
$loglevel = '';
$tgt = $chn->{name};
} else {
$tgt = 'ACCEPT';
}
}
set_optflags( $nonat_chain, DONT_MOVE | DONT_OPTIMIZE ) if $tgt eq 'RETURN';
expand_rule( $nonat_chain ,
PREROUTE_RESTRICT ,
$rule ,
$source ,
$dest ,
$origdest ,
$tgt,
$loglevel ,
$log_action ,
'',
);
}
sub add_addresses () { sub add_addresses () {
if ( @addresses_to_add ) { if ( @addresses_to_add ) {
my @addrs = @addresses_to_add; my @addrs = @addresses_to_add;

View File

@@ -219,30 +219,30 @@ sub setup_forwarding( $$ ) {
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
if ( $config{IP_FORWARDING} eq 'on' ) { if ( $config{IP_FORWARDING} eq 'on' ) {
emit ' echo 1 > /proc/sys/net/ipv4/ip_forward'; emit 'echo 1 > /proc/sys/net/ipv4/ip_forward';
emit ' progress_message2 IPv4 Forwarding Enabled'; emit 'progress_message2 IPv4 Forwarding Enabled';
} elsif ( $config{IP_FORWARDING} eq 'off' ) { } elsif ( $config{IP_FORWARDING} eq 'off' ) {
emit ' echo 0 > /proc/sys/net/ipv4/ip_forward'; emit 'echo 0 > /proc/sys/net/ipv4/ip_forward';
emit ' progress_message2 IPv4 Forwarding Disabled!'; emit 'progress_message2 IPv4 Forwarding Disabled!';
} }
emit ''; emit '';
emit ( ' echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables' , emit ( 'echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables' ,
'' ''
) if have_bridges; ) if have_bridges;
} else { } else {
if ( $config{IP_FORWARDING} eq 'on' ) { if ( $config{IP_FORWARDING} eq 'on' ) {
emit ' echo 1 > /proc/sys/net/ipv6/conf/all/forwarding'; emit 'echo 1 > /proc/sys/net/ipv6/conf/all/forwarding';
emit ' progress_message2 IPv6 Forwarding Enabled'; emit 'progress_message2 IPv6 Forwarding Enabled';
} elsif ( $config{IP_FORWARDING} eq 'off' ) { } elsif ( $config{IP_FORWARDING} eq 'off' ) {
emit ' echo 0 > /proc/sys/net/ipv6/conf/all/forwarding'; emit 'echo 0 > /proc/sys/net/ipv6/conf/all/forwarding';
emit ' progress_message2 IPv6 Forwarding Disabled!'; emit 'progress_message2 IPv6 Forwarding Disabled!';
} }
emit ''; emit '';
emit ( ' echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables' , emit ( 'echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables' ,
'' ''
) if have_bridges; ) if have_bridges;
@@ -251,9 +251,6 @@ sub setup_forwarding( $$ ) {
if ( @$interfaces ) { if ( @$interfaces ) {
progress_message2 "$doing Interface forwarding..." if $first; progress_message2 "$doing Interface forwarding..." if $first;
push_indent;
push_indent;
save_progress_message 'Setting up IPv6 Interface Forwarding...'; save_progress_message 'Setting up IPv6 Interface Forwarding...';
for my $interface ( @$interfaces ) { for my $interface ( @$interfaces ) {
@@ -270,9 +267,6 @@ sub setup_forwarding( $$ ) {
" error_message \"WARNING: Cannot set IPv6 forwarding on $interface\"" ) unless $optional; " error_message \"WARNING: Cannot set IPv6 forwarding on $interface\"" ) unless $optional;
emit "fi\n"; emit "fi\n";
} }
pop_indent;
pop_indent;
} }
} }
} }
@@ -286,7 +280,7 @@ sub setup_interface_proc( $ ) {
if ( interface_has_option( $interface, 'arp_filter' , $value ) ) { if ( interface_has_option( $interface, 'arp_filter' , $value ) ) {
push @emitted, "echo $value > /proc/sys/net/ipv4/conf/$physical/arp_filter"; push @emitted, "echo $value > /proc/sys/net/ipv4/conf/$physical/arp_filter";
} }
if ( interface_has_option( $interface, 'arp_ignore' , $value ) ) { if ( interface_has_option( $interface, 'arp_ignore' , $value ) ) {
push @emitted, "echo $value > /proc/sys/net/ipv4/conf/$physical/arp_ignore"; push @emitted, "echo $value > /proc/sys/net/ipv4/conf/$physical/arp_ignore";
} }
@@ -315,6 +309,6 @@ sub setup_interface_proc( $ ) {
emit "fi\n"; emit "fi\n";
} }
} }
1; 1;

File diff suppressed because it is too large Load Diff

View File

@@ -120,7 +120,7 @@ sub setup_proxy_arp() {
my ( %set, %reset ); my ( %set, %reset );
while ( read_a_line ) { while ( read_a_line( NORMAL_READ ) ) {
my ( $address, $interface, $external, $haveroute, $persistent ) = my ( $address, $interface, $external, $haveroute, $persistent ) =
split_line $file_opt . 'file ', { address => 0, interface => 1, external => 2, haveroute => 3, persistent => 4 }; split_line $file_opt . 'file ', { address => 0, interface => 1, external => 2, haveroute => 3, persistent => 4 };

View File

@@ -20,7 +20,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# This module contains the code that handles the /etc/shorewall/notrack file. # This module contains the code that handles the /etc/shorewall/conntrack file.
# #
package Shorewall::Raw; package Shorewall::Raw;
require Exporter; require Exporter;
@@ -32,8 +32,8 @@ use Shorewall::Chains qw(:DEFAULT :internal);
use strict; use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( setup_notrack ); our @EXPORT = qw( setup_conntrack );
our @EXPORT_OK = qw( ); our @EXPORT_OK = qw( handle_helper_rule );
our $VERSION = 'MODULEVERSION'; our $VERSION = 'MODULEVERSION';
my %valid_ctevent = ( new => 1, related => 1, destroy => 1, reply => 1, assured => 1, protoinfo => 1, helper => 1, mark => 1, natseqinfo => 1, secmark => 1 ); my %valid_ctevent = ( new => 1, related => 1, destroy => 1, reply => 1, assured => 1, protoinfo => 1, helper => 1, mark => 1, natseqinfo => 1, secmark => 1 );
@@ -41,54 +41,91 @@ my %valid_ctevent = ( new => 1, related => 1, destroy => 1, reply => 1, assured
# #
# Notrack # Notrack
# #
sub process_notrack_rule( $$$$$$$ ) { sub process_conntrack_rule( $$$$$$$$$$ ) {
my ($action, $source, $dest, $proto, $ports, $sports, $user ) = @_; my ($chainref, $zoneref, $action, $source, $dest, $proto, $ports, $sports, $user, $switch ) = @_;
require_capability 'RAW_TABLE', 'conntrack rules', '';
$proto = '' if $proto eq 'any'; $proto = '' if $proto eq 'any';
$ports = '' if $ports eq 'any' || $ports eq 'all'; $ports = '' if $ports eq 'any' || $ports eq 'all';
$sports = '' if $sports eq 'any' || $sports eq 'all'; $sports = '' if $sports eq 'any' || $sports eq 'all';
( my $zone, $source) = split /:/, $source, 2; my $zone;
my $zoneref = find_zone $zone; my $restriction = PREROUTE_RESTRICT;
my $chainref = ensure_raw_chain( notrack_chain $zone );
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 or a Vserver zone' if $user ne '-' && $restriction != OUTPUT_RESTRICT; if ( $chainref ) {
require_capability 'RAW_TABLE', 'Notrack rules', ''; $restriction = OUTPUT_RESTRICT if $chainref->{name} eq 'OUTPUT';
} else {
#
# Entry in the conntrack file
#
if ( $zoneref ) {
$zone = $zoneref->{name};
} else {
($zone, $source) = split /:/, $source, 2;
$zoneref = find_zone ( $zone );
}
$chainref = ensure_raw_chain( notrack_chain $zone );
$restriction = OUTPUT_RESTRICT if $zoneref->{type} & (FIREWALL | VSERVER );
fatal_error 'USER/GROUP is not allowed unless the SOURCE zone is $FW or a Vserver zone' if $user ne '-' && $restriction != OUTPUT_RESTRICT;
}
my $target = $action; my $target = $action;
my $exception_rule = ''; my $exception_rule = '';
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ); my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_condition( $switch , $chainref->{name} );
unless ( $action eq 'NOTRACK' ) { if ( $action eq 'NOTRACK' ) {
#
# A patch that deimplements the NOTRACK target has been posted on the
# Netfilter development list
#
$action = 'CT --notrack' if have_capability 'CT_TARGET';
} elsif ( $action ne 'DROP' ) {
( $target, my ( $option, $args, $junk ) ) = split ':', $action, 4; ( $target, my ( $option, $args, $junk ) ) = split ':', $action, 4;
fatal_error "Invalid notrack ACTION ( $action )" if $junk || $target ne 'CT'; fatal_error "Invalid notrack ACTION ( $action )" if $junk || $target ne 'CT';
require_capability 'CT_TARGET', 'CT entries in the notrack file', ''; require_capability 'CT_TARGET', 'CT entries in the conntrack file', '';
if ( $option eq 'notrack' ) { if ( $option eq 'notrack' ) {
fatal_error "Invalid notrack ACTION ( $action )" if supplied $args; fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args;
$action = 'CT --notrack'; $action = 'CT --notrack';
} else { } else {
fatal_error "Invalid or missing CT option and arguments" unless supplied $option && supplied $args; fatal_error "Invalid or missing CT option and arguments" unless supplied $option && supplied $args;
if ( $option eq 'helper' ) { if ( $option eq 'helper' ) {
fatal_error "Invalid helper' ($args)" if $args =~ /,/; my $modifiers = '';
validate_helper( $args, $proto );
$action = "CT --helper $args"; if ( $args =~ /^([-\w.]+)\((.+)\)$/ ) {
$exception_rule = do_proto( $proto, '-', '-' ); $args = $1;
} elsif ( $option eq 'ctevents' ) { $modifiers = $2;
for ( split ',', $args ) {
fatal_error "Invalid 'ctevents' event ($_)" unless $valid_ctevent{$_};
} }
$action = "CT --ctevents $args"; fatal_error "Invalid helper' ($args)" if $args =~ /,/;
} elsif ( $option eq 'expevent' ) { validate_helper( $args, $proto );
fatal_error "Invalid expevent argument ($args)" unless $args eq 'new'; $action = "CT --helper $helpers_aliases{$args}";
} elsif ( $option eq 'zone' ) { $exception_rule = do_proto( $proto, '-', '-' );
fatal_error "Invalid zone id ($args)" unless $args =~ /^\d+$/;
for my $mod ( split_list1( $modifiers, 'ctevents' ) ) {
fatal_error "Invalid helper option ($mod)" unless $mod =~ /^(\w+)=(.+)$/;
$mod = $1;
my $val = $2;
if ( $mod eq 'ctevents' ) {
for ( split_list( $val, 'ctevents' ) ) {
fatal_error "Invalid 'ctevents' event ($_)" unless $valid_ctevent{$_};
}
$action .= " --ctevents $val";
} elsif ( $mod eq 'expevents' ) {
fatal_error "Invalid expevent argument ($val)" unless $val eq 'new';
$action .= ' --expevents new';
} else {
fatal_error "Invalid helper option ($mod)";
}
}
} else { } else {
fatal_error "Invalid CT option ($option)"; fatal_error "Invalid CT option ($option)";
} }
@@ -105,65 +142,159 @@ sub process_notrack_rule( $$$$$$$ ) {
'' , '' ,
$target , $target ,
$exception_rule ); $exception_rule );
progress_message " Notrack rule \"$currentline\" $done";
$globals{UNTRACKED} = 1; progress_message " Conntrack rule \"$currentline\" $done";
}
sub handle_helper_rule( $$$$$$$$$$$ ) {
my ( $helper, $source, $dest, $proto, $ports, $sports, $sourceref, $action_target, $actionchain, $user, $rule ) = @_;
if ( $helper ne '-' ) {
fatal_error "A HELPER is not allowed with this ACTION" if $action_target;
#
# This means that an ACCEPT or NAT rule with a helper is being processed
#
process_conntrack_rule( $actionchain ? ensure_raw_chain( $actionchain ) : undef ,
$sourceref ,
"CT:helper:$helper",
$source ,
$dest ,
$proto ,
$ports ,
$sports ,
$user,
'-',
);
} else {
assert( $action_target );
#
# The target is an action
#
if ( $actionchain ) {
#
# And the source is another action chain
#
expand_rule( ensure_raw_chain( $actionchain ) ,
PREROUTE_RESTRICT ,
$rule ,
$source ,
$dest ,
'' ,
$action_target ,
'',
'CT' ,
'' );
} else {
expand_rule( ensure_raw_chain( notrack_chain( $sourceref->{name} ) ) ,
( $sourceref->{type} == FIREWALL || $sourceref->{type} == VSERVER ?
OUTPUT_RESTRICT :
PREROUTE_RESTRICT ) ,
$rule ,
$source ,
$dest ,
'' ,
$action_target ,
'' ,
'CT' ,
'' );
}
}
} }
sub process_format( $ ) { sub process_format( $ ) {
my $format = shift; my $format = shift;
fatal_error q(FORMAT must be '1' or '2') unless $format =~ /^[12]$/; fatal_error q(FORMAT must be '1', '2' or '3') unless $format =~ /^[123]$/;
$format; $format;
} }
sub setup_notrack() { sub setup_conntrack() {
my $format = 1; for my $name ( qw/notrack conntrack/ ) {
my $action = 'NOTRACK';
if ( my $fn = open_file 'notrack' ) { my $fn = open_file( $name );
first_entry "$doing $fn..."; if ( $fn ) {
my $nonEmpty = 0; my $format = 1;
while ( read_a_line ) { my $action = 'NOTRACK';
my ( $source, $dest, $proto, $ports, $sports, $user );
if ( $format == 1 ) { my $empty = 1;
( $source, $dest, $proto, $ports, $sports, $user ) = split_line1 'Notrack File', { source => 0, dest => 1, proto => 2, dport => 3, sport => 4, user => 5 };
first_entry( "$doing $fn..." );
if ( $source eq 'FORMAT' ) {
$format = process_format( $dest ); while ( read_a_line( NORMAL_READ ) ) {
next; my ( $source, $dest, $proto, $ports, $sports, $user, $switch );
if ( $format == 1 ) {
( $source, $dest, $proto, $ports, $sports, $user, $switch ) = split_line1 'Conntrack File', { source => 0, dest => 1, proto => 2, dport => 3, sport => 4, user => 5, switch => 6 };
if ( $source eq 'FORMAT' ) {
$format = process_format( $dest );
next;
}
} else {
( $action, $source, $dest, $proto, $ports, $sports, $user, $switch ) = split_line1 'Conntrack File', { action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6, switch => 7 }, { COMMENT => 0, FORMAT => 2 };
if ( $action eq 'FORMAT' ) {
$format = process_format( $source );
$action = 'NOTRACK';
next;
}
} }
if ( $source eq 'COMMENT' ) {
process_comment;
next;
}
} else {
( $action, $source, $dest, $proto, $ports, $sports, $user ) = split_line1 'Notrack File', { action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6 }, { COMMENT => 0, FORMAT => 2 };
if ( $action eq 'FORMAT' ) {
$format = process_format( $source );
$action = 'NOTRACK';
next;
}
if ( $action eq 'COMMENT' ) { if ( $action eq 'COMMENT' ) {
process_comment; process_comment;
next; next;
} }
}
process_notrack_rule $action, $source, $dest, $proto, $ports, $sports, $user;
}
clear_comment; $empty = 0;
if ( $format < 3 ) {
if ( $source =~ /^all(-)?(:(.+))?$/ ) {
fatal_error 'USER/GROUP is not allowed unless the SOURCE zone is $FW or a Vserver zone' if $user ne '-';
for my $zone ( $1 ? off_firewall_zones : all_zones ) {
process_conntrack_rule( undef ,
undef,
$action,
$zone . ( $2 || ''),
$dest,
$proto,
$ports,
$sports,
$user ,
$switch );
}
} else {
process_conntrack_rule( undef, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
}
} elsif ( $action =~ s/:O$// ) {
process_conntrack_rule( $raw_table->{OUTPUT}, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
} elsif ( $action =~ s/:OP// || $action =~ s/:PO// ) {
process_conntrack_rule( $raw_table->{PREROUTING}, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
process_conntrack_rule( $raw_table->{OUTPUT}, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
} else {
$action =~ s/:P//;
process_conntrack_rule( $raw_table->{PREROUTING}, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
}
}
clear_comment;
if ( $name eq 'notrack') {
if ( $empty ) {
if ( unlink( $fn ) ) {
warning_message "Empty notrack file ($fn) removed";
} else {
warning_message "Unable to remove empty notrack file ($fn): $!";
}
} else {
warning_message "Non-empty notrack file ($fn); please move its contents to the conntrack file";
}
}
}
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,6 @@
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Tunnels.pm # Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Tunnels.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net) # (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
@@ -62,7 +61,7 @@ sub setup_tunnels() {
} }
} }
my @options = $globals{UNTRACKED} ? state_imatch 'NEW,UNTRACKED' : state_imatch 'NEW'; my @options = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,UNTRACKED' : state_imatch 'NEW';
add_tunnel_rule $inchainref, p => 50, @$source; add_tunnel_rule $inchainref, p => 50, @$source;
add_tunnel_rule $outchainref, p => 50, @$dest; add_tunnel_rule $outchainref, p => 50, @$dest;
@@ -126,9 +125,9 @@ sub setup_tunnels() {
sub setup_pptp_server { sub setup_pptp_server {
my ($inchainref, $outchainref, $kind, $source, $dest ) = @_; my ($inchainref, $outchainref, $kind, $source, $dest ) = @_;
add_tunnel_rule $inchainref, p => 47, @$dest; add_tunnel_rule $inchainref, p => 47, @$source;
add_tunnel_rule $outchainref, p => 47, @$source; add_tunnel_rule $outchainref, p => 47, @$dest;
add_tunnel_rule $inchainref, p => 'tcp --dport 1723', @$dest add_tunnel_rule $inchainref, p => 'tcp --dport 1723', @$source
} }
sub setup_one_openvpn { sub setup_one_openvpn {
@@ -234,7 +233,7 @@ sub setup_tunnels() {
} }
sub setup_one_tunnel($$$$) { sub setup_one_tunnel($$$$) {
my ( $kind , $zone, $gateway, $gatewayzones ) = @_; my ( $kind , $zone, $gateways, $gatewayzones ) = @_;
my $zonetype = zone_type( $zone ); my $zonetype = zone_type( $zone );
@@ -243,35 +242,42 @@ sub setup_tunnels() {
my $inchainref = ensure_rules_chain( rules_chain( ${zone}, ${fw} ) ); my $inchainref = ensure_rules_chain( rules_chain( ${zone}, ${fw} ) );
my $outchainref = ensure_rules_chain( rules_chain( ${fw}, ${zone} ) ); my $outchainref = ensure_rules_chain( rules_chain( ${fw}, ${zone} ) );
$gateway = ALLIP if $gateway eq '-'; $gateways = ALLIP if $gateways eq '-';
my @source = imatch_source_net $gateway; my ( $net, $excl ) = handle_network_list( $gateways , 'src' );
my @dest = imatch_dest_net $gateway; ( $net, $excl ) = handle_network_list( $gateways , 'dst' );
my %tunneltypes = ( 'ipsec' => { function => \&setup_one_ipsec , params => [ $kind, \@source, \@dest , $gatewayzones ] } , fatal_error "Exclusion is not allowed in the GATEWAYS column" if $excl;
'ipsecnat' => { function => \&setup_one_ipsec , params => [ $kind, \@source, \@dest , $gatewayzones ] } ,
'ipip' => { function => \&setup_one_other, params => [ \@source, \@dest , 4 ] } ,
'gre' => { function => \&setup_one_other, params => [ \@source, \@dest , 47 ] } ,
'6to4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
'6in4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
'pptpclient' => { function => \&setup_pptp_client, params => [ $kind, \@source, \@dest ] } ,
'pptpserver' => { function => \&setup_pptp_server, params => [ $kind, \@source, \@dest ] } ,
'openvpn' => { function => \&setup_one_openvpn, params => [ $kind, \@source, \@dest ] } ,
'openvpnclient' => { function => \&setup_one_openvpn_client, params => [ $kind, \@source, \@dest ] } ,
'openvpnserver' => { function => \&setup_one_openvpn_server, params => [ $kind, \@source, \@dest ] } ,
'l2tp' => { function => \&setup_one_l2tp , params => [ $kind, \@source, \@dest ] } ,
'generic' => { function => \&setup_one_generic , params => [ $kind, \@source, \@dest ] } ,
);
$kind = "\L$kind"; for my $gateway ( split_list $gateways, 'GATEWAYS' ) {
my @source = imatch_source_net $gateway;
my @dest = imatch_dest_net $gateway;
(my $type) = split /:/, $kind; my %tunneltypes = ( 'ipsec' => { function => \&setup_one_ipsec , params => [ $kind, \@source, \@dest , $gatewayzones ] } ,
'ipsecnat' => { function => \&setup_one_ipsec , params => [ $kind, \@source, \@dest , $gatewayzones ] } ,
'ipip' => { function => \&setup_one_other, params => [ \@source, \@dest , 4 ] } ,
'gre' => { function => \&setup_one_other, params => [ \@source, \@dest , 47 ] } ,
'6to4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
'6in4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
'pptpclient' => { function => \&setup_pptp_client, params => [ $kind, \@source, \@dest ] } ,
'pptpserver' => { function => \&setup_pptp_server, params => [ $kind, \@source, \@dest ] } ,
'openvpn' => { function => \&setup_one_openvpn, params => [ $kind, \@source, \@dest ] } ,
'openvpnclient' => { function => \&setup_one_openvpn_client, params => [ $kind, \@source, \@dest ] } ,
'openvpnserver' => { function => \&setup_one_openvpn_server, params => [ $kind, \@source, \@dest ] } ,
'l2tp' => { function => \&setup_one_l2tp , params => [ $kind, \@source, \@dest ] } ,
'generic' => { function => \&setup_one_generic , params => [ $kind, \@source, \@dest ] } ,
);
my $tunnelref = $tunneltypes{ $type }; $kind = "\L$kind";
fatal_error "Tunnels of type $type are not supported" unless $tunnelref; (my $type) = split /:/, $kind;
$tunnelref->{function}->( $inchainref, $outchainref, @{$tunnelref->{params}} ); my $tunnelref = $tunneltypes{ $type };
fatal_error "Tunnels of type $type are not supported" unless $tunnelref;
$tunnelref->{function}->( $inchainref, $outchainref, @{$tunnelref->{params}} );
}
progress_message " Tunnel \"$currentline\" $done"; progress_message " Tunnel \"$currentline\" $done";
} }
@@ -283,16 +289,16 @@ sub setup_tunnels() {
first_entry "$doing $fn..."; first_entry "$doing $fn...";
while ( read_a_line ) { while ( read_a_line( NORMAL_READ ) ) {
my ( $kind, $zone, $gateway, $gatewayzones ) = split_line1 'tunnels file', { type => 0, zone => 1, gateway => 2, gateway_zone => 3 }; my ( $kind, $zone, $gateway, $gatewayzones ) = split_line1 'tunnels file', { type => 0, zone => 1, gateway => 2, gateways => 2, gateway_zone => 3 , gateway_zones => 3 }, undef, 4;
fatal_error 'TYPE must be specified' if $kind eq '-'; fatal_error 'TYPE must be specified' if $kind eq '-';
fatal_error 'ZONE must be specified' if $zone eq '-';
if ( $kind eq 'COMMENT' ) { if ( $kind eq 'COMMENT' ) {
process_comment; process_comment;
} else { } else {
fatal_error 'ZONE must be specified' if $zone eq '-';
setup_one_tunnel $kind, $zone, $gateway, $gatewayzones; setup_one_tunnel $kind, $zone, $gateway, $gatewayzones;
} }
} }

View File

@@ -31,63 +31,69 @@ use Shorewall::IPAddrs;
use strict; use strict;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( NOTHING our @EXPORT = ( qw( NOTHING
NUMERIC NUMERIC
NETWORK NETWORK
IPSECPROTO IPSECPROTO
IPSECMODE IPSECMODE
FIREWALL FIREWALL
VSERVER VSERVER
IP IP
BPORT BPORT
IPSEC IPSEC
GROUP
NO_UPDOWN
NO_SFILTER
determine_zones determine_zones
zone_report zone_report
dump_zone_contents dump_zone_contents
find_zone find_zone
firewall_zone firewall_zone
defined_zone defined_zone
zone_type zone_type
zone_interfaces zone_interfaces
zone_mark zone_mark
all_zones all_zones
all_parent_zones all_parent_zones
complex_zones complex_zones
vserver_zones vserver_zones
off_firewall_zones on_firewall_zones
non_firewall_zones off_firewall_zones
single_interface non_firewall_zones
chain_base single_interface
validate_interfaces_file chain_base
all_interfaces validate_interfaces_file
all_real_interfaces all_interfaces
all_bridges all_real_interfaces
interface_number all_plain_interfaces
find_interface all_bridges
known_interface interface_number
get_physical find_interface
physical_name known_interface
have_bridges get_physical
port_to_bridge physical_name
source_port_to_bridge have_bridges
interface_is_optional port_to_bridge
find_interfaces_by_option source_port_to_bridge
find_interfaces_by_option1 interface_is_optional
get_interface_option interface_is_required
interface_has_option find_interfaces_by_option
set_interface_option find_interfaces_by_option1
set_interface_provider get_interface_option
interface_zones interface_has_option
verify_required_interfaces set_interface_option
compile_updown set_interface_provider
validate_hosts_file interface_zones
find_hosts_by_option verify_required_interfaces
find_zone_hosts_by_option validate_hosts_file
find_zones_by_option find_hosts_by_option
all_ipsets find_zone_hosts_by_option
have_ipsec find_zones_by_option
); all_ipsets
have_ipsec
),
);
our @EXPORT_OK = qw( initialize ); our @EXPORT_OK = qw( initialize );
our $VERSION = 'MODULEVERSION'; our $VERSION = 'MODULEVERSION';
@@ -114,7 +120,8 @@ use constant { IN_OUT => 1,
# #
# @zones contains the ordered list of zones with sub-zones appearing before their parents. # @zones contains the ordered list of zones with sub-zones appearing before their parents.
# #
# %zones{<zone1> => {type => <zone type> FIREWALL, IP, IPSEC, BPORT; # %zones{<zone1> => {name => <name>,
# type => <zone type> FIREWALL, IP, IPSEC, BPORT;
# complex => 0|1 # complex => 0|1
# super => 0|1 # super => 0|1
# options => { in_out => < policy match string > # options => { in_out => < policy match string >
@@ -173,6 +180,7 @@ my %reservedName = ( all => 1,
# 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> # base => <shell variable base representing this interface>
# provider => <Provider Name, if interface is associated with a provider>
# zones => { zone1 => 1, ... } # zones => { zone1 => 1, ... }
# } # }
# } # }
@@ -187,7 +195,9 @@ my @bport_zones;
my %ipsets; my %ipsets;
my %physical; my %physical;
my %basemap; my %basemap;
my %basemap1;
my %mapbase; my %mapbase;
my %mapbase1;
my $family; my $family;
my $upgrade; my $upgrade;
my $have_ipsec; my $have_ipsec;
@@ -219,32 +229,36 @@ use constant { SIMPLE_IF_OPTION => 1,
IF_OPTION_WILDOK => 64 IF_OPTION_WILDOK => 64
}; };
use constant { NO_UPDOWN => 1,
NO_SFILTER => 2 };
my %validinterfaceoptions; my %validinterfaceoptions;
my %defaultinterfaceoptions = ( routefilter => 1 , wait => 60 ); my %defaultinterfaceoptions = ( routefilter => 1 , wait => 60 );
my %maxoptionvalue = ( routefilter => 2, mss => 100000 , wait => 120 ); my %maxoptionvalue = ( routefilter => 2, mss => 100000 , wait => 120 , ignore => NO_UPDOWN );
my %validhostoptions; my %validhostoptions;
my %validzoneoptions = ( mss => NUMERIC, my %validzoneoptions = ( mss => NUMERIC,
nomark => NOTHING, nomark => NOTHING,
blacklist => NOTHING, blacklist => NOTHING,
strict => NOTHING, dynamic_shared => NOTHING,
next => NOTHING, strict => NOTHING,
reqid => NUMERIC, next => NOTHING,
spi => NUMERIC, reqid => NUMERIC,
proto => IPSECPROTO, spi => NUMERIC,
mode => IPSECMODE, proto => IPSECPROTO,
"tunnel-src" => NETWORK, mode => IPSECMODE,
"tunnel-dst" => NETWORK, "tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK,
); );
use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 }; use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 };
# #
# 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 %zonekey = ( mss => UNRESTRICTED | COMPLEX , blacklist => NOFW, nomark => NOFW | IN_OUT_ONLY ); my %zonekey = ( mss => UNRESTRICTED | COMPLEX , blacklist => NOFW, nomark => NOFW | IN_OUT_ONLY, dynamic_shared => IN_OUT_ONLY );
# #
# Rather than initializing globals in an INIT block or during declaration, # Rather than initializing globals in an INIT block or during declaration,
@@ -270,7 +284,9 @@ sub initialize( $$ ) {
%ipsets = (); %ipsets = ();
%physical = (); %physical = ();
%basemap = (); %basemap = ();
%basemap1 = ();
%mapbase = (); %mapbase = ();
%mapbase1 = ();
$baseseq = 0; $baseseq = 0;
$minroot = 0; $minroot = 0;
@@ -281,6 +297,7 @@ sub initialize( $$ ) {
bridge => SIMPLE_IF_OPTION, bridge => SIMPLE_IF_OPTION,
detectnets => OBSOLETE_IF_OPTION, detectnets => OBSOLETE_IF_OPTION,
dhcp => SIMPLE_IF_OPTION, dhcp => SIMPLE_IF_OPTION,
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
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 + IF_OPTION_VSERVER, nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_VSERVER,
@@ -291,6 +308,7 @@ sub initialize( $$ ) {
required => SIMPLE_IF_OPTION, required => SIMPLE_IF_OPTION,
routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER, routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER,
routefilter => NUMERIC_IF_OPTION , routefilter => NUMERIC_IF_OPTION ,
rpfilter => SIMPLE_IF_OPTION,
sfilter => IPLIST_IF_OPTION, sfilter => IPLIST_IF_OPTION,
sourceroute => BINARY_IF_OPTION, sourceroute => BINARY_IF_OPTION,
tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST, tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST,
@@ -316,6 +334,7 @@ sub initialize( $$ ) {
%validinterfaceoptions = ( blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST, %validinterfaceoptions = ( blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
bridge => SIMPLE_IF_OPTION, bridge => SIMPLE_IF_OPTION,
dhcp => SIMPLE_IF_OPTION, dhcp => SIMPLE_IF_OPTION,
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST, maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_VSERVER, nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_VSERVER,
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST, nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
@@ -323,6 +342,7 @@ sub initialize( $$ ) {
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 + IF_OPTION_VSERVER, routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER,
rpfilter => SIMPLE_IF_OPTION,
sfilter => IPLIST_IF_OPTION, sfilter => IPLIST_IF_OPTION,
sourceroute => BINARY_IF_OPTION, sourceroute => BINARY_IF_OPTION,
tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST, tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST,
@@ -384,7 +404,7 @@ sub parse_zone_option_list($$\$$)
if ( $key ) { if ( $key ) {
fatal_error "Option '$e' not permitted with this zone type " if $key & NOFW && ($zonetype & ( FIREWALL | VSERVER) ); fatal_error "Option '$e' not permitted with this zone type " if $key & NOFW && ($zonetype & ( FIREWALL | VSERVER) );
fatal_error "Opeion '$e' is only permitted in the OPTIONS columns" if $key & IN_OUT_ONLY && $column != IN_OUT; fatal_error "Option '$e' is only permitted in the OPTIONS columns" if $key & IN_OUT_ONLY && $column != IN_OUT;
$$complexref = 1 if $key & COMPLEX; $$complexref = 1 if $key & COMPLEX;
$h{$e} = $val || 1; $h{$e} = $val || 1;
} else { } else {
@@ -483,7 +503,8 @@ sub process_zone( \$ ) {
my $complex = 0; my $complex = 0;
my $zoneref = $zones{$zone} = { type => $type, my $zoneref = $zones{$zone} = { name => $zone,
type => $type,
parents => \@parents, parents => \@parents,
bridge => '', bridge => '',
options => { in_out => parse_zone_option_list( $options , $type, $complex , IN_OUT ) , options => { in_out => parse_zone_option_list( $options , $type, $complex , IN_OUT ) ,
@@ -519,6 +540,7 @@ sub process_zone( \$ ) {
} }
if ( $zoneref->{options}{in_out}{blacklist} ) { if ( $zoneref->{options}{in_out}{blacklist} ) {
warning_message q(The 'blacklist' option is deprecated);
for ( qw/in out/ ) { for ( qw/in out/ ) {
unless ( $zoneref->{options}{$_}{blacklist} ) { unless ( $zoneref->{options}{$_}{blacklist} ) {
$zoneref->{options}{$_}{blacklist} = 1; $zoneref->{options}{$_}{blacklist} = 1;
@@ -526,6 +548,10 @@ sub process_zone( \$ ) {
warning_message( "Redundant 'blacklist' in " . uc( $_ ) . '_OPTIONS' ); warning_message( "Redundant 'blacklist' in " . uc( $_ ) . '_OPTIONS' );
} }
} }
} else {
for ( qw/in out/ ) {
warning_message q(The 'blacklist' option is deprecated), last if $zoneref->{options}{$_}{blacklist};
}
} }
return $zone; return $zone;
@@ -545,7 +571,7 @@ sub determine_zones()
if ( my $fn = open_file 'zones' ) { if ( my $fn = open_file 'zones' ) {
first_entry "$doing $fn..."; first_entry "$doing $fn...";
push @z, process_zone( $ip ) while read_a_line; push @z, process_zone( $ip ) while read_a_line( NORMAL_READ );
} else { } else {
fatal_error q(The 'zones' file does not exist or has zero size); fatal_error q(The 'zones' file does not exist or has zero size);
} }
@@ -565,6 +591,7 @@ sub determine_zones()
for ( @{$zones{$zone}{children}} ) { for ( @{$zones{$zone}{children}} ) {
next ZONE unless $ordered{$_}; next ZONE unless $ordered{$_};
} }
$ordered{$zone} = 1; $ordered{$zone} = 1;
push @zones, $zone; push @zones, $zone;
redo PUSHED; redo PUSHED;
@@ -572,7 +599,7 @@ sub determine_zones()
} }
} }
assert( scalar @zones == scalar @z ); assert( @zones == @z );
} }
@@ -711,7 +738,7 @@ sub add_group_to_zone($$$$$)
my $interfaceref; my $interfaceref;
my $zoneref = $zones{$zone}; my $zoneref = $zones{$zone};
my $zonetype = $zoneref->{type}; my $zonetype = $zoneref->{type};
$zoneref->{interfaces}{$interface} = 1; $zoneref->{interfaces}{$interface} = 1;
@@ -737,6 +764,13 @@ sub add_group_to_zone($$$$$)
$new = \@exclusions; $new = \@exclusions;
} }
if ( substr( $host, 0, 1 ) eq '+' ) {
fatal_error "Invalid ipset name ($host)" unless $host =~ /^\+(6_)?[a-zA-Z][-\w]*$/;
require_capability( 'IPSET_MATCH', 'Ipset names in host lists', '');
} else {
$host = validate_host $host, 0;
}
unless ( $switched ) { unless ( $switched ) {
if ( $type == $zonetype ) { if ( $type == $zonetype ) {
fatal_error "Duplicate Host Group ($interface:$host) in zone $zone" if $interfaces{$interface}{zone} eq $zone; fatal_error "Duplicate Host Group ($interface:$host) in zone $zone" if $interfaces{$interface}{zone} eq $zone;
@@ -755,13 +789,6 @@ sub add_group_to_zone($$$$$)
} }
} }
if ( substr( $host, 0, 1 ) eq '+' ) {
fatal_error "Invalid ipset name ($host)" unless $host =~ /^\+(6_)?[a-zA-Z]\w*$/;
require_capability( 'IPSET_MATCH', 'Ipset names in host lists', '');
} else {
validate_host $host, 0;
}
push @$new, $host; push @$new, $host;
} }
@@ -825,6 +852,10 @@ sub all_zones() {
@zones; @zones;
} }
sub on_firewall_zones() {
grep ( ( $zones{$_}{type} & ( FIREWALL | VSERVER ) ) , @zones );
}
sub off_firewall_zones() { sub off_firewall_zones() {
grep ( ! ( $zones{$_}{type} & ( FIREWALL | VSERVER ) ) , @zones ); grep ( ! ( $zones{$_}{type} & ( FIREWALL | VSERVER ) ) , @zones );
} }
@@ -909,6 +940,55 @@ sub chain_base($) {
$basemap{$key} = $name; $basemap{$key} = $name;
} }
#
# This is a slightly relaxed version of the above that allows '-' in the generated name.
#
sub chain_base1($) {
my $chain = $_[0];
my $name = $basemap1{$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 eq '' || $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 $mapbase1{$name = join ( '_', $chain, ++$baseseq )};
} else {
#
# We'll store the identity mapping if it is unique
#
$chain = join( '_', $key , ++$baseseq ) while $mapbase1{$name = $chain};
}
#
# Store the reverse mapping
#
$mapbase1{$name} = $key;
#
# Store the mapping
#
$basemap1{$key} = $name;
}
# #
# Process a record in the interfaces file # Process a record in the interfaces file
# #
@@ -934,9 +1014,9 @@ sub process_interface( $$ ) {
return; return;
} }
fatal_error "Invalid FORMAT ($1)"; fatal_error "Invalid FORMAT ($originalinterface)";
} }
if ( $zone eq '-' ) { if ( $zone eq '-' ) {
$zone = ''; $zone = '';
} else { } else {
@@ -992,7 +1072,7 @@ sub process_interface( $$ ) {
$root = substr( $interface, 0, -1 ); $root = substr( $interface, 0, -1 );
$roots{$root} = $interface; $roots{$root} = $interface;
my $len = length $root; my $len = length $root;
if ( $minroot ) { if ( $minroot ) {
$minroot = $len if $minroot > $len; $minroot = $len if $minroot > $len;
} else { } else {
@@ -1029,7 +1109,7 @@ sub process_interface( $$ ) {
if ( $options eq 'ignore' ) { if ( $options eq 'ignore' ) {
fatal_error "Ignored interfaces may not be associated with a zone" if $zone; fatal_error "Ignored interfaces may not be associated with a zone" if $zone;
$options{ignore} = 1; $options{ignore} = NO_UPDOWN | NO_SFILTER;
$options = '-'; $options = '-';
} }
@@ -1090,7 +1170,7 @@ sub process_interface( $$ ) {
assert( 0 ); assert( 0 );
} }
} elsif ( $type == NUMERIC_IF_OPTION ) { } elsif ( $type == NUMERIC_IF_OPTION ) {
fatal_error "The '$option' option may not be specified on a wildcard interface" if $wildcard && ! $type && IF_OPTION_WILDOK; fatal_error "The '$option' option may not be specified on a wildcard interface" if $wildcard && ! $type && IF_OPTION_WILDOK;
$value = $defaultinterfaceoptions{$option} unless defined $value; $value = $defaultinterfaceoptions{$option} unless defined $value;
fatal_error "The '$option' option requires a value" unless defined $value; fatal_error "The '$option' option requires a value" unless defined $value;
my $numval = numeric_value $value; my $numval = numeric_value $value;
@@ -1127,7 +1207,7 @@ sub process_interface( $$ ) {
$hostoptions{broadcast} = 1; $hostoptions{broadcast} = 1;
} elsif ( $option eq 'sfilter' ) { } elsif ( $option eq 'sfilter' ) {
$filterref = [ split_list $value, 'address' ]; $filterref = [ split_list $value, 'address' ];
validate_net( $_, 1) for @{$filterref} $_ = validate_net( $_, 1) for @{$filterref}
} else { } else {
assert(0); assert(0);
} }
@@ -1149,10 +1229,27 @@ sub process_interface( $$ ) {
} }
} }
fatal_error "Invalid combination of interface options" if $options{required} && $options{optional}; fatal_error q(The 'required', 'optional' and 'ignore' options are mutually exclusive)
if ( ( $options{required} && $options{optional} ) ||
( $options{required} && $options{ignore} ) ||
( $options{optional} && $options{ignore} ) );
if ( $options{rpfilter} ) {
require_capability( 'RPFILTER_MATCH', q(The 'rpfilter' option), 's' ) ;
fatal_error q(The 'routefilter', 'sfilter' and 'rpfilter' options are mutually exclusive) if $options{routefilter} || @$filterref;
} else {
fatal_error q(The 'routefilter', 'sfilter' and 'rpfilter' options are mutually exclusive) if $options{routefilter} && @$filterref;
}
if ( supplied( my $ignore = $options{ignore} ) ) {
fatal_error "Invalid value ignore=0" if ! $ignore;
} else {
$options{ignore} = 0;
}
if ( $netsref eq 'dynamic' ) { if ( $netsref eq 'dynamic' ) {
my $ipset = $family == F_IPV4 ? "${zone}_" . chain_base $physical : "6_${zone}_" . chain_base $physical; my $ipset = $family == F_IPV4 ? "${zone}" : "6_${zone}";
$ipset = join( '_', $ipset, chain_base1( $physical ) ) unless $zoneref->{options}{in_out}{dynamic_shared};
$netsref = [ "+$ipset" ]; $netsref = [ "+$ipset" ];
$ipsets{$ipset} = 1; $ipsets{$ipset} = 1;
} }
@@ -1171,6 +1268,10 @@ sub process_interface( $$ ) {
# No options specified -- auto-detect bridge # No options specified -- auto-detect bridge
# #
$hostoptionsref->{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export; $hostoptionsref->{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export;
#
# And give the 'ignore' option a defined value
#
$options{ignore} ||= 0;
} }
$physical{$physical} = $interfaces{$interface} = { name => $interface , $physical{$physical} = $interfaces{$interface} = { name => $interface ,
@@ -1208,13 +1309,13 @@ sub process_interface( $$ ) {
sub validate_interfaces_file( $ ) { sub validate_interfaces_file( $ ) {
my $export = shift; my $export = shift;
our $format = 1; our $format = 1;
my @ifaces; my @ifaces;
my $nextinum = 1; my $nextinum = 1;
if ( my $fn = open_file 'interfaces' ) { if ( my $fn = open_file 'interfaces' ) {
first_entry "$doing $fn..."; first_entry "$doing $fn...";
push @ifaces, process_interface( $nextinum++, $export ) while read_a_line; push @ifaces, process_interface( $nextinum++, $export ) while read_a_line( NORMAL_READ );
} else { } else {
fatal_error q(The 'interfaces' file does not exist or has zero size); fatal_error q(The 'interfaces' file does not exist or has zero size);
} }
@@ -1297,7 +1398,7 @@ sub known_interface($)
if ( $minroot ) { if ( $minroot ) {
while ( length $iface > $minroot ) { while ( length $iface > $minroot ) {
chop $iface; chop $iface;
if ( my $i = $roots{$iface} ) { if ( my $i = $roots{$iface} ) {
$interfaceref = $interfaces{$i}; $interfaceref = $interfaces{$i};
@@ -1373,7 +1474,7 @@ sub physical_name( $ ) {
$devref ? $devref->{physical} : $device; $devref ? $devref->{physical} : $device;
} }
# #
# Returns true if there are bridge port zones defined in the config # Returns true if there are bridge port zones defined in the config
# #
@@ -1416,11 +1517,65 @@ sub interface_is_optional($) {
$optionsref && $optionsref->{optional}; $optionsref && $optionsref->{optional};
} }
#
# Return the 'required' setting of the passed interface
#
sub interface_is_required($) {
my $optionsref = $interfaces{$_[0]}{options};
$optionsref && $optionsref->{required};
}
#
# Return true if the interface is 'plain'
#
sub interface_is_plain($) {
my $interfaceref = $interfaces{$_[0]};
my $optionsref = $interfaceref->{options};
$interfaceref->{bridge} eq $interfaceref->{name} && ! ( $optionsref && ( $optionsref->{required} || $optionsref->{optional} || $optionsref->{ignore} ) )
}
#
# Return a minimal list of physical interfaces that are neither ignored, optional, required nor a bridge port.
#
sub all_plain_interfaces() {
my @plain1 = map get_physical($_), grep $_ ne '%vserver%' && interface_is_plain( $_ ), @interfaces;
my @plain2;
my @wild1;
my @wild2;
for ( @plain1 ) {
if ( /\+$/ ) {
return ( '+' ) if $_ eq '+';
push @wild1, $_;
chop;
push @wild2, $_;
} else {
push @plain2, $_;
}
}
return @plain2 unless @wild1;
@plain1 = ();
NAME:
for my $name ( @plain2) {
for ( @wild2 ) {
next NAME if substr( $name, 0, length( $_ ) ) eq $_;
}
push @plain1, $name;
}
( @plain1, @wild1 );
}
# #
# Returns reference to array of interfaces with the passed option # Returns reference to array of interfaces with the passed option
# #
sub find_interfaces_by_option( $ ) { sub find_interfaces_by_option( $;$ ) {
my $option = $_[0]; my ( $option , $nonzero ) = @_;
my @ints = (); my @ints = ();
for my $interface ( @interfaces ) { for my $interface ( @interfaces ) {
@@ -1429,7 +1584,11 @@ sub find_interfaces_by_option( $ ) {
next unless $interfaceref->{root}; next unless $interfaceref->{root};
my $optionsref = $interfaceref->{options}; my $optionsref = $interfaceref->{options};
if ( $optionsref && defined $optionsref->{$option} ) { if ( $nonzero ) {
if ( $optionsref && $optionsref->{$option} ) {
push @ints , $interface
}
} elsif ( $optionsref && defined $optionsref->{$option} ) {
push @ints , $interface push @ints , $interface
} }
} }
@@ -1479,7 +1638,7 @@ sub get_interface_option( $$ ) {
assert( $ref = known_interface( $interface ) ); assert( $ref = known_interface( $interface ) );
$ref->{options}{$option}; $ref->{options}{$option};
} }
# #
@@ -1540,16 +1699,16 @@ sub verify_required_interfaces( $ ) {
my $physical = get_physical $interface; my $physical = get_physical $interface;
if ( $physical =~ /\+$/ ) { if ( $physical =~ /\+$/ ) {
my $base = uc chain_base $physical;
$physical =~ s/\+$/*/; $physical =~ s/\+$/*/;
emit( 'for interface in $(find_all_interfaces); do', emit( "waittime=$wait",
'',
'for interface in $(find_all_interfaces); do',
' case $interface in', ' case $interface in',
" $physical)", " $physical)",
" waittime=$wait",
' while [ $waittime -gt 0 ]; do', ' while [ $waittime -gt 0 ]; do',
' interface_is_usable $interface && break', ' interface_is_usable $interface && break',
' sleep 1',
' waittime=$(($waittime - 1))', ' waittime=$(($waittime - 1))',
' done', ' done',
' ;;', ' ;;',
@@ -1562,8 +1721,8 @@ sub verify_required_interfaces( $ ) {
emit qq( waittime=$wait); emit qq( waittime=$wait);
emit ''; emit '';
emit q( while [ $waittime -gt 0 ]; do); emit q( while [ $waittime -gt 0 ]; do);
emit qq( interface_is_usable $physical && break);
emit q( sleep 1); emit q( sleep 1);
emit qq( interface_is_usable $physical && break);
emit ' waittime=$(($waittime - 1))'; emit ' waittime=$(($waittime - 1))';
emit q( done); emit q( done);
emit q(fi); emit q(fi);
@@ -1634,181 +1793,12 @@ sub verify_required_interfaces( $ ) {
$returnvalue; $returnvalue;
} }
#
# Emit the updown() function
#
sub compile_updown() {
emit( '',
'#',
'# Handle the "up" and "down" commands',
'#',
'updown() # $1 = interface',
'{',
);
push_indent;
emit( 'local state',
'state=cleared',
'' );
emit 'progress_message3 "$g_product $COMMAND triggered by $1"';
emit '';
if ( $family == F_IPV4 ) {
emit 'if shorewall_is_started; then';
} else {
emit 'if shorewall6_is_started; then';
}
emit( ' state=started',
'elif [ -f ${VARDIR}/state ]; then',
' case "$(cat ${VARDIR}/state)" in',
' Stopped*)',
' state=stopped',
' ;;',
' Cleared*)',
' ;;',
' *)',
' state=unknown',
' ;;',
' esac',
'else',
' state=unknown',
'fi',
''
);
emit( 'case $1 in' );
push_indent;
my $ignore = find_interfaces_by_option 'ignore';
my $required = find_interfaces_by_option 'required';
my $optional = find_interfaces_by_option 'optional';
if ( @$ignore ) {
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$ignore;
$interfaces =~ s/\+/*/g;
emit( "$interfaces)",
' progress_message3 "$COMMAND on interface $1 ignored"',
' exit 0',
' ;;'
);
}
if ( @$required ) {
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$required;
my $wildcard = ( $interfaces =~ s/\+/*/g );
emit( "$interfaces)",
' if [ "$COMMAND" = up ]; then' );
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',
' define_firewall' );
if ( $wildcard ) {
emit( ' elif [ "$state" = started ]; then',
' progress_message3 "$g_product attempting restart"',
' COMMAND=restart',
' detect_configuration',
' define_firewall' );
} else {
emit( ' else',
' COMMAND=stop',
' progress_message3 "$g_product attempting stop"',
' detect_configuration',
' stop_firewall' );
}
emit( ' fi',
' ;;'
);
}
if ( @$optional ) {
my @interfaces = map $interfaces{$_}->{physical}, @$optional;
my $interfaces = join '|', @interfaces;
if ( $interfaces =~ s/\+/*/g || @interfaces > 1 ) {
emit( "$interfaces)",
' if [ "$COMMAND" = up ]; then',
' echo 0 > ${VARDIR}/${1}.state',
' else',
' echo 1 > ${VARDIR}/${1}.state',
' fi' );
} else {
emit( "$interfaces)",
' if [ "$COMMAND" = up ]; then',
" echo 0 > \${VARDIR}/$interfaces.state",
' else',
" echo 1 > \${VARDIR}/$interfaces.state",
' fi' );
}
emit( '',
' if [ "$state" = started ]; then',
' COMMAND=restart',
' progress_message3 "$g_product attempting restart"',
' detect_configuration',
' define_firewall',
' elif [ "$state" = stopped ]; then',
' COMMAND=start',
' progress_message3 "$g_product attempting start"',
' detect_configuration',
' define_firewall',
' else',
' progress_message3 "$COMMAND on interface $1 ignored"',
' fi',
' ;;',
);
}
emit( "*)",
' case $state in',
' started)',
' COMMAND=restart',
' progress_message3 "$g_product attempting restart"',
' detect_configuration',
' define_firewall',
' ;;',
' *)',
' progress_message3 "$COMMAND on interface $1 ignored"',
' ;;',
' esac',
);
pop_indent;
emit( 'esac' );
pop_indent;
emit( '}',
'',
);
}
# #
# Process a record in the hosts file # Process a record in the hosts file
# #
sub process_host( ) { sub process_host( ) {
my $ipsec = 0; my $ipsec = 0;
my ($zone, $hosts, $options ) = split_line 'hosts file', { zone => 0, hosts => 1, options => 2 }; my ($zone, $hosts, $options ) = split_line1 'hosts file', { zone => 0, host => 1, hosts => 1, options => 2 }, {}, 3;
fatal_error 'ZONE must be specified' if $zone eq '-'; fatal_error 'ZONE must be specified' if $zone eq '-';
fatal_error 'HOSTS must be specified' if $hosts eq '-'; fatal_error 'HOSTS must be specified' if $hosts eq '-';
@@ -1829,22 +1819,23 @@ sub process_host( ) {
} else { } else {
fatal_error "Invalid HOST(S) column contents: $hosts"; fatal_error "Invalid HOST(S) column contents: $hosts";
} }
} elsif ( $hosts =~ /^([\w.@%-]+\+?):<(.*)>$/ || } elsif ( $hosts =~ /^([\w.@%-]+\+?):<(.*)>$/ ||
$hosts =~ /^([\w.@%-]+\+?):\[(.*)\]$/ || $hosts =~ /^([\w.@%-]+\+?)\[(.*)\]$/ ||
$hosts =~ /^([\w.@%-]+\+?):(!?\+.*)$/ || $hosts =~ /^([\w.@%-]+\+?):(!?\[.+\](?:\/\d+)?)$/ ||
$hosts =~ /^([\w.@%-]+\+?):(!?\+.*)$/ ||
$hosts =~ /^([\w.@%-]+\+?):(dynamic)$/ ) { $hosts =~ /^([\w.@%-]+\+?):(dynamic)$/ ) {
$interface = $1; $interface = $1;
$hosts = $2; $hosts = $2;
fatal_error "Unknown interface ($interface)" unless ($interfaceref = $interfaces{$interface}) && $interfaceref->{root}; fatal_error "Unknown interface ($interface)" unless ($interfaceref = $interfaces{$interface}) && $interfaceref->{root};
} else { } else {
fatal_error "Invalid HOST(S) column contents: $hosts" fatal_error "Invalid HOST(S) column contents: $hosts"
} }
if ( $hosts =~ /^!?\+/ ) { if ( $hosts =~ /^!?\+/ ) {
$zoneref->{complex} = 1; $zoneref->{complex} = 1;
fatal_error "ipset name qualification is disallowed in this file" if $hosts =~ /[\[\]]/; fatal_error "ipset name qualification is disallowed in this file" if $hosts =~ /[\[\]]/;
fatal_error "Invalid ipset name ($hosts)" unless $hosts =~ /^!?\+[a-zA-Z][-\w]*$/; fatal_error "Invalid ipset name ($hosts)" unless $hosts =~ /^!?\+[a-zA-Z][-\w]*$/;
} }
if ( $type & BPORT ) { if ( $type & BPORT ) {
@@ -1871,6 +1862,7 @@ sub process_host( ) {
} elsif ( $option eq 'norfc1918' ) { } elsif ( $option eq 'norfc1918' ) {
warning_message "The 'norfc1918' host option is no longer supported" warning_message "The 'norfc1918' host option is no longer supported"
} elsif ( $option eq 'blacklist' ) { } elsif ( $option eq 'blacklist' ) {
warning_message "The 'blacklist' option is deprecated";
$zoneref->{options}{in}{blacklist} = 1; $zoneref->{options}{in}{blacklist} = 1;
} elsif ( $option =~ /^mss=(\d+)$/ ) { } elsif ( $option =~ /^mss=(\d+)$/ ) {
fatal_error "Invalid mss ($1)" unless $1 >= 500; fatal_error "Invalid mss ($1)" unless $1 >= 500;
@@ -1907,8 +1899,14 @@ sub process_host( ) {
if ( $hosts eq 'dynamic' ) { if ( $hosts eq 'dynamic' ) {
fatal_error "Vserver zones may not be dynamic" if $type & VSERVER; 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 = chain_base( physical_name $interface );
my $set = $family == F_IPV4 ? "${zone}_${physical}" : "6_${zone}_${physical}"; my $set = $family == F_IPV4 ? "${zone}" : "6_${zone}";
unless ( $zoneref->{options}{in_out}{dynamic_shared} ) {
my $physical = chain_base1( physical_name $interface );
$set = join( '_', $set, $physical );
}
$hosts = "+$set"; $hosts = "+$set";
$optionsref->{dynamic} = 1; $optionsref->{dynamic} = 1;
$ipsets{$set} = 1; $ipsets{$set} = 1;
@@ -1935,7 +1933,7 @@ sub validate_hosts_file()
if ( my $fn = open_file 'hosts' ) { if ( my $fn = open_file 'hosts' ) {
first_entry "$doing $fn..."; first_entry "$doing $fn...";
$ipsec |= process_host while read_a_line; $ipsec |= process_host while read_a_line( NORMAL_READ );
} }
$have_ipsec = $ipsec || haveipseczones; $have_ipsec = $ipsec || haveipseczones;

View File

@@ -37,6 +37,8 @@
# --log_verbosity=<number> # Log Verbosity range -1 to 2 # --log_verbosity=<number> # Log Verbosity range -1 to 2
# --family=<number> # IP family; 4 = IPv4 (default), 6 = IPv6 # --family=<number> # IP family; 4 = IPv4 (default), 6 = IPv6
# --preview # Preview the ruleset. # --preview # Preview the ruleset.
# --shorewallrc=<path> # Path to global shorewallrc file.
# --shorewallrc1=<path> # Path to export shorewallrc file.
# --config_path=<path-list> # Search path for config files # --config_path=<path-list> # Search path for config files
# #
use strict; use strict;
@@ -65,7 +67,8 @@ sub usage( $ ) {
[ --annotate ] [ --annotate ]
[ --update ] [ --update ]
[ --convert ] [ --convert ]
[ --shorewallrc ] [ --shorewallrc=<pathname> ]
[ --shorewallrc1=<pathname> ]
[ --config_path=<path-list> ] [ --config_path=<path-list> ]
'; ';
@@ -93,6 +96,7 @@ my $update = 0;
my $convert = 0; my $convert = 0;
my $config_path = ''; my $config_path = '';
my $shorewallrc = ''; my $shorewallrc = '';
my $shorewallrc1 = '';
Getopt::Long::Configure ('bundling'); Getopt::Long::Configure ('bundling');
@@ -125,6 +129,7 @@ my $result = GetOptions('h' => \$help,
'convert' => \$convert, 'convert' => \$convert,
'config_path=s' => \$config_path, 'config_path=s' => \$config_path,
'shorewallrc=s' => \$shorewallrc, 'shorewallrc=s' => \$shorewallrc,
'shorewallrc1=s' => \$shorewallrc1,
); );
usage(1) unless $result && @ARGV < 2; usage(1) unless $result && @ARGV < 2;
@@ -147,5 +152,6 @@ compiler( script => $ARGV[0] || '',
convert => $convert, convert => $convert,
annotate => $annotate, annotate => $annotate,
config_path => $config_path, config_path => $config_path,
shorewallrc => $shorewallrc shorewallrc => $shorewallrc,
shorewallrc1 => $shorewallrc1,
); );

View File

@@ -25,12 +25,12 @@
# #
# $1 = Path name of params file # $1 = Path name of params file
# $2 = $CONFIG_PATH # $2 = $CONFIG_PATH
# $3 = Address family (4 o4 6) # $3 = Address family (4 or 6)
# #
if [ "$3" = 6 ]; then if [ "$3" = 6 ]; then
g_program=shorewall6 PRODUCT=shorewall6
else else
g_program=shorewall PRODUCT=shorewall
fi fi
# #
@@ -38,11 +38,9 @@ fi
# #
. /usr/share/shorewall/shorewallrc . /usr/share/shorewall/shorewallrc
g_libexec="$LIBEXECDIR" g_program=$PRODUCT
g_sharedir="$SHAREDIR"/shorewall g_sharedir="$SHAREDIR/shorewall"
g_sbindir="$SBINDIR" g_confdir="$CONFDIR/$PRODUCT"
g_perllib="$PERLLIBDIR"
g_confdir="$CONFDIR"/shorewall
g_readrc=1 g_readrc=1
. $g_sharedir/lib.cli . $g_sharedir/lib.cli

View File

@@ -171,28 +171,6 @@ interface_is_up() {
[ -n "$($IP -$g_family link list dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ] [ -n "$($IP -$g_family link list dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ]
} }
#
# Determine if interface is usable from a Netfilter perspective
#
interface_is_usable() # $1 = interface
{
[ "$1" = lo ] && return 0
interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ] && run_isusable_exit $1
}
#
# Find interface addresses--returns the set of addresses assigned to the passed
# device
#
find_interface_addresses() # $1 = interface
{
if [ $g_family -eq 4 ]; then
$IP -f inet addr show $1 2> /dev/null | grep inet\ | sed 's/\s*inet //;s/\/.*//;s/ peer.*//'
else
$IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 2' | sed 's/\s*inet6 //;s/\/.*//;s/ peer.*//'
fi
}
# #
# echo the list of networks routed out of a given interface # echo the list of networks routed out of a given interface
# #
@@ -203,7 +181,6 @@ get_routed_networks() # $1 = interface name, $2-n = Fatal error message
local mask local mask
[ $g_family -eq 4 ] && mask=32 || mask=128 [ $g_family -eq 4 ] && mask=32 || mask=128
$IP -$g_family route show dev $1 2> /dev/null | $IP -$g_family route show dev $1 2> /dev/null |
while read address rest; do while read address rest; do
@@ -362,6 +339,16 @@ replace_default_route() # $1 = USE_DEFAULT_RT
fi fi
} }
#
# Delete default routes with metric 0 from the passed routing table
#
delete_default_routes() # $1 = table number
{
$IP -$g_family route ls table $1 | fgrep default | fgrep -v metric | while read route; do
qt $IP -$g_family route del $route
done
}
restore_default_route() # $1 = USE_DEFAULT_RT restore_default_route() # $1 = USE_DEFAULT_RT
{ {
local result local result
@@ -385,7 +372,7 @@ restore_default_route() # $1 = USE_DEFAULT_RT
done < ${VARDIR}/default_route done < ${VARDIR}/default_route
replace_default_route $1 replace_default_route $1
if [ $result = 1 ]; then if [ $result = 1 ]; then
# #
# We didn't restore a default route with metric 0 # We didn't restore a default route with metric 0
@@ -443,7 +430,7 @@ run_iptables()
local status local status
while [ 1 ]; do while [ 1 ]; do
$g_tool $@ eval $g_tool $@
status=$? status=$?
[ $status -ne 4 ] && break [ $status -ne 4 ] && break
done done
@@ -594,6 +581,7 @@ distribute_load() {
local interface local interface
local totalload local totalload
local load local load
local mark
local maxload local maxload
maxload=$1 maxload=$1
@@ -605,6 +593,8 @@ distribute_load() {
if interface_up $interface; then if interface_up $interface; then
load=$(cat ${VARDIR}/${interface}_load) load=$(cat ${VARDIR}/${interface}_load)
eval ${interface}_load=$load eval ${interface}_load=$load
mark=$(cat ${VARDIR}/${interface}_mark)
eval ${interface}_mark=$mark
totalload=$( bc <<EOF totalload=$( bc <<EOF
scale=8 scale=8
$totalload + $load $totalload + $load
@@ -617,7 +607,8 @@ EOF
for interface in $@; do for interface in $@; do
qt $g_tool -t mangle -F ~$interface qt $g_tool -t mangle -F ~$interface
eval load=\$${interface}_load eval load=\$${interface}_load
eval mark=\$${interface}_mark
if [ -n "$load" ]; then if [ -n "$load" ]; then
load=$(bc <<EOF load=$(bc <<EOF
scale=8 scale=8
@@ -629,19 +620,47 @@ scale=8
$totalload - $load $totalload - $load
EOF EOF
) )
run_iptables -t mangle -A ~$interface -m statistic --mode random --probability $load run_iptables -t mangle -A ~$interface -m statistic --mode random --probability $load -j MARK --set-mark $mark
fi fi
done done
fi fi
} }
?IF __IPV4 ?if __IPV4
################################################################################# #################################################################################
# IPv4-specific Functions # IPv4-specific Functions
################################################################################# #################################################################################
#
# Determine if interface is usable from a Netfilter perspective
#
interface_is_usable() # $1 = interface
{
local status;
status=0
if [ "$1" != lo ]; then
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != 0.0.0.0 ]; then
[ "$COMMAND" = enable ] || run_isusable_exit $1
status=$?
else
status=1
fi
fi
return $status
}
#
# Find interface addresses--returns the set of addresses assigned to the passed device
#
find_interface_addresses() # $1 = interface
{
$IP -f inet addr show $1 2> /dev/null | grep inet\ | sed 's/\s*inet //;s/\/.*//;s/ peer.*//'
}
#
# Find the value 'weight' in the passed arguments then echo the next value # Find the value 'weight' in the passed arguments then echo the next value
# #
find_weight() { find_weight() {
while [ $# -gt 1 ]; do while [ $# -gt 1 ]; do
[ "x$1" = xweight ] && echo $2 && return [ "x$1" = xweight ] && echo $2 && return
@@ -819,13 +838,13 @@ detect_dynamic_gateway() { # $1 = interface
gateway=$( find_peer $($IP addr list $interface ) ) gateway=$( find_peer $($IP addr list $interface ) )
fi fi
if [ -z "$gateway" -a -f /var/lib/dhcpcd/dhcpcd-${1}.info ]; then if [ -z "$gateway" -a -f ${VARLIB}/dhcpcd/dhcpcd-${1}.info ]; then
eval $(grep ^GATEWAYS= /var/lib/dhcpcd/dhcpcd-${1}.info 2> /dev/null) eval $(grep ^GATEWAYS= ${VARLIB}/dhcpcd/dhcpcd-${1}.info 2> /dev/null)
[ -n "$GATEWAYS" ] && GATEWAYS=${GATEWAYS%,*} && gateway=$GATEWAYS [ -n "$GATEWAYS" ] && GATEWAYS=${GATEWAYS%,*} && gateway=$GATEWAYS
fi fi
if [ -z "$gateway" -a -f /var/lib/dhcp/dhclient-${1}.lease ]; then if [ -z "$gateway" -a -f ${VARLIB}/dhcp/dhclient-${1}.lease ]; then
gateway=$(grep 'option routers' /var/lib/dhcp/dhclient-${1}.lease | tail -n 1 | while read j1 j2 gateway; do echo $gateway ; return 0; done) gateway=$(grep 'option routers' ${VARLIB}/dhcp/dhclient-${1}.lease | tail -n 1 | while read j1 j2 gateway; do echo $gateway ; return 0; done)
fi fi
[ -n "$gateway" ] && echo $gateway [ -n "$gateway" ] && echo $gateway
@@ -888,7 +907,7 @@ add_gateway() # $1 = Delta $2 = Table Number
local weight local weight
local delta local delta
local dev local dev
route=`$IP -4 -o route ls table $2 | grep ^default | sed 's/default //; s/[\]//g'` route=`$IP -4 -o route ls table $2 | grep ^default | sed 's/default //; s/[\]//g'`
if [ -z "$route" ]; then if [ -z "$route" ]; then
@@ -897,7 +916,12 @@ add_gateway() # $1 = Delta $2 = Table Number
delta=$1 delta=$1
if ! echo $route | fgrep -q ' nexthop '; then if ! echo $route | fgrep -q ' nexthop '; then
route=`echo $route | sed 's/via/nexthop via/'` if echo $route | fgrep -q via; then
route=`echo $route | sed 's/via/nexthop via/'`
else
route="nexthop $route"
fi
dev=$(find_device $route) dev=$(find_device $route)
if [ -f ${VARDIR}/${dev}_weight ]; then if [ -f ${VARDIR}/${dev}_weight ]; then
weight=`cat ${VARDIR}/${dev}_weight` weight=`cat ${VARDIR}/${dev}_weight`
@@ -920,7 +944,7 @@ delete_gateway() # $! = Description of the Gateway $2 = table number $3 = device
route=`$IP -4 -o route ls table $2 | grep ^default | sed 's/[\]//g'` route=`$IP -4 -o route ls table $2 | grep ^default | sed 's/[\]//g'`
gateway=$1 gateway=$1
if [ -n "$route" ]; then if [ -n "$route" ]; then
if echo $route | fgrep -q ' nexthop '; then if echo $route | fgrep -q ' nexthop '; then
gateway="nexthop $gateway" gateway="nexthop $gateway"
@@ -1008,10 +1032,38 @@ get_all_bcasts()
$IP -f inet addr show 2> /dev/null | grep 'inet.*brd' | grep -v '/32 ' | sed 's/inet.*brd //; s/scope.*//;' | sort -u $IP -f inet addr show 2> /dev/null | grep 'inet.*brd' | grep -v '/32 ' | sed 's/inet.*brd //; s/scope.*//;' | sort -u
} }
?ELSE ?else
################################################################################# #################################################################################
# IPv6-specific Functions # IPv6-specific Functions
################################################################################# #################################################################################
#
# Determine if interface is usable from a Netfilter perspective
#
interface_is_usable() # $1 = interface
{
local status;
status=0
if [ "$1" != lo ]; then
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ]; then
[ "$COMMAND" = enable ] || run_isusable_exit $1
status=$?
else
status=1
fi
fi
return $status
}
#
# Find interface addresses--returns the set of addresses assigned to the passed device
#
find_interface_addresses() # $1 = interface
{
$IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 2' | sed 's/\s*inet6 //;s/\/.*//;s/ peer.*//'
}
# #
# Get all interface addresses with VLSMs # Get all interface addresses with VLSMs
# #
@@ -1214,7 +1266,7 @@ add_gateway() # $1 = Delta $2 = Table Number
local weight local weight
local delta local delta
local dev local dev
run_ip route add default scope global table $2 $1 run_ip route add default scope global table $2 $1
} }
@@ -1229,7 +1281,7 @@ delete_gateway() # $! = Description of the Gateway $2 = table number $3 = device
route=`$IP -6 -o route ls table $2 | grep ^default | sed 's/[\]//g'` route=`$IP -6 -o route ls table $2 | grep ^default | sed 's/[\]//g'`
gateway=$1 gateway=$1
dev=$(find_device $route) dev=$(find_device $route)
[ "$dev" = "$3" ] && run_ip route delete default table $2 [ "$dev" = "$3" ] && run_ip route delete default table $2
} }
@@ -1272,4 +1324,4 @@ clear_firewall() {
logger -p kern.info "$g_product Cleared" logger -p kern.info "$g_product Cleared"
} }
?ENDIF ?endif

View File

@@ -1,11 +0,0 @@
#
# Shorewall version 4 - blacklist Macro
#
# /usr/share/shorewall/macro.blacklist
#
# This macro handles blacklisting using BLACKLIST_DISPOSITION and BLACKLIST_LOGLEVEL
#
###############################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
$BLACKLIST_DISPOSITION:$BLACKLIST_LOGLEVEL

View File

@@ -33,25 +33,25 @@ usage() {
} }
checkkernelversion() { checkkernelversion() {
?if __IPV6
local kernel local kernel
if [ $g_family -eq 6 ]; then kernel=$(uname -r 2> /dev/null | sed -e 's/-.*//')
kernel=$(uname -r 2> /dev/null | sed -e 's/-.*//')
case "$kernel" in case "$kernel" in
*.*.*) *.*.*)
kernel=$(printf "%d%02d%02d" $(echo $kernel | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g')) kernel=$(printf "%d%02d%02d" $(echo $kernel | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g'))
;; ;;
*) *)
kernel=$(printf "%d%02d00" $(echo $kernel | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2/g')) kernel=$(printf "%d%02d00" $(echo $kernel | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2/g'))
;; ;;
esac esac
if [ $kernel -lt 20624 ]; then if [ $kernel -lt 20624 ]; then
error_message "ERROR: $g_product requires Linux kernel 2.6.24 or later" error_message "ERROR: $g_product requires Linux kernel 2.6.24 or later"
return 1 return 1
fi
fi fi
?endif
return 0 return 0
} }
@@ -348,7 +348,9 @@ case "$COMMAND" in
[ $# -eq 1 ] && exit 0 [ $# -eq 1 ] && exit 0
shift shift
[ $# -ne 1 ] && usage 2 [ $# -ne 1 ] && usage 2
updown $1 mutex_on
( updown $1 )
mutex_off
status=0 status=0
;; ;;
enable) enable)

View File

@@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be author's reputation will not be affected by problems that might be
introduced by others. introduced by others.
Finally, software patents pose a constant threat to the existence of Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a effectively restrict the users of a free program by obtaining a
@@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The "work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must former contains code derived from the library, whereas the latter must
be combined with the library in order to run. be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does. and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's 1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an you conspicuously and appropriately publish on each copy an
@@ -158,7 +158,7 @@ Library.
You may charge a fee for the physical act of transferring a copy, You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a and you may at your option offer warranty protection in exchange for a
fee. fee.
2. You may modify your copy or copies of the Library or any portion 2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1 distribute such modifications or work under the terms of Section 1
@@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in that version instead if you wish.) Do not make any other change in
these notices. these notices.
Once this change is made in a given copy, it is irreversible for Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy. subsequent copies and derivative works made from that copy.
@@ -267,7 +267,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6. distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6, Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself. whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or 6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work work containing portions of the Library, and distribute that work
@@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you use both them and the Library together in an executable that you
distribute. distribute.
7. You may place library facilities that are a work based on the 7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined facilities not covered by this License, and distribute such a combined
@@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein. restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with You are not responsible for enforcing compliance by third parties with
this License. this License.
11. If, as a consequence of a court judgment or allegation of patent 11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or conditions are imposed on you (whether by court order, agreement or
@@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by license version number, you may choose any version ever published by
the Free Software Foundation. the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free 14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these, programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is write to the author to ask for permission. For software which is
@@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES. DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest If you develop a new library, and you want it to be of the greatest

View File

@@ -7,6 +7,8 @@
# http://www.shorewall.net/manpages/shorewall-interfaces.html # http://www.shorewall.net/manpages/shorewall-interfaces.html
# #
############################################################################### ###############################################################################
#ZONE INTERFACE BROADCAST OPTIONS FORMAT 2
- lo - ignore ###############################################################################
net all - dhcp,physical=+,routeback,optional #ZONE INTERFACE OPTIONS
- lo ignore
net all dhcp,physical=+,routeback,optional

View File

@@ -6,13 +6,13 @@
# The manpage is also online at # The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-rules.html # http://www.shorewall.net/manpages/shorewall-rules.html
# #
################################################################################################################################################################################### #################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT PORT(S) DEST LIMIT GROUP # PORT PORT(S) DEST LIMIT GROUP
#SECTION ALL #SECTION ALL
#SECTION ESTABLISHED #SECTION ESTABLISHED
#SECTION RELATED #SECTION RELATED
SECTION NEW SECTION NEW
Invalid(DROP) net $FW tcp
SSH(ACCEPT) net $FW SSH(ACCEPT) net $FW
Ping(ACCEPT) net $FW Ping(ACCEPT) net $FW

View File

@@ -41,6 +41,8 @@ MACLIST_LOG_LEVEL=info
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=info
SFILTER_LOG_LEVEL=info SFILTER_LOG_LEVEL=info
SMURF_LOG_LEVEL=info SMURF_LOG_LEVEL=info
@@ -55,14 +57,20 @@ TCP_FLAGS_LOG_LEVEL=info
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
GEOIPDIR=/usr/share/xt_geoip/LE
IPTABLES= IPTABLES=
IP= IP=
IPSET= IPSET=
LOCKFILE=
MODULESDIR= MODULESDIR=
NFACCT=
PERL=/usr/bin/perl 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
@@ -106,7 +114,9 @@ ADD_SNAT_ALIASES=No
ADMINISABSENTMINDED=Yes ADMINISABSENTMINDED=Yes
AUTO_COMMENT=Yes AUTOCOMMENT=Yes
AUTOHELPERS=Yes
AUTOMAKE=No AUTOMAKE=No
@@ -136,6 +146,8 @@ FASTACCEPT=Yes
FORWARD_CLEAR_MARK= FORWARD_CLEAR_MARK=
HELPERS=
IMPLICIT_CONTINUE=No IMPLICIT_CONTINUE=No
IPSET_WARNINGS=Yes IPSET_WARNINGS=Yes
@@ -166,7 +178,7 @@ MUTEX_TIMEOUT=60
NULL_ROUTE_RFC1918=No NULL_ROUTE_RFC1918=No
OPTIMIZE=15 OPTIMIZE=31
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
@@ -174,6 +186,8 @@ REQUIRE_INTERFACE=Yes
RESTORE_DEFAULT_ROUTE=Yes RESTORE_DEFAULT_ROUTE=Yes
RESTORE_ROUTEMARKS=Yes
RETAIN_ALIASES=No RETAIN_ALIASES=No
ROUTE_FILTER=No ROUTE_FILTER=No
@@ -204,6 +218,8 @@ MACLIST_DISPOSITION=REJECT
RELATED_DISPOSITION=ACCEPT RELATED_DISPOSITION=ACCEPT
RPFILTER_DISPOSITION=DROP
SMURF_DISPOSITION=DROP SMURF_DISPOSITION=DROP
SFILTER_DISPOSITION=DROP SFILTER_DISPOSITION=DROP

View File

@@ -11,5 +11,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-interfaces" # For information about entries in this file, type "man shorewall-interfaces"
############################################################################### ###############################################################################
#ZONE INTERFACE BROADCAST OPTIONS FORMAT 2
net eth0 detect dhcp,tcpflags,logmartians,nosmurfs ###############################################################################
#ZONE INTERFACE OPTIONS
net eth0 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0

View File

@@ -10,14 +10,18 @@
# See the file README.txt for further details. # See the file README.txt for further details.
#------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------
# For information on entries in this file, type "man shorewall-rules" # For information on entries in this file, type "man shorewall-rules"
###################################################################################################################################################################################### #################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT PORT(S) DEST LIMIT GROUP # PORT PORT(S) DEST LIMIT GROUP
#SECTION ALL #SECTION ALL
#SECTION ESTABLISHED #SECTION ESTABLISHED
#SECTION RELATED #SECTION RELATED
SECTION NEW SECTION NEW
# Drop packets in the INVALID state
Invalid(DROP) net $FW tcp
# Drop Ping from the "bad" net zone.. and prevent your log from being flooded.. # Drop Ping from the "bad" net zone.. and prevent your log from being flooded..
Ping(DROP) net $FW Ping(DROP) net $FW

View File

@@ -13,7 +13,7 @@
# #
# For information about the settings in this file, type "man shorewall.conf" # For information about the settings in this file, type "man shorewall.conf"
# #
# The manpage is also online at # The manpage is also online at
# http://shorewall.net/manpages/shorewall.conf.html # http://shorewall.net/manpages/shorewall.conf.html
# #
############################################################################### ###############################################################################
@@ -52,6 +52,8 @@ MACLIST_LOG_LEVEL=info
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=info
SFILTER_LOG_LEVEL=info SFILTER_LOG_LEVEL=info
SMURF_LOG_LEVEL=info SMURF_LOG_LEVEL=info
@@ -66,14 +68,20 @@ TCP_FLAGS_LOG_LEVEL=info
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
GEOIPDIR=/usr/share/xt_geoip/LE
IPTABLES= IPTABLES=
IP= IP=
IPSET= IPSET=
LOCKFILE=
MODULESDIR= MODULESDIR=
NFACCT=
PERL=/usr/bin/perl 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
@@ -117,7 +125,9 @@ ADD_SNAT_ALIASES=No
ADMINISABSENTMINDED=Yes ADMINISABSENTMINDED=Yes
AUTO_COMMENT=Yes AUTOCOMMENT=Yes
AUTOHELPERS=Yes
AUTOMAKE=No AUTOMAKE=No
@@ -147,6 +157,8 @@ FASTACCEPT=No
FORWARD_CLEAR_MARK= FORWARD_CLEAR_MARK=
HELPERS=
IMPLICIT_CONTINUE=No IMPLICIT_CONTINUE=No
IPSET_WARNINGS=Yes IPSET_WARNINGS=Yes
@@ -177,7 +189,7 @@ MUTEX_TIMEOUT=60
NULL_ROUTE_RFC1918=No NULL_ROUTE_RFC1918=No
OPTIMIZE=1 OPTIMIZE=31
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
@@ -185,6 +197,8 @@ REQUIRE_INTERFACE=No
RESTORE_DEFAULT_ROUTE=Yes RESTORE_DEFAULT_ROUTE=Yes
RESTORE_ROUTEMARKS=Yes
RETAIN_ALIASES=No RETAIN_ALIASES=No
ROUTE_FILTER=No ROUTE_FILTER=No
@@ -215,6 +229,8 @@ MACLIST_DISPOSITION=REJECT
RELATED_DISPOSITION=ACCEPT RELATED_DISPOSITION=ACCEPT
RPFILTER_DISPOSITION=DROP
SMURF_DISPOSITION=DROP SMURF_DISPOSITION=DROP
SFILTER_DISPOSITION=DROP SFILTER_DISPOSITION=DROP

View File

@@ -11,7 +11,9 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-interfaces" # For information about entries in this file, type "man shorewall-interfaces"
############################################################################### ###############################################################################
#ZONE INTERFACE BROADCAST OPTIONS FORMAT 2
net eth0 detect tcpflags,dhcp,nosmurfs,routefilter,logmartians ###############################################################################
loc eth1 detect tcpflags,nosmurfs,routefilter,logmartians #ZONE INTERFACE OPTIONS
dmz eth2 detect tcpflags,nosmurfs,routefilter,logmartians net eth0 tcpflags,dhcp,nosmurfs,routefilter,logmartians,sourceroute=0
loc eth1 tcpflags,nosmurfs,routefilter,logmartians
dmz eth2 tcpflags,nosmurfs,routefilter,logmartians

View File

@@ -10,8 +10,9 @@
# See the file README.txt for further details. # See the file README.txt for further details.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-masq" # For information about entries in this file, type "man shorewall-masq"
############################################################################## ################################################################################################################
#INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK #INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL
# GROUP DEST
eth0 10.0.0.0/8,\ eth0 10.0.0.0/8,\
169.254.0.0/16,\ 169.254.0.0/16,\
172.16.0.0/12,\ 172.16.0.0/12,\

View File

@@ -10,8 +10,8 @@
# See the file README.txt for further details. # See the file README.txt for further details.
#------------------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-rules" # For information about entries in this file, type "man shorewall-rules"
###################################################################################################################################################################################### #################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT PORT(S) DEST LIMIT GROUP # PORT PORT(S) DEST LIMIT GROUP
#SECTION ALL #SECTION ALL
#SECTION ESTABLISHED #SECTION ESTABLISHED
@@ -20,7 +20,7 @@ SECTION NEW
# Don't allow connection pickup from the net # Don't allow connection pickup from the net
# #
Invalid(DROP) net all Invalid(DROP) net all tcp
# #
# Accept DNS connections from the firewall to the Internet # Accept DNS connections from the firewall to the Internet
# #

View File

@@ -14,7 +14,7 @@
# #
# For information about the settings in this file, type "man shorewall.conf" # For information about the settings in this file, type "man shorewall.conf"
# #
# The manpage is also online at # The manpage is also online at
# http://shorewall.net/manpages/shorewall.conf.html # http://shorewall.net/manpages/shorewall.conf.html
# #
############################################################################### ###############################################################################
@@ -50,6 +50,8 @@ MACLIST_LOG_LEVEL=info
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=info
SFILTER_LOG_LEVEL=info SFILTER_LOG_LEVEL=info
SMURF_LOG_LEVEL=info SMURF_LOG_LEVEL=info
@@ -64,14 +66,20 @@ TCP_FLAGS_LOG_LEVEL=info
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
GEOIPDIR=/usr/share/xt_geoip/LE
IPTABLES= IPTABLES=
IP= IP=
IPSET= IPSET=
LOCKFILE=
MODULESDIR= MODULESDIR=
NFACCT=
PERL=/usr/bin/perl 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
@@ -115,7 +123,9 @@ ADD_SNAT_ALIASES=No
ADMINISABSENTMINDED=Yes ADMINISABSENTMINDED=Yes
AUTO_COMMENT=Yes AUTOCOMMENT=Yes
AUTOHELPERS=Yes
AUTOMAKE=No AUTOMAKE=No
@@ -145,6 +155,8 @@ FASTACCEPT=No
FORWARD_CLEAR_MARK= FORWARD_CLEAR_MARK=
HELPERS=
IMPLICIT_CONTINUE=No IMPLICIT_CONTINUE=No
IPSET_WARNINGS=Yes IPSET_WARNINGS=Yes
@@ -175,7 +187,7 @@ MUTEX_TIMEOUT=60
NULL_ROUTE_RFC1918=No NULL_ROUTE_RFC1918=No
OPTIMIZE=1 OPTIMIZE=31
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
@@ -183,6 +195,8 @@ REQUIRE_INTERFACE=No
RESTORE_DEFAULT_ROUTE=Yes RESTORE_DEFAULT_ROUTE=Yes
RESTORE_ROUTEMARKS=Yes
RETAIN_ALIASES=No RETAIN_ALIASES=No
ROUTE_FILTER=No ROUTE_FILTER=No
@@ -213,6 +227,8 @@ MACLIST_DISPOSITION=REJECT
RELATED_DISPOSITION=ACCEPT RELATED_DISPOSITION=ACCEPT
RPFILTER_DISPOSITION=DROP
SMURF_DISPOSITION=DROP SMURF_DISPOSITION=DROP
SFILTER_DISPOSITION=DROP SFILTER_DISPOSITION=DROP

View File

@@ -1,6 +1,6 @@
# #
# Shorewall6 version 4.0 - Sample Routestopped File for two-interface configuration. # Shorewall version 4.5 - Sample Stoppedrules File for three-interface configuration.
# Copyright (C) 2006,2008 by the Shorewall Team # Copyright (C) 2012 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -9,11 +9,12 @@
# #
# See the file README.txt for further details. # See the file README.txt for further details.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall6-routestopped" # For information about entries in this file, type "man shorewall-stoppedrules"
# ###############################################################################
# See http://shorewall.net/starting_and_stopping_shorewall.htm for additional #ACTION SOURCE DEST PROTO DEST SOURCE
# information. # PORT(S) PORT(S)
# ACCEPT eth1 -
############################################################################## ACCEPT - eth1
#INTERFACE HOST(S) OPTIONS ACCEPT eth2 -
eth1 - ACCEPT - eth2

View File

@@ -11,6 +11,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-interfaces" # For information about entries in this file, type "man shorewall-interfaces"
############################################################################### ###############################################################################
#ZONE INTERFACE BROADCAST OPTIONS FORMAT 2
net eth0 detect dhcp,tcpflags,nosmurfs,routefilter,logmartians ###############################################################################
loc eth1 detect tcpflags,nosmurfs,routefilter,logmartians #ZONE INTERFACE OPTIONS
net eth0 dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0
loc eth1 tcpflags,nosmurfs,routefilter,logmartians

View File

@@ -10,8 +10,9 @@
# See the file README.txt for further details. # See the file README.txt for further details.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-masq" # For information about entries in this file, type "man shorewall-masq"
############################################################################### ################################################################################################################
#INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK #INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL
# GROUP DEST
eth0 10.0.0.0/8,\ eth0 10.0.0.0/8,\
169.254.0.0/16,\ 169.254.0.0/16,\
172.16.0.0/12,\ 172.16.0.0/12,\

View File

@@ -10,8 +10,8 @@
# See the file README.txt for further details. # See the file README.txt for further details.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-rules" # For information about entries in this file, type "man shorewall-rules"
###################################################################################################################################################################################### #################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT PORT(S) DEST LIMIT GROUP # PORT PORT(S) DEST LIMIT GROUP
#SECTION ALL #SECTION ALL
#SECTION ESTABLISHED #SECTION ESTABLISHED
@@ -20,7 +20,7 @@ SECTION NEW
# Don't allow connection pickup from the net # Don't allow connection pickup from the net
# #
Invalid(DROP) net all Invalid(DROP) net all tcp
# #
# Accept DNS connections from the firewall to the network # Accept DNS connections from the firewall to the network
# #

View File

@@ -3,7 +3,7 @@
# Shorewall version 4.0 - Sample shorewall.conf for two-interface # Shorewall version 4.0 - Sample shorewall.conf for two-interface
# configuration. # configuration.
# Copyright (C) 2006,2007 by the Shorewall Team # Copyright (C) 2006,2007 by the Shorewall Team
# 2011 by Thomas M. Eastep # 2011 by Thomas M. Eastep
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,7 @@
# #
# For information about the settings in this file, type "man shorewall.conf" # For information about the settings in this file, type "man shorewall.conf"
# #
# The manpage is also online at # The manpage is also online at
# http://shorewall.net/manpages/shorewall.conf.html # http://shorewall.net/manpages/shorewall.conf.html
# #
############################################################################### ###############################################################################
@@ -53,6 +53,8 @@ MACLIST_LOG_LEVEL=info
RELATED_LOG_LEVEL= RELATED_LOG_LEVEL=
RPFILTER_LOG_LEVEL=info
SFILTER_LOG_LEVEL=info SFILTER_LOG_LEVEL=info
SMURF_LOG_LEVEL=info SMURF_LOG_LEVEL=info
@@ -67,14 +69,20 @@ TCP_FLAGS_LOG_LEVEL=info
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
GEOIPDIR=/usr/share/xt_geoip/LE
IPTABLES= IPTABLES=
IP= IP=
IPSET= IPSET=
LOCKFILE=
MODULESDIR= MODULESDIR=
NFACCT=
PERL=/usr/bin/perl 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
@@ -118,7 +126,9 @@ ADD_SNAT_ALIASES=No
ADMINISABSENTMINDED=Yes ADMINISABSENTMINDED=Yes
AUTO_COMMENT=Yes AUTOCOMMENT=Yes
AUTOHELPERS=Yes
AUTOMAKE=No AUTOMAKE=No
@@ -148,6 +158,8 @@ FASTACCEPT=No
FORWARD_CLEAR_MARK= FORWARD_CLEAR_MARK=
HELPERS=
IMPLICIT_CONTINUE=No IMPLICIT_CONTINUE=No
IPSET_WARNINGS=Yes IPSET_WARNINGS=Yes
@@ -178,7 +190,7 @@ MUTEX_TIMEOUT=60
NULL_ROUTE_RFC1918=No NULL_ROUTE_RFC1918=No
OPTIMIZE=1 OPTIMIZE=31
OPTIMIZE_ACCOUNTING=No OPTIMIZE_ACCOUNTING=No
@@ -186,6 +198,8 @@ REQUIRE_INTERFACE=No
RESTORE_DEFAULT_ROUTE=Yes RESTORE_DEFAULT_ROUTE=Yes
RESTORE_ROUTEMARKS=Yes
RETAIN_ALIASES=No RETAIN_ALIASES=No
ROUTE_FILTER=No ROUTE_FILTER=No
@@ -216,6 +230,8 @@ MACLIST_DISPOSITION=REJECT
RELATED_DISPOSITION=ACCEPT RELATED_DISPOSITION=ACCEPT
RPFILTER_DISPOSITION=DROP
SMURF_DISPOSITION=DROP SMURF_DISPOSITION=DROP
SFILTER_DISPOSITION=DROP SFILTER_DISPOSITION=DROP

View File

@@ -1,6 +1,6 @@
# #
# Shorewall version 4.0 - Sample Routestopped File for two-interface configuration. # Shorewall version 4.5 - Sample Stoppedrules File for two-interface configuration.
# Copyright (C) 2006 by the Shorewall Team # Copyright (C) 2012 by the Shorewall Team
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@@ -9,7 +9,9 @@
# #
# See the file README.txt for further details. # See the file README.txt for further details.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# For information about entries in this file, type "man shorewall-routestopped" # For information about entries in this file, type "man shorewall-stoppedrules"
############################################################################## ###############################################################################
#INTERFACE HOST(S) OPTIONS #ACTION SOURCE DEST PROTO DEST SOURCE
eth1 - # PORT(S) PORT(S)
ACCEPT eth1 -
ACCEPT - eth1

View File

@@ -22,7 +22,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# Broadcast[([<action>|-[,{audit|-}])] # Broadcast[([<action>|-[,{audit|-}])]
# #
# Default action is DROP # Default action is DROP
# #
@@ -31,7 +31,7 @@ FORMAT 2
DEFAULTS DROP,- DEFAULTS DROP,-
BEGIN PERL; ?BEGIN PERL;
use Shorewall::IPAddrs; use Shorewall::IPAddrs;
use Shorewall::Config; use Shorewall::Config;
@@ -43,6 +43,7 @@ fatal_error "Invalid parameter ($audit) to action Broadcast" if supplied $audi
fatal_error "Invalid parameter ($action) to action Broadcast" unless $action =~ /^(?:ACCEPT|DROP|REJECT)$/; fatal_error "Invalid parameter ($action) to action Broadcast" unless $action =~ /^(?:ACCEPT|DROP|REJECT)$/;
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
my $target = require_audit ( $action , $audit ); my $target = require_audit ( $action , $audit );
@@ -51,7 +52,7 @@ if ( have_capability( 'ADDRTYPE' ) ) {
log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type BROADCAST '; log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type BROADCAST ';
log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type MULTICAST '; log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type MULTICAST ';
log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type ANYCAST '; log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type ANYCAST ';
} }
add_jump $chainref, $target, 0, '-m addrtype --dst-type BROADCAST '; add_jump $chainref, $target, 0, '-m addrtype --dst-type BROADCAST ';
add_jump $chainref, $target, 0, '-m addrtype --dst-type MULTICAST '; add_jump $chainref, $target, 0, '-m addrtype --dst-type MULTICAST ';
@@ -64,10 +65,10 @@ if ( have_capability( 'ADDRTYPE' ) ) {
decr_cmd_level $chainref; decr_cmd_level $chainref;
add_commands $chainref, 'done'; add_commands $chainref, 'done';
} }
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d 224.0.0.0/4 ' if $level ne ''; log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d 224.0.0.0/4 ' if $level ne '';
add_jump $chainref, $target, 0, '-d 224.0.0.0/4 '; add_jump $chainref, $target, 0, '-d 224.0.0.0/4 ';
1; 1;
END PERL; ?END PERL;

View File

@@ -33,15 +33,15 @@
############################################################################### ###############################################################################
FORMAT 2 FORMAT 2
# #
# The following magic provides different defaults for $2 thru $5, when $1 is # The following magic provides different defaults for $2 thru $5, when $1 is
# 'audit'. # 'audit'.
# #
BEGIN PERL; ?BEGIN PERL;
use Shorewall::Config; use Shorewall::Config;
my ( $p1, $p2, $p3 , $p4, $p5 ) = get_action_params( 5 ); my ( $p1, $p2, $p3 , $p4, $p5 ) = get_action_params( 5 );
if ( defined $p1 ) { if ( defined $p1 ) {
if ( $p1 eq 'audit' ) { if ( $p1 eq 'audit' ) {
set_action_param( 2, 'A_REJECT') unless supplied $p2; set_action_param( 2, 'A_REJECT') unless supplied $p2;
set_action_param( 3, 'A_DROP') unless supplied $p3; set_action_param( 3, 'A_DROP') unless supplied $p3;
@@ -54,7 +54,7 @@ if ( defined $p1 ) {
1; 1;
END PERL; ?END PERL;
DEFAULTS -,REJECT,DROP,ACCEPT,DROP DEFAULTS -,REJECT,DROP,ACCEPT,DROP

View File

@@ -13,15 +13,17 @@ FORMAT 2
DEFAULTS - DEFAULTS -
BEGIN PERL; ?BEGIN PERL;
use strict; use strict;
use Shorewall::Config qw(:DEFAULT F_IPV4 F_IPV6); use Shorewall::Config qw(:DEFAULT F_IPV4 F_IPV6);
use Shorewall::IPAddrs qw( IPv6_MULTICAST );
use Shorewall::Chains; use Shorewall::Chains;
use Shorewall::Rules; use Shorewall::Rules;
my ( $audit ) = get_action_params( 1 ); my ( $audit ) = get_action_params( 1 );
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
my $target; my $target;
@@ -41,15 +43,15 @@ if ( $level ne '-' || $audit ne '-' ) {
fatal_error "Invalid argument ($audit) to DropSmurfs" if $audit ne 'audit'; fatal_error "Invalid argument ($audit) to DropSmurfs" if $audit ne 'audit';
require_capability 'AUDIT_TARGET', q(Passing 'audit' to the DropSmurfs action), 's'; require_capability 'AUDIT_TARGET', q(Passing 'audit' to the DropSmurfs action), 's';
add_ijump( $logchainref, j => 'AUDIT --type DROP' ); add_ijump( $logchainref, j => 'AUDIT --type DROP' );
} }
add_ijump( $logchainref, j => 'DROP' ); add_ijump( $logchainref, j => 'DROP' );
$target = $logchainref; $target = $logchainref;
} else { } else {
$target = 'DROP'; $target = 'DROP';
} }
if ( have_capability( 'ADDRTYPE' ) ) { if ( have_capability( 'ADDRTYPE' ) ) {
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
add_ijump $chainref , j => 'RETURN', s => '0.0.0.0'; ; add_ijump $chainref , j => 'RETURN', s => '0.0.0.0'; ;
@@ -64,7 +66,7 @@ if ( have_capability( 'ADDRTYPE' ) ) {
} else { } else {
add_commands $chainref, 'for address in $ALL_ACASTS; do'; add_commands $chainref, 'for address in $ALL_ACASTS; do';
} }
incr_cmd_level $chainref; incr_cmd_level $chainref;
add_ijump( $chainref, g => $target, s => '$address' ); add_ijump( $chainref, g => $target, s => '$address' );
decr_cmd_level $chainref; decr_cmd_level $chainref;
@@ -77,9 +79,9 @@ if ( $family == F_IPV4 ) {
add_ijump( $chainref, g => $target, s => IPv6_MULTICAST ); add_ijump( $chainref, g => $target, s => IPv6_MULTICAST );
} }
END PERL; ?END PERL;

View File

@@ -22,7 +22,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# Invalid[([<action>|-[,{audit|-}])] # Invalid[([<action>|-[,{audit|-}])]
# #
# Default action is DROP # Default action is DROP
# #
@@ -31,7 +31,7 @@ FORMAT 2
DEFAULTS DROP,- DEFAULTS DROP,-
BEGIN PERL; ?BEGIN PERL;
use Shorewall::IPAddrs; use Shorewall::IPAddrs;
use Shorewall::Config; use Shorewall::Config;
@@ -43,6 +43,7 @@ fatal_error "Invalid parameter ($audit) to action Invalid" if supplied $audit
fatal_error "Invalid parameter ($action) to action Invalid" unless $action =~ /^(?:ACCEPT|DROP|REJECT)$/; fatal_error "Invalid parameter ($action) to action Invalid" unless $action =~ /^(?:ACCEPT|DROP|REJECT)$/;
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
my $target = require_audit ( $action , $audit ); my $target = require_audit ( $action , $audit );
@@ -53,4 +54,4 @@ allow_optimize( $chainref );
1; 1;
END PERL; ?END PERL;

View File

@@ -22,7 +22,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# NotSyn[([<action>|-[,{audit|-}])] # NotSyn[([<action>|-[,{audit|-}])]
# #
# Default action is DROP # Default action is DROP
# #
@@ -31,7 +31,7 @@ FORMAT 2
DEFAULTS DROP,- DEFAULTS DROP,-
BEGIN PERL; ?BEGIN PERL;
use Shorewall::IPAddrs; use Shorewall::IPAddrs;
use Shorewall::Config; use Shorewall::Config;
@@ -43,6 +43,7 @@ fatal_error "Invalid parameter ($audit) to action NotSyn" if supplied $audit &
fatal_error "Invalid parameter ($action) to action NotSyn" unless $action =~ /^(?:ACCEPT|DROP|REJECT)$/; fatal_error "Invalid parameter ($action) to action NotSyn" unless $action =~ /^(?:ACCEPT|DROP|REJECT)$/;
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
my $target = require_audit ( $action , $audit ); my $target = require_audit ( $action , $audit );
@@ -53,4 +54,4 @@ allow_optimize( $chainref );
1; 1;
END PERL; ?END PERL;

56
Shorewall/action.RST Normal file
View File

@@ -0,0 +1,56 @@
#
# Shorewall 4 - RST Action
#
# /usr/share/shorewall/action.RST
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2012 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# RST[([<action>|-[,{audit|-}])]
#
# Default action is DROP
#
##########################################################################################
FORMAT 2
DEFAULTS DROP,-
?BEGIN PERL;
use Shorewall::Config;
use Shorewall::Chains;
my ( $action, $audit ) = get_action_params( 2 );
fatal_error "Invalid parameter ($audit) to action RST" if supplied $audit && $audit ne 'audit';
fatal_error "Invalid parameter ($action) to action RST" unless $action =~ /^(?:ACCEPT|DROP)$/;
my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging;
my $target = require_audit ( $action , $audit );
log_rule_limit $level, $chainref, 'RST' , $action, '', $tag, 'add', '-p 6 --tcp-flags RST RST ' if $level ne '';
add_jump $chainref , $target, 0, '-p 6 --tcp-flags RST RST ';
allow_optimize( $chainref );
1;
?END PERL;

View File

@@ -29,15 +29,15 @@
############################################################################### ###############################################################################
FORMAT 2 FORMAT 2
# #
# The following magic provides different defaults for $2 thru $5, when $1 is # The following magic provides different defaults for $2 thru $5, when $1 is
# 'audit'. # 'audit'.
# #
BEGIN PERL; ?BEGIN PERL;
use Shorewall::Config; use Shorewall::Config;
my ( $p1, $p2, $p3 , $p4, $p5 ) = get_action_params( 5 ); my ( $p1, $p2, $p3 , $p4, $p5 ) = get_action_params( 5 );
if ( defined $p1 ) { if ( defined $p1 ) {
if ( $p1 eq 'audit' ) { if ( $p1 eq 'audit' ) {
set_action_param( 2, 'A_REJECT') unless supplied $p2; set_action_param( 2, 'A_REJECT') unless supplied $p2;
set_action_param( 3, 'A_REJECT') unless supplied $p3; set_action_param( 3, 'A_REJECT') unless supplied $p3;
@@ -50,7 +50,7 @@ if ( defined $p1 ) {
1; 1;
END PERL; ?END PERL;
DEFAULTS -,REJECT,REJECT,ACCEPT,DROP DEFAULTS -,REJECT,REJECT,ACCEPT,DROP

View File

@@ -1,7 +1,7 @@
# #
# Shorewall version 4 - Drop Smurfs Action # Shorewall version 4 - Drop TCPFlags Action
# #
# /usr/share/shorewall/action.DropSmurfs # /usr/share/shorewall/action.TCPFlags
# #
# Accepts a single optional parameter: # Accepts a single optional parameter:
# #
@@ -13,18 +13,18 @@ FORMAT 2
DEFAULTS DROP,- DEFAULTS DROP,-
BEGIN PERL; ?BEGIN PERL;
use strict; use strict;
use Shorewall::Config qw(:DEFAULT F_IPV4 F_IPV6); use Shorewall::Config qw(:DEFAULT F_IPV4 F_IPV6);
use Shorewall::Chains; use Shorewall::Chains;
my ( $disposition, $audit ) = get_action_params( 2 ); my ( $disposition, $audit ) = get_action_params( 2 );
my $chainref = get_action_chain; my $chainref = get_action_chain;
my ( $level, $tag ) = get_action_logging; my ( $level, $tag ) = get_action_logging;
fatal_error q(The first argument to 'TCPFlags' must be ACCEPT, REJECT, or DROP) unless $disposition =~ /^(ACCEPT|REJECT|DROP)$/; fatal_error q(The first argument to 'TCPFlags' must be ACCEPT, REJECT, or DROP) unless $disposition =~ /^(ACCEPT|REJECT|DROP)$/;
if ( $level ne '-' || $audit ne '-' ) { if ( $level ne '-' || $audit ne '-' ) {
my $logchainref = ensure_filter_chain newlogchain( $chainref->{table} ), 0; my $logchainref = ensure_filter_chain newlogchain( $chainref->{table} ), 0;
@@ -42,22 +42,22 @@ if ( $level ne '-' || $audit ne '-' ) {
fatal_error "Invalid argument ($audit) to TCPFlags" if $audit ne 'audit'; fatal_error "Invalid argument ($audit) to TCPFlags" if $audit ne 'audit';
require_capability 'AUDIT_TARGET', q(Passing 'audit' to the TCPFlags action), 's'; require_capability 'AUDIT_TARGET', q(Passing 'audit' to the TCPFlags action), 's';
add_ijump( $logchainref, j => 'AUDIT --type ' . lc $disposition ); add_ijump( $logchainref, j => 'AUDIT --type ' . lc $disposition );
} }
add_ijump( $logchainref, g => $disposition ); add_ijump( $logchainref, g => $disposition );
$disposition = $logchainref; $disposition = $logchainref;
} }
add_ijump $chainref , g => $disposition, p => 'tcp --tcp-flags ALL FIN,URG,PSH'; add_ijump $chainref , g => $disposition, p => 'tcp --tcp-flags ALL FIN,URG,PSH';
add_ijump $chainref , g => $disposition, p => 'tcp --tcp-flags ALL NONE'; add_ijump $chainref , g => $disposition, p => 'tcp --tcp-flags ALL NONE';
add_ijump $chainref , g => $disposition, p => 'tcp --tcp-flags SYN,RST SYN,RST'; add_ijump $chainref , g => $disposition, p => 'tcp --tcp-flags SYN,RST SYN,RST';
add_ijump $chainref , g => $disposition, p => 'tcp --tcp-flags SYN,FIN SYN,FIN'; add_ijump $chainref , g => $disposition, p => 'tcp --tcp-flags SYN,FIN SYN,FIN';
add_ijump $chainref , g => $disposition, p => 'tcp --syn --sport 0'; add_ijump $chainref , g => $disposition, p => 'tcp --syn --sport 0';
END PERL; ?END PERL;

View File

@@ -21,6 +21,6 @@
####################################################################################################### #######################################################################################################
# DO NOT REMOVE THE FOLLOWING LINE # DO NOT REMOVE THE FOLLOWING LINE
FORMAT 2 FORMAT 2
#################################################################################################################################################################### #################################################################################################################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT PORT(S) DEST LIMIT GROUP # PORT PORT(S) DEST LIMIT GROUP

View File

@@ -33,12 +33,13 @@
# #
############################################################################### ###############################################################################
#ACTION #ACTION
A_Drop # Audited Default Action for DROP policy A_Drop # Audited Default Action for DROP policy
A_Reject # Audited Default action for REJECT policy A_Reject # Audited Default action for REJECT policy
Broadcast # Handles Broadcast/Multicast/Anycast Broadcast noinline # Handles Broadcast/Multicast/Anycast
Drop # Default Action for DROP policy Drop # Default Action for DROP policy
DropSmurfs # Drop smurf packets DropSmurfs noinline # Drop smurf packets
Invalid # Handles packets in the INVALID conntrack state Invalid noinline # Handles packets in the INVALID conntrack state
NotSyn # Handles TCP packets which do not have SYN=1 and ACK=0 NotSyn noinline # Handles TCP packets which do not have SYN=1 and ACK=0
Reject # Default Action for REJECT policy Reject # Default Action for REJECT policy
TCPFlags # Handle bad flag combinations. RST noinline # Handle packets with RST set
TCPFlags noinline # Handle bad flag combinations.

View File

@@ -7,6 +7,6 @@
# #
# Please see http://shorewall.net/Actions.html for additional information. # Please see http://shorewall.net/Actions.html for additional information.
# #
############################################################################### ########################################################################################
#ACTION COMMENT (place '# ' below the 'C' in comment followed by #ACTION OPTIONS COMMENT (place '# ' below the 'C' in comment followed by
# a comment describing the action) # v a comment describing the action)

View File

@@ -1,11 +0,0 @@
#
# Shorewall version 4 - Blacklist File
#
# For information about entries in this file, type "man shorewall-blacklist"
#
# Please see http://shorewall.net/blacklisting_support.htm for additional
# information.
#
###############################################################################
#ADDRESS/SUBNET PROTOCOL PORT OPTIONS

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