Compare commits

..

309 Commits

Author SHA1 Message Date
Tom Eastep
3ce04a8ef3 Add "zone name too long" error
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-12 12:57:31 -07:00
Tom Eastep
737aca6a3d Add target file(s) 5.2.5-RC1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-10 10:36:03 -07:00
Tom Eastep
d89d35a9f0 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2020-06-08 09:48:31 -07:00
Tom Eastep
220e89755e Omit STATE-orientated rules in wildcard policy chains
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-07 20:57:55 -07:00
Tom Eastep
1d875b2909 Minor edit to the blacklisting doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-07 18:12:01 -07:00
Tom Eastep
011638ad7d Document use of address variables in the snat file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-07 18:11:26 -07:00
Tom Eastep
3f5c47695e Expand fail2ban documenation in the blacklisting article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-07 12:37:45 -07:00
Tom Eastep
fb14b0aafc Update targetname files for 5.2.5-Beta2
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-06 12:54:01 -07:00
Tom Eastep
54ab7cdeb5 Update blacklisting documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-06 12:23:32 -07:00
Tom Eastep
aa47554604 Add 'noupdate' DYNAMIC_BLACKLIST option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-06 10:14:32 -07:00
Tom Eastep
07160c5ed1 Add 'blacklist!' command.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-06 10:13:46 -07:00
Tom Eastep
527533ecb6 Add 'log' option to DYNAMIC_BLACKLIST
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-03 14:28:08 -07:00
Tom Eastep
4ac64a545c Change log facility to 'daemon'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-03 13:49:10 -07:00
Tom Eastep
6612ea6b8c Store the exported configuration paramaters in a named array
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-03 11:50:27 -07:00
Tom Eastep
2646ec79a5 Read the params file when processing an 'allow' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-03 11:39:42 -07:00
Tom Eastep
023437a0e0 Add target files 5.2.5-Beta1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-01 10:07:23 -07:00
Tom Eastep
ffb6ac178e Shorten the disposition in ADD/DEL log messages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-06-01 09:36:00 -07:00
Tom Eastep
726d7cde65 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2020-05-31 17:39:38 -07:00
Tom Eastep
c061d87919 Fix links in shorewall(8)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-31 17:39:13 -07:00
Tom Eastep
5af7dce96b Merge branch 'master' of ssh://gitlab.com/shorewall/code 2020-05-31 14:03:23 -07:00
Tom Eastep
eb5bc3d8a4 Create DBL ipset with 'timeout 0'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-31 12:37:42 -07:00
Tom Eastep
b34474df11 Remove the -f option from the documentation of the 'stop' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-30 20:10:07 -07:00
Tom Eastep
16a3384a70 Add an example of using 'blacklist ... timeout nnn'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-30 19:57:37 -07:00
Tom Eastep
67b421dc00 Correct a comment in the optimize level 8 code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-21 11:37:04 -07:00
Matt Darfeuille
c518887a19 Reflect changes in tools repository
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-21 10:40:14 -07:00
Tom Eastep
5493a7e4a6 Merge branch '5.2.4' 2020-05-17 13:20:46 -07:00
Tom Eastep
1093f1ac32 Add target files 5.2.4.5
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-14 09:43:10 -07:00
Tom Eastep
7882c87afe Allow AUTOMAKE to work with symbolic links
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-14 09:22:44 -07:00
Tom Eastep
7343b19abc Clarify the 'optional' interface option.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-05-13 12:30:12 -07:00
Tom Eastep
f27ab4704c Merge branch '5.2.4' 2020-04-30 11:18:18 -07:00
Tom Eastep
e5e8e6fbc0 Correct logic for deleting ipsets
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-29 13:07:04 -07:00
Tom Eastep
c11b647b1b Fix defect which prevented dynamic blacklist ipsets from being created
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-29 12:34:41 -07:00
Tom Eastep
5706c5a860 Avoid hang during 'shorewall[6] start'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-29 12:33:50 -07:00
Tom Eastep
fd1d4a3f35 Update Shared Config Doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-25 14:48:45 -07:00
Tom Eastep
2bf9048057 Another Debian if_pre-down fix.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-24 16:47:42 -07:00
Tom Eastep
d618fd5812 Remove extraneous whitespace
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-23 20:31:07 -07:00
Tom Eastep
177cdb1b98 Move a block of code to keep function declarations adjacent
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-23 18:37:47 -07:00
Tom Eastep
dddde56454 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code
# Conflicts:
#	Shorewall-init/install.sh
#	Shorewall/Perl/Shorewall/Providers.pm

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-23 18:35:11 -07:00
Tom Eastep
9b196e87e9 Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code
# Conflicts:
#	Shorewall-init/shorewall-init

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-23 18:27:54 -07:00
Tom Eastep
c30a4fd080 Merge branch '5.2.4' of ssh://server.shorewall.net/home/teastep/shorewall/code into 5.2.4
# Conflicts:
#	Shorewall/Perl/Shorewall/Chains.pm

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-22 16:27:03 -07:00
Tom Eastep
0a9d2d9a33 Don't install script in if_down.d on Debian
- Eliminates need for Debian-specific code in generated script

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-22 13:47:09 -07:00
Tom Eastep
39de88563f Cleanup of Optimize 16 change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-21 13:02:56 -07:00
Tom Eastep
e14798b4a2 Make OPTIMIZE=16 an order of magnitude faster
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-21 13:02:34 -07:00
Tom Eastep
3042ae815e Make OPTIMIZE=16 an order of magnitude faster
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-20 15:00:33 -07:00
Tom Eastep
86ebb22dd3 Cosmetic changes to shorewall-init
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-20 10:29:36 -07:00
Tom Eastep
18360471ab Have Shorewall-init restore ipsets before stopping the firewalls
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-20 09:23:34 -07:00
Tom Eastep
086f7a0e6d Only destroy ipsets that will be restored
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-20 09:11:03 -07:00
Tom Eastep
057a2dec70 Correct typo with bad consequences
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-19 18:44:19 -07:00
Tom Eastep
16af9ee2de Revert "Don't install ifupdown script in if-down.d on Debian"
This reverts commit 7d4d409799.
2020-04-19 15:19:13 -07:00
Tom Eastep
cabadd4846 Honor 'wait=<seconds> when enabling an interface.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-19 14:31:12 -07:00
Tom Eastep
3c06be28be Delete unnecessary check if IPv6 interface_is_usable()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-19 12:28:16 -07:00
Tom Eastep
7d4d409799 Don't install ifupdown script in if-down.d on Debian
- Proper location for the script is if-post-down

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-19 12:18:44 -07:00
Tom Eastep
32ca53706c Don't run the 'up' command twice when an dual-stack interface comes up
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-18 12:44:19 -07:00
Tom Eastep
0adb9c8f87 Don't run the 'up' command twice when an dual-stack interface comes up
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-18 12:43:27 -07:00
Tom Eastep
381d55760b Don't install ifupdown script in /etc/network/if-down.d on Debian
- Network Manager sets PHASE=post-down when calling our updown script
  so we must process down commands in that phase.

- Modify the generated script to eliminate PHASE checks.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-18 11:42:32 -07:00
Tom Eastep
88a799b860 Allow IFUPDOWN=1 to work on Debian
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-18 11:27:15 -07:00
Tom Eastep
5101a6be4a Merge branch 'master' of ssh://server.shorewall.net/home/teastep/shorewall/code 2020-04-18 09:36:20 -07:00
Tom Eastep
15ca726c49 Add target files 5.2.4.1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-17 17:56:06 -07:00
Tom Eastep
27510d9ed6 Add a comment to clarify where info comes from
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-16 15:20:24 -07:00
Tom Eastep
f832846a8d Remove extraneous white space
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-16 14:05:07 -07:00
Tuomo Soini
64bf5882db ifupdown: only handle up and down state changes
Signed-off-by: Tuomo Soini <tis@foobar.fi>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-16 14:02:15 -07:00
Tuomo Soini
6841fc9eb2 Ignore 'start' and 'stop' if firewall product is active
Signed-off-by: Tuomo Soini <tis@foobar.fi>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-16 13:32:19 -07:00
Tom Eastep
caa0290cb2 Revert "Ignore 'start' and 'stop' if firewall(s) is started"
This reverts commit b6f5b6ba98.
2020-04-16 13:32:03 -07:00
Tom Eastep
4e1262ec7e Revert "Upcase a variable to follow pattern in this file"
This reverts commit 1be78f8f15.
2020-04-16 13:31:48 -07:00
Tom Eastep
53b05aa5fb Revert "Fix omitted instance of product -> PRODUCT"
This reverts commit 072053995c.
2020-04-16 13:31:39 -07:00
Tom Eastep
072053995c Fix omitted instance of product -> PRODUCT
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-15 14:27:28 -07:00
Tom Eastep
1be78f8f15 Upcase a variable to follow pattern in this file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-15 14:18:28 -07:00
Tom Eastep
b6f5b6ba98 Ignore 'start' and 'stop' if firewall(s) is started
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-15 14:15:17 -07:00
Tom Eastep
3c36d638a5 Use the correct error code when Shoerwall-init is not configured
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-15 09:17:51 -07:00
Tom Eastep
9d3da44dad Ignore 'start' and 'stop' if firewall(s) is started
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-15 09:13:31 -07:00
Tom Eastep
a5d4cbd76c Add cautions to the ipsets article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-14 15:23:33 -07:00
Tom Eastep
4e83d0788e Rename valuesort() to sortchainsiftest() and remove keysort()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-11 13:42:41 -07:00
Tom Eastep
a49a9f9f9d Sort specific hash keys and values if -t
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-07 11:12:16 -07:00
Tom Eastep
6dc99e77ae Revert "Sort specific hash keys and values if -e"
This reverts commit 5e648a9379.
2020-04-07 11:09:27 -07:00
Tom Eastep
92b25d88b0 Revert "Add conditional sorts to find[_zone]_hosts_by_option()"
This reverts commit 42a505c99d.
2020-04-07 11:08:46 -07:00
Tom Eastep
42a505c99d Add conditional sorts to find[_zone]_hosts_by_option()
- Another case of different behavior by different Perl versions

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-06 13:48:45 -07:00
Tom Eastep
5e648a9379 Sort specific hash keys and values if -e
- Makes testing output consistent across Perl versions

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-06 10:57:35 -07:00
Tom Eastep
ed2fa863c3 Correct Ids in new FAQs.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-03 12:46:28 -07:00
Tom Eastep
386dff4c33 Add FAQs regarding AUTOMAKE=Yes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-03 12:42:37 -07:00
Tom Eastep
e49f31fb42 Don't compute sha1 hash when testing
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-04-02 10:11:21 -07:00
Tom Eastep
3f0e4959a1 Revert "When exporting or testing, set all variables defined in the params file"
This reverts commit f9003fab43.
2020-04-01 12:55:41 -07:00
Tom Eastep
112c4dc38a Revert "Temporarily disable fix for exported variables"
This reverts commit 137cc48779.
2020-04-01 12:55:14 -07:00
Tom Eastep
137cc48779 Temporarily disable fix for exported variables
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-31 16:43:30 -07:00
Tom Eastep
f9003fab43 When exporting or testing, set all variables defined in the params file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-31 15:55:09 -07:00
Tom Eastep
78da975989 Fix a couple of issues with product name
- Use $Product rather that addressfamily-dependent logic
- Revert unneeded change from 5.2.3.7

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-28 14:24:32 -07:00
Tuomo Soini
be924ff765 Fix http links to point to current project website
Also removes deprecated Shorewall6/configfiles/masq

Signed-off-by: Tuomo Soini <tis@foobar.fi>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-27 14:24:37 -07:00
Tom Eastep
6f484da821 Add target files 5.2.4-base
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-24 10:05:34 -07:00
Tom Eastep
82d2863b29 Update ipsets document
- Clarify use of ipsets in stoppedrules.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-21 14:37:59 -07:00
Tom Eastep
e855d03332 Update Target Files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-16 11:34:35 -07:00
Tom Eastep
09712254e8 Delete duplicate html.css from code repository
- requires tools commit 77a1b359e674cd53ea2af164fed99baa69075ed8

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-15 11:04:20 -07:00
Tom Eastep
de39f7d3aa Revert "Add another targetname file"
This reverts commit 3e2d7cf990.
2020-03-15 09:02:46 -07:00
Tom Eastep
54a70e4632 Merge branch '5.2.4' 2020-03-10 14:18:52 -07:00
Tom Eastep
c80462c283 Update Config File Basics document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-10 14:18:26 -07:00
Tom Eastep
a2e56492df Correct mangle file contents in QOSExample.html
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-10 14:17:15 -07:00
Tom Eastep
3222a380c3 Update the Starting and Stopping document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-10 12:23:00 -07:00
Tom Eastep
e82307f61e Add empty target files 5.2.4-Beta1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-10 11:03:02 -07:00
Tom Eastep
ae4f86a1e5 Merge branch '5.2.3' 2020-03-09 11:46:45 -07:00
Tom Eastep
c33a72594c Correct mangle file contents in QOSExample.html
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-09 11:44:33 -07:00
Tom Eastep
8496bf0ff3 Update Compiled Programs/Shorewall-lite article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-08 13:22:25 -07:00
Tom Eastep
a6c1cd6d7b Expand manpage text about trace/debug -> -T/-D change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-08 13:22:05 -07:00
Tom Eastep
2604378646 Add 'help' to the generated script's help text
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-08 13:20:27 -07:00
Tom Eastep
d24179173f Remove obsolete 'load' command from help text
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-08 13:19:46 -07:00
Tom Eastep
803853c719 Revert "Add DOCKER_BRIDGE option"
This reverts commit ca59556d44.
2020-03-08 10:47:16 -07:00
Matt Darfeuille
57f1f8658f Add empty target files 5.2.3.7
Signed-off-by: Matt Darfeuille <matt@shorewall.org>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-08 10:29:31 -07:00
Matt Darfeuille
0a34e4e685 Revert "Add empty target files 5.2.3.7"
This reverts commit 95d3486788.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-08 10:29:10 -07:00
Tom Eastep
b52a330f41 Replace trace, debug and nolock with options
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-07 17:48:10 -08:00
Tom Eastep
de761ac657 Clarify 'trace' and the compiled script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-07 13:13:43 -08:00
Tom Eastep
d3de75dd12 Add DOCKER_BRIDGE option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-07 11:34:23 -08:00
Tom Eastep
ca59556d44 Add DOCKER_BRIDGE option
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-07 11:03:35 -08:00
Tom Eastep
639dc86e1b Merge branch 'master' into 5.2.4
# Conflicts:
#	Shorewall/Perl/Shorewall/Config.pm

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-06 13:07:00 -08:00
Tom Eastep
fa1aa4b481 Merge branch '5.2.3'
# Conflicts:
#	docs/Introduction.xml
2020-03-06 13:04:18 -08:00
Tom Eastep
3e2d7cf990 Add another targetname file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-06 09:37:41 -08:00
Tom Eastep
95d3486788 Add empty target files 5.2.3.7
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-06 09:19:25 -08:00
Matt Darfeuille
657673927c Accommodate for tracking empty target files
Signed-off-by: Matt Darfeuille <matt@shorewall.org>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-06 08:27:18 -08:00
Tom Eastep
a345be20fb Add Cliff Armstrong's workaround to the Docker document
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-05 15:32:03 -08:00
Tom Eastep
9f3534dc1f Correct Docker-related typos in Compiler.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-04 14:55:52 -08:00
Tom Eastep
f63f0bb2f1 Correct DOCKER code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-03 14:38:36 -08:00
Tom Eastep
646f01a3a4 Eliminate spurious 'Resetting...' message from the compiler
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-02 11:05:21 -08:00
Tom Eastep
65e101f306 Refine handling of MANGLE_ENABLED=No
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-02 08:21:34 -08:00
Tom Eastep
000f120c61 Improve checking when MANGLE_ENABLED=No in shorewall[6].conf
- Fatal error when a feature is used that requires the mangle table

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-01 15:38:28 -08:00
Tom Eastep
f221ca290f Improve checking when MANGLE_ENABLED=No in shorewall[6].conf
- Fatal error when a feature is used that requires the mangle table

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-01 15:07:17 -08:00
Tom Eastep
8b99f8caac Merge branch 'master' into 5.2.4
# Conflicts:
#	docs/SharedConfig.xml

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-01 13:50:05 -08:00
Tom Eastep
8b2c79e5ce Merge branch '5.2.3' into 5.2.4
# Conflicts:
#	docs/Introduction.xml

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-03-01 13:48:45 -08:00
Tom Eastep
dcde2bfa4a Correct logic that decides if a reload is necessary during enable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-26 15:22:17 -08:00
Tom Eastep
1ec81b7d7b Add correct html.css file to code/docs/
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-26 11:39:58 -08:00
Tom Eastep
387b861759 Correct handling of ORIGDEST with OLD_CONNTRACK_MATCH
- Also correct detection of OLD_CONNTRACK_MATCH in shorewall6

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-25 13:08:58 -08:00
Tom Eastep
f4e6d2fa56 Merge branch '5.2.3' of ssh://gitlab.com/shorewall/code into 5.2.3
# Conflicts:
#	Shorewall/Perl/Shorewall/Chains.pm
#	Shorewall/Perl/Shorewall/Compiler.pm
2020-02-24 15:40:07 -08:00
Tom Eastep
6798c2f2b0 Accomodate both DOCKER-ISOLATION and DOCKER-ISOLATION-STAGE-*
Previously, the code assumed that either DOCKER-ISOLATION or
DOCKER-ISOLATION-STAGE-* would exist but not both. That has been corrected
2020-02-24 15:35:50 -08:00
Tom Eastep
caa7475483 Accomodate both DOCKER-ISOLATION and DOCKER-ISOLATION-STAGE-*
Previously, the code assumed that either DOCKER-ISOLATION or
DOCKER-ISOLATION-STAGE-* would exist but not both. That has been corrected
2020-02-22 11:31:19 -08:00
Tom Eastep
3f5e1b5b60 Update interface file example in the Introduction article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-22 11:26:19 -08:00
Tom Eastep
e8f49bc9c7 Merge branch '5.2.3' 2020-02-18 11:11:53 -08:00
Tom Eastep
5021154867 Delete incorrect .css file from the code repository
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-18 11:10:28 -08:00
Tom Eastep
f831d9a988 Correct mal-formed entries in Build.xml
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-16 11:02:37 -08:00
Tom Eastep
31b558b7f9 Filter out LIBVIRT rules when saving Docker Rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-16 10:36:16 -08:00
Tom Eastep
367a5f7d97 Filter out LIBVIRT rules when saving Docker Rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-16 10:33:18 -08:00
Tom Eastep
4efac2fda1 Handle essential IPv6-ICMP types when firewall is stopped
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-06 15:21:51 -08:00
Tom Eastep
5f50b70618 Merge branch '5.2.3' into 5.2.4
# Conflicts:
#	docs/SharedConfig.xml

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-06 14:08:33 -08:00
Tom Eastep
b437f609e5 Merge branch '5.2.3' 2020-02-01 11:01:59 -08:00
Matt Darfeuille
b897fe2b9d Update build article
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-01 11:01:06 -08:00
Matt Darfeuille
802ff1da4e Harmonize permissions
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-01 11:00:41 -08:00
Tom Eastep
f05bd969af Revert "Add targetname files"
This reverts commit c9eb443574.
2020-02-01 09:46:05 -08:00
Tom Eastep
7aaa04149e Merge branch '5.2.3'
# Conflicts:
#	Shorewall/manpages/shorewall-files.xml
#	docs/SharedConfig.xml
2020-02-01 09:45:33 -08:00
Matt Darfeuille
093e55083c Ignore empty target files
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-02-01 09:42:07 -08:00
Tom Eastep
c9eb443574 Add targetname files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2020-01-29 10:41:55 -08:00
Tom Eastep
0aabb81c03 Merge branch '5.2.4' 2020-01-09 09:22:31 -08:00
Tom Eastep
c763525e78 Update Install.xml to point to new location of the GPG key
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-12-31 13:13:51 -08:00
Tom Eastep
533e2472da Update Install.xml to point to new location of the GPG key
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-12-31 13:12:23 -08:00
Tom Eastep
08da235896 Correct IPv6 Address Range parsing
Previously, such ranges were required to be of the form [<addr1>-<addr2>]
rather than the more standard form [<addr1>]-[<addr2>]. In the snat file
(and in nat actions), the latter form was actually flagged as an error
while in other contexts, it resulted in a less obvious error being raised.

With this change, both forms are accepted.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-12-23 10:02:48 -08:00
Tom Eastep
77cad81ba7 Clean up comments
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-12-23 09:59:29 -08:00
Tom Eastep
9213d7e707 Clean up Shorewall6[-lite] manpage links
- there were many links pointing to /manpages6/shorewall6... that should
  have been updated to point to /manpages/shorewall...

