Compare commits

..

262 Commits

Author SHA1 Message Date
Tom Eastep
d63374611c Update TRACK_PROVIDER description in the man pages.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-14 08:37:16 -08:00
Tom Eastep
9a4675c958 Add appropriate 'use' statement to Limit code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-14 08:05:37 -08:00
Tom Eastep
810cb60dfc Update manpages for TRACK_PROVIDERS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-14 07:49:33 -08:00
Tom Eastep
11a4c2345c Add multicast address to mDNS macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 13:20:48 -08:00
Tom Eastep
2c6732f13c Add IGMP to the mDNS macro.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 13:20:34 -08:00
Tom Eastep
b87059157b Use TRACK_PROVIDERS to condition tracked packets and PREROUTING
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 12:56:06 -08:00
Tom Eastep
5fcba1e80a Use TRACK_PROVIDERS to condition tracked packets and PREROUTING
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 12:55:40 -08:00
Tom Eastep
95f45ec17a Remove mention of allowoutUPnP
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 12:55:05 -08:00
Tom Eastep
ee63239102 Make it clear that the variable expansion restriction applies to config files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:37:00 -08:00
Tom Eastep
8be999c42a Don't run ip6tables until we know it exists
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:16:57 -08:00
Tom Eastep
b1055f6f95 Allow Shorewall6 to display the tc config of one interface
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:13:19 -08:00
Tom Eastep
72fb1ccbc9 Change quantum to 1875 for simple TC SFQ.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:12:53 -08:00
Tom Eastep
d0cb88429f Correct typo in Shell Variable section
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-13 08:12:34 -08:00
Tom Eastep
e57bd6f283 Change release version for 'show macros'.
Remove 'new feature'.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:58:41 -08:00
Tom Eastep
172746c2dc Export empty RECOVERING from the -lite programs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:54:53 -08:00
Tom Eastep
710c508a17 Update manpage for 'show macro' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:25:47 -08:00
Tom Eastep
0bc24c78ad Document 'show macro' in release docs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:13:55 -08:00
Tom Eastep
e5112e8fbf Add 'show macro' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 13:12:01 -08:00
Tom Eastep
b57bfa0def Update Lenny->Squeeze doc to indicate that 4.4 is now in Sid
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 12:27:55 -08:00
Tom Eastep
dab8200a73 Don't check wildcard interfaces with is_bridge().
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 11:20:18 -08:00
Tom Eastep
dcc6871fb5 Correct typo in Multi-ISP doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 11:19:53 -08:00
Tom Eastep
393cf37aa9 Expand DHCP relay instructions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 09:12:29 -08:00
Tom Eastep
25fcff6c47 Use bridge detection when generating forwarding rules for 'stop'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 09:04:52 -08:00
Tom Eastep
080f810366 Update DHCP document for forwarding.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 07:59:48 -08:00
Tom Eastep
16380c2c3a Add DHCPfwd macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 07:57:00 -08:00
Tom Eastep
dad38b7b4d Apply Macro changes from Tuomo Soini
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-12 07:56:41 -08:00
Tom Eastep
18e1b10d5c Describe bridge autodetection in the release docs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 19:37:16 -08:00
Tom Eastep
eb5df9b696 Automatically set 'routeback' for local bridges
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 19:25:25 -08:00
Tom Eastep
286708df4d Add an 'is_bridge' function for future use
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 19:05:44 -08:00
Tom Eastep
616bf266fb Delete tc4shorewall link from the traffic shaping page
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 12:47:47 -08:00
Tom Eastep
b6c9ea4746 Remove IPMARK from shorewall6-tcrules.xml
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 10:28:28 -08:00
Tom Eastep
b8d9ce8361 Restore mention of HIGH_ROUTE_MARKS for 4.4 users' benefit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 10:27:01 -08:00
Tom Eastep
260fbb59cc More tcrules changes (both IPv4 and IPv6).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 08:21:22 -08:00
Tom Eastep
ce9b4b52c3 Replace HIGH_ROUTE_MARKS text.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 07:25:51 -08:00
Tom Eastep
8b95b05aef More corrections to tcrules manpage
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 07:19:55 -08:00
Tom Eastep
b43a8b7c0c Make chain-designator syntax more explicit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 07:11:48 -08:00
Tom Eastep
b4a2528c37 Formatting improvements to shorewall-tcrules(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 07:01:12 -08:00
Tom Eastep
865b46c42e Clean up release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 06:55:35 -08:00
Tom Eastep
b0e80e5dc3 Reorganize tcrules manpage
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-11 06:02:06 -08:00
Tom Eastep
7413d2a045 Adjust TPROXY parameter list order to match syntax.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-10 09:49:38 -08:00
Tom Eastep
6219c7aaa1 Fix typo in clear_firewall()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-09 07:29:29 -08:00
Tom Eastep
fe4611be00 Add [...] to IPv6 doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 15:11:51 -08:00
Tom Eastep
73ae0c2067 Allow both <...> and [...] for IPv6 Addresses
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 13:54:31 -08:00
Tom Eastep
46c400201b More updates for Squid/TPROXY doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 13:33:09 -08:00
Tom Eastep
d3733e15d2 Bump version to 4.5.4.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 09:47:54 -08:00
Tom Eastep
a97bc1d4a1 Add link to Squid TPROXY documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 09:15:15 -08:00
Tom Eastep
3805cc275b Add TPROXY to release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 08:54:12 -08:00
Tom Eastep
d11b0d19b2 Add ID to TPROXY section of the Squid doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-08 08:51:31 -08:00
Tom Eastep
adbfaaa885 Long overdue update of LIBVERSION
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-07 15:58:18 -08:00
Tom Eastep
1a36e5122e Correct log file for Debian and derivatives
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-07 11:40:43 -08:00
Tom Eastep
8c67d034df Change TPROXY to TPROXY_TARGET
Correct typo in capabilities report

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-07 10:47:55 -08:00
Tom Eastep
fff60fbd7d Add IPMARK and TPROXY to modules file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-07 10:15:03 -08:00
Tom Eastep
165a3a1a3a Add a TPROXY capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-07 10:03:45 -08:00
Tom Eastep
d29530a4d1 Clarify that only the 'mark' parameter to TPROXY is required
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-07 07:40:31 -08:00
Tom Eastep
fd76862eec Document TPROXY
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 17:26:53 -08:00
Tom Eastep
21024b5e15 Initial stab at implementing TPROXY support.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 16:05:00 -08:00
Tom Eastep
d2c76cd5de Update Module Versions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 14:21:53 -08:00
Tom Eastep
7330e7bd3b Update Lenny->Squeeze document with correct SAVE_IPSETS info
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 09:07:54 -08:00
Tom Eastep
63bd861fb4 Correct typo in error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 08:27:30 -08:00
Tom Eastep
5a10364c2b Correct handling of 'refresh' failures
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 08:01:06 -08:00
Tom Eastep
3d58058d1f Correct typo in shorewall6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 07:47:34 -08:00
Tom Eastep
c91cdfc030 Don't try to restore ipsets when 'restore' is being used to recover
from a start/restart failure.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-06 07:44:00 -08:00
Tom Eastep
558189bcf8 Set CAPSVERSION to 4.4.7 just to be safe.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 10:03:18 -08:00
Tom Eastep
5758bf5c22 Use EXMARK to conditionally add a mask to tcpri-generated rules.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 09:40:32 -08:00
Tom Eastep
385258946a Implement EXMARK capability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 09:33:29 -08:00
Tom Eastep
d65d18596e Update release documents
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 09:28:16 -08:00
Tom Eastep
ad93449f4d Tc improvements:
- Represent mark masks in hex
- Don't specify a mask in tcpri-generated rules so that old iptables can be
  used.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 09:10:01 -08:00
Tom Eastep
0ceace07c7 Explain SAVE_IPSETS=Yes in 4.4.6 and later versions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 08:05:58 -08:00
Tom Eastep
0e40987103 Delete IPSET disclaimer from Lenny->Squeeze doc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 08:00:17 -08:00
Tom Eastep
c87e1baba4 Replace SVN by GIT in Documentation Index
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 07:49:33 -08:00
Tom Eastep
c63f087ced Update Build Document
- Copyright
- Add additional options to build44
- Add warning about xmlto
- Correct a couple of typos

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-05 07:40:18 -08:00
Tom Eastep
3e5d41dc3d Add FAQ 87
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 17:07:19 -08:00
Tom Eastep
a431818552 Recommend EXPORTPARAMS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 16:30:08 -08:00
Tom Eastep
c3326ef59f Correct typo in release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 16:08:41 -08:00
Tom Eastep
7fac6f68a5 Don't let rules chains be copied or moved
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 16:07:30 -08:00
Tom Eastep
daa8a84492 Bump version to 4.5.3
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 14:48:16 -08:00
Tom Eastep
172911eabc Update the Shorewall-perl document regarding SAVE_IPSETS.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 14:46:03 -08:00
Tom Eastep
e4e36facdc Update shorewall.conf (5) to indicate that SAVE_IPSETS was re-enabled in
shorewall 4.4.6.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 14:35:29 -08:00
Tom Eastep
ea05d251bb Fix typo in IPSET_SAVE restore logic
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 14:21:01 -08:00
Tom Eastep
3a63bf879d SAVE_IPSETS improvements:
- call startup_error() rather than fatal_error() during pre-startup
- generate a call to startup_error() during restore if a restore-ipset file
  exists but shorewall is currently started

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 14:17:14 -08:00
Tom Eastep
6527f5c284 Fix handling of invalid OPTIMIZE values
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 13:04:22 -08:00
Tom Eastep
2d4d1e4441 Correct manpage re save/restore
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 12:46:25 -08:00
Tom Eastep
0af3b5e55d Make save/restore work with SAVE_IPSETS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 12:36:31 -08:00
Tom Eastep
35a480b24c Update manpage for SAVE_IPSETS.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 11:50:59 -08:00
Tom Eastep
d766e43c37 Re-enable SAVE_IPSETS=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 11:14:05 -08:00
Tom Eastep
d7a9109a92 Add a hack to work around a 'feature' of xtables-addons on Lenny
Be more careful about checking for the ipset utility before saving the ipsets

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 10:14:36 -08:00
Tom Eastep
1adf70c926 Hunk omitted from the last commit
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 07:44:19 -08:00
Tom Eastep
3c08d9a84f Move code and add comments:
- Declare all of the 'preview' helpers together in Chains.pm
- Add some clarifying comments in the compiler.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 07:43:14 -08:00
Tom Eastep
8053dcb134 Tiny optimization to the fix for fw2fw
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-04 07:09:11 -08:00
Tom Eastep
f472d2e20e Don't delete logging action chains under optimize 4
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-03 18:41:41 -08:00
Tom Eastep
cb2ebf57f0 Avoid deleting fw2fw
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-03 16:55:12 -08:00
Tom Eastep
fdb89a78b0 Fix optimization of fw2fw
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-03 16:42:07 -08:00
Tom Eastep
59b2bc0e7d Fix logging NONAT rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-03 15:32:03 -08:00
Tom Eastep
1966fcc46c Allow users to preview the generated ruleset.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-03 11:15:52 -08:00
Tom Eastep
c401504cb0 Move function to avoid forward reference
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 17:17:54 -08:00
Tom Eastep
514b77ff9f Delete IFLIST_IF_OPTION for now.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 14:31:55 -08:00
Tom Eastep
14f8b3dcda Add a new interface option type
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 14:23:32 -08:00
Tom Eastep
f6d8186257 Fix a couple of compile-time problems:
1) Revert calls to add_jump in Rules::setup_mac_lists()
2) Call insert_rule1() rather than insert_rule() in Chains::add_jump()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 14:20:37 -08:00
Tom Eastep
0d6a443cad Unify use of add_reference()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 11:19:37 -08:00
Tom Eastep
9812dc4845 Update all .conf files to specify 'MODULE_SUFFIX=ko'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 09:29:02 -08:00
Tom Eastep
044504ff0a Much more efficient implementation of make_mask()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 09:15:41 -08:00
Tom Eastep
7c3a989146 Minor tweaks to OPTIMIZE 4:
- Add/improve comments.
- Remove referenced test from copy_rules()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 09:05:41 -08:00
Tom Eastep
8cfc4f7c61 Fix incorrect optimization when DYNAMIC_BLACKLIST=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 08:45:48 -08:00
Tom Eastep
48a9aeeb66 Revise documentation of OPTIMIZE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-02 08:07:44 -08:00
Tom Eastep
ad6cdd7335 Add last-rule jump to optimiziations & 4 2010-01-01 17:57:30 -08:00
Tom Eastep
c07ad12526 Add OPTIMIZE_ACCOUNTING option.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 14:51:57 -08:00
Tom Eastep
c5f809bacf One more copyright
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 14:12:10 -08:00
Tom Eastep
90f514f9f5 Document Copyrights - 2010
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 14:10:15 -08:00
Tom Eastep
6fd3697e46 Copyright/version changes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 12:03:49 -08:00
Tom Eastep
63ab5019c0 Update some copyrights
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 11:50:03 -08:00
Tom Eastep
5c03e32145 More progress messages during optimization.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 11:41:47 -08:00
Tom Eastep
d89056f975 Another add_rule() call changed to an add_jump() call.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 10:25:32 -08:00
Tom Eastep
2aec19e360 Undo the indentation done in the preceding change through
use of the 'grep' function.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 09:10:42 -08:00
Tom Eastep
ba6c866438 Delete chains with no references
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 08:49:43 -08:00
Tom Eastep
8dbf23938b Merge branch '4.5' of ssh://teastep@shorewall.git.sourceforge.net/gitroot/shorewall/shorewall into 4.5 2010-01-01 07:45:17 -08:00
Tom Eastep
8696bf7e8a Move function and add comment to improve readability
Add pass and chain counters to ruleset optimization

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 07:42:59 -08:00
Tom Eastep
f3e67bfe83 Move function and add comment to improve readability
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2010-01-01 07:23:14 -08:00
Tom Eastep
6d70957588 Allow &Shorewall::Chains::dont_optimize to return a reference to the subject chain.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 15:43:25 -08:00
Tom Eastep
d26b0a3b0f Rename 'emptyok' to 'dont_optimize'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 15:22:40 -08:00
Tom Eastep
47d8d4124e Fix typo in release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 14:36:35 -08:00
Tom Eastep
5a664dbabc Document error from prior commit.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 14:03:10 -08:00
Tom Eastep
09cc16c8c3 Error if tracked interfaces, PROVIDER_OFFSET==0 and 'ipp2p'.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 13:57:32 -08:00
Tom Eastep
4369e95291 Prevent annoying error message on 'save' when DYNAMIC_BLACKLIST=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 13:07:12 -08:00
Tom Eastep
65fdcdbf90 Omit user-defined action chains from optimization
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 11:51:16 -08:00
Tom Eastep
30b4ef9385 Update release notes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 11:50:49 -08:00
Tom Eastep
2e85717d4b Add more comments to optimize_ruleset()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 11:23:55 -08:00
Tom Eastep
49b3421131 Rename try_move_rules() to conditionally_move_rules().
Make the routine a little safer.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 10:52:35 -08:00
Tom Eastep
f62fd47442 Delete temporary nat chain used in capabilities detection.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2009-12-31 10:33:37 -08:00
Tom Eastep
c0c0a7d377 Signed-off-by: Tom Eastep <teastep@shorewall.net>
Additional optimization - built-in chain with single jump rule.
2009-12-31 10:26:33 -08:00
Tom Eastep
1594e0f604 Fix typo in Shorewall::Chains::replace_references1() 2009-12-31 09:39:37 -08:00
Tom Eastep
66d50c508b Make accounting chains 'emptyok' 2009-12-30 14:57:35 -08:00
Tom Eastep
033fa38f00 Allow NONE policy to a bridge port zone 2009-12-30 14:44:48 -08:00
Tom Eastep
dc11daf58c Update option name in bridge doc 2009-12-30 14:41:28 -08:00
Tom Eastep
84a1bccece Version update to 4.5.2 2009-12-30 14:29:09 -08:00
Tom Eastep
95b29279ee Apply optimizaiton to all tables 2009-12-30 13:52:00 -08:00
Tom Eastep
6352e305ac Update known problems 2009-12-30 11:39:16 -08:00
Tom Eastep
7e139aaa68 Default to PROVIDER_OFFSET=8 in the IPv6 samples 2009-12-30 11:25:01 -08:00
Tom Eastep
94a346b699 Default to PROVIDER_OFFSET=8 in the samples 2009-12-30 11:23:38 -08:00
Tom Eastep
28b6e7026a Don't RETURN early in tcpost 2009-12-30 11:21:32 -08:00
Tom Eastep
3d1d037128 SAVE/RESTORE marks if ipp2p 2009-12-30 11:05:31 -08:00
Tom Eastep
ef8c25e605 Avoid Perl error if PROTO eq 'ipp2p' in /etc/shorewall/tcpri 2009-12-30 10:33:32 -08:00
Tom Eastep
b6324cda86 Export 'emptyok' by default 2009-12-30 10:15:48 -08:00
Tom Eastep
d22b7bd9d9 One more tcp->6 replacement 2009-12-30 10:03:33 -08:00
Tom Eastep
a6ba0b7638 Little cleanup of OPTIMIZE=4; replace protocol names by numbers in builtin actions 2009-12-30 09:58:15 -08:00
Tom Eastep
be9d57468f Finish OPTIMIZE=4 2009-12-30 09:45:43 -08:00
Tom Eastep
9133b6030c OPTIMIZE &4 2009-12-29 15:39:55 -08:00
Tom Eastep
83b295f6aa New optimization option 2009-12-29 15:04:03 -08:00
Tom Eastep
2be86c9321 Make forwardUPnP an 'emptyok' chain 2009-12-29 12:42:50 -08:00
Tom Eastep
1cb6fb69bd Optimize out empty zone-forward chains 2009-12-29 12:26:22 -08:00
Tom Eastep
d3360d7e4d Remove references to empty POLICY chains 2009-12-29 11:54:00 -08:00
Tom Eastep
70462ff8be Add 'from' references to chains 2009-12-29 11:39:41 -08:00
Tom Eastep
985ebdf739 Additional optimization with OPTIMIZE & 2 2009-12-29 10:58:36 -08:00
Tom Eastep
cae5307404 Make conditional easier to read 2009-12-29 09:38:06 -08:00
Tom Eastep
fd951051c2 Back out incorrect fix for Marcus Limosani's issue 2009-12-29 08:43:46 -08:00
Tom Eastep
e106580a97 A better solution to Marcus Limosani's issue 2009-12-29 08:21:52 -08:00
Tom Eastep
8ec532df42 Display IPv6 Neighbors in dump 2009-12-28 16:57:10 -08:00
Tom Eastep
93e7ce63a7 Final fix for Marcus Limosani's problem 2009-12-28 15:09:29 -08:00
Tom Eastep
68ea446f8d Fix Marcus Limosani's problem 2009-12-28 14:28:08 -08:00
Tom Eastep
b567062adb Different solution for orphan jumps 2009-12-28 13:45:47 -08:00
Tom Eastep
3bc0c3091f Add tcpri and tcinterfaces to Shorewall6 2009-12-28 09:31:52 -08:00
Tom Eastep
232571df09 Allow COMMENTs in /etc/shorewall/tcpri -- TAKE 2 2009-12-28 09:08:21 -08:00
Tom Eastep
98e2517262 Update Known Problems 2009-12-28 09:08:08 -08:00
Tom Eastep
177e7f27c5 Allow COMMENTs in /etc/shorewall/tcpri 2009-12-28 08:43:46 -08:00
Tom Eastep
699995382a Make use of interface chains deterministic 2009-12-28 07:38:45 -08:00
Tom Eastep
783d6d6a6b Allow 'save' to work with DYNAMIC_BLACKLIST=No 2009-12-27 17:02:20 -08:00
Tom Eastep
efcaee1660 Tweak new TC 2009-12-27 16:42:22 -08:00
Tom Eastep
b6ced8624d Corrections/additions to shorewall*.conf 2009-12-27 14:10:55 -08:00
Tom Eastep
b61720f76d Corrections/additions to shorewall*.conf 2009-12-27 14:01:56 -08:00
Tom Eastep
759b4ee0f5 Don't generate a superfluous rule 2009-12-27 10:44:35 -08:00
Tom Eastep
8631d1833d Allow <device> in 'show tc' 2009-12-27 10:40:13 -08:00
Tom Eastep
713b6f472e Set version to 4.5.1 2009-12-27 08:46:43 -08:00
Tom Eastep
660aff84d3 Don't generate source port rule for ICMP 2009-12-27 08:08:21 -08:00
Tom Eastep
6fa5af8164 Don't generate source port rule for ICMP 2009-12-27 08:06:23 -08:00
Tom Eastep
90a6dbcb66 Restore missing line of code 2009-12-27 07:48:33 -08:00
Tom Eastep
5f7246fddf Update release notes 2009-12-26 16:56:13 -08:00
Tom Eastep
eed02e0acb Simplify handling of MANGLE_ENABLED 2009-12-26 16:08:31 -08:00
Tom Eastep
9865b01ce8 Make simple classification work 2009-12-26 15:00:58 -08:00
Tom Eastep
78fd06f945 Fix simple TC typo 2009-12-26 12:45:11 -08:00
Tom Eastep
e1a0969457 Update simple tc document 2009-12-26 12:32:17 -08:00
Tom Eastep
a66ba644ed Add 'helper' column to tcpri 2009-12-26 09:41:53 -08:00
Tom Eastep
9817a822f0 More TC documentation 2009-12-26 09:32:03 -08:00
Tom Eastep
64b016bede More Simple Traffic Shaping Changes 2009-12-26 08:29:01 -08:00
Tom Eastep
70991c1a98 IPv4 Manpages for simple traffic shaping 2009-12-25 16:02:41 -08:00
Tom Eastep
9ef891a762 Expand simple tc to include interface and address 2009-12-25 14:49:30 -08:00
Tom Eastep
321ca670a7 Make Simple Traffic Shaping actually work 2009-12-25 08:15:49 -08:00
Tom Eastep
aee322f1b4 First cut at Simplified Traffic Shaping 2009-12-24 16:03:43 -08:00
Tom Eastep
c2d27c6ec1 More automatically assign MARK values to providers 2009-12-24 13:35:03 -08:00
Tom Eastep
330664d72a Automatically assign MARK values to providers 2009-12-24 13:26:28 -08:00
Tom Eastep
7b80af7e29 Don't pass packets from 'tracked' interfaces through tcpre 2009-12-24 13:02:44 -08:00
Tom Eastep
0885b6a40a fix formatting in shorewall6-interfaces(5) 2009-12-24 08:16:47 -08:00
Tom Eastep
902d790fa5 Document 'forward' option in shorewall6-interfaces(5) 2009-12-24 07:59:31 -08:00
Tom Eastep
ba95a583a9 Allow ROUTE_FILTER=0 in IPv6; fix 'forward' 2009-12-24 07:42:21 -08:00
Tom Eastep
06cacf9f5c Remove old syntax from Shorewall6-defined actions 2009-12-24 07:40:27 -08:00
Tom Eastep
a0fa807d37 Make Shorewall6 shut up about missing KERNELVERSION 2009-12-24 07:16:47 -08:00
Tom Eastep
ef6d63f58e Fix another bug in ROUTE_FILTER Handling 2009-12-24 07:16:30 -08:00
Tom Eastep
606703e007 Fix other issues with rp_filter fix 2009-12-20 15:55:28 -08:00
Tom Eastep
8e720d5548 Fix bug that prevented routefilter=2 2009-12-19 17:12:35 -08:00
Tom Eastep
e6f7ec7b94 Disallow port 00 2009-12-19 14:59:43 -08:00
Tom Eastep
0d4b61f3f4 Resolve Merge Conflicts 2009-12-19 14:14:28 -08:00
Tom Eastep
32072a7c14 Add Kernel Version to the capabilities 2009-12-19 14:03:11 -08:00
Tom Eastep
0184de94b4 Revert "I'm clueless as to what this looks like"
This reverts commit c6aebd9299.
2009-12-19 13:59:01 -08:00
Tom Eastep
c6aebd9299 I'm clueless as to what this looks like 2009-12-19 13:58:30 -08:00
Tom Eastep
7297b1e661 Revert change that allowed out of order policies 2009-12-19 07:20:44 -08:00
Tom Eastep
8a64693f78 Add additional advise about the routestopped file 2009-12-16 11:11:11 -08:00
Tom Eastep
673c5225a3 Delete empty line 2009-12-15 14:27:01 -08:00
Tom Eastep
0f93c47661 Add Forward macro 2009-12-15 08:17:24 -08:00
Tom Eastep
10a5b2d70f Add a comment to process_rule1() 2009-12-14 15:52:32 -08:00
Tom Eastep
355d4886b2 Remove superfluous logic from process_rule1 2009-12-14 14:50:23 -08:00
Tom Eastep
5ea79d5703 Fix typo in MODULESDIR fix 2009-12-13 09:27:41 -08:00
Tom Eastep
5743ec8605 Fix a couple of typos 2009-12-13 07:22:41 -08:00
Tom Eastep
c085f7fd1f Fix nonsensical combo of logmartians and routefilter 2009-12-13 07:14:30 -08:00
Tom Eastep
ab3c3f02c7 Fix typo 2009-12-13 07:08:21 -08:00
Tom Eastep
50be79936c Add current and limit to conntrack table display 2009-12-12 09:15:59 -08:00
Tom Eastep
b8272dd10d Revert "Add current and limit to conntrack table display"
This reverts commit 6f9b788f86.
2009-12-12 09:14:45 -08:00
Tom Eastep
6f9b788f86 Add current and limit to conntrack table display 2009-12-12 09:14:10 -08:00
Tom Eastep
711aa0ef4e Another minor retitling 2009-12-11 14:25:04 -08:00
Tom Eastep
f8b59c5581 Retitle the Lenny to Squeeze article 2009-12-11 13:36:57 -08:00
Tom Eastep
30723d0bf5 Fix typo in both 'notrack' manpages 2009-12-11 08:53:27 -08:00
Tom Eastep
b7eab05647 Add comment about chain table initialization 2009-12-11 08:53:03 -08:00
Tom Eastep
6fa82ceb6a Add footnote and proviso regarding two links from the same ISP 2009-12-11 07:21:42 -08:00
Tom Eastep
bf2a2a8a39 Add comment about optimizing OUTPUT; explain why ACCOUNTING has an option to disable it 2009-12-11 07:15:02 -08:00
Tom Eastep
5dc8b6727d apply chain optimization to OUTPUT 2009-12-10 10:14:02 -08:00
Tom Eastep
ee5c746d55 Add ACCOUNTING and DYNAMIC_BLACKLIST options 2009-12-10 10:04:51 -08:00
Tom Eastep
a026922252 Formatting fix 2009-12-10 07:54:34 -08:00
Tom Eastep
b9d63b6993 Combine identical logging chains -- Update release documents 2009-12-10 07:42:45 -08:00
Tom Eastep
a13539d04b Combine identical logging chains 2009-12-10 07:37:34 -08:00
Tom Eastep
4c56acad0d Hack to avoid multiple DHCP access rules in output rules chains; update release documentation 2009-12-09 15:18:44 -08:00
Tom Eastep
9dbbf5d3be Make 3 the default OPTIMIZE value for new installations 2009-12-09 12:26:49 -08:00
Tom Eastep
a6b0220e93 Optimize ACCEPT policy chains 2009-12-09 10:42:34 -08:00
Tom Eastep
1c2f101b7e Allow OPTIMIZE 2 and 3 2009-12-09 10:09:00 -08:00
Tom Eastep
e6c493cfaf Change sanity test to an assertion 2009-12-09 09:41:39 -08:00
Tom Eastep
293ff5fd5b Fix typo in a comment 2009-12-08 16:10:26 -08:00
Tom Eastep
79a9ec4a2c Translate comment on createlogactionchain() from Bourne shell to Perl 2009-12-08 13:34:50 -08:00
Tom Eastep
ab4e101494 Fix macro handling of SOURCE and DEST columns 2009-12-08 13:28:06 -08:00
Tom Eastep
e5a0e778a6 Flag <macro>/<param> with a warning 2009-12-08 12:33:25 -08:00
Tom Eastep
3c6e51d487 Fix DONT_LOAD vs 'reload -c' 2009-12-07 14:46:27 -08:00
Tom Eastep
7fca3b8147 Fix ENHANCED_REJECT and MODULE_SUFFIX 2009-12-07 13:52:05 -08:00
Tom Eastep
9610224e78 Make kernel version detection work with non-standard version naming such as found on OpenWRT 2009-12-06 10:43:18 -08:00
Tom Eastep
2360263712 Add new mark layout options to shorewall.conf and samples 2009-12-05 11:19:28 -08:00
Tom Eastep
a0e747c456 Describe checking for cls_flow support 2009-12-05 09:35:00 -08:00
Tom Eastep
98604e2f72 Update 'flow=' description in the TC doc 2009-12-05 08:07:48 -08:00
Tom Eastep
24717474d6 More add Debian logo to Debian-specific configuration steps 2009-12-04 09:14:59 -08:00
Tom Eastep
4e2e55cb79 Add Debian logo to Debian-specific configuration steps 2009-12-04 09:06:38 -08:00
Tom Eastep
f200235d4c Allow /dev/null for LOGFILE 2009-12-03 16:16:57 -08:00
Tom Eastep
570373085b Auto-load cls_flow 2009-12-03 12:16:08 -08:00
Tom Eastep
2c569d0dbf More sensible order of progress message and script emission 2009-12-02 15:39:22 -08:00
Tom Eastep
090df23a20 Update the Mark section of the config-file doc 2009-12-02 13:47:15 -08:00
Tom Eastep
085cbc9580 Correct handling of PROVIDER_BITS=0 when adding a provider 2009-12-02 12:42:13 -08:00
Tom Eastep
66e92b219d More mark documentation 2009-12-01 13:32:19 -08:00
Tom Eastep
03d8f33044 Set Version to 4.5.0 2009-12-01 13:24:21 -08:00
Tom Eastep
0ee6278d51 More mark documentation; Correct mark clearing in FORWARD, INPUT and POSTROUTING 2009-12-01 13:23:54 -08:00
Tom Eastep
aea52901ce Documentation Update regarding Mark configuration 2009-12-01 10:02:27 -08:00
Tom Eastep
84fe2183cc More tweaking of mark configuration 2009-12-01 09:30:26 -08:00
Tom Eastep
e1818c12d9 Produce mark layout report during compilation 2009-11-30 16:09:58 -08:00
Tom Eastep
09b6ee0c86 Automatically adjust MASK_BITS 2009-11-30 15:49:01 -08:00
Tom Eastep
cb0a0c56cb More documentation about mark geometry 2009-11-30 15:13:49 -08:00
Tom Eastep
834d28bdc9 Add version information to mark geometry documentation 2009-11-30 13:18:05 -08:00
Tom Eastep
0bc19427e2 More mark geometry documentation 2009-11-30 13:15:46 -08:00
Tom Eastep
1524d18d19 More mark geometry fixes 2009-11-30 12:33:59 -08:00
Tom Eastep
cc782b5207 Document new mark definition and modify it slightly 2009-11-30 07:38:18 -08:00
Tom Eastep
6ba4618cdc Fix inconsistency in the Traffic Shaping Document 2009-11-30 07:37:49 -08:00
Tom Eastep
0c699ed7a3 Allow flexibility in use of packet/connection marks 2009-11-29 15:18:43 -08:00
219 changed files with 8212 additions and 17719 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -42,7 +42,9 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGRATE=
LOGBURST=
LOGALLNEW=
@@ -68,8 +70,6 @@ TC=
IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
@@ -109,13 +109,13 @@ RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
IP_FORWARDING=Off
ADD_IP_ALIASES=No
ADD_IP_ALIASES=Yes
ADD_SNAT_ALIASES=No
RETAIN_ALIASES=No
TC_ENABLED=Internal
TC_ENABLED=Simple
TC_EXPERT=No
@@ -163,11 +163,9 @@ FASTACCEPT=No
IMPLICIT_CONTINUE=No
HIGH_ROUTE_MARKS=No
USE_ACTIONS=Yes
OPTIMIZE=1
OPTIMIZE=7
EXPORTPARAMS=No
@@ -191,25 +189,26 @@ RESTORE_DEFAULT_ROUTE=Yes
AUTOMAKE=No
WIDE_TC_MARKS=Yes
TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
DYNAMIC_BLACKLIST=Yes
REQUIRE_INTERFACE=No
###############################################################################
# MARK Layout
###############################################################################
TC_BITS=8
FORWARD_CLEAR_MARK=Yes
MASK_BITS=8
COMPLETE=No
PROVIDER_BITS=8
PROVIDER_OFFSET=8
###############################################################################
# P A C K E T D I S P O S I T I O N