- this commit corrects those links

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-11-27 15:46:57 -08:00
Tom Eastep
157abcbd37 Allow NFQUEUE 'bypass' in the policy file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-10-21 14:41:02 -07:00
Tom Eastep
6da498510c Correct mss specification when using ipcomp
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-10-16 11:45:08 -07:00
Tom Eastep
2b7a37e42a Minor cleanup of the Chains module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-10-16 11:44:02 -07:00
Tom Eastep
84a220a651 Correct mss specification when using ipcomp
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-10-16 11:41:21 -07:00
Tom Eastep
51b9589c48 Merge branch 'more-bitcoin-ports' of ssh://teastep@git.code.sf.net/u/talkless/shorewall 2019-09-10 08:10:53 -07:00
Vincas Dargis
762df5e18c Add macros for Bitcoin's Testnet and Regtest
Add additional macros for Bitcoin daemon running in Testnet and Regtest
modes.
2019-09-07 16:36:42 +03:00
Tom Eastep
cb56991fee Merge branch '5.2.3' 2019-09-03 07:45:57 -07:00
Tom Eastep
54c7e1a607 Correct typo in FTP.xml
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-09-03 07:42:06 -07:00
Tom Eastep
c4d5bb904b Correct description of 'bypass' in shorewall-rules(5).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-08-26 15:45:26 -07:00
Tom Eastep
40f6192e19 Make 'AUTOMAKE=No' the update default
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-08-25 14:20:54 -07:00
Tom Eastep
7051daeb08 Correct handle of multi-queue NFQUEUE when passed to a macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-08-25 14:18:54 -07:00
Tom Eastep
a9c42e1eaa Correct NFQUEUE policy with per-CPU queues
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-08-25 14:18:06 -07:00
Tom Eastep
8df70406df Update the Shorewall Lite documentation to use 'remote-' commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-04-28 10:49:52 -07:00
Tom Eastep
8b0cfdf779 Clarify SWITCH settings and reload
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-04-25 14:26:18 -07:00
Tom Eastep
c127cec76c Merge branch '5.2.3' 2019-04-14 14:35:09 -07:00
Tom Eastep
6b21135ade Correct handling of an ipset in the SPORT column
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-04-11 18:37:27 -07:00
Tom Eastep
2f66381a4a Allow multiple protocols to be specified for a helper
- the protocol list is specified in the %helpers hash as an array reference
  e.g., "[UDP,TCP]". Note that those are protocol *numbers*, not names.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-04-01 15:14:34 -07:00
Tom Eastep
aa97b1b283 Clean up the Introduction article
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-04-01 15:10:27 -07:00
Matt Darfeuille
53495ec0a8 Point exclusively to shorewall.org
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-03-25 11:35:00 -07:00
Tom Eastep
2f3f6ffa15 Revert "Make $update global in Config.pm"
This reverts commit b9d0821acb.
2019-03-17 08:02:53 -07:00
Tom Eastep
60f2f3b0d0 Allow variable expansion when processing shorewallrc.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-03-14 20:38:10 -07:00
Tom Eastep
e626b77097 Correct policy zone exclusion handling
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-21 09:31:13 -08:00
Tom Eastep
15dd14e167 Correct link to Roberto's repository
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-08 10:47:43 -08:00
Tom Eastep
83b586c192 More document changes
- Include Linuxfest presentation titles

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-08 10:45:09 -08:00
Matt Darfeuille
d3fcb29f0d Use proper function name for warning messages
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-07 10:44:46 -08:00
Tom Eastep
a4ed419aba Add new manpages to Manpages web page
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-07 10:42:23 -08:00
Tom Eastep
e548043e96 Remove modules files
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-06 14:17:10 -08:00
Tom Eastep
443a4223c2 Remove pre-2.6.20 helpers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-06 14:11:48 -08:00
Tom Eastep
8f42a6a72b Remove LOAD_HELPERS_ONLY
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-03 10:04:19 -08:00
Tom Eastep
0982fec513 Remove superfluous whitespace from Providers.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-02-01 12:44:44 -08:00
Tom Eastep
f5262dd050 Correct typo in shorewall-providers(5)
- RESTORE_DEFAULT_OPTION -> RESTORE_DEFAULT_GATEWAY
2019-02-01 12:44:00 -08:00
Tom Eastep
8dcfd86f3a Document compiler globals
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-24 08:26:27 -08:00
Tom Eastep
edc9e25f25 Deprecate 'all[+]-'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-23 12:35:07 -08:00
Tom Eastep
ef11ae834d Drop documentation for all-
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-22 15:53:33 -08:00
Tom Eastep
9f423412d8 Allow zone exclusion in the policy file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-22 12:35:23 -08:00
Tom Eastep
7f7fef3a4e Disallow 'all' in a policy zone list
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-21 10:00:36 -08:00
Tom Eastep
b9d0821acb Make $update global in Config.pm
- Only save raw image if we are updating

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-20 11:06:40 -08:00
Tom Eastep
857539c8b1 Update lib.runtime copyright
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-16 13:09:42 -08:00
Tom Eastep
429070d107 Update Chains.pm and Compiler.pm copyrights
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-16 12:28:27 -08:00
Tom Eastep
89725c530f Change limit of 'wait' option setting to 300 seconds (5 minutes)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-16 11:50:33 -08:00
Tom Eastep
8e5f67797a Allow INLINE() in the accounting file to accept '+' in inline matches
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-14 14:52:18 -08:00
Tom Eastep
0eb0bace9a Update more copyrights
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-09 11:57:41 -08:00
Tom Eastep
fab8cc055b Remove unused local variable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-08 14:25:09 -08:00
Tom Eastep
bef8ec09b3 Insist that '+' (if present) be the first non-blank character in IL matches
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-08 13:55:02 -08:00
Tom Eastep
cf330afbd9 Allow inline matches in the conntrack file.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-08 13:09:00 -08:00
Tom Eastep
49731da807 Update copyright dates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-04 10:14:27 -08:00
Tom Eastep
f3ecbc185c Add Netmanager gateway detection
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-03 11:22:15 -08:00
Tom Eastep
a71a44346e Document the provider table contents
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-02 15:27:38 -08:00
Tom Eastep
4d278f4c20 Clarify [no]hostroute in shorewall-providers(5).
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2019-01-02 15:08:38 -08:00
Tom Eastep
45ec24ea42 Add comments to the Zones module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-30 14:10:28 -08:00
Tom Eastep
bf3880ae59 Add some comments to the Misc module
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-30 12:41:55 -08:00
Tom Eastep
9e838e6d04 Add Tuomo Soini's WUDO macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-19 14:57:38 -08:00
Tom Eastep
d096db6a94 Add/modify comments in Chains.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-19 09:19:26 -08:00
Tom Eastep
636d82414f Merge branch '5.2.1' 2018-12-16 10:34:34 -08:00
Tom Eastep
cb3273b13b Revert "Allow leading 's' & 'd' to be omitted when specifying two rates"
This reverts commit 23bc6f1ab5.
2018-12-16 10:06:34 -08:00
Tom Eastep
f0c75b5119 Update RATE documentation in shorewall-rules(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-16 10:06:00 -08:00
Tom Eastep
23bc6f1ab5 Allow leading 's' & 'd' to be omitted when specifying two rates
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-16 09:47:45 -08:00
Roberto C. Sánchez
54e6412c49 Fix documentation typos 2018-12-15 15:34:45 -08:00
Tom Eastep
1465035aa4 Merge branch 'master' of ssh://git.code.sf.net/p/shorewall/code 2018-12-15 14:57:21 -08:00
Tom Eastep
8473bf2200 Clean up macros contributed by Vincas Dargis
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-15 10:31:57 -08:00
Tom Eastep
0fe45b8f46 Merge branch 'tor' of ssh://teastep@git.code.sf.net/u/talkless/shorewall 2018-12-15 10:25:22 -08:00
Tom Eastep
a4c87149c9 Merge branch 'oncrpc_macro' of ssh://teastep@git.code.sf.net/u/talkless/shorewall 2018-12-15 10:24:56 -08:00
Tom Eastep
83359b098d Merge branch 'bitcoin' of ssh://teastep@git.code.sf.net/u/talkless/shorewall 2018-12-15 10:21:14 -08:00
Tom Eastep
3239fb3eb9 Merge branch '5.2.1' 2018-12-15 09:56:14 -08:00
Roberto C. Sánchez
096f59b5bc Fix documentation typos 2018-12-15 11:02:07 -05:00
Vincas Dargis
9260be402b Add Tor macros
Add macros for various Tor Anonimity Network ports
2018-12-15 13:08:06 +02:00
Vincas Dargis
7bf7000941 Add Bitcoin macros
Add macros for various Bitcoin daemon ports.
2018-12-15 12:35:52 +02:00
Vincas Dargis
840f8b904d Add ONC RPC macro
Add macro for handling ONC RPC calls, for rpcinbd on Linux.
2018-12-15 12:10:03 +02:00
Tom Eastep
61ac08dc7f Correct handling of netmask when two rates are specified in the RATE col.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-14 14:16:26 -08:00
Tom Eastep
f65b10c375 Remove dead/silly code from Shorewall::Chains::use_input/output_chain()
- combine the two into a single function use_interface_chain().

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-14 13:54:36 -08:00
Tom Eastep
35c7f304f7 Correct log name for untracked chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-14 11:00:27 -08:00
Tom Eastep
467544801e Clean up of Chains.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-14 10:59:31 -08:00
Tom Eastep
7cfe9ec272 Correct log name for untracked chain
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-14 10:58:26 -08:00
Tom Eastep
6908a4bcf7 Issue warning when ULOG is used.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-14 09:00:42 -08:00
Tom Eastep
be2110b47e Revert "Remove ULOG support"
This reverts commit 061ce3d781.
2018-12-14 08:54:07 -08:00
Tom Eastep
ad6401da8c Cleanup of Config.pm
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-13 15:32:39 -08:00
Tom Eastep
2b6d657fb0 Add UDP tip to DNAT solutions
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-13 10:33:11 -08:00
Tom Eastep
668cb6deda Make 'status -i' work when there are no providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-11 13:44:31 -08:00
Tom Eastep
ddd8576ced Merge branch '5.2.1' 2018-12-09 11:07:44 -08:00
Tom Eastep
98aad094fb Correct typo in Anti-Spoofing.xml
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-12-09 11:07:10 -08:00
Tom Eastep
8ed644a0ec Correct HELPER requires error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-11-28 11:00:41 -08:00
Tom Eastep
86b82c53cf Correct HELPER requires error message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-11-28 10:59:53 -08:00
Tom Eastep
061ce3d781 Remove ULOG support
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-11-15 14:59:29 -08:00
Tom Eastep
45f8d31021 Don't try to load ipt_ULOG
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-11-15 14:33:25 -08:00
Tom Eastep
03d2088cf7 Implement SW_CONFDIR support
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-11-06 15:40:26 -08:00
Tom Eastep
6534201284 Fix assertion failure during 'check -r' when DOCKER=Yes
- avoid unnecessary mode transitions

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-10-31 15:30:03 -07:00
Tom Eastep
282ca14182 Corrections to DOCKER-ISOLATION change
- Handle DOCKER-USER

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-10-28 09:20:47 -07:00
Tom Eastep
4b7d346911 Merge branch '5.2.1' 2018-10-27 09:11:00 -07:00
Tom Eastep
131a2cd40d Accommodate Docker version 18.06
- Optionally replace DOCKER-ISOLATION with DOCKER-ISOLATION-STAGE-1 and -2

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-10-27 09:04:34 -07:00
Tom Eastep
ae90ab1f68 Add version of Jeremie Courreges-Anglas's <jca@tranquil.it> patch
- Handle case where we are enabling/disabling a balanced/fallback provider
  and another such provider has lost carrier.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-10-11 15:18:47 -07:00
Tom Eastep
5e57c895b3 Avoid emacs issues with compiled code
- handle embedded spaces in moduledir path names

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-10-09 14:47:36 -07:00
Tom Eastep
aab1df7421 Correct ip[6]tables-restore failure message
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-10-06 08:22:46 -07:00
Tom Eastep
9f3cc88cf0 Prevent invalid code generation with SNAT(detect)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-10-02 08:15:20 -07:00
Tom Eastep
aaa80882a0 Add Eric Teeter's Cockpit macro
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-09-28 09:43:55 -07:00
Tom Eastep
1b6de901e0 Merge branch '5.2.0' 2018-08-24 15:33:16 -07:00
Tom Eastep
56780a5d1f Apply rate limiting in the nat table on nat+accept rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-24 15:31:20 -07:00
Tom Eastep
22c1bc2e9c Apply rate limiting in the nat table on nat+accept rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-23 14:07:10 -07:00
Tom Eastep
5048e68cb5 Correct IPv4 examples in shorewall-blrules(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-13 19:21:03 -07:00
Tom Eastep
1897794dbf Change reference to 'masq' to 'snat'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-12 11:37:12 -07:00
Tom Eastep
4fca96f10e Fix typo in IPSEC-2.6.xml
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-09 08:14:01 -07:00
Tom Eastep
2d2ded7efc Merge branch '5.2.0' 2018-08-07 07:46:29 -07:00
Tom Eastep
e5e427f278 Merge branch '5.2.0' of ssh://git.code.sf.net/p/shorewall/code into 5.2.0 2018-08-07 07:44:38 -07:00
Tom Eastep
5e8fd570d1 Prepare for Perl 5.32
- Escape '{' in REs

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-07 07:43:58 -07:00
Tom Eastep
e8428cc298 Prepare for Perl 5.32
- Escape '{' in REs

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-07 07:42:34 -07:00
Tom Eastep
aa94772fc6 Merge branch '5.2.0' 2018-08-06 08:08:39 -07:00
Matt Darfeuille
732ae3ce19 Ipcalc: Fail when missing arguments
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-05 10:26:17 -07:00
Tom Eastep
9cbcb328af More mutex changes for LEDE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-01 13:58:50 -07:00
Tom Eastep
82e84f724d Use -h rather than -L for checking a symlink
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-01 13:58:35 -07:00
Tom Eastep
23cf8328d5 Fix mutex on OpenWRT - patch 1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-01 13:58:28 -07:00
Tom Eastep
7c31f70dc8 Use '=' rather than '&' to create UNTRACKED rule chains.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-01 13:50:20 -07:00
Tom Eastep
f1eafdc314 Use '=' rather than '&' to create UNTRACKED rule chains.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-08-01 13:48:29 -07:00
Tom Eastep
69745caa41 Revert previous emacs-related change.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-31 15:16:24 -07:00
Tom Eastep
0b49477e0d More mutex changes for LEDE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-31 15:03:58 -07:00
Tom Eastep
c195bab01d Correct handling of a provider interface that matches a wildcard.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-29 20:34:02 -07:00
Tom Eastep
1b550baf7e Eliminate broken links
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-28 07:58:32 -07:00
Tom Eastep
d829093caa Use -h rather than -L for checking a symlink
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-26 13:57:10 -07:00
Tom Eastep
1fa77ac470 Fix mutex on OpenWRT - patch 1
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-26 11:47:51 -07:00
Tom Eastep
5083246266 Avoid emacs issues with lib.common
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-26 11:28:06 -07:00
Tom Eastep
c0d6c9e7c0 Document issue with optional shared interfaces
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-19 10:08:17 -07:00
Tom Eastep
0d682fe78b Disallow optional shared providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-19 09:57:06 -07:00
Tom Eastep
410a20dda3 Make shared interface and 'load=<load-factor' play nice together
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-17 13:25:26 -07:00
Tom Eastep
0685d0edfd Fix rate limiting
- Avoid specifying a timeout when the match is '-m limit'

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-15 08:57:43 -07:00
Tom Eastep
474604b1fe Correct source interface exclusion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-04 08:01:27 -07:00
Tom Eastep
6fef1f34ba Correct links in manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-03 15:31:14 -07:00
Tom Eastep
93f0183550 Tweak do_ratelimit()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-03 14:22:30 -07:00
Tom Eastep
5a599552f2 Correct INLINE typos
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-02 16:56:57 -07:00
Tom Eastep
a42972644c Allow specification of 'hashlimit' table sizes
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-02 14:14:36 -07:00
Tom Eastep
b271c52603 Update RATE column documentation
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-02 14:10:53 -07:00
Tom Eastep
49514e2d58 Allow specification of ht buckets and max entries in RATE columns
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-02 10:23:36 -07:00
Tom Eastep
a265685e20 Allow specification of VLSM in the RATE columns
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-07-02 09:08:45 -07:00
Matt Darfeuille
442e6ac152 Update version to 5.2
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-23 09:09:00 -07:00
Matt Darfeuille
14e5a2d5ca Be more verbose in progress messages
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-23 09:02:18 -07:00
Matt Darfeuille
6e32f052c8 Use proper function name on fatal error
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-23 09:01:49 -07:00
Tom Eastep
780eb0402c Update manpages for interface exclusion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-15 08:23:35 -07:00
Tom Eastep
bfb9852eb6 Allow MARK, CONNMARK, SAVE and RESTORE in the nat table
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-14 10:01:12 -07:00
Tom Eastep
a8b6a301f2 Revert "MARK and CONNMARK in the snat file"
This reverts commit e36547f8be.
2018-06-14 07:58:33 -07:00
Tom Eastep
150f7ab798 Allow specification of the TPROXY mark in CONNMARK and MARK.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-14 07:58:06 -07:00
Tom Eastep
b11d63a7bd More manpage corrections
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-11 08:54:34 -07:00
Tom Eastep
84b283533b Correct dangling link
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-11 08:52:07 -07:00
Tom Eastep
e36547f8be MARK and CONNMARK in the snat file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-10 16:34:55 -07:00
Tom Eastep
0632723a6c Support interface exclusion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-10 12:02:19 -07:00
Tom Eastep
43543b5c32 Clean up shorewall-addresses(5)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-06-10 12:00:54 -07:00
Tom Eastep
ffc5a3c7df Add ALT Linux support by Alexey Shabalin <sha-ba@mail.ru>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-29 08:13:26 -07:00
Tom Eastep
b6d1293b2e Merge branch '5.2.0' 2018-05-20 14:48:40 -07:00
Tom Eastep
ec21b03c5b Correct handling of dbl=src_dst in interface OPTIONS
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-18 10:18:09 -07:00
Tom Eastep
25dcf8c5d6 Check for linkdown in interface_is_usable() rather than ..._is_up().
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-18 07:56:06 -07:00
Tom Eastep
c02b71b530 Correct interface_is_up() to look for the 'state' as well as 'UP'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-12 08:09:46 -07:00
Tom Eastep
78269d57bc Handle missing AUTOMAKE
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-10 11:12:23 -07:00
Tom Eastep
fc91648315 Avoid split_line2 confusion when processing a raw line
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-10 09:30:02 -07:00
Tom Eastep
067f435ac5 Update BLACKLIST_DEFAULT if Drop or Reject
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-06 13:31:54 -07:00
Tom Eastep
2039f38faf Fix 'show saves' when there are no saves
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-05 13:27:37 -07:00
Tom Eastep
07654d8f8d Fix 'compile -c'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-05 13:26:58 -07:00
Tom Eastep
b5e8f9bd50 Restore the read_yesno_with_timeout() function
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-04 08:52:40 -07:00
Tom Eastep
f9995a9515 New manpages
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-04 08:47:33 -07:00
Tom Eastep
9c950082f6 Add new IPFS macros
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-05-04 08:45:39 -07:00
Tom Eastep
defdd320cf Merge branch '5.2.0' 2018-04-27 14:09:07 -07:00
Matt Darfeuille
c2fe389da8 Update version to 5.2 in RC files
- Mention LEDE distro in OpenWRT RC file

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-04-27 11:42:04 -07:00
Matt Darfeuille
45d1ef3978 Ipdecimal: Correct error when missing arguments
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-04-27 11:41:44 -07:00
Tom Eastep
65e174a073 Add IPFS macros from Răzvan Sandu <razvan.sandu@mobexpert.ro>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-04-21 09:05:48 -07:00
365 changed files with 6187 additions and 3277 deletions

View File

@@ -18,7 +18,7 @@ Shoreline Firewall (Shorewall) Version 5
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Please see http://www.shorewall.net/Install.htm for installation Please see https://shorewall.org/Install.htm for installation
instructions. instructions.

View File

@@ -0,0 +1 @@
5.2.5-Beta2

View File

@@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
# #
# Shorewall Packet Filtering Firewall RPM configuration program - V4.6 # Shorewall Packet Filtering Firewall configuration program - V5.2
# #
# (c) 2012,2014,2017 - Tom Eastep (teastep@shorewall.net) # (c) 2012,2014,2017 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -109,6 +109,9 @@ if [ -z "$vendor" ]; then
opensuse) opensuse)
vendor=suse vendor=suse
;; ;;
alt|basealt|altlinux)
vendor=alt
;;
*) *)
vendor="$ID" vendor="$ID"
;; ;;
@@ -132,6 +135,8 @@ if [ -z "$vendor" ]; then
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
params[HOST]=debian params[HOST]=debian
ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit
elif [ -f /etc/altlinux-release ] ; then
params[HOST]=alt
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
params[HOST]=redhat params[HOST]=redhat
rcfile=shorewallrc.redhat rcfile=shorewallrc.redhat

View File

@@ -1,10 +1,10 @@
#! /usr/bin/perl -w #! /usr/bin/perl -w
# #
# Shorewall Packet Filtering Firewall RPM configuration program - V4.5 # Shorewall Packet Filtering Firewall configuration program - V5.2
# #
# (c) 2012, 2014 - Tom Eastep (teastep@shorewall.net) # (c) 2012, 2014 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -74,6 +74,8 @@ unless ( defined $vendor ) {
} elsif ( $id eq 'ubuntu' || $id eq 'debian' ) { } elsif ( $id eq 'ubuntu' || $id eq 'debian' ) {
my $init = `ls -l /sbin/init`; my $init = `ls -l /sbin/init`;
$vendor = $init =~ /systemd/ ? 'debian.systemd' : 'debian.sysvinit'; $vendor = $init =~ /systemd/ ? 'debian.systemd' : 'debian.sysvinit';
} elsif ( $id eq 'alt' || $id eq 'basealt' || $id eq 'altlinux' ) {
$vendor = 'alt';
} else { } else {
$vendor = $id; $vendor = $id;
} }
@@ -117,6 +119,9 @@ if ( defined $vendor ) {
} else { } else {
$rcfilename = 'shorewallrc.debian.sysvinit'; $rcfilename = 'shorewallrc.debian.sysvinit';
} }
} elsif ( -f '/etc/altlinux-release' ){
$vendor = 'alt';
$rcfilename = 'shorewallrc.alt';
} elsif ( -f '/etc/redhat-release' ){ } elsif ( -f '/etc/redhat-release' ){
$vendor = 'redhat'; $vendor = 'redhat';
$rcfilename = 'shorewallrc.redhat'; $rcfilename = 'shorewallrc.redhat';

View File

@@ -4,7 +4,7 @@
# #
# (c) 2000-2018 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -172,6 +172,9 @@ if [ -z "$BUILD" ]; then
opensuse) opensuse)
BUILD=suse BUILD=suse
;; ;;
alt|basealt|altlinux)
BUILD=alt
;;
*) *)
BUILD="$ID" BUILD="$ID"
;; ;;
@@ -180,6 +183,8 @@ if [ -z "$BUILD" ]; then
BUILD=debian BUILD=debian
elif [ -f /etc/gentoo-release ]; then elif [ -f /etc/gentoo-release ]; then
BUILD=gentoo BUILD=gentoo
elif [ -f /etc/altlinux-release ]; then
BUILD=alt
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
BUILD=redhat BUILD=redhat
elif [ -f /etc/slackware-version ] ; then elif [ -f /etc/slackware-version ] ; then
@@ -238,7 +243,7 @@ case "$HOST" in
apple) apple)
echo "Installing Mac-specific configuration..."; echo "Installing Mac-specific configuration...";
;; ;;
debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt) debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt|alt)
;; ;;
*) *)
fatal_error "Unknown HOST \"$HOST\"" fatal_error "Unknown HOST \"$HOST\""