View File

@@ -42,7 +42,9 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGRATE=
LOGBURST=
LOGALLNEW=
@@ -68,8 +70,6 @@ TC=
IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
@@ -109,13 +109,13 @@ RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
IP_FORWARDING=On
ADD_IP_ALIASES=No
ADD_IP_ALIASES=Yes
ADD_SNAT_ALIASES=No
RETAIN_ALIASES=No
TC_ENABLED=Internal
TC_ENABLED=Simple
TC_EXPERT=No
@@ -163,11 +163,9 @@ FASTACCEPT=No
IMPLICIT_CONTINUE=No
HIGH_ROUTE_MARKS=No
USE_ACTIONS=Yes
OPTIMIZE=1
OPTIMIZE=7
EXPORTPARAMS=No
@@ -191,25 +189,26 @@ RESTORE_DEFAULT_ROUTE=Yes
AUTOMAKE=No
WIDE_TC_MARKS=Yes
TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
DYNAMIC_BLACKLIST=Yes
REQUIRE_INTERFACE=No
###############################################################################
# MARK Layout
###############################################################################
TC_BITS=8
FORWARD_CLEAR_MARK=Yes
MASK_BITS=8
COMPLETE=No
PROVIDER_BITS=8
PROVIDER_OFFSET=8
###############################################################################
# P A C K E T D I S P O S I T I O N

View File

@@ -49,7 +49,9 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGRATE=
LOGBURST=
LOGALLNEW=
@@ -75,8 +77,6 @@ TC=
IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
@@ -116,13 +116,13 @@ RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
IP_FORWARDING=On
ADD_IP_ALIASES=No
ADD_IP_ALIASES=Yes
ADD_SNAT_ALIASES=No
RETAIN_ALIASES=No
TC_ENABLED=Internal
TC_ENABLED=Simple
TC_EXPERT=No
@@ -170,11 +170,9 @@ FASTACCEPT=No
IMPLICIT_CONTINUE=No
HIGH_ROUTE_MARKS=No
USE_ACTIONS=Yes
OPTIMIZE=1
OPTIMIZE=7
EXPORTPARAMS=No
@@ -198,25 +196,26 @@ RESTORE_DEFAULT_ROUTE=Yes
AUTOMAKE=No
WIDE_TC_MARKS=Yes
TRACK_PROVIDERS=Yes
ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
DYNAMIC_BLACKLIST=Yes
REQUIRE_INTERFACE=No
###############################################################################
# MARK Layout
###############################################################################
TC_BITS=8
FORWARD_CLEAR_MARK=Yes
MASK_BITS=8
COMPLETE=No
PROVIDER_BITS=8
PROVIDER_OFFSET=8
###############################################################################
# P A C K E T D I S P O S I T I O N

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -40,7 +40,9 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGRATE=
LOGBURST=
LOGALLNEW=
@@ -56,8 +58,6 @@ SMURF_LOG_LEVEL=info
IP6TABLES=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
@@ -99,8 +99,6 @@ TC_ENABLED=No
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -121,7 +119,7 @@ IMPLICIT_CONTINUE=No
HIGH_ROUTE_MARKS=No
OPTIMIZE=1
OPTIMIZE=7
EXPORTPARAMS=No
@@ -147,19 +145,22 @@ ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
DYNAMIC_BLACKLIST=Yes
REQUIRE_INTERFACE=No
###############################################################################
# MARK Layout
###############################################################################
TC_BITS=8
FORWARD_CLEAR_MARK=Yes
MASK_BITS=8
COMPLETE=No
PROVIDER_BITS=8
##############################################################################
PROVIDER_OFFSET=8
###############################################################################
# P A C K E T D I S P O S I T I O N
###############################################################################

View File

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

View File

@@ -40,7 +40,9 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGRATE=
LOGBURST=
LOGALLNEW=
@@ -56,8 +58,6 @@ SMURF_LOG_LEVEL=info
IP6TABLES=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
@@ -99,8 +99,6 @@ TC_ENABLED=No
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -121,7 +119,7 @@ IMPLICIT_CONTINUE=No
HIGH_ROUTE_MARKS=No
OPTIMIZE=1
OPTIMIZE=7
EXPORTPARAMS=No
@@ -147,17 +145,20 @@ ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
DYNAMIC_BLACKLIST=Yes
REQUIRE_INTERFACE=No
###############################################################################
# MARK Layout
###############################################################################
TC_BITS=8
FORWARD_CLEAR_MARK=Yes
MASK_BITS=8
COMPLETE=No
PROVIDER_BITS=8
PROVIDER_OFFSET=8
###############################################################################
# P A C K E T D I S P O S I T I O N

View File

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

View File

@@ -1,6 +1,6 @@
###############################################################################
#
# Shorewall version 4.4 - Sample shorewall.conf for one-interface configuration.
# Shorewall version 3.4 - Sample shorewall.conf for one-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
@@ -40,7 +40,9 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGRATE=
LOGBURST=
LOGALLNEW=
@@ -56,8 +58,6 @@ SMURF_LOG_LEVEL=info
IP6TABLES=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
@@ -99,8 +99,6 @@ TC_ENABLED=No
TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
CLEAR_TC=Yes
MARK_IN_FORWARD_CHAIN=No
@@ -121,7 +119,7 @@ IMPLICIT_CONTINUE=No
HIGH_ROUTE_MARKS=No
OPTIMIZE=1
OPTIMIZE=7
EXPORTPARAMS=No
@@ -147,17 +145,20 @@ ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=Yes
DYNAMIC_BLACKLIST=Yes
REQUIRE_INTERFACE=No
###############################################################################
# MARK Layout
###############################################################################
TC_BITS=8
FORWARD_CLEAR_MARK=Yes
MASK_BITS=8
COMPLETE=No
PROVIDER_BITS=8
PROVIDER_OFFSET=8
###############################################################################
# P A C K E T D I S P O S I T I O N

View File

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

View File

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

View File

@@ -1,104 +0,0 @@
#!/bin/sh
#
# ifupdown script for Shorewall-based products
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
IFUPDOWN=0
PRODUCTS=
if [ -f /etc/default/shorewall-init ]; then
. /etc/default/shorewall-init
elif [ -f /etc/sysconfig/shorewall-init ]; then
. /etc/sysconfig/shorewall-init
fi
[ "$IFUPDOWN" = 1 -a -n "$PRODUCTS" ] || exit 0
if [ -f /etc/debian_version ]; then
#
# Debian ifupdown system
#
if [ "$MODE" = start ]; then
COMMAND=up
elif [ "$MODE" = stop ]; then
COMMAND=down
else
exit 0
fi
case "$PHASE" in
pre-*)
exit 0
;;
esac
elif [ -f /etc/SuSE-release ]; then
#
# SuSE ifupdown system
#
IFACE="$2"
case $0 in
*if-up.d*)
COMMAND=up
;;
*if-down.d*)
COMMAND=down
;;
*)
exit 0
;;
esac
else
#
# Assume RedHat/Fedora/CentOS/Foobar/...
#
IFACE="$1"
case $0 in
*ifup*)
COMMAND=up
;;
*ifdown*)
COMMAND=down
;;
*dispatcher.d*)
COMMAND="$2"
;;
*)
exit 0
;;
esac
fi
for PRODUCT in $PRODUCTS; do
VARDIR=/var/lib/$PRODUCT
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
if [ -x $VARDIR/firewall ]; then
( . /usr/share/$PRODUCT/lib.base
mutex_on
${VARDIR}/firewall -V0 $COMMAND $IFACE || echo_notdone
mutex_off
)
fi
done
exit 0

View File

@@ -1,146 +0,0 @@
#!/bin/sh
#
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.4
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2010 - Tom Eastep (teastep@shorewall.net)
#
# On most distributions, this file should be called /etc/init.d/shorewall.
#
# Complete documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
### BEGIN INIT INFO
# Provides: shorewall-init
# Required-Start: $local_fs
# X-Start-Before: $network
# Required-Stop: $local_fs
# X-Stop-After: $network
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Initialize the firewall at boot time
# Description: Place the firewall in a safe state at boot time prior to
# bringing up the network
### END INIT INFO
export VERBOSITY=0
if [ "$(id -u)" != "0" ]
then
echo "You must be root to start, stop or restart \"Shorewall \"."
exit 1
fi
echo_notdone () {
echo "not done."
exit 1
}
not_configured () {
echo "#### WARNING ####"
echo "the firewall won't be initialized unless it is configured"
if [ "$1" != "stop" ]
then
echo ""
echo "Please read about Debian specific customization in"
echo "/usr/share/doc/shorewall-init/README.Debian.gz."
fi
echo "#################"
exit 0
}
# check if shorewall-init is configured or not
if [ -f "/etc/default/shorewall-init" ]
then
. /etc/default/shorewall-init
if [ -z "$PRODUCTS" ]
then
not_configured
fi
else
not_configured
fi
# Initialize the firewall
shorewall_start () {
local product
local VARDIR
echo -n "Initializing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do
VARDIR=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then
#
# Run in a sub-shell to avoid name collisions
#
(
. /usr/share/$product/lib.base
#
# Get mutex so the firewall state is stable
#
mutex_on
if ! ${VARDIR}/firewall status > /dev/null 2>&1; then
${VARDIR}/firewall stop || echo_notdone
fi
mutex_off
)
fi
done
echo "done."
return 0
}
# Clear the firewall
shorewall_stop () {
local product
local VARDIR
echo -n "Clearing \"Shorewall-based firewalls\": "
for product in $PRODUCTS; do
VARDIR=/var/lib/$product
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
if [ -x ${VARDIR}/firewall ]; then
( . /usr/share/$product/lib.base
mutex_on
${VARDIR}/firewall clear || echo_notdone
mutex_off
)
fi
done
echo "done."
return 0
}
case "$1" in
start)
shorewall_start
;;
stop)
shorewall_stop
;;
reload|force-reload)
;;
*)
echo "Usage: /etc/init.d/shorewall-init {start|stop|reload|force-reload}"
exit 1
esac
exit 0