View File

@@ -3,7 +3,7 @@
# #
# (c) 1999-2017 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -3,7 +3,7 @@
# #
# (c) 1999-2018 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -1201,11 +1201,17 @@ show_saves_command() {
echo echo
for f in ${VARDIR}/*-iptables; do for f in ${VARDIR}/*-iptables; do
case $f in
*\**)
;;
*)
fn=$(basename $f) fn=$(basename $f)
fn=${fn%-iptables} fn=${fn%-iptables}
mtime=$(ls -lt $f | tail -n 1 | cut -d ' ' -f '6 7 8' ) mtime=$(ls -lt $f | tail -n 1 | cut -d ' ' -f '6 7 8' )
[ $fn = "$RESTOREFILE" ] && fn="$fn (default)" [ $fn = "$RESTOREFILE" ] && fn="$fn (default)"
echo " $mtime ${fn%-iptables}" echo " $mtime ${fn%-iptables}"
;;
esac
done done
echo echo
@@ -2645,6 +2651,7 @@ allow_command() {
if [ -n "$g_blacklistipset" ]; then if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes allowed=Yes
[ -n "$g_dbllog" ] && mylogger daemon.info "$g_product: $1 Allowed"
fi fi
fi fi
@@ -2661,6 +2668,7 @@ allow_command() {
*) *)
if [ -n "$g_blacklistipset" ]; then if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then if qt $IPSET -D $g_blacklistipset $1; then
[ -n "$g_dbllog" ] && mylogger daemon.info "$g_product: $1 Allowed"
allowed=Yes allowed=Yes
fi fi
fi fi
@@ -2760,7 +2768,7 @@ determine_capabilities() {
g_tool=$(mywhich $tool) g_tool=$(mywhich $tool)
if [ -z "$g_tool" ]; then if [ -z "$g_tool" ]; then
fatal-error "No executable $tool binary can be found on your PATH" fatal_error "No executable $tool binary can be found on your PATH"
fi fi
fi fi
@@ -3616,6 +3624,7 @@ reject_command() {
blacklist_command() { blacklist_command() {
local family local family
local timeout
[ $# -gt 0 ] || fatal_error "Missing address" [ $# -gt 0 ] || fatal_error "Missing address"
@@ -3633,10 +3642,17 @@ blacklist_command() {
;; ;;
esac esac
if $IPSET -A $g_blacklistipset $@ -exist; then if [ $COMMAND = 'blacklist!' ]; then
timeout='timeout 0'
else
echo "$@" | fgrep -q ' timeout ' || timeout="timeout $g_dbltimeout"
fi
if $IPSET -A $g_blacklistipset $@ $timeout -exist; then
local message local message
progress_message2 "$1 Blacklisted" progress_message2 "$1 Blacklisted"
[ -n "$g_dbllog" ] && mylogger daemon.info "$g_product: $1 Blacklisted"
if [ -n "$g_disconnect" ]; then if [ -n "$g_disconnect" ]; then
message="$(conntrack -D -s $1 2>&1)" message="$(conntrack -D -s $1 2>&1)"
@@ -3769,7 +3785,7 @@ ipcalc_command() {
elif [ $# -eq 3 ]; then elif [ $# -eq 3 ]; then
address=$2 address=$2
vlsm=$(ip_vlsm $3) vlsm=$(ip_vlsm $3)
elif [ $# -eq 0 ]; then elif [ $# -eq 1 ]; then
missing_argument missing_argument
else else
too_many_arguments $4 too_many_arguments $4
@@ -3858,7 +3874,7 @@ noiptrace_command() {
verify_firewall_script() { verify_firewall_script() {
if [ ! -f $g_firewall ]; then if [ ! -f $g_firewall ]; then
echo " ERROR: $g_product is not properly installed" >&2 echo " ERROR: $g_product is not properly installed" >&2
if [ -L $g_firewall ]; then if [ -h $g_firewall ]; then
echo " $g_firewall is a symbolic link to a" >&2 echo " $g_firewall is a symbolic link to a" >&2
echo " non-existant file" >&2 echo " non-existant file" >&2
else else
@@ -3891,7 +3907,7 @@ setup_dbl() {
case $DYNAMIC_BLACKLIST in case $DYNAMIC_BLACKLIST in
ipset*,src-dst*) ipset*,src-dst*)
# #
# This utility doesn't need to know about 'src-dst' # Capture 'src-dst'
# #
DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed 's/,src-dst//') DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed 's/,src-dst//')
@@ -3899,11 +3915,49 @@ setup_dbl() {
;; ;;
esac esac
case $DYNAMIC_BLACKLIST in
ipset*,log*)
#
# Capture 'log'
#
DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed 's/,log//')
g_dbllog=Yes
;;
esac
case $DYNAMIC_BLACKLIST in
ipset*,noupdate*)
#
# This utility doesn't use this option
#
DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed 's/,noupdate//')
;;
esac
case $DYNAMIC_BLACKLIST in case $DYNAMIC_BLACKLIST in
ipset*,timeout*) ipset*,timeout*)
# #
# This utility doesn't need to know about 'timeout=nnn' # Capture timeout
# #
local ifs
local f
ifs=$IFS
IFS=','
for f in $DYNAMIC_BLACKLIST; do
case $f in
timeout=*)
g_dbltimeout=${f#timeout=}
g_dbltimeout=${g_dbltimeout%%:*}
break
;;
esac
done
IFS=$ifs
DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed -r 's/,timeout=[[:digit:]]+//') DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed -r 's/,timeout=[[:digit:]]+//')
;; ;;
esac esac
@@ -4114,9 +4168,9 @@ start_command() {
if [ -x $g_firewall ]; then if [ -x $g_firewall ]; then
if [ -n "$g_fast" -a -x ${VARDIR}/${RESTOREFILE} -a ! $g_firewall -nt ${VARDIR}/${RESTOREFILE} ]; then if [ -n "$g_fast" -a -x ${VARDIR}/${RESTOREFILE} -a ! $g_firewall -nt ${VARDIR}/${RESTOREFILE} ]; then
run_it ${VARDIR}/${RESTOREFILE} $g_debugging restore run_it ${VARDIR}/${RESTOREFILE} restore
else else
run_it $g_firewall $g_debugging start run_it $g_firewall start
fi fi
rc=$? rc=$?
else else
@@ -4250,7 +4304,7 @@ restart_command() {
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
if [ -x $g_firewall ]; then if [ -x $g_firewall ]; then
run_it $g_firewall $g_debugging $COMMAND run_it $g_firewall $COMMAND
rc=$? rc=$?
else else
error_message "$g_firewall is missing or is not executable" error_message "$g_firewall is missing or is not executable"
@@ -4264,7 +4318,7 @@ restart_command() {
run_command() { run_command() {
if [ -x $g_firewall ] ; then if [ -x $g_firewall ] ; then
run_it $g_firewall $g_debugging $@ run_it $g_firewall $@
else else
fatal_error "$g_firewall does not exist or is not executable" fatal_error "$g_firewall does not exist or is not executable"
fi fi
@@ -4281,7 +4335,13 @@ ecko() {
# #
usage() # $1 = exit status usage() # $1 = exit status
{ {
echo "Usage: $(basename $0) [debug|trace] [nolock] [ -q ] [ -v[-1|{0-2}] ] [ -t ] <command>" echo "Usage: $(basename $0) [ -T ] [ -D ] [ -N ] [ -q ] [ -v[-1|{0-2}] ] [ -t ] <command>"
echo " -T : Direct the generated script to produce a shell trace to standard error"
echo " -D : Debug iptables commands"
echo " -N : Don't take the master shorewall lock"
echo " -q : Standard Shorewall verbosity control"
echo " -v : Standard Shorewall verbosity control"
echo " -t : Timestamp all messages"
echo "where <command> is one of:" echo "where <command> is one of:"
echo " add <interface>[:<host-list>] ... <zone>" echo " add <interface>[:<host-list>] ... <zone>"
echo " allow <address> ..." echo " allow <address> ..."
@@ -4311,7 +4371,6 @@ usage() # $1 = exit status
echo " iptrace <ip6tables match expression>" echo " iptrace <ip6tables match expression>"
fi fi
ecko " load [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
echo " logdrop <address> ..." echo " logdrop <address> ..."
echo " logreject <address> ..." echo " logreject <address> ..."
echo " logwatch [<refresh interval>]" echo " logwatch [<refresh interval>]"
@@ -4409,20 +4468,16 @@ usage() # $1 = exit status
# here if that lib is loaded below. # here if that lib is loaded below.
# #
shorewall_cli() { shorewall_cli() {
g_debugging=
if [ $# -gt 0 ] && [ "x$1" = "xdebug" -o "x$1" = "xtrace" ]; then
g_debugging=$1
shift
fi
g_nolock= g_nolock=
#
# We'll keep this around for a while so we don't break people's started scripts
#
if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
g_nolock=nolock g_nolock=nolock
shift shift
fi fi
g_debugging=
g_noroutes= g_noroutes=
g_purge= g_purge=
g_ipt_options="-nv" g_ipt_options="-nv"
@@ -4450,6 +4505,9 @@ shorewall_cli() {
g_blacklistipset= g_blacklistipset=
g_disconnect= g_disconnect=
g_havemutex= g_havemutex=
g_trace=
g_dbltimeout=
g_dbllog=
VERBOSE= VERBOSE=
VERBOSITY=1 VERBOSITY=1
@@ -4581,6 +4639,17 @@ shorewall_cli() {
finished=1 finished=1
option= option=
;; ;;
T*)
g_debugging=trace
option=${option#T}
;;
D*)
g_debugging=debug
option=${option#D}
;;
N*)
g_nolock=nolock
;;
*) *)
option_error $option option_error $option
;; ;;
@@ -4633,7 +4702,7 @@ shorewall_cli() {
get_config get_config
[ -x $g_firewall ] || fatal_error "$g_product has never been started" [ -x $g_firewall ] || fatal_error "$g_product has never been started"
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
run_it $g_firewall $g_debugging $COMMAND run_it $g_firewall $COMMAND
[ -n "$g_nolock" ] || mutex_off [ -n "$g_nolock" ] || mutex_off
;; ;;
reset) reset)
@@ -4642,7 +4711,7 @@ shorewall_cli() {
shift shift
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
[ -x $g_firewall ] || fatal_error "$g_product has never been started" [ -x $g_firewall ] || fatal_error "$g_product has never been started"
run_it $g_firewall $g_debugging reset $@ run_it $g_firewall reset $@
[ -n "$g_nolock" ] || mutex_off [ -n "$g_nolock" ] || mutex_off
;; ;;
reload|restart) reload|restart)
@@ -4655,12 +4724,12 @@ shorewall_cli() {
only_root only_root
get_config Yes get_config Yes
if product_is_started; then if product_is_started; then
run_it $g_firewall $g_debugging $@ run_it $g_firewall $@
else else
fatal_error "$g_product is not running" fatal_error "$g_product is not running"
fi fi
;; ;;
blacklist) blacklist|blacklist!)
only_root only_root
get_config Yes get_config Yes
shift shift
@@ -4738,7 +4807,7 @@ shorewall_cli() {
;; ;;
allow) allow)
only_root only_root
get_config get_config Yes
allow_command $@ allow_command $@
;; ;;
add) add)
@@ -4810,7 +4879,7 @@ shorewall_cli() {
# It isn't a function visible to this script -- try # It isn't a function visible to this script -- try
# the compiled firewall # the compiled firewall
# #
run_it $g_firewall $g_debugging call $@ run_it $g_firewall call $@
fi fi
else else
missing_argument missing_argument

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.2 -- /usr/share/shorewall/lib.common # Shorewall 5.2 -- /usr/share/shorewall/lib.common
# #
# (c) 2010-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2010-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -92,18 +92,20 @@ startup_error() # $* = Error Message
# #
run_it() { run_it() {
local script local script
local options local options='-'
export VARDIR export VARDIR
script=$1 script=$1
shift shift
if [ x$1 = xtrace -o x$1 = xdebug ]; then
options="$1 -" if [ "$g_debugging" = debug ]; then
shift; options='-D'
elif [ "$g_debugging" = trace ]; then
options='-T'
else else
options='-' options='-';
fi fi
[ -n "$g_noroutes" ] && options=${options}n [ -n "$g_noroutes" ] && options=${options}n
@@ -411,7 +413,7 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
[ -d $directory ] && moduledirectories="$moduledirectories $directory" [ -d $directory ] && moduledirectories="$moduledirectories $directory"
done done
[ -n "$LOAD_HELPERS_ONLY" ] && modules=$(find_file helpers) || modules=$(find_file modules) modules=$(find_file helpers)
if [ -f $modules -a -n "$moduledirectories" ]; then if [ -f $modules -a -n "$moduledirectories" ]; then
[ -d /sys/module/ ] || MODULES=$(lsmod | cut -d ' ' -f1) [ -d /sys/module/ ] || MODULES=$(lsmod | cut -d ' ' -f1)
@@ -419,7 +421,7 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
. $modules . $modules
if [ $savemoduleinfo = Yes ]; then if [ $savemoduleinfo = Yes ]; then
[ -d ${VARDIR} ] || mkdir -p ${VARDIR} [ -d ${VARDIR} ] || mkdir -p ${VARDIR}
echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir echo MODULESDIR=\"$MODULESDIR\" > ${VARDIR}/.modulesdir
cp -f $modules ${VARDIR}/.modules cp -f $modules ${VARDIR}/.modules
fi fi
elif [ $savemoduleinfo = Yes ]; then elif [ $savemoduleinfo = Yes ]; then
@@ -501,7 +503,7 @@ ip_network() {
# #
# The following hack is supplied to compensate for the fact that many of # The following hack is supplied to compensate for the fact that many of
# the popular light-weight Bourne shell derivatives don't support XOR ("^"). # the popular light-weight Bourne shell derivatives do not support XOR ("^").
# #
ip_broadcast() { ip_broadcast() {
local x local x
@@ -736,8 +738,8 @@ truncate() # $1 = length
# #
# Call this function to assert mutual exclusion with Shorewall. If you invoke the # 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 # /sbin/shorewall program while holding mutual exclusion, you should pass -N as
# the first argument. Example "shorewall nolock refresh" # the first argument. Example "shorewall -N refresh"
# #
# This function uses the lockfile utility from procmail if it exists. # This function uses the lockfile utility from procmail if it exists.
# Otherwise, it uses a somewhat race-prone algorithm to attempt to simulate the # Otherwise, it uses a somewhat race-prone algorithm to attempt to simulate the
@@ -751,6 +753,8 @@ mutex_on()
lockf=${LOCKFILE:=${VARDIR}/lock} lockf=${LOCKFILE:=${VARDIR}/lock}
local lockpid local lockpid
local lockd local lockd
local lockbin
local openwrt
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60} MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
@@ -760,29 +764,33 @@ mutex_on()
[ -d "$lockd" ] || mkdir -p "$lockd" [ -d "$lockd" ] || mkdir -p "$lockd"
lockbin=$(mywhich lock)
[ -n "$lockbin" -a -h "$lockbin" ] && openwrt=Yes
if [ -f $lockf ]; then if [ -f $lockf ]; then
lockpid=`cat ${lockf} 2> /dev/null` lockpid=`cat ${lockf} 2> /dev/null`
if [ -z "$lockpid" ] || [ $lockpid = 0 ]; then if [ -z "$lockpid" ] || [ $lockpid = 0 ]; then
rm -f ${lockf} rm -f ${lockf}
error_message "WARNING: Stale lockfile ${lockf} removed" error_message "WARNING: Stale lockfile ${lockf} removed"
elif [ $lockpid -eq $$ ]; then elif [ -z "$openwrt" ]; then
return 0 if [ $lockpid -eq $$ ]; then
elif ! ps | grep -v grep | qt grep ${lockpid}; then fatal_error "Mutex_on confusion"
elif ! qt ps --pid ${lockpid}; then
rm -f ${lockf} rm -f ${lockf}
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed" error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
fi fi
fi fi
fi
if qt mywhich lockfile; then if [ -n "$openwrt" ]; then
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf} lock ${lockf} || fatal_error "Can't lock ${lockf}"
g_havemutex="lock -u ${lockf}"
elif qt mywhich lockfile; then
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf} || fatal_error "Can't lock ${lockf}"
g_havemutex="rm -f ${lockf}" g_havemutex="rm -f ${lockf}"
chmod u+w ${lockf} chmod u+w ${lockf}
echo $$ > ${lockf} echo $$ > ${lockf}
chmod u-w ${lockf} chmod u-w ${lockf}
elif qt mywhich lock; then
lock ${lockf}
g_havemutex="lock -u ${lockf} && rm -f ${lockf}"
chmod u=r ${lockf}
else else
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
sleep 1 sleep 1

View File

@@ -3,7 +3,7 @@
# #
# (c) 1999-2017 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -4,7 +4,7 @@
# (c) 2017 - Tom Eastep (teastep@shorewall.net) # (c) 2017 - Tom Eastep (teastep@shorewall.net)
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com) # (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -4,7 +4,7 @@
# (c) 2017 - Tom Eastep (teastep@shorewall.net) # (c) 2017 - Tom Eastep (teastep@shorewall.net)
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com) # (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -60,7 +60,7 @@ mywhich() {
remove_file() # $1 = file to remove remove_file() # $1 = file to remove
{ {
if [ -n "$1" ] ; then if [ -n "$1" ] ; then
if [ -f $1 -o -L $1 ] ; then if [ -f $1 -o -h $1 ] ; then
rm -f $1 rm -f $1
echo "$1 Removed" echo "$1 Removed"
fi fi
@@ -84,7 +84,7 @@ remove_file_with_wildcard() # $1 = file with wildcard to remove
if [ -d $f ] ; then if [ -d $f ] ; then
rm -rf $f rm -rf $f
echo "$f Removed" echo "$f Removed"
elif [ -f $f -o -L $f ] ; then elif [ -f $f -o -h $f ] ; then
rm -f $f rm -f $f
echo "$f Removed" echo "$f Removed"
fi fi

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
# #
# Shorewall Packet Filtering Firewall Control Program - V5.1 # Shorewall Packet Filtering Firewall Control Program - V5.2
# #
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2014,2015-2017 # (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2014,2015-2017
# Tom Eastep (teastep@shorewall.net) # Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -0,0 +1,25 @@
#
# ALT/BaseALT/ALTLinux Shorewall 5.2 rc file
#
BUILD= #Default is to detect the build system
HOST=alt
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
LIBEXECDIR=${PREFIX}/libexec #Directory for executable scripts.
PERLLIBDIR=${SHAREDIR}/perl5 #Directory to install Shorewall Perl module directory
CONFDIR=/etc #Directory where subsystem configurations are installed
SBINDIR=/sbin #Directory where system administration programs are installed
MANDIR=${SHAREDIR}/man #Directory where manpages are installed.
INITDIR=${CONFDIR}/rc.d/init.d #Directory where SysV init scripts are installed.
INITFILE=$PRODUCT #Name of the product's installed SysV init script
INITSOURCE=init.alt.sh #Name of the distributed file to be installed as the SysV init script
ANNOTATED= #If non-zero, annotated configuration files are installed
SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
SYSCONFFILE=sysconfig #Name of the distributed file to be installed as $SYSCONFDIR/$PRODUCT
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
VARLIB=/var/lib #Directory where product variable data is stored.
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
DEFAULT_PAGER=/usr/bin/less #Pager to use if none specified in shorewall[6].conf

View File

@@ -4,7 +4,7 @@
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -1,12 +1,12 @@
#!/bin/sh #!/bin/sh
# #
# Shorewall interface helper utility - V4.2 # Shorewall interface helper utility - V5.2
# #
# (c) 2007,2014 - Tom Eastep (teastep@shorewall.net) # (c) 2007,2014 - Tom Eastep (teastep@shorewall.net)
# #
# This file is installed in /usr/share/shorewall/wait4ifup # This file is installed in /usr/share/shorewall/wait4ifup
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -6,7 +6,7 @@
# #
# (c) 2010,2013 - Tom Eastep (teastep@shorewall.net) # (c) 2010,2013 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License
@@ -110,7 +110,7 @@ case $0 in
;; ;;
*) *)
# #
# Debian ifupdown system # Debian ifupdown system - MODE and INTERFACE inherited from the environment
# #
INTERFACE="$IFACE" INTERFACE="$IFACE"
@@ -127,6 +127,17 @@ esac
[ -n "$LOGFILE" ] || LOGFILE=/dev/null [ -n "$LOGFILE" ] || LOGFILE=/dev/null
for PRODUCT in $PRODUCTS; do for PRODUCT in $PRODUCTS; do
if [ -n "$ADDRFAM" -a ${COMMAND} = up ]; then
case $PRODUCT in
*6*)
[ ${ADDRFAM} = inet6 ] || continue
;;
*)
[ ${ADDRFAM} = inet ] || continue
;;
esac
fi
setstatedir setstatedir
if [ -x $VARLIB/$PRODUCT/firewall ]; then if [ -x $VARLIB/$PRODUCT/firewall ]; then

View File

@@ -6,7 +6,7 @@
# #
# (c) 2010,2013 - Tom Eastep (teastep@shorewall.net) # (c) 2010,2013 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License
@@ -90,6 +90,8 @@ case $0 in
COMMAND=down COMMAND=down
;; ;;
*dispatcher.d*) *dispatcher.d*)
case "$2" in
up|down)
COMMAND="$2" COMMAND="$2"
;; ;;
*) *)
@@ -97,6 +99,11 @@ case $0 in
;; ;;
esac esac
;; ;;
*)
exit 0
;;
esac
;;
esac esac
[ -n "$LOGFILE" ] || LOGFILE=/dev/null [ -n "$LOGFILE" ] || LOGFILE=/dev/null

View File

@@ -6,7 +6,7 @@
# #
# (c) 2010,2013 - Tom Eastep (teastep@shorewall.net) # (c) 2010,2013 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License
@@ -120,8 +120,15 @@ case $0 in
case $0 in case $0 in
*dispatcher.d*) *dispatcher.d*)
INTERFACE="$1" INTERFACE="$1"
case "$2" in
up|down)
COMMAND="$2" COMMAND="$2"
;; ;;
*)
exit 0
;;
esac
;;
*if-up.d*) *if-up.d*)
COMMAND=up COMMAND=up
;; ;;

150
Shorewall-init/init.alt.sh Executable file
View File

@@ -0,0 +1,150 @@
#!/bin/sh
#
# Shorewall init script
#
# chkconfig: - 09 91
# description: Initialize the shorewall firewall at boot time
#
### BEGIN INIT INFO
# Provides: shorewall-init
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Initialize the shorewall firewall at boot time
# Description: Place the firewall in a safe state at boot time
# prior to bringing up the network.
### END INIT INFO
# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1
# Source function library.
. /etc/init.d/functions
#
# The installer may alter this
#
. /usr/share/shorewall/shorewallrc
NAME="Shorewall-init firewall"
PROG="shorewall-init"
SHOREWALL="$SBINDIR/$PROG"
LOGGER="logger -i -t $PROG"
# Get startup options (override default)
OPTIONS=
LOCKFILE=/var/lock/subsys/shorewall-init
# check if shorewall-init is configured or not
if [ -f "/etc/sysconfig/shorewall-init" ]; then
. /etc/sysconfig/shorewall-init
if [ -z "$PRODUCTS" ]; then
echo "No PRODUCTS configured"
exit 6
fi
else
echo "/etc/sysconfig/shorewall-init not found"
exit 6
fi
RETVAL=0
# set the STATEDIR variable
setstatedir() {
local statedir
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
fi
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ -x ${STATEDIR}/firewall ]; then
return 0
elif [ $PRODUCT = shorewall ]; then
${SBINDIR}/shorewall compile
elif [ $PRODUCT = shorewall6 ]; then
${SBINDIR}/shorewall -6 compile
else
return 1
fi
}
start() {
local PRODUCT
local STATEDIR
printf "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop 2>&1 | "$LOGGER"
RETVAL=$?
else
RETVAL=6
break
fi
done
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
ipset -R < "$SAVE_IPSETS"
fi
[ $RETVAL -eq 0 ] && touch "$LOCKFILE"
return $RETVAL
}
stop() {
local PRODUCT
local STATEDIR
printf "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
${STATEDIR}/firewall ${OPTIONS} clear 2>&1 | "$LOGGER"
RETVAL=$?
else
RETVAL=6
break
fi
done
if [ -n "$SAVE_IPSETS" ]; then
mkdir -p $(dirname "$SAVE_IPSETS")
if ipset -S > "${SAVE_IPSETS}.tmp"; then
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
else
rm -f "${SAVE_IPSETS}.tmp"
fi
fi
[ $RETVAL -eq 0 ] && rm -f "$LOCKFILE"
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|condrestart|condreload)
# "Not implemented"
;;
condstop)
if [ -e "$LOCKFILE" ]; then
stop
fi
;;
status)
status "$PROG"
RETVAL=$?
;;
*)
echo $"Usage: ${0##*/} {start|stop|restart|reload|condrestart|condstop|status}"
RETVAL=1
esac
exit $RETVAL

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.0 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.2
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
@@ -8,7 +8,7 @@
# #
# On most distributions, this file should be called /etc/init.d/shorewall. # On most distributions, this file should be called /etc/init.d/shorewall.
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.0 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.2
# #
# (c) 2010,2012-2014 - Tom Eastep (teastep@shorewall.net) # (c) 2010,2012-2014 - Tom Eastep (teastep@shorewall.net)
# (c) 2016 - Matt Darfeuille (matdarf@gmail.com) # (c) 2016 - Matt Darfeuille (matdarf@gmail.com)

View File

@@ -1,5 +1,5 @@
#! /bin/bash #! /bin/bash
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.0 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.2
# #
# (c) 2010,2012-2014 - Tom Eastep (teastep@shorewall.net) # (c) 2010,2012-2014 - Tom Eastep (teastep@shorewall.net)
# #

View File

@@ -1,5 +1,5 @@
#! /bin/bash #! /bin/bash
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.0 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.2
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
@@ -7,7 +7,7 @@
# #
# On most distributions, this file should be called /etc/init.d/shorewall. # On most distributions, this file should be called /etc/init.d/shorewall.
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# (c) 2010 - Roberto C. Sanchez (roberto@connexer.com) # (c) 2010 - Roberto C. Sanchez (roberto@connexer.com)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -169,7 +169,7 @@ if [ -z "$BUILD" ]; then
;; ;;
*) *)
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
eval $(cat /etc/os-release | grep ^ID=) ID=$(grep '^ID=' /etc/os-release | sed 's/ID=//; s/"//g;')
case $ID in case $ID in
fedora|rhel|centos|foobar) fedora|rhel|centos|foobar)
@@ -181,6 +181,9 @@ if [ -z "$BUILD" ]; then
opensuse) opensuse)
BUILD=suse BUILD=suse
;; ;;
alt|basealt|altlinux)
BUILD=alt
;;
*) *)
BUILD="$ID" BUILD="$ID"
;; ;;
@@ -191,6 +194,8 @@ if [ -z "$BUILD" ]; then
BUILD=debian BUILD=debian
elif [ -f /etc/gentoo-release ]; then elif [ -f /etc/gentoo-release ]; then
BUILD=gentoo BUILD=gentoo
elif [ -f /etc/altlinux-release ]; then
BUILD=alt
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
BUILD=redhat BUILD=redhat
elif [ -f /etc/SuSE-release ]; then elif [ -f /etc/SuSE-release ]; then
@@ -253,6 +258,9 @@ case "$HOST" in
openwrt) openwrt)
echo "Installing Openwrt-specific configuration..." echo "Installing Openwrt-specific configuration..."
;; ;;
alt)
echo "Installing ALT-specific configuration...";
;;
linux) linux)
fatal_error "Shorewall-init is not supported on this system" fatal_error "Shorewall-init is not supported on this system"
;; ;;
@@ -349,12 +357,11 @@ fi
if [ $HOST = debian ]; then if [ $HOST = debian ]; then
if [ -n "${DESTDIR}" ]; then if [ -n "${DESTDIR}" ]; then
make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755 make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755
make_parent_directory ${DESTDIR}${ETC}/network/if-down.d 0755
make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755 make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755
elif [ $configure -eq 0 ]; then elif [ $configure -eq 0 ]; then
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-up.d 0755 make_parent_directory ${CONFDIR}/network/if-up.d 0755
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-down.d 0755 make_parent_directory ${CONFDIR}/network/if-post-down.d 0755
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-post-down.d 0755 rm -f ${CONFDIR}/network/if-down.d/shorewall
fi fi
if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then
@@ -380,7 +387,7 @@ else
elif [ $HOST = openwrt ]; then elif [ $HOST = openwrt ]; then
# Not implemented on OpenWRT # Not implemented on OpenWRT
/bin/true /bin/true
else elif [ "$HOST" != debian ]; then
make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755 make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755
fi fi
fi fi
@@ -409,19 +416,22 @@ if [ $HOST != openwrt ]; then
fi fi
if [ -d ${DESTDIR}/etc/NetworkManager ]; then if [ -d ${DESTDIR}/etc/NetworkManager ]; then
if [ "$HOST" = debian ]; then
rm -f ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall
else
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755 [ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544 install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
fi
fi fi
case $HOST in case $HOST in
debian) debian)
if [ $configure -eq 1 ]; then if [ $configure -eq 1 ]; then
install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544 install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-down.d/shorewall 0544
install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544 install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
rm -f ${DESTDIR}/etc/network/if-down.d/shorewall
else else
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-up.d/shorewall 0544 install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-up.d/shorewall 0544
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-down.d/shorewall 0544
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-post-down.d/shorewall 0544 install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-post-down.d/shorewall 0544
fi fi
;; ;;

View File

@@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.0 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.2
# #
# (c) 2012-2014 - Tom Eastep (teastep@shorewall.net) # (c) 2012-2014 - Tom Eastep (teastep@shorewall.net)
# #
# On most distributions, this file should be called # On most distributions, this file should be called
# /etc/init.d/shorewall. # /etc/init.d/shorewall.
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -25,6 +25,7 @@
# #
############################################################################### ###############################################################################
# set the STATEDIR variable # set the STATEDIR variable
setstatedir() { setstatedir() {
local statedir local statedir
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
@@ -42,6 +43,67 @@ setstatedir() {
fi fi
} }
# Initialize the firewalls
shorewall_init_start () {
local PRODUCT
local STATEDIR
printf "Initializing \"Shorewall-based firewalls\": "
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
ipset -R < "$SAVE_IPSETS"
fi
for PRODUCT in $PRODUCTS; do
if setstatedir; then
#
# Run in a sub-shell to avoid name collisions
#
(
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop
fi
)
fi
done
return 0
}
# Clear the firewalls
shorewall_init_stop () {
local PRODUCT
local STATEDIR
printf "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
#
# Run in sub-shell to avoid name collisions
#
(
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} clear
fi
)
fi
done
if [ -n "$SAVE_IPSETS" ]; then
mkdir -p $(dirname "$SAVE_IPSETS")
if ipset -S > "${SAVE_IPSETS}.tmp"; then
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
else
rm -f "${SAVE_IPSETS}.tmp"
fi
fi
return 0
}
# #
# This is modified by the installer when ${SHAREDIR} <> /usr/share # This is modified by the installer when ${SHAREDIR} <> /usr/share
# #
@@ -59,62 +121,12 @@ else
exit 1 exit 1
fi fi
# Initialize the firewall
shorewall_start () {
local PRODUCT
local STATEDIR
printf "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
#
# Run in a sub-shell to avoid name collisions
#
(
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
${STATEDIR}/firewall ${OPTIONS} stop
fi
)
fi
done
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
ipset -R < "$SAVE_IPSETS"
fi
return 0
}
# Clear the firewall
shorewall_stop () {
local PRODUCT
local STATEDIR
printf "Clearing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
if setstatedir; then
${STATEDIR}/firewall ${OPTIONS} clear
fi
done
if [ -n "$SAVE_IPSETS" ]; then
mkdir -p $(dirname "$SAVE_IPSETS")
if ipset -S > "${SAVE_IPSETS}.tmp"; then
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
else
rm -f "${SAVE_IPSETS}.tmp"
fi
fi
return 0
}
case "$1" in case "$1" in
start) start)
shorewall_start shorewall_init_start
;; ;;
stop) stop)
shorewall_stop shorewall_init_stop
;; ;;
*) *)
echo "Usage: $0 {start|stop}" echo "Usage: $0 {start|stop}"

View File

@@ -0,0 +1 @@
5.2.4.1

117
Shorewall-lite/init.alt.sh Executable file
View File

@@ -0,0 +1,117 @@
#!/bin/sh
#
# Shorewall-Lite init script
#
# chkconfig: - 28 90
# description: Packet filtering firewall
#
### BEGIN INIT INFO
# Provides: shorewall-lite
# Required-Start: $local_fs $remote_fs $syslog $network
# Should-Start: $time $named
# Required-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Packet filtering firewall
# Description: The Shoreline Firewall, more commonly known as "Shorewall", is a
# Netfilter (iptables) based firewall
### END INIT INFO
# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1
# Source function library.
. /etc/init.d/functions
#
# The installer may alter this
#
. /usr/share/shorewall/shorewallrc
NAME="Shorewall-Lite firewall"
PROG="shorewall"
SHOREWALL="$SBINDIR/$PROG -l"
LOGGER="logger -i -t $PROG"
# Get startup options (override default)
OPTIONS=
SourceIfNotEmpty $SYSCONFDIR/${PROG}-lite
LOCKFILE="/var/lock/subsys/${PROG}-lite"
RETVAL=0
start() {
action $"Applying $NAME rules:" "$SHOREWALL" "$OPTIONS" start "$STARTOPTIONS" 2>&1 | "$LOGGER"
RETVAL=$?
[ $RETVAL -eq 0 ] && touch "$LOCKFILE"
return $RETVAL
}
stop() {
action $"Stoping $NAME :" "$SHOREWALL" "$OPTIONS" stop "$STOPOPTIONS" 2>&1 | "$LOGGER"
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f "$LOCKFILE"
return $RETVAL
}
restart() {
action $"Restarting $NAME rules: " "$SHOREWALL" "$OPTIONS" restart "$RESTARTOPTIONS" 2>&1 | "$LOGGER"
RETVAL=$?
return $RETVAL
}
reload() {
action $"Reloadinging $NAME rules: " "$SHOREWALL" "$OPTIONS" reload "$RELOADOPTIONS" 2>&1 | "$LOGGER"
RETVAL=$?
return $RETVAL
}
clear() {
action $"Clearing $NAME rules: " "$SHOREWALL" "$OPTIONS" clear 2>&1 | "$LOGGER"
RETVAL=$?
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
clear)
clear
;;
condrestart)
if [ -e "$LOCKFILE" ]; then
restart
fi
;;
condreload)
if [ -e "$LOCKFILE" ]; then
restart
fi
;;
condstop)
if [ -e "$LOCKFILE" ]; then
stop
fi
;;
status)
"$SHOREWALL" status
RETVAL=$?
;;
*)
echo $"Usage: ${0##*/} {start|stop|restart|reload|clear|condrestart|condstop|status}"
RETVAL=1
esac
exit $RETVAL

View File

@@ -1,13 +1,13 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# #
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.2
# #
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012,2014 - Tom Eastep (teastep@shorewall.net) # (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012,2014 - Tom Eastep (teastep@shorewall.net)
# (c) 2015 - Matt Darfeuille - (matdarf@gmail.com) # (c) 2015 - Matt Darfeuille - (matdarf@gmail.com)
# #
# On most distributions, this file should be called /etc/init.d/shorewall. # On most distributions, this file should be called /etc/init.d/shorewall.
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
RCDLINKS="2,S41 3,S41 6,K41" RCDLINKS="2,S41 3,S41 6,K41"
# #
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.2
# #
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012,2014 - Tom Eastep (teastep@shorewall.net) # (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012,2014 - Tom Eastep (teastep@shorewall.net)
# #
# On most distributions, this file should be called /etc/init.d/shorewall. # On most distributions, this file should be called /etc/init.d/shorewall.
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5 # The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V5.2
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
@@ -8,7 +8,7 @@
# #
# On most distributions, this file should be called /etc/init.d/shorewall. # On most distributions, this file should be called /etc/init.d/shorewall.
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -4,7 +4,7 @@
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -190,6 +190,9 @@ if [ -z "$BUILD" ]; then
opensuse) opensuse)
BUILD=suse BUILD=suse
;; ;;
alt|basealt|altlinux)
BUILD=alt
;;
*) *)
BUILD="$ID" BUILD="$ID"
;; ;;
@@ -198,6 +201,8 @@ if [ -z "$BUILD" ]; then
BUILD=debian BUILD=debian
elif [ -f /etc/gentoo-release ]; then elif [ -f /etc/gentoo-release ]; then
BUILD=gentoo BUILD=gentoo
elif [ -f /etc/altlinux-release ]; then
BUILD=alt
elif [ -f ${CONFDIR}/redhat-release ]; then elif [ -f ${CONFDIR}/redhat-release ]; then
BUILD=redhat BUILD=redhat
elif [ -f ${CONFDIR}/SuSE-release ]; then elif [ -f ${CONFDIR}/SuSE-release ]; then
@@ -266,6 +271,9 @@ case "$HOST" in
openwrt) openwrt)
echo "Installing OpenWRT-specific configuration..." echo "Installing OpenWRT-specific configuration..."
;; ;;
alt)
echo "Installing ALT-specific configuration...";
;;
linux) linux)
;; ;;
*) *)
@@ -418,6 +426,11 @@ echo "Capability file builder installed in ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shor
if [ -f modules ]; then if [ -f modules ]; then
install_file modules ${DESTDIR}${SHAREDIR}/$PRODUCT/modules 0600 install_file modules ${DESTDIR}${SHAREDIR}/$PRODUCT/modules 0600
echo "Modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/modules" echo "Modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/modules"
for f in modules.*; do
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
done
fi fi
if [ -f helpers ]; then if [ -f helpers ]; then
@@ -425,11 +438,6 @@ if [ -f helpers ]; then
echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers" echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers"
fi fi
for f in modules.*; do
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
done
# #
# Install the Man Pages # Install the Man Pages
# #

View File

@@ -3,7 +3,7 @@
# #
# (c) 2011,2014 - Tom Eastep (teastep@shorewall.net) # (c) 2011,2014 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -183,7 +183,7 @@
<title>See ALSO</title> <title>See ALSO</title>
<para><ulink <para><ulink
url="http://www.shorewall.net/Documentation_Index.html">http://www.shorewall.net/Documentation_Index.html</ulink></para> url="https://shorewall.org/Documentation_Index.html">https://shorewall.org/Documentation_Index.html</ulink></para>
<para>shorewall-lite(8), shorewall-accounting(5), shorewall-actions(5), <para>shorewall-lite(8), shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall-interfaces(5), shorewall-blacklist(5), shorewall-hosts(5), shorewall-interfaces(5),

View File

@@ -8,7 +8,7 @@
# "man shorewall-lite.conf" # "man shorewall-lite.conf"
# #
# Manpage also online at # Manpage also online at
# http://www.shorewall.net/manpages/shorewall-lite.conf.html # https://shorewall.org/manpages/shorewall-lite.conf.html
############################################################################### ###############################################################################
# N 0 T E # N 0 T E
############################################################################### ###############################################################################

View File

@@ -151,7 +151,7 @@ fi
remove_file ${SBINDIR}/$PRODUCT remove_file ${SBINDIR}/$PRODUCT
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then if [ -h ${SHAREDIR}/$PRODUCT/init ]; then
if [ $HOST = openwrt ]; then if [ $HOST = openwrt ]; then
if [ $configure -eq 1 ] && /etc/init.d/$PRODUCT enabled; then if [ $configure -eq 1 ] && /etc/init.d/$PRODUCT enabled; then
/etc/init.d/$PRODUCT disable /etc/init.d/$PRODUCT disable

View File