View File

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

View File

@@ -1,336 +0,0 @@
#!/bin/sh
#
# Script to install Shoreline Firewall Init
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
# (c) 2010 - Roberto C. Sanchez (roberto@connexer.com)
#
# Shorewall documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
VERSION=4.4.13-Beta1
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME"
echo " $ME -v"
echo " $ME -h"
exit $1
}
split() {
local ifs
ifs=$IFS
IFS=:
set -- $1
echo $*
IFS=$ifs
}
qt()
{
"$@" >/dev/null 2>&1
}
mywhich() {
local dir
for dir in $(split $PATH); do
if [ -x $dir/$1 ]; then
echo $dir/$1
return 0
fi
done
return 2
}
run_install()
{
if ! install $*; then
echo
echo "ERROR: Failed to install $*" >&2
exit 1
fi
}
cant_autostart()
{
echo
echo "WARNING: Unable to configure shorewall init to start automatically at boot" >&2
}
delete_file() # $1 = file to delete
{
rm -f $1
}
install_file() # $1 = source $2 = target $3 = mode
{
run_install $T $OWNERSHIP -m $3 $1 ${2}
}
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
#
# Parse the run line
#
# DEST is the SysVInit script directory
# INIT is the name of the script in the $DEST directory
# ARGS is "yes" if we've already parsed an argument
#
ARGS=""
if [ -z "$DEST" ] ; then
DEST="/etc/init.d"
fi
if [ -z "$INIT" ] ; then
INIT="shorewall-init"
fi
while [ $# -gt 0 ] ; do
case "$1" in
-h|help|?)
usage 0
;;
-v)
echo "Shorewall Init Installer Version $VERSION"
exit 0
;;
*)
usage 1
;;
esac
shift
ARGS="yes"
done
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
#
# Determine where to install the firewall script
#
case $(uname) in
Darwin)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=wheel
T=
;;
*)
[ -z "$OWNER" ] && OWNER=root
[ -z "$GROUP" ] && GROUP=root
;;
esac
OWNERSHIP="-o $OWNER -g $GROUP"
if [ -n "$DESTDIR" ]; then
if [ `id -u` != 0 ] ; then
echo "Not setting file owner/group permissions, not running as root."
OWNERSHIP=""
fi
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
elif [ -f /etc/debian_version ]; then
DEBIAN=yes
elif [ -f /etc/SuSE-release ]; then
SUSE=Yes
elif [ -f /etc/slackware-version ] ; then
echo "Shorewall-init is currently not supported on Slackware" >&2
exit 1
# DEST="/etc/rc.d"
# INIT="rc.firewall"
elif [ -f /etc/arch-release ] ; then
echo "Shorewall-init is currently not supported on Arch Linux" >&2
exit 1
# DEST="/etc/rc.d"
# INIT="shorewall-init"
# ARCHLINUX=yes
elif [ -d /etc/sysconfig/network-scripts/ ]; then
#
# Assume RedHat-based
#
REDHAT=Yes
else
echo "Unknown distribution: Shorewall-init support is not available" >&2
exit 1
fi
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
echo "Installing Shorewall Init Version $VERSION"
#
# Check for /usr/share/shorewall-init/version
#
if [ -f ${DESTDIR}/usr/share/shorewall-init/version ]; then
first_install=""
else
first_install="Yes"
fi
#
# Install the Init Script
#
if [ -n "$DEBIAN" ]; then
install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall-init 0544
#elif [ -n "$ARCHLINUX" ]; then
# install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544
else
install_file init.sh ${DESTDIR}${DEST}/$INIT 0544
fi
echo "Shorewall Init script installed in ${DESTDIR}${DEST}/$INIT"
#
# Create /usr/share/shorewall-init if needed
#
mkdir -p ${DESTDIR}/usr/share/shorewall-init
chmod 755 ${DESTDIR}/usr/share/shorewall-init
#
# Create the version file
#
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall-init/version
chmod 644 ${DESTDIR}/usr/share/shorewall-init/version
#
# Remove and create the symbolic link to the init script
#
if [ -z "$DESTDIR" ]; then
rm -f /usr/share/shorewall-init/init
ln -s ${DEST}/${INIT} /usr/share/shorewall-init/init
fi
if [ -n "$DEBIAN" ]; then
if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}/etc/network/if-up.d/
mkdir -p ${DESTDIR}/etc/network/if-post-down.d/
fi
if [ ! -f ${DESTDIR}/etc/default/shorewall-init ]; then
if [ -n "${DESTDIR}" ]; then
mkdir ${DESTDIR}/etc/default
fi
install_file sysconfig ${DESTDIR}/etc/default/shorewall-init 0644
fi
else
if [ -n "$DESTDIR" ]; then
mkdir -p ${DESTDIR}/etc/sysconfig
if [ -z "$RPM" ]; then
if [ -n "$SUSE" ]; then
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-up.d
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-down.d
else
mkdir -p ${DESTDIR}/etc/NetworkManager/dispatcher.d
fi
fi
fi
if [ -d ${DESTDIR}/etc/sysconfig -a ! -f ${DESTDIR}/etc/sysconfig/shorewall-init ]; then
install_file sysconfig ${DESTDIR}/etc/sysconfig/shorewall-init 0644
fi
fi
#
# Install the ifupdown script
#
mkdir -p ${DESTDIR}/usr/share/shorewall-init
install_file ifupdown.sh ${DESTDIR}/usr/share/shorewall-init/ifupdown 0544
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
install_file ifupdown.sh ${DESTDIR}/etc/NetworkManager/dispatcher.d/01-shorewall 0544
fi
if [ -n "$DEBIAN" ]; then
install_file ifupdown.sh ${DESTDIR}/etc/network/if-up.d/shorewall 0544
install_file ifupdown.sh ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
elif [ -n "$SUSE" ]; then
install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-up.d/shorewall 0544
install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-down.d/shorewall 0544
elif [ -n "$REDHAT" ]; then
if [ -f ${DESTDIR}/sbin/ifup-local -o -f ${DESTDIR}/sbin/ifdown-local ]; then
echo "WARNING: /sbin/ifup-local and/or /sbin/ifdown-local already exist; up/down events will not be handled"
else
install_file ifupdown.sh ${DESTDIR}/sbin/ifup-local 0544
install_file ifupdown.sh ${DESTDIR}/sbin/ifdown-local 0544
fi
fi
if [ -z "$DESTDIR" ]; then
if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
if [ -x /sbin/insserv ]; then
insserv /etc/init.d/shorewall-init
else
ln -sf ../init.d/shorewall-init /etc/rcS.d/S38shorewall-init
fi
echo "Shorewall Init will start automatically at boot"
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall-init ; then
echo "Shorewall Init will start automatically at boot"
else
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall-init ; then
echo "Shorewall Init will start automatically in run levels as follows:"
chkconfig --list shorewall-init
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall-init default; then
echo "Shorewall Init will start automatically at boot"
else
cant_autostart
fi
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
cant_autostart
fi
fi
fi
else
if [ -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
if [ -n "${DESTDIR}" ]; then
mkdir -p ${DESTDIR}/etc/rcS.d
fi
ln -sf ../init.d/shorewall-init ${DESTDIR}/etc/rcS.d/S38shorewall-init
echo "Shorewall Init will start automatically at boot"
fi
fi
fi
#
# Report Success
#
echo "shorewall Init Version $VERSION Installed"

View File

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

View File

@@ -1,12 +0,0 @@
# List the Shorewall products that Shorewall-init is to
# initialize (space-separated list).
#
# Sample: PRODUCTS="shorewall shorewall6"
#
PRODUCTS=""
#
# Set this to 1 if you want Shorewall-init to react to
# ifup/ifdown and NetworkManager events
#
IFUPDOWN=0

View File

@@ -1,97 +0,0 @@
#!/bin/sh
#
# Script to back uninstall Shoreline Firewall
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.sourceforge.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Usage:
#
# You may only use this script to uninstall the version
# shown below. Simply run this script to remove Shorewall Firewall
VERSION=4.4.13-Beta1
usage() # $1 = exit status
{
ME=$(basename $0)
echo "usage: $ME"
exit $1
}
qt()
{
"$@" >/dev/null 2>&1
}
remove_file() # $1 = file to restore
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
}
if [ -f /usr/share/shorewall-init/version ]; then
INSTALLED_VERSION="$(cat /usr/share/shorewall-init/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Init Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller."
VERSION="$INSTALLED_VERSION"
fi
else
echo "WARNING: Shorewall Init Version $VERSION is not installed"
VERSION=""
fi
echo "Uninstalling Shorewall Init $VERSION"
INITSCRIPT=/etc/init.d/shorewall-init
if [ -n "$INITSCRIPT" ]; then
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
insserv -r $INITSCRIPT
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $INITSCRIPT)
else
rm -f /etc/rc*.d/*$(basename $INITSCRIPT)
fi
remove_file $INITSCRIPT
fi
[ "$(readlink -m -q /sbin/ifup-local)" = /usr/share/shorewall-init ] && remove_file /sbin/ifup-local
[ "$(readlink -m -q /sbin/ifdown-local)" = /usr/share/shorewall-init ] && remove_file /sbin/ifdown-local
remove_file /etc/default/shorewall-init
remove_file /etc/sysconfig/shorewall-init
remove_file /etc/NetworkManager/dispatcher.d/01-shorewall
remove_file /etc/network/if-up.d/shorewall
remove_file /etc/network/if-down.d/shorewall
remove_file /etc/sysconfig/network/if-up.d/shorewall
remove_file /etc/sysconfig/network/if-down.d/shorewall
rm -rf /usr/share/shorewall-init
echo "Shorewall Init Uninstalled"

View File

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

View File

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

104
Shorewall-lite/fallback.sh Executable file
View File

@@ -0,0 +1,104 @@
#!/bin/sh
#
# Script to back out the installation of Shorewall Lite and to restore the previous version of
# the program
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Usage:
#
# You may only use this script to back out the installation of the version
# shown below. Simply run this script to revert to your prior version of
# Shoreline Firewall.
VERSION=4.5.4
usage() # $1 = exit status
{
echo "usage: $(basename $0)"
exit $1
}
restore_directory() # $1 = directory to restore
{
if [ -d ${1}-${VERSION}.bkout ]; then
if mv -f $1 ${1}-${VERSION} && mv ${1}-${VERSION}.bkout $1; then
echo
echo "$1 restored"
rm -rf ${1}-${VERSION}
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
restore_file() # $1 = file to restore, $2 = (Optional) Directory to restore from
{
if [ -n "$2" ]; then
local file
file=$(basename $1)
if [ -f $2/$file ]; then
if mv -f $2/$file $1 ; then
echo
echo "$1 restored"
return
fi
echo "ERROR: Could not restore $1"
exit 1
fi
fi
if [ -f ${1}-${VERSION}.bkout -o -L ${1}-${VERSION}.bkout ]; then
if (mv -f ${1}-${VERSION}.bkout $1); then
echo
echo "$1 restored"
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
if [ ! -f /usr/share/shorewall-lite-${VERSION}.bkout/version ]; then
echo "Shorewall Version $VERSION is not installed"
exit 1
fi
echo "Backing Out Installation of Shorewall $VERSION"
if [ -L /usr/share/shorewall-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
restore_file $FIREWALL /usr/share/shorewall-lite-${VERSION}.bkout
else
restore_file /etc/init.d/shorewall /usr/share/shorewall-lite-${VERSION}.bkout
fi
restore_file /sbin/shorewall /var/lib/shorewall-lite-${VERSION}.bkout
restore_directory /etc/shorewall-lite
restore_directory /usr/share/shorewall-lite
restore_directory /var/lib/shorewall-lite
echo "Shorewall Lite Restored to Version $(cat /usr/share/shorewall-lite/version)"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,6 @@
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - 224.0.0.251 udp 5353
PARAM - - udp 32768: 5353
PARAM - 224.0.0.251 2
PARAM DEST SOURCE:224.0.0.251 udp 5353
PARAM DEST SOURCE:224.0.0.251 2

View File

@@ -23,10 +23,10 @@
# to the name of the remote firewall corresponding to the directory.
#
# To make the 'firewall' script, type "make".
#
#
# Once the script is compiling correctly, you can install it by
# typing "make install".
#
#
################################################################################
# V A R I A B L E S
#
@@ -55,7 +55,7 @@ all: firewall
#
# Only generate the capabilities file if it doesn't already exist
#
capabilities:
capabilities:
ssh root@$(HOST) "MODULESDIR=$(MODULESDIR) /usr/share/shorewall-lite/shorecap > $(LITEDIR)/capabilities"
scp root@$(HOST):$(LITEDIR)/capabilities .
#
@@ -78,5 +78,5 @@ save:
#
# Remove generated files
#
clean:
clean:
rm -f capabilities firewall firewall.conf reload

View File

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

View File

@@ -28,7 +28,6 @@ require Exporter;
use Shorewall::Config qw(:DEFAULT :internal);
use Shorewall::Zones;
use Shorewall::Chains qw(:DEFAULT :internal);
use Shorewall::IPAddrs;
use strict;
@@ -58,7 +57,7 @@ our @EXPORT = qw( merge_levels
$macro_commands
);
our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_12';
our $VERSION = '4.5_2';
#
# Used Actions. Each action that is actually used has an entry with value 1.
@@ -89,6 +88,8 @@ our $family;
our @builtins;
our $oldmacros;
#
# Commands that can be embedded in a macro file and how many total tokens on the line (0 => unlimited).
#
@@ -121,6 +122,8 @@ sub initialize( $ ) {
} else {
@builtins = qw/dropBcast allowBcast dropNotSyn rejNotSyn dropInvalid allowInvalid/;
}
$oldmacros = 0;
}
#
@@ -179,27 +182,9 @@ sub find_macro( $ )
#
sub split_action ( $ ) {
my $action = $_[0];
my $target = '';
my $max = 3;
#
# The following rather grim RE, when matched, breaks the action into two parts:
#
# basicaction(param)
# logging part (may be empty)
#
# The param may contain one or more ':' characters
#
if ( $action =~ /^([^(:]+\(.*?\))(:(.*))?$/ ) {
$target = $1;
$action = $2 ? $3 : '';
$max = 2;
}
my @a = split( /:/ , $action, 4 );
fatal_error "Invalid ACTION ($action)" if ( $action =~ /::/ ) || ( @a > $max );
$target = shift @a unless $target;
( $target, join ":", @a );
fatal_error "Invalid ACTION ($action)" if ( $action =~ /::/ ) || ( @a > 3 );
( shift @a, join ":", @a );
}
#
@@ -267,7 +252,9 @@ sub isolate_basic_target( $ ) {
sub get_target_param( $ ) {
my ( $target, $param ) = split '/', $_[0];
unless ( defined $param ) {
if ( defined $param ) {
warning_message "The form <macro>/<param> is deprecated in favor of <macro>(<param>)" unless $oldmacros++;
} else {
( $target, $param ) = ( $1, $2 ) if $target =~ /^(.*?)[(](.*)[)]$/;
}
@@ -789,14 +776,10 @@ sub process_action3( $$$$$ ) {
sub dropBcast( $$$ ) {
my ($chainref, $level, $tag) = @_;
if ( have_capability( 'ADDRTYPE' ) ) {
if ( $capabilities{ADDRTYPE} ) {
if ( $level ne '' ) {
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -m addrtype --dst-type BROADCAST ';
if ( $family == F_IPV4 ) {
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -d 224.0.0.0/4 ';
} else {
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', join( ' ', ' -d' , IPv6_MULTICAST , '-j DROP ' );
}
log_rule_limit $level, $chainref, 'dropBcast' , 'DROP', '', $tag, 'add', ' -d 224.0.0.0/4 ';
}
add_rule $chainref, '-m addrtype --dst-type BROADCAST -j DROP';
@@ -820,14 +803,14 @@ sub dropBcast( $$$ ) {
if ( $family == F_IPV4 ) {
add_rule $chainref, '-d 224.0.0.0/4 -j DROP';
} else {
add_rule $chainref, join( ' ', '-d', IPv6_MULTICAST, '-j DROP' );
add_rule $chainref, '-d ff00::/10 -j DROP';
}
}
sub allowBcast( $$$ ) {
my ($chainref, $level, $tag) = @_;
if ( $family == F_IPV4 && have_capability( 'ADDRTYPE' ) ) {
if ( $family == F_IPV4 && $capabilities{ADDRTYPE} ) {
if ( $level ne '' ) {
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -m addrtype --dst-type BROADCAST ';
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d 224.0.0.0/4 ';
@@ -852,8 +835,8 @@ sub allowBcast( $$$ ) {
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d 224.0.0.0/4 ' if $level ne '';
add_rule $chainref, '-d 224.0.0.0/4 -j ACCEPT';
} else {
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d ' . IPv6_MULTICAST . ' ' if $level ne '';
add_rule $chainref, join ( ' ', '-d', IPv6_MULTICAST, '-j ACCEPT' );
log_rule_limit $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', ' -d ff00::/10 ' if $level ne '';
add_rule $chainref, '-d ff00:/10 -j ACCEPT';
}
}
}
@@ -875,20 +858,19 @@ sub rejNotSyn ( $$$ ) {
sub dropInvalid ( $$$ ) {
my ($chainref, $level, $tag) = @_;
log_rule_limit $level, $chainref, 'dropInvalid' , 'DROP', '', $tag, 'add', "$globals{STATEMATCH} INVALID " if $level ne '';
add_rule $chainref , "$globals{STATEMATCH} INVALID -j DROP";
log_rule_limit $level, $chainref, 'dropInvalid' , 'DROP', '', $tag, 'add', '-m state --state INVALID ' if $level ne '';
add_rule $chainref , '-m state --state INVALID -j DROP';
}
sub allowInvalid ( $$$ ) {
my ($chainref, $level, $tag) = @_;
log_rule_limit $level, $chainref, 'allowInvalid' , 'ACCEPT', '', $tag, 'add', "$globals{STATEMATCH} INVALID " if $level ne '';
add_rule $chainref , "$globals{STATEMATCH} INVALID -j ACCEPT";
log_rule_limit $level, $chainref, 'allowInvalid' , 'ACCEPT', '', $tag, 'add', '-m state --state INVALID ' if $level ne '';
add_rule $chainref , '-m state --state INVALID -j ACCEPT';
}
sub forwardUPnP ( $$$ ) {
my $chainref = dont_optimize 'forwardUPnP';
add_commands( $chainref , '[ -f ${VARDIR}/.forwardUPnP ] && cat ${VARDIR}/.forwardUPnP >&3' );
dont_optimize 'forwardUPnP';
}
sub allowinUPnP ( $$$ ) {

File diff suppressed because it is too large Load Diff

View File

@@ -41,9 +41,9 @@ use Shorewall::IPAddrs;
use Shorewall::Raw;
our @ISA = qw(Exporter);
our @EXPORT = qw( compiler );
our @EXPORT = qw( compiler EXPORT TIMESTAMP DEBUG );
our @EXPORT_OK = qw( $export );
our $VERSION = '4.4_12';
our $VERSION = '4.5_3';
our $export;
@@ -72,38 +72,36 @@ sub initialize_package_globals() {
#
# First stage of script generation.
#
# Copy prog.header and lib.common to the generated script.
# Copy prog.header to the generated script.
# Generate the various user-exit jacket functions.
#
# Note: This function is not called when $command eq 'check'. So it must have no side effects other
# than those related to writing to the output script file.
#
sub generate_script_1( $ ) {
sub generate_script_1() {
my $script = shift;
if ( $test ) {
emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall-perl\n#";
} else {
my $date = localtime;
if ( $script ) {
if ( $test ) {
emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall-perl\n#";
emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
if ( $family == F_IPV4 ) {
copy $globals{SHAREDIRPL} . 'prog.header';
} else {
my $date = localtime;
emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
if ( $family == F_IPV4 ) {
copy $globals{SHAREDIRPL} . 'prog.header';
} else {
copy $globals{SHAREDIRPL} . 'prog.header6';
}
copy2 $globals{SHAREDIR} . '/lib.common', 0;
copy $globals{SHAREDIRPL} . 'prog.header6';
}
}
my $lib = find_file 'lib.private';
copy2( $lib, $debug ) if -f $lib;
if ( -f $lib ) {
emit <<'EOF';
################################################################################
# Functions imported from lib.private
################################################################################
EOF
copy1 $lib;
emit "\n";
}
emit <<'EOF';
################################################################################
@@ -166,24 +164,24 @@ sub generate_script_2() {
if ( $export ) {
emit ( 'SHAREDIR=/usr/share/shorewall-lite',
'CONFDIR=/etc/shorewall-lite',
'g_product="Shorewall Lite"'
'PRODUCT="Shorewall Lite"'
);
} else {
emit ( 'SHAREDIR=/usr/share/shorewall',
'CONFDIR=/etc/shorewall',
'g_product=\'Shorewall\'',
'PRODUCT=\'Shorewall\'',
);
}
} else {
if ( $export ) {
emit ( 'SHAREDIR=/usr/share/shorewall6-lite',
'CONFDIR=/etc/shorewall6-lite',
'g_product="Shorewall6 Lite"'
'PRODUCT="Shorewall6 Lite"'
);
} else {
emit ( 'SHAREDIR=/usr/share/shorewall6',
'CONFDIR=/etc/shorewall6',
'g_product=\'Shorewall6\'',
'PRODUCT=\'Shorewall6\'',
);
}
}
@@ -215,15 +213,16 @@ sub generate_script_2() {
my @dont_load = split_list $config{DONT_LOAD}, 'module';
emit ( '[ -n "${COMMAND:=restart}" ]',
'[ -n "${VERBOSITY:=0}" ]',
'[ -n "${VERBOSE:=0}" ]',
qq([ -n "\${RESTOREFILE:=$config{RESTOREFILE}}" ]) );
emit ( qq(SHOREWALL_VERSION="$globals{VERSION}") ) unless $test;
emit ( qq(VERSION="$globals{VERSION}") ) unless $test;
emit ( qq(PATH="$config{PATH}") ,
'TERMINATOR=fatal_error' ,
qq(DONT_LOAD="@dont_load") ,
qq(STARTUP_LOG="$config{STARTUP_LOG}") ,
"LOG_VERBOSE=$config{LOG_VERBOSITY}" ,
''
);
@@ -232,7 +231,7 @@ sub generate_script_2() {
append_file 'params' if $config{EXPORTPARAMS};
emit ( '',
"g_stopping=",
"STOPPING=",
'',
'#',
'# The library requires that ${VARDIR} exist',
@@ -256,7 +255,7 @@ sub generate_script_2() {
push_indent;
if ( $global_variables ) {
emit( 'case $COMMAND in' );
push_indent;
@@ -271,7 +270,7 @@ sub generate_script_2() {
set_global_variables(1);
handle_optional_interfaces(0);
handle_optional_interfaces;
emit ';;';
@@ -284,7 +283,7 @@ sub generate_script_2() {
set_global_variables(0);
handle_optional_interfaces(0);
handle_optional_interfaces;
emit ';;';
}
@@ -294,15 +293,16 @@ sub generate_script_2() {
emit ( 'esac' ) ,
} else {
emit( 'true' ) unless handle_optional_interfaces(1);
emit( 'true' ) unless handle_optional_interfaces;
}
pop_indent;
emit "\n}\n"; # End of detect_configuration()
}
#
# Final stage of script generation.
#
# Generate code for loading the various files in /var/lib/shorewall[6][-lite]
@@ -334,9 +334,9 @@ sub generate_script_3($) {
save_progress_message 'Initializing...';
if ( $export ) {
my $fn = find_file $config{LOAD_HELPERS_ONLY} ? 'helpers' : 'modules';
my $fn = find_file 'modules';
if ( -f $fn && ! $fn =~ "^$globals{SHAREDIR}/" ) {
if ( $fn ne "$globals{SHAREDIR}/modules" && -f $fn ) {
emit 'echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir';
emit 'cat > ${VARDIR}/.modules << EOF';
open_file $fn;
@@ -353,17 +353,80 @@ sub generate_script_3($) {
}
if ( $family == F_IPV4 ) {
load_ipsets;
my @ipsets = all_ipsets;
if ( @ipsets || $config{SAVE_IPSETS} ) {
emit ( '',
'local hack',
'',
'case $IPSET in',
' */*)',
' [ -x "$IPSET" ] || startup_error "IPSET=$IPSET does not exist or is not executable"',
' ;;',
' *)',
' IPSET="$(mywhich $IPSET)"',
' [ -n "$IPSET" ] || startup_error "The ipset utility cannot be located"' ,
' ;;',
'esac',
'',
'if [ "$COMMAND" = start ]; then' ,
' if [ -f ${VARDIR}/ipsets.save ]; then' ,
' $IPSET -F' ,
' $IPSET -X' ,
' $IPSET -R < ${VARDIR}/ipsets.save' ,
' fi' ,
'elif [ "$COMMAND" = restore -a -z "$RECOVERING" ]; then' ,
' if [ -f $(my_pathname)-ipsets ]; then' ,
' if chain_exists shorewall; then' ,
' startup_error "Cannot restore $(my_pathname)-ipsets with Shorewall running"' ,
' else' ,
' $IPSET -F' ,
' $IPSET -X' ,
' $IPSET -R < $(my_pathname)-ipsets' ,
' fi' ,
' fi' ,
);
if ( @ipsets ) {
emit '';
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( '' ,
'elif [ "$COMMAND" = restart ]; then' ,
'' );
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( '' ,
' if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then' ,
' #',
' # The \'grep -v\' is a hack for a bug in ipset\'s nethash implementation when xtables-addons is applied to Lenny' ,
' #',
' hack=\'| grep -v /31\'' ,
' else' ,
' hack=' ,
' fi' ,
'',
' if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then' ,
' grep -q "^-N" ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save' ,
' fi' );
}
emit ( 'fi',
'' );
}
emit ( 'if [ "$COMMAND" = refresh ]; then' ,
' run_refresh_exit' ,
'else' ,
' run_refresh_exit' );
emit ( " qt \$IPSET -L $_ -n || \$IPSET -N $_ iphash" ) for @ipsets;
emit ( 'else' ,
' run_init_exit',
'fi',
'' );
save_dynamic_chains;
mark_firewall_not_started;
emit ('',
@@ -371,7 +434,7 @@ sub generate_script_3($) {
''
);
if ( have_capability( 'NAT_ENABLED' ) ) {
if ( $capabilities{NAT_ENABLED} ) {
emit( 'if [ -f ${VARDIR}/nat ]; then',
' while read external interface; do',
' del_ip_addr $external $interface',
@@ -384,9 +447,8 @@ sub generate_script_3($) {
emit "disable_ipv6\n" if $config{DISABLE_IPV6};
} else {
emit ( '[ "$COMMAND" = refresh ] && run_refresh_exit || run_init_exit',
emit ( '[ "$COMMAND" = refresh ] && run_refresh_exit || run_init_exit',
'' );
save_dynamic_chains;
mark_firewall_not_started;
emit '';
}
@@ -441,38 +503,31 @@ EOF
pop_indent;
setup_forwarding( $family , 1 );
push_indent;
my $config_dir = $globals{CONFIGDIR};
emit<<"EOF";
set_state Started $config_dir
emit<<'EOF';
set_state "Started"
run_restored_exit
else
if [ \$COMMAND = refresh ]; then
if [ $COMMAND = refresh ]; then
chainlist_reload
EOF
setup_forwarding( $family , 0 );
emit<<"EOF";
emit<<'EOF';
run_refreshed_exit
do_iptables -N shorewall
set_state Started $config_dir
set_state "Started"
else
setup_netfilter
restore_dynamic_rules
conditionally_flush_conntrack
EOF
setup_forwarding( $family , 0 );
emit<<"EOF";
emit<<'EOF';
run_start_exit
do_iptables -N shorewall
set_state Started $config_dir
set_state "Started"
run_started_exit
fi
EOF
emit<<'EOF';
[ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall
fi
@@ -480,16 +535,16 @@ date > ${VARDIR}/restarted
case $COMMAND in
start)
logger -p kern.info "$g_product started"
logger -p kern.info "$PRODUCT started"
;;
restart)
logger -p kern.info "$g_product restarted"
logger -p kern.info "$PRODUCT restarted"
;;
refresh)
logger -p kern.info "$g_product refreshed"
logger -p kern.info "$PRODUCT refreshed"
;;
restore)
logger -p kern.info "$g_product restored"
logger -p kern.info "$PRODUCT restored"
;;
esac
EOF
@@ -565,8 +620,6 @@ sub compiler {
set_shorewall_dir( $directory );
}
$verbosity = 1 if $debug && $verbosity < 1;
set_verbosity( $verbosity );
set_log($log, $log_verbosity) if $log;
set_timestamp( $timestamp );
@@ -576,11 +629,11 @@ sub compiler {
#
get_configuration( $export );
report_capabilities unless $config{LOAD_HELPERS_ONLY};
report_capabilities;
require_capability( 'MULTIPORT' , "Shorewall $globals{VERSION}" , 's' );
require_capability( 'RECENT_MATCH' , 'MACLIST_TTL' , 's' ) if $config{MACLIST_TTL};
require_capability( 'XCONNMARK' , 'HIGH_ROUTE_MARKS=Yes' , 's' ) if $config{PROVIDER_OFFSET} > 0;
require_capability( 'XCONNMARK' , 'PROVIDER_OFFSET > 0' , 's' ) if $config{PROVIDER_OFFSET};
require_capability( 'MANGLE_ENABLED' , 'Traffic Shaping' , 's' ) if $config{TC_ENABLED};
if ( $scriptfilename ) {
@@ -633,11 +686,11 @@ sub compiler {
enable_script;
if ( $scriptfilename || $debug ) {
if ( $scriptfilename ) {
#
# Place Header in the script
#
generate_script_1( $scriptfilename );
generate_script_1;
#
# C O M M O N _ R U L E S
# (Writes the setup_common_rules() function to the compiled script)
@@ -651,11 +704,11 @@ sub compiler {
push_indent;
}
#
# Do all of the zone-independent stuff (mostly /proc)
# Do all of the zone-independent stuff
#
add_common_rules;
#
# More /proc
# /proc stuff
#
if ( $family == F_IPV4 ) {
setup_arp_filtering;
@@ -673,7 +726,7 @@ sub compiler {
#
setup_zone_mss;
if ( $scriptfilename || $debug ) {
if ( $scriptfilename ) {
emit 'return 0';
pop_indent;
emit '}';
@@ -686,7 +739,7 @@ sub compiler {
#
enable_script;
if ( $scriptfilename || $debug ) {
if ( $scriptfilename ) {
emit( "\n#",
'# Setup routing and traffic shaping',
'#',
@@ -704,7 +757,7 @@ sub compiler {
#
setup_tc;
if ( $scriptfilename || $debug ) {
if ( $scriptfilename ) {
pop_indent;
emit "}\n";
}
@@ -720,7 +773,7 @@ sub compiler {
#
# ECN
#
setup_ecn if have_capability( 'MANGLE_ENABLED' ) && $config{MANGLE_ENABLED};
setup_ecn if $capabilities{MANGLE_ENABLED} && $config{MANGLE_ENABLED};
#
# Setup Masquerading/SNAT
#
@@ -771,7 +824,7 @@ sub compiler {
#
generate_matrix;
if ( $config{OPTIMIZE} & 0xD ) {
if ( $config{OPTIMIZE} & 6 ) {
progress_message2 'Optimizing Ruleset...';
#
# Optimize Policy Chains
@@ -780,7 +833,7 @@ sub compiler {
#
# More Optimization
#
optimize_ruleset if $config{OPTIMIZE} & 0xC;
optimize_ruleset if $config{OPTIMIZE} & 4;
}
enable_script;
@@ -806,11 +859,6 @@ sub compiler {
#
compile_stop_firewall( $test, $export );
#
# U P D O W N
# (Writes the updown() function to the compiled script)
#
compile_updown;
#
# Copy the footer to the script
#
unless ( $test ) {
@@ -834,9 +882,9 @@ sub compiler {
#
# Just checking the configuration
#
if ( $preview || $debug ) {
if ( $preview ) {
#
# User wishes to preview the ruleset or we are tracing -- generate the rule matrix
# User wishes to preview the ruleset -- generate the rule matrix
#
generate_matrix;
@@ -852,11 +900,7 @@ sub compiler {
optimize_ruleset if $config{OPTIMIZE} & 4;
}
enable_script if $debug;
generate_script_2 if $debug;
preview_netfilter_load if $preview;
preview_netfilter_load;
}
#
# Re-initialize the chain table so that process_routestopped() has the same
@@ -864,17 +908,11 @@ sub compiler {
#
Shorewall::Chains::initialize( $family );
initialize_chain_table;
if ( $debug ) {
compile_stop_firewall( $test, $export );
disable_script;
} else {
#
# compile_stop_firewall() also validates the routestopped file. Since we don't
# call that function during normal 'check', we must validate routestopped here.
#
process_routestopped;
}
#
# compile_stop_firewall() also validates the routestopped file. Since we don't
# call that function during 'check', we must validate routestopped here.
#
process_routestopped;
if ( $family == F_IPV4 ) {
progress_message3 "Shorewall configuration verified";

File diff suppressed because it is too large Load Diff

View File

@@ -47,7 +47,6 @@ our @EXPORT = qw( ALLIPv4
ALL
TCP
UDP
UDPLITE
ICMP
DCCP
IPv6_ICMP
@@ -73,7 +72,7 @@ our @EXPORT = qw( ALLIPv4
validate_icmp6
);
our @EXPORT_OK = qw( );
our $VERSION = '4.4_12';
our $VERSION = '4.4_5';
#
# Some IPv4/6 useful stuff
@@ -87,29 +86,28 @@ our $validate_address;
our $validate_net;
our $validate_range;
our $validate_host;
our $family;
use constant { ALLIPv4 => '0.0.0.0/0' ,
ALLIPv6 => '::/0' ,
IPv4_MULTICAST => '224.0.0.0/4' ,
IPv6_MULTICAST => 'ff00::/8' ,
IPv6_LINKLOCAL => 'fe80::/10' ,
IPv6_SITELOCAL => 'feC0::/10' ,
IPv6_MULTICAST => 'FF00::/10' ,
IPv6_LINKLOCAL => 'FF80::/10' ,
IPv6_SITELOCAL => 'FFC0::/10' ,
IPv6_LOOPBACK => '::1' ,
IPv6_LINK_ALLNODES => 'ff01::1' ,
IPv6_LINK_ALLRTRS => 'ff01::2' ,
IPv6_SITE_ALLNODES => 'ff02::1' ,
IPv6_SITE_ALLRTRS => 'ff02::2' ,
IPv6_LINK_ALLNODES => 'FF01::1' ,
IPv6_LINK_ALLRTRS => 'FF01::2' ,
IPv6_SITE_ALLNODES => 'FF02::1' ,
IPv6_SITE_ALLRTRS => 'FF02::2' ,
ICMP => 1,
TCP => 6,
UDP => 17,
DCCP => 33,
IPv6_ICMP => 58,
SCTP => 132,
UDPLITE => 136 };
SCTP => 132 };
our @rfc1918_networks = ( "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" );
#
# Note: initialize() is declared at the bottom of the file
#
@@ -124,8 +122,8 @@ sub valid_4address( $ ) {
my @address = split /\./, $address;
return 0 unless @address == 4;
for ( @address ) {
return 0 unless /^\d+$/ && $_ < 256;
for my $a ( @address ) {
return 0 unless $a =~ /^\d+$/ && $a < 256;
}
1;
@@ -158,8 +156,8 @@ sub decodeaddr( $ ) {
my $result = shift @address;
for ( @address ) {
$result = ( $result << 8 ) | $_;
for my $a ( @address ) {
$result = ( $result << 8 ) | $a;
}
$result;
@@ -289,17 +287,7 @@ sub resolve_proto( $ ) {
my $proto = $_[0];
my $number;
if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) {
$number = numeric_value ( $proto );
defined $number && $number <= 65535 ? $number : undef;
} else {
#
# Allow 'icmp' as a synonym for 'ipv6-icmp' in IPv6 compilations
#
$proto= 'ipv6-icmp' if $proto eq 'icmp' && $family == F_IPV6;
defined( $number = $nametoproto{$proto} ) ? $number : scalar getprotobyname $proto;
}
$proto =~ /^(\d+)$/ ? $proto <= 65535 ? $proto : undef : defined( $number = $nametoproto{$proto} ) ? $number : scalar getprotobyname $proto;
}
sub proto_name( $ ) {
@@ -313,7 +301,7 @@ sub validate_port( $$ ) {
my $value;
if ( $port =~ /^(\d+)$/ || $port =~ /^0x/ ) {
if ( $port =~ /^(\d+)$/ ) {
$port = numeric_value $port;
return $port if defined $port && $port && $port <= 65535;
} else {
@@ -321,11 +309,9 @@ sub validate_port( $$ ) {
$value = getservbyname( $port, $proto );
}
return $value if defined $value;
fatal_error "Invalid/Unknown $proto port/service ($port)" unless defined $value;
fatal_error "The separator for a port range is ':', not '-' ($port)" if $port =~ /^\d+-\d+$/;
fatal_error "Invalid/Unknown $proto port/service ($_[1])" unless defined $value;
$value;
}
sub validate_portpair( $$ ) {
@@ -338,7 +324,7 @@ sub validate_portpair( $$ ) {
my @ports = split /:/, $portpair, 2;
$_ = validate_port( $proto, $_) for ( grep $_, @ports );
$_ = validate_port( $proto, $_) for ( @ports );
if ( @ports == 2 ) {
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
@@ -507,7 +493,7 @@ sub valid_6address( $ ) {
unless ( $address =~ /::$/ ) {
return 0 if $address =~ /:$/;
}
for my $a ( @address ) {
return 0 unless $a eq '' || ( $a =~ /^[a-fA-f\d]+$/ && length $a < 5 );
}
@@ -576,7 +562,7 @@ sub normalize_6addr( $ ) {
1 while $addr =~ s/::/:0:/;
$addr =~ s/^0+:/0:/;
$addr;
}
}
@@ -688,7 +674,7 @@ sub validate_host ($$ ) {
# able to re-initialize its dependent modules' state.
#
sub initialize( $ ) {
$family = shift;
my $family = shift;
if ( $family == F_IPV4 ) {
$allip = ALLIPv4;

View File

@@ -36,7 +36,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_masq setup_nat setup_netmap add_addresses );
our @EXPORT_OK = ();
our $VERSION = '4.4_13';
our $VERSION = '4.5_2';
our @addresses_to_add;
our %addresses_to_add;
@@ -49,6 +49,56 @@ sub initialize() {
%addresses_to_add = ();
}
#
# Handle IPSEC Options in a masq record
#
sub do_ipsec_options($)
{
my %validoptions = ( strict => NOTHING,
next => NOTHING,
reqid => NUMERIC,
spi => NUMERIC,
proto => IPSECPROTO,
mode => IPSECMODE,
"tunnel-src" => NETWORK,
"tunnel-dst" => NETWORK,
);
my $list=$_[0];
my $options = '-m policy --pol ipsec --dir out ';
my $fmt;
for my $e ( split_list $list, 'option' ) {
my $val = undef;
my $invert = '';
if ( $e =~ /([\w-]+)!=(.+)/ ) {
$val = $2;
$e = $1;
$invert = '! ';
} elsif ( $e =~ /([\w-]+)=(.+)/ ) {
$val = $2;
$e = $1;
}
$fmt = $validoptions{$e};
fatal_error "Invalid Option ($e)" unless $fmt;
if ( $fmt eq NOTHING ) {
fatal_error "Option \"$e\" does not take a value" if defined $val;
} else {
fatal_error "Missing value for option \"$e\"" unless defined $val;
fatal_error "Invalid value ($val) for option \"$e\"" unless $val =~ /^($fmt)$/;
}
$options .= $invert;
$options .= "--$e ";
$options .= "$val " if defined $val;
}
$options;
}
#
# Process a single rule from the the masq file
#
@@ -100,16 +150,16 @@ sub process_one_masq( )
# Handle IPSEC options, if any
#
if ( $ipsec ne '-' ) {
fatal_error "Non-empty IPSEC column requires policy match support in your kernel and iptables" unless have_capability( 'POLICY_MATCH' );
fatal_error "Non-empty IPSEC column requires policy match support in your kernel and iptables" unless $globals{ORIGINAL_POLICY_MATCH};
if ( $ipsec =~ /^yes$/i ) {
$baserule .= do_ipsec_options 'out', 'ipsec', '';
$baserule .= '-m policy --pol ipsec --dir out ';
} elsif ( $ipsec =~ /^no$/i ) {
$baserule .= do_ipsec_options 'out', 'none', '';
$baserule .= '-m policy --pol none --dir out ';
} else {
$baserule .= do_ipsec_options 'out', 'ipsec', $ipsec;
$baserule .= do_ipsec_options $ipsec;
}
} elsif ( have_ipsec ) {
} elsif ( $capabilities{POLICY_MATCH} ) {
$baserule .= '-m policy --pol none --dir out ';
}
@@ -121,7 +171,7 @@ sub process_one_masq( )
# Handle Mark
#
$baserule .= do_test( $mark, $globals{TC_MASK} ) if $mark ne '-';
$baserule .= do_user( $user ) if $user ne '-';
$baserule .= do_user( $user ) if $user ne '-';
for my $fullinterface (split_list $interfacelist, 'interface' ) {
my $rule = '';
@@ -322,7 +372,7 @@ sub do_one_nat( $$$$$ )
$interface = $interfaceref->{name};
}
if ( have_ipsec ) {
if ( $capabilities{POLICY_MATCH} ) {
$policyin = ' -m policy --pol none --dir in';
$policyout = '-m policy --pol none --dir out';
}
@@ -352,6 +402,7 @@ sub do_one_nat( $$$$$ )
push @addresses_to_add, ( $external , $fullinterface );
}
}
}
#
@@ -398,9 +449,7 @@ sub setup_netmap() {
while ( read_a_line ) {
my ( $type, $net1, $interfacelist, $net2, $net3 ) = split_line 4, 5, 'netmap file';
$net3 = ALLIP if $net3 eq '-';
my ( $type, $net1, $interfacelist, $net2 ) = split_line 4, 4, 'netmap file';
for my $interface ( split_list $interfacelist, 'interface' ) {
@@ -408,18 +457,18 @@ sub setup_netmap() {
my $ruleout = '';
my $iface = $interface;
fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface );
fatal_error "Unknown interface ($interface)" unless my $interfaceref = find_interface( $interface );
unless ( $interfaceref->{root} ) {
$rulein = match_source_dev( $interface );
$ruleout = match_dest_dev( $interface );
$rulein = match_source_dev $interface;
$ruleout = match_dest_dev $interface;
$interface = $interfaceref->{name};
}
if ( $type eq 'DNAT' ) {
add_rule ensure_chain( 'nat' , input_chain $interface ) , $rulein . match_source_net( $net3 ) . "-d $net1 -j NETMAP --to $net2";
add_rule ensure_chain( 'nat' , input_chain $interface ) , $rulein . "-d $net1 -j NETMAP --to $net2";
} elsif ( $type eq 'SNAT' ) {
add_rule ensure_chain( 'nat' , output_chain $interface ) , $ruleout . match_dest_net( $net3 ) . "-s $net1 -j NETMAP --to $net2";
add_rule ensure_chain( 'nat' , output_chain $interface ) , $ruleout . "-s $net1 -j NETMAP --to $net2";
} else {
fatal_error "Invalid type ($type)";
}

View File

@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( validate_policy apply_policy_rules complete_standard_chain setup_syn_flood_chains save_policies optimize_policy_chains);
our @EXPORT_OK = qw( );
our $VERSION = '4.4_12';
our $VERSION = '4.5_2';
# @policy_chains is a list of references to policy chains in the filter table
@@ -66,11 +66,11 @@ sub convert_to_policy_chain($$$$$)
#
sub new_policy_chain($$$$)
{
my ($source, $dest, $policy, $provisional) = @_;
my ($source, $dest, $policy, $optional) = @_;
my $chainref = new_chain( 'filter', rules_chain( ${source}, ${dest} ) );
convert_to_policy_chain( $chainref, $source, $dest, $policy, $provisional );
convert_to_policy_chain( $chainref, $source, $dest, $policy, $optional );
$chainref;
}
@@ -115,7 +115,7 @@ sub set_policy_chain($$$$$)
#
# Process the policy file
#
use constant { PROVISIONAL => 1 };
use constant { OPTIONAL => 1 };
sub add_or_modify_policy_chain( $$ ) {
my ( $zone, $zone1 ) = @_;
@@ -124,11 +124,11 @@ sub add_or_modify_policy_chain( $$ ) {
if ( $chainref ) {
unless( $chainref->{is_policy} ) {
convert_to_policy_chain( $chainref, $zone, $zone1, 'CONTINUE', PROVISIONAL );
convert_to_policy_chain( $chainref, $zone, $zone1, 'CONTINUE', OPTIONAL );
push @policy_chains, $chainref;
}
} else {
push @policy_chains, ( new_policy_chain $zone, $zone1, 'CONTINUE', PROVISIONAL );
push @policy_chains, ( new_policy_chain $zone, $zone1, 'CONTINUE', OPTIONAL );
}
}
@@ -204,7 +204,7 @@ sub process_a_policy() {
if ( zone_type( $client ) == FIREWALL ) || ( zone_type( $server ) == FIREWALL );
}
unless ( $clientwild || $serverwild ) {
unless ( $clientwild || $serverwild || $policy eq 'NONE' ) {
if ( zone_type( $server ) == BPORT ) {
fatal_error "Invalid policy - DEST zone is a Bridge Port zone but the SOURCE zone is not associated with the same bridge"
unless find_zone( $client )->{bridge} eq find_zone( $server)->{bridge} || single_interface( $client ) eq find_zone( $server )->{bridge};
@@ -246,7 +246,7 @@ sub process_a_policy() {
$chainref->{synchain} = $chain
}
$chainref->{default} = $default if $default;
$chainref->{default} = $default if $default;
if ( $clientwild ) {
if ( $serverwild ) {
@@ -286,7 +286,7 @@ sub save_policies() {
}
}
}
}
}
sub validate_policy()
{
@@ -307,7 +307,6 @@ sub validate_policy()
NFQUEUE_DEFAULT => 'NFQUEUE' );
my $zone;
my $firewall = firewall_zone;
our @zonelist = $config{EXPAND_POLICIES} ? all_zones : ( all_zones, 'all' );
for my $option qw/DROP_DEFAULT REJECT_DEFAULT ACCEPT_DEFAULT QUEUE_DEFAULT NFQUEUE_DEFAULT/ {
@@ -330,18 +329,15 @@ sub validate_policy()
}
for $zone ( all_zones ) {
push @policy_chains, ( new_policy_chain $zone, $zone, 'ACCEPT', PROVISIONAL );
push @policy_chains, ( new_policy_chain firewall_zone, $zone, 'NONE', PROVISIONAL ) if zone_type( $zone ) == BPORT;
push @policy_chains, ( new_policy_chain $zone, $zone, 'ACCEPT', OPTIONAL );
my $zoneref = find_zone( $zone );
if ( $config{IMPLICIT_CONTINUE} && ( @{$zoneref->{parents}} || $zoneref->{type} == VSERVER ) ) {
if ( $config{IMPLICIT_CONTINUE} && ( @{find_zone( $zone )->{parents}} ) ) {
for my $zone1 ( all_zones ) {
unless( $zone eq $zone1 ) {
add_or_modify_policy_chain( $zone, $zone1 );
add_or_modify_policy_chain( $zone1, $zone );
}
}
}
}
}
@@ -418,14 +414,13 @@ sub apply_policy_rules() {
for my $chainref ( @policy_chains ) {
my $policy = $chainref->{policy};
my $loglevel = $chainref->{loglevel};
my $provisional = $chainref->{provisional};
my $default = $chainref->{default};
my $name = $chainref->{name};
my $synparms = $chainref->{synparms};
unless ( $policy eq 'NONE' ) {
my $loglevel = $chainref->{loglevel};
my $provisional = $chainref->{provisional};
my $default = $chainref->{default};
my $name = $chainref->{name};
my $synparms = $chainref->{synparms};
if ( $policy ne 'NONE' ) {
unless ( $chainref->{referenced} || $provisional || $policy eq 'CONTINUE' ) {
if ( $config{OPTIMIZE} & 2 ) {
#
@@ -471,7 +466,7 @@ sub apply_policy_rules() {
sub complete_standard_chain ( $$$$ ) {
my ( $stdchainref, $zone, $zone2, $default ) = @_;
add_rule $stdchainref, "$globals{STATEMATCH} ESTABLISHED,RELATED -j ACCEPT" unless $config{FASTACCEPT};
add_rule $stdchainref, '-m state --state ESTABLISHED,RELATED -j ACCEPT' unless $config{FASTACCEPT};
run_user_exit $stdchainref;
@@ -496,14 +491,7 @@ sub setup_syn_flood_chains() {
my $level = $chainref->{loglevel};
my $synchainref = new_chain 'filter' , syn_flood_chain $chainref;
add_rule $synchainref , "${limit}-j RETURN";
log_rule_limit( $level ,
$synchainref ,
$chainref->{name} ,
'DROP',
$globals{LOGLIMIT} || '-m limit --limit 5/min --limit-burst 5 ' ,
'' ,
'add' ,
'' )
log_rule_limit $level , $synchainref , $chainref->{name} , 'DROP', '-m limit --limit 5/min --limit-burst 5 ' , '' , 'add' , ''
if $level ne '';
add_rule $synchainref, '-j DROP';
}

View File

@@ -41,7 +41,7 @@ our @EXPORT = qw(
setup_forwarding
);
our @EXPORT_OK = qw( );
our $VERSION = '4.4_7';
our $VERSION = '4.4_4';
#
# ARP Filtering
@@ -58,7 +58,7 @@ sub setup_arp_filtering() {
for my $interface ( @$interfaces ) {
my $value = get_interface_option $interface, 'arp_filter';
my $optional = interface_is_optional $interface;
$interface = get_physical $interface;
my $file = "/proc/sys/net/ipv4/conf/$interface/arp_filter";
@@ -74,7 +74,7 @@ sub setup_arp_filtering() {
for my $interface ( @$interfaces1 ) {
my $value = get_interface_option $interface, 'arp_ignore';
my $optional = interface_is_optional $interface;
$interface = get_physical $interface;
my $file = "/proc/sys/net/ipv4/conf/$interface/arp_ignore";
@@ -118,7 +118,7 @@ sub setup_route_filtering() {
for my $interface ( @$interfaces ) {
my $value = get_interface_option $interface, 'routefilter';
my $optional = interface_is_optional $interface;
$interface = get_physical $interface;
my $file = "/proc/sys/net/ipv4/conf/$interface/rp_filter";
@@ -130,7 +130,7 @@ sub setup_route_filtering() {
emit "fi\n";
}
if ( have_capability( 'KERNELVERSION' ) < 20631 ) {
if ( $capabilities{KERNELVERSION} < 20631 ) {
emit 'echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter';
} elsif ( $val ne '' ) {
emit "echo $val > /proc/sys/net/ipv4/conf/all/rp_filter";
@@ -138,7 +138,7 @@ sub setup_route_filtering() {
emit "echo $val > /proc/sys/net/ipv4/conf/default/rp_filter" if $val ne '';
emit "[ -n \"\$g_noroutes\" ] || \$IP -4 route flush cache";
emit "[ -n \"\$NOROUTES\" ] || \$IP -4 route flush cache";
}
}
@@ -169,7 +169,7 @@ sub setup_martian_logging() {
for my $interface ( @$interfaces ) {
my $value = get_interface_option $interface, 'logmartians';
my $optional = interface_is_optional $interface;
$interface = get_physical $interface;
my $file = "/proc/sys/net/ipv4/conf/$interface/log_martians";

View File

@@ -35,7 +35,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_providers @routemarked_interfaces handle_stickiness handle_optional_interfaces );
our @EXPORT_OK = qw( initialize lookup_provider );
our $VERSION = '4.4_11';
our $VERSION = '4.5_2';
use constant { LOCAL_TABLE => 255,
MAIN_TABLE => 254,
@@ -158,7 +158,7 @@ sub copy_and_edit_table( $$$$ ) {
my ( $duplicate, $number, $copy, $realm) = @_;
#
# Hack to work around problem in iproute
#
#
my $filter = $family == F_IPV6 ? q(sed 's/ via :: / /' | ) : '';
#
# Map physical names in $copy to logical names
@@ -295,7 +295,7 @@ sub add_a_provider( ) {
$gateway = '';
}
my ( $loose, $track, $balance , $default, $default_balance, $optional, $mtu, $local ) =
my ( $loose, $track, $balance , $default, $default_balance, $optional, $mtu, $local ) =
(0, $config{TRACK_PROVIDERS}, 0 , 0, $config{USE_DEFAULT_RT} ? 1 : 0, interface_is_optional( $interface ), '' , 0 );
unless ( $options eq '-' ) {
@@ -340,7 +340,7 @@ sub add_a_provider( ) {
} elsif ( $option eq 'local' ) {
$local = 1;
$track = 0 if $config{TRACK_PROVIDERS};
$default_balance = 0 if$config{USE_DEFAULT_RT};
$default_balance = 0 if$config{USE_DEFAULT_RT};
} else {
fatal_error "Invalid option ($option)";
}
@@ -416,7 +416,7 @@ sub add_a_provider( ) {
start_provider( $table, $number, qq(if interface_is_usable $physical && [ -n "$variable" ]; then) );
} else {
if ( $optional ) {
start_provider( $table, $number, qq(if [ -n "\$SW_${base}_IS_USABLE" ]; then) );
start_provider( $table, $number, qq(if [ -n "\$${base}_IS_USABLE" ]; then) );
} elsif ( $gatewaycase eq 'detect' ) {
start_provider( $table, $number, qq(if interface_is_usable $physical && [ -n "$gateway" ]; then) );
} else {
@@ -435,12 +435,10 @@ sub add_a_provider( ) {
}
if ( $mark ne '-' ) {
my $mask = have_capability 'FWMARK_RT_MASK' ? '/' . in_hex $globals{PROVIDER_MASK} : '';
emit ( "qt \$IP -$family rule del fwmark $mark" ) if $config{DELETE_THEN_ADD};
emit ( "qt \$IP -$family rule del fwmark ${mark}${mask}" ) if $config{DELETE_THEN_ADD};
emit ( "run_ip rule add fwmark ${mark}${mask} pref $pref table $number",
"echo \"qt \$IP -$family rule del fwmark ${mark}${mask}\" >> \${VARDIR}/undo_routing"
emit ( "run_ip rule add fwmark $mark pref $pref table $number",
"echo \"qt \$IP -$family rule del fwmark $mark\" >> \${VARDIR}/undo_routing"
);
}
@@ -545,10 +543,10 @@ sub add_a_provider( ) {
sub start_new_if( $ ) {
our $current_if = shift;
emit ( '', qq(if [ -n "\$SW_${current_if}_IS_USABLE" ]; then) );
emit ( '', qq(if [ -n "\$${current_if}_IS_USABLE" ]; then) );
push_indent;
}
#
# Complete any current 'if' statement in the output script
#
@@ -761,7 +759,7 @@ sub setup_providers() {
first_entry sub() {
progress_message2 "$doing $fn...";
emit "\nif [ -z \"\$g_noroutes\" ]; then";
emit "\nif [ -z \"\$NOROUTES\" ]; then";
push_indent;
start_providers; };
@@ -794,7 +792,7 @@ sub setup_providers() {
setup_route_marking if @routemarked_interfaces;
} else {
emit "\nif [ -z \"\$g_noroutes\" ]; then";
emit "\nif [ -z \"\$NOROUTES\" ]; then";
push_indent;
@@ -838,20 +836,14 @@ sub lookup_provider( $ ) {
#
# This function is called by the compiler when it is generating the detect_configuration() function.
# The function calls Shorewall::Zones::verify_required_interfaces then emits code to set the
# ..._IS_USABLE interface variables appropriately for the optional interfaces
# The function emits code to set the ..._IS_USABLE interface variables appropriately for the
# optional interfaces
#
# Returns true if there were required or optional interfaces
# Returns true if there were optional interfaces
#
sub handle_optional_interfaces( $ ) {
sub handle_optional_interfaces() {
my $returnvalue = verify_required_interfaces( shift );
#
# find_interfaces_by_option1() does not return wildcard interfaces. If an interface is defined
# as a wildcard in /etc/shorewall/interfaces, then only specific interfaces matching that
# wildcard are returned.
#
my $interfaces = find_interfaces_by_option1 'optional';
my $interfaces = find_interfaces_by_option 'optional';
if ( @$interfaces ) {
for my $interface ( @$interfaces ) {
@@ -859,12 +851,7 @@ sub handle_optional_interfaces( $ ) {
my $physical = get_physical $interface;
my $base = uc chain_base( $physical );
emit( '' );
if ( $config{REQUIRE_INTERFACE} ) {
emit( 'HAVE_INTERFACE=' );
emit( '' );
}
emit '';
if ( $provider ) {
#
@@ -884,41 +871,14 @@ sub handle_optional_interfaces( $ ) {
emit qq(if interface_is_usable $physical; then);
}
emit( ' HAVE_INTERFACE=Yes' ) if $config{REQUIRE_INTERFACE};
emit( " SW_${base}_IS_USABLE=Yes" ,
emit( " ${base}_IS_USABLE=Yes" ,
'else' ,
" SW_${base}_IS_USABLE=" ,
" ${base}_IS_USABLE=" ,
'fi' );
}
if ( $config{REQUIRE_INTERFACE} ) {
emit( '',
'if [ -z "$HAVE_INTERFACE" ]; then' ,
' case "$COMMAND" in',
' start|restart|restore|refresh)'
);
if ( $family == F_IPV4 ) {
emit( ' if shorewall_is_started; then' );
} else {
emit( ' if shorewall6_is_started; then' );
}
emit( ' fatal_error "No network interface available"',
' else',
' startup_error "No network interface available"',
' fi',
' ;;',
' esac',
'fi'
);
}
$returnvalue = 1;
1;
}
$returnvalue;
}
#
@@ -1000,9 +960,8 @@ sub handle_stickiness( $ ) {
}
if ( @routemarked_providers ) {
delete_jumps $mangle_table->{PREROUTING}, $setstickyref unless @{$setstickyref->{rules}};
delete_jumps $mangle_table->{OUTPUT}, $setstickoref unless @{$setstickoref->{rules}};
purge_jump $mangle_table->{PREROUTING}, $setstickyref unless @{$setstickyref->{rules}};
purge_jump $mangle_table->{OUTPUT}, $setstickoref unless @{$setstickoref->{rules}};
}
}
1;

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -35,7 +35,7 @@ our @EXPORT = qw(
);
our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_9';
our $VERSION = '4.4_4';
our @proxyarp;
@@ -76,7 +76,7 @@ sub setup_one_proxy_arp( $$$$$ ) {
}
unless ( $haveroute ) {
emit "[ -n \"\$g_noroutes\" ] || run_ip route replace $address dev $interface";
emit "[ -n \"\$NOROUTES\" ] || run_ip route replace $address dev $interface";
$haveroute = 1 if $persistent;
}
@@ -118,7 +118,6 @@ sub setup_proxy_arp() {
}
$interface = get_physical $interface;
$external = get_physical $external;
$set{$interface} = 1;
$reset{$external} = 1 unless $set{$external};

View File

@@ -3,7 +3,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2009 - Tom Eastep (teastep@shorewall.net)
# (c) 2009,2010 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_notrack );
our @EXPORT_OK = qw( );
our $VERSION = '4.4_11';
our $VERSION = '4.5_2';
#
# Notrack
@@ -50,9 +50,9 @@ sub process_notrack_rule( $$$$$$ ) {
( my $zone, $source) = split /:/, $source, 2;
my $zoneref = find_zone $zone;
my $chainref = ensure_raw_chain( notrack_chain $zone );
my $restriction = $zoneref->{type} == FIREWALL || $zoneref->{type} == VSERVER ? OUTPUT_RESTRICT : PREROUTE_RESTRICT;
my $restriction = $zone eq firewall_zone ? 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;
fatal_error 'USER/GROUP is not allowed unless the SOURCE zone is $FW' if $user ne '-' && $restriction != OUTPUT_RESTRICT;
require_capability 'RAW_TABLE', 'Notrack rules', '';
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user );

File diff suppressed because it is too large Load Diff

View File

@@ -40,7 +40,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_tc );
our @EXPORT_OK = qw( process_tc_rule initialize );
our $VERSION = '4.4_11';
our $VERSION = '4.5_3';
our %tcs = ( T => { chain => 'tcpost',
connmark => 0,
@@ -132,6 +132,7 @@ our $devnum;
our $sticky;
our $ipp2p;
#
# TCClasses Table
#
@@ -317,7 +318,7 @@ sub process_tc_rule( ) {
require_capability( 'TPROXY_TARGET', 'Use of TPROXY', 's');
fatal_error "Invalid TPROXY specification( $cmd/$rest )" if $rest;
$chain = 'tcpre';
$cmd =~ /TPROXY\((.+?)\)$/;
@@ -337,15 +338,15 @@ sub process_tc_rule( ) {
}
$target .= "--on-port $port";
if ( defined $ip && $ip ne '' ) {
validate_address $ip, 1;
$target .= " --on-ip $ip";
}
$target .= ' --tproxy-mark';
$target .= ' --tproxy-mark';
}
if ( $rest ) {
fatal_error "Invalid MARK ($originalmark)" if $marktype == NOMARK;
@@ -371,10 +372,8 @@ sub process_tc_rule( ) {
my $val = numeric_value( $cmd );
fatal_error "Invalid MARK/CLASSIFY ($cmd)" unless defined $val;
my $limit = $globals{TC_MASK};
unless ( have_capability 'FWMARK_RT_MASK' ) {
fatal_error "Marks <= $limit may not be set in the PREROUTING or OUTPUT chains when HIGH_ROUTE_MARKS=Yes"
if $cmd && ( $chain eq 'tcpre' || $chain eq 'tcout' ) && $val <= $limit;
}
fatal_error "Marks <= $limit may not be set in the PREROUTING or OUTPUT chains when PROVIDER_OFFSET > 0"
if $cmd && ( $chain eq 'tcpre' || $chain eq 'tcout' ) && $val <= $limit;
}
}
}
@@ -445,13 +444,34 @@ sub process_flow($) {
}
sub process_simple_device() {
my ( $device , $type , $in_bandwidth ) = split_line 1, 3, 'tcinterfaces';
my ( $device , $type , $bandwidth ) = split_line 1, 3, 'tcinterfaces';
my $devnumber;
if ( $device =~ /:/ ) {
( my $number, $device, my $rest ) = split /:/, $device, 3;
fatal_error "Invalid NUMBER:INTERFACE ($device:$number:$rest)" if defined $rest;
if ( defined $number ) {
$devnumber = hex_value( $number );
fatal_error "Invalid interface NUMBER ($number)" unless defined $devnumber && $devnumber;
fatal_error "Duplicate interface number ($number)" if defined $devnums[ $devnumber ];
$devnum = $devnumber if $devnumber > $devnum;
} else {
fatal_error "Missing interface NUMBER";
}
} else {
$devnumber = ++$devnum;
}
$devnums[ $devnumber ] = $device;
my $number = in_hexp $devnumber;
fatal_error "Duplicate INTERFACE ($device)" if $tcdevices{$device};
fatal_error "Invalid INTERFACE name ($device)" if $device =~ /[:+]/;
my $number = in_hexp( $tcdevices{$device} = ++$devnum );
my $physical = physical_name $device;
my $dev = chain_base( $physical );
@@ -465,7 +485,13 @@ sub process_simple_device() {
}
}
$in_bandwidth = rate_to_kbit( $in_bandwidth );
$tcdevices{$device} = { number => $devnumber ,
physical => physical_name $device ,
type => $type ,
in_bandwidth => $bandwidth = rate_to_kbit( $bandwidth ) ,
};
push @tcdevices, $device;
emit "if interface_is_up $physical; then";
@@ -473,24 +499,28 @@ sub process_simple_device() {
emit ( "${dev}_exists=Yes",
"qt \$TC qdisc del dev $physical root",
"qt \$TC qdisc del dev $physical ingress\n"
"qt \$TC qdisc del dev $physical ingress\n"
);
emit ( "run_tc qdisc add dev $physical handle ffff: ingress",
"run_tc filter add dev $physical parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${in_bandwidth}kbit burst 10k drop flowid :1\n"
) if $in_bandwidth;
if ( $bandwidth ) {
emit ( "run_tc qdisc add dev $physical handle ffff: ingress",
"run_tc filter add dev $physical parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${bandwidth}kbit burst 10k drop flowid :1\n"
);
}
emit "run_tc qdisc add dev $physical root handle $number: prio bands 3 priomap $config{TC_PRIOMAP}";
my $i = 0;
for ( my $i = 1; $i <= 3; $i++ ) {
while ( ++$i <= 3 ) {
emit "run_tc qdisc add dev $physical parent $number:$i handle ${number}${i}: sfq quantum 1875 limit 127 perturb 10";
emit "run_tc filter add dev $physical protocol all parent $number: handle $i fw classid $number:$i";
emit "run_tc filter add dev $physical protocol all prio 1 parent ${number}$i: handle ${number}${i} flow hash keys $type divisor 1024" if $type ne '-' && have_capability 'FLOW_FILTER';
emit "run_tc filter add dev $physical protocol all parent $number: handle $i fw classid $devnum:$i";
emit "run_tc filter add dev $physical protocol all prio 1 parent ${number}$i: handle ${number}${i} flow hash keys $type divisor 1024" if $type ne '-';
emit '';
}
save_progress_message_short qq(" TC Device $physical defined.");
save_progress_message_short " TC Device $physical defined.";
pop_indent;
emit 'else';
push_indent;
@@ -499,9 +529,9 @@ sub process_simple_device() {
emit "${dev}_exists=";
pop_indent;
emit "fi\n";
progress_message " Simple tcdevice \"$currentline\" $done.";
}
}
sub validate_tc_device( ) {
my ( $device, $inband, $outband , $options , $redirected ) = split_line 3, 5, 'tcdevices';
@@ -561,13 +591,13 @@ sub validate_tc_device( ) {
if ( @redirected ) {
fatal_error "IFB devices may not have IN-BANDWIDTH" if $inband ne '-' && $inband;
$classify = 1;
}
for my $rdevice ( @redirected ) {
fatal_error "Invalid device name ($rdevice)" if $rdevice =~ /[:+]/;
my $rdevref = $tcdevices{$rdevice};
fatal_error "REDIRECTED device ($rdevice) has not been defined in this file" unless $rdevref;
fatal_error "IN-BANDWIDTH must be zero for REDIRECTED devices" if $rdevref->{in_bandwidth} ne '0kbit';
}
for my $rdevice ( @redirected ) {
fatal_error "Invalid device name ($rdevice)" if $rdevice =~ /[:+]/;
my $rdevref = $tcdevices{$rdevice};
fatal_error "REDIRECTED device ($rdevice) has not been defined in this file" unless $rdevref;
fatal_error "IN-BANDWIDTH must be zero for REDIRECTED devices" if $rdevref->{in_bandwidth} ne '0kbit';
}
$tcdevices{$device} = { in_bandwidth => rate_to_kbit( $inband ) . 'kbit',
@@ -1064,7 +1094,7 @@ sub process_tc_filter( ) {
$currentline =~ s/\s+/ /g;
save_progress_message_short qq(' TC Filter \"$currentline\" defined.');
save_progress_message_short qq(" TC Filter \"$currentline\" defined.");
emit '';
@@ -1084,7 +1114,7 @@ sub process_tc_priority() {
my $rule = do_helper( $helper ) . "-j MARK --set-mark $band";
$rule .= join('', '/', in_hex( $globals{TC_MASK} ) ) if have_capability( 'EXMARK' );
$rule .= join('', '/', in_hex( $globals{TC_MASK} ) ) if $capabilities{EXMARK};
if ( $interface ne '-' ) {
fatal_error "Invalid combination of columns" unless $address eq '-' && $proto eq '-' && $ports eq '-';
@@ -1096,14 +1126,14 @@ sub process_tc_priority() {
1 );
} else {
my $postref = $mangle_table->{tcpost};
if ( $address ne '-' ) {
fatal_error "Invalid combination of columns" unless $proto eq '-' && $ports eq '-';
add_rule( $postref ,
join( '', match_source_net( $address) , $rule ) ,
1 );
} else {
add_rule( $postref ,
add_rule( $postref ,
join( '', do_proto( $proto, $ports, '-' , 0 ) , $rule ) ,
1 );
@@ -1115,7 +1145,7 @@ sub process_tc_priority() {
$ipp2p = 1;
}
add_rule( $postref ,
add_rule( $postref ,
join( '' , do_proto( $proto, '-', $ports, 0 ) , $rule ) ,
1 )
unless $proto =~ /^ipp2p/ || $protocol == ICMP || $protocol == IPv6_ICMP;
@@ -1127,7 +1157,7 @@ sub process_tc_priority() {
sub setup_simple_traffic_shaping() {
my $interfaces;
save_progress_message q("Setting up Traffic Control...");
save_progress_message "Setting up Traffic Control...";
my $fn = open_file 'tcinterfaces';
@@ -1141,12 +1171,9 @@ sub setup_simple_traffic_shaping() {
my $fn1 = open_file 'tcpri';
if ( $fn1 ) {
first_entry
sub {
progress_message2 "$doing $fn1...";
warning_message "There are entries in $fn1 but $fn was empty" unless $interfaces;
};
first_entry sub { progress_message2 "$doing $fn1...";
warning_message "There are entries in $fn1 but $fn was empty" unless $interfaces;
};
process_tc_priority while read_a_line;
clear_comment;
@@ -1161,7 +1188,7 @@ sub setup_simple_traffic_shaping() {
sub setup_traffic_shaping() {
our $lastrule = '';
save_progress_message q("Setting up Traffic Control...");
save_progress_message "Setting up Traffic Control...";
my $fn = open_file 'tcdevices';
@@ -1171,9 +1198,6 @@ sub setup_traffic_shaping() {
validate_tc_device while read_a_line;
}
my $sfq = $devnum;
my $sfqinhex;
$devnum = $devnum > 10 ? 10 : 1;
$fn = open_file 'tcclasses';
@@ -1243,7 +1267,7 @@ sub setup_traffic_shaping() {
emit( "run_tc filter add dev $rdev parent ffff: protocol all u32 match u32 0 0 action mirred egress redirect dev $device > /dev/null" );
}
save_progress_message_short qq(" TC Device $device defined.");
save_progress_message_short " TC Device $device defined.";
pop_indent;
emit 'else';
@@ -1310,18 +1334,17 @@ sub setup_traffic_shaping() {
}
}
if ( $tcref->{leaf} && ! $tcref->{pfifo} ) {
$sfqinhex = in_hexp( ++$sfq);
emit( "run_tc qdisc add dev $device parent $classid handle $sfqinhex: sfq quantum \$quantum limit $tcref->{limit} perturb 10" );
}
emit( "run_tc qdisc add dev $device parent $classid handle ${classnum}: sfq quantum \$quantum limit $tcref->{limit} perturb 10" ) if $tcref->{leaf} && ! $tcref->{pfifo};
#
# add filters
#
unless ( $devref->{classify} ) {
emit "run_tc filter add dev $device protocol all parent $devicenumber:0 prio " . ( $priority | 20 ) . " handle $mark fw classid $classid" if $tcref->{occurs} == 1;
if ( $tcref->{occurs} == 1 ) {
emit "run_tc filter add dev $device protocol all parent $devicenumber:0 prio " . ( $priority | 20 ) . " handle $mark fw classid $classid";
}
}
emit "run_tc filter add dev $device protocol all prio 1 parent $sfqinhex: handle $classnum flow hash keys $tcref->{flow} divisor 1024" if $tcref->{flow};
emit "run_tc filter add dev $device protocol all prio 1 parent $classnum: handle $classnum flow hash keys $tcref->{flow} divisor 1024" if $tcref->{flow};
#
# options
#
@@ -1345,7 +1368,7 @@ sub setup_traffic_shaping() {
$fn = open_file 'tcfilters';
if ( $fn ) {
first_entry( sub { progress_message2 "$doing $fn..."; save_progress_message q("Adding TC Filters"); } );
first_entry( sub { progress_message2 "$doing $fn..."; save_progress_message "Adding TC Filters"; } );
process_tc_filter while read_a_line;
}
@@ -1361,7 +1384,7 @@ sub setup_tc() {
ensure_mangle_chain 'tcpre';
ensure_mangle_chain 'tcout';
if ( have_capability( 'MANGLE_FORWARD' ) ) {
if ( $capabilities{MANGLE_FORWARD} ) {
ensure_mangle_chain 'tcfor';
ensure_mangle_chain 'tcpost';
}
@@ -1376,7 +1399,7 @@ sub setup_tc() {
# This is overloading TRACK_PROVIDERS a bit but sending tracked packets through PREROUTING is a PITA for users
#
for my $interface ( @routemarked_interfaces ) {
add_jump $mangle_table->{PREROUTING} , 'tcpre', 0, match_source_dev( $interface );
add_rule $mangle_table->{PREROUTING} , match_source_dev( $interface ) . "-j tcpre";
}
}
}
@@ -1384,17 +1407,15 @@ sub setup_tc() {
add_jump $mangle_table->{PREROUTING} , 'tcpre', 0, $mark_part;
add_jump $mangle_table->{OUTPUT} , 'tcout', 0, $mark_part;
if ( have_capability( 'MANGLE_FORWARD' ) ) {
my $mask = have_capability 'EXMARK' ? have_capability 'FWMARK_RT_MASK' ? '/' . in_hex $globals{PROVIDER_MASK} : '' : '';
add_rule( $mangle_table->{FORWARD}, "-j MARK --set-mark 0${mask}" ) if $config{FORWARD_CLEAR_MARK};
if ( $capabilities{MANGLE_FORWARD} ) {
add_rule( $mangle_table->{FORWARD}, '-j MARK --set-mark 0' );
add_jump $mangle_table->{FORWARD} , 'tcfor', 0;
add_jump $mangle_table->{POSTROUTING} , 'tcpost', 0;
}
}
if ( $globals{TC_SCRIPT} ) {
save_progress_message q('Setting up Traffic Control...');
save_progress_message 'Setting up Traffic Control...';
append_file $globals{TC_SCRIPT};
} elsif ( $config{TC_ENABLED} eq 'Internal' ) {
setup_traffic_shaping;

View File

@@ -34,7 +34,7 @@ use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_tunnels );
our @EXPORT_OK = ( );
our $VERSION = '4.4_9';
our $VERSION = '4.5_0';
#
# Here starts the tunnel stuff -- we really should get rid of this crap...
@@ -61,7 +61,7 @@ sub setup_tunnels() {
}
}
my $options = $globals{UNTRACKED} ? "$globals{STATEMATCH} NEW,UNTRACKED -j ACCEPT" : "$globals{STATEMATCH} NEW -j ACCEPT";
my $options = $globals{UNTRACKED} ? '-m state --state NEW,UNTRACKED -j ACCEPT' : '-m state --state NEW -j ACCEPT';
add_tunnel_rule $inchainref, "-p 50 $source -j ACCEPT";
add_tunnel_rule $outchainref, "-p 50 $dest -j ACCEPT";
@@ -86,7 +86,7 @@ sub setup_tunnels() {
$inchainref = ensure_filter_chain rules_chain( ${zone}, ${fw} ), 1;
$outchainref = ensure_filter_chain rules_chain( ${fw}, ${zone} ), 1;
unless ( have_ipsec ) {
unless ( $capabilities{POLICY_MATCH} ) {
add_tunnel_rule $inchainref, "-p 50 $source -j ACCEPT";
add_tunnel_rule $outchainref, "-p 50 $dest -j ACCEPT";

View File

@@ -11,7 +11,7 @@
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the shope that it will be useful,
# 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.
@@ -37,7 +37,6 @@ our @EXPORT = qw( NOTHING
IPSECPROTO
IPSECMODE
FIREWALL
VSERVER
IP
BPORT
IPSEC
@@ -53,11 +52,8 @@ our @EXPORT = qw( NOTHING
all_zones
all_parent_zones
complex_zones
vserver_zones
off_firewall_zones
non_firewall_zones
single_interface
chain_base
validate_interfaces_file
all_interfaces
all_bridges
@@ -71,19 +67,15 @@ our @EXPORT = qw( NOTHING
source_port_to_bridge
interface_is_optional
find_interfaces_by_option
find_interfaces_by_option1
get_interface_option
set_interface_option
verify_required_interfaces
compile_updown
validate_hosts_file
find_hosts_by_option
all_ipsets
have_ipsec
);
our @EXPORT_OK = qw( initialize );
our $VERSION = '4.4_12';
our $VERSION = '4.5_0';
#
# IPSEC Option types
@@ -155,6 +147,7 @@ our %reservedName = ( all => 1,
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
# number => <ordinal position in the interfaces file>
# physical => <physical interface name>
# include => [ <if1>, ... ]
# }
# }
#
@@ -164,13 +157,11 @@ our @bport_zones;
our %ipsets;
our %physical;
our $family;
our $have_ipsec;
use constant { FIREWALL => 1,
IP => 2,
BPORT => 3,
IPSEC => 4,
VSERVER => 5 };
IPSEC => 4 };
use constant { SIMPLE_IF_OPTION => 1,
BINARY_IF_OPTION => 2,
@@ -180,18 +171,17 @@ use constant { SIMPLE_IF_OPTION => 1,
IPLIST_IF_OPTION => 6,
STRING_IF_OPTION => 7,
MASK_IF_OPTION => 7,
MASK_IF_OPTION => 15,
IF_OPTION_ZONEONLY => 8,
IF_OPTION_HOST => 16,
IF_OPTION_VSERVER => 32,
IF_OPTION_ZONEONLY => 16,
IF_OPTION_HOST => 32,
};
our %validinterfaceoptions;
our %defaultinterfaceoptions = ( routefilter => 1 , wait => 60 );
our %defaultinterfaceoptions = ( routefilter => 1 );
our %maxoptionvalue = ( routefilter => 2, mss => 100000 , wait => 120 );
our %maxoptionvalue = ( routefilter => 2, mss => 100000 );
our %validhostoptions;
@@ -210,7 +200,6 @@ sub initialize( $ ) {
@zones = ();
%zones = ();
$firewall_zone = '';
$have_ipsec = undef;
@interfaces = ();
%interfaces = ();
@@ -227,13 +216,12 @@ sub initialize( $ ) {
dhcp => SIMPLE_IF_OPTION,
maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
logmartians => BINARY_IF_OPTION,
nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_VSERVER,
nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY,
norfc1918 => OBSOLETE_IF_OPTION,
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
optional => SIMPLE_IF_OPTION,
proxyarp => BINARY_IF_OPTION,
required => SIMPLE_IF_OPTION,
routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER,
routeback => SIMPLE_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST,
routefilter => NUMERIC_IF_OPTION ,
sourceroute => BINARY_IF_OPTION,
tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST,
@@ -241,7 +229,6 @@ sub initialize( $ ) {
upnpclient => SIMPLE_IF_OPTION,
mss => NUMERIC_IF_OPTION,
physical => STRING_IF_OPTION + IF_OPTION_HOST,
wait => NUMERIC_IF_OPTION,
);
%validhostoptions = (
blacklist => 1,
@@ -258,18 +245,16 @@ sub initialize( $ ) {
bridge => SIMPLE_IF_OPTION,
dhcp => SIMPLE_IF_OPTION,
maclist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_VSERVER,
nosmurfs => SIMPLE_IF_OPTION + IF_OPTION_HOST,
nets => IPLIST_IF_OPTION + IF_OPTION_ZONEONLY,
nosmurfs => SIMPLE_IF_OPTION,
optional => SIMPLE_IF_OPTION,
proxyndp => BINARY_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,
sourceroute => BINARY_IF_OPTION,
tcpflags => SIMPLE_IF_OPTION + IF_OPTION_HOST,
mss => NUMERIC_IF_OPTION,
forward => BINARY_IF_OPTION,
physical => STRING_IF_OPTION + IF_OPTION_HOST,
wait => NUMERIC_IF_OPTION,
);
%validhostoptions = (
blacklist => 1,
@@ -381,7 +366,6 @@ sub process_zone( \$ ) {
fatal_error "Invalid Parent List ($2)" unless $p;
fatal_error "Unknown parent zone ($p)" unless $zones{$p};
fatal_error 'Subzones of firewall zone not allowed' if $zones{$p}{type} == FIREWALL;
fatal_error 'Subzones of a Vserver zone not allowed' if $zones{$p}{type} == VSERVER;
push @{$zones{$p}{children}}, $zone;
}
}
@@ -408,30 +392,32 @@ sub process_zone( \$ ) {
$firewall_zone = $zone;
$ENV{FW} = $zone;
$type = FIREWALL;
} elsif ( $type eq 'vserver' ) {
fatal_error 'Vserver zones may not be nested' if @parents;
$type = VSERVER;
} elsif ( $type eq '-' ) {
$type = IP;
$$ip = 1;
} else {
fatal_error "Invalid zone type ($type)";
fatal_error "Invalid zone type ($type)" ;
}
if ( $type eq IPSEC ) {
require_capability 'POLICY_MATCH' , 'IPSEC zones', '';
for ( @parents ) {
set_super( $zones{$_} ) unless $zones{$_}{type} == IPSEC;
unless ( $zones{$_}{type} == IPSEC ) {
set_super( $zones{$_} );
}
}
}
for ( $options, $in_options, $out_options ) {
$_ = '' if $_ eq '-';
}
$zones{$zone} = { type => $type,
parents => \@parents,
bridge => '',
options => { in_out => parse_zone_option_list( $options || '', $type ) ,
in => parse_zone_option_list( $in_options || '', $type ) ,
out => parse_zone_option_list( $out_options || '', $type ) ,
complex => ( $type == IPSEC || $options ne '-' || $in_options ne '-' || $out_options ne '-' ) ,
complex => ($type == IPSEC || $options || $in_options || $out_options ? 1 : 0) ,
nested => @parents > 0 ,
super => 0 ,
} ,
@@ -504,9 +490,9 @@ sub zone_report()
my @translate;
if ( $family == F_IPV4 ) {
@translate = ( undef, 'firewall', 'ipv4', 'bport4', 'ipsec4', 'vserver' );
@translate = ( undef, 'firewall', 'ipv4', 'bport4', 'ipsec4' );
} else {
@translate = ( undef, 'firewall', 'ipv6', 'bport6', 'ipsec6', 'vserver' );
@translate = ( undef, 'firewall', 'ipv6', 'bport6', 'ipsec6' );
}
for my $zone ( @zones )
@@ -533,7 +519,7 @@ sub zone_report()
my $grouplist = join ',', ( @$hosts );
my $exclusions = join ',', @{$groupref->{exclusions}};
$grouplist = join '!', ( $grouplist, $exclusions) if $exclusions;
if ( $family == F_IPV4 ) {
progress_message_nocompress " $iref->{physical}:$grouplist";
} else {
@@ -563,9 +549,9 @@ sub dump_zone_contents()
my @xlate;
if ( $family == F_IPV4 ) {
@xlate = ( undef, 'firewall', 'ipv4', 'bport4', 'ipsec4', 'vserver' );
@xlate = ( undef, 'firewall', 'ipv4', 'bport4', 'ipsec4' );
} else {
@xlate = ( undef, 'firewall', 'ipv6', 'bport6', 'ipsec6', 'vserver' );
@xlate = ( undef, 'firewall', 'ipv6', 'bport6', 'ipsec6' );
}
for my $zone ( @zones )
@@ -642,9 +628,7 @@ sub add_group_to_zone($$$$$)
my $allip = 0;
for my $host ( @$networks ) {
$interfaceref = $interfaces{$interface};
$interfaceref->{nets}++;
$interfaces{$interface}{nets}++;
fatal_error "Invalid Host List" unless defined $host and $host ne '';
@@ -661,13 +645,6 @@ sub add_group_to_zone($$$$$)
if ( $host eq ALLIP ) {
fatal_error "Duplicate Host Group ($interface:$host) in zone $zone" if @newnetworks;
$interfaces{$interface}{zone} = $zone;
#
# Make 'find_hosts_by_option()' work correctly for this zone
#
for ( qw/blacklist maclist nosmurfs tcpflags/ ) {
$options->{$_} = 1 if $interfaceref->{options}{$_};
}
$allip = 1;
}
}
@@ -731,58 +708,27 @@ sub all_zones() {
@zones;
}
sub off_firewall_zones() {
grep ( ! ( $zones{$_}{type} == FIREWALL || $zones{$_}{type} == VSERVER ) , @zones );
}
sub non_firewall_zones() {
grep ( $zones{$_}{type} != FIREWALL , @zones );
grep ( $zones{$_}{type} != FIREWALL , @zones );
}
sub all_parent_zones() {
#
# Although the firewall zone is technically a parent zone, we let the caller decide
# if it is to be included or not.
#
grep ( ! @{$zones{$_}{parents}} , off_firewall_zones );
grep ( ! @{$zones{$_}{parents}} , @zones );
}
sub complex_zones() {
grep( $zones{$_}{options}{complex} , @zones );
}
sub vserver_zones() {
grep ( $zones{$_}{type} == VSERVER, @zones );
}
sub firewall_zone() {
$firewall_zone;
}
#
# Determine if the passed physical device is a bridge
#
sub is_a_bridge( $ ) {
which 'brctl' && qt( "brctl show | tail -n+2 | grep -q '^$_[0]\[\[:space:\]\]'" );
}
#
# Transform the passed interface name into a legal shell variable name.
#
sub chain_base($) {
my $chain = $_[0];
$chain =~ s/^@/at_/;
$chain =~ tr/[.\-%@]/_/;
$chain =~ s/\+$//;
$chain;
}
#
# Process a record in the interfaces file
#
sub process_interface( $$ ) {
my ( $nextinum, $export ) = @_;
my ( $nextinum , $export ) = @_;
my $netsref = '';
my ($zone, $originalinterface, $bcasts, $options ) = split_line 2, 4, 'interfaces file';
my $zoneref;
@@ -797,6 +743,9 @@ sub process_interface( $$ ) {
fatal_error "Firewall zone not allowed in ZONE column of interface record" if $zoneref->{type} == FIREWALL;
}
$bcasts = '' if $bcasts eq '-';
$options = '' if $options eq '-';
my ($interface, $port, $extra) = split /:/ , $originalinterface, 3;
fatal_error "Invalid INTERFACE ($originalinterface)" if ! $interface || defined $extra;
@@ -804,7 +753,7 @@ sub process_interface( $$ ) {
if ( defined $port && $port ne '' ) {
fatal_error qq("Virtual" interfaces are not supported -- see http://www.shorewall.net/Shorewall_and_Aliased_Interfaces.html) if $port =~ /^\d+$/;
require_capability( 'PHYSDEV_MATCH', 'Bridge Ports', '');
fatal_error "Your iptables is not recent enough to support bridge ports" unless have_capability( 'KLUDGEFREE' );
fatal_error "Your iptables is not recent enough to support bridge ports" unless $capabilities{KLUDGEFREE};
fatal_error "Invalid Interface Name ($interface:$port)" unless $port =~ /^[\w.@%-]+\+?$/;
fatal_error "Duplicate Interface ($port)" if $interfaces{$port};
@@ -818,8 +767,6 @@ sub process_interface( $$ ) {
} else {
$zoneref->{bridge} = $interface;
}
fatal_error "Vserver zones may not be associated with bridge ports" if $zoneref->{type} == VSERVER;
}
$bridge = $interface;
@@ -827,8 +774,6 @@ sub process_interface( $$ ) {
} else {
fatal_error "Duplicate Interface ($interface)" if $interfaces{$interface};
fatal_error "Zones of type 'bport' may only be associated with bridge ports" if $zone && $zoneref->{type} == BPORT;
fatal_error "Vserver zones may not be associated with interfaces" if $zone && $zoneref->{type} == VSERVER;
$bridge = $interface;
}
@@ -845,14 +790,14 @@ sub process_interface( $$ ) {
my $physical = $interface;
my $broadcasts;
unless ( $bcasts eq '-' || $bcasts eq 'detect' ) {
unless ( $bcasts eq '' || $bcasts eq 'detect' ) {
my @broadcasts = split_list $bcasts, 'address';
for my $address ( @broadcasts ) {
fatal_error 'Invalid BROADCAST address' unless $address =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
}
if ( have_capability( 'ADDRTYPE' ) ) {
if ( $capabilities{ADDRTYPE} ) {
warning_message 'Shorewall no longer uses broadcast addresses in rule generation when Address Type Match is available';
} else {
$broadcasts = \@broadcasts;
@@ -865,13 +810,7 @@ sub process_interface( $$ ) {
my $hostoptionsref = {};
if ( $options eq 'ignore' ) {
fatal_error "Ignored interfaces may not be associated with a zone" if $zone;
$options{ignore} = 1;
$options = '-';
}
if ( $options ne '-' ) {
if ( $options ) {
my %hostoptions = ( dynamic => 0 );
@@ -882,11 +821,7 @@ sub process_interface( $$ ) {
fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option};
if ( $zone ) {
fatal_error qq(The "$option" option may not be specified for a Vserver zone") if $zoneref->{type} == VSERVER && ! ( $type & IF_OPTION_VSERVER );
} else {
fatal_error "The \"$option\" option may not be specified on a multi-zone interface" if $type & IF_OPTION_ZONEONLY;
}
fatal_error "The \"$option\" option may not be specified on a multi-zone interface" if $type & IF_OPTION_ZONEONLY && ! $zone;
my $hostopt = $type & IF_OPTION_HOST;
@@ -965,7 +900,7 @@ sub process_interface( $$ ) {
fatal_error "The '$option' option requires a value" unless defined $value;
if ( $option eq 'physical' ) {
fatal_error "Invalid Physical interface name ($value)" unless $value && $value =~ /^[\w.@%-]*\+?$/;
fatal_error "Invalid Physical interface name ($value)" unless $value =~ /^[\w.@%-]+\+?$/;
fatal_error "Duplicate physical interface name ($value)" if ( $physical{$value} && ! $port );
@@ -979,29 +914,27 @@ sub process_interface( $$ ) {
}
}
fatal_error "Invalid combination of interface options" if $options{required} && $options{optional};
if ( $netsref eq 'dynamic' ) {
my $ipset = "${zone}_" . chain_base $physical;
$netsref = [ "+$ipset" ];
$ipsets{$ipset} = 1;
}
$zoneref->{options}{in_out}{routeback} = 1 if $zoneref && $options{routeback};
if ( $options{bridge} ) {
require_capability( 'PHYSDEV_MATCH', 'The "bridge" option', 's');
fatal_error "Bridges may not have wildcard names" if $wildcard;
$hostoptions{routeback} = $options{routeback} = 1;
}
$hostoptions{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export || $options{routeback};
$hostoptionsref = \%hostoptions;
} else {
#
# No options specified -- auto-detect bridge
#
$hostoptionsref->{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export;
}
#
# Automatically set 'routeback' for local bridges
#
unless ( $export || $wildcard || $options{routeback} ) {
$options{routeback} = $hostoptionsref->{routeback} = is_bridge $physical;
}
$physical{$physical} = $interfaces{$interface} = { name => $interface ,
@@ -1018,12 +951,12 @@ sub process_interface( $$ ) {
if ( $zone ) {
$netsref ||= [ allip ];
add_group_to_zone( $zone, $zoneref->{type}, $interface, $netsref, $hostoptionsref );
add_group_to_zone( $zone,
$zoneref->{type},
$interface,
$family == F_IPV4 ? [ IPv4_MULTICAST ] : [ IPv6_MULTICAST ] ,
add_group_to_zone( $zone,
$zoneref->{type},
$interface,
[ IPv4_MULTICAST ],
{ destonly => 1 } ) if $hostoptionsref->{multicast} && $interfaces{$interface}{zone} ne $zone;
}
}
progress_message " Interface \"$currentline\" Validated";
@@ -1068,27 +1001,6 @@ sub validate_interfaces_file( $ ) {
# Be sure that we have at least one interface
#
fatal_error "No network interfaces defined" unless @interfaces;
if ( vserver_zones ) {
#
# While the user thinks that vservers are associated with a particular interface, they really are not.
# We create an interface to associated them with.
#
my $interface = '%vserver%';
$interfaces{$interface} = { name => $interface ,
bridge => $interface ,
nets => 0 ,
number => $nextinum ,
root => $interface ,
broadcasts => undef ,
options => {} ,
zone => '',
physical => 'lo',
};
push @interfaces, $interface;
}
}
#
@@ -1097,18 +1009,18 @@ sub validate_interfaces_file( $ ) {
sub map_physical( $$ ) {
my ( $name, $interfaceref ) = @_;
my $physical = $interfaceref->{physical};
return $physical if $name eq $interfaceref->{name};
$physical =~ s/\+$//;
$physical . substr( $name, length $interfaceref->{root} );
}
}
#
# Returns true if passed interface matches an entry in /etc/shorewall/interfaces
#
# If the passed name matches a wildcard, an entry for the name is added in %interfaces to speed up validation of other references to that name.
# If the passed name matches a wildcard, a entry for the name is added in %interfaces to speed up validation of other references to that name.
#
sub known_interface($)
{
@@ -1124,9 +1036,9 @@ sub known_interface($)
#
# Cache this result for future reference. We set the 'name' to the name of the entry that appears in /etc/shorewall/interfaces and we do not set the root;
#
return $interfaces{$interface} = { options => $interfaceref->{options},
bridge => $interfaceref->{bridge} ,
name => $i ,
return $interfaces{$interface} = { options => $interfaceref->{options},
bridge => $interfaceref->{bridge} ,
name => $i ,
number => $interfaceref->{number} ,
physical => map_physical( $interface, $interfaceref )
};
@@ -1227,7 +1139,7 @@ sub find_interfaces_by_option( $ ) {
for my $interface ( @interfaces ) {
my $interfaceref = $interfaces{$interface};
next unless $interfaceref->{root};
my $optionsref = $interfaceref->{options};
@@ -1239,28 +1151,6 @@ sub find_interfaces_by_option( $ ) {
\@ints;
}
#
# Returns reference to array of interfaces with the passed option
#
sub find_interfaces_by_option1( $ ) {
my $option = $_[0];
my @ints = ();
for my $interface ( keys %interfaces ) {
my $interfaceref = $interfaces{$interface};
next unless defined $interfaceref->{physical};
next if $interfaceref->{physical} =~ /\+/;
my $optionsref = $interfaceref->{options};
if ( $optionsref && defined $optionsref->{$option} ) {
push @ints , $interface
}
}
\@ints;
}
#
# Return the value of an option for an interface
#
@@ -1279,293 +1169,6 @@ sub set_interface_option( $$$ ) {
$interfaces{$interface}{options}{$option} = $value;
}
#
# Verify that all required interfaces are available after waiting for any that specify the 'wait' option.
#
sub verify_required_interfaces( $ ) {
my $generate_case = shift;
my $returnvalue = 0;
my $interfaces = find_interfaces_by_option 'wait';
if ( @$interfaces ) {
my $first = 1;
emit( "local waittime\n" );
emit( 'case "$COMMAND" in' );
push_indent;
emit( 'start|restart|restore)' );
push_indent;
for my $interface (@$interfaces ) {
my $wait = $interfaces{$interface}{options}{wait};
emit q() unless $first-- > 0;
if ( $wait ) {
my $physical = get_physical $interface;
if ( $physical =~ /\+$/ ) {
my $base = uc chain_base $physical;
$physical =~ s/\+$/*/;
emit( 'for interface in $(find_all_interfaces); do',
' case $interface in',
" $physical)",
" waittime=$wait",
' while [ $waittime -gt 0 ]; do',
' interface_is_usable $interface && break',
' waittime=$(($waittime - 1))',
' done',
' ;;',
' esac',
'done',
'',
);
} else {
emit qq(if ! interface_is_usable $physical; then);
emit qq( waittime=$wait);
emit '';
emit q( while [ $waittime -gt 0 ]; do);
emit qq( interface_is_usable $physical && break);
emit q( sleep 1);
emit ' waittime=$(($waittime - 1))';
emit q( done);
emit q(fi);
}
$returnvalue = 1;
}
}
emit( ";;\n" );
pop_indent;
pop_indent;
emit( "esac\n" );
}
$interfaces = find_interfaces_by_option 'required';
if ( @$interfaces ) {
if ( $generate_case ) {
emit( 'case "$COMMAND" in' );
push_indent;
emit( 'start|restart|restore|refresh)' );
push_indent;
}
for my $interface (@$interfaces ) {
my $physical = get_physical $interface;
if ( $physical =~ /\+$/ ) {
my $base = uc chain_base $physical;
$physical =~ s/\+$/*/;
emit( "${base}_IS_UP=\n",
'for interface in $(find_all_interfaces); do',
' case $interface in',
" $physical)",
" interface_is_usable \$interface && ${base}_IS_UP=Yes && break",
' ;;',
' esac',
'done',
'',
"if [ -z \"\$${base}_IS_UP\" ]; then",
" startup_error \"None of the required interfaces $physical are available\"",
"fi\n"
);
} else {
emit qq(if ! interface_is_usable $physical; then);
emit qq( startup_error "Required interface $physical not available");
emit qq(fi\n);
}
}
if ( $generate_case ) {
emit( ';;' );
pop_indent;
pop_indent;
emit( 'esac' );
}
$returnvalue = 1;
}
$returnvalue;
}
#
# Emit the updown() function
#
sub compile_updown() {
emit( '',
'#',
'# Handle the "up" and "down" commands',
'#',
'updown() # $1 = interface',
'{',
);
push_indent;
emit( 'local state',
'state=cleared',
'' );
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/\+/*/;
emit( "$interfaces)",
' progress_message3 "$COMMAND on interface $1 ignored"',
' exit 0',
' ;;'
);
}
if ( @$required ) {
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$required;
my $wildcard = ( $interfaces =~ s/\+/*/ );
emit( "$interfaces)",
' if [ "$COMMAND" = up ]; then' );
if ( $wildcard ) {
emit( ' if [ "$state" = started ]; then',
' COMMAND=restart',
' else',
' COMMAND=start',
' fi' );
} else {
emit( ' COMMAND=start' );
}
emit( ' 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 = join '|', map $interfaces{$_}->{physical}, @$optional;
$interfaces =~ s/\+/*/;
emit( "$interfaces)",
' if [ "$COMMAND" = up ]; then',
' echo 0 > ${VARDIR}/${1}.state',
' else',
' echo 1 > ${VARDIR}/${1}.state',
' fi',
'',
' if [ "$state" = started ]; then',
' COMMAND=restart',
' 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
#
@@ -1606,7 +1209,7 @@ sub process_host( ) {
} elsif ( $zoneref->{bridge} ne $interfaces{$interface}{bridge} ) {
fatal_error "Interface $interface is not a port on bridge $zoneref->{bridge}";
}
}
}
my $optionsref = { dynamic => 0 };
@@ -1616,22 +1219,18 @@ sub process_host( ) {
for my $option ( @options ) {
if ( $option eq 'ipsec' ) {
require_capability 'POLICY_MATCH' , q(The 'ipsec' option), 's';
$type = IPSEC;
$zoneref->{options}{complex} = 1;
$ipsec = 1;
} elsif ( $option eq 'norfc1918' ) {
warning_message "The 'norfc1918' option is no longer supported"
} elsif ( $validhostoptions{$option}) {
fatal_error qq(The "$option" option is not allowed with Vserver zones) if $type == VSERVER && ! ( $validhostoptions{$option} & IF_OPTION_VSERVER );
$options{$option} = 1;
} else {
fatal_error "Invalid option ($option)";
}
}
fatal_error q(A host entry for a Vserver zone may not specify the 'ipsec' option) if $ipsec && $zoneref->{type} == VSERVER;
$optionsref = \%options;
}
@@ -1651,7 +1250,6 @@ sub process_host( ) {
$hosts = join( '', ALLIP , $hosts ) if substr($hosts, 0, 2 ) eq ',!';
if ( $hosts eq 'dynamic' ) {
fatal_error "Vserver zones may not be dynamic" if $type == VSERVER;
require_capability( 'IPSET_MATCH', 'Dynamic nets', '');
my $physical = physical_name $interface;
$hosts = "+${zone}_${physical}";
@@ -1659,10 +1257,6 @@ sub process_host( ) {
$ipsets{"${zone}_${physical}"} = 1;
}
#
# We ignore the user's notion of what interface vserver addresses are on and simply invent one for all of the vservers.
#
$interface = '%vserver%' if $type == VSERVER;
add_group_to_zone( $zone, $type , $interface, [ split_list( $hosts, 'host' ) ] , $optionsref);
@@ -1684,15 +1278,7 @@ sub validate_hosts_file()
$ipsec |= process_host while read_a_line;
$have_ipsec = $ipsec || haveipseczones;
}
#
# Return an indication of whether IPSEC is present
#
sub have_ipsec() {
return defined $have_ipsec ? $have_ipsec : have_capability 'POLICY_MATCH';
$capabilities{POLICY_MATCH} = '' unless $ipsec || haveipseczones;
}
#

View File

@@ -4,7 +4,7 @@
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2007,2008,2009,2010 - Tom Eastep (teastep@shorewall.net)
# (c) 2007,2008,2009 - Tom Eastep (teastep@shorewall.net)
#
# Complete documentation is available at http://shorewall.net
#
@@ -45,6 +45,7 @@ use Shorewall::Compiler;
use Getopt::Long;
sub usage( $ ) {
my $returnval = shift @_;
print STDERR 'usage: compiler.pl [ <option> ... ] [ <filename> ]
@@ -62,7 +63,7 @@ sub usage( $ ) {
[ --family={4|6} ]
';
exit shift @_;
exit $returnval;
}
#
@@ -108,7 +109,7 @@ my $result = GetOptions('h' => \$help,
usage(1) unless $result && @ARGV < 2;
usage(0) if $help;
compiler( script => $ARGV[0] || '',
compiler( script => defined $ARGV[0] ? $ARGV[0] : '',
directory => $shorewall_dir,
verbosity => $verbose,
timestamp => $timestamp,

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,597 +1,65 @@
Changes in Shorewall 4.4.13
Changes in 4.5.4
1) Allow zone lists in rules SOURCE and DEST.
1) Autodetect local bridges.
Changes in Shorewall 4.4.12
2) Add 'show macro' command.
1) Fix IPv6 shorecap program.
Changes in 4.5.3
2) Eradicate incorrect IPv6 Multicast Network
1) Fix logging NONAT rules.
3) Add ADD/DEL support.
2) Don't let fw-fw be optimized away.
4) Allow :random to work with REDIRECT
3) Don't optimize away non-empty rules chains.
5) Add per-ip log rate limiting.
4) Represent masks in hex.
6) Use new hashlimit match syntax if available.
5) Don't specify a mask in tcpri-generated rules.
7) Add Universal sample.
6) Add TPROXY support.
8) Add COMPLETE option.
Changes in 4.5.2
9) Make ICMP a synonym for IPV6-ICMP in ipv6 configs.
1) Extend OPTIMIZE & 4 to all tables.
10) Support new set match syntax.
2) Add OPTIMIZE_ACCOUNTING.
11) Blacklisting by DEST IP.
3) Add -p option to check.
12) Fix duplicate rule generation with 'any'.
Changes in 4.5.1
13) Fix port range editing problem.
1) Fix syntax error in /sbin/shorewall.
14) Display the .conf file directory in response to the status command.
2) Don't generate source type rule for ICMP/ICMPv6.
15) Correct AUTOMAKE
3) Add <device> argument to 'show tc'.
Changes in Shorewall 4.4.11
4) Fix 'save' when DYNAMIC_BLACKLIST=No
1) Apply patch from Gabriel.
5) Allow COMMENTs in tcpri.
2) Fix IPSET match detection when a pathname is specified for IPSET.
6) More ACCEPT optimization with OPTIMIZE & 2.
3) Fix start priority of shorewall-init on Debian
7) OPTIMIZE & 4.
4) Make IPv6 log and connections output readable.
8) Allow ipp2p in tcpri.
5) Add REQUIRE_INTERFACE to shorewall*.conf
Changes in 4.5.0
6) Avoid run-time warnings when options are not listed in
shorewall.conf.
1) Allow control over how the Mark is used.
7) Implement Vserver zones.
2) Generate warning on <macro>/<param>.
8) Make find_hosts_by_option() work correctly where ALL_IP appears in
hosts file.
3) Add a new optimization option.
9) Add CLEAR_FORWARD_MARK option.
4) Combine identical logging chains.
10) Avoid missing closing quote when REQUIRE_INTERFACE=Yes.
5) Added ACCOUNTING and DYNAMIC_BLACKLIST options.
11) Add PERL option.
6) Don't unconditionally pass traffic from routemarked interfaces
through the tcpre chain.
12) Fix nets= in Shorewall6
Changes in Shorewall 4.4.10
1) Fix regression with scripts.
2) Log startup errors.
3) Implement Shorewall-init.
4) Add SAFESTOP option to /etc/default/shorewall*
5) Restore -a functionality to the version command.
6) Correct Optimization issue
7) Rename PREFIX to DESTDIR in install scripts
8) Correct handling of optional/required interfaces with wildcard names.
Changes in Shorewall 4.4.9
1) Auto-detection of bridges.
2) Correct handling of a logical interface name in the EXTERNAL column
of proxyarp.
3) More robust 'trace'.
4) Added IPv6 mDNS macro.
5) Fix find_first_interface_address() error reporting.
6) Fix propagation of zero-valued config variables.
7) Fix OPTIMIZE 4 bug.
8) Deallocate unused rules.
9) Keep rule arrays compressed during optimization.
10) Remove remaining fallback scripts.
11) Rationalize startup logs.
12) Optimize 8.
13) Don't create output chains for BPORT zones.
14) Implement 'show log ip-addr' in /sbin/shorewall and
/sbin/shorewall-lite/
15) Restore lone ACCEPT rule to the OUTPUT chain under OPTIMIZE 2.
16) Change chain policy on OUTPUT chain with lone ACCEPT rule.
17) Set IP before sourcing the params file.
18) Fix rare optimization bug.
19) Allow definition of an addressless bridge without a zone.
20) In the routestopped file, assume 'routeback' if the interface has
'routeback'.
21) Make Shorewall and Shorewall6 installable on OS X.
Changes in Shorewall 4.4.8
1) Correct handling of RATE LIMIT on NAT rules.
2) Don't create a logging chain for rules with '-j RETURN'.
3) Avoid duplicate SFQ class numbers.
4) Fix low per-IP rate limits.
5) Fix Debian init script exit status
6) Fix NFQUEUE(queue-num) in policy
7) Implement -s option in install.sh
8) Add HKP Macro
9) Fix multiple policy matches with OPTIMIZE 4 and not KLUDGEFREE
10) Eliminate up-cased variable names that aren't documented options.
11) Don't show 'OLD' capabilities if they are not available.
12) Attempt to flag use of '-' as a port-range separator.
13) Add undocumented OPTIMIZE=-1 setting.
14) Replace OPTIMIZE=-1 with undocumented optimize 4096 which DISABLES
default optimizations.
15) Add support for UDPLITE
16) Distinguish between 'Started' and 'Restored' in ${VARDIR}/state
17) Issue warnings when 'blacklist' but no blacklist file entries.
18) Don't optimize 'blacklst'.
Changes in Shorewall 4.4.7
1) Backport optimization changes from 4.5.
2) Backport two new options from 4.5.
3) Backport TPROXY from 4.5
4) Add TC_PRIOMAP to shorewall*.conf
5) Implement LOAD_HELPERS_ONLY
6) Avoid excessive module loading with LOAD_HELPERS_ONLY=Yes
7) Fix case where MARK target is unavailable.
8) Change default to ADD_IP_ALIASES=No
9) Correct defects in generate_matrix().
10) Fix and optimize 'nosmurfs'.
11) Use 'OLD_HL_MATCH' to suppress use of 'flow' in Simple TC.
Changes in Shorewall 4.4.6
1) Fix for rp_filter and kernel 2.6.31.
2) Add a hack to work around a bug in Lenny + xtables-addons
3) Re-enable SAVE_IPSETS
4) Allow both <...> and [...] for IPv6 Addresses.
5) Port mark geometry change from 4.5.
6) Add Macro patch from Tuomo Soini
7) Add 'show macro' command.
8) Add -r option to check.
9) Port simplified TC from 4.5.
Changes in Shorewall 4.4.5
1) Fix 15-port limit removal change.
2) Fix handling of interfaces with the 'bridge' option.
3) Generate error for port number 0
4) Allow zone::serverport in rules DEST column.
5) Fix 'show policies' in Shorewall6.
6) Auto-load tc modules.
7) Allow LOGFILE=/dev/null
8) Fix shorewall6-lite/shorecap
9) Fix MODULE_SUFFIX.
10) Fix ENHANCED_REJECT detection for IPv4.
11) Fix DONT_LOAD vs 'reload -c'
12) Fix handling of SOURCE and DEST vs macros.
13) Remove silly logic in expand_rule().
14) Add current and limit to Conntrack Table Heading.
Changes in Shorewall 4.4.4
1) Change STARTUP_LOG and LOG_VERBOSITY in default shorewall6.conf.
2) Fix access to uninitialized variable.
3) Add logrotate scripts.
4) Allow long port lists in /etc/shorewall/routestopped.
5) Implement 'physical' interface option.
6) Implement ZONE2ZONE option.
7) Suppress duplicate COMMENT warnings.
8) Implement 'show policies' command.
9) Fix route_rule suppression for down provider.
10) Suppress redundant tests for provider availability in route rules
processing.
11) Implement the '-l' option to the 'show' command.
12) Fix class number assignment when WIDE_TC_MARKS=Yes
13) Allow wide marks in tcclasses when WIDE_TC_MARKS=Yes
Changes in Shorewall 4.4.3
1) Move Debian INITLOG initialization to /etc/default/shorewall
2) Fix 'routeback' in /etc/shorewall/routestopped.
3) Rename 'object' to 'script' in compiler and config modules.
4) Correct RETAIN_ALIASES=No.
5) Fix detection of IP config.
6) Fix nested zones.
7) Move all function declarations from prog.footer to prog.header
8) Remove superfluous variables from generated script
9) Make 'track' the default.
10) Add TRACK_PROVIDERS option.
11) Fix IPv6 address parsing bug.
12) Add hack to work around iproute IPv6 bug in route handling
13) Correct messages issued when an optional provider is not usable.
14) Fix optional interfaces.
15) Add 'limit' option to tcclasses.
Changes in Shorewall 4.4.2
1) BUGFIX: Correct detection of Persistent SNAT support
2) BUGFIX: Fix chain table initialization
3) BUGFIX: Validate routestopped file on 'check'
4) Let the Actions module add the builtin actions to
%Shorewall::Chains::targets. Much better modularization that way.
5) Some changes to make Lenny->Squeeze less painful.
6) Allow comments at the end of continued lines.
7) Call process_routestopped() during 'check' rather than
'compile_stop_firewall()'.
8) Don't look for an extension script for built-in actions.
9) Apply Jesse Shrieve's patch for SNAT range.
10) Add -<family> to 'ip route del default' command.
11) Add three new columns to macro body.
12) Change 'wait4ifup' so that it requires no PATH
13) Allow extension scripts for accounting chains.
14) Allow per-ip LIMIT to work on ancient iptables releases.
15) Add 'MARK' column to action body.
Changes in Shorewall 4.4.1
1) Deleted extra 'use ...IPAddrs.pm' from Nat.pm.
2) Deleted superfluous export from Chains.pm.
3) Added support for --persistent.
4) Don't do module initialization in an INIT block.
5) Minor performance improvements.
6) Add 'clean' target to Makefile.
7) Redefine 'full' for sub-classes.
8) Fix log level in rules at the end of INPUT and OUTPUT chains.
9) Fix nested ipsec zones.
10) Change one-interface sample to IP_FORWARDING=Off.
11) Allow multicast to non-dynamic zones defined with nets=.
12) Allow zones with nets= to be extended by /etc/shorewall/hosts
entries.
13) Don't allow nets= in a multi-zone interface definition.
14) Fix rule generated by MULTICAST=Yes
15) Fix silly hole in zones file parsing.
16) Tighen up zone membership checking.
17) Combine portlist-spitting routines into a single function.
Changes in Shorewall 4.4.0
1) Fix 'compile ... -' so that it no longer requires '-v-1'
2) Fix rule generation for logging nat rules with no exclusion.
3) Fix log record formatting.
4) Restore ipset binding
5) Fix 'upnpclient' with required interfaces.
6) Fix provider number in masq file.
Changes in Shorewall 4.4.0-RC2
1) Fix capabilities file with Shorewall6.
2) Allow Shorewall6 to recognize TC, IP and IPSET
3) Make 'any' a reserved zone name.
4) Correct handling of an ipsec zone nested in a non-ipsec zone.
Changes in Shorewall 4.4.0-RC1
1) Delete duplicate Git macro.
2) Fix routing when no providers.
3) Add 'any' as a SOURCE/DEST in rules.
4) Fix NONAT on child zone.
5) Fix rpm -U from earlier versions
6) Generate error on 'status' by non-root.
7) Get rid of prog.functions and prog.functions6
Changes in Shorewall 4.4.0-Beta4
1) Add more macros.
2) Correct broadcast address detection
3) Fix 'show dynamic'
4) Fix BGP and OSFP macros.
5) Change DISABLE_IPV6 default and use 'correct' ip6tables.
Changes in Shorewall 4.4.0-Beta3
1) Add new macros.
2) Work around mis-configured interfaces.
3) Fix 'show dynamic'.
4) Check for xt_LOG.
5) Fix 'findgw'
Changes in Shorewall 4.4.0-Beta2
1) The 'find_first_interface_address()' and
'find_first_interface_address_if_any()' functions have been restored to
lib.base.
2) Integerize r2q before inserting it into 'tc qdisc add root'
command.
3) Remove '-h' from the help text for install.sh in Shorewall and
Shorewall6.
4) Delete the 'continue' file from the Shorewall package.
5) Add 'upnpclient' interface option.
6) Fix handling of optional interfaces.
7) Add 'iptrace' and 'noiptrace' command.
8) Add 'USER/GROUP' column to masq file.
9) Added lib.private.
Changes in Shorewall 4.4.0-Beta1
1) Correct typo in Shorewall6 two-interface sample shorewall.conf.
2) Fix TOS mnemonic handling in /etc/shorewall/tcfilters.
Changes in Shorewall 4.3.12
1) Eliminate 'large quantum' warnings.
2) Add HFSC support.
3) Delete support for ipset binding. Jozsef has removed the capability
from ipset.
4) Add TOS and LENGTH columns to tcfilters file.
5) Fix 'reset' command.
6) Fix 'findgw'.
7) Remove 'norfc1918' support.
Changes in Shorewall 4.3.11
1) Reduce the number of arguments passed in may cases.
2) Fix SCTP source port handling in tcfilters.
3) Add 'findgw' user exit.
4) Add macro.Trcrt
Changes in Shorewall 4.3.10
1) Fix handling of shared optional providers.
2) Add WIDE_TC_MARKS option.
3) Allow compile to STDOUT.
4) Fix handling of class IDs.
5) Deprecate use of an interface in the SOURCE column of
/etc/shorewall/masq.
6) Fix handling of 'all' in the SOURCE of DNAT- rules.
7) Fix compile for export.
8) Optimize IPMARK.
9) Implement nested HTB classes.
10) Fix 'iprange' command.
11) Make traffic shaping work better with IPv6.
12) Externalize 'flow'.
13) Fix 'start' with AUTOMAKE=Yes
Changes in Shorewall 4.3.9
1) Logging rules now create separate chain.
2) Fix netmask genereation in tcfilters.
3) Allow Shorewall6 with kernel 2.6.24
4) Avoid 'Invalid BROADCAST address' errors.
5) Allow Shorewall6 on kernel 4.2.24:Shorewall/changelog.txt
6) Add IP, TC and IPSET options in shorewall.conf and shorewall6.conf.
7) Add IPMARK support
Changes in Shorewall 4.3.8
1) Apply Tuomo Soini's patch for USE_DEFAULT_RT.
2) Use 'startup_error' for those errors caught early.
3) Fix swping
4) Detect gateway via dhclient leases file.
5) Suppress leading whitespace on certain continuation lines.
6) Use iptables[6]-restore to stop the firewall.
7) Add AUTOMAKE option
8) Remove SAME support.
9) Allow 'compile' without a pathname.
10) Fix LOG_MARTIANS=Yes.
11) Adapt I. Buijs's hashlimit patch.
Changes in Shorewall 4.3.7
1) Fix forward treatment of interface options.
2) Replace $VARDIR/.restore with $VARDIR/firewall
3) Fix DNAT- parsing of DEST column.
4) Implement dynamic zones
5) Allow 'HOST' options on bridge ports.
6) Deprecate old macro parameter syntax.
Changes in Shorewall 4.3.6
1) Add SAME tcrules target.
2) Make 'dump' display the raw table. Fix shorewall6 dump anomalies.
3) Fix split_list1()
4) Fix Shorewall6 file location bugs.
Changes in Shorewall 4.3.5
1) Remove support for shorewall-shell.
2) Combine shorewall-common and shorewall-perl to produce shorewall.
3) Add nets= OPTION in interfaces file.
7) Automatically assign mark values.
8) Simplified Traffic Shaping

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,19 @@
###############################################################################
# /etc/shorewall/shorewall.conf Version 4 - Change the following variables to
# match your setup
#
# Shorewall Version 4 -- /etc/shorewall/shorewall.conf
# This program is under GPL
# [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# This file should be placed in /etc/shorewall
#
# (c) 1999,2000,2001,2002,2003,2004,2005,
# 2006,2007,2008 - Tom Eastep (teastep@shorewall.net)
#
# For information about the settings in this file, type "man shorewall.conf"
#
# Manpage also online at http://www.shorewall.net/manpages/shorewall.conf.html
# Additional information is available at
# http://www.shorewall.net/Documentation.htm#Conf
###############################################################################
# S T A R T U P E N A B L E D
###############################################################################
@@ -31,7 +40,9 @@ LOGFORMAT="Shorewall:%s:%s:"
LOGTAGONLY=No
LOGLIMIT=
LOGRATE=
LOGBURST=
LOGALLNEW=
@@ -57,8 +68,6 @@ TC=
IPSET=
PERL=/usr/bin/perl
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
SHOREWALL_SHELL=/bin/sh
@@ -98,7 +107,7 @@ RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
IP_FORWARDING=On
ADD_IP_ALIASES=No
ADD_IP_ALIASES=Yes
ADD_SNAT_ALIASES=No
@@ -188,17 +197,20 @@ ZONE2ZONE=2
ACCOUNTING=Yes
DYNAMIC_BLACKLIST=Yes
OPTIMIZE_ACCOUNTING=No
LOAD_HELPERS_ONLY=No
DYNAMIC_BLACKLIST=Yes
REQUIRE_INTERFACE=No
###############################################################################
# MARK Layout
###############################################################################
TC_BITS=
FORWARD_CLEAR_MARK=Yes
MASK_BITS=
COMPLETE=No
PROVIDER_BITS=
PROVIDER_OFFSET=
###############################################################################
# P A C K E T D I S P O S I T I O N

View File

@@ -7,5 +7,5 @@
# information.
#
###############################################################################
#INTERFACE TYPE IN-BANDWIDTH
#INTERFACE TYPE IN-BANDWIDTH

View File

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

View File

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

View File

@@ -1,8 +1,8 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: shorewall
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Required-Start: $network
# Required-Stop: $network
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Configure the firewall at boot time
@@ -20,7 +20,7 @@ test -n ${INITLOG:=/var/log/shorewall-init.log}
test -x $SRWL || exit 0
test -x $WAIT_FOR_IFUP || exit 0
test -n "$INITLOG" || {
echo "INITLOG cannot be empty, please configure $0" ;
echo "INITLOG cannot be empty, please configure $0" ;
exit 1;
}
@@ -32,13 +32,12 @@ fi
echo_notdone () {
if [ "$INITLOG" = "/dev/null" ] ; then
if [ "$INITLOG" = "/dev/null" ] ; then
echo "not done."
else
else
echo "not done (check $INITLOG)."
fi
exit 1
}
not_configured () {
@@ -71,7 +70,7 @@ fi
export SHOREWALL_INIT_SCRIPT
# wait for an unconfigured interface
# wait for an unconfigured interface
wait_for_pppd () {
if [ "$wait_interface" != "" ]
then
@@ -93,11 +92,7 @@ shorewall_start () {
# stop the firewall
shorewall_stop () {
echo -n "Stopping \"Shorewall firewall\": "
if [ "$SAFESTOP" = 1 ]; then
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
else
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
fi
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
return 0
}
@@ -124,7 +119,7 @@ case "$1" in
;;
refresh)
shorewall_refresh
;;
;;
force-reload|restart)
shorewall_restart
;;

View File

@@ -45,7 +45,7 @@ status() {
export SHOREWALL_INIT_SCRIPT=1
case $1 in
case $1 in
'start')
start
;;

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
There are no known problems in Shorewall 4.4.13-Beta1
There are no known problems in Shorewall 4.5.4

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -33,7 +33,7 @@
#
interface_is_up() {
[ -n "$(/sbin/ip link list dev $1 2> /dev/null | /bin/grep -e '[<,]UP[,>]')" ]
[ -n "$(/sbin/ip link list dev $1 2> /dev/null | /bin/grep -e '[<,]UP[,>]')" ]
}
case $# in
@@ -57,4 +57,4 @@ done
exit 1

View File

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

View File

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

104
Shorewall6-lite/fallback.sh Executable file
View File

@@ -0,0 +1,104 @@
#!/bin/sh
#
# Script to back out the installation of Shorewall Lite and to restore the previous version of
# the program
#
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
#
# Shorewall documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Usage:
#
# You may only use this script to back out the installation of the version
# shown below. Simply run this script to revert to your prior version of
# Shoreline Firewall.
VERSION=4.5.4
usage() # $1 = exit status
{
echo "usage: $(basename $0)"
exit $1
}
restore_directory() # $1 = directory to restore
{
if [ -d ${1}-${VERSION}.bkout ]; then
if mv -f $1 ${1}-${VERSION} && mv ${1}-${VERSION}.bkout $1; then
echo
echo "$1 restored"
rm -rf ${1}-${VERSION}
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
restore_file() # $1 = file to restore, $2 = (Optional) Directory to restore from
{
if [ -n "$2" ]; then
local file
file=$(basename $1)
if [ -f $2/$file ]; then
if mv -f $2/$file $1 ; then
echo
echo "$1 restored"
return
fi
echo "ERROR: Could not restore $1"
exit 1
fi
fi
if [ -f ${1}-${VERSION}.bkout -o -L ${1}-${VERSION}.bkout ]; then
if (mv -f ${1}-${VERSION}.bkout $1); then
echo
echo "$1 restored"
else
echo "ERROR: Could not restore $1"
exit 1
fi
fi
}
if [ ! -f /usr/share/shorewall-lite-${VERSION}.bkout/version ]; then
echo "Shorewall Version $VERSION is not installed"
exit 1
fi
echo "Backing Out Installation of Shorewall $VERSION"
if [ -L /usr/share/shorewall-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
restore_file $FIREWALL /usr/share/shorewall-lite-${VERSION}.bkout
else
restore_file /etc/init.d/shorewall /usr/share/shorewall-lite-${VERSION}.bkout
fi
restore_file /sbin/shorewall /var/lib/shorewall-lite-${VERSION}.bkout
restore_directory /etc/shorewall-lite
restore_directory /usr/share/shorewall-lite
restore_directory /var/lib/shorewall-lite
echo "Shorewall Lite Restored to Version $(cat /usr/share/shorewall-lite/version)"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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