@@ -7,7 +7,7 @@
# #
# (c) 2012-2017 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2012-2017 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -27,7 +27,7 @@
# the IP address that are older than <duration> seconds. # the IP address that are older than <duration> seconds.
# Disposition - Disposition for any event generated. # Disposition - Disposition for any event generated.
# #
# For additional information, see http://www.shorewall.net/Events.html # For additional information, see https://shorewall.org/Events.html
# #
############################################################################### ###############################################################################
# DO NOT REMOVE THE FOLLOWING LINE # DO NOT REMOVE THE FOLLOWING LINE
@@ -115,8 +115,6 @@ if ( ( $targets{$action} || 0 ) & NATRULE ) {
if ( $command & $RESET_CMD ) { if ( $command & $RESET_CMD ) {
require_capability 'MARK_ANYWHERE', '"reset"', 's'; require_capability 'MARK_ANYWHERE', '"reset"', 's';
print "Resetting....\n";
my $mark = $globals{EVENT_MARK}; my $mark = $globals{EVENT_MARK};
# #
# The event mark bit must be within 32 bits # The event mark bit must be within 32 bits

View File

@@ -6,7 +6,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2012-2017 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -13,7 +13,7 @@
# address (dst) # address (dst)
# Disposition - Disposition for any rule generated. # Disposition - Disposition for any rule generated.
# #
# For additional information, see http://www.shorewall.net/Events.html # For additional information, see https://shorewall.org/Events.html
# #
############################################################################### ###############################################################################
# DO NOT REMOVE THE FOLLOWING LINE # DO NOT REMOVE THE FOLLOWING LINE

View File

@@ -13,7 +13,7 @@
# address (dst) # address (dst)
# Disposition - Disposition for any event generated. # Disposition - Disposition for any event generated.
# #
# For additional information, see http://www.shorewall.net/Events.html # For additional information, see https://shorewall.org/Events.html
# #
DEFAULTS -,ACCEPT,src DEFAULTS -,ACCEPT,src

View File

@@ -7,7 +7,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -7,7 +7,7 @@
# #
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -13,7 +13,7 @@
# 2. Copy this file to /etc/shorewall/action.<action name> # 2. Copy this file to /etc/shorewall/action.<action name>
# 3. Add the desired rules to that file. # 3. Add the desired rules to that file.
# #
# Please see http://shorewall.net/Actions.html for additional # Please see https://shorewall.org/Actions.html for additional
# information. # information.
# #
# Columns are the same as in /etc/shorewall/mangle. # Columns are the same as in /etc/shorewall/mangle.

View File

@@ -5,7 +5,7 @@
# #
# (c) 2017 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -13,7 +13,7 @@
# 2. Copy this file to /etc/shorewall/action.<action name> # 2. Copy this file to /etc/shorewall/action.<action name>
# 3. Add the desired rules to that file. # 3. Add the desired rules to that file.
# #
# Please see http://shorewall.net/Actions.html for additional # Please see https://shorewall.org/Actions.html for additional
# information. # information.
# #
# Columns are the same as in /etc/shorewall/rules. # Columns are the same as in /etc/shorewall/rules.

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Shorewall WAN Interface monitor - V4.4 # Shorewall WAN Interface monitor - V5.2
# #
# Inspired by Angsuman Chakraborty's gwping script. # Inspired by Angsuman Chakraborty's gwping script.
# #
@@ -21,7 +21,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# For information about this script, see http://www.shorewall.net/MultiISP.html#swping. # For information about this script, see https://shorewall.org/MultiISP.html#swping.
# #
########################################################################################### ###########################################################################################
# #

View File

@@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# Shorewall WAN Interface monitor - V4.4 # Shorewall WAN Interface monitor - V5.2
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
@@ -7,7 +7,7 @@
# #
# On most distributions, this file should be called /etc/init.d/shorewall. # On most distributions, this file should be called /etc/init.d/shorewall.
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of Version 2 of the GNU General Public License

View File

@@ -18,7 +18,7 @@ Shoreline Firewall (Shorewall) Version 5
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Please see http://www.shorewall.net/Install.htm for installation Please see https://shorewall.org/Install.htm for installation
instructions. instructions.

View File

@@ -0,0 +1,9 @@
#
# Shorewall -- /usr/share/shorewall/macro.IPFS-swarm
#
# This macro handles IPFS data traffic (the connection to IPFS swarm).
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
PARAM - - tcp 4001

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.Bitcoin
#
# Macro for handling Bitcoin P2P traffic
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 8333

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.BitcoinRPC
#
# Macro for handling Bitcoin RPC traffic
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 8332

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.BitcoinRegtest
#
# Macro for handling Bitcoin P2P traffic (Regtest mode)
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 18444

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.BitcoinTestnet
#
# Macro for handling Bitcoin P2P traffic (Testnet mode)
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 18333

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.BitcoinTestnetRPC
#
# Macro for handling Bitcoin RPC traffic (Testnet and Regtest mode)
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 18332

View File

@@ -0,0 +1,9 @@
#
# Shorewall --/usr/share/shorewall/macro.BitcoinZMQ
#
# Macro for handling Bitcoin ZMQ traffic
# See https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 28332

View File

@@ -0,0 +1,12 @@
#
# Shorewall -- /usr/share/shorewall/macro.Cockpit
#
# This macro handles Time protocol (RFC868).
# Unless you are supporting extremely old hardware or software,
# you shouldn't be using this. NTP is a superior alternative.
#
# By Eric Teeter
###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
PARAM - - tcp 9090

View File

@@ -0,0 +1,9 @@
#
# Shorewall -- /usr/share/shorewall/macro.IPFS-API
#
# This macro handles IPFS API port (commands for the IPFS daemon).
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
PARAM - - tcp 5001

View File

@@ -0,0 +1,9 @@
#
# Shorewall -- /usr/share/shorewall/macro.IPFS-gateway
#
# This macro handles the IPFS gateway to HTTP.
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
PARAM - - tcp 8080

View File

@@ -0,0 +1,9 @@
#
# Shorewall -- /usr/share/shorewall/macro.IPFS-swarm
#
# This macro handles IPFS data traffic (the connection to IPFS swarm).
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
PARAM - - tcp 4001

View File

@@ -0,0 +1,8 @@
#
# Shorewall -- /usr/share/shorewall/macro.ONCRPC
#
# This macro handles ONC RCP traffic (for rpcbind on Linux, etc).
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp,udp 111

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.Tor
#
# Macro for handling Tor Onion Network traffic
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 9001

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.TorBrowserBundle
#
# Macro for handling Tor Onion Network traffic provided by Tor Browser Bundle
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 9150

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.TorControl
#
# Macro for handling Tor Controller Applications traffic
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 9051

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.TorDirectory
#
# Macro for handling Tor Directory traffic
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 9030

View File

@@ -0,0 +1,8 @@
#
# Shorewall --/usr/share/shorewall/macro.TorSocks
#
# Macro for handling Tor Socks Proxy traffic
#
##############################################################################################################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
PARAM - - tcp 9050

View File

@@ -0,0 +1,9 @@
# Shorewall -- /usr/share/shorewall/macro.WUDO
#
# This macro handles WUDO (Windows Update Delivery Optimization)
#
###############################################################################
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
PARAM - - tcp 7680

View File

@@ -5,7 +5,7 @@
# #
# (c) 2013 - Tom Eastep (teastep@shorewall.net) # (c) 2013 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -3,9 +3,9 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -201,6 +201,13 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
my $prerule = ''; my $prerule = '';
my $rule2 = 0; my $rule2 = 0;
my $jump = 0; my $jump = 0;
my $raw_matches = get_inline_matches(1);
if ( $raw_matches =~ s/^\s*+// ) {
$prerule = $raw_matches;
} else {
$rule .= $raw_matches;
}
unless ( $action eq 'COUNT' ) { unless ( $action eq 'COUNT' ) {
if ( $action eq 'DONE' ) { if ( $action eq 'DONE' ) {
@@ -242,9 +249,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
$rule .= do_nfacct( $_ ); $rule .= do_nfacct( $_ );
} }
} }
} elsif ( $action eq 'INLINE' ) { } elsif ( $action ne 'INLINE' ) {
$rule .= get_inline_matches(1);
} else {
( $action, my $cmd ) = split /:/, $action; ( $action, my $cmd ) = split /:/, $action;
if ( $cmd ) { if ( $cmd ) {

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
#! /usr/bin/perl -w #! /usr/bin/perl -w
# #
# The Shoreline Firewall Packet Filtering Firewall Compiler - V5.0 # The Shoreline Firewall Packet Filtering Firewall Compiler - V5.2
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -47,19 +47,17 @@ our @EXPORT = qw( compiler );
our @EXPORT_OK = qw( $export ); our @EXPORT_OK = qw( $export );
our $VERSION = 'MODULEVERSION'; our $VERSION = 'MODULEVERSION';
our $export; our $export; # True when compiling for export
our $test; our $family; # IP address family (4 or 6)
our $family; our $have_arptables; # True if we have arptables rules
our $have_arptables;
# #
# Initilize the package-globals in the other modules # Initilize the package-globals in the other modules
# #
sub initialize_package_globals( $$$ ) { sub initialize_package_globals( $$$$ ) {
Shorewall::Config::initialize($family, $export, $_[1], $_[2]); Shorewall::Config::initialize($family, $export, $_[1], $_[2], $_[3]);
Shorewall::Chains::initialize ($family, 1, $export ); Shorewall::Chains::initialize ($family, 1, $export );
Shorewall::Zones::initialize ($family, $_[0]); Shorewall::Zones::initialize ($family, $_[0]);
Shorewall::Nat::initialize($family); Shorewall::Nat::initialize($family);
@@ -269,7 +267,9 @@ sub generate_script_2() {
'chain_exists DOCKER nat && chain_exists DOCKER && g_docker=Yes', 'chain_exists DOCKER nat && chain_exists DOCKER && g_docker=Yes',
); );
emit( 'chain_exists DOCKER-INGRESS && g_dockeringress=Yes' ); emit( 'chain_exists DOCKER-INGRESS && g_dockeringress=Yes' );
emit( 'chain_exists DOCKER-ISOLATION && g_dockernetwork=Yes' ); emit( 'chain_exists DOCKER-USER && g_dockeruser=Yes' );
emit( 'chain_exists DOCKER-ISOLATION && g_dockeriso=Yes' );
emit( 'chain_exists DOCKER-ISOLATION-STAGE-1 && g_dockerisostage=Yes' );
} }
pop_indent; pop_indent;
@@ -379,10 +379,10 @@ sub generate_script_3() {
save_progress_message 'Initializing...'; save_progress_message 'Initializing...';
if ( $export || $config{EXPORTMODULES} ) { if ( $export || $config{EXPORTMODULES} ) {
my $fn = find_file( $config{LOAD_HELPERS_ONLY} ? 'helpers' : 'modules' ); my $fn = find_file( 'helpers' );
if ( -f $fn && ( $config{EXPORTMODULES} || ( $export && ! $fn =~ "^$globals{SHAREDIR}/" ) ) ) { if ( -f $fn && ( $config{EXPORTMODULES} || ( $export && ! $fn =~ "^$globals{SHAREDIR}/" ) ) ) {
emit 'echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir'; emit 'echo MODULESDIR=\"$MODULESDIR\" > ${VARDIR}/.modulesdir';
emit 'cat > ${VARDIR}/.modules << EOF'; emit 'cat > ${VARDIR}/.modules << EOF';
open_file $fn; open_file $fn;
@@ -543,13 +543,13 @@ date > ${VARDIR}/restarted
case $COMMAND in case $COMMAND in
start) start)
mylogger kern.info "$g_product started" mylogger daemon.info "$g_product started"
;; ;;
reload) reload)
mylogger kern.info "$g_product reloaded" mylogger daemon.info "$g_product reloaded"
;; ;;
restore) restore)
mylogger kern.info "$g_product restored" mylogger daemon.info "$g_product restored"
;; ;;
esac esac
EOF EOF
@@ -586,7 +586,7 @@ sub compiler {
( '', '', -1, '', 0, '', -1, 0, 0, 0, 0, , '' , '/usr/share/shorewall/shorewallrc', '' ); ( '', '', -1, '', 0, '', -1, 0, 0, 0, 0, , '' , '/usr/share/shorewall/shorewallrc', '' );
$export = 0; $export = 0;
$test = 0; my $test = 0;
$have_arptables = 0; $have_arptables = 0;
sub validate_boolean( $ ) { sub validate_boolean( $ ) {
@@ -639,18 +639,19 @@ sub compiler {
# #
# Now that we know the address family (IPv4/IPv6), we can initialize the other modules' globals # Now that we know the address family (IPv4/IPv6), we can initialize the other modules' globals
# #
initialize_package_globals( $update, $shorewallrc, $shorewallrc1 ); initialize_package_globals( $update, $test, $shorewallrc, $shorewallrc1 );
#
# Rather than continuing to extend the argument list of Config::initialize(),
# we use a set of small functions to export settings to the Config module.
#
set_config_path( $config_path ) if $config_path; set_config_path( $config_path ) if $config_path;
set_shorewall_dir( $directory ) if $directory ne ''; set_shorewall_dir( $directory ) if $directory ne '';
$verbosity = 1 if $debug && $verbosity < 1; $verbosity = 1 if $debug && $verbosity < 1;
set_verbosity( $verbosity ); set_verbosity( $verbosity );
set_log($log, $log_verbosity) if $log; set_log($log, $log_verbosity) if $log;
set_timestamp( $timestamp ); set_timestamp( $timestamp );
set_debug( $debug , $confess ); set_debug( $debug , $confess );
set_command( 'compile', 'Compiling', 'Compiled' );
# #
# S H O R E W A L L R C , # S H O R E W A L L R C ,
# S H O R E W A L L . C O N F A N D C A P A B I L I T I E S # S H O R E W A L L . C O N F A N D C A P A B I L I T I E S
@@ -668,12 +669,7 @@ sub compiler {
# #
# Create a temp file to hold the script # Create a temp file to hold the script
# #
if ( $scriptfilename ) { create_temp_script( $scriptfilename , $export ) if $scriptfilename;
set_command( 'compile', 'Compiling', 'Compiled' );
create_temp_script( $scriptfilename , $export );
} else {
set_command( 'check', 'Checking', 'Checked' );
}
# #
# Z O N E D E F I N I T I O N # Z O N E D E F I N I T I O N
# (Produces no output to the compiled script) # (Produces no output to the compiled script)
@@ -911,7 +907,7 @@ sub compiler {
# #
# Close, rename and secure the script # Close, rename and secure the script
# #
finalize_script ( $export ); finalize_script ( $export, $test );
# #
# And generate the auxilary config file # And generate the auxilary config file
# #
@@ -976,11 +972,7 @@ sub compiler {
# #
report_used_capabilities; report_used_capabilities;
if ( $family == F_IPV4 ) { progress_message3 "$Product configuration verified";
progress_message3 "Shorewall configuration verified";
} else {
progress_message3 "Shorewall6 configuration verified";
}
} }
close_log if $log; close_log if $log;

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
# #
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -3,9 +3,9 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -34,6 +34,7 @@ use Shorewall::Zones;
use Shorewall::Chains qw(:DEFAULT :internal); use Shorewall::Chains qw(:DEFAULT :internal);
use Shorewall::Rules; use Shorewall::Rules;
use Shorewall::Proc; use Shorewall::Proc;
use sort 'stable';
use strict; use strict;
@@ -66,6 +67,9 @@ sub initialize( $ ) {
$family = shift; $family = shift;
} }
#
# Warn that the tos file is no longer supported
#
sub process_tos() { sub process_tos() {
if ( my $fn = open_file 'tos' ) { if ( my $fn = open_file 'tos' ) {
@@ -94,7 +98,7 @@ sub setup_ecn()
if ( my $fn = open_file 'ecn' ) { if ( my $fn = open_file 'ecn' ) {
first_entry( sub { progress_message2 "$doing $fn..."; first_entry( sub { progress_message2 "$doing $fn...";
require_capability 'MANGLE_ENABLED', 'Entries in the ecn file', ''; require_mangle_capability 'MANGLE_ENABLED', 'Entries in the ecn file', '';
warning_message 'ECN will not be applied to forwarded packets' unless have_capability 'MANGLE_FORWARD'; warning_message 'ECN will not be applied to forwarded packets' unless have_capability 'MANGLE_FORWARD';
} ); } );
@@ -127,7 +131,7 @@ sub setup_ecn()
} }
if ( @hosts ) { if ( @hosts ) {
my @interfaces = ( keys %interfaces ); my @interfaces = ( sortkeysiftest %interfaces );
progress_message "$doing ECN control on @interfaces..."; progress_message "$doing ECN control on @interfaces...";
@@ -145,6 +149,9 @@ sub setup_ecn()
} }
} }
#
# Add a logging rule followed by a jump
#
sub add_rule_pair( $$$$$ ) { sub add_rule_pair( $$$$$ ) {
my ($chainref , $predicate , $target , $level, $tag ) = @_; my ($chainref , $predicate , $target , $level, $tag ) = @_;
@@ -329,7 +336,7 @@ sub convert_blacklist() {
# #
# For information about entries in this file, type "man shorewall-blrules" # For information about entries in this file, type "man shorewall-blrules"
# #
# Please see http://shorewall.net/blacklisting_support.htm for additional # Please see https://shorewall.org/blacklisting_support.htm for additional
# information. # information.
# #
################################################################################################################################################################################################### ###################################################################################################################################################################################################
@@ -402,6 +409,9 @@ EOF
} }
} }
#
# Convert a routestopped file into an equivalent stoppedrules file
#
sub convert_routestopped() { sub convert_routestopped() {
if ( my $fn = open_file 'routestopped' ) { if ( my $fn = open_file 'routestopped' ) {
@@ -425,9 +435,9 @@ sub convert_routestopped() {
# For information about entries in this file, type "man shorewall-stoppedrules" # For information about entries in this file, type "man shorewall-stoppedrules"
# #
# The manpage is also online at # The manpage is also online at
# http://www.shorewall.net/manpages/shorewall-stoppedrules.html # https://shorewall.org/manpages/shorewall-stoppedrules.html
# #
# See http://shorewall.net/starting_and_stopping_shorewall.htm for additional # See https://shorewall.org/starting_and_stopping_shorewall.htm for additional
# information. # information.
# #
############################################################################### ###############################################################################
@@ -662,21 +672,28 @@ sub process_stoppedrules() {
$result; $result;
} }
#
# Generate the rules required when DOCKER=Yes
#
sub create_docker_rules() { sub create_docker_rules() {
my $bridge = $config{DOCKER_BRIDGE};
add_commands( $nat_table->{PREROUTING} , '[ -n "$g_docker" ] && echo "-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER" >&3' ); add_commands( $nat_table->{PREROUTING} , '[ -n "$g_docker" ] && echo "-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER" >&3' );
my $chainref = $filter_table->{FORWARD}; my $chainref = $filter_table->{FORWARD};
add_commands( $chainref, '[ -n "$g_dockeringress" ] && echo "-A FORWARD -j DOCKER-INGRESS" >&3', ); add_commands( $chainref, '[ -n "$g_dockeringress" ] && echo "-A FORWARD -j DOCKER-INGRESS" >&3' );
add_commands( $chainref, '[ -n "$g_dockernetwork" ] && echo "-A FORWARD -j DOCKER-ISOLATION" >&3', ); add_commands( $chainref, '[ -n "$g_dockeruser" ] && echo "-A FORWARD -j DOCKER-USER" >&3' );
add_commands( $chainref, '[ -n "$g_dockeriso" ] && echo "-A FORWARD -j DOCKER-ISOLATION" >&3' );
add_commands( $chainref, '[ -n "$g_dockerisostage" ] && echo "-A FORWARD -j DOCKER-ISOLATION-STAGE-1" >&3' );
if ( my $dockerref = known_interface('docker0') ) { if ( my $dockerref = known_interface( $bridge ) ) {
add_commands( $chainref, 'if [ -n "$g_docker" ]; then' ); add_commands( $chainref, 'if [ -n "$g_docker" ]; then' );
incr_cmd_level( $chainref ); incr_cmd_level( $chainref );
add_ijump( $chainref, j => 'DOCKER', o => 'docker0' ); add_ijump( $chainref, j => 'DOCKER', o => $bridge );
add_ijump( $chainref, j => 'ACCEPT', o => 'docker0', state_imatch 'ESTABLISHED,RELATED' ); add_ijump( $chainref, j => 'ACCEPT', o => $bridge , state_imatch 'ESTABLISHED,RELATED' );
add_ijump( $chainref, j => 'ACCEPT', i => 'docker0', o => '! docker0' ); add_ijump( $chainref, j => 'ACCEPT', i => $bridge , o => "! $bridge" );
add_ijump( $chainref, j => 'ACCEPT', i => 'docker0', o => 'docker0' ) if $dockerref->{options}{routeback}; add_ijump( $chainref, j => 'ACCEPT', i => $bridge , o => $bridge ) if $dockerref->{options}{routeback};
decr_cmd_level( $chainref ); decr_cmd_level( $chainref );
add_commands( $chainref, 'fi' ); add_commands( $chainref, 'fi' );
@@ -693,6 +710,9 @@ sub create_docker_rules() {
sub setup_mss(); sub setup_mss();
#
# Add rules generated by .conf options and interface options
#
sub add_common_rules ( $ ) { sub add_common_rules ( $ ) {
my ( $upgrade ) = @_; my ( $upgrade ) = @_;
my $interface; my $interface;
@@ -715,6 +735,7 @@ sub add_common_rules ( $ ) {
my $dbl_tag; my $dbl_tag;
my $dbl_src_target; my $dbl_src_target;
my $dbl_dst_target; my $dbl_dst_target;
my $dbl_options;
if ( $config{REJECT_ACTION} ) { if ( $config{REJECT_ACTION} ) {
process_reject_action; process_reject_action;
@@ -776,9 +797,10 @@ sub add_common_rules ( $ ) {
if ( $dbl_ipset ) { if ( $dbl_ipset ) {
if ( $val = $globals{DBL_TIMEOUT} ) { if ( $val = $globals{DBL_TIMEOUT} ) {
$dbl_src_target = $globals{DBL_OPTIONS} =~ /src-dst/ ? 'dbl_src' : 'dbl_log'; $dbl_options = $globals{DBL_OPTIONS};
$dbl_src_target = $dbl_options =~ /src-dst/ ? 'dbl_src' : 'dbl_log';
my $chainref = set_optflags( new_standard_chain( $dbl_src_target ) , DONT_OPTIMIZE | DONT_DELETE ); my $chainref = new_standard_chain( $dbl_src_target );
log_rule_limit( $dbl_level, log_rule_limit( $dbl_level,
$chainref, $chainref,
@@ -789,11 +811,11 @@ sub add_common_rules ( $ ) {
'add', 'add',
'', '',
$origin{DYNAMIC_BLACKLIST} ) if $dbl_level; $origin{DYNAMIC_BLACKLIST} ) if $dbl_level;
add_ijump_extended( $chainref, j => "SET --add-set $dbl_ipset src --exist --timeout $val", $origin{DYNAMIC_BLACKLIST} ); add_ijump_extended( $chainref, j => "SET --add-set $dbl_ipset src --exist --timeout $val", $origin{DYNAMIC_BLACKLIST} ) unless $dbl_options =~ /noupdate/;
add_ijump_extended( $chainref, j => 'DROP', $origin{DYNAMIC_BLACKLIST} ); add_ijump_extended( $chainref, j => 'DROP', $origin{DYNAMIC_BLACKLIST} );
if ( $dbl_src_target eq 'dbl_src' ) { if ( $dbl_src_target eq 'dbl_src' ) {
$chainref = set_optflags( new_standard_chain( $dbl_dst_target = 'dbl_dst' ) , DONT_OPTIMIZE | DONT_DELETE ); $chainref = new_standard_chain( $dbl_dst_target = 'dbl_dst' );
log_rule_limit( $dbl_level, log_rule_limit( $dbl_level,
$chainref, $chainref,
@@ -810,7 +832,7 @@ sub add_common_rules ( $ ) {
$dbl_dst_target = $dbl_src_target; $dbl_dst_target = $dbl_src_target;
} }
} elsif ( $dbl_level ) { } elsif ( $dbl_level ) {
my $chainref = set_optflags( new_standard_chain( $dbl_src_target = 'dbl_log' ) , DONT_OPTIMIZE | DONT_DELETE ); my $chainref = new_standard_chain( $dbl_src_target = $dbl_dst_target = 'dbl_log' );
log_rule_limit( $dbl_level, log_rule_limit( $dbl_level,
$chainref, $chainref,
@@ -1273,6 +1295,13 @@ my %maclist_targets = ( ACCEPT => { target => 'RETURN' , mangle => 1 } ,
REJECT => { target => 'reject' , mangle => 0 } , REJECT => { target => 'reject' , mangle => 0 } ,
DROP => { target => 'DROP' , mangle => 1 } ); DROP => { target => 'DROP' , mangle => 1 } );
#
# Create rules generated by the 'maclist' option and by entries in the maclist file.
#
# The function is called twice. The first call passes '1' and causes the maclist file
# to be processed. The second call passes '2' and generates the jumps for 'maclist'
# interfaces.
#
sub setup_mac_lists( $ ) { sub setup_mac_lists( $ ) {
my $phase = $_[0]; my $phase = $_[0];
@@ -1296,7 +1325,7 @@ sub setup_mac_lists( $ ) {
$maclist_interfaces{ $hostref->[0] } = 1; $maclist_interfaces{ $hostref->[0] } = 1;
} }
my @maclist_interfaces = ( keys %maclist_interfaces ); my @maclist_interfaces = ( sortkeysiftest %maclist_interfaces );
if ( $phase == 1 ) { if ( $phase == 1 ) {
@@ -1382,7 +1411,7 @@ sub setup_mac_lists( $ ) {
# #
# Generate jumps from the input and forward chains # Generate jumps from the input and forward chains
# #
for my $hostref ( @$maclist_hosts ) { for my $hostref ( $test ? sort { $a->[0] cmp $b->[0] } @$maclist_hosts : @$maclist_hosts ) {
my $interface = $hostref->[0]; my $interface = $hostref->[0];
my $ipsec = $hostref->[1]; my $ipsec = $hostref->[1];
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : (); my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
@@ -1714,9 +1743,9 @@ sub add_interface_jumps {
add_ijump( $filter_table->{input_chain $bridge }, add_ijump( $filter_table->{input_chain $bridge },
j => $inputref , j => $inputref ,
imatch_source_dev( $interface, 1 ) imatch_source_dev( $interface, 1 )
) unless $input_jump_added{$interface} || ! use_input_chain $interface, $inputref; ) unless $input_jump_added{$interface} || ! use_interface_chain( $interface, 'use_input_chain' );
unless ( $output_jump_added{$interface} || ! use_output_chain $interface, $outputref ) { unless ( $output_jump_added{$interface} || ! use_interface_chain( $interface, 'use_output_chain') ) {
add_ijump( $filter_table->{output_chain $bridge} , add_ijump( $filter_table->{output_chain $bridge} ,
j => $outputref , j => $outputref ,
imatch_dest_dev( $interface, 1 ) ) imatch_dest_dev( $interface, 1 ) )
@@ -1726,9 +1755,9 @@ sub add_interface_jumps {
add_ijump ( $filter_table->{FORWARD}, j => 'ACCEPT', imatch_source_dev( $interface) , imatch_dest_dev( $interface) ) unless $interfaceref->{nets} || ! $interfaceref->{options}{bridge}; add_ijump ( $filter_table->{FORWARD}, j => 'ACCEPT', imatch_source_dev( $interface) , imatch_dest_dev( $interface) ) unless $interfaceref->{nets} || ! $interfaceref->{options}{bridge};
add_ijump( $filter_table->{FORWARD} , j => $forwardref , imatch_source_dev( $interface ) ) if use_forward_chain( $interface, $forwardref ) && ! $forward_jump_added{$interface}++; add_ijump( $filter_table->{FORWARD} , j => $forwardref , imatch_source_dev( $interface ) ) if use_forward_chain( $interface, $forwardref ) && ! $forward_jump_added{$interface}++;
add_ijump( $filter_table->{INPUT} , j => $inputref , imatch_source_dev( $interface ) ) if use_input_chain( $interface, $inputref ) && ! $input_jump_added{$interface}++; add_ijump( $filter_table->{INPUT} , j => $inputref , imatch_source_dev( $interface ) ) if use_interface_chain( $interface, 'use_input_chain' ) && ! $input_jump_added{$interface}++;
if ( use_output_chain $interface, $outputref ) { if ( use_interface_chain( $interface, 'use_output_chain' ) ) {
add_ijump $filter_table->{OUTPUT} , j => $outputref , imatch_dest_dev( $interface ) unless get_interface_option( $interface, 'port' ) || $output_jump_added{$interface}++; add_ijump $filter_table->{OUTPUT} , j => $outputref , imatch_dest_dev( $interface ) unless get_interface_option( $interface, 'port' ) || $output_jump_added{$interface}++;
} }
} }
@@ -1775,7 +1804,7 @@ sub handle_complex_zone( $$ ) {
my $type = $zoneref->{type}; my $type = $zoneref->{type};
my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {}; my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {};
for my $interface ( keys %$source_ref ) { for my $interface ( sortkeysiftest %$source_ref ) {
my $sourcechainref = $filter_table->{forward_chain $interface}; my $sourcechainref = $filter_table->{forward_chain $interface};
my @interfacematch; my @interfacematch;
my $interfaceref = find_interface $interface; my $interfaceref = find_interface $interface;
@@ -1915,9 +1944,9 @@ sub add_output_jumps( $$$$$$$$ ) {
my $use_output = 0; my $use_output = 0;
my @dest = imatch_dest_net $net; my @dest = imatch_dest_net $net;
my @ipsec_out_match = match_ipsec_out $zone , $hostref; my @ipsec_out_match = match_ipsec_out $zone , $hostref;
my @zone_interfaces = keys %{zone_interfaces( $zone )}; my @zone_interfaces = sortkeysiftest %{zone_interfaces( $zone )};
if ( @vservers || use_output_chain( $interface, $interfacechainref ) || ( @{$interfacechainref->{rules}} && ! $chain1ref ) || @zone_interfaces > 1 ) { if ( @vservers || use_interface_chain( $interface, 'use_output_chain' ) || ( @{$interfacechainref->{rules}} && ! $chain1ref ) || @zone_interfaces > 1 ) {
# #
# - There are vserver zones (so OUTPUT will have multiple source; or # - There are vserver zones (so OUTPUT will have multiple source; or
# - We must use the interface output chain; or # - We must use the interface output chain; or
@@ -2051,7 +2080,7 @@ sub add_input_jumps( $$$$$$$$$ ) {
my @source = imatch_source_net $net; my @source = imatch_source_net $net;
my @ipsec_in_match = match_ipsec_in $zone , $hostref; my @ipsec_in_match = match_ipsec_in $zone , $hostref;
if ( @vservers || use_input_chain( $interface, $interfacechainref ) || ! $chain2 || ( @{$interfacechainref->{rules}} && ! $chain2ref ) ) { if ( @vservers || use_interface_chain( $interface, 'use_input_chain' ) || ! $chain2 || ( @{$interfacechainref->{rules}} && ! $chain2ref ) ) {
# #
# - There are vserver zones (so INPUT will have multiple destinations; or # - There are vserver zones (so INPUT will have multiple destinations; or
# - We must use the interface input chain; or # - We must use the interface input chain; or
@@ -2287,9 +2316,9 @@ sub generate_matrix() {
# #
# Take care of PREROUTING, INPUT and OUTPUT jumps # Take care of PREROUTING, INPUT and OUTPUT jumps
# #
for my $type ( keys %$source_hosts_ref ) { for my $type ( sortkeysiftest %$source_hosts_ref ) {
my $typeref = $source_hosts_ref->{$type}; my $typeref = $source_hosts_ref->{$type};
for my $interface ( keys %$typeref ) { for my $interface ( sortkeysiftest %$typeref ) {
if ( get_physical( $interface ) eq '+' ) { if ( get_physical( $interface ) eq '+' ) {
# #
# Insert the interface-specific jumps before this one which is not interface-specific # Insert the interface-specific jumps before this one which is not interface-specific
@@ -2374,9 +2403,9 @@ sub generate_matrix() {
my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT
for my $type ( keys %{$zone1ref->{hosts}} ) { for my $type ( sortkeysiftest %{$zone1ref->{hosts}} ) {
my $typeref = $zone1ref->{hosts}{$type}; my $typeref = $zone1ref->{hosts}{$type};
for my $interface ( keys %$typeref ) { for my $interface ( sortkeysiftest %$typeref ) {
for my $hostref ( @{$typeref->{$interface}} ) { for my $hostref ( @{$typeref->{$interface}} ) {
next if $hostref->{options}{sourceonly}; next if $hostref->{options}{sourceonly};
if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) { if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) {
@@ -2444,6 +2473,9 @@ sub generate_matrix() {
} }
} }
#
# Generate MSS rules
#
sub setup_mss( ) { sub setup_mss( ) {
my $clampmss = $config{CLAMPMSS}; my $clampmss = $config{CLAMPMSS};
my $option; my $option;
@@ -2505,6 +2537,7 @@ sub compile_stop_firewall( $$$$ ) {
my $input = $filter_table->{INPUT}; my $input = $filter_table->{INPUT};
my $output = $filter_table->{OUTPUT}; my $output = $filter_table->{OUTPUT};
my $forward = $filter_table->{FORWARD}; my $forward = $filter_table->{FORWARD};
my $absentminded = $config{ ADMINISABSENTMINDED };
emit <<'EOF'; emit <<'EOF';
# #
@@ -2512,7 +2545,7 @@ sub compile_stop_firewall( $$$$ ) {
# #
stop_firewall() { stop_firewall() {
EOF EOF
$output->{policy} = 'ACCEPT' if $config{ADMINISABSENTMINDED}; $output->{policy} = 'ACCEPT' if $absentminded;
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
emit <<'EOF'; emit <<'EOF';
@@ -2671,7 +2704,7 @@ EOF
# #
create_docker_rules if $config{DOCKER}; create_docker_rules if $config{DOCKER};
if ( $config{ADMINISABSENTMINDED} ) { if ( $absentminded ) {
add_ijump $filter_table ->{$_}, j => 'ACCEPT', state_imatch 'ESTABLISHED,RELATED' for qw/INPUT FORWARD/; add_ijump $filter_table ->{$_}, j => 'ACCEPT', state_imatch 'ESTABLISHED,RELATED' for qw/INPUT FORWARD/;
} }
@@ -2680,7 +2713,7 @@ EOF
add_ijump $input, j => 'ACCEPT', d => IPv6_LINKLOCAL; add_ijump $input, j => 'ACCEPT', d => IPv6_LINKLOCAL;
add_ijump $input, j => 'ACCEPT', d => IPv6_MULTICAST; add_ijump $input, j => 'ACCEPT', d => IPv6_MULTICAST;
unless ( $config{ADMINISABSENTMINDED} ) { unless ( $absentminded ) {
add_ijump $output, j => 'ACCEPT', d => IPv6_LINKLOCAL; add_ijump $output, j => 'ACCEPT', d => IPv6_LINKLOCAL;
add_ijump $output, j => 'ACCEPT', d => IPv6_MULTICAST; add_ijump $output, j => 'ACCEPT', d => IPv6_MULTICAST;
} }
@@ -2694,12 +2727,25 @@ EOF
process_stoppedrules; process_stoppedrules;
if ( $family == F_IPV6 ) {
my $chain = new_action_chain( 'filter', 'AllowICMPs' );
for my $type ( 1, 2, 3, 4, 130, 131, 132, 133, 134, 135, 136, 137, 141, 142, 143, 148, 149, 151, 152, 153 ) {
add_ijump( $chain, j => 'ACCEPT', p => IPv6_ICMP . " --icmpv6-type $type" );
}
for $chain ( $input, $output, $forward ) {
next if $chain eq $output && $absentminded;
add_ijump( $chain, j => 'AllowICMPs', p => IPv6_ICMP );
}
}
if ( have_capability 'IFACE_MATCH' ) { if ( have_capability 'IFACE_MATCH' ) {
add_ijump $input, j => 'ACCEPT', iface => '--dev-in --loopback'; add_ijump $input, j => 'ACCEPT', iface => '--dev-in --loopback';
add_ijump $output, j => 'ACCEPT', iface => '--dev-out --loopback' unless $config{ADMINISABSENTMINDED}; add_ijump $output, j => 'ACCEPT', iface => '--dev-out --loopback' unless $absentminded;
} else { } else {
add_ijump $input, j => 'ACCEPT', i => loopback_interface; add_ijump $input, j => 'ACCEPT', i => loopback_interface;
add_ijump $output, j => 'ACCEPT', o => loopback_interface unless $config{ADMINISABSENTMINDED}; add_ijump $output, j => 'ACCEPT', o => loopback_interface unless $absentminded;
} }
my $interfaces = find_interfaces_by_option 'dhcp'; my $interfaces = find_interfaces_by_option 'dhcp';
@@ -2709,7 +2755,7 @@ EOF
for my $interface ( @$interfaces ) { for my $interface ( @$interfaces ) {
add_ijump $input, j => 'ACCEPT', p => "udp --dport $ports", imatch_source_dev( $interface ); add_ijump $input, j => 'ACCEPT', p => "udp --dport $ports", imatch_source_dev( $interface );
add_ijump $output, j => 'ACCEPT', p => "udp --dport $ports", imatch_dest_dev( $interface ) unless $config{ADMINISABSENTMINDED}; add_ijump $output, j => 'ACCEPT', p => "udp --dport $ports", imatch_dest_dev( $interface ) unless $absentminded;
# #
# This might be a bridge # This might be a bridge
# #
@@ -2765,7 +2811,7 @@ EOF
emit ' emit '
set_state "Stopped" set_state "Stopped"
mylogger kern.info "$g_product Stopped" mylogger daemon.info "$g_product Stopped"
case $COMMAND in case $COMMAND in
stop|clear) stop|clear)

View File

@@ -3,9 +3,9 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -90,7 +90,7 @@ sub process_one_masq1( $$$$$$$$$$$ )
# #
# Handle early matches # Handle early matches
# #
if ( $inlinematches =~ s/s*\+// ) { if ( $inlinematches =~ s/^s*\+// ) {
$prerule = $inlinematches; $prerule = $inlinematches;
$inlinematches = ''; $inlinematches = '';
} }
@@ -316,9 +316,9 @@ sub process_one_masq1( $$$$$$$$$$$ )
fatal_error "Invalid IPv6 Address ($addr)" unless $addr =~ /^\[(.+)\]$/; fatal_error "Invalid IPv6 Address ($addr)" unless $addr =~ /^\[(.+)\]$/;
$addr = $1; $addr = $1;
$addr =~ s/\]-\[/-/;
if ( $addr =~ /^(.+)-(.+)$/ ) { if ( $addr =~ /^(.+)-(.+)$/ ) {
fatal_error "Correct address range syntax is '[<addr1>-<addr2>]'" if $addr =~ /]-\[/;
validate_range( $1, $2 ); validate_range( $1, $2 );
} else { } else {
validate_address $addr, 0; validate_address $addr, 0;
@@ -561,7 +561,7 @@ sub open_snat_for_output( $ ) {
# #
# For information about entries in this file, type "man shorewall-snat" # For information about entries in this file, type "man shorewall-snat"
# #
# See http://shorewall.net/manpages/shorewall-snat.html for additional information # See https://shorewall.org/manpages/shorewall-snat.html for additional information
EOF EOF
} else { } else {
print $snat <<'EOF'; print $snat <<'EOF';
@@ -570,7 +570,7 @@ EOF
# #
# For information about entries in this file, type "man shorewall6-snat" # For information about entries in this file, type "man shorewall6-snat"
# #
# See http://shorewall.net/manpages6/shorewall6-snat.html for additional information # See https://shorewall.org/manpages/shorewall-snat.html for additional information
EOF EOF
} }
@@ -930,7 +930,7 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
if ( $server =~ /^\[(.+)\]$/ ) { if ( $server =~ /^\[(.+)\]$/ ) {
$server = $1; $server = $1;
fatal_error "Correct address range syntax is '[<addr1>-<addr2>]'" if $server =~ /]-\[/; $server =~ s/\]-\[/-/;
assert( $server =~ /^(.+)-(.+)$/ ); assert( $server =~ /^(.+)-(.+)$/ );
( $addr1, $addr2 ) = ( $1, $2 ); ( $addr1, $addr2 ) = ( $1, $2 );
} }

View File

@@ -5,7 +5,7 @@
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #

View File

@@ -3,9 +3,9 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -60,25 +60,63 @@ our @routemarked_providers;
our %routemarked_interfaces; our %routemarked_interfaces;
our @routemarked_interfaces; our @routemarked_interfaces;
our %provider_interfaces; our %provider_interfaces;
our @load_interfaces; our @load_providers;
our $balancing; our $balancing; # True, if there are balanced providers
our $fallback; our $fallback; # True, if there are fallback providers
our $balanced_providers; our $balanced_providers; # Count of balanced providers
our $fallback_providers; our $fallback_providers; # Count of fallback providers
our $metrics; our $metrics; # True, if using statistical balancing
our $first_default_route; our $first_default_route; # True, until we generate the first 'via' clause for balanced providers
our $first_fallback_route; our $first_fallback_route; # True, until we generate the first 'via' clause for fallback providers
our $maxload; our $maxload; # Sum of 'load' values
our $tproxies; our $tproxies; # Count of tproxy providers
our %providers; our %providers; # Provider table
#
# %provider_table { <provider> => { provider => <provider name>,
# number => <provider number>,
# id => <name> or <number> depending on USE_RT_NAMES,
# rawmark => <specified mark value>,
# mark => <mark, in hex>,
# interface => <logical interface>,
# physical => <physical interface>,
# optional => {0|1},
# wildcard => <from interface>,
# gateway => <gateway>,
# gatewaycase => { 'detect', 'none', or 'specified' },
# shared => <true, if multiple providers through this interface>,
# copy => <contents of the COPY column>,
# balance => <balance count>,
# pref => <route rules preference (priority) value>,
# mtu => <mtu>,
# noautosrc => {0|1} based on [no]autosrc setting,
# track => {0|1} based on 'track' setting,
# loose => {0|1} based on 'loose' setting,
# duplicate => <contents of the DUPLICATE column>,
# address => If {shared} above, then the local IP address.
# Otherwise, the value of the 'src' option,
# mac => Mac address of gateway, if {shared} above,
# tproxy => {0|1},
# load => <load % for statistical balancing>,
# pseudo => {0|1}. 1 means this is an optional interface and not
# a real provider,
# what => 'provider' or 'interface' depending on {pseudo} above,
# hostroute => {0|1} based on [no]hostroute setting,
# rules => ( <routing rules> ),
# persistent_rules => ( <persistent routing rules> ),
# routes => ( <routes> ),
# persistent_routes => ( <persistent routes> ),
# persistent => {0|1} depending on 'persistent' setting,
# routedests => { <subnet> => 1 , ... }, (used for duplicate destination detection),
# origin => <filename and linenumber where provider/interface defined>
# }
our @providers; our @providers; # Provider names. Only declared names are included in this array.
our $family; our $family; # Address family
our $lastmark; our $lastmark; # Highest assigned mark
use constant { ROUTEMARKED_SHARED => 1, ROUTEMARKED_UNSHARED => 2 }; use constant { ROUTEMARKED_SHARED => 1, ROUTEMARKED_UNSHARED => 2 };
@@ -99,7 +137,7 @@ sub initialize( $ ) {
%routemarked_interfaces = (); %routemarked_interfaces = ();
@routemarked_interfaces = (); @routemarked_interfaces = ();
%provider_interfaces = (); %provider_interfaces = ();
@load_interfaces = (); @load_providers = ();
$balancing = 0; $balancing = 0;
$balanced_providers = 0; $balanced_providers = 0;
$fallback_providers = 0; $fallback_providers = 0;
@@ -132,7 +170,6 @@ sub setup_route_marking() {
# #
# Clear the mark -- we have seen cases where the mark is non-zero even in the raw table chains! # Clear the mark -- we have seen cases where the mark is non-zero even in the raw table chains!
# #
if ( $config{ZERO_MARKS} ) { if ( $config{ZERO_MARKS} ) {
add_ijump( $mangle_table->{$_}, j => 'MARK', targetopts => '--set-mark 0' ) for qw/PREROUTING OUTPUT/; add_ijump( $mangle_table->{$_}, j => 'MARK', targetopts => '--set-mark 0' ) for qw/PREROUTING OUTPUT/;
} }
@@ -163,8 +200,8 @@ sub setup_route_marking() {
add_ijump_extended $mangle_table->{OUTPUT} , j => $chainref2, $origin, mark => "--mark $mark/$mask"; add_ijump_extended $mangle_table->{OUTPUT} , j => $chainref2, $origin, mark => "--mark $mark/$mask";
if ( have_ipsec ) { if ( have_ipsec ) {
if ( have_capability( 'MARK_ANYWHERE' ) ) { if ( have_capability( 'MARK_ANYWHERE' ) && ( my $chainref = $filter_table->{forward_chain($interface)} ) ) {
add_ijump_extended $filter_table->{forward_chain($interface)}, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", , state_imatch('NEW'), policy => '--dir in --pol ipsec'; add_ijump_extended $chainref, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", , state_imatch('NEW'), policy => '--dir in --pol ipsec';
} elsif ( have_capability( 'MANGLE_FORWARD' ) ) { } elsif ( have_capability( 'MANGLE_FORWARD' ) ) {
add_ijump_extended $mangle_table->{FORWARD}, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", i => $physical, state_imatch('NEW'), policy => '--dir in --pol ipsec'; add_ijump_extended $mangle_table->{FORWARD}, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", i => $physical, state_imatch('NEW'), policy => '--dir in --pol ipsec';
} }
@@ -185,16 +222,16 @@ sub setup_route_marking() {
add_ijump $chainref, j => 'CONNMARK', targetopts => "--save-mark --mask $mask", mark => "! --mark 0/$mask"; add_ijump $chainref, j => 'CONNMARK', targetopts => "--save-mark --mask $mask", mark => "! --mark 0/$mask";
} }
if ( @load_interfaces ) { if ( @load_providers ) {
my $chainref1 = new_chain 'mangle', 'balance'; my $chainref1 = new_chain 'mangle', 'balance';
my @match; my @match;
add_ijump $chainref, g => $chainref1, mark => "--mark 0/$mask"; add_ijump $chainref, g => $chainref1, mark => "--mark 0/$mask";
add_ijump $mangle_table->{OUTPUT}, j => $chainref1, state_imatch( 'NEW,RELATED' ), mark => "--mark 0/$mask"; add_ijump $mangle_table->{OUTPUT}, j => $chainref1, state_imatch( 'NEW,RELATED' ), mark => "--mark 0/$mask";
for my $physical ( @load_interfaces ) { for my $provider ( @load_providers ) {
my $chainref2 = new_chain( 'mangle', load_chain( $physical ) ); my $chainref2 = new_chain( 'mangle', load_chain( $provider ) );
set_optflags( $chainref2, DONT_OPTIMIZE | DONT_MOVE | DONT_DELETE ); set_optflags( $chainref2, DONT_OPTIMIZE | DONT_MOVE | DONT_DELETE );
@@ -446,7 +483,7 @@ sub process_a_provider( $ ) {
fatal_error 'NAME must be specified' if $table eq '-'; fatal_error 'NAME must be specified' if $table eq '-';
unless ( $pseudo ) { unless ( $pseudo ) {
fatal_error "Invalid Provider Name ($table)" unless $table =~ /^[\w]+$/; fatal_error "Invalid Provider Name ($table)" unless $table =~ /^[A-Za-z][\w]*$/;
my $num = numeric_value $number; my $num = numeric_value $number;
@@ -557,7 +594,7 @@ sub process_a_provider( $ ) {
unless ( $options eq '-' ) { unless ( $options eq '-' ) {
for my $option ( split_list $options, 'option' ) { for my $option ( split_list $options, 'option' ) {
if ( $option eq 'track' ) { if ( $option eq 'track' ) {
require_capability( 'MANGLE_ENABLED' , q(The 'track' option) , 's' ); require_mangle_capability( 'MANGLE_ENABLED' , q(The 'track' option) , 's' );
$track = 1; $track = 1;
} elsif ( $option eq 'notrack' ) { } elsif ( $option eq 'notrack' ) {
$track = 0; $track = 0;
@@ -636,6 +673,7 @@ sub process_a_provider( $ ) {
} }
fatal_error "A provider interface must have at least one associated zone" unless $tproxy || %{interface_zones($interface)}; fatal_error "A provider interface must have at least one associated zone" unless $tproxy || %{interface_zones($interface)};
fatal_error "An interface supporting multiple providers may not be optional" if $shared && $optional;
unless ( $pseudo ) { unless ( $pseudo ) {
if ( $local ) { if ( $local ) {
@@ -676,8 +714,7 @@ sub process_a_provider( $ ) {
$mark = ( $lastmark += ( 1 << $config{PROVIDER_OFFSET} ) ) if $mark eq '-' && $track; $mark = ( $lastmark += ( 1 << $config{PROVIDER_OFFSET} ) ) if $mark eq '-' && $track;
if ( $mark ne '-' ) { if ( $mark ne '-' ) {
require_mangle_capability( 'MANGLE_ENABLED' , 'Provider marks' , '' );
require_capability( 'MANGLE_ENABLED' , 'Provider marks' , '' );
if ( $tproxy && ! $local ) { if ( $tproxy && ! $local ) {
$val = $globals{TPROXY_MARK}; $val = $globals{TPROXY_MARK};
@@ -779,7 +816,7 @@ sub process_a_provider( $ ) {
push @routemarked_providers, $providers{$table}; push @routemarked_providers, $providers{$table};
} }
push @load_interfaces, $physical if $load; push @load_providers, $table if $load;
push @providers, $table; push @providers, $table;
@@ -941,8 +978,9 @@ sub add_a_provider( $$ ) {
} }
} }
emit( "echo $load > \${VARDIR}/${physical}_load", emit( "echo $load > \${VARDIR}/${table}_load",
'echo ' . in_hex( $mark ) . '/' . in_hex( $globals{PROVIDER_MASK} ) . " > \${VARDIR}/${physical}_mark" ) if $load; 'echo ' . in_hex( $mark ) . '/' . in_hex( $globals{PROVIDER_MASK} ) . " > \${VARDIR}/${table}_mark",
"echo $physical > \${VARDIR}/${table}_interface" ) if $load;
emit( '', emit( '',
"cat <<EOF >> \${VARDIR}/undo_${table}_routing" ); "cat <<EOF >> \${VARDIR}/undo_${table}_routing" );
@@ -1097,7 +1135,7 @@ CEOF
$weight = 1; $weight = 1;
} }
emit ( "distribute_load $maxload @load_interfaces" ) if $load; emit ( "distribute_load $maxload @load_providers" ) if $load;
unless ( $shared ) { unless ( $shared ) {
emit( "setup_${dev}_tc" ) if $tcdevices->{$interface}; emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
@@ -1142,14 +1180,14 @@ CEOF
emit "fi\n"; emit "fi\n";
if ( get_interface_option( $interface, 'used_address_variable' ) ) { if ( get_interface_option( $interface, 'used_address_variable' ) ) {
my $variable = interface_address( $interface ); my $variable = get_interface_address( $interface );
emit( "echo \$$variable > \${VARDIR}/${physical}.address" ); emit( "echo $variable > \${VARDIR}/${physical}.address" );
} }
if ( get_interface_option( $interface, 'used_gateway_variable' ) ) { if ( get_interface_option( $interface, 'used_gateway_variable' ) ) {
my $variable = interface_gateway( $interface ); my $variable = get_interface_gateway( $interface );
emit( qq(echo "\$$variable" > \${VARDIR}/${physical}.gateway\n) ); emit( qq(echo "$variable" > \${VARDIR}/${physical}.gateway\n) );
} }
} else { } else {
emit( qq(progress_message "Provider $table ($number) Started") ); emit( qq(progress_message "Provider $table ($number) Started") );
@@ -1244,7 +1282,7 @@ CEOF
} }
emit ( '', emit ( '',
"distribute_load $maxload @load_interfaces" ) if $load; "distribute_load $maxload @load_providers" ) if $load;
if ( $persistent ) { if ( $persistent ) {
emit ( '', emit ( '',
@@ -1615,7 +1653,7 @@ sub finish_providers() {
emit( 'fi', emit( 'fi',
'' ); '' );
} else { } else {
if ( ( $fallback || @load_interfaces ) && $config{USE_DEFAULT_RT} ) { if ( ( $fallback || @load_providers ) && $config{USE_DEFAULT_RT} ) {
emit ( q(#), emit ( q(#),
q(# Delete any default routes in the 'main' table), q(# Delete any default routes in the 'main' table),
q(#), q(#),
@@ -1854,8 +1892,8 @@ sub map_provider_to_interface() {
my $haveoptional; my $haveoptional;
for my $providerref ( values %providers ) { for my $provider ( @providers ) {
if ( $providerref->{optional} ) { if ( ( my $providerref=$providers{$provider} )->{optional} ) {
unless ( $haveoptional++ ) { unless ( $haveoptional++ ) {
emit( 'if [ -n "$interface" ]; then', emit( 'if [ -n "$interface" ]; then',
' case $interface in' ); ' case $interface in' );
@@ -1909,24 +1947,24 @@ sub setup_providers() {
pop_indent; pop_indent;
emit 'fi'; emit 'fi';
setup_route_marking if @routemarked_interfaces || @load_interfaces; setup_route_marking if @routemarked_interfaces || @load_providers;
} else { } else {
emit "\nif [ -z \"\$g_noroutes\" ]; then"; emit "\nif [ -z \"\$g_noroutes\" ]; then";
push_indent; push_indent;
emit "undo_routing";
emit "restore_default_route $config{USE_DEFAULT_RT}";
if ( $pseudoproviders ) { if ( $pseudoproviders ) {
emit ''; emit '';
emit "start_$providers{$_}->{what}_$_" for @providers; emit "start_$providers{$_}->{what}_$_" for @providers;
emit '';
} }
emit "undo_routing";
emit "restore_default_route $config{USE_DEFAULT_RT}";
my $standard_routes = @{$providers{main}{routes}} || @{$providers{default}{routes}}; my $standard_routes = @{$providers{main}{routes}} || @{$providers{default}{routes}};
if ( $config{NULL_ROUTE_RFC1918} ) { if ( $config{NULL_ROUTE_RFC1918} ) {
emit '';
setup_null_routing; setup_null_routing;
emit "\nrun_ip route flush cache" unless $standard_routes; emit "\nrun_ip route flush cache" unless $standard_routes;
} }
@@ -2016,8 +2054,7 @@ sub compile_updown() {
); );
} }
my @nonshared = ( grep $providers{$_}->{optional}, my @nonshared = ( grep $providers{$_}->{optional}, sortvaluesiftest %provider_interfaces );
values %provider_interfaces );
if ( @nonshared ) { if ( @nonshared ) {
my $interfaces = join( '|', map $providers{$_}->{physical}, @nonshared ); my $interfaces = join( '|', map $providers{$_}->{physical}, @nonshared );
@@ -2032,7 +2069,7 @@ sub compile_updown() {
q( COMMAND=enable) , q( COMMAND=enable) ,
q( detect_configuration $1), q( detect_configuration $1),
q( enable_provider $1), q( enable_provider $1),
q( elif [ "$PHASE" != post-down ]; then # pre-down or not Debian) , q( else),
q( progress_message3 "Attempting disable on interface $1") , q( progress_message3 "Attempting disable on interface $1") ,
q( COMMAND=disable) , q( COMMAND=disable) ,
q( detect_configuration $1), q( detect_configuration $1),
@@ -2073,7 +2110,7 @@ sub compile_updown() {
emit( ' progress_message3 "$g_product attempting $COMMAND"', emit( ' progress_message3 "$g_product attempting $COMMAND"',
' detect_configuration', ' detect_configuration',
' define_firewall', ' define_firewall',
' elif [ "$PHASE" != pre-down ]; then # Not Debian pre-down phase' ' else' ,
); );
push_indent; push_indent;
@@ -2208,10 +2245,12 @@ sub handle_optional_interfaces() {
# names but they might derive from wildcard interface entries. Optional interfaces which do not have # names but they might derive from wildcard interface entries. Optional interfaces which do not have
# wildcard physical names are also included in the providers table. # wildcard physical names are also included in the providers table.
# #
for my $providerref ( grep $_->{optional} , values %providers ) { for my $provider ( @providers ) {
if ( ( my $providerref = $providers{$provider} )->{optional} ) {
push @interfaces, $providerref->{interface}; push @interfaces, $providerref->{interface};
$wildcards ||= $providerref->{wildcard}; $wildcards ||= $providerref->{wildcard};
} }
}
# #
# Now do the optional wild interfaces # Now do the optional wild interfaces
@@ -2258,17 +2297,7 @@ sub handle_optional_interfaces() {
emit( "$physical)" ), push_indent if $wildcards; emit( "$physical)" ), push_indent if $wildcards;
if ( $provider eq $physical ) {
#
# Just an optional interface, or provider and interface are the same
#
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then); emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
} else {
#
# Provider
#
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
}
push_indent; push_indent;
@@ -2285,22 +2314,22 @@ sub handle_optional_interfaces() {
emit( 'fi' ); emit( 'fi' );
if ( get_interface_option( $interface, 'used_address_variable' ) ) { if ( get_interface_option( $interface, 'used_address_variable' ) ) {
my $variable = interface_address( $interface ); my $variable = get_interface_address( $interface );
emit( '', emit( '',
"if [ -f \${VARDIR}/${physical}.address ]; then", "if [ -f \${VARDIR}/${physical}.address ]; then",
" if [ \$(cat \${VARDIR}/${physical}.address) != \$$variable ]; then", " if [ \$(cat \${VARDIR}/${physical}.address) != $variable ]; then",
' g_forcereload=Yes', ' g_forcereload=Yes',
' fi', ' fi',
'fi' ); 'fi' );
} }
if ( get_interface_option( $interface, 'used_gateway_variable' ) ) { if ( get_interface_option( $interface, 'used_gateway_variable' ) ) {
my $variable = interface_gateway( $interface ); my $variable = get_interface_gateway( $interface );
emit( '', emit( '',
"if [ -f \${VARDIR}/${physical}.gateway ]; then", "if [ -f \${VARDIR}/${physical}.gateway ]; then",
" if [ \$(cat \${VARDIR}/${physical}.gateway) != \"\$$variable\" ]; then", " if [ \$(cat \${VARDIR}/${physical}.gateway) != \"$variable\" ]; then",
' g_forcereload=Yes', ' g_forcereload=Yes',
' fi', ' fi',
'fi' ); 'fi' );
@@ -2485,7 +2514,7 @@ sub handle_stickiness( $ ) {
} }
} }
if ( @routemarked_providers || @load_interfaces ) { if ( @routemarked_providers || @load_providers ) {
delete_jumps $mangle_table->{PREROUTING}, $setstickyref unless @{$setstickyref->{rules}}; delete_jumps $mangle_table->{PREROUTING}, $setstickyref unless @{$setstickyref->{rules}};
delete_jumps $mangle_table->{OUTPUT}, $setstickoref unless @{$setstickoref->{rules}}; delete_jumps $mangle_table->{OUTPUT}, $setstickoref unless @{$setstickoref->{rules}};
} }
@@ -2493,9 +2522,9 @@ sub handle_stickiness( $ ) {
sub setup_load_distribution() { sub setup_load_distribution() {
emit ( '', emit ( '',
"distribute_load $maxload @load_interfaces" , "distribute_load $maxload @load_providers" ,
'' ''
) if @load_interfaces; ) if @load_providers;
} }
1; 1;

View File

@@ -5,7 +5,7 @@
# #
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -155,7 +155,7 @@ sub setup_proxy_arp() {
emit ''; emit '';
for my $interface ( keys %reset ) { for my $interface ( sortkeysiftest %reset ) {
unless ( $set{interface} ) { unless ( $set{interface} ) {
my $physical = get_physical $interface; my $physical = get_physical $interface;
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" , emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
@@ -164,7 +164,7 @@ sub setup_proxy_arp() {
} }
} }
for my $interface ( keys %set ) { for my $interface ( sortkeysiftest %set ) {
my $physical = get_physical $interface; my $physical = get_physical $interface;
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" , emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
" echo 1 > /proc/sys/net/ipv$family/conf/$physical/$proc_file" ); " echo 1 > /proc/sys/net/ipv$family/conf/$physical/$proc_file" );

View File

@@ -3,9 +3,9 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2009-2018 - Tom Eastep (teastep@shorewall.net) # (c) 2009-2019 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -70,6 +70,13 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
my $zone; my $zone;
my $restriction = PREROUTE_RESTRICT; my $restriction = PREROUTE_RESTRICT;
my $raw_matches = get_inline_matches(0);
my $prerule = '';
if ( $raw_matches =~ /^s*+/ ) {
$prerule = $raw_matches;
$raw_matches = '';
}
if ( $chainref ) { if ( $chainref ) {
$restriction = OUTPUT_RESTRICT if $chainref->{name} eq 'OUTPUT'; $restriction = OUTPUT_RESTRICT if $chainref->{name} eq 'OUTPUT';
@@ -206,10 +213,11 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
expand_rule( $chainref , expand_rule( $chainref ,
$restriction , $restriction ,
'', $prerule,
do_proto( $proto, $ports, $sports ) . do_proto( $proto, $ports, $sports ) .
do_user ( $user ) . do_user ( $user ) .
do_condition( $switch , $chainref->{name} ), do_condition( $switch , $chainref->{name} ) .
$raw_matches ,
$source , $source ,
$dest , $dest ,
'' , '' ,
@@ -316,7 +324,7 @@ sub setup_conntrack($) {
{ source => 0, dest => 1, proto => 2, dport => 3, sport => 4, user => 5, switch => 6 } ); { source => 0, dest => 1, proto => 2, dport => 3, sport => 4, user => 5, switch => 6 } );
$action = 'NOTRACK'; $action = 'NOTRACK';
} else { } else {
( $action, $source, $dest, $protos, $ports, $sports, $user, $switch ) = split_line1 'Conntrack File', { action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6, switch => 7 }; ( $action, $source, $dest, $protos, $ports, $sports, $user, $switch ) = split_line2( 'Conntrack File', { action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6, switch => 7 }, undef, undef, 1 );
} }
$empty = 0; $empty = 0;

View File

@@ -3,9 +3,9 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at https://shorewall.org
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -292,6 +292,8 @@ our $mangle;
our $sticky; our $sticky;
our $excludefw;
our $divertref; # DIVERT chain our $divertref; # DIVERT chain
our %validstates = ( NEW => 0, our %validstates = ( NEW => 0,
@@ -365,6 +367,10 @@ sub initialize( $ ) {
# #
%actions = (); %actions = ();
# #
# Count of 'all[+]=' encountered
#
$excludefw = 0;
#
# Action variants actually used. Key is <action>:<loglevel>:<tag>:<caller>:<params>; value is corresponding chain name # Action variants actually used. Key is <action>:<loglevel>:<tag>:<caller>:<params>; value is corresponding chain name
# #
%usedactions = (); %usedactions = ();
@@ -437,6 +443,7 @@ sub convert_to_policy_chain($$$$$$)
my ($chainref, $source, $dest, $policy, $provisional, $audit ) = @_; my ($chainref, $source, $dest, $policy, $provisional, $audit ) = @_;
$chainref->{is_policy} = 1; $chainref->{is_policy} = 1;
$chainref->{wild} = $source eq 'all' || $dest eq 'all';
$chainref->{policy} = $policy; $chainref->{policy} = $policy;
$chainref->{provisional} = $provisional; $chainref->{provisional} = $provisional;
$chainref->{audit} = $audit; $chainref->{audit} = $audit;
@@ -605,8 +612,8 @@ sub process_policy_actions( $$$ ) {
# #
# Verify an NFQUEUE specification and return the appropriate ip[6]tables target # Verify an NFQUEUE specification and return the appropriate ip[6]tables target
# #
sub handle_nfqueue( $$ ) { sub handle_nfqueue( $ ) {
my ($params, $allow_bypass ) = @_; my ($params) = @_;
my ( $action, $bypass, $fanout ); my ( $action, $bypass, $fanout );
my ( $queue1, $queue2, $queuenum1, $queuenum2 ); my ( $queue1, $queue2, $queuenum1, $queuenum2 );
@@ -619,7 +626,6 @@ sub handle_nfqueue( $$ ) {
if ( supplied $queue ) { if ( supplied $queue ) {
if ( $queue eq 'bypass' ) { if ( $queue eq 'bypass' ) {
fatal_error "'bypass' is not allowed in this context" unless $allow_bypass;
fatal_error "Invalid NFQUEUE options (bypass,$bypass)" if supplied $bypass; fatal_error "Invalid NFQUEUE options (bypass,$bypass)" if supplied $bypass;
return 'NFQUEUE --queue-bypass'; return 'NFQUEUE --queue-bypass';
} }
@@ -647,7 +653,6 @@ sub handle_nfqueue( $$ ) {
if ( supplied $bypass ) { if ( supplied $bypass ) {
fatal_error "Invalid NFQUEUE option ($bypass)" if $bypass ne 'bypass'; fatal_error "Invalid NFQUEUE option ($bypass)" if $bypass ne 'bypass';
fatal_error "'bypass' is not allowed in this context" unless $allow_bypass;
$bypass =' --queue-bypass'; $bypass =' --queue-bypass';
} else { } else {
@@ -672,14 +677,42 @@ sub process_a_policy1($$$$$$$) {
my ( $client, $server, $originalpolicy, $loglevel, $synparams, $connlimit, $intrazone ) = @_; my ( $client, $server, $originalpolicy, $loglevel, $synparams, $connlimit, $intrazone ) = @_;
my $clientwild = ( "\L$client" =~ /^all(\+)?$/ ); my $clientwild = ( "\L$client" =~ /^all(\+)?(?:!(.+))?$/ );
my $clientexclude;
my %clientexcluded;
$intrazone ||= $clientwild && $1; if ( $clientwild ) {
$intrazone ||= $1;
if ( $clientexclude = $2 ) {
for my $client ( split_list( $clientexclude, 'zone' ) ) {
fatal_error "Undefined zone ($client)" unless defined_zone( $client );
$clientexcluded{$client} = 1;
}
$client = 'all';
}
}
fatal_error "Undefined zone ($client)" unless $clientwild || defined_zone( $client ); fatal_error "Undefined zone ($client)" unless $clientwild || defined_zone( $client );
my $serverwild = ( "\L$server" =~ /^all(\+)?/ ); my $serverwild = ( "\L$server" =~ /^all(\+)?(?:!(.+))?/ );
$intrazone ||= ( $serverwild && $1 ); my $serverexclude;
my %serverexcluded;
if ( $serverwild ) {
$intrazone ||= $1;
if ( $serverexclude = $2 ) {
for my $server ( split_list( $serverexclude, 'zone' ) ) {
fatal_error "Undefined zone ($server)" unless defined_zone( $server );
$serverexcluded{$server} = 1;
}
$server = 'all';
}
}
fatal_error "Undefined zone ($server)" unless $serverwild || defined_zone( $server ); fatal_error "Undefined zone ($server)" unless $serverwild || defined_zone( $server );
@@ -687,7 +720,13 @@ sub process_a_policy1($$$$$$$) {
require_capability 'AUDIT_TARGET', ":audit", "s" if $audit; require_capability 'AUDIT_TARGET', ":audit", "s" if $audit;
my ( $policy, $pactions ) = split( /:/, $originalpolicy, 2 ); my ( $policy, $pactions );
if ( $originalpolicy =~ /^NFQUEUE\((.*?)\)(?::?(.*))/ ) {
( $policy, $pactions ) = ( "NFQUEUE($1)", $2 );
} else {
( $policy, $pactions ) = split( /:/, $originalpolicy, 2 );
}
fatal_error "Invalid or missing POLICY ($originalpolicy)" unless $policy; fatal_error "Invalid or missing POLICY ($originalpolicy)" unless $policy;
@@ -702,9 +741,7 @@ sub process_a_policy1($$$$$$$) {
my $pactionref = process_policy_actions( $originalpolicy, $policy, $pactions ); my $pactionref = process_policy_actions( $originalpolicy, $policy, $pactions );
if ( defined $queue ) { if ( defined $queue ) {
$policy = handle_nfqueue( $queue, $policy = handle_nfqueue( $queue );
0 # Don't allow 'bypass'
);
} elsif ( $policy eq 'NONE' ) { } elsif ( $policy eq 'NONE' ) {
fatal_error "NONE policy not allowed with \"all\"" fatal_error "NONE policy not allowed with \"all\""
if $clientwild || $serverwild; if $clientwild || $serverwild;
@@ -762,20 +799,20 @@ sub process_a_policy1($$$$$$$) {
if ( $clientwild ) { if ( $clientwild ) {
if ( $serverwild ) { if ( $serverwild ) {
for my $zone ( @zonelist ) { for my $zone ( grep( ! $clientexcluded{$_}, @zonelist ) ) {
for my $zone1 ( @zonelist ) { for my $zone1 ( grep( ! $serverexcluded{zone}, @zonelist ) ) {
set_policy_chain $zone, $zone1, $chainref, $policy, $intrazone; set_policy_chain $zone, $zone1, $chainref, $policy, $intrazone;
print_policy $zone, $zone1, $originalpolicy, $chain; print_policy $zone, $zone1, $originalpolicy, $chain;
} }
} }
} else { } else {
for my $zone ( all_zones ) { for my $zone ( grep( ! $clientexcluded{$_}, all_zones ) ) {
set_policy_chain $zone, $server, $chainref, $policy, $intrazone; set_policy_chain $zone, $server, $chainref, $policy, $intrazone;
print_policy $zone, $server, $originalpolicy, $chain; print_policy $zone, $server, $originalpolicy, $chain;
} }
} }
} elsif ( $serverwild ) { } elsif ( $serverwild ) {
for my $zone ( @zonelist ) { for my $zone ( grep( ! $serverexcluded{$_}, @zonelist ) ) {
set_policy_chain $client, $zone, $chainref, $policy, $intrazone; set_policy_chain $client, $zone, $chainref, $policy, $intrazone;
print_policy $client, $zone, $originalpolicy, $chain; print_policy $client, $zone, $originalpolicy, $chain;
} }
@@ -802,11 +839,15 @@ sub process_a_policy() {
my ( $intrazone, $clientlist, $serverlist ); my ( $intrazone, $clientlist, $serverlist );
if ( $clientlist = ( $clients =~ /,/ ) ) { if ( $clients =~ /^all(\+)?!/ ) {
$intrazone = $1;
} elsif ( $clientlist = ( $clients =~ /,/ ) ) {
$intrazone = ( $clients =~ s/\+$// ); $intrazone = ( $clients =~ s/\+$// );
} }
if ( $serverlist = ( $servers =~ /,/ ) ) { if ( $servers =~ /^all(\+)?!/ ) {
$intrazone = $1;
} elsif ( $serverlist = ( $servers =~ /,/ ) ) {
$intrazone ||= ( $servers =~ s/\+$// ); $intrazone ||= ( $servers =~ s/\+$// );
} }
@@ -816,12 +857,14 @@ sub process_a_policy() {
if ( $clientlist || $serverlist ) { if ( $clientlist || $serverlist ) {
for my $client ( split_list( $clients, 'zone' ) ) { for my $client ( split_list( $clients, 'zone' ) ) {
fatal_error "'all' is not allowed in a source zone list" if $clientlist && $client =~ /^all\b/;
for my $server ( split_list( $servers, 'zone' ) ) { for my $server ( split_list( $servers, 'zone' ) ) {
fatal_error "'all' is not allowed in a destination zone list" if $serverlist && $server =~ /^all\b/;
process_a_policy1( $client, $server, $policy, $loglevel, $synparams, $connlimit, $intrazone ) if $intrazone || $client ne $server; process_a_policy1( $client, $server, $policy, $loglevel, $synparams, $connlimit, $intrazone ) if $intrazone || $client ne $server;
} }
} }
} else { } else {
process_a_policy1( $clients, $servers, $policy, $loglevel, $synparams, $connlimit, 0 ); process_a_policy1( $clients, $servers, $policy, $loglevel, $synparams, $connlimit, $intrazone );
} }
} }
@@ -1105,7 +1148,7 @@ sub complete_policy_chains() {
} }
} }
if ( $name =~ /^all[-2]|[-2]all$/ ) { if ( $chainref->{wild} ) {
add_policy_rules $chainref , $policy, $loglevel , $defaults, $config{MULTICAST}; add_policy_rules $chainref , $policy, $loglevel , $defaults, $config{MULTICAST};
} }
} }
@@ -1210,6 +1253,7 @@ sub finish_chain_section ($$$) {
$state ) = @_; $state ) = @_;
my $chain = $chainref->{name}; my $chain = $chainref->{name};
my $save_comment = push_comment; my $save_comment = push_comment;
my $wild = $chainref->{wild} && ! $config{EXPAND_RULES};
my %state; my %state;
$state{$_} = 1 for split ',', $state; $state{$_} = 1 for split ',', $state;
@@ -1220,6 +1264,7 @@ sub finish_chain_section ($$$) {
$chain1ref->{sections}{$_} = 1 for keys %state; $chain1ref->{sections}{$_} = 1 for keys %state;
unless ( $wild ) {
for ( qw( ESTABLISHED RELATED INVALID UNTRACKED ) ) { for ( qw( ESTABLISHED RELATED INVALID UNTRACKED ) ) {
if ( $state{$_} ) { if ( $state{$_} ) {
my ( $char, $level, $tag, $target , $origin, $level_origin ) = @{$statetable{$_}}; my ( $char, $level, $tag, $target , $origin, $level_origin ) = @{$statetable{$_}};
@@ -1289,6 +1334,7 @@ sub finish_chain_section ($$$) {
add_ijump( $chain1ref, j => 'ACCEPT', state_imatch join(',', @state ) ) if @state; add_ijump( $chain1ref, j => 'ACCEPT', state_imatch join(',', @state ) ) if @state;
} }
}
if ($sections{NEW} ) { if ($sections{NEW} ) {
if ( $chain1ref->{is_policy} ) { if ( $chain1ref->{is_policy} ) {
@@ -1564,8 +1610,8 @@ sub merge_levels ($$) {
return $subordinate if $subordinate =~ /^(?:FORMAT|COMMENT|DEFAULTS?)$/; return $subordinate if $subordinate =~ /^(?:FORMAT|COMMENT|DEFAULTS?)$/;
my @supparts = split /:/, $superior; my @supparts = split_list2( $superior , 'Action' );
my @subparts = split /:/, $subordinate; my @subparts = split_list2( $subordinate , 'Action' );
my $subparts = @subparts; my $subparts = @subparts;
@@ -2609,7 +2655,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
# #
# Handle early matches # Handle early matches
# #
if ( $raw_matches =~ s/s*\+// ) { if ( $raw_matches =~ s/^s*\+// ) {
$prerule = $raw_matches; $prerule = $raw_matches;
$raw_matches = ''; $raw_matches = '';
} }
@@ -2658,9 +2704,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
$macro_nest_level--; $macro_nest_level--;
goto EXIT; goto EXIT;
} elsif ( $actiontype & NFQ ) { } elsif ( $actiontype & NFQ ) {
$action = handle_nfqueue( $param, $action = handle_nfqueue( $param );
1 # Allow 'bypass'
);
} elsif ( $actiontype & SET ) { } elsif ( $actiontype & SET ) {
require_capability( 'IPSET_MATCH', 'SET and UNSET rules', '' ); require_capability( 'IPSET_MATCH', 'SET and UNSET rules', '' );
fatal_error "$action rules require a set name parameter" unless $param; fatal_error "$action rules require a set name parameter" unless $param;
@@ -2781,7 +2825,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
LOG => sub { fatal_error 'LOG requires a log level' unless supplied $loglevel; } , LOG => sub { fatal_error 'LOG requires a log level' unless supplied $loglevel; } ,
HELPER => sub { HELPER => sub {
fatal_error "HELPER requires require that the helper be specified in the HELPER column" if $helper eq '-'; fatal_error "HELPER requires that a helper be specified in the HELPER column" if $helper eq '-';
fatal_error "HELPER rules may only appear in the NEW section" unless $section == NEW_SECTION; fatal_error "HELPER rules may only appear in the NEW section" unless $section == NEW_SECTION;
$action = ''; } , $action = ''; } ,
@@ -2848,6 +2892,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/; fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/;
$action = join( ' ', 'SET --' . $xlate{$basictarget} , $setname , $flags ); $action = join( ' ', 'SET --' . $xlate{$basictarget} , $setname , $flags );
$log_action = "$basictarget($setname)";
if ( supplied $timeout ) { if ( supplied $timeout ) {
fatal_error "A timeout may only be supplied in an ADD rule" unless $basictarget eq 'ADD'; fatal_error "A timeout may only be supplied in an ADD rule" unless $basictarget eq 'ADD';
@@ -3137,13 +3182,14 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
if ( $actiontype & ( NATRULE | NONAT ) && ! ( $actiontype & NATONLY ) ) { if ( $actiontype & ( NATRULE | NONAT ) && ! ( $actiontype & NATONLY ) ) {
# #
# Either a DNAT, REDIRECT or ACCEPT+ rule or an Action with NAT; # Either a DNAT, REDIRECT or ACCEPT+ rule or an Action with NAT;
# don't apply rate limiting twice
# #
$rule .= join( '', $rule .= join( '',
do_proto($proto, $ports, $sports), do_proto($proto, $ports, $sports),
do_ratelimit( $ratelimit, 'ACCEPT' ),
do_user( $user ) , do_user( $user ) ,
do_test( $mark , $globals{TC_MASK} ) , do_test( $mark , $globals{TC_MASK} ) ,
do_connlimit( $connlimit ), do_connlimit( $connlimit ),
do_ratelimit( $ratelimit, 'ACCEPT' ),
do_time( $time ) , do_time( $time ) ,
do_headers( $headers ) , do_headers( $headers ) ,
do_condition( $condition , $chain ) , do_condition( $condition , $chain ) ,
@@ -3239,12 +3285,12 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
# - the destination IP will be the server IP ($dest) -- also done above # - the destination IP will be the server IP ($dest) -- also done above
# - there will be no log level (we log NAT rules in the nat table rather than in the filter table). # - there will be no log level (we log NAT rules in the nat table rather than in the filter table).
# - the target will be ACCEPT. # - the target will be ACCEPT.
# - don't apply rate limiting twice
# #
unless ( $actiontype & NATONLY ) { unless ( $actiontype & NATONLY ) {
$rule = join( '', $rule = join( '',
$matches, $matches,
do_proto( $proto, $ports, $sports ), do_proto( $proto, $ports, $sports ),
do_ratelimit( $ratelimit, 'ACCEPT' ),
do_user $user, do_user $user,
do_test( $mark , $globals{TC_MASK} ), do_test( $mark , $globals{TC_MASK} ),
do_condition( $condition , $chain ), do_condition( $condition , $chain ),
@@ -3658,6 +3704,7 @@ sub next_section() {
# #
sub build_zone_list( $$$\$\$ ) { sub build_zone_list( $$$\$\$ ) {
my ($fw, $input, $which, $intrazoneref, $wildref ) = @_; my ($fw, $input, $which, $intrazoneref, $wildref ) = @_;
my $original_input = $input;
my $any = ( $input =~ s/^any/all/ ); my $any = ( $input =~ s/^any/all/ );
my $exclude; my $exclude;
my $rest; my $rest;
@@ -3686,9 +3733,25 @@ sub build_zone_list( $$$\$\$ ) {
if ( $input eq 'all+' ) { if ( $input eq 'all+' ) {
$$intrazoneref = 1; $$intrazoneref = 1;
} elsif ( ( $input eq 'all+-' ) || ( $input eq 'all-+' ) ) { } elsif ( ( $input eq 'all+-' ) || ( $input eq 'all-+' ) ) {
unless ( $excludefw++ ) {
if ( $any ) {
warning_message "$original_input is deprecated in favor of 'any+!\$FW'";
} else {
warning_message "$original_input is deprecated in favor of 'all+!\$FW'";
}
}
$$intrazoneref = 1; $$intrazoneref = 1;
$exclude{$fw} = 1; $exclude{$fw} = 1;
} elsif ( $input eq 'all-' ) { } elsif ( $input eq 'all-' ) {
unless ( $excludefw++ ) {
if ( $any ) {
warning_message "any- is deprecated in favor of 'any!\$FW'";
} else {
warning_message "all- is deprecated in favor of 'all!\$FW'" unless $excludefw++;
}
}
$exclude{$fw} = 1; $exclude{$fw} = 1;
} else { } else {
fatal_error "Invalid $which ($input)"; fatal_error "Invalid $which ($input)";
@@ -4077,6 +4140,10 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
O => OUTPUT, O => OUTPUT,
T => POSTROUTING, T => POSTROUTING,
R => REALPREROUTING, R => REALPREROUTING,
NP => REALPREROUTING,
NI => REALINPUT,
NO => REALOUTPUT,
NT => REALPOSTROUTING
); );
my %chainlabels = ( 1 => 'PREROUTING', my %chainlabels = ( 1 => 'PREROUTING',
@@ -4093,6 +4160,9 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
32 => 'sticky', 32 => 'sticky',
64 => 'sticko', 64 => 'sticko',
128 => 'PREROUTING', 128 => 'PREROUTING',
256 => 'INPUT',
512 => 'OUTPUT',
1024 => 'POSTROUTING',
); );
my $inchain = defined $chainref; my $inchain = defined $chainref;
@@ -4116,6 +4186,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
my $actiontype; my $actiontype;
my $commandref; my $commandref;
my $prerule = ''; my $prerule = '';
my $table = 'mangle';
my $tabletype = MANGLE_TABLE;
# #
# Subroutine for handling MARK and CONNMARK. We use an enclosure so as to keep visibility of the # Subroutine for handling MARK and CONNMARK. We use an enclosure so as to keep visibility of the
# function's local variables without making them static. process_mangle_rule1() is called # function's local variables without making them static. process_mangle_rule1() is called
@@ -4157,7 +4229,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
$option ||= ( $and_or eq '|' ? '--or-mark' : $and_or ? '--and-mark' : '--set-mark' ); $option ||= ( $and_or eq '|' ? '--or-mark' : $and_or ? '--and-mark' : '--set-mark' );
my $chainref = ensure_chain( 'mangle', $chain = $chainnames{$chain} ); my $chainref = ensure_chain( $table, $chain = $chainnames{$chain} );
$restriction |= $chainref->{restriction}; $restriction |= $chainref->{restriction};
@@ -4476,7 +4548,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
my ( $tgt, $options ) = split( ' ', $params, 2 ); my ( $tgt, $options ) = split( ' ', $params, 2 );
my $target_type = $builtin_target{$tgt}; my $target_type = $builtin_target{$tgt};
fatal_error "Unknown target ($tgt)" unless $target_type; fatal_error "Unknown target ($tgt)" unless $target_type;
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE; fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & $tabletype;
$target = $params; $target = $params;
$usergenerated = 1; $usergenerated = 1;
}, },
@@ -4492,7 +4564,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
my ( $tgt, $options ) = split( ' ', $params, 2 ); my ( $tgt, $options ) = split( ' ', $params, 2 );
my $target_type = $builtin_target{$tgt}; my $target_type = $builtin_target{$tgt};
fatal_error "Unknown target ($tgt)" unless $target_type; fatal_error "Unknown target ($tgt)" unless $target_type;
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE; fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & $tabletype;
$target = $params; $target = $params;
$usergenerated = 1; $usergenerated = 1;
}, },
@@ -4564,7 +4636,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
RESTORE => { RESTORE => {
defaultchain => 0, defaultchain => 0,
allowedchains => PREROUTING | INPUT | FORWARD | OUTPUT | POSTROUTING, allowedchains => PREROUTING | INPUT | FORWARD | OUTPUT | POSTROUTING | REALPREROUTING | REALINPUT | REALOUTPUT | REALPOSTROUTING,
minparams => 0, minparams => 0,
maxparams => 1, maxparams => 1,
function => sub () { function => sub () {
@@ -4600,7 +4672,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
SAVE => { SAVE => {
defaultchain => 0, defaultchain => 0,
allowedchains => PREROUTING | INPUT | FORWARD | OUTPUT | POSTROUTING, allowedchains => PREROUTING | INPUT | FORWARD | OUTPUT | POSTROUTING | REALPREROUTING | REALINPUT | REALOUTPUT | REALPOSTROUTING,
minparams => 0, minparams => 0,
maxparams => 1, maxparams => 1,
function => sub () { function => sub () {
@@ -4846,6 +4918,14 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
fatal_error "A chain designator may not be specified in an action body" if $inaction; fatal_error "A chain designator may not be specified in an action body" if $inaction;
my $temp = $designators{$designator}; my $temp = $designators{$designator};
fatal_error "Invalid chain designator ( $designator )" unless $temp; fatal_error "Invalid chain designator ( $designator )" unless $temp;
if ( $designator =~ /^N/ ) {
fatal_error "Only MARK, CONNMARK, SAVE and RESTORE may be used in the nat table" unless $cmd =~ /^(?:(?:(?:CONN)MARK)|SAVE|RESTORE)[(]?/;
require_capability('MARK_ANYWHERE', "The $designator designator", 's');
$table = 'nat';
$tabletype = NAT_TABLE;
}
$designator = $temp; $designator = $temp;
} }
@@ -4871,21 +4951,30 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
# #
# Handle early matches # Handle early matches
# #
if ( $raw_matches =~ s/s*\+// ) { if ( $raw_matches =~ s/^s*\+// ) {
$prerule = $raw_matches; $prerule = $raw_matches;
$raw_matches = ''; $raw_matches = '';
} }
if ( $source ne '-' ) { if ( $source ne '-' ) {
if ( $source eq $fw ) { if ( $source eq $fw ) {
fatal_error 'Rules with SOURCE $FW must use the OUTPUT chain' if $designator && $designator != OUTPUT; if ( $designator ) {
fatal_error 'Rules with SOURCE $FW must use the OUTPUT chain' unless $designator & ( OUTPUT | REALOUTPUT );
$chain = $designator;
} else {
$chain = OUTPUT; $chain = OUTPUT;
}
$source = '-'; $source = '-';
} elsif ( $source =~ s/^($fw):// ) { } elsif ( $source =~ s/^($fw):// ) {
fatal_error 'Rules with SOURCE $FW must use the OUTPUT chain' if $designator && $designator != OUTPUT; if ( $designator ) {
fatal_error 'Rules with SOURCE $FW must use the OUTPUT chain' unless $designator & ( OUTPUT | REALOUTPUT );
$chain = $designator;
} else {
$chain = OUTPUT; $chain = OUTPUT;
} }
} }
}
if ( $dest ne '-' ) { if ( $dest ne '-' ) {
if ( $dest eq $fw ) { if ( $dest eq $fw ) {
@@ -4953,11 +5042,11 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
} else { } else {
$resolve_chain->(); $resolve_chain->();
fatal_error "$cmd rules are not allowed in the $chainlabels{$chain} chain" unless $commandref->{allowedchains} & $chain; fatal_error "$cmd rules are not allowed in the $chainlabels{$chain} chain" unless $commandref->{allowedchains} & $chain;
unless ( $chain == OUTPUT || $chain == POSTROUTING ) { unless ( $chain & ( OUTPUT | POSTROUTING | REALOUTPUT | REALPOSTROUTING ) ) {
fatal_error 'A USER/GROUP may only be specified when the SOURCE is $FW' unless $user eq '-'; fatal_error 'A USER/GROUP may only be specified when the SOURCE is $FW' unless $user eq '-';
} }
$chainref = ensure_chain( 'mangle', $chainnames{$chain} ); $chainref = ensure_chain( $table, $chainnames{$chain} );
} }
$restriction |= $chainref->{restriction}; $restriction |= $chainref->{restriction};
@@ -5547,6 +5636,15 @@ sub process_snat1( $$$$$$$$$$$$ ) {
$chainref = $interface ? ensure_chain('nat', $pre_nat ? snat_chain $interface : masq_chain $interface) : $nat_table->{INPUT}; $chainref = $interface ? ensure_chain('nat', $pre_nat ? snat_chain $interface : masq_chain $interface) : $nat_table->{INPUT};
} }
if ( $chainref->{complete} ) {
if ( $interface ) {
warning_message( "Interface $interface entry generated no $toolname rule" );
} else {
warning_message( "Entry generated no $toolname rule" );
}
next;
}
$baserule .= do_condition( $condition , $chainref->{name} ); $baserule .= do_condition( $condition , $chainref->{name} );
# #
# Handle IPSEC options, if any # Handle IPSEC options, if any
@@ -5674,9 +5772,9 @@ sub process_snat1( $$$$$$$$$$$$ ) {
fatal_error "Invalid IPv6 Address ($addr)" unless $addr =~ /^\[(.+)\]$/; fatal_error "Invalid IPv6 Address ($addr)" unless $addr =~ /^\[(.+)\]$/;
$addr = $1; $addr = $1;
$addr =~ s/\]-\[/-/;
if ( $addr =~ /^(.+)-(.+)$/ ) { if ( $addr =~ /^(.+)-(.+)$/ ) {
fatal_error "Correct address range syntax is '[<addr1>-<addr2>]'" if $addr =~ /]-\[/;
validate_range( $1, $2 ); validate_range( $1, $2 );
} else { } else {
validate_address $addr, 0; validate_address $addr, 0;

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