forked from extern/shorewall_code
Compare commits
386 Commits
5.1.4-Beta
...
5.2.0-base
Author | SHA1 | Date | |
---|---|---|---|
|
7630d3cdb1 | ||
|
90df607d79 | ||
|
f012244acd | ||
|
5e2f1f573d | ||
|
011322992e | ||
|
16bb41db15 | ||
|
47a96e9ff9 | ||
|
4a1d8ba0f9 | ||
|
7c99059a66 | ||
|
609ee8dea2 | ||
|
299ea2b41f | ||
|
224400833a | ||
|
32f1ae1992 | ||
|
9b5468cd4a | ||
|
47a59cdd7c | ||
|
676ca872d6 | ||
|
ef28208c0e | ||
|
cdeb82bdab | ||
|
3be071ca3d | ||
|
6f6abfc8cd | ||
|
f99f3539d1 | ||
|
e08e239c00 | ||
|
02ed6f26a9 | ||
|
9e002a7689 | ||
|
34c5441768 | ||
|
c3d8cba042 | ||
|
8bc97bcd35 | ||
|
c1a74b54fc | ||
|
88547f5140 | ||
|
4a714b3ab9 | ||
|
7ad7598d5b | ||
|
4dfc6d90b9 | ||
|
0cb4a5c202 | ||
|
9a83365986 | ||
|
bc65d29650 | ||
|
9d3e8d6f6c | ||
|
8056b6fd85 | ||
|
db4a26cfa9 | ||
|
95e956c913 | ||
|
5e3795b5a4 | ||
|
3402b1efb6 | ||
|
24e21e730e | ||
|
421edccd3f | ||
|
cf8a48f110 | ||
|
12bbbbfa2a | ||
|
422911f06b | ||
|
2a12e0950a | ||
|
9869dd25d7 | ||
|
e47b57fd4a | ||
|
3cbe0e7a1c | ||
|
221753c3c0 | ||
|
b14924bd64 | ||
|
c0a608ef84 | ||
|
c518e85215 | ||
|
34fd10df41 | ||
|
e7004da47c | ||
|
1fc97c50f1 | ||
|
440d404780 | ||
|
91c76f7559 | ||
|
eb224e653f | ||
|
73b39abd62 | ||
|
3903fe5fd9 | ||
|
a3e10157de | ||
|
2e4af68b98 | ||
|
de9f29d7d4 | ||
|
99ddb17c9e | ||
|
8ea9d0bbef | ||
|
ebe09a95b8 | ||
|
f32b304eb6 | ||
|
7bdd69d151 | ||
|
a08f0cfe10 | ||
|
09a81ae574 | ||
|
7042d586b2 | ||
|
e17c4ac8af | ||
|
a6000ee963 | ||
|
0ab1464f51 | ||
|
789854adce | ||
|
37101a2031 | ||
|
40bcfd15e5 | ||
|
230ab06e5d | ||
|
09cda21dd4 | ||
|
9253f90ac5 | ||
|
f4cae55c1e | ||
|
fbee4a91fd | ||
|
cb7071a213 | ||
|
cdf5ad45d5 | ||
|
070a67d665 | ||
|
9796c58eb2 | ||
|
cabc20957f | ||
|
a9a379c5a5 | ||
|
3bf5066f82 | ||
|
b2c33a0f9a | ||
|
64f704a964 | ||
|
416224ee05 | ||
|
92ce1beddc | ||
|
4d6bf8564e | ||
|
fb4b362724 | ||
|
97de2be778 | ||
|
85cae3c7f8 | ||
|
acd425a3c2 | ||
|
4e6949f996 | ||
|
5d7dcc3122 | ||
|
23d498146b | ||
|
422d0b216a | ||
|
37ecbff23a | ||
|
491309a78a | ||
|
bc993c384c | ||
|
0e4c1cdac1 | ||
|
27a0f0f7a0 | ||
|
9ac075fd56 | ||
|
b2604583af | ||
|
62c6411cb0 | ||
|
6badf3ce1a | ||
|
1bc90beb01 | ||
|
eaccf033c6 | ||
|
056711d304 | ||
|
0aa0bebe07 | ||
|
1a68d87c94 | ||
|
c518cfaa4a | ||
|
196a56ea3c | ||
|
2c3f121835 | ||
|
18ba5c7311 | ||
|
c8774110c6 | ||
|
1479e955d4 | ||
|
09980cc75e | ||
|
e0a757ea03 | ||
|
550003f0f4 | ||
|
4f50303318 | ||
|
5053999442 | ||
|
6b5889177b | ||
|
71f8bad300 | ||
|
377c9f5708 | ||
|
45a164733b | ||
|
6f82bfe7d1 | ||
|
4e5b98d3d9 | ||
|
078c781dfa | ||
|
46f68c6dcb | ||
|
b42678269c | ||
|
9bd10c0c00 | ||
|
f861f8da35 | ||
|
9e3cb27d0a | ||
|
5b97800901 | ||
|
d8a22d13dd | ||
|
675e41e6a6 | ||
|
28f6379956 | ||
|
c9b58e203b | ||
|
9afe8daae0 | ||
|
43adcd26a1 | ||
|
65371437b5 | ||
|
cc2022e172 | ||
|
f2a565729f | ||
|
ea8b2a803a | ||
|
16832149ca | ||
|
7edf4918d7 | ||
|
d3a1dc1e2a | ||
|
f68f47d01b | ||
|
b1d1fa862a | ||
|
24acf25451 | ||
|
229c47ac6c | ||
|
38de9c1732 | ||
|
17f4fd7cd2 | ||
|
cfd02c1bb6 | ||
|
02caeb5aa0 | ||
|
19b7601c72 | ||
|
5a8e9cd0a3 | ||
|
b5a6067588 | ||
|
45468af2d2 | ||
|
6c018f478c | ||
|
dec3cacb2a | ||
|
4ab8e1f0a2 | ||
|
821d72093a | ||
|
42d5d13780 | ||
|
7121a0f1b1 | ||
|
ab12d63a4f | ||
|
6ba1d5413b | ||
|
4fc572f664 | ||
|
138e64c54a | ||
|
b04b65cac8 | ||
|
c907748b52 | ||
|
7f3414e3d8 | ||
|
c75fe2ea8d | ||
|
5dcb684efc | ||
|
3e87e5004a | ||
|
c89b113a61 | ||
|
7289175070 | ||
|
5aaf1e53de | ||
|
a9373d727b | ||
|
528b473f6b | ||
|
d22210c074 | ||
|
89d6009200 | ||
|
f411f7dd31 | ||
|
502e98eb9f | ||
|
f73bad440d | ||
|
f0cb3f50e4 | ||
|
23bc019a82 | ||
|
9d299ef866 | ||
|
2a9272ccd1 | ||
|
130ddff9de | ||
|
9cf298482d | ||
|
c5a586aa37 | ||
|
0670ecaf5e | ||
|
d3eebde464 | ||
|
832418585a | ||
|
605f61fb3c | ||
|
824f4ca570 | ||
|
9acdbb5acf | ||
|
8dfa0be611 | ||
|
ef8b85fc3e | ||
|
2b5613026a | ||
|
c7c318c0e7 | ||
|
b48e5a8932 | ||
|
d1976189aa | ||
|
6b4905c2c0 | ||
|
774b707352 | ||
|
c3bd58827f | ||
|
b35f1112f4 | ||
|
a0eb91cb90 | ||
|
105e6a3d01 | ||
|
77d9eeb915 | ||
|
17838c1443 | ||
|
5867ce6c3b | ||
|
84cd80eba9 | ||
|
9b02f7a922 | ||
|
f1975ae9b0 | ||
|
7b9f7c095d | ||
|
8ea96098bf | ||
|
02ed36332a | ||
|
15a3b29a32 | ||
|
cb4f9e7261 | ||
|
bfab002dda | ||
|
ddb12fcad9 | ||
|
42ce754961 | ||
|
5cd4d63bc5 | ||
|
5b567f2d8b | ||
|
39a3c72057 | ||
|
b47e633c38 | ||
|
1b55a37a28 | ||
|
a97dcd23d0 | ||
|
108b169d8d | ||
|
a9fbaa57ed | ||
|
317f12041b | ||
|
8469f983d8 | ||
|
f54acb665a | ||
|
3d2e9eb93e | ||
|
c6a939301f | ||
|
1cb98254cc | ||
|
baa791a1e3 | ||
|
8b4b965f63 | ||
|
8ee2d6246c | ||
|
a7be3dfece | ||
|
846e8c4ece | ||
|
e2bf7e6584 | ||
|
ff3994f6a1 | ||
|
494ec9c59c | ||
|
1cde92e8f3 | ||
|
721a1e3b33 | ||
|
84fa774cb7 | ||
|
c39bc7b65f | ||
|
2548e8741d | ||
|
0a31fba6bb | ||
|
9701c9c522 | ||
|
973d352209 | ||
|
91e59c2ed4 | ||
|
be5aabcbfb | ||
|
a8937e6bc8 | ||
|
e91bd9a0e9 | ||
|
5e1cf17ebc | ||
|
85a7ec6fe5 | ||
|
fb831e3128 | ||
|
2ed11c7e15 | ||
|
ef1353790e | ||
|
4f79d2e82b | ||
|
e6a2ba78a4 | ||
|
41ea3bdeda | ||
|
1065c2951b | ||
|
3b373f3f21 | ||
|
0c05ab3bff | ||
|
ef3a33e3f4 | ||
|
8a78fb6e77 | ||
|
b54a691110 | ||
|
90f33dd436 | ||
|
b7aef24d7c | ||
|
6f475cde3f | ||
|
6053a40af0 | ||
|
7e4dba7623 | ||
|
3d322d31b7 | ||
|
34e4fffd7d | ||
|
2e98d4375b | ||
|
419ff8903b | ||
|
390ac30be8 | ||
|
8cb98f16ea | ||
|
5a9f179e25 | ||
|
d8eca457de | ||
|
8641d53bd1 | ||
|
7e3521e221 | ||
|
0603f8e355 | ||
|
ddefde2d10 | ||
|
2beeedd8fe | ||
|
1a2647618e | ||
|
72293883dd | ||
|
c31397532c | ||
|
d0861e813b | ||
|
5d5bef105a | ||
|
da62bd2b32 | ||
|
a83c19cc33 | ||
|
96a33395e8 | ||
|
dabe8abe52 | ||
|
a504820d19 | ||
|
8db4265ccc | ||
|
4c2c1bcdf1 | ||
|
f2ee8013fc | ||
|
56c8f70b52 | ||
|
657215f9b5 | ||
|
5589ab76d9 | ||
|
ec0e6763e4 | ||
|
6425e5ae5d | ||
|
8521c6f750 | ||
|
c57edb0fbf | ||
|
80e6cd8a2f | ||
|
69a0061d0f | ||
|
5a24953e6c | ||
|
eea3cca90c | ||
|
a420ef04d9 | ||
|
e573436b12 | ||
|
7f44473387 | ||
|
cf9773c4de | ||
|
939f0e92a5 | ||
|
320d448684 | ||
|
975a14b94f | ||
|
cf3c304078 | ||
|
d1a21fb678 | ||
|
b9b7baf98d | ||
|
92e725de97 | ||
|
922bd9eeca | ||
|
d2b3fa476a | ||
|
4e978b687d | ||
|
2d0cb5c2d8 | ||
|
d9dc6bcfe2 | ||
|
ff51915b4f | ||
|
1ad796ba5d | ||
|
c8e2b4ae28 | ||
|
9d160d4342 | ||
|
1301848315 | ||
|
f050fc6e05 | ||
|
61b6898782 | ||
|
aee8c14ea6 | ||
|
ff2323b249 | ||
|
b4a06e9656 | ||
|
4122021344 | ||
|
71d50e0217 | ||
|
1b6f15d577 | ||
|
7515520b46 | ||
|
1e2030fd6f | ||
|
708644f7c9 | ||
|
2f5687c65a | ||
|
66d1fbd3aa | ||
|
c410459e27 | ||
|
987e54cd54 | ||
|
42a46d42b6 | ||
|
d8ef934f24 | ||
|
62a60ad995 | ||
|
b1ba05db2b | ||
|
57f7cb4f3c | ||
|
4cf60258af | ||
|
1061644ac7 | ||
|
4a262c0e1b | ||
|
29ffb7eb4b | ||
|
a775fdcb7c | ||
|
6338aa42b0 | ||
|
12a32d3a6b | ||
|
45d96a5d64 | ||
|
f21d6de4d6 | ||
|
965a8e8f68 | ||
|
eb26a467e9 | ||
|
28e3218041 | ||
|
bb70a3637b | ||
|
6c20cc7c4f | ||
|
d4e05f6163 | ||
|
6201f37913 | ||
|
7ee44d6b4b | ||
|
363b8f9802 | ||
|
d365a9ff18 | ||
|
00d4724fd8 | ||
|
749c8047d8 | ||
|
a00f2e6365 | ||
|
a46f19899b |
4
Shorewall-core/configure
vendored
4
Shorewall-core/configure
vendored
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Shorewall Packet Filtering Firewall RPM configuration program - V4.6
|
# Shorewall Packet Filtering Firewall RPM configuration program - V4.6
|
||||||
#
|
#
|
||||||
# (c) 2012,2014 - 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 http://www.shorewall.net
|
||||||
#
|
#
|
||||||
@@ -190,7 +190,7 @@ for p in ${!params[@]}; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo '#' > shorewallrc
|
echo '#' > shorewallrc
|
||||||
echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc
|
echo "# Created by Shorewall Core version $VERSION configure - " `date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}"` >> shorewallrc
|
||||||
echo "# rc file: $rcfile" >> shorewallrc
|
echo "# rc file: $rcfile" >> shorewallrc
|
||||||
echo '#' >> shorewallrc
|
echo '#' >> shorewallrc
|
||||||
|
|
||||||
|
@@ -173,7 +173,12 @@ my $outfile;
|
|||||||
|
|
||||||
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
|
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
|
||||||
|
|
||||||
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
|
if ( $ENV{SOURCE_DATE_EPOCH} ) {
|
||||||
|
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s\n", VERSION, `date --utc --date=\"\@$ENV{SOURCE_DATE_EPOCH}\"`;
|
||||||
|
} else {
|
||||||
|
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
|
||||||
|
}
|
||||||
|
|
||||||
print $outfile "# rc file: $rcfilename\n#\n";
|
print $outfile "# rc file: $rcfilename\n#\n";
|
||||||
|
|
||||||
print $outfile "# Input: @ARGV\n#\n" if @ARGV;
|
print $outfile "# Input: @ARGV\n#\n" if @ARGV;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Script to install Shoreline Firewall Core Modules
|
# Script to install Shoreline Firewall Core Modules
|
||||||
#
|
#
|
||||||
# (c) 2000-2016 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -335,9 +335,8 @@ for f in lib.* ; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ $SHAREDIR != /usr/share ]; then
|
if [ $SHAREDIR != /usr/share ]; then
|
||||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.base
|
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/lib.base
|
||||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.core
|
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/lib.cli
|
||||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.cli
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.base
|
# Shorewall 5.2 -- /usr/share/shorewall/lib.base
|
||||||
#
|
#
|
||||||
# (c) 1999-2015 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.cli.
|
# Shorewall 5.2 -- /usr/share/shorewall/lib.cli
|
||||||
#
|
#
|
||||||
# (c) 1999-2015 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
# loaded after this one and replaces some of the functions declared here.
|
# loaded after this one and replaces some of the functions declared here.
|
||||||
#
|
#
|
||||||
|
|
||||||
SHOREWALL_CAPVERSION=50100
|
SHOREWALL_CAPVERSION=50200
|
||||||
|
|
||||||
if [ -z "$g_basedir" ]; then
|
if [ -z "$g_basedir" ]; then
|
||||||
#
|
#
|
||||||
@@ -47,6 +47,10 @@ startup_error() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
only_root() {
|
||||||
|
[ "$(id -u)" != 0 ] && fatal_error "The '$COMMAND' command may only be run by root"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Display a chain if it exists
|
# Display a chain if it exists
|
||||||
#
|
#
|
||||||
@@ -83,6 +87,8 @@ showchain() # $1 = name of chain
|
|||||||
#
|
#
|
||||||
validate_restorefile() # $* = label
|
validate_restorefile() # $* = label
|
||||||
{
|
{
|
||||||
|
[ -n "$RESTOREFILE" ] || RESTOREFILE=restore
|
||||||
|
|
||||||
case $RESTOREFILE in
|
case $RESTOREFILE in
|
||||||
*/*)
|
*/*)
|
||||||
error_message "ERROR: $@ must specify a simple file name: $RESTOREFILE"
|
error_message "ERROR: $@ must specify a simple file name: $RESTOREFILE"
|
||||||
@@ -411,9 +417,9 @@ resolve_arptables() {
|
|||||||
savesets() {
|
savesets() {
|
||||||
local supported
|
local supported
|
||||||
|
|
||||||
supported=$(run_it ${VARDIR}/firewall help | fgrep savesets )
|
supported=$(run_it $g_firewall help | fgrep savesets )
|
||||||
|
|
||||||
[ -n "$supported" ] && run_it ${VARDIR}/firewall savesets ${g_restorepath}-ipsets
|
[ -n "$supported" ] && run_it $g_firewall savesets ${g_restorepath}-ipsets
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -422,9 +428,9 @@ savesets() {
|
|||||||
savesets1() {
|
savesets1() {
|
||||||
local supported
|
local supported
|
||||||
|
|
||||||
supported=$(run_it ${VARDIR}/firewall help | fgrep savesets )
|
supported=$(run_it $g_firewall help | fgrep savesets )
|
||||||
|
|
||||||
[ -n "$supported" ] && run_it ${VARDIR}/firewall savesets ${VARDIR}/ipsets.save && progress_message3 "The ipsets have been saved to ${VARDIR}/ipsets.save"
|
[ -n "$supported" ] && run_it $g_firewall savesets ${VARDIR}/ipsets.save && progress_message3 "The ipsets have been saved to ${VARDIR}/ipsets.save"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -435,9 +441,9 @@ do_save() {
|
|||||||
local arptables
|
local arptables
|
||||||
status=0
|
status=0
|
||||||
|
|
||||||
if [ -f ${VARDIR}/firewall ]; then
|
if [ -f $g_firewall ]; then
|
||||||
if $iptables_save | grep -v -- '-A dynamic.* -j ACCEPT' > ${VARDIR}/restore-$$; then
|
if $iptables_save | grep -v -- '-A dynamic.* -j ACCEPT' > ${VARDIR}/restore-$$; then
|
||||||
cp -f ${VARDIR}/firewall $g_restorepath
|
cp -f $g_firewall $g_restorepath
|
||||||
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables
|
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables
|
||||||
chmod 700 $g_restorepath
|
chmod 700 $g_restorepath
|
||||||
chmod 600 ${g_restorepath}-iptables
|
chmod 600 ${g_restorepath}-iptables
|
||||||
@@ -449,7 +455,7 @@ do_save() {
|
|||||||
status=1
|
status=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo " ERROR: ${VARDIR}/firewall does not exist" >&2
|
echo " ERROR: $g_firewall does not exist" >&2
|
||||||
status=1
|
status=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -634,7 +640,7 @@ show_routing() {
|
|||||||
ip -$g_family rule list | find_tables | sort -u | while read table; do
|
ip -$g_family rule list | find_tables | sort -u | while read table; do
|
||||||
heading "Table $table:"
|
heading "Table $table:"
|
||||||
if [ $g_family -eq 6 ]; then
|
if [ $g_family -eq 6 ]; then
|
||||||
ip -$g_family -o route list table $table | grep -vF cache | sort_routes
|
ip -6 -o route list table $table | grep -vF cache | sort_routes
|
||||||
else
|
else
|
||||||
ip -4 -o route list table $table | sort_routes
|
ip -4 -o route list table $table | sort_routes
|
||||||
fi
|
fi
|
||||||
@@ -647,7 +653,7 @@ show_routing() {
|
|||||||
else
|
else
|
||||||
heading "Routing Table"
|
heading "Routing Table"
|
||||||
if [ $g_family -eq 6 ]; then
|
if [ $g_family -eq 6 ]; then
|
||||||
ip -$g_family -o route list | grep -vF cache | sort_routes
|
ip -6 -o route list | grep -vF cache | sort_routes
|
||||||
else
|
else
|
||||||
ip -4 -o route list table $table | sort_routes
|
ip -4 -o route list table $table | sort_routes
|
||||||
fi
|
fi
|
||||||
@@ -1137,16 +1143,31 @@ show_a_macro() {
|
|||||||
cat ${directory}/macro.$1
|
cat ${directory}/macro.$1
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# Don't dump empty SPD entries
|
# Don't dump empty SPD entries or entries from the other address family
|
||||||
#
|
#
|
||||||
spd_filter()
|
spd_filter() {
|
||||||
{
|
#
|
||||||
awk \
|
# af = Address Family (4 or 6)
|
||||||
'BEGIN { skip=0; }; \
|
# afok = Address Family of entry matches af
|
||||||
/^src/ { skip=0; }; \
|
# p = print the contents of A (entry is not empty)
|
||||||
/^src 0.0.0.0\/0/ { skip=1; }; \
|
# i = Number of lines stored in A
|
||||||
/^src ::\/0/ { skip=1; }; \
|
#
|
||||||
{ if ( skip == 0 ) print; };'
|
awk -v af=$g_family \
|
||||||
|
'function prnt(A,i, j) { while ( j < i ) print A[j++]; };\
|
||||||
|
\
|
||||||
|
/^src / { if (p) prnt( A, i );\
|
||||||
|
afok = 1;\
|
||||||
|
p = 0;\
|
||||||
|
i = 0;\
|
||||||
|
if ( af == 4 )\
|
||||||
|
{ if ( /:/ ) afok = 0; }\
|
||||||
|
else\
|
||||||
|
{ if ( /\./ ) afok = 0; }\
|
||||||
|
};\
|
||||||
|
{ if ( afok ) A[i++] = $0; };\
|
||||||
|
/tmpl/ { p = afok; };\
|
||||||
|
\
|
||||||
|
END { if (p) prnt( A, i ); }'
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# Print a heading with leading and trailing black lines
|
# Print a heading with leading and trailing black lines
|
||||||
@@ -1159,7 +1180,8 @@ heading() {
|
|||||||
|
|
||||||
show_ipsec() {
|
show_ipsec() {
|
||||||
heading "PFKEY SPD"
|
heading "PFKEY SPD"
|
||||||
$IP -s xfrm policy | spd_filter
|
$IP -s -$g_family xfrm policy | spd_filter
|
||||||
|
|
||||||
heading "PFKEY SAD"
|
heading "PFKEY SAD"
|
||||||
$IP -s -$g_family xfrm state | egrep -v '[[:space:]]+(auth-trunc|enc )' # Don't divulge the keys
|
$IP -s -$g_family xfrm state | egrep -v '[[:space:]]+(auth-trunc|enc )' # Don't divulge the keys
|
||||||
}
|
}
|
||||||
@@ -1169,6 +1191,26 @@ show_ipsec_command() {
|
|||||||
show_ipsec
|
show_ipsec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_saves_command() {
|
||||||
|
local f
|
||||||
|
local fn
|
||||||
|
local mtime
|
||||||
|
|
||||||
|
echo "$g_product $SHOREWALL_VERSION Saves at $g_hostname - $(date)"
|
||||||
|
echo "Saved snapshots are:"
|
||||||
|
echo
|
||||||
|
|
||||||
|
for f in ${VARDIR}/*-iptables; do
|
||||||
|
fn=$(basename $f)
|
||||||
|
fn=${fn%-iptables}
|
||||||
|
mtime=$(ls -lt $f | tail -n 1 | cut -d ' ' -f '6 7 8' )
|
||||||
|
[ $fn = "$RESTOREFILE" ] && fn="$fn (default)"
|
||||||
|
echo " $mtime ${fn%-iptables}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Show Command Executor
|
# Show Command Executor
|
||||||
#
|
#
|
||||||
@@ -1187,6 +1229,7 @@ show_command() {
|
|||||||
show_macro() {
|
show_macro() {
|
||||||
foo=`grep 'This macro' $macro | sed 's/This macro //'`
|
foo=`grep 'This macro' $macro | sed 's/This macro //'`
|
||||||
if [ -n "$foo" ]; then
|
if [ -n "$foo" ]; then
|
||||||
|
macro=$(basename $macro)
|
||||||
macro=${macro#*.}
|
macro=${macro#*.}
|
||||||
foo=${foo%.*}
|
foo=${foo%.*}
|
||||||
if [ ${#macro} -gt 5 ]; then
|
if [ ${#macro} -gt 5 ]; then
|
||||||
@@ -1281,37 +1324,47 @@ show_command() {
|
|||||||
|
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
|
|
||||||
|
COMMAND="$COMMAND $1"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
connections)
|
connections)
|
||||||
|
only_root
|
||||||
eval show_connections $@ $g_pager
|
eval show_connections $@ $g_pager
|
||||||
;;
|
;;
|
||||||
nat)
|
nat)
|
||||||
|
only_root
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
eval show_nat $g_pager
|
eval show_nat $g_pager
|
||||||
;;
|
;;
|
||||||
raw)
|
raw)
|
||||||
|
only_root
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
eval show_raw $g_pager
|
eval show_raw $g_pager
|
||||||
;;
|
;;
|
||||||
tos|mangle)
|
tos|mangle)
|
||||||
|
only_root
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
eval show_mangle $g_pager
|
eval show_mangle $g_pager
|
||||||
;;
|
;;
|
||||||
log)
|
log)
|
||||||
[ $# -gt 2 ] && too_many_arguments $2
|
[ $# -gt 2 ] && too_many_arguments $2
|
||||||
|
|
||||||
|
only_root
|
||||||
setup_logread
|
setup_logread
|
||||||
eval show_log $g_pager
|
eval show_log $g_pager
|
||||||
;;
|
;;
|
||||||
tc)
|
tc)
|
||||||
|
only_root
|
||||||
[ $# -gt 2 ] && too_many_arguments $2
|
[ $# -gt 2 ] && too_many_arguments $2
|
||||||
eval show_tc $@ $g_pager
|
eval show_tc $@ $g_pager
|
||||||
;;
|
;;
|
||||||
classifiers|filters)
|
classifiers|filters)
|
||||||
|
only_root
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
eval show_classifiers_command $g_pager
|
eval show_classifiers_command $g_pager
|
||||||
;;
|
;;
|
||||||
zones)
|
zones)
|
||||||
|
only_root
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
if [ -f ${VARDIR}/zones ]; then
|
if [ -f ${VARDIR}/zones ]; then
|
||||||
echo "$g_product $SHOREWALL_VERSION Zones at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION Zones at $g_hostname - $(date)"
|
||||||
@@ -1335,6 +1388,7 @@ show_command() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
capabilities)
|
capabilities)
|
||||||
|
only_root
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
determine_capabilities
|
determine_capabilities
|
||||||
VERBOSITY=2
|
VERBOSITY=2
|
||||||
@@ -1371,33 +1425,50 @@ show_command() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
chain)
|
chain)
|
||||||
|
only_root
|
||||||
shift
|
shift
|
||||||
eval show_chain $@ $g_pager
|
eval show_chain $@ $g_pager
|
||||||
;;
|
;;
|
||||||
vardir)
|
vardir)
|
||||||
echo $VARDIR;
|
echo $VARDIR;
|
||||||
;;
|
;;
|
||||||
|
rc)
|
||||||
|
shift
|
||||||
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
if [ -n "$1" -a -d "$1" ]; then
|
||||||
|
cat $1/shorewallrc
|
||||||
|
elif [ -n "$g_basedir" -a -d "$g_basedir" ]; then
|
||||||
|
cat $g_basedir/shorewallrc
|
||||||
|
else
|
||||||
|
fatal_error "Can not determine the location of the shorewallrc file."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
policies)
|
policies)
|
||||||
|
only_root
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
eval show_policies $g_pager
|
eval show_policies $g_pager
|
||||||
;;
|
;;
|
||||||
ipa)
|
ipa)
|
||||||
|
only_root
|
||||||
[ $g_family -eq 4 ] || fatal_error "'show ipa' is now available in $g_product"
|
[ $g_family -eq 4 ] || fatal_error "'show ipa' is now available in $g_product"
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
eval show_ipa $g_pager
|
eval show_ipa $g_pager
|
||||||
;;
|
;;
|
||||||
marks)
|
marks)
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
only_root
|
||||||
echo "$g_product $SHOREWALL_VERSION Mark Layout at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION Mark Layout at $g_hostname - $(date)"
|
||||||
echo
|
echo
|
||||||
[ -f ${VARDIR}/marks ] && cat ${VARDIR}/marks;
|
[ -f ${VARDIR}/marks ] && cat ${VARDIR}/marks;
|
||||||
;;
|
;;
|
||||||
nfacct)
|
nfacct)
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
only_root
|
||||||
eval show_nfacct_command $g_pager
|
eval show_nfacct_command $g_pager
|
||||||
;;
|
;;
|
||||||
arptables)
|
arptables)
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
only_root
|
||||||
resolve_arptables
|
resolve_arptables
|
||||||
if [ -n "$arptables" -a -x $arptables ]; then
|
if [ -n "$arptables" -a -x $arptables ]; then
|
||||||
eval show_arptables $g_pager
|
eval show_arptables $g_pager
|
||||||
@@ -1407,6 +1478,7 @@ show_command() {
|
|||||||
;;
|
;;
|
||||||
event)
|
event)
|
||||||
[ $# -gt 1 ] || too_many_arguments $2
|
[ $# -gt 1 ] || too_many_arguments $2
|
||||||
|
only_root
|
||||||
echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)"
|
||||||
echo
|
echo
|
||||||
shift
|
shift
|
||||||
@@ -1414,14 +1486,18 @@ show_command() {
|
|||||||
;;
|
;;
|
||||||
events)
|
events)
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
only_root
|
||||||
eval show_events_command $g_pager
|
eval show_events_command $g_pager
|
||||||
;;
|
;;
|
||||||
bl|blacklists)
|
bl|blacklists)
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
only_root
|
||||||
|
setup_dbl
|
||||||
eval show_blacklists $g_pager
|
eval show_blacklists $g_pager
|
||||||
;;
|
;;
|
||||||
opens)
|
opens)
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
only_root
|
||||||
echo "$g_product $SHOREWALL_VERSION Temporarily opened connections at $g_hostname - $(date)"
|
echo "$g_product $SHOREWALL_VERSION Temporarily opened connections at $g_hostname - $(date)"
|
||||||
|
|
||||||
if chain_exists dynamic; then
|
if chain_exists dynamic; then
|
||||||
@@ -1432,8 +1508,13 @@ show_command() {
|
|||||||
;;
|
;;
|
||||||
ipsec)
|
ipsec)
|
||||||
[ $# -gt 1 ] && too_many_arguments $2
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
only_root
|
||||||
eval show_ipsec_command $g_pager
|
eval show_ipsec_command $g_pager
|
||||||
;;
|
;;
|
||||||
|
saves)
|
||||||
|
[ $# -gt 1 ] && too_many_arguments $2
|
||||||
|
show_saves_command
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
case "$PRODUCT" in
|
case "$PRODUCT" in
|
||||||
*-lite)
|
*-lite)
|
||||||
@@ -1480,6 +1561,8 @@ show_command() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
only_root
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
if [ $1 = dynamic -a $# -gt 1 ]; then
|
if [ $1 = dynamic -a $# -gt 1 ]; then
|
||||||
shift
|
shift
|
||||||
@@ -1797,7 +1880,7 @@ do_dump_command() {
|
|||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
qt mywhich ss && ss -${g_family}tunap || { qt mywhich netstat && netatat -tunap; }
|
qt mywhich ss && ss -${g_family}tunap || { qt mywhich netstat && netstat -tunap; }
|
||||||
|
|
||||||
if [ -n "$TC_ENABLED" ]; then
|
if [ -n "$TC_ENABLED" ]; then
|
||||||
heading "Traffic Control"
|
heading "Traffic Control"
|
||||||
@@ -1911,41 +1994,6 @@ show_proc() # $1 = name of a file
|
|||||||
[ -f $1 ] && echo " $1 = $(cat $1)"
|
[ -f $1 ] && echo " $1 = $(cat $1)"
|
||||||
}
|
}
|
||||||
|
|
||||||
read_yesno_with_timeout() {
|
|
||||||
local timeout
|
|
||||||
timeout=${1:-60}
|
|
||||||
|
|
||||||
case $timeout in
|
|
||||||
*s)
|
|
||||||
;;
|
|
||||||
*m)
|
|
||||||
timeout=$((${timeout%m} * 60))
|
|
||||||
;;
|
|
||||||
*h)
|
|
||||||
timeout=$((${timeout%h} * 3600))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
read -t $timeout yn 2> /dev/null
|
|
||||||
if [ $? -eq 2 ]
|
|
||||||
then
|
|
||||||
# read doesn't support timeout
|
|
||||||
test -x /bin/bash || return 2 # bash is not installed so the feature is not available
|
|
||||||
/bin/bash -c "read -t $timeout yn ; if [ \"\$yn\" == \"y\" ] ; then exit 0 ; else exit 1 ; fi" # invoke bash and use its version of read
|
|
||||||
return $?
|
|
||||||
else
|
|
||||||
# read supports timeout
|
|
||||||
case "$yn" in
|
|
||||||
y|Y)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create the appropriate -q option to pass onward
|
# Create the appropriate -q option to pass onward
|
||||||
#
|
#
|
||||||
@@ -2529,109 +2577,114 @@ hits_command() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Issue an error message and terminate if the firewall isn't started
|
||||||
|
#
|
||||||
|
require_started() {
|
||||||
|
if ! product_is_started; then
|
||||||
|
error_message "ERROR: $g_product is not started"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# 'allow' command executor
|
# 'allow' command executor
|
||||||
#
|
#
|
||||||
allow_command() {
|
allow_command() {
|
||||||
|
|
||||||
|
local allowed
|
||||||
|
local which
|
||||||
|
which='-s'
|
||||||
|
local range
|
||||||
|
range='--src-range'
|
||||||
|
local dynexists
|
||||||
|
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
[ $# -eq 1 ] && missing_argument
|
[ $# -eq 1 ] && missing_argument
|
||||||
|
|
||||||
if product_is_started ; then
|
if [ -n "$g_blacklistipset" ]; then
|
||||||
local allowed
|
case ${IPSET:=ipset} in
|
||||||
local which
|
*/*)
|
||||||
which='-s'
|
if [ ! -x "$IPSET" ]; then
|
||||||
local range
|
fatal_error "IPSET=$IPSET does not exist or is not executable"
|
||||||
range='--src-range'
|
fi
|
||||||
local dynexists
|
;;
|
||||||
|
*)
|
||||||
if [ -n "$g_blacklistipset" ]; then
|
IPSET="$(mywhich $IPSET)"
|
||||||
|
[ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"
|
||||||
case ${IPSET:=ipset} in
|
;;
|
||||||
*/*)
|
esac
|
||||||
if [ ! -x "$IPSET" ]; then
|
|
||||||
fatal_error "IPSET=$IPSET does not exist or is not executable"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
IPSET="$(mywhich $IPSET)"
|
|
||||||
[ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if chain_exists dynamic; then
|
|
||||||
dynexists=Yes
|
|
||||||
elif [ -z "$g_blacklistipset" ]; then
|
|
||||||
fatal_error "Dynamic blacklisting is not enabled in the current $g_product configuration"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -n "$g_nolock" ] || mutex_on
|
|
||||||
|
|
||||||
while [ $# -gt 1 ]; do
|
|
||||||
shift
|
|
||||||
|
|
||||||
allowed=''
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
from)
|
|
||||||
which='-s'
|
|
||||||
range='--src-range'
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
to)
|
|
||||||
which='-d'
|
|
||||||
range='--dst-range'
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
*-*)
|
|
||||||
if [ -n "$g_blacklistipset" ]; then
|
|
||||||
if qt $IPSET -D $g_blacklistipset $1; then
|
|
||||||
allowed=Yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$dynexists" ]; then
|
|
||||||
if qt $g_tool -D dynamic -m iprange $range $1 -j reject ||\
|
|
||||||
qt $g_tool -D dynamic -m iprange $range $1 -j DROP ||\
|
|
||||||
qt $g_tool -D dynamic -m iprange $range $1 -j logdrop ||\
|
|
||||||
qt $g_tool -D dynamic -m iprange $range $1 -j logreject
|
|
||||||
then
|
|
||||||
allowed=Yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -n "$g_blacklistipset" ]; then
|
|
||||||
if qt $IPSET -D $g_blacklistipset $1; then
|
|
||||||
allowed=Yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$dynexists" ]; then
|
|
||||||
if qt $g_tool -D dynamic $which $1 -j reject ||\
|
|
||||||
qt $g_tool -D dynamic $which $1 -j DROP ||\
|
|
||||||
qt $g_tool -D dynamic $which $1 -j logdrop ||\
|
|
||||||
qt $g_tool -D dynamic $which $1 -j logreject
|
|
||||||
then
|
|
||||||
allowed=Yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -n "$allowed" ]; then
|
|
||||||
progress_message2 "$1 Allowed"
|
|
||||||
else
|
|
||||||
error_message "WARNING: $1 already allowed (not dynamically blacklisted)"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -n "$g_nolock" ] || mutex_off
|
|
||||||
else
|
|
||||||
error_message "ERROR: $g_product is not started"
|
|
||||||
exit 2
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if chain_exists dynamic; then
|
||||||
|
dynexists=Yes
|
||||||
|
elif [ -z "$g_blacklistipset" ]; then
|
||||||
|
require_started
|
||||||
|
fatal_error "Dynamic blacklisting is not enabled in the current $g_product configuration"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
|
|
||||||
|
while [ $# -gt 1 ]; do
|
||||||
|
shift
|
||||||
|
|
||||||
|
allowed=''
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
from)
|
||||||
|
which='-s'
|
||||||
|
range='--src-range'
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
to)
|
||||||
|
which='-d'
|
||||||
|
range='--dst-range'
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
*-*)
|
||||||
|
if [ -n "$g_blacklistipset" ]; then
|
||||||
|
if qt $IPSET -D $g_blacklistipset $1; then
|
||||||
|
allowed=Yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$dynexists" ]; then
|
||||||
|
if qt $g_tool -D dynamic -m iprange $range $1 -j reject ||\
|
||||||
|
qt $g_tool -D dynamic -m iprange $range $1 -j DROP ||\
|
||||||
|
qt $g_tool -D dynamic -m iprange $range $1 -j logdrop ||\
|
||||||
|
qt $g_tool -D dynamic -m iprange $range $1 -j logreject
|
||||||
|
then
|
||||||
|
allowed=Yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -n "$g_blacklistipset" ]; then
|
||||||
|
if qt $IPSET -D $g_blacklistipset $1; then
|
||||||
|
allowed=Yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$dynexists" ]; then
|
||||||
|
if qt $g_tool -D dynamic $which $1 -j reject ||\
|
||||||
|
qt $g_tool -D dynamic $which $1 -j DROP ||\
|
||||||
|
qt $g_tool -D dynamic $which $1 -j logdrop ||\
|
||||||
|
qt $g_tool -D dynamic $which $1 -j logreject
|
||||||
|
then
|
||||||
|
allowed=Yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$allowed" ]; then
|
||||||
|
progress_message2 "$1 Allowed"
|
||||||
|
else
|
||||||
|
error_message "WARNING: $1 already allowed (not dynamically blacklisted)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2751,7 +2804,6 @@ determine_capabilities() {
|
|||||||
LENGTH_MATCH=
|
LENGTH_MATCH=
|
||||||
CLASSIFY_TARGET=
|
CLASSIFY_TARGET=
|
||||||
ENHANCED_REJECT=
|
ENHANCED_REJECT=
|
||||||
USEPKTTYPE=
|
|
||||||
KLUDGEFREE=
|
KLUDGEFREE=
|
||||||
MARK=
|
MARK=
|
||||||
XMARK=
|
XMARK=
|
||||||
@@ -2770,7 +2822,7 @@ determine_capabilities() {
|
|||||||
GOTO_TARGET=
|
GOTO_TARGET=
|
||||||
LOGMARK_TARGET=
|
LOGMARK_TARGET=
|
||||||
IPMARK_TARGET=
|
IPMARK_TARGET=
|
||||||
LOG_TARGET=Yes
|
LOG_TARGET=
|
||||||
ULOG_TARGET=
|
ULOG_TARGET=
|
||||||
NFLOG_TARGET=
|
NFLOG_TARGET=
|
||||||
PERSISTENT_SNAT=
|
PERSISTENT_SNAT=
|
||||||
@@ -2803,6 +2855,8 @@ determine_capabilities() {
|
|||||||
WAIT_OPTION=
|
WAIT_OPTION=
|
||||||
CPU_FANOUT=
|
CPU_FANOUT=
|
||||||
NETMAP_TARGET=
|
NETMAP_TARGET=
|
||||||
|
NFLOG_SIZE=
|
||||||
|
RESTORE_WAIT_OPTION=
|
||||||
|
|
||||||
AMANDA_HELPER=
|
AMANDA_HELPER=
|
||||||
FTP_HELPER=
|
FTP_HELPER=
|
||||||
@@ -2826,9 +2880,11 @@ determine_capabilities() {
|
|||||||
qt $arptables -L OUT && ARPTABLESJF=Yes
|
qt $arptables -L OUT && ARPTABLESJF=Yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -z "$(${g_tool}-restore --wait < /dev/null 2>&1)" ] && RESTORE_WAIT_OPTION=Yes
|
||||||
|
|
||||||
if qt $g_tool --wait -t filter -L INPUT -n -v; then
|
if qt $g_tool --wait -t filter -L INPUT -n -v; then
|
||||||
WAIT_OPTION=Yes
|
WAIT_OPTION=Yes
|
||||||
tool="$tool --wait"
|
g_tool="$g_tool --wait"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chain=fooX$$
|
chain=fooX$$
|
||||||
@@ -2843,6 +2899,7 @@ determine_capabilities() {
|
|||||||
qt $g_tool -t nat -A $chain -j NETMAP --to 2001:470:B:227::/64 && NETMAP_TARGET=Yes
|
qt $g_tool -t nat -A $chain -j NETMAP --to 2001:470:B:227::/64 && NETMAP_TARGET=Yes
|
||||||
fi
|
fi
|
||||||
qt $g_tool -t nat -A $chain -j MASQUERADE && MASQUERADE_TGT=Yes
|
qt $g_tool -t nat -A $chain -j MASQUERADE && MASQUERADE_TGT=Yes
|
||||||
|
qt $g_tool -t nat -L INPUT -n && NAT_INPUT_CHAIN=Yes
|
||||||
qt $g_tool -t nat -A $chain -p udplite -m multiport --dport 33 -j REDIRECT --to-port 22 && UDPREDIRECT=Yes
|
qt $g_tool -t nat -A $chain -p udplite -m multiport --dport 33 -j REDIRECT --to-port 22 && UDPREDIRECT=Yes
|
||||||
qt $g_tool -t nat -F $chain
|
qt $g_tool -t nat -F $chain
|
||||||
qt $g_tool -t nat -X $chain
|
qt $g_tool -t nat -X $chain
|
||||||
@@ -3093,7 +3150,6 @@ determine_capabilities() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
qt $g_tool -A $chain -m pkttype --pkt-type broadcast -j ACCEPT && USEPKTTYPE=Yes
|
|
||||||
qt $g_tool -A $chain -m addrtype --src-type BROADCAST -j ACCEPT && ADDRTYPE=Yes
|
qt $g_tool -A $chain -m addrtype --src-type BROADCAST -j ACCEPT && ADDRTYPE=Yes
|
||||||
qt $g_tool -A $chain -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1000:1500 -j ACCEPT && TCPMSS_MATCH=Yes
|
qt $g_tool -A $chain -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1000:1500 -j ACCEPT && TCPMSS_MATCH=Yes
|
||||||
qt $g_tool -A $chain -m hashlimit --hashlimit-upto 4 --hashlimit-burst 5 --hashlimit-name $chain --hashlimit-mode dstip -j ACCEPT && HASHLIMIT_MATCH=Yes
|
qt $g_tool -A $chain -m hashlimit --hashlimit-upto 4 --hashlimit-burst 5 --hashlimit-name $chain --hashlimit-mode dstip -j ACCEPT && HASHLIMIT_MATCH=Yes
|
||||||
@@ -3134,12 +3190,15 @@ determine_capabilities() {
|
|||||||
qt $g_tool -A $chain -m time --timestart 23:00 -j DROP && TIME_MATCH=Yes
|
qt $g_tool -A $chain -m time --timestart 23:00 -j DROP && TIME_MATCH=Yes
|
||||||
qt $g_tool -A $chain -g $chain1 && GOTO_TARGET=Yes
|
qt $g_tool -A $chain -g $chain1 && GOTO_TARGET=Yes
|
||||||
qt $g_tool -A $chain -j LOGMARK && LOGMARK_TARGET=Yes
|
qt $g_tool -A $chain -j LOGMARK && LOGMARK_TARGET=Yes
|
||||||
qt $g_tool -A $chain -j LOG || LOG_TARGET=
|
qt $g_tool -A $chain -j LOG && LOG_TARGET=Yes
|
||||||
qt $g_tool -A $chain -j ULOG && ULOG_TARGET=Yes
|
qt $g_tool -A $chain -j ULOG && ULOG_TARGET=Yes
|
||||||
qt $g_tool -A $chain -j NFLOG && NFLOG_TARGET=Yes
|
|
||||||
qt $g_tool -A $chain -j MARK --set-mark 5 && MARK_ANYWHERE=Yes
|
qt $g_tool -A $chain -j MARK --set-mark 5 && MARK_ANYWHERE=Yes
|
||||||
qt $g_tool -A $chain -m statistic --mode nth --every 2 --packet 1 && STATISTIC_MATCH=Yes
|
qt $g_tool -A $chain -m statistic --mode nth --every 2 --packet 1 && STATISTIC_MATCH=Yes
|
||||||
qt $g_tool -A $chain -m geoip --src-cc US && GEOIP_MATCH=Yes
|
qt $g_tool -A $chain -m geoip --src-cc US && GEOIP_MATCH=Yes
|
||||||
|
if qt $g_tool -A $chain -j NFLOG; then
|
||||||
|
NFLOG_TARGET=Yes
|
||||||
|
qt $g_tool -A $chain -j NFLOG --nflog-size 64 && NFLOG_SIZE=Yes
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $g_family -eq 4 ]; then
|
if [ $g_family -eq 4 ]; then
|
||||||
qt $g_tool -A $chain -j ACCOUNT --addr 192.168.1.0/29 --tname $chain && ACCOUNT_TARGET=Yes
|
qt $g_tool -A $chain -j ACCOUNT --addr 192.168.1.0/29 --tname $chain && ACCOUNT_TARGET=Yes
|
||||||
@@ -3204,7 +3263,6 @@ report_capabilities_unsorted() {
|
|||||||
report_capability "Extended Connection Tracking Match Support (NEW_CONNTRACK_MATCH)" $NEW_CONNTRACK_MATCH
|
report_capability "Extended Connection Tracking Match Support (NEW_CONNTRACK_MATCH)" $NEW_CONNTRACK_MATCH
|
||||||
[ -n "$OLD_CONNTRACK_MATCH" ] && report_capability "Old Connection Tracking Match Syntax (OLD_CONNTRACK_MATCH)" $OLD_CONNTRACK_MATCH
|
[ -n "$OLD_CONNTRACK_MATCH" ] && report_capability "Old Connection Tracking Match Syntax (OLD_CONNTRACK_MATCH)" $OLD_CONNTRACK_MATCH
|
||||||
fi
|
fi
|
||||||
report_capability "Packet Type Match (USEPKTTYPE)" $USEPKTTYPE
|
|
||||||
report_capability "Policy Match (POLICY_MATCH)" $POLICY_MATCH
|
report_capability "Policy Match (POLICY_MATCH)" $POLICY_MATCH
|
||||||
report_capability "Physdev Match (PHYSDEV_MATCH)" $PHYSDEV_MATCH
|
report_capability "Physdev Match (PHYSDEV_MATCH)" $PHYSDEV_MATCH
|
||||||
report_capability "Physdev-is-bridged Support (PHYSDEV_BRIDGE)" $PHYSDEV_BRIDGE
|
report_capability "Physdev-is-bridged Support (PHYSDEV_BRIDGE)" $PHYSDEV_BRIDGE
|
||||||
@@ -3214,8 +3272,8 @@ report_capabilities_unsorted() {
|
|||||||
[ -n "$RECENT_MATCH" ] && report_capability 'Recent Match "--reap" option (REAP_OPTION)' $REAP_OPTION
|
[ -n "$RECENT_MATCH" ] && report_capability 'Recent Match "--reap" option (REAP_OPTION)' $REAP_OPTION
|
||||||
report_capability "Owner Match (OWNER_MATCH)" $OWNER_MATCH
|
report_capability "Owner Match (OWNER_MATCH)" $OWNER_MATCH
|
||||||
report_capability "Owner Name Match (OWNER_NAME_MATCH)" $OWNER_NAME_MATCH
|
report_capability "Owner Name Match (OWNER_NAME_MATCH)" $OWNER_NAME_MATCH
|
||||||
|
report_capability "Ipset Match (IPSET_MATCH)" $IPSET_MATCH
|
||||||
if [ -n "$IPSET_MATCH" ]; then
|
if [ -n "$IPSET_MATCH" ]; then
|
||||||
report_capability "Ipset Match (IPSET_MATCH)" $IPSET_MATCH
|
|
||||||
[ -n "$OLD_IPSET_MATCH" ] && report_capability "OLD_Ipset Match (OLD_IPSET_MATCH)" $OLD_IPSET_MATCH
|
[ -n "$OLD_IPSET_MATCH" ] && report_capability "OLD_Ipset Match (OLD_IPSET_MATCH)" $OLD_IPSET_MATCH
|
||||||
[ -n "$IPSET_MATCH_NOMATCH" ] && report_capability "Ipset Match Nomatch (IPSET_MATCH_NOMATCH)" $IPSET_MATCH_NOMATCH
|
[ -n "$IPSET_MATCH_NOMATCH" ] && report_capability "Ipset Match Nomatch (IPSET_MATCH_NOMATCH)" $IPSET_MATCH_NOMATCH
|
||||||
[ -n "$IPSET_MATCH_NOMATCH" ] && report_capability "Ipset Match Counters (IPSET_MATCH_COUNTERS)" $IPSET_MATCH_COUNTERS
|
[ -n "$IPSET_MATCH_NOMATCH" ] && report_capability "Ipset Match Counters (IPSET_MATCH_COUNTERS)" $IPSET_MATCH_COUNTERS
|
||||||
@@ -3295,9 +3353,11 @@ report_capabilities_unsorted() {
|
|||||||
if [ $g_family -eq 4 ]; then
|
if [ $g_family -eq 4 ]; then
|
||||||
report_capability "iptables -S (IPTABLES_S)" $IPTABLES_S
|
report_capability "iptables -S (IPTABLES_S)" $IPTABLES_S
|
||||||
report_capability "iptables --wait option (WAIT_OPTION)" $WAIT_OPTION
|
report_capability "iptables --wait option (WAIT_OPTION)" $WAIT_OPTION
|
||||||
|
report_capability "iptables-restore --wait option (RESTORE_WAIT_OPTION)" $RESTORE_WAIT_OPTION
|
||||||
else
|
else
|
||||||
report_capability "ip6tables -S (IPTABLES_S)" $IPTABLES_S
|
report_capability "ip6tables -S (IPTABLES_S)" $IPTABLES_S
|
||||||
report_capability "ip6tables --wait option (WAIT_OPTION)" $WAIT_OPTION
|
report_capability "ip6tables --wait option (WAIT_OPTION)" $WAIT_OPTION
|
||||||
|
report_capability "ip6tables-restore --wait option (RESTORE_WAIT_OPTION)" $RESTORE_WAIT_OPTION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
report_capability "Basic Filter (BASIC_FILTER)" $BASIC_FILTER
|
report_capability "Basic Filter (BASIC_FILTER)" $BASIC_FILTER
|
||||||
@@ -3305,6 +3365,8 @@ report_capabilities_unsorted() {
|
|||||||
report_capability "CT Target (CT_TARGET)" $CT_TARGET
|
report_capability "CT Target (CT_TARGET)" $CT_TARGET
|
||||||
report_capability "NFQUEUE CPU Fanout (CPU_FANOUT)" $CPU_FANOUT
|
report_capability "NFQUEUE CPU Fanout (CPU_FANOUT)" $CPU_FANOUT
|
||||||
report_capability "NETMAP Target (NETMAP_TARGET)" $NETMAP_TARGET
|
report_capability "NETMAP Target (NETMAP_TARGET)" $NETMAP_TARGET
|
||||||
|
report_capability "--nflog-size support (NFLOG_SIZE)" $NFLOG_SIZE
|
||||||
|
report_capability "INPUT chain in nat table (NAT_INPUT_CHAIN)" $NAT_INPUT_CHAIN
|
||||||
|
|
||||||
echo " Kernel Version (KERNELVERSION): $KERNELVERSION"
|
echo " Kernel Version (KERNELVERSION): $KERNELVERSION"
|
||||||
echo " Capabilities Version (CAPVERSION): $CAPVERSION"
|
echo " Capabilities Version (CAPVERSION): $CAPVERSION"
|
||||||
@@ -3317,8 +3379,6 @@ report_capabilities() {
|
|||||||
report_capabilities_unsorted | sort
|
report_capabilities_unsorted | sort
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$PKTTYPE" ] || USEPKTTYPE=
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
report_capabilities_unsorted1() {
|
report_capabilities_unsorted1() {
|
||||||
@@ -3335,7 +3395,6 @@ report_capabilities_unsorted1() {
|
|||||||
report_capability1 CONNTRACK_MATCH
|
report_capability1 CONNTRACK_MATCH
|
||||||
report_capability1 NEW_CONNTRACK_MATCH
|
report_capability1 NEW_CONNTRACK_MATCH
|
||||||
report_capability1 OLD_CONNTRACK_MATCH
|
report_capability1 OLD_CONNTRACK_MATCH
|
||||||
report_capability1 USEPKTTYPE
|
|
||||||
report_capability1 POLICY_MATCH
|
report_capability1 POLICY_MATCH
|
||||||
report_capability1 PHYSDEV_MATCH
|
report_capability1 PHYSDEV_MATCH
|
||||||
report_capability1 PHYSDEV_BRIDGE
|
report_capability1 PHYSDEV_BRIDGE
|
||||||
@@ -3411,6 +3470,9 @@ report_capabilities_unsorted1() {
|
|||||||
report_capability1 WAIT_OPTION
|
report_capability1 WAIT_OPTION
|
||||||
report_capability1 CPU_FANOUT
|
report_capability1 CPU_FANOUT
|
||||||
report_capability1 NETMAP_TARGET
|
report_capability1 NETMAP_TARGET
|
||||||
|
report_capability1 NFLOG_SIZE
|
||||||
|
report_capability1 RESTORE_WAIT_OPTION
|
||||||
|
report_capability1 NAT_INPUT_CHAIN
|
||||||
|
|
||||||
report_capability1 AMANDA_HELPER
|
report_capability1 AMANDA_HELPER
|
||||||
report_capability1 FTP_HELPER
|
report_capability1 FTP_HELPER
|
||||||
@@ -3715,7 +3777,7 @@ ipcalc_command() {
|
|||||||
|
|
||||||
valid_address $address || fatal_error "Invalid IP address: $address"
|
valid_address $address || fatal_error "Invalid IP address: $address"
|
||||||
[ -z "$vlsm" ] && fatal_error "Missing VLSM"
|
[ -z "$vlsm" ] && fatal_error "Missing VLSM"
|
||||||
[ "x$address" = "x$vlsm" ] && "Invalid VLSM"
|
[ "x$address" = "x$vlsm" ] && fatal_error "Invalid VLSM"
|
||||||
[ $vlsm -gt 32 ] && fatal_error "Invalid VLSM: /$vlsm"
|
[ $vlsm -gt 32 ] && fatal_error "Invalid VLSM: /$vlsm"
|
||||||
|
|
||||||
address=$address/$vlsm
|
address=$address/$vlsm
|
||||||
@@ -3896,7 +3958,7 @@ get_config() {
|
|||||||
|
|
||||||
ensure_config_path
|
ensure_config_path
|
||||||
|
|
||||||
[ -f ${VARDIR}/firewall.conf ] && . ${VARDIR}/firewall.conf
|
[ -f $g_firewall.conf ] && . ${VARDIR}/firewall.conf
|
||||||
|
|
||||||
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||||
|
|
||||||
@@ -4050,15 +4112,15 @@ start_command() {
|
|||||||
rc=0
|
rc=0
|
||||||
[ -n "$g_nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
|
|
||||||
if [ -x ${VARDIR}/firewall ]; then
|
if [ -x $g_firewall ]; then
|
||||||
if [ -n "$g_fast" -a -x ${VARDIR}/${RESTOREFILE} -a ! ${VARDIR}/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} $g_debugging restore
|
||||||
else
|
else
|
||||||
run_it ${VARDIR}/firewall $g_debugging start
|
run_it $g_firewall $g_debugging start
|
||||||
fi
|
fi
|
||||||
rc=$?
|
rc=$?
|
||||||
else
|
else
|
||||||
error_message "${VARDIR}/firewall is missing or is not executable"
|
error_message "$g_firewall is missing or is not executable"
|
||||||
mylogger kern.err "ERROR:$g_product start failed"
|
mylogger kern.err "ERROR:$g_product start failed"
|
||||||
rc=6
|
rc=6
|
||||||
fi
|
fi
|
||||||
@@ -4187,11 +4249,11 @@ restart_command() {
|
|||||||
|
|
||||||
[ -n "$g_nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
|
|
||||||
if [ -x ${VARDIR}/firewall ]; then
|
if [ -x $g_firewall ]; then
|
||||||
run_it ${VARDIR}/firewall $g_debugging $COMMAND
|
run_it $g_firewall $g_debugging $COMMAND
|
||||||
rc=$?
|
rc=$?
|
||||||
else
|
else
|
||||||
error_message "${VARDIR}/firewall is missing or is not executable"
|
error_message "$g_firewall is missing or is not executable"
|
||||||
mylogger kern.err "ERROR:$g_product $COMMAND failed"
|
mylogger kern.err "ERROR:$g_product $COMMAND failed"
|
||||||
rc=6
|
rc=6
|
||||||
fi
|
fi
|
||||||
@@ -4201,10 +4263,10 @@ restart_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_command() {
|
run_command() {
|
||||||
if [ -x ${VARDIR}/firewall ] ; then
|
if [ -x $g_firewall ] ; then
|
||||||
run_it ${VARDIR}/firewall $g_debugging $@
|
run_it $g_firewall $g_debugging $@
|
||||||
else
|
else
|
||||||
fatal_error "${VARDIR}/firewall does not exist or is not executable"
|
fatal_error "$g_firewall does not exist or is not executable"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4262,7 +4324,6 @@ usage() # $1 = exit status
|
|||||||
|
|
||||||
echo " open <source> <dest> [ <protocol> [ <port> ] ]"
|
echo " open <source> <dest> [ <protocol> [ <port> ] ]"
|
||||||
echo " reenable <interface>"
|
echo " reenable <interface>"
|
||||||
ecko " refresh [ -d ] [ -n ] [ -T ] [ -D <directory> ] [ <chain>... ]"
|
|
||||||
echo " reject <address> ..."
|
echo " reject <address> ..."
|
||||||
|
|
||||||
if [ -n "$g_lite" ]; then
|
if [ -n "$g_lite" ]; then
|
||||||
@@ -4272,9 +4333,11 @@ usage() # $1 = exit status
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$g_lite" ]; then
|
if [ -z "$g_lite" ]; then
|
||||||
echo " remote-reload [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
echo " remote-getrc [ -T ] [ -c ] [ -r <root-name> ] [ [ -D ] <directory> ] [ <system> ]"
|
||||||
echo " remote-restart [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
echo " remote-getcaps [ -T ] [ -R ] [ -r <root-name> ] [ [ -D ] <directory> ] [ <system> ]"
|
||||||
echo " remote-start [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
echo " remote-reload [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] [ <system> ]"
|
||||||
|
echo " remote-restart [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] [ <system> ]"
|
||||||
|
echo " remote-start [ -n ] [ -s ] [ -c ] [ -r <root-name> ] [ -T ] [ -i ] [ <directory> ] [ <system> ]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " reset [ <chain> ... ]"
|
echo " reset [ <chain> ... ]"
|
||||||
@@ -4317,7 +4380,9 @@ usage() # $1 = exit status
|
|||||||
echo " [ show | list | ls ] nfacct"
|
echo " [ show | list | ls ] nfacct"
|
||||||
echo " [ show | list | ls ] opens"
|
echo " [ show | list | ls ] opens"
|
||||||
echo " [ show | list | ls ] policies"
|
echo " [ show | list | ls ] policies"
|
||||||
|
echo " [ show | list | ls ] rc"
|
||||||
echo " [ show | list | ls ] routing"
|
echo " [ show | list | ls ] routing"
|
||||||
|
echo " [ show | list | ls ] saves"
|
||||||
echo " [ show | list | ls ] tc [ device ]"
|
echo " [ show | list | ls ] tc [ device ]"
|
||||||
echo " [ show | list | ls ] vardir"
|
echo " [ show | list | ls ] vardir"
|
||||||
echo " [ show | list | ls ] zones"
|
echo " [ show | list | ls ] zones"
|
||||||
@@ -4366,7 +4431,6 @@ shorewall_cli() {
|
|||||||
g_use_verbosity=
|
g_use_verbosity=
|
||||||
g_debug=
|
g_debug=
|
||||||
g_export=
|
g_export=
|
||||||
g_refreshchains=:none:
|
|
||||||
g_confess=
|
g_confess=
|
||||||
g_update=
|
g_update=
|
||||||
g_annotate=
|
g_annotate=
|
||||||
@@ -4385,6 +4449,7 @@ shorewall_cli() {
|
|||||||
g_nopager=
|
g_nopager=
|
||||||
g_blacklistipset=
|
g_blacklistipset=
|
||||||
g_disconnect=
|
g_disconnect=
|
||||||
|
g_havemutex=
|
||||||
|
|
||||||
VERBOSE=
|
VERBOSE=
|
||||||
VERBOSITY=1
|
VERBOSITY=1
|
||||||
@@ -4557,12 +4622,14 @@ shorewall_cli() {
|
|||||||
|
|
||||||
case "$COMMAND" in
|
case "$COMMAND" in
|
||||||
start)
|
start)
|
||||||
|
only_root
|
||||||
get_config Yes Yes
|
get_config Yes Yes
|
||||||
shift
|
shift
|
||||||
start_command $@
|
start_command $@
|
||||||
;;
|
;;
|
||||||
stop|clear)
|
stop|clear)
|
||||||
[ $# -ne 1 ] && too_many_arguments $2
|
[ $# -ne 1 ] && too_many_arguments $2
|
||||||
|
only_root
|
||||||
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
|
||||||
@@ -4570,6 +4637,7 @@ shorewall_cli() {
|
|||||||
[ -n "$g_nolock" ] || mutex_off
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
;;
|
;;
|
||||||
reset)
|
reset)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
shift
|
shift
|
||||||
[ -n "$g_nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
@@ -4578,19 +4646,22 @@ shorewall_cli() {
|
|||||||
[ -n "$g_nolock" ] || mutex_off
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
;;
|
;;
|
||||||
reload|restart)
|
reload|restart)
|
||||||
|
only_root
|
||||||
get_config Yes Yes
|
get_config Yes Yes
|
||||||
shift
|
shift
|
||||||
restart_command $@
|
restart_command $@
|
||||||
;;
|
;;
|
||||||
disable|enable|reenable)
|
disable|enable|reenable)
|
||||||
|
only_root
|
||||||
get_config Yes
|
get_config Yes
|
||||||
if product_is_started; then
|
if product_is_started; then
|
||||||
run_it ${VARDIR}/firewall $g_debugging $@
|
run_it $g_firewall $g_debugging $@
|
||||||
else
|
else
|
||||||
fatal_error "$g_product is not running"
|
fatal_error "$g_product is not running"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
blacklist)
|
blacklist)
|
||||||
|
only_root
|
||||||
get_config Yes
|
get_config Yes
|
||||||
shift
|
shift
|
||||||
[ -n "$g_nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
@@ -4599,6 +4670,7 @@ shorewall_cli() {
|
|||||||
;;
|
;;
|
||||||
run)
|
run)
|
||||||
[ $# -gt 1 ] || fatal_error "Missing function name"
|
[ $# -gt 1 ] || fatal_error "Missing function name"
|
||||||
|
only_root
|
||||||
get_config Yes
|
get_config Yes
|
||||||
run_command $@
|
run_command $@
|
||||||
;;
|
;;
|
||||||
@@ -4608,18 +4680,20 @@ shorewall_cli() {
|
|||||||
show_command $@
|
show_command $@
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
[ "$(id -u)" != 0 ] && fatal_error "The status command may only be run by root"
|
only_root
|
||||||
get_config
|
get_config
|
||||||
shift
|
shift
|
||||||
status_command $@
|
status_command $@
|
||||||
;;
|
;;
|
||||||
dump)
|
dump)
|
||||||
|
only_root
|
||||||
get_config Yes No Yes
|
get_config Yes No Yes
|
||||||
shift
|
shift
|
||||||
dump_command $@
|
dump_command $@
|
||||||
;;
|
;;
|
||||||
hits)
|
hits)
|
||||||
[ $g_family -eq 6 ] && fatal_error "$g_product does not support the hits command"
|
[ $g_family -eq 6 ] && fatal_error "$g_product does not support the hits command"
|
||||||
|
only_root
|
||||||
get_config Yes No Yes
|
get_config Yes No Yes
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
shift
|
shift
|
||||||
@@ -4630,53 +4704,63 @@ shorewall_cli() {
|
|||||||
version_command $@
|
version_command $@
|
||||||
;;
|
;;
|
||||||
logwatch)
|
logwatch)
|
||||||
|
only_root
|
||||||
get_config Yes Yes Yes
|
get_config Yes Yes Yes
|
||||||
banner="${g_product}-$SHOREWALL_VERSION Logwatch at $g_hostname -"
|
banner="${g_product}-$SHOREWALL_VERSION Logwatch at $g_hostname -"
|
||||||
logwatch_command $@
|
logwatch_command $@
|
||||||
;;
|
;;
|
||||||
drop)
|
drop)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
[ $# -eq 1 ] && missing_argument
|
[ $# -eq 1 ] && missing_argument
|
||||||
drop_command $@
|
drop_command $@
|
||||||
;;
|
;;
|
||||||
logdrop)
|
logdrop)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
[ $# -eq 1 ] && missing_argument
|
[ $# -eq 1 ] && missing_argument
|
||||||
logdrop_command $@
|
logdrop_command $@
|
||||||
;;
|
;;
|
||||||
reject|logreject)
|
reject|logreject)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
[ $# -eq 1 ] && missing_argument
|
[ $# -eq 1 ] && missing_argument
|
||||||
reject_command $@
|
reject_command $@
|
||||||
;;
|
;;
|
||||||
open|close)
|
open|close)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
shift
|
shift
|
||||||
open_close_command $@
|
open_close_command $@
|
||||||
;;
|
;;
|
||||||
allow)
|
allow)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
allow_command $@
|
allow_command $@
|
||||||
;;
|
;;
|
||||||
add)
|
add)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
shift
|
shift
|
||||||
add_command $@
|
add_command $@
|
||||||
;;
|
;;
|
||||||
delete)
|
delete)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
shift
|
shift
|
||||||
delete_command $@
|
delete_command $@
|
||||||
;;
|
;;
|
||||||
save)
|
save)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
save_command $@
|
save_command $@
|
||||||
;;
|
;;
|
||||||
forget)
|
forget)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
forget_command $@
|
forget_command $@
|
||||||
;;
|
;;
|
||||||
@@ -4693,11 +4777,13 @@ shorewall_cli() {
|
|||||||
ipdecimal_command $@
|
ipdecimal_command $@
|
||||||
;;
|
;;
|
||||||
restore)
|
restore)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
shift
|
shift
|
||||||
restore_command $@
|
restore_command $@
|
||||||
;;
|
;;
|
||||||
call)
|
call)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
#
|
#
|
||||||
@@ -4735,17 +4821,20 @@ shorewall_cli() {
|
|||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
iptrace)
|
iptrace)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
shift
|
shift
|
||||||
iptrace_command $@
|
iptrace_command $@
|
||||||
;;
|
;;
|
||||||
noiptrace)
|
noiptrace)
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
shift
|
shift
|
||||||
noiptrace_command $@
|
noiptrace_command $@
|
||||||
;;
|
;;
|
||||||
savesets)
|
savesets)
|
||||||
[ $# -eq 1 ] || too_many_arguments $2
|
[ $# -eq 1 ] || too_many_arguments $2
|
||||||
|
only_root
|
||||||
get_config
|
get_config
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
savesets1
|
savesets1
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.common.
|
# Shorewall 5.2 -- /usr/share/shorewall/lib.common
|
||||||
#
|
#
|
||||||
# (c) 2010-2015 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2010-2017 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -269,53 +269,48 @@ loadmodule() # $1 = module name, $2 - * arguments
|
|||||||
{
|
{
|
||||||
local modulename
|
local modulename
|
||||||
modulename=$1
|
modulename=$1
|
||||||
|
shift
|
||||||
|
local moduleoptions
|
||||||
|
moduleoptions=$*
|
||||||
local modulefile
|
local modulefile
|
||||||
local suffix
|
local suffix
|
||||||
|
|
||||||
if [ -d /sys/module/ ]; then
|
if [ -d /sys/module/ ]; then
|
||||||
if ! list_search $modulename $DONT_LOAD; then
|
if ! list_search $modulename $DONT_LOAD; then
|
||||||
if [ ! -d /sys/module/$modulename ]; then
|
if [ ! -d /sys/module/$modulename ]; then
|
||||||
shift
|
case $moduleloader in
|
||||||
|
insmod)
|
||||||
for suffix in $MODULE_SUFFIX ; do
|
for directory in $moduledirectories; do
|
||||||
for directory in $moduledirectories; do
|
for modulefile in $directory/${modulename}.*; do
|
||||||
modulefile=$directory/${modulename}.${suffix}
|
if [ -f $modulefile ]; then
|
||||||
|
insmod $modulefile $moduleoptions
|
||||||
if [ -f $modulefile ]; then
|
return
|
||||||
case $moduleloader in
|
fi
|
||||||
insmod)
|
done
|
||||||
insmod $modulefile $*
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
modprobe $modulename $*
|
modprobe -q $modulename $moduleoptions
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif ! list_search $modulename $DONT_LOAD $MODULES; then
|
elif ! list_search $modulename $DONT_LOAD $MODULES; then
|
||||||
shift
|
case $moduleloader in
|
||||||
|
insmod)
|
||||||
for suffix in $MODULE_SUFFIX ; do
|
for directory in $moduledirectories; do
|
||||||
for directory in $moduledirectories; do
|
for modulefile in $directory/${modulename}.*; do
|
||||||
modulefile=$directory/${modulename}.${suffix}
|
if [ -f $modulefile ]; then
|
||||||
|
insmod $modulefile $moduleoptions
|
||||||
if [ -f $modulefile ]; then
|
return
|
||||||
case $moduleloader in
|
fi
|
||||||
insmod)
|
done
|
||||||
insmod $modulefile $*
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
modprobe $modulename $*
|
modprobe -q $modulename $moduleoptions
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,8 +333,6 @@ reload_kernel_modules() {
|
|||||||
moduleloader=insmod
|
moduleloader=insmod
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "${MODULE_SUFFIX:=ko ko.gz ko.xz o o.gz o.xz gz xz}" ]
|
|
||||||
|
|
||||||
if [ -n "$MODULESDIR" ]; then
|
if [ -n "$MODULESDIR" ]; then
|
||||||
case "$MODULESDIR" in
|
case "$MODULESDIR" in
|
||||||
+*)
|
+*)
|
||||||
@@ -394,8 +387,6 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
|
|||||||
moduleloader=insmod
|
moduleloader=insmod
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "${MODULE_SUFFIX:=o gz xz ko o.gz o.xz ko.gz ko.xz}" ]
|
|
||||||
|
|
||||||
if [ -n "$MODULESDIR" ]; then
|
if [ -n "$MODULESDIR" ]; then
|
||||||
case "$MODULESDIR" in
|
case "$MODULESDIR" in
|
||||||
+*)
|
+*)
|
||||||
@@ -763,7 +754,7 @@ mutex_on()
|
|||||||
|
|
||||||
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
|
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
|
||||||
|
|
||||||
if [ $MUTEX_TIMEOUT -gt 0 ]; then
|
if [ -z "$g_havemutex" -a $MUTEX_TIMEOUT -gt 0 ]; then
|
||||||
|
|
||||||
lockd=$(dirname $LOCKFILE)
|
lockd=$(dirname $LOCKFILE)
|
||||||
|
|
||||||
@@ -771,7 +762,7 @@ mutex_on()
|
|||||||
|
|
||||||
if [ -f $lockf ]; then
|
if [ -f $lockf ]; then
|
||||||
lockpid=`cat ${lockf} 2> /dev/null`
|
lockpid=`cat ${lockf} 2> /dev/null`
|
||||||
if [ -z "$lockpid" -o $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 [ $lockpid -eq $$ ]; then
|
||||||
@@ -784,12 +775,14 @@ mutex_on()
|
|||||||
|
|
||||||
if qt mywhich lockfile; then
|
if qt mywhich lockfile; then
|
||||||
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf}
|
lockfile -${MUTEX_TIMEOUT} -r1 ${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
|
elif qt mywhich lock; then
|
||||||
lock ${lockf}
|
lock ${lockf}
|
||||||
chmod u=r ${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
|
||||||
@@ -799,10 +792,15 @@ mutex_on()
|
|||||||
if [ ${try} -lt ${MUTEX_TIMEOUT} ] ; then
|
if [ ${try} -lt ${MUTEX_TIMEOUT} ] ; then
|
||||||
# Create the lockfile
|
# Create the lockfile
|
||||||
echo $$ > ${lockf}
|
echo $$ > ${lockf}
|
||||||
|
g_havemutex="rm -f ${lockf}"
|
||||||
else
|
else
|
||||||
echo "Giving up on lock file ${lockf}" >&2
|
echo "Giving up on lock file ${lockf}" >&2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$g_havemutex" ]; then
|
||||||
|
trap mutex_off EXIT
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -811,7 +809,10 @@ mutex_on()
|
|||||||
#
|
#
|
||||||
mutex_off()
|
mutex_off()
|
||||||
{
|
{
|
||||||
[ -f ${CONFDIR}/rc.common ] && lock -u ${LOCKFILE:=${VARDIR}/lock}
|
if [ -n "$g_havemutex" ]; then
|
||||||
rm -f ${LOCKFILE:=${VARDIR}/lock}
|
eval $g_havemutex
|
||||||
|
g_havemutex=
|
||||||
|
trap '' exit
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.core
|
# Shorewall 5.2 -- /usr/share/shorewall/lib.core
|
||||||
#
|
#
|
||||||
# (c) 1999-2015 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
# generated scripts.
|
# generated scripts.
|
||||||
#
|
#
|
||||||
|
|
||||||
SHOREWALL_LIBVERSION=50100
|
SHOREWALL_LIBVERSION=50108
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fatal Error
|
# Fatal Error
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#
|
#
|
||||||
#
|
# Shorewall 5.2 -- /usr/share/shorewall/lib.installer
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer.
|
|
||||||
#
|
#
|
||||||
# (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)
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#
|
#
|
||||||
#
|
# Shorewall 5.2 -- /usr/share/shorewall/lib.installer
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer.
|
|
||||||
#
|
#
|
||||||
# (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)
|
||||||
|
@@ -405,20 +405,6 @@
|
|||||||
<replaceable>provider</replaceable> }</arg>
|
<replaceable>provider</replaceable> }</arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>shorewall[6]</command>
|
|
||||||
|
|
||||||
<arg
|
|
||||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
|
||||||
|
|
||||||
<arg>options</arg>
|
|
||||||
|
|
||||||
<arg
|
|
||||||
choice="plain"><option>refresh</option><arg><option>-n</option></arg><arg><option>-d</option></arg><arg><option>-T</option></arg><arg><option>-i</option></arg><arg>-<option>D</option>
|
|
||||||
<replaceable>directory</replaceable> </arg><arg
|
|
||||||
rep="repeat"><replaceable>chain</replaceable></arg></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>shorewall[6][-lite]</command>
|
<command>shorewall[6][-lite]</command>
|
||||||
|
|
||||||
@@ -459,6 +445,54 @@
|
|||||||
<arg><replaceable>directory</replaceable></arg>
|
<arg><replaceable>directory</replaceable></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
|
<cmdsynopsis>
|
||||||
|
<command>shorewall[6]</command>
|
||||||
|
|
||||||
|
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||||
|
|
||||||
|
<arg>options</arg>
|
||||||
|
|
||||||
|
<arg choice="plain"><option>remote-getcaps</option></arg>
|
||||||
|
|
||||||
|
<arg><option>-s</option></arg>
|
||||||
|
|
||||||
|
<arg><option>-R</option></arg>
|
||||||
|
|
||||||
|
<arg><option>-r</option> <replaceable>root-user-name</replaceable></arg>
|
||||||
|
|
||||||
|
<arg><option>-T</option></arg>
|
||||||
|
|
||||||
|
<arg><option>-i</option></arg>
|
||||||
|
|
||||||
|
<arg><arg><option>-D</option></arg><replaceable>directory</replaceable></arg>
|
||||||
|
|
||||||
|
<arg choice="plain"><arg><replaceable>system</replaceable></arg></arg>
|
||||||
|
</cmdsynopsis>
|
||||||
|
|
||||||
|
<cmdsynopsis>
|
||||||
|
<command>shorewall[6]</command>
|
||||||
|
|
||||||
|
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||||
|
|
||||||
|
<arg>options</arg>
|
||||||
|
|
||||||
|
<arg choice="plain"><option>remote-getrc</option></arg>
|
||||||
|
|
||||||
|
<arg><option>-s</option></arg>
|
||||||
|
|
||||||
|
<arg><option>-c</option></arg>
|
||||||
|
|
||||||
|
<arg><option>-r</option> <replaceable>root-user-name</replaceable></arg>
|
||||||
|
|
||||||
|
<arg><option>-T</option></arg>
|
||||||
|
|
||||||
|
<arg><option>-i</option></arg>
|
||||||
|
|
||||||
|
<arg><arg><option>-D</option></arg><replaceable>directory</replaceable></arg>
|
||||||
|
|
||||||
|
<arg choice="plain"><arg><replaceable>system</replaceable></arg></arg>
|
||||||
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>shorewall[6]</command>
|
<command>shorewall[6]</command>
|
||||||
|
|
||||||
@@ -813,7 +847,7 @@
|
|||||||
|
|
||||||
<arg choice="req"><option>show | list | ls </option></arg>
|
<arg choice="req"><option>show | list | ls </option></arg>
|
||||||
|
|
||||||
<arg choice="plain"><option>tc</option></arg>
|
<arg choice="plain"><option>saves</option></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
|
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
@@ -1316,7 +1350,7 @@
|
|||||||
by the compiled script that executed the last successful <emphasis
|
by the compiled script that executed the last successful <emphasis
|
||||||
role="bold">start</emphasis>, <emphasis
|
role="bold">start</emphasis>, <emphasis
|
||||||
role="bold">restart</emphasis> or <emphasis
|
role="bold">restart</emphasis> or <emphasis
|
||||||
role="bold">refresh</emphasis> command if that script exists.</para>
|
role="bold">reload</emphasis> command if that script exists.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -1773,63 +1807,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><emphasis role="bold">refresh </emphasis> [-<option>n</option>]
|
|
||||||
[-<option>d</option>] [-<option>T</option>] [-i] [-<option>D
|
|
||||||
</option><replaceable>directory</replaceable> ] [
|
|
||||||
<replaceable>chain</replaceable>... ]</term>
|
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<para>Not available with Shorewall[6]-lite.</para>
|
|
||||||
|
|
||||||
<para>All steps performed by <command>restart</command> are
|
|
||||||
performed by <command>refresh</command> with the exception that
|
|
||||||
<command>refresh</command> only recreates the chains specified in
|
|
||||||
the command while <command>restart</command> recreates the entire
|
|
||||||
Netfilter ruleset. If no <replaceable>chain</replaceable> is given,
|
|
||||||
the static blacklisting chain <emphasis
|
|
||||||
role="bold">blacklst</emphasis> is assumed.</para>
|
|
||||||
|
|
||||||
<para>The listed chains are assumed to be in the filter table. You
|
|
||||||
can refresh chains in other tables by prefixing the chain name with
|
|
||||||
the table name followed by ":" (e.g., nat:net_dnat). Chain names
|
|
||||||
which follow are assumed to be in that table until the end of the
|
|
||||||
list or until an entry in the list names another table. Built-in
|
|
||||||
chains such as FORWARD may not be refreshed.</para>
|
|
||||||
|
|
||||||
<para>The <option>-n</option> option was added in Shorewall 4.5.3
|
|
||||||
causes Shorewall to avoid updating the routing table(s).</para>
|
|
||||||
|
|
||||||
<para>The <option>-d</option> option was added in Shorewall 4.5.3
|
|
||||||
causes the compiler to run under the Perl debugger.</para>
|
|
||||||
|
|
||||||
<para>The <option>-T</option> option was added in Shorewall 4.5.3
|
|
||||||
and causes a Perl stack trace to be included with each
|
|
||||||
compiler-generated error and warning message.</para>
|
|
||||||
|
|
||||||
<para>The <option>-i</option> option was added in Shorewall 4.6.0
|
|
||||||
and causes a warning message to be issued if the current line
|
|
||||||
contains alternative input specifications following a semicolon
|
|
||||||
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
|
|
||||||
set to Yes in <ulink
|
|
||||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para>
|
|
||||||
|
|
||||||
<para>The <option>-D</option> option was added in Shorewall 4.5.3
|
|
||||||
and causes Shorewall to look in the given
|
|
||||||
<emphasis>directory</emphasis> first for configuration files.</para>
|
|
||||||
|
|
||||||
<para>Example:<programlisting><command>shorewall refresh net2fw nat:net_dnat</command> #Refresh the 'net2loc' chain in the filter table and the 'net_dnat' chain in the nat table</programlisting></para>
|
|
||||||
|
|
||||||
<para>The <emphasis role="bold">refresh</emphasis> command has
|
|
||||||
slightly different behavior. When no chain name is given to the
|
|
||||||
<emphasis role="bold">refresh</emphasis> command, the mangle table
|
|
||||||
is refreshed along with the blacklist chain (if any). This allows
|
|
||||||
you to modify <filename>/etc/shorewall/tcrules </filename>and
|
|
||||||
install the changes using <emphasis
|
|
||||||
role="bold">refresh</emphasis>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">reject</emphasis><replaceable>
|
<term><emphasis role="bold">reject</emphasis><replaceable>
|
||||||
address</replaceable></term>
|
address</replaceable></term>
|
||||||
@@ -1941,6 +1918,57 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><emphasis role="bold">remote-getcaps</emphasis>
|
||||||
|
[-<option>R</option>] [-<option>r</option>
|
||||||
|
<replaceable>root-user-name</replaceable>] [ [ -D ]
|
||||||
|
<replaceable>directory</replaceable> ] [
|
||||||
|
<replaceable>system</replaceable> ]</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shoreall 5.2.0, this command executes <emphasis
|
||||||
|
role="bold">shorewall[6]-lite show capabilities -f >
|
||||||
|
/var/lib/shorewall[6]-lite/capabilities</emphasis> on the remote
|
||||||
|
<replaceable>system</replaceable> via ssh then the generated file is
|
||||||
|
copied to <replaceable>directory</replaceable> on the local system.
|
||||||
|
If no <replaceable>directory</replaceable> is given, the current
|
||||||
|
working directory is assumed.</para>
|
||||||
|
|
||||||
|
<para>if <emphasis role="bold">-R</emphasis> is included, the remote
|
||||||
|
shorewallrc file is also copied to
|
||||||
|
<replaceable>directory</replaceable>.</para>
|
||||||
|
|
||||||
|
<para>If <option>-r</option> is included, it specifies that the root
|
||||||
|
user on <replaceable>system</replaceable> is named
|
||||||
|
<replaceable>root-user-name</replaceable> rather than "root".</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><emphasis role="bold">remote-getrc</emphasis>
|
||||||
|
[-<option>c</option>] [-<option>r</option>
|
||||||
|
<replaceable>root-user-name</replaceable>] [ [ -D ]
|
||||||
|
<replaceable>directory</replaceable> ] [
|
||||||
|
<replaceable>system</replaceable> ]</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shoreall 5.2.0, this command copies the shorewallrc
|
||||||
|
file from the remote <replaceable>system</replaceable> to
|
||||||
|
<replaceable>directory</replaceable> on the local system. If no
|
||||||
|
<replaceable>directory</replaceable> is given, the current working
|
||||||
|
directory is assumed.</para>
|
||||||
|
|
||||||
|
<para>if <emphasis role="bold">-c</emphasis> is included, the remote
|
||||||
|
capabilities are also copied to
|
||||||
|
<replaceable>directory</replaceable>, as is done by the
|
||||||
|
<command>remote-getcaps</command> command.</para>
|
||||||
|
|
||||||
|
<para>If <option>-r</option> is included, it specifies that the root
|
||||||
|
user on <replaceable>system</replaceable> is named
|
||||||
|
<replaceable>root-user-name</replaceable> rather than "root".</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">remote-start</emphasis>
|
<term><emphasis role="bold">remote-start</emphasis>
|
||||||
[-<option>n</option>] [-<option>s</option>] [-<option>c</option>]
|
[-<option>n</option>] [-<option>s</option>] [-<option>c</option>]
|
||||||
@@ -1992,9 +2020,9 @@
|
|||||||
role="bold">shorewall-lite save</emphasis> via ssh.</para>
|
role="bold">shorewall-lite save</emphasis> via ssh.</para>
|
||||||
|
|
||||||
<para>if <emphasis role="bold">-c</emphasis> is included, the
|
<para>if <emphasis role="bold">-c</emphasis> is included, the
|
||||||
command <emphasis role="bold">shorewall-lite show capabilities -f
|
command <emphasis role="bold">shorewall[6]-lite show capabilities -f
|
||||||
> /var/lib/shorewall-lite/capabilities</emphasis> is executed via
|
> /var/lib/shorewall[6]-lite/capabilities</emphasis> is executed
|
||||||
ssh then the generated file is copied to
|
via ssh then the generated file is copied to
|
||||||
<replaceable>directory</replaceable> using scp. This step is
|
<replaceable>directory</replaceable> using scp. This step is
|
||||||
performed before the configuration is compiled.</para>
|
performed before the configuration is compiled.</para>
|
||||||
|
|
||||||
@@ -2005,13 +2033,6 @@
|
|||||||
<para>The <option>-T</option> option was added in Shorewall 4.5.3
|
<para>The <option>-T</option> option was added in Shorewall 4.5.3
|
||||||
and causes a Perl stack trace to be included with each
|
and causes a Perl stack trace to be included with each
|
||||||
compiler-generated error and warning message.</para>
|
compiler-generated error and warning message.</para>
|
||||||
|
|
||||||
<para>The <option>-i</option> option was added in Shorewall 4.6.0
|
|
||||||
and causes a warning message to be issued if the current line
|
|
||||||
contains alternative input specifications following a semicolon
|
|
||||||
(";"). Such lines will be handled incorrectly if INLINE_MATCHES is
|
|
||||||
set to Yes in <ulink
|
|
||||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -2430,11 +2451,11 @@
|
|||||||
<replaceable>filename</replaceable> ]</term>
|
<replaceable>filename</replaceable> ]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>The dynamic blacklist is stored in /var/lib/shorewall/save.
|
<para>Creates a snapshot of the currently running firewall. The
|
||||||
The state of the firewall is stored in
|
dynamic blacklist is stored in /var/lib/shorewall/save. The state of
|
||||||
|
the firewall is stored in
|
||||||
/var/lib/shorewall/<emphasis>filename</emphasis> for use by the
|
/var/lib/shorewall/<emphasis>filename</emphasis> for use by the
|
||||||
<emphasis role="bold">shorewall restore</emphasis> and <emphasis
|
<emphasis role="bold">shorewall restore</emphasis> command. If
|
||||||
role="bold">shorewall -f start</emphasis> commands. If
|
|
||||||
<emphasis>filename</emphasis> is not given then the state is saved
|
<emphasis>filename</emphasis> is not given then the state is saved
|
||||||
in the file specified by the RESTOREFILE option in <ulink
|
in the file specified by the RESTOREFILE option in <ulink
|
||||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||||
@@ -2737,6 +2758,15 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><emphasis role="bold">rc</emphasis></term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shorewall 5.2.0. Displays the contents of
|
||||||
|
$SHAREDIR/shorewall/shorewallrc.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>[-<option>c</option>]<emphasis role="bold">
|
<term>[-<option>c</option>]<emphasis role="bold">
|
||||||
routing</emphasis></term>
|
routing</emphasis></term>
|
||||||
@@ -2762,6 +2792,20 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>saves</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shorewall 5.2.0. Lists snapshots created by the
|
||||||
|
<command>save</command> command. Each snapshot is listed with
|
||||||
|
the date and time when it was taken. If there is a snapshot
|
||||||
|
with the name specified in the RESTOREFILE option in <ulink
|
||||||
|
url="shorewall.conf.html">shorewall.conf(5</ulink>), that
|
||||||
|
snapshot is listed as the <emphasis>default</emphasis>
|
||||||
|
snapshot for the <command>restore</command> command.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">tc</emphasis></term>
|
<term><emphasis role="bold">tc</emphasis></term>
|
||||||
|
|
||||||
@@ -2921,7 +2965,7 @@
|
|||||||
by the compiled script that executed the last successful <emphasis
|
by the compiled script that executed the last successful <emphasis
|
||||||
role="bold">start</emphasis>, <emphasis
|
role="bold">start</emphasis>, <emphasis
|
||||||
role="bold">restart</emphasis> or <emphasis
|
role="bold">restart</emphasis> or <emphasis
|
||||||
role="bold">refresh</emphasis> command if that script exists.</para>
|
role="bold">reload</emphasis> command if that script exists.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -3173,6 +3217,8 @@
|
|||||||
<title>FILES</title>
|
<title>FILES</title>
|
||||||
|
|
||||||
<para>/etc/shorewall/</para>
|
<para>/etc/shorewall/</para>
|
||||||
|
|
||||||
|
<para>/etc/shorewall6/</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
@@ -3182,13 +3228,18 @@
|
|||||||
url="/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink></para>
|
url="/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink></para>
|
||||||
|
|
||||||
<para>shorewall-accounting(5), shorewall-actions(5),
|
<para>shorewall-accounting(5), shorewall-actions(5),
|
||||||
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
|
shorewall-arprules(5), shorewall-blrules(5), shorewall.conf(5),
|
||||||
shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
|
shorewall-conntrack(5), shorewall-ecn(5), shorewall-exclusion(5),
|
||||||
shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
|
shorewall-hosts(5), shorewall-init(5), shorewall_interfaces(5),
|
||||||
shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
|
shorewall-ipsets(5), shorewall-logging(), shorewall-maclist(5),
|
||||||
shorewall-rtrules(5), shorewall-routestopped(5), shorewall-rules(5),
|
shorewall-mangle(5), shorewall-masq(5), shorewall-modules(5),
|
||||||
shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
|
shorewall-nat(5), shorewall-nesting(5), shorewall-netmap(5),
|
||||||
shorewall-tcdevices(5), shorewall-tcrules(5), shorewall-tos(5),
|
shorewall-params(5), shorewall-policy(5), shorewall-providers(5),
|
||||||
shorewall-tunnels(5), shorewall-zones(5)</para>
|
shorewall-proxyarp(5), shorewall6-proxyndp(5), shorewall-routes(5),
|
||||||
|
shorewall-rtrules(5), shorewall-rtrules(5), shorewall-rules(5),
|
||||||
|
shorewall-secmarks(5), shorewall-snat(5), shorewall-tcclasses(5),
|
||||||
|
shorewall-tcdevices(5), shorewall-tcfilters(5), shorewall-tcinterfaces(5),
|
||||||
|
shorewall-tcpri(5), shorewall-tunnels(5), shorewall-vardir(5),
|
||||||
|
shorewall-zones(5)</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Shorewall Packet Filtering Firewall Control Program - V5.0
|
# Shorewall Packet Filtering Firewall Control Program - V5.1
|
||||||
#
|
#
|
||||||
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2014,2015 -
|
# (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 http://www.shorewall.net
|
||||||
@@ -25,6 +25,10 @@
|
|||||||
# For a list of supported commands, type 'shorewall help' or 'shorewall6 help'
|
# For a list of supported commands, type 'shorewall help' or 'shorewall6 help'
|
||||||
#
|
#
|
||||||
################################################################################################
|
################################################################################################
|
||||||
|
#
|
||||||
|
# Default product is Shorewall. PRODUCT will be set based on $0 and on passed -[46] and -l
|
||||||
|
# options
|
||||||
|
#
|
||||||
PRODUCT=shorewall
|
PRODUCT=shorewall
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -13,9 +13,9 @@ MANDIR=${PREFIX}/share/man #Directory where manpages are installed.
|
|||||||
INITDIR= #Directory where SysV init scripts are installed.
|
INITDIR= #Directory where SysV init scripts are installed.
|
||||||
INITFILE= #Name of the product's installed SysV init script
|
INITFILE= #Name of the product's installed SysV init script
|
||||||
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
|
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
|
||||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
ANNOTATED= #If non-empty, annotated configuration files are installed
|
||||||
SYSCONFFILE=default.debian.systemd #Name of the distributed file to be installed in $SYSCONFDIR
|
SYSCONFFILE=default.debian.systemd #Name of the distributed file to be installed in $SYSCONFDIR
|
||||||
SERVICEFILE=$PRODUCT.service.debian #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
|
SERVICEFILE=$PRODUCT.service.debian #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
|
||||||
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
|
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
|
||||||
SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
|
SERVICEDIR=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
|
||||||
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
|
28
Shorewall-core/shorewallrc.sandbox
Normal file
28
Shorewall-core/shorewallrc.sandbox
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#
|
||||||
|
# Shorewall 5.2 rc file for installing into a Sandbox
|
||||||
|
#
|
||||||
|
BUILD= # Default is to detect the build system
|
||||||
|
HOST=linux
|
||||||
|
INSTALLDIR= # Set this to the directory where you want Shorewall installed
|
||||||
|
PREFIX=${INSTALLDIR}/usr # Top-level directory for shared files, libraries, etc.
|
||||||
|
SHAREDIR=${PREFIX}/share # Directory for arch-neutral files.
|
||||||
|
LIBEXECDIR=${PREFIX}/share # Directory for executable scripts.
|
||||||
|
PERLLIBDIR=${PREFIX}/share/shorewall # Directory to install Shorewall Perl module directory
|
||||||
|
CONFDIR=${INSTALLDIR}/etc # Directory where subsystem configurations are installed
|
||||||
|
SBINDIR=${INSTALLDIR}/sbin # Directory where system administration programs are installed
|
||||||
|
MANDIR= # Leave empty
|
||||||
|
INITDIR= # Leave empty
|
||||||
|
INITSOURCE= # Leave empty
|
||||||
|
INITFILE= # Leave empty
|
||||||
|
AUXINITSOURCE= # Leave empty
|
||||||
|
AUXINITFILE= # Leave empty
|
||||||
|
SERVICEDIR= # Leave empty
|
||||||
|
SERVICEFILE= # Leave empty
|
||||||
|
SYSCONFFILE= # Leave empty
|
||||||
|
SYSCONFDIR= # Leave empty
|
||||||
|
SPARSE= # Leave empty
|
||||||
|
ANNOTATED= # If non-empty, annotated configuration files are installed
|
||||||
|
VARLIB=${INSTALLDIR}/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
|
||||||
|
SANDBOX=Yes # Indicates SANDBOX installation
|
@@ -73,12 +73,16 @@ setstatedir() {
|
|||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
${SBINDIR}/shorewall compile
|
return 0
|
||||||
elif [ $PRODUCT = shorewall6 ]; then
|
|
||||||
${SBINDIR}/shorewall -6 compile
|
|
||||||
else
|
else
|
||||||
return 0
|
if [ $PRODUCT = shorewall ]; then
|
||||||
|
${SBINDIR}/shorewall compile
|
||||||
|
elif [ $PRODUCT = shorewall6 ]; then
|
||||||
|
${SBINDIR}/shorewall -6 compile
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,16 +112,14 @@ shorewall_start () {
|
|||||||
|
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
#
|
||||||
#
|
# Run in a sub-shell to avoid name collisions
|
||||||
# Run in a sub-shell to avoid name collisions
|
#
|
||||||
#
|
(
|
||||||
(
|
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
${STATEDIR}/firewall ${OPTIONS} stop
|
||||||
${STATEDIR}/firewall ${OPTIONS} stop
|
fi
|
||||||
fi
|
)
|
||||||
)
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -145,9 +147,7 @@ shorewall_stop () {
|
|||||||
printf "Clearing \"Shorewall-based firewalls\": "
|
printf "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
${STATEDIR}/firewall ${OPTIONS} clear
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -159,8 +159,9 @@ shorewall_stop () {
|
|||||||
|
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||||
else
|
else
|
||||||
|
rm -f "${SAVE_IPSETS}.tmp"
|
||||||
echo_notdone
|
echo_notdone
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -44,12 +44,14 @@ setstatedir() {
|
|||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
|
return 0
|
||||||
|
elif [ $PRODUCT = shorewall ]; then
|
||||||
${SBINDIR}/shorewall compile
|
${SBINDIR}/shorewall compile
|
||||||
elif [ $PRODUCT = shorewall6 ]; then
|
elif [ $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/shorewall -6 compile
|
${SBINDIR}/shorewall -6 compile
|
||||||
else
|
else
|
||||||
return 0
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,20 +68,20 @@ start () {
|
|||||||
|
|
||||||
printf "Initializing \"Shorewall-based firewalls\": "
|
printf "Initializing \"Shorewall-based firewalls\": "
|
||||||
|
|
||||||
|
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||||
|
ipset -R < "$SAVE_IPSETS"
|
||||||
|
fi
|
||||||
|
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
setstatedir
|
setstatedir
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
if [ $retval -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
if [ -x "${STATEDIR}/firewall" ]; then
|
${STATEDIR}/firewall ${OPTIONS} stop 2>&1 | $logger
|
||||||
${STATEDIR}/firewall ${OPTIONS} stop 2>&1 | $logger
|
retval=${PIPESTATUS[0]}
|
||||||
retval=${PIPESTATUS[0]}
|
[ $retval -ne 0 ] && break
|
||||||
[ $retval -ne 0 ] && break
|
|
||||||
else
|
|
||||||
retval=6 #Product not configured
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
|
retval=6 #Product not configured
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -106,20 +108,25 @@ stop () {
|
|||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
if [ $retval -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
if [ -x "${STATEDIR}/firewall" ]; then
|
${STATEDIR}/firewall ${OPTIONS} clear 2>&1 | $logger
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear 2>&1 | $logger
|
retval=${PIPESTATUS[0]}
|
||||||
retval=${PIPESTATUS[0]}
|
[ $retval -ne 0 ] && break
|
||||||
[ $retval -ne 0 ] && break
|
|
||||||
else
|
|
||||||
retval=6 #Product not configured
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
|
retval=6 #Product not configured
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $retval -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
|
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
|
||||||
|
|
||||||
rm -f $lockfile
|
rm -f $lockfile
|
||||||
success
|
success
|
||||||
else
|
else
|
||||||
|
24
Shorewall-init/init.openwrt.sh
Normal file → Executable file
24
Shorewall-init/init.openwrt.sh
Normal file → Executable file
@@ -75,12 +75,14 @@ setstatedir() {
|
|||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
|
return 0
|
||||||
|
elif [ $PRODUCT = shorewall ]; then
|
||||||
${SBINDIR}/shorewall compile
|
${SBINDIR}/shorewall compile
|
||||||
elif [ $PRODUCT = shorewall6 ]; then
|
elif [ $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/shorewall -6 compile
|
${SBINDIR}/shorewall -6 compile
|
||||||
else
|
else
|
||||||
return 0
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,10 +94,8 @@ start () {
|
|||||||
printf "Initializing \"Shorewall-based firewalls\": "
|
printf "Initializing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
${STATEDIR}/firewall ${OPTIONS} stop
|
||||||
${STATEDIR}/firewall ${OPTIONS} stop
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -103,6 +103,8 @@ start () {
|
|||||||
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||||
ipset -R < "$SAVE_IPSETS"
|
ipset -R < "$SAVE_IPSETS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
boot () {
|
boot () {
|
||||||
@@ -117,17 +119,19 @@ stop () {
|
|||||||
printf "Clearing \"Shorewall-based firewalls\": "
|
printf "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
${STATEDIR}/firewall ${OPTIONS} clear
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$SAVE_IPSETS" ]; then
|
if [ -n "$SAVE_IPSETS" ]; then
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,10 +69,12 @@ setstatedir() {
|
|||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
|
return 0
|
||||||
|
elif [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/$PRODUCT ${OPTIONS} compile $STATEDIR/firewall
|
${SBINDIR}/$PRODUCT ${OPTIONS} compile $STATEDIR/firewall
|
||||||
else
|
else
|
||||||
return 0
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,10 +86,8 @@ shorewall_start () {
|
|||||||
printf "Initializing \"Shorewall-based firewalls\": "
|
printf "Initializing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
${STATEDIR}/firewall ${OPTIONS} stop
|
||||||
${STATEDIR}/firewall ${OPTIONS} stop
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -107,16 +107,16 @@ shorewall_stop () {
|
|||||||
printf "Clearing \"Shorewall-based firewalls\": "
|
printf "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
${STATEDIR}/firewall ${OPTIONS} clear
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$SAVE_IPSETS" ]; then
|
if [ -n "$SAVE_IPSETS" ]; then
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -79,12 +79,14 @@ setstatedir() {
|
|||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
|
return 0
|
||||||
|
elif [ $PRODUCT = shorewall ]; then
|
||||||
${SBINDIR}/shorewall compile
|
${SBINDIR}/shorewall compile
|
||||||
elif [ $PRODUCT = shorewall6 ]; then
|
elif [ $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/shorewall -6 compile
|
${SBINDIR}/shorewall -6 compile
|
||||||
else
|
else
|
||||||
return 0
|
return 6
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,10 +98,8 @@ shorewall_start () {
|
|||||||
printf "Initializing \"Shorewall-based firewalls\": "
|
printf "Initializing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x $STATEDIR/firewall ]; then
|
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop
|
||||||
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -117,16 +117,16 @@ shorewall_stop () {
|
|||||||
printf "Clearing \"Shorewall-based firewalls\": "
|
printf "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
${STATEDIR}/firewall ${OPTIONS} clear
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$SAVE_IPSETS" ]; then
|
if [ -n "$SAVE_IPSETS" ]; then
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@@ -33,12 +33,12 @@ setstatedir() {
|
|||||||
|
|
||||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||||
|
|
||||||
if [ $PRODUCT = shorewall ]; then
|
if [ -x ${STATEDIR}/firewall ]; then
|
||||||
|
return 0
|
||||||
|
elif [ $PRODUCT = shorewall ]; then
|
||||||
${SBINDIR}/shorewall compile
|
${SBINDIR}/shorewall compile
|
||||||
elif [ $PRODUCT = shorewall6 ]; then
|
elif [ $PRODUCT = shorewall6 ]; then
|
||||||
${SBINDIR}/shorewall -6 compile
|
${SBINDIR}/shorewall -6 compile
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,16 +67,14 @@ shorewall_start () {
|
|||||||
printf "Initializing \"Shorewall-based firewalls\": "
|
printf "Initializing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
#
|
||||||
#
|
# Run in a sub-shell to avoid name collisions
|
||||||
# Run in a sub-shell to avoid name collisions
|
#
|
||||||
#
|
(
|
||||||
(
|
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
${STATEDIR}/firewall ${OPTIONS} stop
|
||||||
${STATEDIR}/firewall ${OPTIONS} stop
|
fi
|
||||||
fi
|
)
|
||||||
)
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -95,16 +93,16 @@ shorewall_stop () {
|
|||||||
printf "Clearing \"Shorewall-based firewalls\": "
|
printf "Clearing \"Shorewall-based firewalls\": "
|
||||||
for PRODUCT in $PRODUCTS; do
|
for PRODUCT in $PRODUCTS; do
|
||||||
if setstatedir; then
|
if setstatedir; then
|
||||||
if [ -x ${STATEDIR}/firewall ]; then
|
${STATEDIR}/firewall ${OPTIONS} clear
|
||||||
${STATEDIR}/firewall ${OPTIONS} clear
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$SAVE_IPSETS" ]; then
|
if [ -n "$SAVE_IPSETS" ]; then
|
||||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 4.4 -- /usr/share/shorewall-lite/lib.base
|
# Shorewall 5.2 -- /usr/share/shorewall-lite/lib.base
|
||||||
#
|
#
|
||||||
# (c) 2011,2014 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2011,2014 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#
|
#
|
||||||
# On the target system (the system where the firewall program is to run):
|
# On the target system (the system where the firewall program is to run):
|
||||||
#
|
#
|
||||||
# [ IPTABLES=<iptables binary> ] [ MODULESDIR=<kernel modules directory> ] [ MODULE_SUFFIX="<module suffix list>" ] shorecap > capabilities
|
# [ IPTABLES=<iptables binary> ] [ MODULESDIR=<kernel modules directory> ] shorecap > capabilities
|
||||||
#
|
#
|
||||||
# Now move the capabilities file to the compilation system. The file must
|
# Now move the capabilities file to the compilation system. The file must
|
||||||
# be placed in a directory on the CONFIG_PATH to be used when compiling firewalls
|
# be placed in a directory on the CONFIG_PATH to be used when compiling firewalls
|
||||||
@@ -38,7 +38,6 @@
|
|||||||
#
|
#
|
||||||
# IPTABLES - iptables
|
# IPTABLES - iptables
|
||||||
# MODULESDIR - /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter
|
# MODULESDIR - /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter
|
||||||
# MODULE_SUFFIX - "o gz xz ko o.gz o.xz ko.gz ko.xz"
|
|
||||||
#
|
#
|
||||||
# Shorewall need not be installed on the target system to run shorecap. If the '-e' flag is
|
# Shorewall need not be installed on the target system to run shorecap. If the '-e' flag is
|
||||||
# used during firewall compilation, then the generated firewall program will likewise not
|
# used during firewall compilation, then the generated firewall program will likewise not
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall6 -- /usr/share/shorewall/action.A_AllowICMPs
|
|
||||||
#
|
|
||||||
# This action A_ACCEPTs needed ICMP types
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO DPORT
|
|
||||||
|
|
||||||
AllowICMPs(A_ACCEPT)
|
|
@@ -1,57 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall -- /usr/share/shorewall/action.A_Drop
|
|
||||||
#
|
|
||||||
# The audited default DROP common rules
|
|
||||||
#
|
|
||||||
# This action is invoked before a DROP policy is enforced. The purpose
|
|
||||||
# of the action is:
|
|
||||||
#
|
|
||||||
# a) Avoid logging lots of useless cruft.
|
|
||||||
# b) Ensure that certain ICMP packets that are necessary for successful
|
|
||||||
# internet operation are always ACCEPTed.
|
|
||||||
#
|
|
||||||
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
|
|
||||||
#
|
|
||||||
?require AUDIT_TARGET
|
|
||||||
?warning "You are using the deprecated A_Drop default action. Please see http://www.shorewall.net/Actions.html
|
|
||||||
###############################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT
|
|
||||||
#
|
|
||||||
# Count packets that come through here
|
|
||||||
#
|
|
||||||
COUNT
|
|
||||||
#
|
|
||||||
# Special Handling for Auth
|
|
||||||
#
|
|
||||||
Auth(A_DROP)
|
|
||||||
#
|
|
||||||
# ACCEPT critical ICMP types
|
|
||||||
#
|
|
||||||
# For IPv6 connectivity ipv6-icmp broadcasting is required so
|
|
||||||
# AllowICMPs must be before broadcast Drop.
|
|
||||||
#
|
|
||||||
A_AllowICMPs - - icmp
|
|
||||||
#
|
|
||||||
# Don't log broadcasts and multicasts
|
|
||||||
#
|
|
||||||
dropBcast(audit)
|
|
||||||
dropMcast(audit)
|
|
||||||
#
|
|
||||||
# Drop packets that are in the INVALID state -- these are usually ICMP packets
|
|
||||||
# and just confuse people when they appear in the log.
|
|
||||||
#
|
|
||||||
dropInvalid(audit)
|
|
||||||
#
|
|
||||||
# Drop Microsoft noise so that it doesn't clutter up the log.
|
|
||||||
#
|
|
||||||
SMB(A_DROP)
|
|
||||||
A_DropUPnP
|
|
||||||
#
|
|
||||||
# Drop 'newnotsyn' traffic so that it doesn't get logged.
|
|
||||||
#
|
|
||||||
dropNotSyn(audit) - - tcp
|
|
||||||
#
|
|
||||||
# Drop late-arriving DNS replies. These are just a nuisance and clutter up
|
|
||||||
# the log.
|
|
||||||
#
|
|
||||||
A_DropDNSrep
|
|
@@ -1,11 +1,11 @@
|
|||||||
#
|
#
|
||||||
# Shorewall -- /usr/share/shorewall/action.A_REJECTWITH
|
# Shorewall -- /usr/share/shorewall/action.A_REJECT
|
||||||
#
|
#
|
||||||
# A_REJECT Action.
|
# A_REJECT Action.
|
||||||
#
|
#
|
||||||
# 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) 2012-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2012-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,54 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall -- /usr/share/shorewall/action.A_Reject
|
|
||||||
#
|
|
||||||
# The audited default REJECT action common rules
|
|
||||||
#
|
|
||||||
# This action is invoked before a REJECT policy is enforced. The purpose
|
|
||||||
# of the action is:
|
|
||||||
#
|
|
||||||
# a) Avoid logging lots of useless cruft.
|
|
||||||
# b) Ensure that certain ICMP packets that are necessary for successful
|
|
||||||
# internet operation are always ACCEPTed.
|
|
||||||
#
|
|
||||||
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
|
|
||||||
?require AUDIT_TARGET
|
|
||||||
?warning "You are using the deprecated A_REJECT default action. Please see http://www.shorewall.net/Actions.html
|
|
||||||
###############################################################################
|
|
||||||
#ACTION SOURCE DEST PROTO
|
|
||||||
#
|
|
||||||
# Count packets that come through here
|
|
||||||
#
|
|
||||||
COUNT
|
|
||||||
#
|
|
||||||
# ACCEPT critical ICMP types
|
|
||||||
#
|
|
||||||
# For IPv6 connectivity ipv6-icmp broadcasting is required so
|
|
||||||
# AllowICMPs must be before broadcast Drop.
|
|
||||||
#
|
|
||||||
A_AllowICMPs - - icmp
|
|
||||||
#
|
|
||||||
# Drop Broadcasts and multicasts so they don't clutter up the log
|
|
||||||
# (these must *not* be rejected).
|
|
||||||
#
|
|
||||||
dropBcast(audit)
|
|
||||||
dropMcast(audit)
|
|
||||||
#
|
|
||||||
# Drop packets that are in the INVALID state -- these are usually ICMP packets
|
|
||||||
# and just confuse people when they appear in the log (these ICMPs cannot be
|
|
||||||
# rejected).
|
|
||||||
#
|
|
||||||
dropInvalid(audit)
|
|
||||||
#
|
|
||||||
# Reject Microsoft noise so that it doesn't clutter up the log.
|
|
||||||
#
|
|
||||||
SMB(A_REJECT)
|
|
||||||
A_DropUPnP
|
|
||||||
#
|
|
||||||
# Drop 'newnotsyn' traffic so that it doesn't get logged.
|
|
||||||
#
|
|
||||||
dropNotSyn(audit) - - tcp
|
|
||||||
#
|
|
||||||
# Drop late-arriving DNS replies. These are just a nuisance and clutter up
|
|
||||||
# the log.
|
|
||||||
#
|
|
||||||
A_DropDNSrep
|
|
@@ -13,7 +13,6 @@ DEFAULTS ACCEPT
|
|||||||
@1 - - icmp time-exceeded {comment="Needed ICMP types"}
|
@1 - - icmp time-exceeded {comment="Needed ICMP types"}
|
||||||
?else
|
?else
|
||||||
?COMMENT Needed ICMP types (RFC4890)
|
?COMMENT Needed ICMP types (RFC4890)
|
||||||
|
|
||||||
@1 - - ipv6-icmp destination-unreachable
|
@1 - - ipv6-icmp destination-unreachable
|
||||||
@1 - - ipv6-icmp packet-too-big
|
@1 - - ipv6-icmp packet-too-big
|
||||||
@1 - - ipv6-icmp time-exceeded
|
@1 - - ipv6-icmp time-exceeded
|
||||||
@@ -38,7 +37,7 @@ DEFAULTS ACCEPT
|
|||||||
@1 - - ipv6-icmp 148 # Certificate path solicitation
|
@1 - - ipv6-icmp 148 # Certificate path solicitation
|
||||||
@1 - - ipv6-icmp 149 # Certificate path advertisement
|
@1 - - ipv6-icmp 149 # Certificate path advertisement
|
||||||
|
|
||||||
# The following should have a link local source address and a ttl of 1 and must be allowed to transit abridge
|
# The following should have a link local source address and a ttl of 1 and must be allowed to transit a bridge
|
||||||
@1 fe80::/10 - ipv6-icmp 151 # Multicast router advertisement
|
@1 fe80::/10 - ipv6-icmp 151 # Multicast router advertisement
|
||||||
@1 fe80::/10 - ipv6-icmp 152 # Multicast router solicitation
|
@1 fe80::/10 - ipv6-icmp 152 # Multicast router solicitation
|
||||||
@1 fe80::/10 - ipv6-icmp 153 # Multicast router termination
|
@1 fe80::/10 - ipv6-icmp 153 # Multicast router termination
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,84 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall -- /usr/share/shorewall/action.Drop
|
|
||||||
#
|
|
||||||
# The former default DROP common rules. Use of this action is now deprecated
|
|
||||||
#
|
|
||||||
# This action is invoked before a DROP policy is enforced. The purpose
|
|
||||||
# of the action is:
|
|
||||||
#
|
|
||||||
# a) Avoid logging lots of useless cruft.
|
|
||||||
# b) Ensure that certain ICMP packets that are necessary for successful
|
|
||||||
# internet operation are always ACCEPTed.
|
|
||||||
#
|
|
||||||
# The action accepts six optional parameters:
|
|
||||||
#
|
|
||||||
# 1 - 'audit' or '-'. Default is '-' which means don't audit in builtin
|
|
||||||
# actions.
|
|
||||||
# 2 - Action to take with Auth requests. Default is to do nothing special
|
|
||||||
# with them.
|
|
||||||
# 3 - Action to take with SMB requests. Default is DROP or A_DROP,
|
|
||||||
# depending on the setting of the first parameter.
|
|
||||||
# 4 - Action to take with required ICMP packets. Default is ACCEPT or
|
|
||||||
# A_ACCEPT depending on the first parameter.
|
|
||||||
# 5 - Action to take with late DNS replies (UDP source port 53). Default
|
|
||||||
# is DROP or A_DROP depending on the first parameter.
|
|
||||||
# 6 - Action to take with UPnP packets. Default is DROP or A_DROP
|
|
||||||
# depending on the first parameter.
|
|
||||||
#
|
|
||||||
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
?warning "You are using the deprecated Drop default action. Please see http://www.shorewall.net/Actions.html#Default"
|
|
||||||
|
|
||||||
?if passed(@1)
|
|
||||||
?if @1 eq 'audit'
|
|
||||||
DEFAULTS -,-,A_DROP,A_ACCEPT,A_DROP,A_DROP
|
|
||||||
?else
|
|
||||||
?error The first parameter to Drop must be 'audit' or '-'
|
|
||||||
?endif
|
|
||||||
?else
|
|
||||||
DEFAULTS -,-,DROP,ACCEPT,DROP,DROP
|
|
||||||
?endif
|
|
||||||
|
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT
|
|
||||||
#
|
|
||||||
# Count packets that come through here
|
|
||||||
#
|
|
||||||
COUNT
|
|
||||||
#
|
|
||||||
# Special Handling for Auth
|
|
||||||
#
|
|
||||||
?if passed(@2)
|
|
||||||
Auth(@2)
|
|
||||||
?endif
|
|
||||||
#
|
|
||||||
# ACCEPT critical ICMP types
|
|
||||||
#
|
|
||||||
# For IPv6 connectivity ipv6-icmp broadcasting is required so
|
|
||||||
# AllowICMPs must be before silent broadcast Drop.
|
|
||||||
#
|
|
||||||
AllowICMPs(@4) - - icmp
|
|
||||||
#
|
|
||||||
# Don't log broadcasts or multicasts
|
|
||||||
#
|
|
||||||
Broadcast(DROP,@1)
|
|
||||||
Multicast(DROP,@1)
|
|
||||||
#
|
|
||||||
# Drop packets that are in the INVALID state -- these are usually ICMP packets
|
|
||||||
# and just confuse people when they appear in the log.
|
|
||||||
#
|
|
||||||
Invalid(DROP,@1)
|
|
||||||
#
|
|
||||||
# Drop Microsoft noise so that it doesn't clutter up the log.
|
|
||||||
#
|
|
||||||
SMB(@3)
|
|
||||||
DropUPnP(@6)
|
|
||||||
#
|
|
||||||
# Drop 'newnotsyn' traffic so that it doesn't get logged.
|
|
||||||
#
|
|
||||||
NotSyn(DROP,@1) - - tcp
|
|
||||||
#
|
|
||||||
# Drop late-arriving DNS replies. These are just a nuisance and clutter up
|
|
||||||
# the log.
|
|
||||||
#
|
|
||||||
DropDNSrep(@5)
|
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
33
Shorewall/Actions/action.FIN
Normal file
33
Shorewall/Actions/action.FIN
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/action.FIN
|
||||||
|
#
|
||||||
|
# FIN Action
|
||||||
|
#
|
||||||
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
|
#
|
||||||
|
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||||
|
#
|
||||||
|
# Complete documentation is available at http://shorewall.net
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of Version 2 of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
# FIN[([<action>])]
|
||||||
|
#
|
||||||
|
# Default action is ACCEPT
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
DEFAULTS ACCEPT,-
|
||||||
|
|
||||||
|
@1 - - ;;+ -p 6 --tcp-flags ACK,FIN ACK,FIN
|
@@ -107,6 +107,11 @@ if ( $command & $REAP_OPT ) {
|
|||||||
|
|
||||||
$duration .= '--rttl ' if $command & $TTL_OPT;
|
$duration .= '--rttl ' if $command & $TTL_OPT;
|
||||||
|
|
||||||
|
if ( ( $targets{$action} || 0 ) & NATRULE ) {
|
||||||
|
perl_action_helper( "${action}-", "-m recent --rcheck ${duration}--hitcount $hitcount" );
|
||||||
|
$action = 'ACCEPT';
|
||||||
|
}
|
||||||
|
|
||||||
if ( $command & $RESET_CMD ) {
|
if ( $command & $RESET_CMD ) {
|
||||||
require_capability 'MARK_ANYWHERE', '"reset"', 's';
|
require_capability 'MARK_ANYWHERE', '"reset"', 's';
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
# Invalid Action
|
# Invalid Action
|
||||||
# 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) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2012-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,85 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall -- /usr/share/shorewall/action.Reject
|
|
||||||
#
|
|
||||||
# The former default REJECT action common rules. Use of this action is deprecated.
|
|
||||||
#
|
|
||||||
# This action is invoked before a REJECT policy is enforced. The purpose
|
|
||||||
# of the action is:
|
|
||||||
#
|
|
||||||
# a) Avoid logging lots of useless cruft.
|
|
||||||
# b) Ensure that certain ICMP packets that are necessary for successful
|
|
||||||
# internet operation are always ACCEPTed.
|
|
||||||
#
|
|
||||||
# The action accepts six optional parameters:
|
|
||||||
#
|
|
||||||
# 1 - 'audit' or '-'. Default is '-' which means don't audit in builtin
|
|
||||||
# actions.
|
|
||||||
# 2 - Action to take with Auth requests. Default is to do nothing
|
|
||||||
# special with them.
|
|
||||||
# 3 - Action to take with SMB requests. Default is REJECT or A_REJECT,
|
|
||||||
# depending on the setting of the first parameter.
|
|
||||||
# 4 - Action to take with required ICMP packets. Default is ACCEPT or
|
|
||||||
# A_ACCEPT depending on the first parameter.
|
|
||||||
# 5 - Action to take with late DNS replies (UDP source port 53). Default
|
|
||||||
# is DROP or A_DROP depending on the first parameter.
|
|
||||||
# 6 - Action to take with UPnP packets. Default is DROP or A_DROP
|
|
||||||
# depending on the first parameter.
|
|
||||||
#
|
|
||||||
# IF YOU ARE HAVING CONNECTION PROBLEMS, CHANGING THIS FILE WON'T HELP!!!!!!!!!
|
|
||||||
###############################################################################
|
|
||||||
?warning "You are using the deprecated Reject default action. Please see http://www.shorewall.net/Actions.html#Default"
|
|
||||||
|
|
||||||
?if passed(@1)
|
|
||||||
?if @1 eq 'audit'
|
|
||||||
DEFAULTS -,-,A_REJECT,A_ACCEPT,A_DROP,A_DROP
|
|
||||||
?else
|
|
||||||
?error The first parameter to Reject must be 'audit' or '-'
|
|
||||||
?endif
|
|
||||||
?else
|
|
||||||
DEFAULTS -,-,REJECT,ACCEPT,DROP,DROP
|
|
||||||
?endif
|
|
||||||
|
|
||||||
#ACTION SOURCE DEST PROTO
|
|
||||||
#
|
|
||||||
# Count packets that come through here
|
|
||||||
#
|
|
||||||
COUNT
|
|
||||||
#
|
|
||||||
# Special handling for Auth
|
|
||||||
#
|
|
||||||
?if passed(@2)
|
|
||||||
Auth(@2)
|
|
||||||
?endif
|
|
||||||
#
|
|
||||||
# ACCEPT critical ICMP types
|
|
||||||
#
|
|
||||||
# For IPv6 connectivity ipv6-icmp broadcasting is required so
|
|
||||||
# AllowICMPs must be before silent broadcast Drop.
|
|
||||||
#
|
|
||||||
AllowICMPs(@4) - - icmp
|
|
||||||
#
|
|
||||||
# Drop Broadcasts so they don't clutter up the log
|
|
||||||
# (broadcasts must *not* be rejected).
|
|
||||||
#
|
|
||||||
Broadcast(DROP,@1)
|
|
||||||
Multicast(DROP,@1)
|
|
||||||
#
|
|
||||||
# Drop packets that are in the INVALID state -- these are usually ICMP packets
|
|
||||||
# and just confuse people when they appear in the log (these ICMPs cannot be
|
|
||||||
# rejected).
|
|
||||||
#
|
|
||||||
Invalid(DROP,@1)
|
|
||||||
#
|
|
||||||
# Reject Microsoft noise so that it doesn't clutter up the log.
|
|
||||||
#
|
|
||||||
SMB(@3)
|
|
||||||
DropUPnP(@6)
|
|
||||||
#
|
|
||||||
# Drop 'newnotsyn' traffic so that it doesn't get logged.
|
|
||||||
#
|
|
||||||
NotSyn(DROP,@1) - - tcp
|
|
||||||
#
|
|
||||||
# Drop late-arriving DNS replies. These are just a nuisance and clutter up
|
|
||||||
# the log.
|
|
||||||
#
|
|
||||||
DropDNSrep(@5)
|
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -41,6 +41,11 @@ fatal_error "Invalid Src or Dest ($destination)" unless $destination =~ /^(?:src
|
|||||||
set_action_disposition( $disposition) if supplied $disposition;
|
set_action_disposition( $disposition) if supplied $disposition;
|
||||||
set_action_name_to_caller;
|
set_action_name_to_caller;
|
||||||
|
|
||||||
|
if ( ( $targets{$action} || 0 ) & NATRULE ) {
|
||||||
|
perl_action_helper( "${action}-", "" );
|
||||||
|
$action = 'ACCEPT';
|
||||||
|
}
|
||||||
|
|
||||||
if ( $destination eq 'dst' ) {
|
if ( $destination eq 'dst' ) {
|
||||||
perl_action_helper( $action, '', '', "-m recent --name $event --remove --rdest" );
|
perl_action_helper( $action, '', '', "-m recent --name $event --remove --rdest" );
|
||||||
} else {
|
} else {
|
||||||
|
@@ -37,6 +37,11 @@ fatal_error "Invalid Src or Dest ($destination)" unless $destination =~ /^(?:src
|
|||||||
set_action_disposition( $disposition) if supplied $disposition;
|
set_action_disposition( $disposition) if supplied $disposition;
|
||||||
set_action_name_to_caller;
|
set_action_name_to_caller;
|
||||||
|
|
||||||
|
if ( ( $targets{$action} || 0 ) & NATRULE ) {
|
||||||
|
perl_action_helper( "${action}-", "" );
|
||||||
|
$action = 'ACCEPT';
|
||||||
|
}
|
||||||
|
|
||||||
if ( $destination eq 'dst' ) {
|
if ( $destination eq 'dst' ) {
|
||||||
perl_action_helper( $action, '', '', "-m recent --name $event --set --rdest" );
|
perl_action_helper( $action, '', '', "-m recent --name $event --set --rdest" );
|
||||||
} else {
|
} else {
|
||||||
|
@@ -26,4 +26,4 @@ $tcpflags_action - - ;;+ -p 6 --tcp-flags ALL FIN,URG,PSH
|
|||||||
$tcpflags_action - - ;;+ -p 6 --tcp-flags ALL NONE
|
$tcpflags_action - - ;;+ -p 6 --tcp-flags ALL NONE
|
||||||
$tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,RST SYN,RST
|
$tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,RST SYN,RST
|
||||||
$tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,FIN SYN,FIN
|
$tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,FIN SYN,FIN
|
||||||
$tcpflags_action - - ;;+ -p tcp --syn --sport 0
|
$tcpflags_action - - ;;+ -p 6 --syn --sport 0
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
39
Shorewall/Actions/action.dropBcasts
Normal file
39
Shorewall/Actions/action.dropBcasts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/action.dropBcasts
|
||||||
|
#
|
||||||
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
|
#
|
||||||
|
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||||
|
#
|
||||||
|
# Complete documentation is available at http://shorewall.net
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of Version 2 of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
# dropBcasts[([audit])]
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
DEFAULTS -
|
||||||
|
|
||||||
|
?if passed(@1)
|
||||||
|
?if @1 eq 'audit'
|
||||||
|
?require AUDIT_TARGET
|
||||||
|
Broadcast(A_DROP)
|
||||||
|
?else
|
||||||
|
?error "Invalid argument (@1) to dropBcasts"
|
||||||
|
?endif
|
||||||
|
?else
|
||||||
|
Broadcast(DROP)
|
||||||
|
?endif
|
||||||
|
|
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2011-2016 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall - /usr/share/shorewall/macro.SNMPtrap
|
# Shorewall -- /usr/share/shorewall/macro.Apcupsd
|
||||||
#
|
#
|
||||||
# This macro deprecated by SNMPtrap.
|
# This macro handles apcupsd traffic.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
SNMPtrap
|
PARAM - - tcp 3551
|
16
Shorewall/Macros/macro.FreeIPA
Normal file
16
Shorewall/Macros/macro.FreeIPA
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.FreeIPA
|
||||||
|
#
|
||||||
|
# This macro handles FreeIPA server traffic.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
DNS
|
||||||
|
HTTP
|
||||||
|
HTTPS
|
||||||
|
Kerberos
|
||||||
|
Kpasswd
|
||||||
|
LDAP
|
||||||
|
LDAPS
|
||||||
|
NTP
|
@@ -11,13 +11,20 @@
|
|||||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
PARAM - - tcp 623 # RMCP
|
PARAM - - tcp 623 # RMCP
|
||||||
|
PARAM - - udp 623 # RMCP
|
||||||
PARAM - - tcp 3668,3669 # Virtual Media, Secure (Dell)
|
PARAM - - tcp 3668,3669 # Virtual Media, Secure (Dell)
|
||||||
PARAM - - tcp 5120,5123 # CD, floppy (Asus, Aten)
|
PARAM - - tcp 5120,5122,5123 # CD,FD,HD (Asus, Aten)
|
||||||
PARAM - - tcp 5900,5901 # Remote Console (Aten, Dell)
|
PARAM - - tcp 5900,5901 # Remote Console (Aten, Dell)
|
||||||
PARAM - - tcp 7578 # Remote Console (AMI)
|
PARAM - - tcp 7578 # Remote Console (AMI)
|
||||||
PARAM - - udp 623 # RMCP
|
PARAM - - tcp 8889 # WS-MAN
|
||||||
HTTP
|
HTTP
|
||||||
HTTPS
|
|
||||||
SNMP
|
|
||||||
SSH # Serial over Lan
|
|
||||||
Telnet
|
Telnet
|
||||||
|
SNMP
|
||||||
|
|
||||||
|
# TLS/secure ports
|
||||||
|
PARAM - - tcp 3520 # Remote Console (Redfish)
|
||||||
|
PARAM - - tcp 3669 # Virtual Media (Dell)
|
||||||
|
PARAM - - tcp 5124,5126,5127 # CD,FD,HD (AMI)
|
||||||
|
PARAM - - tcp 7582 # Remote Console (AMI)
|
||||||
|
HTTPS
|
||||||
|
SSH # Serial over Lan
|
||||||
|
10
Shorewall/Macros/macro.Kpasswd
Normal file
10
Shorewall/Macros/macro.Kpasswd
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.Kpasswd
|
||||||
|
#
|
||||||
|
# This macro handles Kerberos "passwd" traffic.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - tcp 464
|
||||||
|
PARAM - - udp 464
|
@@ -6,4 +6,5 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - udp 3389
|
||||||
PARAM - - tcp 3389
|
PARAM - - tcp 3389
|
||||||
|
9
Shorewall/Macros/macro.RedisSecure
Normal file
9
Shorewall/Macros/macro.RedisSecure
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.RedisSecure
|
||||||
|
#
|
||||||
|
# This macro handles Redis Secure (SSL/TLS) traffic.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - tcp 6380
|
9
Shorewall/Macros/macro.Rwhois
Normal file
9
Shorewall/Macros/macro.Rwhois
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.Rwhois
|
||||||
|
#
|
||||||
|
# This macro handles Remote Who Is (rwhois) traffic.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - tcp 4321
|
9
Shorewall/Macros/macro.SSDP
Normal file
9
Shorewall/Macros/macro.SSDP
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.SSDP
|
||||||
|
#
|
||||||
|
# This macro handles SSDP (used by DLNA/UPnP) client traffic.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - udp 1900
|
10
Shorewall/Macros/macro.SSDPserver
Normal file
10
Shorewall/Macros/macro.SSDPserver
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.SSDPserver
|
||||||
|
#
|
||||||
|
# This macro handles SSDP (used by DLNA/UPnP) server bidirectional traffic.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - udp 1900
|
||||||
|
PARAM DEST SOURCE udp - 1900
|
@@ -1,82 +0,0 @@
|
|||||||
# Shorewall Packet Filtering Firewall Export Directory Makefile - V4.2
|
|
||||||
#
|
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
|
||||||
#
|
|
||||||
# (c) 2006 - Tom Eastep (teastep@shorewall.net)
|
|
||||||
#
|
|
||||||
# Shorewall documentation is available at http://www.shorewall.net
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of Version 2 of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
################################################################################
|
|
||||||
# Place this file in each export directory. Modify each copy to set HOST
|
|
||||||
# to the name of the remote firewall corresponding to the directory.
|
|
||||||
#
|
|
||||||
# To make the 'firewall' script, type "make".
|
|
||||||
#
|
|
||||||
# Once the script is compiling correctly, you can install it by
|
|
||||||
# typing "make install".
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
# V A R I A B L E S
|
|
||||||
#
|
|
||||||
# Files in the export directory on which the firewall script does not depend
|
|
||||||
#
|
|
||||||
IGNOREFILES = firewall% Makefile% trace% %~
|
|
||||||
#
|
|
||||||
# Remote Firewall system
|
|
||||||
#
|
|
||||||
HOST = gateway
|
|
||||||
#
|
|
||||||
# Save some typing
|
|
||||||
#
|
|
||||||
LITEDIR = /var/lib/shorewall-lite
|
|
||||||
#
|
|
||||||
# Set this if the remote system has a non-standard modules directory
|
|
||||||
#
|
|
||||||
MODULESDIR=
|
|
||||||
#
|
|
||||||
# Default target is the firewall script
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
# T A R G E T S
|
|
||||||
#
|
|
||||||
all: firewall
|
|
||||||
#
|
|
||||||
# Only generate the capabilities file if it doesn't already exist
|
|
||||||
#
|
|
||||||
capabilities:
|
|
||||||
ssh root@$(HOST) "MODULESDIR=$(MODULESDIR) /usr/share/shorewall-lite/shorecap > $(LITEDIR)/capabilities"
|
|
||||||
scp root@$(HOST):$(LITEDIR)/capabilities .
|
|
||||||
#
|
|
||||||
# Compile the firewall script. Using the 'wildcard' function causes "*" to be expanded so that
|
|
||||||
# 'filter-out' will be presented with the list of files in this directory rather than "*"
|
|
||||||
#
|
|
||||||
firewall: $(filter-out $(IGNOREFILES) capabilities , $(wildcard *) ) capabilities
|
|
||||||
shorewall compile -e . firewall
|
|
||||||
#
|
|
||||||
# Only reload on demand.
|
|
||||||
#
|
|
||||||
install: firewall
|
|
||||||
scp firewall firewall.conf root@$(HOST):$(LITEDIR)
|
|
||||||
ssh root@$(HOST) "/sbin/shorewall-lite restart"
|
|
||||||
#
|
|
||||||
# Save running configuration
|
|
||||||
#
|
|
||||||
save:
|
|
||||||
ssh root@$(HOST) "/sbin/shorewall-lite save"
|
|
||||||
#
|
|
||||||
# Remove generated files
|
|
||||||
#
|
|
||||||
clean:
|
|
||||||
rm -f capabilities firewall firewall.conf reload
|
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/ARP.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/ARP.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Accounting.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Accounting.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -195,7 +195,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
$ports = '' if $ports eq 'any' || $ports eq 'all';
|
$ports = '' if $ports eq 'any' || $ports eq 'all';
|
||||||
$sports = '' if $sports eq 'any' || $sports eq 'all';
|
$sports = '' if $sports eq 'any' || $sports eq 'all';
|
||||||
|
|
||||||
fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT;
|
fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT_SECTION;
|
||||||
|
|
||||||
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} ) . do_headers( $headers );
|
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} ) . do_headers( $headers );
|
||||||
my $prerule = '';
|
my $prerule = '';
|
||||||
@@ -266,7 +266,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
if ( $source eq 'any' || $source eq 'all' ) {
|
if ( $source eq 'any' || $source eq 'all' ) {
|
||||||
$source = ALLIP;
|
$source = ALLIP;
|
||||||
} else {
|
} else {
|
||||||
fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT || ! $asection );
|
fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT_SECTION || ! $asection );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( have_bridges && ! $asection ) {
|
if ( have_bridges && ! $asection ) {
|
||||||
@@ -282,7 +282,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
|
|
||||||
if ( $dest eq 'any' || $dest eq 'all' || $dest eq ALLIP ) {
|
if ( $dest eq 'any' || $dest eq 'all' || $dest eq ALLIP ) {
|
||||||
expand_rule(
|
expand_rule(
|
||||||
ensure_rules_chain ( 'accountout' ) ,
|
ensure_chain ( $config{ACCOUNTING_TABLE}, 'accountout' ) ,
|
||||||
OUTPUT_RESTRICT ,
|
OUTPUT_RESTRICT ,
|
||||||
$prerule ,
|
$prerule ,
|
||||||
$rule ,
|
$rule ,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -59,7 +59,7 @@ 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, $_[1], $_[2]);
|
Shorewall::Config::initialize($family, $export, $_[1], $_[2]);
|
||||||
Shorewall::Chains::initialize ($family, 1, $export );
|
Shorewall::Chains::initialize ($family, 1, $export );
|
||||||
Shorewall::Zones::initialize ($family, $_[0]);
|
Shorewall::Zones::initialize ($family, $_[0]);
|
||||||
Shorewall::Nat::initialize($family);
|
Shorewall::Nat::initialize($family);
|
||||||
@@ -103,13 +103,13 @@ sub generate_script_1( $ ) {
|
|||||||
|
|
||||||
copy2( $lib, $debug ) if -f $lib;
|
copy2( $lib, $debug ) if -f $lib;
|
||||||
|
|
||||||
emit <<'EOF';
|
emithd<<'EOF';
|
||||||
################################################################################
|
################################################################################
|
||||||
# Functions to execute the various user exits (extension scripts)
|
# Functions to execute the various user exits (extension scripts)
|
||||||
################################################################################
|
################################################################################
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
for my $exit ( qw/init start tcclear started stop stopped clear refresh refreshed restored/ ) {
|
for my $exit ( qw/init start tcclear started stop stopped clear restored enabled disabled/ ) {
|
||||||
emit "\nrun_${exit}_exit() {";
|
emit "\nrun_${exit}_exit() {";
|
||||||
push_indent;
|
push_indent;
|
||||||
append_file $exit or emit 'true';
|
append_file $exit or emit 'true';
|
||||||
@@ -125,7 +125,7 @@ EOF
|
|||||||
emit '}';
|
emit '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
emit <<'EOF';
|
emithd <<'EOF';
|
||||||
################################################################################
|
################################################################################
|
||||||
# End user exit functions
|
# End user exit functions
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -209,6 +209,8 @@ sub generate_script_2() {
|
|||||||
emit ( '[ -f ${g_confdir}/vardir ] && . ${g_confdir}/vardir' );
|
emit ( '[ -f ${g_confdir}/vardir ] && . ${g_confdir}/vardir' );
|
||||||
emit ( qq([ -n "\${VARDIR:=$shorewallrc1{VARDIR}}" ]) );
|
emit ( qq([ -n "\${VARDIR:=$shorewallrc1{VARDIR}}" ]) );
|
||||||
emit ( qq([ -n "\${VARLIB:=$shorewallrc1{VARLIB}}" ]) );
|
emit ( qq([ -n "\${VARLIB:=$shorewallrc1{VARLIB}}" ]) );
|
||||||
|
emit ( qq([ -n "\${CONFDIR:=$shorewallrc1{CONFDIR}}" ]) );
|
||||||
|
emit ( qq([ -n "\${SHAREDIR:=$shorewallrc1{SHAREDIR}}" ]) );
|
||||||
|
|
||||||
emit 'TEMPFILE=';
|
emit 'TEMPFILE=';
|
||||||
|
|
||||||
@@ -266,13 +268,13 @@ sub generate_script_2() {
|
|||||||
emit( '',
|
emit( '',
|
||||||
'chain_exists DOCKER nat && chain_exists DOCKER && g_docker=Yes',
|
'chain_exists DOCKER nat && chain_exists DOCKER && g_docker=Yes',
|
||||||
);
|
);
|
||||||
emit( 'chain_exists DOCKER-ISOLATION && g_dockernetwork=Yes]' );
|
emit( 'chain_exists DOCKER-INGRESS && g_dockeringress=Yes' );
|
||||||
emit( '' );
|
emit( 'chain_exists DOCKER-ISOLATION && g_dockernetwork=Yes' );
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
|
|
||||||
emit "\n}\n"; # End of initialize()
|
emit "}\n"; # End of initialize()
|
||||||
|
|
||||||
emit( '' ,
|
emit( '' ,
|
||||||
'#' ,
|
'#' ,
|
||||||
@@ -309,10 +311,9 @@ sub generate_script_2() {
|
|||||||
push_indent;
|
push_indent;
|
||||||
|
|
||||||
if ( $global_variables == ( ALL_COMMANDS | NOT_RESTORE ) ) {
|
if ( $global_variables == ( ALL_COMMANDS | NOT_RESTORE ) ) {
|
||||||
|
verify_required_interfaces(0);
|
||||||
set_global_variables(0, 0);
|
set_global_variables(0, 0);
|
||||||
|
handle_optional_interfaces;
|
||||||
handle_optional_interfaces(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit ';;';
|
emit ';;';
|
||||||
@@ -324,19 +325,19 @@ sub generate_script_2() {
|
|||||||
push_indent;
|
push_indent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verify_required_interfaces(1);
|
||||||
set_global_variables(1,1);
|
set_global_variables(1,1);
|
||||||
|
handle_optional_interfaces;
|
||||||
|
|
||||||
if ( $global_variables & NOT_RESTORE ) {
|
if ( $global_variables & NOT_RESTORE ) {
|
||||||
handle_optional_interfaces(1);
|
|
||||||
emit ';;';
|
emit ';;';
|
||||||
pop_indent;
|
pop_indent;
|
||||||
pop_indent;
|
pop_indent;
|
||||||
emit ( 'esac' );
|
emit ( 'esac' );
|
||||||
} else {
|
|
||||||
handle_optional_interfaces(1);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emit( 'true' ) unless handle_optional_interfaces(1);
|
verify_required_interfaces(1);
|
||||||
|
emit( 'true' ) unless handle_optional_interfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
@@ -355,7 +356,7 @@ sub generate_script_2() {
|
|||||||
# Note: This function is not called when $command eq 'check'. So it must have no side effects other
|
# Note: This function is not called when $command eq 'check'. So it must have no side effects other
|
||||||
# than those related to writing to the output script file.
|
# than those related to writing to the output script file.
|
||||||
#
|
#
|
||||||
sub generate_script_3($) {
|
sub generate_script_3() {
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
progress_message2 "Creating iptables-restore input...";
|
progress_message2 "Creating iptables-restore input...";
|
||||||
@@ -365,7 +366,6 @@ sub generate_script_3($) {
|
|||||||
|
|
||||||
create_netfilter_load( $test );
|
create_netfilter_load( $test );
|
||||||
create_arptables_load( $test ) if $have_arptables;
|
create_arptables_load( $test ) if $have_arptables;
|
||||||
create_chainlist_reload( $_[0] );
|
|
||||||
create_save_ipsets;
|
create_save_ipsets;
|
||||||
create_load_ipsets;
|
create_load_ipsets;
|
||||||
|
|
||||||
@@ -397,16 +397,10 @@ sub generate_script_3($) {
|
|||||||
emit 'load_kernel_modules Yes';
|
emit 'load_kernel_modules Yes';
|
||||||
}
|
}
|
||||||
|
|
||||||
emit '';
|
emit( '' ,
|
||||||
|
'run_init_exit',
|
||||||
emit ( 'if [ "$COMMAND" = refresh ]; then' ,
|
'' ,
|
||||||
' run_refresh_exit' ,
|
'load_ipsets' ,
|
||||||
'else' ,
|
|
||||||
' run_init_exit',
|
|
||||||
'fi',
|
|
||||||
'' );
|
|
||||||
|
|
||||||
emit( 'load_ipsets' ,
|
|
||||||
'' );
|
'' );
|
||||||
|
|
||||||
create_nfobjects;
|
create_nfobjects;
|
||||||
@@ -464,11 +458,6 @@ sub generate_script_3($) {
|
|||||||
dump_proxy_arp;
|
dump_proxy_arp;
|
||||||
emit_unindented '__EOF__';
|
emit_unindented '__EOF__';
|
||||||
|
|
||||||
emit( '',
|
|
||||||
'if [ "$COMMAND" != refresh ]; then' );
|
|
||||||
|
|
||||||
push_indent;
|
|
||||||
|
|
||||||
emit 'cat > ${VARDIR}/zones << __EOF__';
|
emit 'cat > ${VARDIR}/zones << __EOF__';
|
||||||
dump_zone_contents;
|
dump_zone_contents;
|
||||||
emit_unindented '__EOF__';
|
emit_unindented '__EOF__';
|
||||||
@@ -481,10 +470,6 @@ sub generate_script_3($) {
|
|||||||
dump_mark_layout;
|
dump_mark_layout;
|
||||||
emit_unindented '__EOF__';
|
emit_unindented '__EOF__';
|
||||||
|
|
||||||
pop_indent;
|
|
||||||
|
|
||||||
emit "fi\n";
|
|
||||||
|
|
||||||
emit '> ${VARDIR}/nat';
|
emit '> ${VARDIR}/nat';
|
||||||
|
|
||||||
add_addresses;
|
add_addresses;
|
||||||
@@ -523,29 +508,12 @@ sub generate_script_3($) {
|
|||||||
|
|
||||||
my $config_dir = $globals{CONFIGDIR};
|
my $config_dir = $globals{CONFIGDIR};
|
||||||
|
|
||||||
emit<<"EOF";
|
emithd <<"EOF";
|
||||||
set_state Started $config_dir
|
set_state Started $config_dir
|
||||||
run_restored_exit
|
run_restored_exit
|
||||||
elif [ \$COMMAND = refresh ]; then
|
else
|
||||||
chainlist_reload
|
setup_netfilter
|
||||||
EOF
|
EOF
|
||||||
push_indent;
|
|
||||||
setup_load_distribution;
|
|
||||||
setup_forwarding( $family , 0 );
|
|
||||||
pop_indent;
|
|
||||||
#
|
|
||||||
# Use a parameter list rather than 'here documents' to avoid an extra blank line
|
|
||||||
#
|
|
||||||
emit( ' run_refreshed_exit',
|
|
||||||
' do_iptables -N shorewall' );
|
|
||||||
|
|
||||||
emit( ' do_iptables -A shorewall -m recent --set --name %CURRENTTIME' ) if have_capability 'RECENT_MATCH';
|
|
||||||
|
|
||||||
emit( " set_state Started $config_dir",
|
|
||||||
' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall',
|
|
||||||
'else',
|
|
||||||
' setup_netfilter' );
|
|
||||||
|
|
||||||
push_indent;
|
push_indent;
|
||||||
emit 'setup_arptables' if $have_arptables;
|
emit 'setup_arptables' if $have_arptables;
|
||||||
setup_load_distribution;
|
setup_load_distribution;
|
||||||
@@ -570,7 +538,7 @@ EOF
|
|||||||
' run_started_exit',
|
' run_started_exit',
|
||||||
"fi\n" );
|
"fi\n" );
|
||||||
|
|
||||||
emit<<'EOF';
|
emithd<<'EOF';
|
||||||
date > ${VARDIR}/restarted
|
date > ${VARDIR}/restarted
|
||||||
|
|
||||||
case $COMMAND in
|
case $COMMAND in
|
||||||
@@ -580,9 +548,6 @@ case $COMMAND in
|
|||||||
reload)
|
reload)
|
||||||
mylogger kern.info "$g_product reloaded"
|
mylogger kern.info "$g_product reloaded"
|
||||||
;;
|
;;
|
||||||
refresh)
|
|
||||||
mylogger kern.info "$g_product refreshed"
|
|
||||||
;;
|
|
||||||
restore)
|
restore)
|
||||||
mylogger kern.info "$g_product restored"
|
mylogger kern.info "$g_product restored"
|
||||||
;;
|
;;
|
||||||
@@ -617,8 +582,8 @@ sub compile_info_command() {
|
|||||||
#
|
#
|
||||||
sub compiler {
|
sub compiler {
|
||||||
|
|
||||||
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $config_path, $shorewallrc , $shorewallrc1 , $inline ) =
|
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $log , $log_verbosity, $preview, $confess , $update , $annotate , $config_path, $shorewallrc , $shorewallrc1 ) =
|
||||||
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , '' , '/usr/share/shorewall/shorewallrc', '' , 0 );
|
( '', '', -1, '', 0, '', -1, 0, 0, 0, 0, , '' , '/usr/share/shorewall/shorewallrc', '' );
|
||||||
|
|
||||||
$export = 0;
|
$export = 0;
|
||||||
$test = 0;
|
$test = 0;
|
||||||
@@ -647,7 +612,6 @@ sub compiler {
|
|||||||
timestamp => { store => \$timestamp, validate => \&validate_boolean } ,
|
timestamp => { store => \$timestamp, validate => \&validate_boolean } ,
|
||||||
debug => { store => \$debug, validate => \&validate_boolean } ,
|
debug => { store => \$debug, validate => \&validate_boolean } ,
|
||||||
export => { store => \$export , validate => \&validate_boolean } ,
|
export => { store => \$export , validate => \&validate_boolean } ,
|
||||||
chains => { store => \$chains },
|
|
||||||
log => { store => \$log },
|
log => { store => \$log },
|
||||||
log_verbosity => { store => \$log_verbosity, validate => \&validate_verbosity } ,
|
log_verbosity => { store => \$log_verbosity, validate => \&validate_verbosity } ,
|
||||||
test => { store => \$test },
|
test => { store => \$test },
|
||||||
@@ -655,7 +619,6 @@ sub compiler {
|
|||||||
confess => { store => \$confess, validate=> \&validate_boolean } ,
|
confess => { store => \$confess, validate=> \&validate_boolean } ,
|
||||||
update => { store => \$update, validate=> \&validate_boolean } ,
|
update => { store => \$update, validate=> \&validate_boolean } ,
|
||||||
annotate => { store => \$annotate, validate=> \&validate_boolean } ,
|
annotate => { store => \$annotate, validate=> \&validate_boolean } ,
|
||||||
inline => { store => \$inline, validate=> \&validate_boolean } ,
|
|
||||||
config_path => { store => \$config_path } ,
|
config_path => { store => \$config_path } ,
|
||||||
shorewallrc => { store => \$shorewallrc } ,
|
shorewallrc => { store => \$shorewallrc } ,
|
||||||
shorewallrc1 => { store => \$shorewallrc1 } ,
|
shorewallrc1 => { store => \$shorewallrc1 } ,
|
||||||
@@ -689,9 +652,10 @@ sub compiler {
|
|||||||
set_timestamp( $timestamp );
|
set_timestamp( $timestamp );
|
||||||
set_debug( $debug , $confess );
|
set_debug( $debug , $confess );
|
||||||
#
|
#
|
||||||
|
# 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
|
||||||
#
|
#
|
||||||
get_configuration( $export , $update , $annotate , $inline );
|
get_configuration( $export , $update , $annotate );
|
||||||
#
|
#
|
||||||
# Chain table initialization depends on shorewall.conf and capabilities. So it must be deferred until
|
# Chain table initialization depends on shorewall.conf and capabilities. So it must be deferred until
|
||||||
# now when shorewall.conf has been processed and the capabilities have been determined.
|
# now when shorewall.conf has been processed and the capabilities have been determined.
|
||||||
@@ -793,13 +757,10 @@ sub compiler {
|
|||||||
emit '}'; # End of setup_common_rules()
|
emit '}'; # End of setup_common_rules()
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_script;
|
|
||||||
#
|
#
|
||||||
# R O U T I N G _ A N D _ T R A F F I C _ S H A P I N G
|
# R O U T I N G _ A N D _ T R A F F I C _ S H A P I N G
|
||||||
# (Writes the setup_routing_and_traffic_shaping() function to the compiled script)
|
# (Writes the setup_routing_and_traffic_shaping() function to the compiled script)
|
||||||
#
|
#
|
||||||
enable_script;
|
|
||||||
#
|
|
||||||
# Validate the TC files so that the providers will know what interfaces have TC
|
# Validate the TC files so that the providers will know what interfaces have TC
|
||||||
#
|
#
|
||||||
my $tcinterfaces = process_tc;
|
my $tcinterfaces = process_tc;
|
||||||
@@ -817,7 +778,7 @@ sub compiler {
|
|||||||
#
|
#
|
||||||
# Setup Masquerade/SNAT
|
# Setup Masquerade/SNAT
|
||||||
#
|
#
|
||||||
setup_snat( $update );
|
setup_snat;
|
||||||
#
|
#
|
||||||
# Setup Nat
|
# Setup Nat
|
||||||
#
|
#
|
||||||
@@ -898,7 +859,7 @@ sub compiler {
|
|||||||
|
|
||||||
optimize_level0;
|
optimize_level0;
|
||||||
|
|
||||||
if ( ( my $optimize = $config{OPTIMIZE} ) & 0x1E ) {
|
if ( ( my $optimize = $config{OPTIMIZE} ) & OPTIMIZE_MASK ) {
|
||||||
progress_message2 'Optimizing Ruleset...';
|
progress_message2 'Optimizing Ruleset...';
|
||||||
#
|
#
|
||||||
# Optimize Policy Chains
|
# Optimize Policy Chains
|
||||||
@@ -920,7 +881,7 @@ sub compiler {
|
|||||||
# N E T F I L T E R L O A D
|
# N E T F I L T E R L O A D
|
||||||
# (Produces setup_netfilter(), setup_arptables(), chainlist_reload() and define_firewall() )
|
# (Produces setup_netfilter(), setup_arptables(), chainlist_reload() and define_firewall() )
|
||||||
#
|
#
|
||||||
generate_script_3( $chains );
|
generate_script_3();
|
||||||
#
|
#
|
||||||
# We must reinitialize Shorewall::Chains before generating the iptables-restore input
|
# We must reinitialize Shorewall::Chains before generating the iptables-restore input
|
||||||
# for stopping the firewall
|
# for stopping the firewall
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/IPAddrs.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/IPAddrs.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2015 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -60,10 +60,10 @@ our @EXPORT = ( qw( ALLIPv4
|
|||||||
decompose_net
|
decompose_net
|
||||||
decompose_net_u32
|
decompose_net_u32
|
||||||
compare_nets
|
compare_nets
|
||||||
|
loopback_address
|
||||||
validate_host
|
validate_host
|
||||||
validate_range
|
validate_range
|
||||||
ip_range_explicit
|
ip_range_explicit
|
||||||
expand_port_range
|
|
||||||
allipv4
|
allipv4
|
||||||
allipv6
|
allipv6
|
||||||
allip
|
allip
|
||||||
@@ -74,10 +74,6 @@ our @EXPORT = ( qw( ALLIPv4
|
|||||||
resolve_proto
|
resolve_proto
|
||||||
resolve_dnsname
|
resolve_dnsname
|
||||||
proto_name
|
proto_name
|
||||||
validate_port
|
|
||||||
validate_portpair
|
|
||||||
validate_portpair1
|
|
||||||
validate_port_list
|
|
||||||
validate_icmp
|
validate_icmp
|
||||||
validate_icmp6
|
validate_icmp6
|
||||||
) );
|
) );
|
||||||
@@ -103,12 +99,14 @@ our $resolve_dnsname;
|
|||||||
our $validate_range;
|
our $validate_range;
|
||||||
our $validate_host;
|
our $validate_host;
|
||||||
our $family;
|
our $family;
|
||||||
|
our $loopback_address;
|
||||||
|
|
||||||
use constant { ALLIPv4 => '0.0.0.0/0' ,
|
use constant { ALLIPv4 => '0.0.0.0/0' ,
|
||||||
ALLIPv6 => '::/0' ,
|
ALLIPv6 => '::/0' ,
|
||||||
NILIPv4 => '0.0.0.0' ,
|
NILIPv4 => '0.0.0.0' ,
|
||||||
NILIPv6 => '::' ,
|
NILIPv6 => '::' ,
|
||||||
IPv4_MULTICAST => '224.0.0.0/4' ,
|
IPv4_MULTICAST => '224.0.0.0/4' ,
|
||||||
|
IPv4_LOOPBACK => '127.0.0.1' ,
|
||||||
IPv6_MULTICAST => 'ff00::/8' ,
|
IPv6_MULTICAST => 'ff00::/8' ,
|
||||||
IPv6_LINKLOCAL => 'fe80::/10' ,
|
IPv6_LINKLOCAL => 'fe80::/10' ,
|
||||||
IPv6_SITELOCAL => 'feC0::/10' ,
|
IPv6_SITELOCAL => 'feC0::/10' ,
|
||||||
@@ -375,6 +373,10 @@ sub rfc1918_networks() {
|
|||||||
@rfc1918_networks
|
@rfc1918_networks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub loopback_address() {
|
||||||
|
$loopback_address;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Protocol/port validation
|
# Protocol/port validation
|
||||||
#
|
#
|
||||||
@@ -411,114 +413,6 @@ sub proto_name( $ ) {
|
|||||||
$proto =~ /^(\d+)$/ ? $prototoname[ $proto ] || scalar getprotobynumber $proto : $proto
|
$proto =~ /^(\d+)$/ ? $prototoname[ $proto ] || scalar getprotobynumber $proto : $proto
|
||||||
}
|
}
|
||||||
|
|
||||||
sub validate_port( $$ ) {
|
|
||||||
my ($proto, $port) = @_;
|
|
||||||
|
|
||||||
my $value;
|
|
||||||
|
|
||||||
if ( $port =~ /^(\d+)$/ || $port =~ /^0x/ ) {
|
|
||||||
$port = numeric_value $port;
|
|
||||||
return $port if defined $port && $port && $port <= 65535;
|
|
||||||
} else {
|
|
||||||
$proto = proto_name $proto if $proto =~ /^(\d+)$/;
|
|
||||||
$value = getservbyname( $port, $proto );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value if defined $value;
|
|
||||||
|
|
||||||
fatal_error "The separator for a port range is ':', not '-' ($port)" if $port =~ /^\d+-\d+$/;
|
|
||||||
|
|
||||||
fatal_error "Invalid/Unknown $proto port/service ($_[1])" unless defined $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub validate_portpair( $$ ) {
|
|
||||||
my ($proto, $portpair) = @_;
|
|
||||||
my $what;
|
|
||||||
my $pair = $portpair;
|
|
||||||
#
|
|
||||||
# Accept '-' as a port-range separator
|
|
||||||
#
|
|
||||||
$pair =~ tr/-/:/ if $pair =~ /^[-0-9]+$/;
|
|
||||||
|
|
||||||
fatal_error "Invalid port range ($portpair)" if $pair =~ tr/:/:/ > 1;
|
|
||||||
|
|
||||||
$pair = "0$pair" if substr( $pair, 0, 1 ) eq ':';
|
|
||||||
$pair = "${pair}65535" if substr( $pair, -1, 1 ) eq ':';
|
|
||||||
|
|
||||||
my @ports = split /:/, $pair, 2;
|
|
||||||
|
|
||||||
my $protonum = resolve_proto( $proto ) || 0;
|
|
||||||
|
|
||||||
$_ = validate_port( $protonum, $_) for grep $_, @ports;
|
|
||||||
|
|
||||||
if ( @ports == 2 ) {
|
|
||||||
$what = 'port range';
|
|
||||||
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
|
|
||||||
} else {
|
|
||||||
$what = 'port';
|
|
||||||
}
|
|
||||||
|
|
||||||
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, UDPLITE, SCTP or DCCP" unless
|
|
||||||
defined $protonum && ( $protonum == TCP ||
|
|
||||||
$protonum == UDP ||
|
|
||||||
$protonum == UDPLITE ||
|
|
||||||
$protonum == SCTP ||
|
|
||||||
$protonum == DCCP );
|
|
||||||
join ':', @ports;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sub validate_portpair1( $$ ) {
|
|
||||||
my ($proto, $portpair) = @_;
|
|
||||||
my $what;
|
|
||||||
|
|
||||||
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
|
|
||||||
|
|
||||||
$portpair = "1$portpair" if substr( $portpair, 0, 1 ) eq ':';
|
|
||||||
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
|
|
||||||
|
|
||||||
my @ports = split /-/, $portpair, 2;
|
|
||||||
|
|
||||||
my $protonum = resolve_proto( $proto ) || 0;
|
|
||||||
|
|
||||||
$_ = validate_port( $protonum, $_) for grep $_, @ports;
|
|
||||||
|
|
||||||
if ( @ports == 2 ) {
|
|
||||||
$what = 'port range';
|
|
||||||
fatal_error "Invalid port range ($portpair)" unless $ports[0] && $ports[0] < $ports[1];
|
|
||||||
} else {
|
|
||||||
$what = 'port';
|
|
||||||
fatal_error 'Invalid port number (0)' unless $portpair;
|
|
||||||
}
|
|
||||||
|
|
||||||
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
|
|
||||||
defined $protonum && ( $protonum == TCP ||
|
|
||||||
$protonum == UDP ||
|
|
||||||
$protonum == SCTP ||
|
|
||||||
$protonum == DCCP );
|
|
||||||
join '-', @ports;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sub validate_port_list( $$ ) {
|
|
||||||
my $result = '';
|
|
||||||
my ( $proto, $list ) = @_;
|
|
||||||
my @list = split_list( $list, 'port' );
|
|
||||||
|
|
||||||
if ( @list > 1 && $list =~ /[:-]/ ) {
|
|
||||||
require_capability( 'XMULTIPORT' , 'Port ranges in a port list', '' );
|
|
||||||
}
|
|
||||||
|
|
||||||
$proto = proto_name $proto;
|
|
||||||
|
|
||||||
for ( @list ) {
|
|
||||||
my $value = validate_portpair( $proto , $_ );
|
|
||||||
$result = $result ? join ',', $result, $value : $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result;
|
|
||||||
}
|
|
||||||
|
|
||||||
my %icmp_types = ( any => 'any',
|
my %icmp_types = ( any => 'any',
|
||||||
'echo-reply' => 0,
|
'echo-reply' => 0,
|
||||||
'destination-unreachable' => 3,
|
'destination-unreachable' => 3,
|
||||||
@@ -572,67 +466,6 @@ sub validate_icmp( $ ) {
|
|||||||
fatal_error "Invalid ICMP Type ($type)"
|
fatal_error "Invalid ICMP Type ($type)"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Expands a port range into a minimal list of ( port, mask ) pairs.
|
|
||||||
# Each port and mask are expressed as 4 hex nibbles without a leading '0x'.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
#
|
|
||||||
# DB<3> @foo = Shorewall::IPAddrs::expand_port_range( 6, '110:' ); print "@foo\n"
|
|
||||||
# 006e fffe 0070 fff0 0080 ff80 0100 ff00 0200 fe00 0400 fc00 0800 f800 1000 f000 2000 e000 4000 c000 8000 8000
|
|
||||||
#
|
|
||||||
sub expand_port_range( $$ ) {
|
|
||||||
my ( $proto, $range ) = @_;
|
|
||||||
|
|
||||||
if ( $range =~ /^(.*):(.*)$/ ) {
|
|
||||||
my ( $first, $last ) = ( $1, $2);
|
|
||||||
my @result;
|
|
||||||
|
|
||||||
fatal_error "Invalid port range ($range)" unless $first ne '' or $last ne '';
|
|
||||||
#
|
|
||||||
# Supply missing first/last port number
|
|
||||||
#
|
|
||||||
$first = 0 if $first eq '';
|
|
||||||
$last = 65535 if $last eq '';
|
|
||||||
#
|
|
||||||
# Validate the ports
|
|
||||||
#
|
|
||||||
( $first , $last ) = ( validate_port( $proto, $first || 1 ) , validate_port( $proto, $last ) );
|
|
||||||
|
|
||||||
$last++; #Increment last address for limit testing.
|
|
||||||
#
|
|
||||||
# Break the range into groups:
|
|
||||||
#
|
|
||||||
# - If the first port in the remaining range is odd, then the next group is ( <first>, ffff ).
|
|
||||||
# - Otherwise, find the largest power of two P that divides the first address such that
|
|
||||||
# the remaining range has less than or equal to P ports. The next group is
|
|
||||||
# ( <first> , ~( P-1 ) ).
|
|
||||||
#
|
|
||||||
while ( ( my $ports = ( $last - $first ) ) > 0 ) {
|
|
||||||
my $mask = 0xffff; #Mask for current ports in group.
|
|
||||||
my $y = 2; #Next power of two to test
|
|
||||||
my $z = 1; #Number of ports in current group (Previous value of $y).
|
|
||||||
|
|
||||||
while ( ( ! ( $first % $y ) ) && ( $y <= $ports ) ) {
|
|
||||||
$mask <<= 1;
|
|
||||||
$z = $y;
|
|
||||||
$y <<= 1;
|
|
||||||
}
|
|
||||||
#
|
|
||||||
#
|
|
||||||
push @result, sprintf( '%04x', $first ) , sprintf( '%04x' , $mask & 0xffff );
|
|
||||||
$first += $z;
|
|
||||||
}
|
|
||||||
|
|
||||||
fatal_error "Invalid port range ($range)" unless @result; # first port > last port
|
|
||||||
|
|
||||||
@result;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
( sprintf( '%04x' , validate_port( $proto, $range ) ) , 'ffff' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub valid_6address( $ ) {
|
sub valid_6address( $ ) {
|
||||||
my $address = $_[0];
|
my $address = $_[0];
|
||||||
|
|
||||||
@@ -929,6 +762,7 @@ sub initialize( $ ) {
|
|||||||
$nilip = NILIPv4;
|
$nilip = NILIPv4;
|
||||||
@nilip = @nilipv4;
|
@nilip = @nilipv4;
|
||||||
$vlsm_width = VLSMv4;
|
$vlsm_width = VLSMv4;
|
||||||
|
$loopback_address = IPv4_LOOPBACK;
|
||||||
$valid_address = \&valid_4address;
|
$valid_address = \&valid_4address;
|
||||||
$validate_address = \&validate_4address;
|
$validate_address = \&validate_4address;
|
||||||
$validate_net = \&validate_4net;
|
$validate_net = \&validate_4net;
|
||||||
@@ -941,6 +775,7 @@ sub initialize( $ ) {
|
|||||||
$nilip = NILIPv6;
|
$nilip = NILIPv6;
|
||||||
@nilip = @nilipv6;
|
@nilip = @nilipv6;
|
||||||
$vlsm_width = VLSMv6;
|
$vlsm_width = VLSMv6;
|
||||||
|
$loopback_address = IPv6_LOOPBACK;
|
||||||
$valid_address = \&valid_6address;
|
$valid_address = \&valid_6address;
|
||||||
$validate_address = \&validate_6address;
|
$validate_address = \&validate_6address;
|
||||||
$validate_net = \&validate_6net;
|
$validate_net = \&validate_6net;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Misc.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Misc.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -667,6 +667,7 @@ sub create_docker_rules() {
|
|||||||
|
|
||||||
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_dockernetwork" ] && echo "-A FORWARD -j DOCKER-ISOLATION" >&3', );
|
add_commands( $chainref, '[ -n "$g_dockernetwork" ] && echo "-A FORWARD -j DOCKER-ISOLATION" >&3', );
|
||||||
|
|
||||||
if ( my $dockerref = known_interface('docker0') ) {
|
if ( my $dockerref = known_interface('docker0') ) {
|
||||||
@@ -717,7 +718,7 @@ sub add_common_rules ( $ ) {
|
|||||||
|
|
||||||
if ( $config{REJECT_ACTION} ) {
|
if ( $config{REJECT_ACTION} ) {
|
||||||
process_reject_action;
|
process_reject_action;
|
||||||
fatal_eror( "The REJECT_ACTION ($config{REJECT_ACTION}) is not terminating" ) unless terminating( $rejectref );
|
fatal_error( "The REJECT_ACTION ($config{REJECT_ACTION}) is not terminating" ) unless terminating( $rejectref );
|
||||||
} else {
|
} else {
|
||||||
if ( have_capability( 'ADDRTYPE' ) ) {
|
if ( have_capability( 'ADDRTYPE' ) ) {
|
||||||
add_ijump $rejectref , j => 'DROP' , addrtype => '--src-type BROADCAST';
|
add_ijump $rejectref , j => 'DROP' , addrtype => '--src-type BROADCAST';
|
||||||
@@ -2447,7 +2448,7 @@ sub setup_mss( ) {
|
|||||||
my $clampmss = $config{CLAMPMSS};
|
my $clampmss = $config{CLAMPMSS};
|
||||||
my $option;
|
my $option;
|
||||||
my @match;
|
my @match;
|
||||||
my $chainref = $filter_table->{FORWARD};
|
my $chainref = $mangle_table->{FORWARD};
|
||||||
|
|
||||||
if ( $clampmss ) {
|
if ( $clampmss ) {
|
||||||
if ( "\L$clampmss" eq 'yes' ) {
|
if ( "\L$clampmss" eq 'yes' ) {
|
||||||
@@ -2553,9 +2554,6 @@ EOF
|
|||||||
reload)
|
reload)
|
||||||
mylogger kern.err "ERROR:$g_product reload failed"
|
mylogger kern.err "ERROR:$g_product reload failed"
|
||||||
;;
|
;;
|
||||||
refresh)
|
|
||||||
mylogger kern.err "ERROR:$g_product refresh failed"
|
|
||||||
;;
|
|
||||||
enable)
|
enable)
|
||||||
mylogger kern.err "ERROR:$g_product 'enable $g_interface' failed"
|
mylogger kern.err "ERROR:$g_product 'enable $g_interface' failed"
|
||||||
;;
|
;;
|
||||||
@@ -2645,7 +2643,6 @@ EOF
|
|||||||
|
|
||||||
rm -f ${VARDIR}/proxyarp
|
rm -f ${VARDIR}/proxyarp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
} else {
|
} else {
|
||||||
emit <<'EOF';
|
emit <<'EOF';
|
||||||
@@ -2659,7 +2656,6 @@ EOF
|
|||||||
|
|
||||||
rm -f ${VARDIR}/proxyndp
|
rm -f ${VARDIR}/proxyndp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Nat.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Nat.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -37,7 +37,7 @@ use strict;
|
|||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw( setup_nat setup_netmap add_addresses );
|
our @EXPORT = qw( setup_nat setup_netmap add_addresses );
|
||||||
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule process_one_masq convert_masq @addresses_to_add %addresses_to_add ) ] );
|
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule convert_masq @addresses_to_add %addresses_to_add ) ] );
|
||||||
our @EXPORT_OK = ();
|
our @EXPORT_OK = ();
|
||||||
|
|
||||||
Exporter::export_ok_tags('rules');
|
Exporter::export_ok_tags('rules');
|
||||||
@@ -587,11 +587,11 @@ EOF
|
|||||||
# Convert a masq file into the equivalent snat file
|
# Convert a masq file into the equivalent snat file
|
||||||
#
|
#
|
||||||
sub convert_masq() {
|
sub convert_masq() {
|
||||||
|
my $have_masq_rules;
|
||||||
|
|
||||||
if ( my $fn = open_file( 'masq', 1, 1 ) ) {
|
if ( my $fn = open_file( 'masq', 1, 1 ) ) {
|
||||||
my ( $snat, $fn1 ) = open_snat_for_output( $fn );
|
my ( $snat, $fn1 ) = open_snat_for_output( $fn );
|
||||||
|
|
||||||
my $have_masq_rules;
|
|
||||||
|
|
||||||
directive_callback(
|
directive_callback(
|
||||||
sub ()
|
sub ()
|
||||||
{
|
{
|
||||||
@@ -647,6 +647,8 @@ sub convert_masq() {
|
|||||||
|
|
||||||
close $snat, directive_callback( 0 );
|
close $snat, directive_callback( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$have_masq_rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -941,7 +943,17 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
|
|||||||
} else {
|
} else {
|
||||||
$server = $1 if $family == F_IPV6 && $server =~ /^\[(.+)\]$/;
|
$server = $1 if $family == F_IPV6 && $server =~ /^\[(.+)\]$/;
|
||||||
fatal_error "Invalid server IP address ($server)" if $server eq ALLIP || $server eq NILIP;
|
fatal_error "Invalid server IP address ($server)" if $server eq ALLIP || $server eq NILIP;
|
||||||
my @servers = validate_address $server, 1;
|
|
||||||
|
my @servers;
|
||||||
|
|
||||||
|
if ( ( $server =~ /^([&%])(.+)/ ) ) {
|
||||||
|
$server = record_runtime_address( $1, $2 );
|
||||||
|
$server =~ s/ $//;
|
||||||
|
@servers = ( $server );
|
||||||
|
} else {
|
||||||
|
@servers = validate_address $server, 1;
|
||||||
|
}
|
||||||
|
|
||||||
$server = join ',', @servers;
|
$server = join ',', @servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Proc.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Proc.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Providers.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Providers.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -64,6 +64,8 @@ our @load_interfaces;
|
|||||||
|
|
||||||
our $balancing;
|
our $balancing;
|
||||||
our $fallback;
|
our $fallback;
|
||||||
|
our $balanced_providers;
|
||||||
|
our $fallback_providers;
|
||||||
our $metrics;
|
our $metrics;
|
||||||
our $first_default_route;
|
our $first_default_route;
|
||||||
our $first_fallback_route;
|
our $first_fallback_route;
|
||||||
@@ -99,6 +101,8 @@ sub initialize( $ ) {
|
|||||||
%provider_interfaces = ();
|
%provider_interfaces = ();
|
||||||
@load_interfaces = ();
|
@load_interfaces = ();
|
||||||
$balancing = 0;
|
$balancing = 0;
|
||||||
|
$balanced_providers = 0;
|
||||||
|
$fallback_providers = 0;
|
||||||
$fallback = 0;
|
$fallback = 0;
|
||||||
$metrics = 0;
|
$metrics = 0;
|
||||||
$first_default_route = 1;
|
$first_default_route = 1;
|
||||||
@@ -121,7 +125,7 @@ sub initialize( $ ) {
|
|||||||
# Set up marking for 'tracked' interfaces.
|
# Set up marking for 'tracked' interfaces.
|
||||||
#
|
#
|
||||||
sub setup_route_marking() {
|
sub setup_route_marking() {
|
||||||
my $mask = in_hex( $globals{PROVIDER_MASK} );
|
my $mask = in_hex( $globals{PROVIDER_MASK} );
|
||||||
my $exmask = have_capability( 'EXMARK' ) ? "/$mask" : '';
|
my $exmask = have_capability( 'EXMARK' ) ? "/$mask" : '';
|
||||||
|
|
||||||
require_capability( $_ , q(The provider 'track' option) , 's' ) for qw/CONNMARK_MATCH CONNMARK/;
|
require_capability( $_ , q(The provider 'track' option) , 's' ) for qw/CONNMARK_MATCH CONNMARK/;
|
||||||
@@ -157,6 +161,15 @@ sub setup_route_marking() {
|
|||||||
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref, $origin, i => $physical, mark => "--mark 0/$mask";
|
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref, $origin, i => $physical, mark => "--mark 0/$mask";
|
||||||
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref1, $origin, i => "! $physical", mark => "--mark $mark/$mask";
|
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref1, $origin, i => "! $physical", mark => "--mark $mark/$mask";
|
||||||
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_capability( 'MARK_ANYWHERE' ) ) {
|
||||||
|
add_ijump_extended $filter_table->{forward_chain($interface)}, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", , state_imatch('NEW'), policy => '--dir in --pol ipsec';
|
||||||
|
} 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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$marked_interfaces{$interface} = 1;
|
$marked_interfaces{$interface} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,18 +336,24 @@ sub balance_default_route( $$$$ ) {
|
|||||||
emit '';
|
emit '';
|
||||||
|
|
||||||
if ( $first_default_route ) {
|
if ( $first_default_route ) {
|
||||||
if ( $gateway ) {
|
if ( $balanced_providers == 1 ) {
|
||||||
emit "DEFAULT_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\"";
|
if ( $gateway ) {
|
||||||
|
emit qq(DEFAULT_ROUTE="via $gateway dev $interface $realm");
|
||||||
|
} else {
|
||||||
|
emit qq(DEFAULT_ROUTE="dev $interface $realm");
|
||||||
|
}
|
||||||
|
} elsif ( $gateway ) {
|
||||||
|
emit qq(DEFAULT_ROUTE="nexthop via $gateway dev $interface weight $weight $realm");
|
||||||
} else {
|
} else {
|
||||||
emit "DEFAULT_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
emit qq(DEFAULT_ROUTE="nexthop dev $interface weight $weight $realm");
|
||||||
}
|
}
|
||||||
|
|
||||||
$first_default_route = 0;
|
$first_default_route = 0;
|
||||||
} else {
|
} else {
|
||||||
if ( $gateway ) {
|
if ( $gateway ) {
|
||||||
emit "DEFAULT_ROUTE=\"\$DEFAULT_ROUTE nexthop via $gateway dev $interface weight $weight $realm\"";
|
emit qq(DEFAULT_ROUTE="\$DEFAULT_ROUTE nexthop via $gateway dev $interface weight $weight $realm");
|
||||||
} else {
|
} else {
|
||||||
emit "DEFAULT_ROUTE=\"\$DEFAULT_ROUTE nexthop dev $interface weight $weight $realm\"";
|
emit qq(DEFAULT_ROUTE="\$DEFAULT_ROUTE nexthop dev $interface weight $weight $realm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,18 +366,24 @@ sub balance_fallback_route( $$$$ ) {
|
|||||||
emit '';
|
emit '';
|
||||||
|
|
||||||
if ( $first_fallback_route ) {
|
if ( $first_fallback_route ) {
|
||||||
if ( $gateway ) {
|
if ( $fallback_providers == 1 ) {
|
||||||
emit "FALLBACK_ROUTE=\"nexthop via $gateway dev $interface weight $weight $realm\"";
|
if ( $gateway ) {
|
||||||
|
emit qq(FALLBACK_ROUTE="via $gateway dev $interface $realm");
|
||||||
|
} else {
|
||||||
|
emit qq(FALLBACK_ROUTE="dev $interface $realm");
|
||||||
|
}
|
||||||
|
} elsif ( $gateway ) {
|
||||||
|
emit qq(FALLBACK_ROUTE="nexthop via $gateway dev $interface weight $weight $realm");
|
||||||
} else {
|
} else {
|
||||||
emit "FALLBACK_ROUTE=\"nexthop dev $interface weight $weight $realm\"";
|
emit qq(FALLBACK_ROUTE="nexthop dev $interface weight $weight $realm");
|
||||||
}
|
}
|
||||||
|
|
||||||
$first_fallback_route = 0;
|
$first_fallback_route = 0;
|
||||||
} else {
|
} else {
|
||||||
if ( $gateway ) {
|
if ( $gateway ) {
|
||||||
emit "FALLBACK_ROUTE=\"\$FALLBACK_ROUTE nexthop via $gateway dev $interface weight $weight $realm\"";
|
emit qq(FALLBACK_ROUTE="\$FALLBACK_ROUTE nexthop via $gateway dev $interface weight $weight $realm");
|
||||||
} else {
|
} else {
|
||||||
emit "FALLBACK_ROUTE=\"\$FALLBACK_ROUTE nexthop dev $interface weight $weight $realm\"";
|
emit qq(FALLBACK_ROUTE="\$FALLBACK_ROUTE nexthop dev $interface weight $weight $realm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,7 +511,7 @@ sub process_a_provider( $ ) {
|
|||||||
|
|
||||||
if ( ( $gw = lc $gateway ) eq 'detect' ) {
|
if ( ( $gw = lc $gateway ) eq 'detect' ) {
|
||||||
fatal_error "Configuring multiple providers through one interface requires an explicit gateway" if $shared;
|
fatal_error "Configuring multiple providers through one interface requires an explicit gateway" if $shared;
|
||||||
$gateway = get_interface_gateway( $interface, undef, 1 );
|
$gateway = get_interface_gateway( $interface, undef, $number );
|
||||||
$gatewaycase = 'detect';
|
$gatewaycase = 'detect';
|
||||||
set_interface_option( $interface, 'gateway', 'detect' );
|
set_interface_option( $interface, 'gateway', 'detect' );
|
||||||
} elsif ( $gw eq 'none' ) {
|
} elsif ( $gw eq 'none' ) {
|
||||||
@@ -496,6 +521,9 @@ sub process_a_provider( $ ) {
|
|||||||
set_interface_option( $interface, 'gateway', 'none' );
|
set_interface_option( $interface, 'gateway', 'none' );
|
||||||
} elsif ( $gateway && $gateway ne '-' ) {
|
} elsif ( $gateway && $gateway ne '-' ) {
|
||||||
( $gateway, $mac ) = split_host_list( $gateway, 0 );
|
( $gateway, $mac ) = split_host_list( $gateway, 0 );
|
||||||
|
|
||||||
|
$gateway = $1 if $family == F_IPV6 && $gateway =~ /^\[(.+)\]$/;
|
||||||
|
|
||||||
validate_address $gateway, 0;
|
validate_address $gateway, 0;
|
||||||
|
|
||||||
if ( defined $mac ) {
|
if ( defined $mac ) {
|
||||||
@@ -586,6 +614,7 @@ sub process_a_provider( $ ) {
|
|||||||
} elsif ( $option eq 'nohostroute' ) {
|
} elsif ( $option eq 'nohostroute' ) {
|
||||||
$hostroute = 0;
|
$hostroute = 0;
|
||||||
} elsif ( $option eq 'persistent' ) {
|
} elsif ( $option eq 'persistent' ) {
|
||||||
|
warning_message "When RESTORE_DEFAULT_ROUTE=Yes, the 'persistent' option may not work as expected" if $config{RESTORE_DEFAULT_ROUTE};
|
||||||
$persistent = 1;
|
$persistent = 1;
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Invalid option ($option)";
|
fatal_error "Invalid option ($option)";
|
||||||
@@ -593,7 +622,12 @@ sub process_a_provider( $ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error q(The 'balance' and 'fallback' options are mutually exclusive) if $balance && $default;
|
if ( $balance ) {
|
||||||
|
fatal_error q(The 'balance' and 'fallback' options are mutually exclusive) if $default;
|
||||||
|
$balanced_providers++;
|
||||||
|
} elsif ( $default ) {
|
||||||
|
$fallback_providers++;
|
||||||
|
}
|
||||||
|
|
||||||
if ( $load ) {
|
if ( $load ) {
|
||||||
fatal_error q(The 'balance=<weight>' and 'load=<load-factor>' options are mutually exclusive) if $balance > 1;
|
fatal_error q(The 'balance=<weight>' and 'load=<load-factor>' options are mutually exclusive) if $balance > 1;
|
||||||
@@ -667,7 +701,6 @@ sub process_a_provider( $ ) {
|
|||||||
|
|
||||||
$pref = 10000 + $number - 1;
|
$pref = 10000 + $number - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unless ( $loose || $pseudo ) {
|
unless ( $loose || $pseudo ) {
|
||||||
@@ -826,7 +859,7 @@ sub add_a_provider( $$ ) {
|
|||||||
if ( $tproxy ) {
|
if ( $tproxy ) {
|
||||||
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
|
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
|
||||||
} else {
|
} else {
|
||||||
emit "run_ip route add default dev $physical table $id";
|
emit "run_ip route replace default dev $physical table $id";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -842,8 +875,8 @@ sub add_a_provider( $$ ) {
|
|||||||
emit qq(echo "\$IP route del $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
emit qq(echo "\$IP route del $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit( "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm" );
|
emit( "run_ip route replace default via $gateway src $address dev $physical ${mtu}table $id $realm" );
|
||||||
emit( qq( echo "\$IP route del default via $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) );
|
emit( qq(echo "\$IP route del default via $gateway src $address dev $physical ${mtu}table $id $realm > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $noautosrc ) {
|
if ( ! $noautosrc ) {
|
||||||
@@ -852,24 +885,25 @@ sub add_a_provider( $$ ) {
|
|||||||
emit( "run_ip rule add from $address pref 20000 table $id" ,
|
emit( "run_ip rule add from $address pref 20000 table $id" ,
|
||||||
"echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" );
|
"echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" );
|
||||||
} else {
|
} else {
|
||||||
emit ( "find_interface_addresses $physical | while read address; do" );
|
emit ( '',
|
||||||
emit ( " qt \$IP -$family rule del from \$address" );
|
"find_interface_addresses $physical | while read address; do",
|
||||||
emit ( " run_ip rule add from \$address pref 20000 table $id",
|
" qt \$IP -$family rule del from \$address",
|
||||||
|
" run_ip rule add from \$address pref 20000 table $id",
|
||||||
" echo \"\$IP -$family rule del from \$address pref 20000 > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing",
|
" echo \"\$IP -$family rule del from \$address pref 20000 > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing",
|
||||||
' rulenum=$(($rulenum + 1))',
|
' rulenum=$(($rulenum + 1))',
|
||||||
'done'
|
'done'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( @{$providerref->{persistent_routes}} ) {
|
if ( @{$providerref->{persistent_routes}} ) {
|
||||||
emit '';
|
emit '';
|
||||||
emit $_ for @{$providers{$table}->{persistent_routes}};
|
emit $_ for @{$providers{$table}->{persistent_routes}};
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( @{$providerref->{persistent_rules}} ) {
|
if ( @{$providerref->{persistent_rules}} ) {
|
||||||
emit '';
|
emit '';
|
||||||
emit $_ for @{$providers{$table}->{persistent_rules}};
|
emit $_ for @{$providers{$table}->{persistent_rules}};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
@@ -877,7 +911,6 @@ sub add_a_provider( $$ ) {
|
|||||||
emit( qq(fi\n),
|
emit( qq(fi\n),
|
||||||
qq(echo 1 > \${VARDIR}/${physical}_disabled) );
|
qq(echo 1 > \${VARDIR}/${physical}_disabled) );
|
||||||
|
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
|
|
||||||
emit( "}\n" );
|
emit( "}\n" );
|
||||||
@@ -903,7 +936,7 @@ sub add_a_provider( $$ ) {
|
|||||||
if ( $tproxy ) {
|
if ( $tproxy ) {
|
||||||
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
|
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
|
||||||
} else {
|
} else {
|
||||||
emit "run_ip route add default dev $physical table $id";
|
emit "run_ip route replace default dev $physical table $id";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -935,7 +968,7 @@ CEOF
|
|||||||
my $hexmark = in_hex( $mark );
|
my $hexmark = in_hex( $mark );
|
||||||
my $mask = have_capability( 'FWMARK_RT_MASK' ) ? '/' . in_hex( $globals{ $tproxy && ! $local ? 'TPROXY_MARK' : 'PROVIDER_MASK' } ) : '';
|
my $mask = have_capability( 'FWMARK_RT_MASK' ) ? '/' . in_hex( $globals{ $tproxy && ! $local ? 'TPROXY_MARK' : 'PROVIDER_MASK' } ) : '';
|
||||||
|
|
||||||
emit ( "qt \$IP -$family rule del fwmark ${hexmark}${mask}" ) if $config{DELETE_THEN_ADD};
|
emit ( "qt \$IP -$family rule del fwmark ${hexmark}${mask}" ) if $persistent || $config{DELETE_THEN_ADD};
|
||||||
|
|
||||||
emit ( "run_ip rule add fwmark ${hexmark}${mask} pref $pref table $id",
|
emit ( "run_ip rule add fwmark ${hexmark}${mask} pref $pref table $id",
|
||||||
"echo \"\$IP -$family rule del fwmark ${hexmark}${mask} > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing"
|
"echo \"\$IP -$family rule del fwmark ${hexmark}${mask} > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing"
|
||||||
@@ -964,7 +997,7 @@ CEOF
|
|||||||
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm);
|
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm";
|
emit "run_ip route replace default via $gateway src $address dev $physical ${mtu}table $id $realm";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $balance ) {
|
if ( $balance ) {
|
||||||
@@ -976,14 +1009,16 @@ CEOF
|
|||||||
emit '';
|
emit '';
|
||||||
if ( $gateway ) {
|
if ( $gateway ) {
|
||||||
emit qq(run_ip route replace $gateway/32 dev $physical table $id) if $hostroute;
|
emit qq(run_ip route replace $gateway/32 dev $physical table $id) if $hostroute;
|
||||||
emit qq(run_ip route add default via $gateway src $address dev $physical table $id metric $number);
|
emit qq(run_ip route replace default via $gateway src $address dev $physical table $id metric $number);
|
||||||
emit qq(echo "\$IP -$family route del default via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
emit qq(echo "\$IP -$family route del default via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
||||||
emit qq(echo "\$IP -4 route del $gateway/32 dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) if $family == F_IPV4;
|
emit qq(echo "\$IP -4 route del $gateway/32 dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) if $family == F_IPV4;
|
||||||
} else {
|
} else {
|
||||||
emit qq(run_ip route add default table $id dev $physical metric $number);
|
emit qq(run_ip route replace default table $id dev $physical metric $number);
|
||||||
emit qq(echo "\$IP -$family route del default dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
emit qq(echo "\$IP -$family route del default dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit( 'g_fallback=Yes' ) if $persistent;
|
||||||
|
|
||||||
$metrics = 1;
|
$metrics = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1005,12 +1040,13 @@ CEOF
|
|||||||
} elsif ( ! $noautosrc ) {
|
} elsif ( ! $noautosrc ) {
|
||||||
if ( $shared ) {
|
if ( $shared ) {
|
||||||
if ( $persistent ) {
|
if ( $persistent ) {
|
||||||
emit( qq(if ! egrep -q "^2000:[[:space:]]+from $address lookup $id"; then),
|
emit( qq(if ! egrep -q "^20000:[[:space:]]+from $address lookup $id"; then),
|
||||||
|
qq( qt \$IP -$family rule del from $address pref 20000),
|
||||||
qq( run_ip rule add from $address pref 20000 table $id),
|
qq( run_ip rule add from $address pref 20000 table $id),
|
||||||
qq( echo "\$IP -$family rule del from $address pref 20000> /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing ),
|
qq( echo "\$IP -$family rule del from $address pref 20000> /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing ),
|
||||||
qq(fi) );
|
qq(fi) );
|
||||||
} else {
|
} else {
|
||||||
emit "qt \$IP -$family rule del from $address" if $config{DELETE_THEN_ADD};
|
emit "qt \$IP -$family rule del from $address" if $persistent || $config{DELETE_THEN_ADD};
|
||||||
emit( "run_ip rule add from $address pref 20000 table $id" ,
|
emit( "run_ip rule add from $address pref 20000 table $id" ,
|
||||||
"echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" );
|
"echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" );
|
||||||
}
|
}
|
||||||
@@ -1067,7 +1103,21 @@ CEOF
|
|||||||
emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
|
emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
|
||||||
}
|
}
|
||||||
|
|
||||||
emit( qq(rm -f \${VARDIR}/${physical}_disabled) );
|
emit( qq(rm -f \${VARDIR}/${physical}_disabled),
|
||||||
|
$pseudo ? "run_enabled_exit ${physical} ${interface}" : "run_enabled_exit ${physical} ${interface} ${table}"
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( ! $pseudo && $config{USE_DEFAULT_RT} && $config{RESTORE_DEFAULT_ROUTE} ) {
|
||||||
|
emit ( '#',
|
||||||
|
'# We now have a viable default route in the \'default\' table so delete any default routes in the main table',
|
||||||
|
'#',
|
||||||
|
'while qt \$IP -$family route del default table ' . MAIN_TABLE . '; do',
|
||||||
|
' true',
|
||||||
|
'done',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
emit_started_message( '', 2, $pseudo, $table, $number );
|
emit_started_message( '', 2, $pseudo, $table, $number );
|
||||||
|
|
||||||
if ( get_interface_option( $interface, 'used_address_variable' ) || get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
if ( get_interface_option( $interface, 'used_address_variable' ) || get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
||||||
@@ -1201,7 +1251,7 @@ CEOF
|
|||||||
'if [ $COMMAND = disable ]; then',
|
'if [ $COMMAND = disable ]; then',
|
||||||
" do_persistent_${what}_${table}",
|
" do_persistent_${what}_${table}",
|
||||||
"else",
|
"else",
|
||||||
" echo 1 > \${VARDIR}/${physical}_disabled\n",
|
" echo 1 > \${VARDIR}/${physical}_disabled",
|
||||||
"fi\n",
|
"fi\n",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1212,12 +1262,14 @@ CEOF
|
|||||||
"qt \$TC qdisc del dev $physical ingress\n" ) if $tcdevices->{$interface};
|
"qt \$TC qdisc del dev $physical ingress\n" ) if $tcdevices->{$interface};
|
||||||
}
|
}
|
||||||
|
|
||||||
emit( "echo 1 > \${VARDIR}/${physical}.status" );
|
emit( "echo 1 > \${VARDIR}/${physical}.status",
|
||||||
|
$pseudo ? "run_disabled_exit ${physical} ${interface}" : "run_disabled_exit ${physical} ${interface} ${table}"
|
||||||
|
);
|
||||||
|
|
||||||
if ( $pseudo ) {
|
if ( $pseudo ) {
|
||||||
emit( "progress_message2 \" Optional Interface $table stopped\"" );
|
emit( "progress_message2 \"Optional Interface $table stopped\"" );
|
||||||
} else {
|
} else {
|
||||||
emit( "progress_message2 \" Provider $table ($number) stopped\"" );
|
emit( "progress_message2 \"Provider $table ($number) stopped\"" );
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
@@ -1318,7 +1370,7 @@ sub add_an_rtrule1( $$$$$ ) {
|
|||||||
|
|
||||||
$priority = "pref $priority";
|
$priority = "pref $priority";
|
||||||
|
|
||||||
push @{$providerref->{rules}}, "qt \$IP -$family rule del $source ${dest}${mark} $priority" if $config{DELETE_THEN_ADD};
|
push @{$providerref->{rules}}, "qt \$IP -$family rule del $source ${dest}${mark} $priority" if $persistent || $config{DELETE_THEN_ADD};
|
||||||
push @{$providerref->{rules}}, "run_ip rule add $source ${dest}${mark} $priority table $id";
|
push @{$providerref->{rules}}, "run_ip rule add $source ${dest}${mark} $priority table $id";
|
||||||
|
|
||||||
if ( $persistent ) {
|
if ( $persistent ) {
|
||||||
@@ -1416,22 +1468,22 @@ sub add_a_route( ) {
|
|||||||
|
|
||||||
if ( $gateway ne '-' ) {
|
if ( $gateway ne '-' ) {
|
||||||
if ( $device ne '-' ) {
|
if ( $device ne '-' ) {
|
||||||
push @$routes, qq(run_ip route add $dest via $gateway dev $physical table $id);
|
push @$routes, qq(run_ip route replace $dest via $gateway dev $physical table $id);
|
||||||
push @$persistent_routes, qq(run_ip route add $dest via $gateway dev $physical table $id) if $persistent;
|
push @$persistent_routes, qq(run_ip route replace $dest via $gateway dev $physical table $id) if $persistent;
|
||||||
push @$routes, q(echo "$IP ) . qq(-$family route del $dest via $gateway dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
push @$routes, q(echo "$IP ) . qq(-$family route del $dest via $gateway dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
||||||
} elsif ( $null ) {
|
} elsif ( $null ) {
|
||||||
push @$routes, qq(run_ip route add $null $dest table $id);
|
push @$routes, qq(run_ip route replace $null $dest table $id);
|
||||||
push @$persistent_routes, qq(run_ip route add $null $dest table $id) if $persistent;
|
push @$persistent_routes, qq(run_ip route replace $null $dest table $id) if $persistent;
|
||||||
push @$routes, q(echo "$IP ) . qq(-$family route del $null $dest table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
push @$routes, q(echo "$IP ) . qq(-$family route del $null $dest table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
||||||
} else {
|
} else {
|
||||||
push @$routes, qq(run_ip route add $dest via $gateway table $id);
|
push @$routes, qq(run_ip route replace $dest via $gateway table $id);
|
||||||
push @$persistent_routes, qq(run_ip route add $dest via $gateway table $id) if $persistent;
|
push @$persistent_routes, qq(run_ip route replace $dest via $gateway table $id) if $persistent;
|
||||||
push @$routes, q(echo "$IP ) . qq(-$family route del $dest via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
push @$routes, q(echo "$IP ) . qq(-$family route del $dest via $gateway table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fatal_error "You must specify a device for this route" unless $physical;
|
fatal_error "You must specify a device for this route" unless $physical;
|
||||||
push @$routes, qq(run_ip route add $dest dev $physical table $id);
|
push @$routes, qq(run_ip route replace $dest dev $physical table $id);
|
||||||
push @$persistent_routes, qq(run_ip route add $dest dev $physical table $id) if $persistent;
|
push @$persistent_routes, qq(run_ip route replace $dest dev $physical table $id) if $persistent;
|
||||||
push @$routes, q(echo "$IP ) . qq(-$family route del $dest dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
push @$routes, q(echo "$IP ) . qq(-$family route del $dest dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${provider}_routing) if $number >= DEFAULT_TABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1533,16 +1585,17 @@ sub finish_providers() {
|
|||||||
emit ( " run_ip route replace default scope global table $table \$DEFAULT_ROUTE" );
|
emit ( " run_ip route replace default scope global table $table \$DEFAULT_ROUTE" );
|
||||||
} else {
|
} else {
|
||||||
emit ( " if echo \$DEFAULT_ROUTE | grep -q 'nexthop.+nexthop'; then",
|
emit ( " if echo \$DEFAULT_ROUTE | grep -q 'nexthop.+nexthop'; then",
|
||||||
" qt \$IP -6 route delete default scope global table $table \$DEFAULT_ROUTE",
|
" while qt \$IP -6 route delete default table $table; do true; done",
|
||||||
" run_ip -6 route add default scope global table $table \$DEFAULT_ROUTE",
|
" run_ip route add default scope global table $table \$DEFAULT_ROUTE",
|
||||||
' else',
|
' else',
|
||||||
" run_ip -6 route replace default scope global table $table \$DEFAULT_ROUTE",
|
" run_ip route replace default scope global table $table \$DEFAULT_ROUTE",
|
||||||
' fi',
|
' fi',
|
||||||
'' );
|
'' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $config{USE_DEFAULT_RT} ) {
|
if ( $config{USE_DEFAULT_RT} ) {
|
||||||
emit ( " while qt \$IP -$family route del default table $main; do",
|
emit ( '',
|
||||||
|
" while qt \$IP -$family route del default table $main; do",
|
||||||
' true',
|
' true',
|
||||||
' done',
|
' done',
|
||||||
''
|
''
|
||||||
@@ -1554,7 +1607,7 @@ sub finish_providers() {
|
|||||||
' error_message "WARNING: No Default route added (all \'balance\' providers are down)"' );
|
' error_message "WARNING: No Default route added (all \'balance\' providers are down)"' );
|
||||||
|
|
||||||
if ( $config{RESTORE_DEFAULT_ROUTE} ) {
|
if ( $config{RESTORE_DEFAULT_ROUTE} ) {
|
||||||
emit qq( restore_default_route $config{USE_DEFAULT_RT} && error_message "NOTICE: Default route restored")
|
emit qq( [ -z "\${FALLBACK_ROUTE}\${g_fallback}" ] && restore_default_route $config{USE_DEFAULT_RT} && error_message "NOTICE: Default route restored")
|
||||||
} else {
|
} else {
|
||||||
emit qq( qt \$IP -$family route del default table $table && error_message "WARNING: Default route deleted from table $table");
|
emit qq( qt \$IP -$family route del default table $table && error_message "WARNING: Default route deleted from table $table");
|
||||||
}
|
}
|
||||||
@@ -1581,7 +1634,7 @@ sub finish_providers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit ( '#',
|
emit ( '#',
|
||||||
'# Delete any routes in the \'balance\' table',
|
'# Delete any default routes with metric 0 in the \'balance\' table',
|
||||||
'#',
|
'#',
|
||||||
"while qt \$IP -$family route del default table $balance; do",
|
"while qt \$IP -$family route del default table $balance; do",
|
||||||
' true',
|
' true',
|
||||||
@@ -1596,7 +1649,7 @@ sub finish_providers() {
|
|||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
emit( " run_ip route replace default scope global table $default \$FALLBACK_ROUTE" );
|
emit( " run_ip route replace default scope global table $default \$FALLBACK_ROUTE" );
|
||||||
} else {
|
} else {
|
||||||
emit( " run_ip route delete default scope global table $default \$FALLBACK_ROUTE" );
|
emit( " while qt \$IP -6 route delete default table $default; do true; done" );
|
||||||
emit( " run_ip route add default scope global table $default \$FALLBACK_ROUTE" );
|
emit( " run_ip route add default scope global table $default \$FALLBACK_ROUTE" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1609,7 +1662,10 @@ sub finish_providers() {
|
|||||||
'fi',
|
'fi',
|
||||||
'' );
|
'' );
|
||||||
} elsif ( $config{USE_DEFAULT_RT} ) {
|
} elsif ( $config{USE_DEFAULT_RT} ) {
|
||||||
emit( "delete_default_routes $default",
|
emit( '#',
|
||||||
|
'# No balanced fallback routes - delete any routes with metric 0 from the \'default\' table',
|
||||||
|
'#',
|
||||||
|
"delete_default_routes $default",
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1654,7 +1710,7 @@ sub process_providers( $ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $providers ) {
|
if ( $providers ) {
|
||||||
fatal_error q(Either all 'fallback' providers must specify a weight or non of them can specify a weight) if $fallback && $metrics;
|
fatal_error q(Either all 'fallback' providers must specify a weight or none of them can specify a weight) if $fallback && $metrics;
|
||||||
|
|
||||||
my $fn = open_file( 'route_rules' );
|
my $fn = open_file( 'route_rules' );
|
||||||
|
|
||||||
@@ -1685,7 +1741,7 @@ sub process_providers( $ ) {
|
|||||||
|
|
||||||
add_a_provider( $providers{$_}, $tcdevices ) for @providers;
|
add_a_provider( $providers{$_}, $tcdevices ) for @providers;
|
||||||
|
|
||||||
emit << 'EOF';;
|
emithd << 'EOF';;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Enable an optional provider
|
# Enable an optional provider
|
||||||
@@ -1731,12 +1787,11 @@ EOF
|
|||||||
pop_indent;
|
pop_indent;
|
||||||
pop_indent;
|
pop_indent;
|
||||||
|
|
||||||
emit << 'EOF';;
|
emithd << 'EOF';;
|
||||||
*)
|
*)
|
||||||
startup_error "$g_interface is not an optional provider or interface"
|
startup_error "$g_interface is not an optional provider or interface"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1840,20 +1895,19 @@ sub setup_providers() {
|
|||||||
|
|
||||||
start_providers;
|
start_providers;
|
||||||
|
|
||||||
setup_null_routing if $config{NULL_ROUTE_RFC1918};
|
setup_null_routing, emit '' if $config{NULL_ROUTE_RFC1918};
|
||||||
|
|
||||||
emit '';
|
if ( @providers ) {
|
||||||
|
emit "start_$providers{$_}->{what}_$_" for @providers;
|
||||||
emit "start_$providers{$_}->{what}_$_" for @providers;
|
emit '';
|
||||||
|
}
|
||||||
emit '';
|
|
||||||
|
|
||||||
finish_providers;
|
finish_providers;
|
||||||
|
|
||||||
emit "\nrun_ip route flush cache";
|
emit "\nrun_ip route flush cache";
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
emit "fi\n";
|
emit 'fi';
|
||||||
|
|
||||||
setup_route_marking if @routemarked_interfaces || @load_interfaces;
|
setup_route_marking if @routemarked_interfaces || @load_interfaces;
|
||||||
} else {
|
} else {
|
||||||
@@ -1864,9 +1918,10 @@ sub setup_providers() {
|
|||||||
if ( $pseudoproviders ) {
|
if ( $pseudoproviders ) {
|
||||||
emit '';
|
emit '';
|
||||||
emit "start_$providers{$_}->{what}_$_" for @providers;
|
emit "start_$providers{$_}->{what}_$_" for @providers;
|
||||||
|
emit '';
|
||||||
}
|
}
|
||||||
|
|
||||||
emit "\nundo_routing";
|
emit "undo_routing";
|
||||||
emit "restore_default_route $config{USE_DEFAULT_RT}";
|
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}};
|
||||||
@@ -1891,9 +1946,8 @@ sub setup_providers() {
|
|||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
|
|
||||||
emit "fi\n";
|
emit 'fi';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2142,17 +2196,13 @@ sub provider_realm( $ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# This function is called by the compiler when it is generating the detect_configuration() function.
|
# Perform processing related to optional interfaces. Returns true if there are optional interfaces.
|
||||||
# The function calls Shorewall::Zones::verify_required_interfaces then emits code to set the
|
|
||||||
# ..._IS_USABLE interface variables appropriately for the optional interfaces
|
|
||||||
#
|
#
|
||||||
# Returns true if there were required or optional interfaces
|
sub handle_optional_interfaces() {
|
||||||
#
|
|
||||||
sub handle_optional_interfaces( $ ) {
|
|
||||||
|
|
||||||
my @interfaces;
|
my @interfaces;
|
||||||
my $wildcards;
|
my $wildcards;
|
||||||
|
|
||||||
#
|
#
|
||||||
# First do the provider interfacess. Those that are real providers will never have wildcard physical
|
# First do the provider interfacess. Those that are real providers will never have wildcard physical
|
||||||
# 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
|
||||||
@@ -2176,10 +2226,6 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
|
|
||||||
if ( @interfaces ) {
|
if ( @interfaces ) {
|
||||||
my $require = $config{REQUIRE_INTERFACE};
|
my $require = $config{REQUIRE_INTERFACE};
|
||||||
my $gencase = shift;
|
|
||||||
|
|
||||||
verify_required_interfaces( $gencase );
|
|
||||||
emit '' if $gencase;
|
|
||||||
|
|
||||||
emit( 'HAVE_INTERFACE=', '' ) if $require;
|
emit( 'HAVE_INTERFACE=', '' ) if $require;
|
||||||
#
|
#
|
||||||
@@ -2322,7 +2368,7 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
emit( '',
|
emit( '',
|
||||||
'if [ -z "$HAVE_INTERFACE" ]; then' ,
|
'if [ -z "$HAVE_INTERFACE" ]; then' ,
|
||||||
' case "$COMMAND" in',
|
' case "$COMMAND" in',
|
||||||
' start|reload|restore|refresh)'
|
' start|reload|restore)'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
@@ -2343,8 +2389,6 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_required_interfaces( shift );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Proxyarp.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Proxyarp.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -96,6 +96,7 @@ sub setup_one_proxy_arp( $$$$$$$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit ( "run_ip neigh add proxy $address nud permanent dev $extphy" ,
|
emit ( "run_ip neigh add proxy $address nud permanent dev $extphy" ,
|
||||||
|
'' ,
|
||||||
qq(progress_message " Host $address connected to $interface added to $proto on $extphy"\n) );
|
qq(progress_message " Host $address connected to $interface added to $proto on $extphy"\n) );
|
||||||
|
|
||||||
push @proxyarp, "$address $interface $external $haveroute";
|
push @proxyarp, "$address $interface $external $haveroute";
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Raw.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Raw.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2009-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2009-2018 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -91,7 +91,7 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
|||||||
|
|
||||||
my $disposition = $action;
|
my $disposition = $action;
|
||||||
my $exception_rule = '';
|
my $exception_rule = '';
|
||||||
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_condition( $switch , $chainref->{name} );
|
|
||||||
my $level = '';
|
my $level = '';
|
||||||
|
|
||||||
if ( $action =~ /^(?:NFLOG|ULOG)/ ) {
|
if ( $action =~ /^(?:NFLOG|ULOG)/ ) {
|
||||||
@@ -138,6 +138,14 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
|||||||
|
|
||||||
require_capability 'CT_TARGET', 'CT entries in the conntrack file', '';
|
require_capability 'CT_TARGET', 'CT entries in the conntrack file', '';
|
||||||
|
|
||||||
|
if ( $proto ne '-' ) {
|
||||||
|
if ( $proto =~ s/:all$// ) {
|
||||||
|
fatal_error '":all" may only be used with TCP' unless resolve_proto( $proto ) == TCP;
|
||||||
|
} else {
|
||||||
|
$proto = TCP . ':syn' if $proto !~ /:syn/ && resolve_proto( $proto ) == TCP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $option eq 'notrack' ) {
|
if ( $option eq 'notrack' ) {
|
||||||
fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args;
|
fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args;
|
||||||
$action = 'CT --notrack';
|
$action = 'CT --notrack';
|
||||||
@@ -199,7 +207,9 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
|||||||
expand_rule( $chainref ,
|
expand_rule( $chainref ,
|
||||||
$restriction ,
|
$restriction ,
|
||||||
'',
|
'',
|
||||||
$rule,
|
do_proto( $proto, $ports, $sports ) .
|
||||||
|
do_user ( $user ) .
|
||||||
|
do_condition( $switch , $chainref->{name} ),
|
||||||
$source ,
|
$source ,
|
||||||
$dest ,
|
$dest ,
|
||||||
'' ,
|
'' ,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Tc.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Tc.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Traffic Control is from tc4shorewall Version 0.5
|
# Traffic Control is from tc4shorewall Version 0.5
|
||||||
# (c) 2005 Arne Bernin <arne@ucbering.de>
|
# (c) 2005 Arne Bernin <arne@ucbering.de>
|
||||||
@@ -225,11 +225,11 @@ sub handle_in_bandwidth( $$$ ) {
|
|||||||
if ( have_capability 'BASIC_FILTER' ) {
|
if ( have_capability 'BASIC_FILTER' ) {
|
||||||
if ( $in_rate ) {
|
if ( $in_rate ) {
|
||||||
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 basic \\",
|
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 basic \\",
|
||||||
" police mpu 64 drop rate ${in_rate}kbit burst $in_burst\n" );
|
" police mpu 64 rate ${in_rate}kbit burst $in_burst drop\n" );
|
||||||
} else {
|
} else {
|
||||||
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\",
|
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\",
|
||||||
" estimator $in_interval $in_decay basic \\",
|
" estimator $in_interval $in_decay basic \\",
|
||||||
" police drop avrate ${in_avrate}kbit\n" );
|
" police avrate ${in_avrate}kbit drop\n" );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\" ,
|
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\" ,
|
||||||
@@ -1434,7 +1434,7 @@ sub process_tc_filter2( $$$$$$$$$ ) {
|
|||||||
|
|
||||||
while ( @sportlist ) {
|
while ( @sportlist ) {
|
||||||
my ( $sport, $smask ) = ( shift @sportlist, shift @sportlist );
|
my ( $sport, $smask ) = ( shift @sportlist, shift @sportlist );
|
||||||
$rule .= "\\\n cmp\\( u16 at 0 layer 2 mask $smask eq 0x$sport \\)";
|
$rule .= "\\\n cmp\\( u16 at 0 layer 2 mask 0x$smask eq 0x$sport \\)";
|
||||||
$rule .= ' or' if @sportlist;
|
$rule .= ' or' if @sportlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Tunnels.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Tunnels.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||||
@@ -85,8 +85,8 @@ sub setup_tunnels() {
|
|||||||
for my $zone ( split_list $gatewayzones, 'zone' ) {
|
for my $zone ( split_list $gatewayzones, 'zone' ) {
|
||||||
my $type = zone_type( $zone );
|
my $type = zone_type( $zone );
|
||||||
fatal_error "Invalid zone ($zone) for GATEWAY ZONE" if $type == FIREWALL || $type == BPORT;
|
fatal_error "Invalid zone ($zone) for GATEWAY ZONE" if $type == FIREWALL || $type == BPORT;
|
||||||
$inchainref = ensure_rules_chain( rules_chain( ${zone}, ${fw} ) );
|
$inchainref = ensure_rules_chain( ${zone}, ${fw} );
|
||||||
$outchainref = ensure_rules_chain( rules_chain( ${fw}, ${zone} ) );
|
$outchainref = ensure_rules_chain( ${fw}, ${zone} );
|
||||||
|
|
||||||
unless ( have_ipsec ) {
|
unless ( have_ipsec ) {
|
||||||
add_tunnel_rule $inchainref, p => 50, @$source;
|
add_tunnel_rule $inchainref, p => 50, @$source;
|
||||||
@@ -250,8 +250,8 @@ sub setup_tunnels() {
|
|||||||
|
|
||||||
fatal_error "Invalid tunnel ZONE ($zone)" if $zonetype & ( FIREWALL | BPORT );
|
fatal_error "Invalid tunnel ZONE ($zone)" if $zonetype & ( FIREWALL | BPORT );
|
||||||
|
|
||||||
my $inchainref = ensure_rules_chain( rules_chain( ${zone}, ${fw} ) );
|
my $inchainref = ensure_rules_chain( ${zone}, ${fw} );
|
||||||
my $outchainref = ensure_rules_chain( rules_chain( ${fw}, ${zone} ) );
|
my $outchainref = ensure_rules_chain( ${fw}, ${zone} );
|
||||||
|
|
||||||
$gateways = ALLIP if $gateways eq '-';
|
$gateways = ALLIP if $gateways eq '-';
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Zones.pm
|
# Shorewall 5.2 -- /usr/share/shorewall/Shorewall/Zones.pm
|
||||||
#
|
#
|
||||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||||
#
|
#
|
||||||
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net)
|
# (c) 2007,2008,2009,2010,2011-2017 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# Complete documentation is available at http://shorewall.net
|
# Complete documentation is available at http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -90,9 +90,8 @@ our @EXPORT = ( qw( NOTHING
|
|||||||
interface_is_optional
|
interface_is_optional
|
||||||
interface_is_required
|
interface_is_required
|
||||||
find_interfaces_by_option
|
find_interfaces_by_option
|
||||||
find_interfaces_by_option1
|
|
||||||
get_interface_option
|
get_interface_option
|
||||||
get_interface_origin
|
get_interface_origin
|
||||||
interface_has_option
|
interface_has_option
|
||||||
set_interface_option
|
set_interface_option
|
||||||
interface_zone
|
interface_zone
|
||||||
@@ -108,55 +107,37 @@ our @EXPORT = ( qw( NOTHING
|
|||||||
|
|
||||||
our @EXPORT_OK = qw( initialize );
|
our @EXPORT_OK = qw( initialize );
|
||||||
our $VERSION = 'MODULEVERSION';
|
our $VERSION = 'MODULEVERSION';
|
||||||
|
|
||||||
#
|
|
||||||
# IPSEC Option types
|
|
||||||
#
|
|
||||||
use constant { NOTHING => 'NOTHING',
|
|
||||||
NUMERIC => '0x[\da-fA-F]+|\d+',
|
|
||||||
NETWORK => '\d+.\d+.\d+.\d+(\/\d+)?',
|
|
||||||
IPSECPROTO => 'ah|esp|ipcomp',
|
|
||||||
IPSECMODE => 'tunnel|transport'
|
|
||||||
};
|
|
||||||
|
|
||||||
#
|
|
||||||
# Option columns
|
|
||||||
#
|
|
||||||
use constant { IN_OUT => 1,
|
|
||||||
IN => 2,
|
|
||||||
OUT => 3 };
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Zone Table.
|
# Zone Table.
|
||||||
#
|
#
|
||||||
# @zones contains the ordered list of zones with sub-zones appearing before their parents.
|
# @zones contains the ordered list of zones with sub-zones appearing before their parents.
|
||||||
#
|
#
|
||||||
# %zones{<zone1> => {name => <name>,
|
# %zones{<zone1> => {name => <name>,
|
||||||
# type => <zone type> FIREWALL, IP, IPSEC, BPORT;
|
# type => <zone type> FIREWALL, IP, IPSEC, BPORT;
|
||||||
# complex => 0|1
|
# complex => 0|1
|
||||||
# super => 0|1
|
# super => 0|1
|
||||||
# options => { in_out => < policy match string >
|
# options => { in_out => < policy match string >
|
||||||
# in => < policy match string >
|
# in => < policy match string >
|
||||||
# out => < policy match string >
|
# out => < policy match string >
|
||||||
# }
|
# }
|
||||||
# parents => [ <parents> ] Parents, Children and interfaces are listed by name
|
# parents => [ <parents> ] Parents, Children and interfaces are listed by name
|
||||||
# children => [ <children> ]
|
# children => [ <children> ]
|
||||||
# interfaces => { <interfaces1> => 1, ... }
|
# interfaces => { <interfaces1> => 1, ... }
|
||||||
# bridge => <bridge>
|
# bridge => <bridge>
|
||||||
# hosts { <type> } => [ { <interface1> => { ipsec => 'ipsec'|'none'
|
# hosts { <type> } => [ { <interface1> => { ipsec => 'ipsec'|'none'
|
||||||
# options => { <option1> => <value1>
|
# options => { <option1> => <value1>
|
||||||
# ...
|
# ...
|
||||||
# }
|
# }
|
||||||
# hosts => [ <net1> , <net2> , ... ]
|
# hosts => [ <net1> , <net2> , ... ]
|
||||||
# exclusions => [ <net1>, <net2>, ... ]
|
# exclusions => [ <net1>, <net2>, ... ]
|
||||||
# origin => <where defined>
|
# origin => <where defined>
|
||||||
# }
|
# }
|
||||||
# <interface2> => ...
|
# <interface2> => ...
|
||||||
# }
|
# }
|
||||||
# ]
|
# ]
|
||||||
# }
|
# }
|
||||||
# <zone2> => ...
|
# <zone2> => ...
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# $firewall_zone names the firewall zone.
|
# $firewall_zone names the firewall zone.
|
||||||
#
|
#
|
||||||
@@ -178,27 +159,27 @@ our %reservedName = ( all => 1,
|
|||||||
#
|
#
|
||||||
# @interfaces lists the interface names in the order that they appear in the interfaces file.
|
# @interfaces lists the interface names in the order that they appear in the interfaces file.
|
||||||
#
|
#
|
||||||
# %interfaces { <interface1> => { name => <name of interface>
|
# %interfaces { <interface1> => { name => <name of interface>
|
||||||
# root => <name without trailing '+'>
|
# root => <name without trailing '+'>
|
||||||
# options => { port => undef|1
|
# options => { port => undef|1
|
||||||
# { <option1> } => <val1> , #See %validinterfaceoptions
|
# { <option1> } => <val1> , #See %validinterfaceoptions
|
||||||
# ...
|
# ...
|
||||||
# }
|
# }
|
||||||
# zone => <zone name>
|
# zone => <zone name>
|
||||||
# multizone => undef|1 #More than one zone interfaces through this interface
|
# multizone => undef|1 #More than one zone interfaces through this interface
|
||||||
# nets => <number of nets in interface/hosts records referring to this interface>
|
# nets => <number of nets in interface/hosts records referring to this interface>
|
||||||
# bridge => <bridge name> # Same as ->{name} if not a bridge port.
|
# bridge => <bridge name> # Same as ->{name} if not a bridge port.
|
||||||
# ports => <number of port on this bridge>
|
# ports => <number of port on this bridge>
|
||||||
# ipsec => undef|1 # Has an ipsec host group
|
# ipsec => undef|1 # Has an ipsec host group
|
||||||
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
|
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
|
||||||
# number => <ordinal position in the interfaces file>
|
# number => <ordinal position in the interfaces file>
|
||||||
# physical => <physical interface name>
|
# physical => <physical interface name>
|
||||||
# base => <shell variable base representing this interface>
|
# base => <shell variable base representing this interface>
|
||||||
# wildcard => undef|1 # Wildcard Name
|
# wildcard => undef|1 # Wildcard Name
|
||||||
# zones => { zone1 => 1, ... }
|
# zones => { zone1 => 1, ... }
|
||||||
# origin => <where defined>
|
# origin => <where defined>
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# The purpose of the 'base' member is to ensure that the base names associated with the physical interfaces are assigned in
|
# The purpose of the 'base' member is to ensure that the base names associated with the physical interfaces are assigned in
|
||||||
# the same order as the interfaces are encountered in the configuration files.
|
# the same order as the interfaces are encountered in the configuration files.
|
||||||
@@ -221,6 +202,26 @@ our $zonemarkincr;
|
|||||||
our $zonemarklimit;
|
our $zonemarklimit;
|
||||||
our $loopback_interface;
|
our $loopback_interface;
|
||||||
|
|
||||||
|
#
|
||||||
|
# IPSEC Option types
|
||||||
|
#
|
||||||
|
use constant { NOTHING => 'NOTHING',
|
||||||
|
NUMERIC => '0x[\da-fA-F]+|\d+',
|
||||||
|
IPSECPROTO => 'ah|esp|ipcomp',
|
||||||
|
IPSECMODE => 'tunnel|transport'
|
||||||
|
};
|
||||||
|
|
||||||
|
sub NETWORK() {
|
||||||
|
$family == F_IPV4 ? '\d+.\d+.\d+.\d+(\/\d+)?' : '(?:[0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}(?:\/d+)?';
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Option columns
|
||||||
|
#
|
||||||
|
use constant { IN_OUT => 1,
|
||||||
|
IN => 2,
|
||||||
|
OUT => 3 };
|
||||||
|
|
||||||
use constant { FIREWALL => 1,
|
use constant { FIREWALL => 1,
|
||||||
IP => 2,
|
IP => 2,
|
||||||
BPORT => 4,
|
BPORT => 4,
|
||||||
@@ -251,6 +252,17 @@ use constant { NO_UPDOWN => 1,
|
|||||||
|
|
||||||
our %validinterfaceoptions;
|
our %validinterfaceoptions;
|
||||||
|
|
||||||
|
our %procinterfaceoptions=( accept_ra => 1,
|
||||||
|
arp_filter => 1,
|
||||||
|
arp_ignore => 1,
|
||||||
|
forward => 1,
|
||||||
|
logmartians => 1,
|
||||||
|
proxyarp => 1,
|
||||||
|
proxyndp => 1,
|
||||||
|
routefilter => 1,
|
||||||
|
sourceroute => 1,
|
||||||
|
);
|
||||||
|
|
||||||
our %prohibitunmanaged = (
|
our %prohibitunmanaged = (
|
||||||
blacklist => 1,
|
blacklist => 1,
|
||||||
bridge => 1,
|
bridge => 1,
|
||||||
@@ -276,19 +288,7 @@ our %maxoptionvalue = ( routefilter => 2, mss => 100000 , wait => 120 , ignore =
|
|||||||
|
|
||||||
our %validhostoptions;
|
our %validhostoptions;
|
||||||
|
|
||||||
our %validzoneoptions = ( mss => NUMERIC,
|
our %validzoneoptions;
|
||||||
nomark => NOTHING,
|
|
||||||
blacklist => NOTHING,
|
|
||||||
dynamic_shared => NOTHING,
|
|
||||||
strict => NOTHING,
|
|
||||||
next => NOTHING,
|
|
||||||
reqid => NUMERIC,
|
|
||||||
spi => NUMERIC,
|
|
||||||
proto => IPSECPROTO,
|
|
||||||
mode => IPSECMODE,
|
|
||||||
"tunnel-src" => NETWORK,
|
|
||||||
"tunnel-dst" => NETWORK,
|
|
||||||
);
|
|
||||||
|
|
||||||
use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 };
|
use constant { UNRESTRICTED => 1, NOFW => 2 , COMPLEX => 8, IN_OUT_ONLY => 16 };
|
||||||
#
|
#
|
||||||
@@ -327,15 +327,29 @@ sub initialize( $$ ) {
|
|||||||
%mapbase = ();
|
%mapbase = ();
|
||||||
%mapbase1 = ();
|
%mapbase1 = ();
|
||||||
$baseseq = 0;
|
$baseseq = 0;
|
||||||
$minroot = 0;
|
$minroot = undef;
|
||||||
$loopback_interface = '';
|
$loopback_interface = '';
|
||||||
|
|
||||||
|
%validzoneoptions = ( mss => NUMERIC,
|
||||||
|
nomark => NOTHING,
|
||||||
|
blacklist => NOTHING,
|
||||||
|
dynamic_shared => NOTHING,
|
||||||
|
strict => NOTHING,
|
||||||
|
next => NOTHING,
|
||||||
|
reqid => NUMERIC,
|
||||||
|
spi => NUMERIC,
|
||||||
|
proto => IPSECPROTO,
|
||||||
|
mode => IPSECMODE,
|
||||||
|
"tunnel-src" => NETWORK,
|
||||||
|
"tunnel-dst" => NETWORK,
|
||||||
|
);
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
|
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
|
||||||
arp_ignore => ENUM_IF_OPTION,
|
arp_ignore => ENUM_IF_OPTION,
|
||||||
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
bridge => SIMPLE_IF_OPTION,
|
bridge => SIMPLE_IF_OPTION,
|
||||||
dbl => ENUM_IF_OPTION,
|
dbl => ENUM_IF_OPTION + IF_OPTION_WILDOK,
|
||||||
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
detectnets => OBSOLETE_IF_OPTION,
|
detectnets => OBSOLETE_IF_OPTION,
|
||||||
dhcp => SIMPLE_IF_OPTION,
|
dhcp => SIMPLE_IF_OPTION,
|
||||||
@@ -359,9 +373,9 @@ sub initialize( $$ ) {
|
|||||||
upnp => SIMPLE_IF_OPTION,
|
upnp => SIMPLE_IF_OPTION,
|
||||||
upnpclient => SIMPLE_IF_OPTION,
|
upnpclient => SIMPLE_IF_OPTION,
|
||||||
mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||||
physical => STRING_IF_OPTION + IF_OPTION_HOST,
|
physical => STRING_IF_OPTION + IF_OPTION_HOST + IF_OPTION_WILDOK,
|
||||||
unmanaged => SIMPLE_IF_OPTION,
|
unmanaged => SIMPLE_IF_OPTION,
|
||||||
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
wait => NUMERIC_IF_OPTION,
|
||||||
);
|
);
|
||||||
%validhostoptions = (
|
%validhostoptions = (
|
||||||
blacklist => 1,
|
blacklist => 1,
|
||||||
@@ -386,7 +400,7 @@ sub initialize( $$ ) {
|
|||||||
%validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION,
|
%validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION,
|
||||||
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
bridge => SIMPLE_IF_OPTION,
|
bridge => SIMPLE_IF_OPTION,
|
||||||
dbl => ENUM_IF_OPTION,
|
dbl => ENUM_IF_OPTION + IF_OPTION_WILDOK,
|
||||||
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
dhcp => SIMPLE_IF_OPTION,
|
dhcp => SIMPLE_IF_OPTION,
|
||||||
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||||
@@ -398,18 +412,18 @@ sub initialize( $$ ) {
|
|||||||
optional => SIMPLE_IF_OPTION,
|
optional => SIMPLE_IF_OPTION,
|
||||||
proxyndp => BINARY_IF_OPTION,
|
proxyndp => BINARY_IF_OPTION,
|
||||||
required => SIMPLE_IF_OPTION,
|
required => SIMPLE_IF_OPTION,
|
||||||
routeback => BINARY_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER,
|
routeback => BINARY_IF_OPTION + IF_OPTION_ZONEONLY + IF_OPTION_HOST + IF_OPTION_VSERVER + IF_OPTION_WILDOK,
|
||||||
rpfilter => SIMPLE_IF_OPTION,
|
rpfilter => SIMPLE_IF_OPTION,
|
||||||
sfilter => IPLIST_IF_OPTION,
|
sfilter => IPLIST_IF_OPTION,
|
||||||
sourceroute => BINARY_IF_OPTION,
|
sourceroute => BINARY_IF_OPTION,
|
||||||
tcpflags => BINARY_IF_OPTION + IF_OPTION_HOST,
|
tcpflags => BINARY_IF_OPTION + IF_OPTION_HOST,
|
||||||
mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||||
forward => BINARY_IF_OPTION,
|
forward => BINARY_IF_OPTION,
|
||||||
physical => STRING_IF_OPTION + IF_OPTION_HOST,
|
physical => STRING_IF_OPTION + IF_OPTION_HOST + IF_OPTION_WILDOK,
|
||||||
unmanaged => SIMPLE_IF_OPTION,
|
unmanaged => SIMPLE_IF_OPTION,
|
||||||
upnp => SIMPLE_IF_OPTION,
|
upnp => SIMPLE_IF_OPTION,
|
||||||
upnpclient => SIMPLE_IF_OPTION,
|
upnpclient => SIMPLE_IF_OPTION,
|
||||||
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
wait => NUMERIC_IF_OPTION,
|
||||||
);
|
);
|
||||||
%validhostoptions = (
|
%validhostoptions = (
|
||||||
blacklist => 1,
|
blacklist => 1,
|
||||||
@@ -697,6 +711,40 @@ sub haveipseczones() {
|
|||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Returns 1 if the two interfaces passed are related
|
||||||
|
#
|
||||||
|
sub interface_match( $$ ) {
|
||||||
|
my ( $piface, $ciface ) = @_;
|
||||||
|
|
||||||
|
return 1 if $piface eq $ciface;
|
||||||
|
|
||||||
|
my ( $pifaceref, $cifaceref ) = @interfaces{$piface, $ciface};
|
||||||
|
|
||||||
|
return 1 if $piface eq $cifaceref->{bridge};
|
||||||
|
return 1 if $ciface eq $pifaceref->{bridge};
|
||||||
|
|
||||||
|
if ( defined $minroot ) {
|
||||||
|
if ( $piface =~ /\+$/ ) {
|
||||||
|
my $root = $pifaceref->{root};
|
||||||
|
my $rlength = length( $root );
|
||||||
|
while ( length( $ciface ) >= $rlength ) {
|
||||||
|
return 1 if $ciface eq $root;
|
||||||
|
chop $ciface;
|
||||||
|
}
|
||||||
|
} elsif ( $ciface =~ /\+$/ ) {
|
||||||
|
my $root = $cifaceref->{root};
|
||||||
|
my $rlength = length( $root );
|
||||||
|
while ( length( $piface ) >= $rlength ) {
|
||||||
|
return 1 if $piface eq $root;
|
||||||
|
chop $piface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
0;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Report about zones.
|
# Report about zones.
|
||||||
#
|
#
|
||||||
@@ -734,7 +782,7 @@ sub zone_report()
|
|||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
progress_message_nocompress " $iref->{physical}:$grouplist";
|
progress_message_nocompress " $iref->{physical}:$grouplist";
|
||||||
} else {
|
} else {
|
||||||
progress_message_nocompress " $iref->{physical}:<$grouplist>";
|
progress_message_nocompress " $iref->{physical}:[$grouplist]";
|
||||||
}
|
}
|
||||||
$printed = 1;
|
$printed = 1;
|
||||||
}
|
}
|
||||||
@@ -743,6 +791,17 @@ sub zone_report()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PARENT:
|
||||||
|
for my $p ( @{$zoneref->{parents}} ) {
|
||||||
|
for my $pi ( keys ( %{$zones{$p}{interfaces}} ) ) {
|
||||||
|
for my $ci ( keys( %{$zoneref->{interfaces}} ) ) {
|
||||||
|
next PARENT if interface_match( $pi, $ci );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
warning_message "Zone $zone is defined as a sub-zone of $p, yet the two zones have no interface in common";
|
||||||
|
}
|
||||||
|
|
||||||
unless ( $printed ) {
|
unless ( $printed ) {
|
||||||
fatal_error "No bridge has been associated with zone $zone" if $type & BPORT && ! $zoneref->{bridge};
|
fatal_error "No bridge has been associated with zone $zone" if $type & BPORT && ! $zoneref->{bridge};
|
||||||
warning_message "*** $zone is an EMPTY ZONE ***" unless $type == FIREWALL;
|
warning_message "*** $zone is an EMPTY ZONE ***" unless $type == FIREWALL;
|
||||||
@@ -1155,15 +1214,16 @@ sub process_interface( $$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $wildcard = 0;
|
my $wildcard = 0;
|
||||||
|
my $physwild = 0;
|
||||||
my $root;
|
my $root;
|
||||||
|
|
||||||
if ( $interface =~ /\+$/ ) {
|
if ( $interface =~ /\+$/ ) {
|
||||||
$wildcard = 1;
|
$wildcard = $physwild = 1; # Default physical name is the logical name
|
||||||
$root = substr( $interface, 0, -1 );
|
$root = substr( $interface, 0, -1 );
|
||||||
$roots{$root} = $interface;
|
$roots{$root} = $interface;
|
||||||
my $len = length $root;
|
my $len = length $root;
|
||||||
|
|
||||||
if ( $minroot ) {
|
if ( defined $minroot ) {
|
||||||
$minroot = $len if $minroot > $len;
|
$minroot = $len if $minroot > $len;
|
||||||
} else {
|
} else {
|
||||||
$minroot = $len;
|
$minroot = $len;
|
||||||
@@ -1209,8 +1269,6 @@ sub process_interface( $$ ) {
|
|||||||
my %hostoptions = ( dynamic => 0 );
|
my %hostoptions = ( dynamic => 0 );
|
||||||
|
|
||||||
for my $option (split_list1 $options, 'option' ) {
|
for my $option (split_list1 $options, 'option' ) {
|
||||||
next if $option eq '-';
|
|
||||||
|
|
||||||
( $option, my $value ) = split /=/, $option;
|
( $option, my $value ) = split /=/, $option;
|
||||||
|
|
||||||
fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option};
|
fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option};
|
||||||
@@ -1247,7 +1305,6 @@ sub process_interface( $$ ) {
|
|||||||
} elsif ( $type == BINARY_IF_OPTION ) {
|
} elsif ( $type == BINARY_IF_OPTION ) {
|
||||||
$value = 1 unless defined $value;
|
$value = 1 unless defined $value;
|
||||||
fatal_error "Option value for '$option' must be 0 or 1" unless ( $value eq '0' || $value eq '1' );
|
fatal_error "Option value for '$option' must be 0 or 1" unless ( $value eq '0' || $value eq '1' );
|
||||||
fatal_error "The '$option' option may not be used with a wild-card interface name" if $wildcard && ! $type && IF_OPTION_WILDOK;
|
|
||||||
$options{$option} = $value;
|
$options{$option} = $value;
|
||||||
$hostoptions{$option} = $value if $hostopt;
|
$hostoptions{$option} = $value if $hostopt;
|
||||||
} elsif ( $type == ENUM_IF_OPTION ) {
|
} elsif ( $type == ENUM_IF_OPTION ) {
|
||||||
@@ -1271,7 +1328,6 @@ sub process_interface( $$ ) {
|
|||||||
assert( 0 );
|
assert( 0 );
|
||||||
}
|
}
|
||||||
} elsif ( $type == NUMERIC_IF_OPTION ) {
|
} elsif ( $type == NUMERIC_IF_OPTION ) {
|
||||||
fatal_error "The '$option' option may not be specified on a wildcard interface" if $wildcard && ! $type && IF_OPTION_WILDOK;
|
|
||||||
$value = $defaultinterfaceoptions{$option} unless defined $value;
|
$value = $defaultinterfaceoptions{$option} unless defined $value;
|
||||||
fatal_error "The '$option' option requires a value" unless defined $value;
|
fatal_error "The '$option' option requires a value" unless defined $value;
|
||||||
my $numval = numeric_value $value;
|
my $numval = numeric_value $value;
|
||||||
@@ -1315,7 +1371,7 @@ sub process_interface( $$ ) {
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
} elsif ( $type == STRING_IF_OPTION ) {
|
} elsif ( $type == STRING_IF_OPTION ) {
|
||||||
fatal_error "The '$option' option requires a value" unless defined $value;
|
fatal_error "The '$option' option requires a value" unless supplied $value;
|
||||||
|
|
||||||
if ( $option eq 'physical' ) {
|
if ( $option eq 'physical' ) {
|
||||||
fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/;
|
fatal_error "Invalid interface name ($interface)" if $interface =~ /[()\[\]\*\?%]/;
|
||||||
@@ -1323,7 +1379,9 @@ sub process_interface( $$ ) {
|
|||||||
|
|
||||||
fatal_error "Duplicate physical interface name ($value)" if ( $interfaces{$value} && ! $port );
|
fatal_error "Duplicate physical interface name ($value)" if ( $interfaces{$value} && ! $port );
|
||||||
|
|
||||||
fatal_error "The type of 'physical' name ($value) doesn't match the type of interface name ($interface)" if $wildcard && ! $value =~ /\+$/;
|
$physwild = ( $value =~ /\+$/ );
|
||||||
|
fatal_error "The type of 'physical' name ($value) doesn't match the type of interface name ($interface)" if $wildcard && ! $physwild;
|
||||||
|
|
||||||
$physical = $value;
|
$physical = $value;
|
||||||
} else {
|
} else {
|
||||||
assert(0);
|
assert(0);
|
||||||
@@ -1351,6 +1409,14 @@ sub process_interface( $$ ) {
|
|||||||
$options{ignore} = 0;
|
$options{ignore} = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for my $option ( keys %options ) {
|
||||||
|
if ( $root ) {
|
||||||
|
warning_message( "The '$option' option is ignored when used with a wildcard physical name" ) if $physwild && $procinterfaceoptions{$option};
|
||||||
|
} else {
|
||||||
|
warning_message( "The '$option' option is ignored when used with interface name '+'" ) unless $validinterfaceoptions{$option} & IF_OPTION_WILDOK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $netsref eq 'dynamic' ) {
|
if ( $netsref eq 'dynamic' ) {
|
||||||
my $ipset = $family == F_IPV4 ? "${zone}" : "6_${zone}";
|
my $ipset = $family == F_IPV4 ? "${zone}" : "6_${zone}";
|
||||||
$ipset = join( '_', $ipset, var_base1( $physical ) ) unless $zoneref->{options}{in_out}{dynamic_shared};
|
$ipset = join( '_', $ipset, var_base1( $physical ) ) unless $zoneref->{options}{in_out}{dynamic_shared};
|
||||||
@@ -1409,6 +1475,7 @@ sub process_interface( $$ ) {
|
|||||||
zones => {},
|
zones => {},
|
||||||
origin => shortlineinfo( '' ),
|
origin => shortlineinfo( '' ),
|
||||||
wildcard => $wildcard,
|
wildcard => $wildcard,
|
||||||
|
physwild => $physwild, # Currently unused
|
||||||
};
|
};
|
||||||
|
|
||||||
$interfaces{$physical} = $interfaceref if $physical ne $interface;
|
$interfaces{$physical} = $interfaceref if $physical ne $interface;
|
||||||
@@ -1567,13 +1634,11 @@ sub known_interface($)
|
|||||||
|
|
||||||
my $iface = $interface;
|
my $iface = $interface;
|
||||||
|
|
||||||
if ( $minroot ) {
|
if ( defined $minroot ) {
|
||||||
#
|
#
|
||||||
# We have wildcard interfaces -- see if this interface matches one of their roots
|
# We have wildcard interfaces -- see if this interface matches one of their roots
|
||||||
#
|
#
|
||||||
while ( length $iface > $minroot ) {
|
while ( length $iface >= $minroot ) {
|
||||||
chop $iface;
|
|
||||||
|
|
||||||
if ( my $i = $roots{$iface} ) {
|
if ( my $i = $roots{$iface} ) {
|
||||||
#
|
#
|
||||||
# Found one
|
# Found one
|
||||||
@@ -1595,6 +1660,8 @@ sub known_interface($)
|
|||||||
};
|
};
|
||||||
return $interfaceref;
|
return $interfaceref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chop $iface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1808,7 +1875,8 @@ sub find_interfaces_by_option( $;$ ) {
|
|||||||
for my $interface ( @interfaces ) {
|
for my $interface ( @interfaces ) {
|
||||||
my $interfaceref = $interfaces{$interface};
|
my $interfaceref = $interfaces{$interface};
|
||||||
|
|
||||||
next unless $interfaceref->{root};
|
next unless $interfaceref->{root}; # Don't return '+' interface
|
||||||
|
next if $procinterfaceoptions{$option} && $interfaceref->{physwild}; # Ignore /proc options on wildcard interface
|
||||||
|
|
||||||
my $optionsref = $interfaceref->{options};
|
my $optionsref = $interfaceref->{options};
|
||||||
if ( $nonzero ) {
|
if ( $nonzero ) {
|
||||||
@@ -1823,35 +1891,6 @@ sub find_interfaces_by_option( $;$ ) {
|
|||||||
\@ints;
|
\@ints;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Returns reference to array of interfaces with the passed option. Unlike the preceding function, this one:
|
|
||||||
#
|
|
||||||
# - All entries in %interfaces are searched.
|
|
||||||
# - Returns a two-element list; the second element indicates whether any members of the list have wildcard physical names
|
|
||||||
#
|
|
||||||
sub find_interfaces_by_option1( $ ) {
|
|
||||||
my $option = $_[0];
|
|
||||||
my @ints = ();
|
|
||||||
my $wild = 0;
|
|
||||||
|
|
||||||
for my $interface ( @interfaces ) {
|
|
||||||
my $interfaceref = $interfaces{$interface};
|
|
||||||
|
|
||||||
next unless defined $interfaceref->{physical};
|
|
||||||
|
|
||||||
my $optionsref = $interfaceref->{options};
|
|
||||||
|
|
||||||
if ( $optionsref && defined $optionsref->{$option} ) {
|
|
||||||
$wild ||= $interfaceref->{wildcard};
|
|
||||||
push @ints , $interface
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return unless defined wantarray;
|
|
||||||
|
|
||||||
wantarray ? ( \@ints, $wild ) : \@ints;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the value of an option for an interface
|
# Return the value of an option for an interface
|
||||||
#
|
#
|
||||||
@@ -1982,6 +2021,7 @@ sub verify_required_interfaces( $ ) {
|
|||||||
|
|
||||||
emit( "esac\n" );
|
emit( "esac\n" );
|
||||||
|
|
||||||
|
$returnvalue = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$interfaces = find_interfaces_by_option( 'required' );
|
$interfaces = find_interfaces_by_option( 'required' );
|
||||||
@@ -1991,7 +2031,7 @@ sub verify_required_interfaces( $ ) {
|
|||||||
if ( $generate_case ) {
|
if ( $generate_case ) {
|
||||||
emit( 'case "$COMMAND" in' );
|
emit( 'case "$COMMAND" in' );
|
||||||
push_indent;
|
push_indent;
|
||||||
emit( 'start|reload|restore|refresh)' );
|
emit( 'start|reload|restore)' );
|
||||||
push_indent;
|
push_indent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2027,7 +2067,7 @@ sub verify_required_interfaces( $ ) {
|
|||||||
emit( ';;' );
|
emit( ';;' );
|
||||||
pop_indent;
|
pop_indent;
|
||||||
pop_indent;
|
pop_indent;
|
||||||
emit( 'esac' );
|
emit( "esac\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
$returnvalue = 1;
|
$returnvalue = 1;
|
||||||
|
@@ -32,7 +32,6 @@
|
|||||||
# --directory=<directory> # Directory where configuration resides (default is /etc/shorewall)
|
# --directory=<directory> # Directory where configuration resides (default is /etc/shorewall)
|
||||||
# --timestamp # Timestamp all progress messages
|
# --timestamp # Timestamp all progress messages
|
||||||
# --debug # Print stack trace on warnings and fatal error.
|
# --debug # Print stack trace on warnings and fatal error.
|
||||||
# --refresh=<chainlist> # Make the 'refresh' command refresh a comma-separated list of chains rather than 'blacklst'.
|
|
||||||
# --log=<filename> # Log file
|
# --log=<filename> # Log file
|
||||||
# --log_verbosity=<number> # Log Verbosity range -1 to 2
|
# --log_verbosity=<number> # Log Verbosity range -1 to 2
|
||||||
# --family=<number> # IP family; 4 = IPv4 (default), 6 = IPv6
|
# --family=<number> # IP family; 4 = IPv4 (default), 6 = IPv6
|
||||||
@@ -40,9 +39,10 @@
|
|||||||
# --shorewallrc=<path> # Path to global shorewallrc file.
|
# --shorewallrc=<path> # Path to global shorewallrc file.
|
||||||
# --shorewallrc1=<path> # Path to export shorewallrc file.
|
# --shorewallrc1=<path> # Path to export shorewallrc file.
|
||||||
# --config_path=<path-list> # Search path for config files
|
# --config_path=<path-list> # Search path for config files
|
||||||
# --inline # Update alternative column specifications
|
|
||||||
# --update # Update configuration to current release
|
# --update # Update configuration to current release
|
||||||
#
|
#
|
||||||
|
# If the <filename> is omitted, then a 'check' operation is performed.
|
||||||
|
#
|
||||||
use strict;
|
use strict;
|
||||||
use FindBin;
|
use FindBin;
|
||||||
use lib "$FindBin::Bin";
|
use lib "$FindBin::Bin";
|
||||||
@@ -62,7 +62,6 @@ usage: compiler.pl [ <option> ... ] [ <filename> ]
|
|||||||
[ --timestamp ]
|
[ --timestamp ]
|
||||||
[ --debug ]
|
[ --debug ]
|
||||||
[ --confess ]
|
[ --confess ]
|
||||||
[ --refresh=<chainlist> ]
|
|
||||||
[ --log=<filename> ]
|
[ --log=<filename> ]
|
||||||
[ --log-verbose={-1|0-2} ]
|
[ --log-verbose={-1|0-2} ]
|
||||||
[ --test ]
|
[ --test ]
|
||||||
@@ -73,7 +72,6 @@ usage: compiler.pl [ <option> ... ] [ <filename> ]
|
|||||||
[ --shorewallrc=<pathname> ]
|
[ --shorewallrc=<pathname> ]
|
||||||
[ --shorewallrc1=<pathname> ]
|
[ --shorewallrc1=<pathname> ]
|
||||||
[ --config_path=<path-list> ]
|
[ --config_path=<path-list> ]
|
||||||
[ --inline ]
|
|
||||||
_EOF_
|
_EOF_
|
||||||
|
|
||||||
exit shift @_;
|
exit shift @_;
|
||||||
@@ -88,7 +86,6 @@ my $verbose = 0;
|
|||||||
my $timestamp = 0;
|
my $timestamp = 0;
|
||||||
my $debug = 0;
|
my $debug = 0;
|
||||||
my $confess = 0;
|
my $confess = 0;
|
||||||
my $chains = ':none:';
|
|
||||||
my $log = '';
|
my $log = '';
|
||||||
my $log_verbose = 0;
|
my $log_verbose = 0;
|
||||||
my $help = 0;
|
my $help = 0;
|
||||||
@@ -100,7 +97,6 @@ my $update = 0;
|
|||||||
my $config_path = '';
|
my $config_path = '';
|
||||||
my $shorewallrc = '';
|
my $shorewallrc = '';
|
||||||
my $shorewallrc1 = '';
|
my $shorewallrc1 = '';
|
||||||
my $inline = 0;
|
|
||||||
|
|
||||||
Getopt::Long::Configure ('bundling');
|
Getopt::Long::Configure ('bundling');
|
||||||
|
|
||||||
@@ -115,8 +111,6 @@ my $result = GetOptions('h' => \$help,
|
|||||||
'timestamp' => \$timestamp,
|
'timestamp' => \$timestamp,
|
||||||
't' => \$timestamp,
|
't' => \$timestamp,
|
||||||
'debug' => \$debug,
|
'debug' => \$debug,
|
||||||
'r=s' => \$chains,
|
|
||||||
'refresh=s' => \$chains,
|
|
||||||
'log=s' => \$log,
|
'log=s' => \$log,
|
||||||
'l=s' => \$log,
|
'l=s' => \$log,
|
||||||
'log_verbosity=i' => \$log_verbose,
|
'log_verbosity=i' => \$log_verbose,
|
||||||
@@ -130,7 +124,6 @@ my $result = GetOptions('h' => \$help,
|
|||||||
'annotate' => \$annotate,
|
'annotate' => \$annotate,
|
||||||
'u' => \$update,
|
'u' => \$update,
|
||||||
'update' => \$update,
|
'update' => \$update,
|
||||||
'inline' => \$inline,
|
|
||||||
'config_path=s' => \$config_path,
|
'config_path=s' => \$config_path,
|
||||||
'shorewallrc=s' => \$shorewallrc,
|
'shorewallrc=s' => \$shorewallrc,
|
||||||
'shorewallrc1=s' => \$shorewallrc1,
|
'shorewallrc1=s' => \$shorewallrc1,
|
||||||
@@ -145,7 +138,6 @@ compiler( script => $ARGV[0] || '',
|
|||||||
timestamp => $timestamp,
|
timestamp => $timestamp,
|
||||||
debug => $debug,
|
debug => $debug,
|
||||||
export => $export,
|
export => $export,
|
||||||
chains => $chains,
|
|
||||||
log => $log,
|
log => $log,
|
||||||
log_verbosity => $log_verbose,
|
log_verbosity => $log_verbose,
|
||||||
test => $test,
|
test => $test,
|
||||||
@@ -157,5 +149,4 @@ compiler( script => $ARGV[0] || '',
|
|||||||
config_path => $config_path,
|
config_path => $config_path,
|
||||||
shorewallrc => $shorewallrc,
|
shorewallrc => $shorewallrc,
|
||||||
shorewallrc1 => $shorewallrc1,
|
shorewallrc1 => $shorewallrc1,
|
||||||
inline => $inline,
|
|
||||||
);
|
);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# (c) 1999-2016 - Tom Eastep (teastep@shorewall.net)
|
# (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
|
||||||
#
|
#
|
||||||
# This program is part of Shorewall.
|
# This program is part of Shorewall.
|
||||||
#
|
#
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
# down Stop an optional interface
|
# down Stop an optional interface
|
||||||
# enable Enable an optional interface
|
# enable Enable an optional interface
|
||||||
# help Show command syntax
|
# help Show command syntax
|
||||||
# reenable Disable then nable an optional
|
# reenable Disable then enable an optional
|
||||||
# interface
|
# interface
|
||||||
# refresh Refresh the firewall
|
# refresh Refresh the firewall
|
||||||
# reload Reload the firewall
|
# reload Reload the firewall
|
||||||
@@ -369,7 +369,7 @@ replace_default_route() # $1 = USE_DEFAULT_RT
|
|||||||
delete_default_routes() # $1 = table number
|
delete_default_routes() # $1 = table number
|
||||||
{
|
{
|
||||||
$IP -$g_family route ls table $1 | grep -F default | grep -vF metric | while read route; do
|
$IP -$g_family route ls table $1 | grep -F default | grep -vF metric | while read route; do
|
||||||
qt $IP -$g_family route del $route
|
qt $IP -$g_family route del $route table $1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +421,7 @@ restore_default_route() # $1 = USE_DEFAULT_RT
|
|||||||
conditionally_flush_conntrack() {
|
conditionally_flush_conntrack() {
|
||||||
|
|
||||||
if [ -n "$g_purge" ]; then
|
if [ -n "$g_purge" ]; then
|
||||||
if [ -n $(mywhich conntrack) ]; then
|
if [ -n "$(mywhich conntrack)" ]; then
|
||||||
conntrack -F
|
conntrack -F
|
||||||
else
|
else
|
||||||
error_message "WARNING: The '-p' option requires the conntrack utility which does not appear to be installed on this system"
|
error_message "WARNING: The '-p' option requires the conntrack utility which does not appear to be installed on this system"
|
||||||
@@ -899,7 +899,7 @@ detect_dynamic_gateway() { # $1 = interface
|
|||||||
#
|
#
|
||||||
# Detect the gateway through an interface
|
# Detect the gateway through an interface
|
||||||
#
|
#
|
||||||
detect_gateway() # $1 = interface
|
detect_gateway() # $1 = interface $2 = table number
|
||||||
{
|
{
|
||||||
local interface
|
local interface
|
||||||
interface=$1
|
interface=$1
|
||||||
@@ -912,6 +912,8 @@ detect_gateway() # $1 = interface
|
|||||||
# Maybe there's a default route through this gateway already
|
# Maybe there's a default route through this gateway already
|
||||||
#
|
#
|
||||||
[ -n "$gateway" ] || gateway=$(find_gateway $($IP -4 route list dev $interface | grep ^default))
|
[ -n "$gateway" ] || gateway=$(find_gateway $($IP -4 route list dev $interface | grep ^default))
|
||||||
|
|
||||||
|
[ -z "$gateway" -a -n "$2" ] && gateway=$(find_gateway $($IP -4 route list dev $interface table $2 | grep ^default))
|
||||||
#
|
#
|
||||||
# Last hope -- is there a load-balancing route through the interface?
|
# Last hope -- is there a load-balancing route through the interface?
|
||||||
#
|
#
|
||||||
@@ -1063,8 +1065,6 @@ clear_firewall() {
|
|||||||
run_iptables -F
|
run_iptables -F
|
||||||
qt $IPTABLES -t raw -F
|
qt $IPTABLES -t raw -F
|
||||||
|
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
|
||||||
|
|
||||||
if [ -n "$DISABLE_IPV6" ]; then
|
if [ -n "$DISABLE_IPV6" ]; then
|
||||||
if [ -x $IP6TABLES ]; then
|
if [ -x $IP6TABLES ]; then
|
||||||
$IP6TABLES -P INPUT ACCEPT 2> /dev/null
|
$IP6TABLES -P INPUT ACCEPT 2> /dev/null
|
||||||
@@ -1373,8 +1373,6 @@ clear_firewall() {
|
|||||||
run_iptables -F
|
run_iptables -F
|
||||||
qt $IP6TABLES -t raw -F
|
qt $IP6TABLES -t raw -F
|
||||||
|
|
||||||
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
|
||||||
|
|
||||||
run_clear_exit
|
run_clear_exit
|
||||||
|
|
||||||
set_state "Cleared"
|
set_state "Cleared"
|
||||||
|
@@ -1,5 +1,23 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Code imported from /usr/share/shorewall/prog.footer
|
# Code imported from /usr/share/shorewall/prog.footer
|
||||||
|
#
|
||||||
|
# (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
|
||||||
|
#
|
||||||
|
# This program is part of Shorewall.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by the
|
||||||
|
# Free Software Foundation, either version 2 of the license or, at your
|
||||||
|
# option, any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Give Usage Information
|
# Give Usage Information
|
||||||
@@ -78,11 +96,13 @@ reload_command() {
|
|||||||
detect_configuration
|
detect_configuration
|
||||||
define_firewall
|
define_firewall
|
||||||
status=$?
|
status=$?
|
||||||
if [ -n "$SUBSYSLOCK" ]; then
|
|
||||||
[ $status -eq 0 ] && touch $SUBSYSLOCK || rm -f $SUBSYSLOCK
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ $status -eq 0 ] && progress_message3 "done."
|
if [ $status -eq 0 ]; then
|
||||||
|
[ -n "$SUBSYSLOCK" ] && touch $SUBSYSLOCK
|
||||||
|
progress_message3 "done."
|
||||||
|
else
|
||||||
|
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -127,8 +147,10 @@ g_counters=
|
|||||||
g_compiled=
|
g_compiled=
|
||||||
g_file=
|
g_file=
|
||||||
g_docker=
|
g_docker=
|
||||||
|
g_dockeringress=
|
||||||
g_dockernetwork=
|
g_dockernetwork=
|
||||||
g_forcereload=
|
g_forcereload=
|
||||||
|
g_fallback=
|
||||||
|
|
||||||
[ -n "$SERVICEDIR" ] && SUBSYSLOCK=
|
[ -n "$SERVICEDIR" ] && SUBSYSLOCK=
|
||||||
|
|
||||||
@@ -264,8 +286,10 @@ case "$COMMAND" in
|
|||||||
error_message "$g_product is not running"
|
error_message "$g_product is not running"
|
||||||
status=2
|
status=2
|
||||||
elif [ $# -eq 1 ]; then
|
elif [ $# -eq 1 ]; then
|
||||||
$g_tool -Z
|
for table in raw mangle nat filter; do
|
||||||
$g_tool -t mangle -Z
|
qt $g_tool -t $table -Z
|
||||||
|
done
|
||||||
|
|
||||||
date > ${VARDIR}/restarted
|
date > ${VARDIR}/restarted
|
||||||
status=0
|
status=0
|
||||||
progress_message3 "$g_product Counters Reset"
|
progress_message3 "$g_product Counters Reset"
|
||||||
@@ -349,6 +373,7 @@ case "$COMMAND" in
|
|||||||
clear)
|
clear)
|
||||||
[ $# -ne 1 ] && usage 2
|
[ $# -ne 1 ] && usage 2
|
||||||
progress_message3 "Clearing $g_product...."
|
progress_message3 "Clearing $g_product...."
|
||||||
|
detect_configuration
|
||||||
clear_firewall
|
clear_firewall
|
||||||
status=0
|
status=0
|
||||||
if [ -n "$SUBSYSLOCK" ]; then
|
if [ -n "$SUBSYSLOCK" ]; then
|
||||||
@@ -418,9 +443,12 @@ case "$COMMAND" in
|
|||||||
[ $# -ne 1 ] && usage 2
|
[ $# -ne 1 ] && usage 2
|
||||||
mutex_on
|
mutex_on
|
||||||
if product_is_started; then
|
if product_is_started; then
|
||||||
|
COMMAND=disable
|
||||||
detect_configuration $1
|
detect_configuration $1
|
||||||
COMMAND=enable disable_provider $1 Yes
|
disable_provider $1 Yes
|
||||||
COMMAND=disable enable_provider $1 Yes
|
COMMAND=enable
|
||||||
|
detect_configuration $1
|
||||||
|
enable_provider $1 Yes
|
||||||
fi
|
fi
|
||||||
mutex_off
|
mutex_off
|
||||||
status=0
|
status=0
|
||||||
|
@@ -45,6 +45,8 @@ LOG_MARTIANS=Yes
|
|||||||
|
|
||||||
LOG_VERBOSITY=2
|
LOG_VERBOSITY=2
|
||||||
|
|
||||||
|
LOG_ZONE=Both
|
||||||
|
|
||||||
LOGALLNEW=
|
LOGALLNEW=
|
||||||
|
|
||||||
LOGFILE=/var/log/messages
|
LOGFILE=/var/log/messages
|
||||||
@@ -77,7 +79,7 @@ UNTRACKED_LOG_LEVEL=
|
|||||||
|
|
||||||
ARPTABLES=
|
ARPTABLES=
|
||||||
|
|
||||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||||
|
|
||||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||||
|
|
||||||
@@ -183,8 +185,6 @@ IGNOREUNKNOWNVARIABLES=No
|
|||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
|
||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=On
|
IP_FORWARDING=On
|
||||||
@@ -199,14 +199,10 @@ MACLIST_TTL=
|
|||||||
|
|
||||||
MANGLE_ENABLED=Yes
|
MANGLE_ENABLED=Yes
|
||||||
|
|
||||||
MAPOLDACTIONS=No
|
|
||||||
|
|
||||||
MINIUPNPD=No
|
MINIUPNPD=No
|
||||||
|
|
||||||
MARK_IN_FORWARD_CHAIN=No
|
MARK_IN_FORWARD_CHAIN=No
|
||||||
|
|
||||||
MODULE_SUFFIX="ko ko.xz"
|
|
||||||
|
|
||||||
MULTICAST=No
|
MULTICAST=No
|
||||||
|
|
||||||
MUTEX_TIMEOUT=60
|
MUTEX_TIMEOUT=60
|
||||||
@@ -217,8 +213,12 @@ OPTIMIZE=All
|
|||||||
|
|
||||||
OPTIMIZE_ACCOUNTING=No
|
OPTIMIZE_ACCOUNTING=No
|
||||||
|
|
||||||
|
PERL_HASH_SEED=0
|
||||||
|
|
||||||
REJECT_ACTION=
|
REJECT_ACTION=
|
||||||
|
|
||||||
|
RENAME_COMBINED=Yes
|
||||||
|
|
||||||
REQUIRE_INTERFACE=Yes
|
REQUIRE_INTERFACE=Yes
|
||||||
|
|
||||||
RESTART=restart
|
RESTART=restart
|
||||||
@@ -247,6 +247,8 @@ TRACK_RULES=No
|
|||||||
|
|
||||||
USE_DEFAULT_RT=Yes
|
USE_DEFAULT_RT=Yes
|
||||||
|
|
||||||
|
USE_NFLOG_SIZE=No
|
||||||
|
|
||||||
USE_PHYSICAL_NAMES=No
|
USE_PHYSICAL_NAMES=No
|
||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Shorewall - Sample Interfaces File for one-interface configuration.
|
# Shorewall - Sample Interfaces File for one-interface configuration.
|
||||||
# Copyright (C) 2006-2015 by the Shorewall Team
|
# Copyright (C) 2006-2017 by the Shorewall Team
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -14,4 +14,4 @@
|
|||||||
?FORMAT 2
|
?FORMAT 2
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ZONE INTERFACE OPTIONS
|
#ZONE INTERFACE OPTIONS
|
||||||
net eth0 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0
|
net NET_IF dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,physical=eth0
|
||||||
|
@@ -56,6 +56,8 @@ LOG_MARTIANS=Yes
|
|||||||
|
|
||||||
LOG_VERBOSITY=2
|
LOG_VERBOSITY=2
|
||||||
|
|
||||||
|
LOG_ZONE=Both
|
||||||
|
|
||||||
LOGALLNEW=
|
LOGALLNEW=
|
||||||
|
|
||||||
LOGFILE=/var/log/messages
|
LOGFILE=/var/log/messages
|
||||||
@@ -88,7 +90,7 @@ UNTRACKED_LOG_LEVEL=
|
|||||||
|
|
||||||
ARPTABLES=
|
ARPTABLES=
|
||||||
|
|
||||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||||
|
|
||||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||||
|
|
||||||
@@ -194,8 +196,6 @@ IGNOREUNKNOWNVARIABLES=No
|
|||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
|
||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=Off
|
IP_FORWARDING=Off
|
||||||
@@ -210,14 +210,10 @@ MACLIST_TTL=
|
|||||||
|
|
||||||
MANGLE_ENABLED=Yes
|
MANGLE_ENABLED=Yes
|
||||||
|
|
||||||
MAPOLDACTIONS=No
|
|
||||||
|
|
||||||
MINIUPNPD=No
|
MINIUPNPD=No
|
||||||
|
|
||||||
MARK_IN_FORWARD_CHAIN=No
|
MARK_IN_FORWARD_CHAIN=No
|
||||||
|
|
||||||
MODULE_SUFFIX="ko ko.xz"
|
|
||||||
|
|
||||||
MULTICAST=No
|
MULTICAST=No
|
||||||
|
|
||||||
MUTEX_TIMEOUT=60
|
MUTEX_TIMEOUT=60
|
||||||
@@ -228,8 +224,12 @@ OPTIMIZE=All
|
|||||||
|
|
||||||
OPTIMIZE_ACCOUNTING=No
|
OPTIMIZE_ACCOUNTING=No
|
||||||
|
|
||||||
|
PERL_HASH_SEED=0
|
||||||
|
|
||||||
REJECT_ACTION=
|
REJECT_ACTION=
|
||||||
|
|
||||||
|
RENAME_COMBINED=Yes
|
||||||
|
|
||||||
REQUIRE_INTERFACE=No
|
REQUIRE_INTERFACE=No
|
||||||
|
|
||||||
RESTART=restart
|
RESTART=restart
|
||||||
@@ -258,6 +258,8 @@ TRACK_RULES=No
|
|||||||
|
|
||||||
USE_DEFAULT_RT=Yes
|
USE_DEFAULT_RT=Yes
|
||||||
|
|
||||||
|
USE_NFLOG_SIZE=No
|
||||||
|
|
||||||
USE_PHYSICAL_NAMES=No
|
USE_PHYSICAL_NAMES=No
|
||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Shorewall - Sample Interfaces File for three-interface configuration.
|
# Shorewall - Sample Interfaces File for three-interface configuration.
|
||||||
# Copyright (C) 2006-2015 by the Shorewall Team
|
# Copyright (C) 2006-2017 by the Shorewall Team
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -14,6 +14,6 @@
|
|||||||
?FORMAT 2
|
?FORMAT 2
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ZONE INTERFACE OPTIONS
|
#ZONE INTERFACE OPTIONS
|
||||||
net eth0 tcpflags,dhcp,nosmurfs,routefilter,logmartians,sourceroute=0
|
net NET_IF tcpflags,dhcp,nosmurfs,routefilter,logmartians,sourceroute=0,physical=eth0
|
||||||
loc eth1 tcpflags,nosmurfs,routefilter,logmartians
|
loc LOC_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth1
|
||||||
dmz eth2 tcpflags,nosmurfs,routefilter,logmartians
|
dmz DMZ_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth2
|
||||||
|
@@ -53,6 +53,8 @@ LOG_MARTIANS=Yes
|
|||||||
|
|
||||||
LOG_VERBOSITY=2
|
LOG_VERBOSITY=2
|
||||||
|
|
||||||
|
LOG_ZONE=Both
|
||||||
|
|
||||||
LOGALLNEW=
|
LOGALLNEW=
|
||||||
|
|
||||||
LOGFILE=/var/log/messages
|
LOGFILE=/var/log/messages
|
||||||
@@ -85,7 +87,7 @@ UNTRACKED_LOG_LEVEL=
|
|||||||
|
|
||||||
ARPTABLES=
|
ARPTABLES=
|
||||||
|
|
||||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||||
|
|
||||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||||
|
|
||||||
@@ -191,8 +193,6 @@ IGNOREUNKNOWNVARIABLES=No
|
|||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
|
||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=On
|
IP_FORWARDING=On
|
||||||
@@ -207,14 +207,10 @@ MACLIST_TTL=
|
|||||||
|
|
||||||
MANGLE_ENABLED=Yes
|
MANGLE_ENABLED=Yes
|
||||||
|
|
||||||
MAPOLDACTIONS=No
|
|
||||||
|
|
||||||
MINIUPNPD=No
|
MINIUPNPD=No
|
||||||
|
|
||||||
MARK_IN_FORWARD_CHAIN=No
|
MARK_IN_FORWARD_CHAIN=No
|
||||||
|
|
||||||
MODULE_SUFFIX="ko ko.xz"
|
|
||||||
|
|
||||||
MULTICAST=No
|
MULTICAST=No
|
||||||
|
|
||||||
MUTEX_TIMEOUT=60
|
MUTEX_TIMEOUT=60
|
||||||
@@ -225,8 +221,12 @@ OPTIMIZE=All
|
|||||||
|
|
||||||
OPTIMIZE_ACCOUNTING=No
|
OPTIMIZE_ACCOUNTING=No
|
||||||
|
|
||||||
|
PERL_HASH_SEED=0
|
||||||
|
|
||||||
REJECT_ACTION=
|
REJECT_ACTION=
|
||||||
|
|
||||||
|
RENAME_COMBINED=Yes
|
||||||
|
|
||||||
REQUIRE_INTERFACE=No
|
REQUIRE_INTERFACE=No
|
||||||
|
|
||||||
RESTART=restart
|
RESTART=restart
|
||||||
@@ -255,6 +255,8 @@ TRACK_RULES=No
|
|||||||
|
|
||||||
USE_DEFAULT_RT=Yes
|
USE_DEFAULT_RT=Yes
|
||||||
|
|
||||||
|
USE_NFLOG_SIZE=No
|
||||||
|
|
||||||
USE_PHYSICAL_NAMES=No
|
USE_PHYSICAL_NAMES=No
|
||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Shorewall - Sample SNAT/Masqueradee File for three-interface configuration.
|
# Shorewall - Sample SNAT/Masqueradee File for three-interface configuration.
|
||||||
# Copyright (C) 2006-2016 by the Shorewall Team
|
# Copyright (C) 2006-2017 by the Shorewall Team
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,4 +20,4 @@
|
|||||||
MASQUERADE 10.0.0.0/8,\
|
MASQUERADE 10.0.0.0/8,\
|
||||||
169.254.0.0/16,\
|
169.254.0.0/16,\
|
||||||
172.16.0.0/12,\
|
172.16.0.0/12,\
|
||||||
192.168.0.0/16 eth0
|
192.168.0.0/16 NET_IF
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Shorewall - Sample Stoppedrules File for three-interface configuration.
|
# Shorewall - Sample Stoppedrules File for three-interface configuration.
|
||||||
# Copyright (C) 2012-2015 by the Shorewall Team
|
# Copyright (C) 2012-2017 by the Shorewall Team
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||||
# PORT(S) PORT(S)
|
# PORT(S) PORT(S)
|
||||||
ACCEPT eth1 -
|
ACCEPT LOC_IF -
|
||||||
ACCEPT - eth1
|
ACCEPT - LOC_IF
|
||||||
ACCEPT eth2 -
|
ACCEPT DMZ_IF -
|
||||||
ACCEPT - eth2
|
ACCEPT - DMZ_IF
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Shorewall - Sample Interfaces File for two-interface configuration.
|
# Shorewall - Sample Interfaces File for two-interface configuration.
|
||||||
# Copyright (C) 2006-2015 by the Shorewall Team
|
# Copyright (C) 2006-2017 by the Shorewall Team
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -14,5 +14,5 @@
|
|||||||
?FORMAT 2
|
?FORMAT 2
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ZONE INTERFACE OPTIONS
|
#ZONE INTERFACE OPTIONS
|
||||||
net eth0 dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0
|
net NET_IF dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0,physical=eth0
|
||||||
loc eth1 tcpflags,nosmurfs,routefilter,logmartians
|
loc LOC_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth1
|
||||||
|
@@ -56,6 +56,8 @@ LOG_MARTIANS=Yes
|
|||||||
|
|
||||||
LOG_VERBOSITY=2
|
LOG_VERBOSITY=2
|
||||||
|
|
||||||
|
LOG_ZONE=Both
|
||||||
|
|
||||||
LOGALLNEW=
|
LOGALLNEW=
|
||||||
|
|
||||||
LOGFILE=/var/log/messages
|
LOGFILE=/var/log/messages
|
||||||
@@ -88,7 +90,7 @@ UNTRACKED_LOG_LEVEL=
|
|||||||
|
|
||||||
ARPTABLES=
|
ARPTABLES=
|
||||||
|
|
||||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||||
|
|
||||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||||
|
|
||||||
@@ -194,8 +196,6 @@ IGNOREUNKNOWNVARIABLES=No
|
|||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=Yes
|
|
||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=On
|
IP_FORWARDING=On
|
||||||
@@ -210,14 +210,10 @@ MACLIST_TTL=
|
|||||||
|
|
||||||
MANGLE_ENABLED=Yes
|
MANGLE_ENABLED=Yes
|
||||||
|
|
||||||
MAPOLDACTIONS=No
|
|
||||||
|
|
||||||
MINIUPNPD=No
|
MINIUPNPD=No
|
||||||
|
|
||||||
MARK_IN_FORWARD_CHAIN=No
|
MARK_IN_FORWARD_CHAIN=No
|
||||||
|
|
||||||
MODULE_SUFFIX="ko ko.xz"
|
|
||||||
|
|
||||||
MULTICAST=No
|
MULTICAST=No
|
||||||
|
|
||||||
MUTEX_TIMEOUT=60
|
MUTEX_TIMEOUT=60
|
||||||
@@ -228,8 +224,12 @@ OPTIMIZE=All
|
|||||||
|
|
||||||
OPTIMIZE_ACCOUNTING=No
|
OPTIMIZE_ACCOUNTING=No
|
||||||
|
|
||||||
|
PERL_HASH_SEED=0
|
||||||
|
|
||||||
REJECT_ACTION=
|
REJECT_ACTION=
|
||||||
|
|
||||||
|
RENAME_COMBINED=Yes
|
||||||
|
|
||||||
REQUIRE_INTERFACE=No
|
REQUIRE_INTERFACE=No
|
||||||
|
|
||||||
RESTART=restart
|
RESTART=restart
|
||||||
@@ -258,6 +258,8 @@ TRACK_RULES=No
|
|||||||
|
|
||||||
USE_DEFAULT_RT=Yes
|
USE_DEFAULT_RT=Yes
|
||||||
|
|
||||||
|
USE_NFLOG_SIZE=No
|
||||||
|
|
||||||
USE_PHYSICAL_NAMES=No
|
USE_PHYSICAL_NAMES=No
|
||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Shorewall - Sample SNAT/Masqueradee File for two-interface configuration.
|
# Shorewall - Sample SNAT/Masqueradee File for two-interface configuration.
|
||||||
# Copyright (C) 2006-2016 by the Shorewall Team
|
# Copyright (C) 2006-2017 by the Shorewall Team
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,4 +20,4 @@
|
|||||||
MASQUERADE 10.0.0.0/8,\
|
MASQUERADE 10.0.0.0/8,\
|
||||||
169.254.0.0/16,\
|
169.254.0.0/16,\
|
||||||
172.16.0.0/12,\
|
172.16.0.0/12,\
|
||||||
192.168.0.0/16 eth0
|
192.168.0.0/16 NET_IF
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Shorewall - Sample Stoppedrules File for two-interface configuration.
|
# Shorewall - Sample Stoppedrules File for two-interface configuration.
|
||||||
# Copyright (C) 2012-2015 by the Shorewall Team
|
# Copyright (C) 2012-2017 by the Shorewall Team
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -13,5 +13,5 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||||
# PORT(S) PORT(S)
|
# PORT(S) PORT(S)
|
||||||
ACCEPT eth1 -
|
ACCEPT LOC_IF -
|
||||||
ACCEPT - eth1
|
ACCEPT - LOC_IF
|
||||||
|
@@ -8,11 +8,8 @@
|
|||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#ACTION
|
#ACTION
|
||||||
A_AllowICMPs inline # Audited version of AllowICMPs
|
|
||||||
A_Drop # Audited Default Action for DROP policy
|
|
||||||
A_REJECT noinline,logjump # Audits then rejects a connection request
|
A_REJECT noinline,logjump # Audits then rejects a connection request
|
||||||
A_REJECT! inline # Audits then rejects a connection request
|
A_REJECT! inline # Audits then rejects a connection request
|
||||||
A_Reject # Audited Default action for REJECT policy
|
|
||||||
AllowICMPs inline # Allow Required ICMP packets
|
AllowICMPs inline # Allow Required ICMP packets
|
||||||
allowBcast inline # Silently Allow Broadcast
|
allowBcast inline # Silently Allow Broadcast
|
||||||
allowinUPnP inline # Allow UPnP inbound (to firewall) traffic
|
allowinUPnP inline # Allow UPnP inbound (to firewall) traffic
|
||||||
@@ -21,33 +18,44 @@ allowMcast inline # Silently Allow Multicast
|
|||||||
AutoBL noinline # Auto-blacklist IPs that exceed thesholds
|
AutoBL noinline # Auto-blacklist IPs that exceed thesholds
|
||||||
AutoBLL noinline # Helper for AutoBL
|
AutoBLL noinline # Helper for AutoBL
|
||||||
BLACKLIST logjump,section # Add sender to the dynamic blacklist
|
BLACKLIST logjump,section # Add sender to the dynamic blacklist
|
||||||
|
?if __ADDRTYPE
|
||||||
|
Broadcast inline,audit # Handles Broadcast/Anycast
|
||||||
|
?else
|
||||||
Broadcast noinline,audit # Handles Broadcast/Anycast
|
Broadcast noinline,audit # Handles Broadcast/Anycast
|
||||||
DNSAmp # Matches one-question recursive DNS queries
|
?endif
|
||||||
Drop # Default Action for DROP policy (deprecated)
|
DNSAmp proto=17 # Matches one-question recursive DNS queries
|
||||||
dropBcast inline # Silently Drop Broadcast
|
dropBcast inline # Silently Drop Broadcast
|
||||||
|
dropBcasts inline # Silently Drop Broadcast
|
||||||
dropInvalid inline # Drops packets in the INVALID conntrack state
|
dropInvalid inline # Drops packets in the INVALID conntrack state
|
||||||
dropMcast inline # Silently Drop Multicast
|
dropMcast inline # Silently Drop Multicast
|
||||||
dropNotSyn noinline # Silently Drop Non-syn TCP packets
|
dropNotSyn noinline,proto=6 # Silently Drop Non-syn TCP packets
|
||||||
DropDNSrep inline # Drops DNS replies
|
DropDNSrep inline,proto=17 # Drops DNS replies
|
||||||
DropSmurfs noinline # Drop smurf packets
|
DropSmurfs noinline # Drop smurf packets
|
||||||
Established inline,\ # Handles packets in the ESTABLISHED state
|
Established inline,\ # Handles packets in the ESTABLISHED state
|
||||||
state=ESTABLISHED #
|
state=ESTABLISHED #
|
||||||
|
FIN inline,audit,\ # Handles ACK,FIN packets
|
||||||
|
proto=6
|
||||||
forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces.
|
forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces.
|
||||||
GlusterFS inline # Handles GlusterFS
|
GlusterFS inline # Handles GlusterFS
|
||||||
IfEvent noinline # Perform an action based on an event
|
IfEvent noinline # Perform an action based on an event
|
||||||
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
|
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
|
||||||
state=INVALID #
|
state=INVALID #
|
||||||
Limit noinline # Limit the rate of connections from each individual IP address
|
Limit noinline # Limit the rate of connections from each individual IP address
|
||||||
|
?if __ADDRTYPE
|
||||||
|
Multicast inline,audit # Handles Multicast
|
||||||
|
?else
|
||||||
Multicast noinline,audit # Handles Multicast
|
Multicast noinline,audit # Handles Multicast
|
||||||
|
?endif
|
||||||
New inline,state=NEW # Handles packets in the NEW conntrack state
|
New inline,state=NEW # Handles packets in the NEW conntrack state
|
||||||
NotSyn inline,audit # Handles TCP packets which do not have SYN=1 and ACK=0
|
NotSyn inline,audit,\ # Handles TCP packets which do not have SYN=1 and ACK=0
|
||||||
rejNotSyn noinline # Silently Reject Non-syn TCP packets
|
proto=6
|
||||||
Reject # Default Action for REJECT policy (deprecated)
|
rejNotSyn noinline,proto=6 # Silently Reject Non-syn TCP packets
|
||||||
Related inline,\ # Handles packets in the RELATED conntrack state
|
Related inline,\ # Handles packets in the RELATED conntrack state
|
||||||
state=RELATED #
|
state=RELATED #
|
||||||
ResetEvent inline # Reset an Event
|
ResetEvent inline # Reset an Event
|
||||||
RST inline,audit # Handle packets with RST set
|
RST inline,audit,\ # Handle packets with RST set
|
||||||
|
proto=6
|
||||||
SetEvent inline # Initialize an event
|
SetEvent inline # Initialize an event
|
||||||
TCPFlags # Handle bad flag combinations.
|
TCPFlags proto=6 # Handle bad flag combinations.
|
||||||
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
|
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
|
||||||
state=UNTRACKED #
|
state=UNTRACKED #
|
||||||
|
12
Shorewall/configfiles/disabled
Normal file
12
Shorewall/configfiles/disabled
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /etc/shorewall/disabled
|
||||||
|
#
|
||||||
|
# Add commands below that you want executed when an optional
|
||||||
|
# interface is successfully disabled using the 'disable' command
|
||||||
|
#
|
||||||
|
# When the commands are invoked:
|
||||||
|
#
|
||||||
|
# $1 contains the physical name of the interface
|
||||||
|
# $2 contains the logical name of the interface
|
||||||
|
# $3 contains the name of the provider associated with the interface,
|
||||||
|
if any
|
12
Shorewall/configfiles/enabled
Normal file
12
Shorewall/configfiles/enabled
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /etc/shorewall/enabled
|
||||||
|
#
|
||||||
|
# Add commands below that you want executed when an optional
|
||||||
|
# interface is successfully enabled using the 'enable' command
|
||||||
|
#
|
||||||
|
# When the commands are invoked:
|
||||||
|
#
|
||||||
|
# $1 contains the physical name of the interface
|
||||||
|
# $2 contains the logical name of the interface
|
||||||
|
# $3 contains the name of the provider associated with the interface,
|
||||||
|
if any
|
@@ -1,10 +0,0 @@
|
|||||||
#
|
|
||||||
# Shorewall -- /etc/shorewall/masq
|
|
||||||
#
|
|
||||||
# For information about entries in this file, type "man shorewall-masq"
|
|
||||||
#
|
|
||||||
# The manpage is also online at
|
|
||||||
# http://www.shorewall.net/manpages/shorewall-masq.html
|
|
||||||
#
|
|
||||||
###################################################################################################################################
|
|
||||||
#INTERFACE SOURCE ADDRESS PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
|
@@ -45,6 +45,8 @@ LOG_MARTIANS=Yes
|
|||||||
|
|
||||||
LOG_VERBOSITY=2
|
LOG_VERBOSITY=2
|
||||||
|
|
||||||
|
LOG_ZONE=Both
|
||||||
|
|
||||||
LOGALLNEW=
|
LOGALLNEW=
|
||||||
|
|
||||||
LOGFILE=/var/log/messages
|
LOGFILE=/var/log/messages
|
||||||
@@ -77,7 +79,7 @@ UNTRACKED_LOG_LEVEL=
|
|||||||
|
|
||||||
ARPTABLES=
|
ARPTABLES=
|
||||||
|
|
||||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||||
|
|
||||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||||
|
|
||||||
@@ -183,8 +185,6 @@ IGNOREUNKNOWNVARIABLES=No
|
|||||||
|
|
||||||
IMPLICIT_CONTINUE=No
|
IMPLICIT_CONTINUE=No
|
||||||
|
|
||||||
INLINE_MATCHES=No
|
|
||||||
|
|
||||||
IPSET_WARNINGS=Yes
|
IPSET_WARNINGS=Yes
|
||||||
|
|
||||||
IP_FORWARDING=Keep
|
IP_FORWARDING=Keep
|
||||||
@@ -199,14 +199,10 @@ MACLIST_TTL=
|
|||||||
|
|
||||||
MANGLE_ENABLED=Yes
|
MANGLE_ENABLED=Yes
|
||||||
|
|
||||||
MAPOLDACTIONS=No
|
|
||||||
|
|
||||||
MARK_IN_FORWARD_CHAIN=No
|
MARK_IN_FORWARD_CHAIN=No
|
||||||
|
|
||||||
MINIUPNPD=No
|
MINIUPNPD=No
|
||||||
|
|
||||||
MODULE_SUFFIX=ko
|
|
||||||
|
|
||||||
MULTICAST=No
|
MULTICAST=No
|
||||||
|
|
||||||
MUTEX_TIMEOUT=60
|
MUTEX_TIMEOUT=60
|
||||||
@@ -217,8 +213,12 @@ OPTIMIZE=All
|
|||||||
|
|
||||||
OPTIMIZE_ACCOUNTING=No
|
OPTIMIZE_ACCOUNTING=No
|
||||||
|
|
||||||
|
PERL_HASH_SEED=0
|
||||||
|
|
||||||
REJECT_ACTION=
|
REJECT_ACTION=
|
||||||
|
|
||||||
|
RENAME_COMBINED=Yes
|
||||||
|
|
||||||
REQUIRE_INTERFACE=No
|
REQUIRE_INTERFACE=No
|
||||||
|
|
||||||
RESTART=restart
|
RESTART=restart
|
||||||
@@ -241,12 +241,14 @@ TC_EXPERT=No
|
|||||||
|
|
||||||
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
|
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
|
||||||
|
|
||||||
TRACK_PROVIDERS=No
|
TRACK_PROVIDERS=Yes
|
||||||
|
|
||||||
TRACK_RULES=No
|
TRACK_RULES=No
|
||||||
|
|
||||||
USE_DEFAULT_RT=Yes
|
USE_DEFAULT_RT=Yes
|
||||||
|
|
||||||
|
USE_NFLOG_SIZE=No
|
||||||
|
|
||||||
USE_PHYSICAL_NAMES=No
|
USE_PHYSICAL_NAMES=No
|
||||||
|
|
||||||
USE_RT_NAMES=No
|
USE_RT_NAMES=No
|
||||||
|
@@ -3,4 +3,4 @@
|
|||||||
#
|
#
|
||||||
# /usr/share/shorewall/configpath
|
# /usr/share/shorewall/configpath
|
||||||
#
|
#
|
||||||
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
|
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.cli-std.
|
# Shorewall 5.2 -- /usr/share/shorewall/lib.cli-std
|
||||||
#
|
#
|
||||||
# (c) 1999-2015 - 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 http://shorewall.net
|
||||||
#
|
#
|
||||||
@@ -47,11 +47,10 @@ get_config() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if [ -n "$g_shorewalldir" ]; then
|
||||||
config=$(find_file ${PRODUCT}.conf)
|
|
||||||
else
|
|
||||||
[ -n "$g_shorewalldir" ] || fatal_error "Ordinary users may not $COMMAND the $CONFDIR/$PRODUCT configuration"
|
|
||||||
config="$g_shorewalldir/$PRODUCT.conf"
|
config="$g_shorewalldir/$PRODUCT.conf"
|
||||||
|
else
|
||||||
|
config=$(find_file ${PRODUCT}.conf)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $config ]; then
|
if [ -f $config ]; then
|
||||||
@@ -211,30 +210,35 @@ get_config() {
|
|||||||
LOG_VERBOSITY=-1
|
LOG_VERBOSITY=-1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$SHOREWALL_SHELL" -a -z "$g_export" ]; then
|
if [ -z "${g_export}${g_test}" ]; then
|
||||||
if [ ! -x "$SHOREWALL_SHELL" ]; then
|
if [ -n "$SHOREWALL_SHELL" ]; then
|
||||||
echo " WARNING: The program specified in SHOREWALL_SHELL does not exist or is not executable; falling back to /bin/sh" >&2
|
if [ ! -x "$SHOREWALL_SHELL" ]; then
|
||||||
SHOREWALL_SHELL=/bin/sh
|
echo " WARNING: The program specified in SHOREWALL_SHELL does not exist or is not executable; falling back to /bin/sh" >&2
|
||||||
|
SHOREWALL_SHELL=/bin/sh
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$IP" ]; then
|
if [ -n "$IP" ]; then
|
||||||
case "$IP" in
|
case "$IP" in
|
||||||
*/*)
|
*/*)
|
||||||
if [ ! -x "$IP" ] ; then
|
if [ ! -x "$IP" ] ; then
|
||||||
fatal_error "The program specified in IP ($IP) does not exist or is not executable"
|
fatal_error "The program specified in IP ($IP) does not exist or is not executable"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
prog="$(mywhich $IP 2> /dev/null)"
|
prog="$(mywhich $IP 2> /dev/null)"
|
||||||
if [ -z "$prog" ] ; then
|
if [ -z "$prog" ] ; then
|
||||||
fatal_error "Can't find $IP executable"
|
fatal_error "Can't find $IP executable"
|
||||||
fi
|
fi
|
||||||
IP=$prog
|
IP=$prog
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
IP='ip'
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
IP='ip'
|
[ -n "$SHOREWALL_SHELL" ] || SHOREWALL_SHELL=/bin/sh
|
||||||
|
[ -n "$IP" ] || IP='ip'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $VERBOSITY in
|
case $VERBOSITY in
|
||||||
@@ -277,10 +281,18 @@ get_config() {
|
|||||||
|
|
||||||
case $AUTOMAKE in
|
case $AUTOMAKE in
|
||||||
Yes|yes)
|
Yes|yes)
|
||||||
|
AUTOMAKE=1
|
||||||
;;
|
;;
|
||||||
No|no)
|
No|no)
|
||||||
AUTOMAKE=
|
AUTOMAKE=
|
||||||
;;
|
;;
|
||||||
|
[1-9])
|
||||||
|
;;
|
||||||
|
[1-9][0-9])
|
||||||
|
;;
|
||||||
|
[Rr]ecursive)
|
||||||
|
AUTOMAKE=recursive
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -n "$AUTOMAKE" ]; then
|
if [ -n "$AUTOMAKE" ]; then
|
||||||
fatal_error "Invalid AUTOMAKE setting ($AUTOMAKE)"
|
fatal_error "Invalid AUTOMAKE setting ($AUTOMAKE)"
|
||||||
@@ -337,8 +349,24 @@ get_config() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$DYNAMIC_BLACKLIST" ]; then
|
if [ -n "$DYNAMIC_BLACKLIST" -a "$(id -u)" = 0 ]; then
|
||||||
setup_dbl
|
case $COMMAND in
|
||||||
|
blacklist|allow|drop|logdrop|reject)
|
||||||
|
setup_dbl
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$PERL_HASH_SEED" ]; then
|
||||||
|
PERL_HASH_SEED=0
|
||||||
|
else
|
||||||
|
case $PERL_HASH_SEED in
|
||||||
|
[0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]|random)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
fatal_error "Invalid setting ($PERL_HASH_SEED) for PERL_HASH_SEED"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lib=$(find_file lib.cli-user)
|
lib=$(find_file lib.cli-user)
|
||||||
@@ -346,6 +374,17 @@ get_config() {
|
|||||||
[ -f $lib ] && . $lib
|
[ -f $lib ] && . $lib
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Ensure that the effective UID is 0 or that we are dealing with a private configuration
|
||||||
|
#
|
||||||
|
ensure_root() {
|
||||||
|
if [ $(id -u) -ne 0 ]; then
|
||||||
|
if [ -z "$g_shorewalldir" -o "$g_shorewalldir" = $CONFDIR/$PRODUCT ]; then
|
||||||
|
startup_error "Ordinary users may not $COMMAND the default $PRODUCT configuration"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Determine if there are config files newer than the passed object
|
# Determine if there are config files newer than the passed object
|
||||||
#
|
#
|
||||||
@@ -353,20 +392,35 @@ uptodate() {
|
|||||||
[ -x $1 ] || return 1
|
[ -x $1 ] || return 1
|
||||||
|
|
||||||
local dir
|
local dir
|
||||||
local ifs
|
local busybox
|
||||||
|
local find
|
||||||
|
|
||||||
ifs="$IFS"
|
find=$(mywhich find)
|
||||||
IFS=':'
|
|
||||||
|
|
||||||
for dir in $g_shorewalldir $CONFIG_PATH; do
|
[ -n "${find}" ] || return 1
|
||||||
if [ -n "$(find ${dir} -newer $1)" ]; then
|
[ -h "${find}" ] && busybox=Yes
|
||||||
IFS="$ifs"
|
|
||||||
|
for dir in $g_shorewalldir $(split $CONFIG_PATH); do
|
||||||
|
if [ -n "${busybox}" ]; then
|
||||||
|
#
|
||||||
|
# Busybox 'find' doesn't support -quit.
|
||||||
|
#
|
||||||
|
if [ $AUTOMAKE = recursive ]; then
|
||||||
|
if [ -n "$(${find} ${dir} -newer $1 -print)" ]; then
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print)" ]; then
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
elif [ $AUTOMAKE = recursive ]; then
|
||||||
|
if [ -n "$(${find} ${dir} -newer $1 -print -quit)" ]; then
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print -quit)" ]; then
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
IFS="$ifs"
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,11 +450,7 @@ compiler() {
|
|||||||
|
|
||||||
pc=${LIBEXECDIR}/shorewall/compiler.pl
|
pc=${LIBEXECDIR}/shorewall/compiler.pl
|
||||||
|
|
||||||
if [ $(id -u) -ne 0 ]; then
|
ensure_root
|
||||||
if [ -z "$g_shorewalldir" -o "$g_shorewalldir" = $CONFDIR/$PRODUCT ]; then
|
|
||||||
startup_error "Ordinary users may not $COMMAND the $CONFDIR/$PRODUCT configuration"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
#
|
#
|
||||||
# We've now set g_shorewalldir so recalculate CONFIG_PATH
|
# We've now set g_shorewalldir so recalculate CONFIG_PATH
|
||||||
#
|
#
|
||||||
@@ -411,7 +461,7 @@ compiler() {
|
|||||||
get_config Yes
|
get_config Yes
|
||||||
|
|
||||||
case $COMMAND in
|
case $COMMAND in
|
||||||
*start|try|refresh|reload|restart|safe-*)
|
*start|try|reload|restart|safe-*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
STARTUP_LOG=
|
STARTUP_LOG=
|
||||||
@@ -453,11 +503,9 @@ compiler() {
|
|||||||
[ -n "$g_test" ] && options="$options --test"
|
[ -n "$g_test" ] && options="$options --test"
|
||||||
[ -n "$g_preview" ] && options="$options --preview"
|
[ -n "$g_preview" ] && options="$options --preview"
|
||||||
[ "$g_debugging" = trace ] && options="$options --debug"
|
[ "$g_debugging" = trace ] && options="$options --debug"
|
||||||
[ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
|
|
||||||
[ -n "$g_confess" ] && options="$options --confess"
|
[ -n "$g_confess" ] && options="$options --confess"
|
||||||
[ -n "$g_update" ] && options="$options --update"
|
[ -n "$g_update" ] && options="$options --update"
|
||||||
[ -n "$g_annotate" ] && options="$options --annotate"
|
[ -n "$g_annotate" ] && options="$options --annotate"
|
||||||
[ -n "$g_inline" ] && options="$options --inline"
|
|
||||||
|
|
||||||
if [ -n "$PERL" ]; then
|
if [ -n "$PERL" ]; then
|
||||||
if [ ! -x "$PERL" ]; then
|
if [ ! -x "$PERL" ]; then
|
||||||
@@ -484,8 +532,17 @@ compiler() {
|
|||||||
#
|
#
|
||||||
[ "$g_debugging" != trace -a -z "$g_preview" ] || [ -n "$g_debug" ] && g_pager=
|
[ "$g_debugging" != trace -a -z "$g_preview" ] || [ -n "$g_debug" ] && g_pager=
|
||||||
|
|
||||||
PERL_HASH_SEED=0
|
case $PERL_HASH_SEED in
|
||||||
export PERL_HASH_SEED
|
random)
|
||||||
|
unset PERL_HASH_SEED
|
||||||
|
unset PERL_PERTURB_KEYS
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
export PERL_HASH_SEED
|
||||||
|
PERL_PERTURB_KEYS=0
|
||||||
|
export PERL_PERTURB_KEYS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ ${PERLLIBDIR} = ${LIBEXECDIR}/shorewall ]; then
|
if [ ${PERLLIBDIR} = ${LIBEXECDIR}/shorewall ]; then
|
||||||
eval $PERL $debugflags $pc $options $@ $g_pager
|
eval $PERL $debugflags $pc $options $@ $g_pager
|
||||||
@@ -513,28 +570,6 @@ start_command() {
|
|||||||
local rc
|
local rc
|
||||||
rc=0
|
rc=0
|
||||||
|
|
||||||
do_it() {
|
|
||||||
if [ -n "$AUTOMAKE" ]; then
|
|
||||||
[ -n "$nolock" ] || mutex_on
|
|
||||||
run_it ${VARDIR}/firewall $g_debugging start
|
|
||||||
rc=$?
|
|
||||||
[ -n "$nolock" ] || mutex_off
|
|
||||||
else
|
|
||||||
g_file="${VARDIR}/.start"
|
|
||||||
if compiler $g_debugging $nolock compile "$g_file"; then
|
|
||||||
[ -n "$nolock" ] || mutex_on
|
|
||||||
run_it ${VARDIR}/.start $g_debugging start
|
|
||||||
rc=$?
|
|
||||||
[ -n "$nolock" ] || mutex_off
|
|
||||||
else
|
|
||||||
rc=$?
|
|
||||||
mylogger kern.err "ERROR:$g_product start failed"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $rc
|
|
||||||
}
|
|
||||||
|
|
||||||
if product_is_started; then
|
if product_is_started; then
|
||||||
error_message "Shorewall is already running"
|
error_message "Shorewall is already running"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -575,10 +610,6 @@ start_command() {
|
|||||||
g_confess=Yes
|
g_confess=Yes
|
||||||
option=${option#T}
|
option=${option#T}
|
||||||
;;
|
;;
|
||||||
i*)
|
|
||||||
g_inline=Yes
|
|
||||||
option=${option#i}
|
|
||||||
;;
|
|
||||||
C*)
|
C*)
|
||||||
g_counters=Yes
|
g_counters=Yes
|
||||||
option=${option#C}
|
option=${option#C}
|
||||||
@@ -620,13 +651,31 @@ start_command() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -n "${g_fast}${AUTOMAKE}" ]; then
|
if [ -n "${g_fast}${AUTOMAKE}" ]; then
|
||||||
if ! uptodate ${VARDIR}/firewall; then
|
if ! uptodate $g_firewall; then
|
||||||
g_fast=
|
g_fast=
|
||||||
AUTOMAKE=
|
AUTOMAKE=
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_it
|
if [ -n "$AUTOMAKE" ]; then
|
||||||
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
|
run_it $g_firewall $g_debugging start
|
||||||
|
rc=$?
|
||||||
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
|
else
|
||||||
|
g_file="${VARDIR}/.start"
|
||||||
|
if compiler $g_debugging $g_nolock compile "$g_file"; then
|
||||||
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
|
run_it ${VARDIR}/.start $g_debugging start
|
||||||
|
rc=$?
|
||||||
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
|
else
|
||||||
|
rc=$?
|
||||||
|
mylogger kern.err "ERROR:$g_product start failed"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $rc
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -671,10 +720,6 @@ compile_command() {
|
|||||||
g_confess=Yes
|
g_confess=Yes
|
||||||
option=${option#T}
|
option=${option#T}
|
||||||
;;
|
;;
|
||||||
i*)
|
|
||||||
g_inline=Yes
|
|
||||||
option=${option#i}
|
|
||||||
;;
|
|
||||||
-)
|
-)
|
||||||
finished=1
|
finished=1
|
||||||
option=
|
option=
|
||||||
@@ -695,7 +740,7 @@ compile_command() {
|
|||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
0)
|
0)
|
||||||
[ -n "$g_export" ] && g_file=firewall || g_file=${VARDIR}/firewall
|
[ -n "$g_export" ] && g_file=firewall || g_file=$g_firewall
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
g_file=$1
|
g_file=$1
|
||||||
@@ -753,6 +798,10 @@ check_command() {
|
|||||||
g_profile=Yes
|
g_profile=Yes
|
||||||
option=${option#p}
|
option=${option#p}
|
||||||
;;
|
;;
|
||||||
|
t*)
|
||||||
|
g_test=Yes
|
||||||
|
option=${option#t}
|
||||||
|
;;
|
||||||
d*)
|
d*)
|
||||||
g_debug=Yes;
|
g_debug=Yes;
|
||||||
option=${option#d}
|
option=${option#d}
|
||||||
@@ -765,10 +814,6 @@ check_command() {
|
|||||||
g_confess=Yes
|
g_confess=Yes
|
||||||
option=${option#T}
|
option=${option#T}
|
||||||
;;
|
;;
|
||||||
i*)
|
|
||||||
g_inline=Yes
|
|
||||||
option=${option#i}
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
option_error $option
|
option_error $option
|
||||||
;;
|
;;
|
||||||
@@ -805,7 +850,7 @@ check_command() {
|
|||||||
|
|
||||||
g_doing="Checking"
|
g_doing="Checking"
|
||||||
|
|
||||||
compiler $g_debugging $nolock check
|
compiler $g_debugging $g_nolock check
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -837,6 +882,10 @@ update_command() {
|
|||||||
g_profile=Yes
|
g_profile=Yes
|
||||||
option=${option#p}
|
option=${option#p}
|
||||||
;;
|
;;
|
||||||
|
t*)
|
||||||
|
g_test=Yes
|
||||||
|
option=${option#t}
|
||||||
|
;;
|
||||||
d*)
|
d*)
|
||||||
g_debug=Yes;
|
g_debug=Yes;
|
||||||
option=${option#d}
|
option=${option#d}
|
||||||
@@ -849,16 +898,11 @@ update_command() {
|
|||||||
g_confess=Yes
|
g_confess=Yes
|
||||||
option=${option#T}
|
option=${option#T}
|
||||||
;;
|
;;
|
||||||
i*)
|
|
||||||
g_inline=Yes
|
|
||||||
option=${option#i}
|
|
||||||
;;
|
|
||||||
a*)
|
a*)
|
||||||
g_annotate=Yes
|
g_annotate=Yes
|
||||||
option=${option#a}
|
option=${option#a}
|
||||||
;;
|
;;
|
||||||
A*)
|
A*)
|
||||||
g_inline=Yes
|
|
||||||
option=${option#A}
|
option=${option#A}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -897,7 +941,7 @@ update_command() {
|
|||||||
|
|
||||||
g_doing="Updating"
|
g_doing="Updating"
|
||||||
|
|
||||||
compiler $g_debugging $nolock check
|
compiler $g_debugging $g_nolock check
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -948,7 +992,6 @@ restart_command() {
|
|||||||
option=${option#T}
|
option=${option#T}
|
||||||
;;
|
;;
|
||||||
i*)
|
i*)
|
||||||
g_inline=Yes
|
|
||||||
option=${option#i}
|
option=${option#i}
|
||||||
;;
|
;;
|
||||||
C*)
|
C*)
|
||||||
@@ -994,114 +1037,27 @@ restart_command() {
|
|||||||
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
|
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
|
||||||
|
|
||||||
if [ -z "$g_fast" -a -n "$AUTOMAKE" ]; then
|
if [ -z "$g_fast" -a -n "$AUTOMAKE" ]; then
|
||||||
uptodate ${VARDIR}/firewall && g_fast=Yes
|
uptodate $g_firewall && g_fast=Yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
g_file="${VARDIR}/.${COMMAND}"
|
g_file="${VARDIR}/.${COMMAND}"
|
||||||
|
|
||||||
if [ -z "$g_fast" ]; then
|
if [ -z "$g_fast" ]; then
|
||||||
if compiler $g_debugging $nolock compile "$g_file"; then
|
if compiler $g_debugging $g_nolock compile "$g_file"; then
|
||||||
[ -n "$nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
run_it ${VARDIR}/.${COMMAND} $g_debugging ${COMMAND}
|
run_it ${VARDIR}/.${COMMAND} $g_debugging ${COMMAND}
|
||||||
rc=$?
|
rc=$?
|
||||||
[ -n "$nolock" ] || mutex_off
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
else
|
else
|
||||||
rc=$?
|
rc=$?
|
||||||
mylogger kern.err "ERROR:$g_product ${COMMAND} failed"
|
mylogger kern.err "ERROR:$g_product ${COMMAND} failed"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
[ -x ${VARDIR}/firewall ] || fatal_error "No ${VARDIR}/firewall file found"
|
[ -x $g_firewall ] || fatal_error "No $g_firewall file found"
|
||||||
[ -n "$nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
run_it ${VARDIR}/firewall $g_debugging $COMMAND
|
run_it $g_firewall $g_debugging $COMMAND
|
||||||
rc=$?
|
|
||||||
[ -n "$nolock" ] || mutex_off
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $rc
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Refresh Command Executor
|
|
||||||
#
|
|
||||||
refresh_command() {
|
|
||||||
local finished
|
|
||||||
finished=0
|
|
||||||
|
|
||||||
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
|
||||||
option=$1
|
|
||||||
case $option in
|
|
||||||
-*)
|
|
||||||
option=${option#-}
|
|
||||||
|
|
||||||
while [ -n "$option" ]; do
|
|
||||||
case $option in
|
|
||||||
-)
|
|
||||||
finished=1
|
|
||||||
option=
|
|
||||||
;;
|
|
||||||
d*)
|
|
||||||
g_debug=Yes
|
|
||||||
option=${option#d}
|
|
||||||
;;
|
|
||||||
n*)
|
|
||||||
g_noroutes=Yes
|
|
||||||
option=${option#n}
|
|
||||||
;;
|
|
||||||
T*)
|
|
||||||
g_confess=Yes
|
|
||||||
option=${option#T}
|
|
||||||
;;
|
|
||||||
i*)
|
|
||||||
g_inline=Yes
|
|
||||||
option=${option#i}
|
|
||||||
;;
|
|
||||||
D)
|
|
||||||
if [ $# -gt 1 ]; then
|
|
||||||
g_shorewalldir="$2"
|
|
||||||
option=
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
fatal_error "The -D option requires a directory name"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
option_error $option
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
finished=1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
|
||||||
g_refreshchains=$1
|
|
||||||
shift
|
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
|
||||||
g_refreshchains="$g_refreshchains,$1"
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
else
|
|
||||||
g_refreshchains=:refresh:
|
|
||||||
fi
|
|
||||||
|
|
||||||
product_is_started || fatal_error "$g_product is not running"
|
|
||||||
|
|
||||||
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
|
|
||||||
|
|
||||||
g_file="${VARDIR}/.refresh"
|
|
||||||
|
|
||||||
if compiler $g_debugging $nolock compile "$g_file"; then
|
|
||||||
[ -n "$nolock" ] || mutex_on
|
|
||||||
run_it ${VARDIR}/.refresh $g_debugging refresh
|
|
||||||
rc=$?
|
|
||||||
[ -n "$nolock" ] || mutex_off
|
|
||||||
else
|
|
||||||
rc=$?
|
rc=$?
|
||||||
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $rc
|
return $rc
|
||||||
@@ -1229,7 +1185,7 @@ safe_commands() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
|
|
||||||
if run_it ${VARDIR}/.$command $g_debugging $command; then
|
if run_it ${VARDIR}/.$command $g_debugging $command; then
|
||||||
|
|
||||||
@@ -1244,7 +1200,7 @@ safe_commands() {
|
|||||||
run_it ${VARDIR}/.$command clear
|
run_it ${VARDIR}/.$command clear
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$nolock" ] || mutex_off
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
|
|
||||||
echo "New configuration has been rejected and the old one restored"
|
echo "New configuration has been rejected and the old one restored"
|
||||||
exit 2
|
exit 2
|
||||||
@@ -1252,7 +1208,7 @@ safe_commands() {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$nolock" ] || mutex_off
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1342,7 +1298,7 @@ try_command() {
|
|||||||
|
|
||||||
g_file="${VARDIR}/.$command"
|
g_file="${VARDIR}/.$command"
|
||||||
|
|
||||||
if ! compiler $g_debugging $nolock compile "$g_file"; then
|
if ! compiler $g_debugging $g_nolock compile "$g_file"; then
|
||||||
status=$?
|
status=$?
|
||||||
exit $status
|
exit $status
|
||||||
fi
|
fi
|
||||||
@@ -1362,7 +1318,7 @@ try_command() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
|
|
||||||
if run_it ${VARDIR}/.$command $g_debugging $command && [ -n "$timeout" ]; then
|
if run_it ${VARDIR}/.$command $g_debugging $command && [ -n "$timeout" ]; then
|
||||||
sleep $timeout
|
sleep $timeout
|
||||||
@@ -1374,7 +1330,7 @@ try_command() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$nolock" ] || mutex_off
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -1392,10 +1348,165 @@ rcp_command() {
|
|||||||
eval $RCP_COMMAND
|
eval $RCP_COMMAND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Remote-{getcaps|getrc} command executer
|
||||||
|
#
|
||||||
|
remote_capture() # $* = original arguments less the command.
|
||||||
|
{
|
||||||
|
local verbose
|
||||||
|
verbose=$(make_verbose)
|
||||||
|
local finished
|
||||||
|
finished=0
|
||||||
|
local system
|
||||||
|
local getrc
|
||||||
|
getrc=
|
||||||
|
local getcaps
|
||||||
|
getcaps=
|
||||||
|
local remote_sw_dir_path
|
||||||
|
remote_sw_dir_path=
|
||||||
|
local root
|
||||||
|
root=root
|
||||||
|
local libexec
|
||||||
|
libexec=${LIBEXECDIR}
|
||||||
|
|
||||||
|
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||||
|
option=$1
|
||||||
|
case $option in
|
||||||
|
-*)
|
||||||
|
option=${option#-}
|
||||||
|
|
||||||
|
while [ -n "$option" ]; do
|
||||||
|
case $option in
|
||||||
|
-)
|
||||||
|
finished=1
|
||||||
|
option=
|
||||||
|
;;
|
||||||
|
R*)
|
||||||
|
getrc=Yes
|
||||||
|
option=${option#R}
|
||||||
|
;;
|
||||||
|
c*)
|
||||||
|
getcaps=Yes
|
||||||
|
option=${option#c}
|
||||||
|
;;
|
||||||
|
r)
|
||||||
|
[ $# -gt 1 ] || fatal_error "Missing Root User name"
|
||||||
|
root=$2
|
||||||
|
option=
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
D)
|
||||||
|
[ $# -gt 1 ] || fatal_error "Missing directory name"
|
||||||
|
g_shorewalldir=$2
|
||||||
|
option=
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
[ $# -gt 1 ] || fatal_error "Missing directory name"
|
||||||
|
remote_sw_dir_path=$2
|
||||||
|
option=
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
T*)
|
||||||
|
g_confess=Yes
|
||||||
|
option=${option#T}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
option_error $option
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
finished=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
case $# in
|
||||||
|
0)
|
||||||
|
[ -n "$g_shorewalldir" ] || g_shorewalldir='.'
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
g_shorewalldir="."
|
||||||
|
system=$1
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
g_shorewalldir=$1
|
||||||
|
system=$2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
too_many_arguments $3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[ -f $g_shorewalldir/${PRODUCT}.conf ] || fatal_error "Missing file: $g_shorewalldir/${PRODUCT}.conf."
|
||||||
|
|
||||||
|
g_export=Yes
|
||||||
|
|
||||||
|
ensure_config_path
|
||||||
|
|
||||||
|
get_config No
|
||||||
|
|
||||||
|
g_haveconfig=Yes
|
||||||
|
|
||||||
|
if [ -z "$system" ]; then
|
||||||
|
system=$FIREWALL
|
||||||
|
[ -n "$system" ] || fatal_error "No system name given and the FIREWALL option is not set"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $COMMAND in
|
||||||
|
remote-getrc)
|
||||||
|
getrc=Yes
|
||||||
|
;;
|
||||||
|
remote-getcaps)
|
||||||
|
getcaps=Yes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[ -n "$getcaps" ] && getrc=Yes
|
||||||
|
|
||||||
|
if [ -n "$getrc" -o ! -s $g_shorewalldir/shorewallrc ]; then
|
||||||
|
progress_message2 "Getting RC file on system $system..."
|
||||||
|
|
||||||
|
if [ -n "$remote_sw_dir_path" ]; then
|
||||||
|
if ! rsh_command "/sbin/shorewall-lite show rc $remote_sw_dir_path" > $g_shorewalldir/shorewallrc; then
|
||||||
|
fatal_error "Capturing RC file on system $system failed"
|
||||||
|
fi
|
||||||
|
elif ! rsh_command "/sbin/shorewall-lite show rc" > $g_shorewalldir/shorewallrc; then
|
||||||
|
fatal_error "Capturing RC file on system $system failed"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
remote_sw_dir_path=
|
||||||
|
|
||||||
|
if [ -n "$getcaps" -o ! -s $g_shorewalldir/capabilities ]; then
|
||||||
|
if [ -f $g_shorewalldir/shorewallrc -a -s $g_shorewalldir/shorewallrc ]; then
|
||||||
|
. $g_shorewalldir/shorewallrc
|
||||||
|
libexec="$LIBEXECDIR"
|
||||||
|
|
||||||
|
[ -n "$DONT_LOAD" ] && DONT_LOAD="$(echo $DONT_LOAD | tr ',' ' ')"
|
||||||
|
|
||||||
|
progress_message2 "Getting Capabilities on system $system..."
|
||||||
|
|
||||||
|
if [ $g_family -eq 4 ]; then
|
||||||
|
if ! rsh_command "MODULESDIR=$MODULESDIR IPTABLES=$IPTABLES DONT_LOAD=\"$DONT_LOAD\" $libexec/shorewall-lite/shorecap" > $g_shorewalldir/capabilities; then
|
||||||
|
fatal_error "Capturing capabilities on system $system failed"
|
||||||
|
fi
|
||||||
|
elif ! rsh_command "MODULESDIR=$MODULESDIR IP6TABLES=$IP6TABLES DONT_LOAD=\"$DONT_LOAD\" $libexec/shorewall6-lite/shorecap" > $g_shorewalldir/capabilities; then
|
||||||
|
fatal_error "Capturing capabilities on system $system failed"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
fatal_error "$g_shorewalldir/shorewallrc is not present."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remote-{start|reload|restart} command executor
|
# Remote-{start|reload|restart} command executor
|
||||||
#
|
#
|
||||||
remote_reload_command() # $* = original arguments less the command.
|
remote_commands() # $* = original arguments less the command.
|
||||||
{
|
{
|
||||||
local verbose
|
local verbose
|
||||||
verbose=$(make_verbose)
|
verbose=$(make_verbose)
|
||||||
@@ -1461,10 +1572,6 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
g_confess=Yes
|
g_confess=Yes
|
||||||
option=${option#T}
|
option=${option#T}
|
||||||
;;
|
;;
|
||||||
i*)
|
|
||||||
g_inline=Yes
|
|
||||||
option=${option#i}
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
option_error $option
|
option_error $option
|
||||||
;;
|
;;
|
||||||
@@ -1510,6 +1617,8 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
litedir="${VARDIR}-lite"
|
litedir="${VARDIR}-lite"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
g_export=Yes
|
||||||
|
|
||||||
if [ -f $g_shorewalldir/${PRODUCT}.conf ]; then
|
if [ -f $g_shorewalldir/${PRODUCT}.conf ]; then
|
||||||
if [ -f $g_shorewalldir/params ]; then
|
if [ -f $g_shorewalldir/params ]; then
|
||||||
. $g_shorewalldir/params
|
. $g_shorewalldir/params
|
||||||
@@ -1531,7 +1640,7 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
|
|
||||||
if [ -z "$getcaps" ]; then
|
if [ -z "$getcaps" ]; then
|
||||||
capabilities=$(find_file capabilities)
|
capabilities=$(find_file capabilities)
|
||||||
[ -f $capabilities ] || getcaps=Yes
|
[ ! -f $capabilities -o ! -s $capabilities ] && getcaps=Yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$getcaps" ]; then
|
if [ -n "$getcaps" ]; then
|
||||||
@@ -1539,18 +1648,16 @@ remote_reload_command() # $* = original arguments less the command.
|
|||||||
|
|
||||||
progress_message "Getting Capabilities on system $system..."
|
progress_message "Getting Capabilities on system $system..."
|
||||||
if [ $g_family -eq 4 ]; then
|
if [ $g_family -eq 4 ]; then
|
||||||
if ! rsh_command "MODULESDIR=$MODULESDIR MODULE_SUFFIX=\"$MODULE_SUFFIX\" IPTABLES=$IPTABLES DONT_LOAD=\"$DONT_LOAD\" $libexec/shorewall-lite/shorecap" > $g_shorewalldir/capabilities; then
|
if ! rsh_command "MODULESDIR=$MODULESDIR IPTABLES=$IPTABLES DONT_LOAD=\"$DONT_LOAD\" $libexec/shorewall-lite/shorecap" > $g_shorewalldir/capabilities; then
|
||||||
fatal_error "Capturing capabilities on system $system failed"
|
fatal_error "Capturing capabilities on system $system failed"
|
||||||
fi
|
fi
|
||||||
elif ! rsh_command "MODULESDIR=$MODULESDIR MODULE_SUFFIX=\"$MODULE_SUFFIX\" IP6TABLES=$IP6TABLES DONT_LOAD=\"$DONT_LOAD\" $libexec/shorewall6-lite/shorecap" > $g_shorewalldir/capabilities; then
|
elif ! rsh_command "MODULESDIR=$MODULESDIR IP6TABLES=$IP6TABLES DONT_LOAD=\"$DONT_LOAD\" $libexec/shorewall6-lite/shorecap" > $g_shorewalldir/capabilities; then
|
||||||
fatal_error "Capturing capabilities on system $system failed"
|
fatal_error "Capturing capabilities on system $system failed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
file=$(resolve_file $g_shorewalldir/firewall)
|
file=$(resolve_file $g_shorewalldir/firewall)
|
||||||
|
|
||||||
g_export=Yes
|
|
||||||
|
|
||||||
program=$sbindir/${PRODUCT}-lite
|
program=$sbindir/${PRODUCT}-lite
|
||||||
#
|
#
|
||||||
# Handle nonstandard remote VARDIR
|
# Handle nonstandard remote VARDIR
|
||||||
@@ -1695,11 +1802,11 @@ export_command() # $* = original arguments less the command.
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_command() {
|
run_command() {
|
||||||
if [ -x ${VARDIR}/firewall ] ; then
|
if [ -x $g_firewall ] ; then
|
||||||
uptodate ${VARDIR}/firewall || echo " WARNING: ${VARDIR}/firewall is not up to date" >&2
|
uptodate $g_firewall || echo " WARNING: $g_firewall is not up to date" >&2
|
||||||
run_it ${VARDIR}/firewall $g_debugging $@
|
run_it $g_firewall $g_debugging $@
|
||||||
else
|
else
|
||||||
fatal_error "${VARDIR}/firewall does not exist or is not executable"
|
fatal_error "$g_firewall does not exist or is not executable"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1710,11 +1817,6 @@ compiler_command() {
|
|||||||
shift
|
shift
|
||||||
compile_command $@
|
compile_command $@
|
||||||
;;
|
;;
|
||||||
refresh)
|
|
||||||
get_config Yes Yes
|
|
||||||
shift
|
|
||||||
refresh_command $@
|
|
||||||
;;
|
|
||||||
check|ck)
|
check|ck)
|
||||||
shift
|
shift
|
||||||
check_command $@
|
check_command $@
|
||||||
@@ -1725,22 +1827,28 @@ compiler_command() {
|
|||||||
;;
|
;;
|
||||||
remote-start|remote-reload|remote-restart)
|
remote-start|remote-reload|remote-restart)
|
||||||
shift
|
shift
|
||||||
remote_reload_command $@
|
remote_commands $@
|
||||||
;;
|
;;
|
||||||
export)
|
export)
|
||||||
shift
|
shift
|
||||||
export_command $@
|
export_command $@
|
||||||
;;
|
;;
|
||||||
try)
|
try)
|
||||||
|
only_root
|
||||||
get_config Yes
|
get_config Yes
|
||||||
shift
|
shift
|
||||||
try_command $@
|
try_command $@
|
||||||
;;
|
;;
|
||||||
safe-reload|safe-restart|safe-start)
|
safe-reload|safe-restart|safe-start)
|
||||||
|
only_root
|
||||||
get_config Yes
|
get_config Yes
|
||||||
shift
|
shift
|
||||||
safe_commands $@
|
safe_commands $@
|
||||||
;;
|
;;
|
||||||
|
remote-getrc|remote-getcaps)
|
||||||
|
shift
|
||||||
|
remote_capture $@
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
fatal_error "Invalid command: $COMMAND"
|
fatal_error "Invalid command: $COMMAND"
|
||||||
;;
|
;;
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>/etc/shorewall/accounting</command>
|
<command>/etc/shorewall[6]/accounting</command>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
@@ -783,29 +783,19 @@
|
|||||||
<title>FILES</title>
|
<title>FILES</title>
|
||||||
|
|
||||||
<para>/etc/shorewall/accounting</para>
|
<para>/etc/shorewall/accounting</para>
|
||||||
|
|
||||||
|
<para>/etc/shorewall6/accounting</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>See ALSO</title>
|
<title>See ALSO</title>
|
||||||
|
|
||||||
<para><ulink
|
<para><ulink
|
||||||
url="/Accounting.html">http://www.shorewall.net/Accounting.html
|
url="shorewall-logging.htm">shorewall-logging(5)</ulink></para>
|
||||||
</ulink></para>
|
|
||||||
|
|
||||||
<para><ulink
|
|
||||||
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink></para>
|
|
||||||
|
|
||||||
<para><ulink
|
<para><ulink
|
||||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
||||||
|
|
||||||
<para>shorewall(8), shorewall-actions(5), shorewall-blacklist(5),
|
<para>shorewall(8)</para>
|
||||||
shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5),
|
|
||||||
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
|
|
||||||
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
|
|
||||||
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
|
|
||||||
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
|
|
||||||
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
|
|
||||||
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
|
|
||||||
shorewall-zones(5)</para>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>/etc/shorewall/actions</command>
|
<command>/etc/shorewall[6]/actions</command>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
@@ -148,9 +148,9 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 5.0.7. Specifies that this action is
|
<para>Added in Shorewall 5.0.7. Specifies that this action is
|
||||||
to be used in <ulink
|
to be used in <ulink
|
||||||
url="shorewall-mangle.html">shorewall-mangle(5)</ulink> rather
|
url="/manpages/shorewall-mangle.html">shorewall-mangle(5)</ulink>
|
||||||
than <ulink
|
rather than <ulink
|
||||||
url="shorewall-rules.html">shorewall-rules(5)</ulink>.</para>
|
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -160,11 +160,11 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 5.0.13. Specifies that this action is
|
<para>Added in Shorewall 5.0.13. Specifies that this action is
|
||||||
to be used in <ulink
|
to be used in <ulink
|
||||||
url="shorewall-snat.html">shorewall-snat(5)</ulink> rather
|
url="/manpages/shorewall-snat.html">shorewall-snat(5)</ulink>
|
||||||
than <ulink
|
rather than <ulink
|
||||||
url="shorewall-rules.html">shorewall-rules(5)</ulink>. The
|
url="/manpages/shorewall-rules.html">shorewall-rules(5)</ulink>.
|
||||||
<option>mangle</option> and <option>nat</option> options are
|
The <option>mangle</option> and <option>nat</option> options
|
||||||
mutually exclusive.</para>
|
are mutually exclusive.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -191,6 +191,27 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>proto</option>=<replaceable>protocol</replaceable></term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shorewall 5.1.10. Specifies that the action is
|
||||||
|
only usable with the specified
|
||||||
|
<replaceable>protocol</replaceable> (name or number). When the
|
||||||
|
action is invoked with no protocol specified in the PROTO
|
||||||
|
column, or if the action is used as a Policy Action, the named
|
||||||
|
<replaceable>protocol</replaceable> will be assumed. If a
|
||||||
|
protocol is specified in the PROTO column of an invocation,
|
||||||
|
then it must match the named
|
||||||
|
<replaceable>protocol</replaceable>.</para>
|
||||||
|
|
||||||
|
<para>The <option>proto</option> option has no effect if the
|
||||||
|
<option>inline</option> or <option>builtin</option> option is
|
||||||
|
specified. A warning is issued if <option>proto</option> is
|
||||||
|
specified along with <option>builtin</option>.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>section</option></term>
|
<term><option>section</option></term>
|
||||||
|
|
||||||
@@ -206,7 +227,7 @@
|
|||||||
<para>Given that neither the <filename>snat</filename> nor the
|
<para>Given that neither the <filename>snat</filename> nor the
|
||||||
<filename>mangle</filename> file is sectioned, this parameter
|
<filename>mangle</filename> file is sectioned, this parameter
|
||||||
has no effect when <option>mangle</option> or
|
has no effect when <option>mangle</option> or
|
||||||
<option>nat</option> is specified. </para>
|
<option>nat</option> is specified.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -239,6 +260,8 @@
|
|||||||
<title>FILES</title>
|
<title>FILES</title>
|
||||||
|
|
||||||
<para>/etc/shorewall/actions</para>
|
<para>/etc/shorewall/actions</para>
|
||||||
|
|
||||||
|
<para>/etc/shorewall6/actions</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
@@ -247,14 +270,6 @@
|
|||||||
<para><ulink
|
<para><ulink
|
||||||
url="/Actions.html">http://www.shorewall.net/Actions.html</ulink></para>
|
url="/Actions.html">http://www.shorewall.net/Actions.html</ulink></para>
|
||||||
|
|
||||||
<para>shorewall(8), shorewall-accounting(5), shorewall-blacklist(5),
|
<para>shorewall(8)</para>
|
||||||
shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5),
|
|
||||||
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5),
|
|
||||||
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
|
|
||||||
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
|
|
||||||
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
|
|
||||||
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
|
|
||||||
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
|
|
||||||
shorewall-zones(5)</para>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
|
<para>IPv4 only.</para>
|
||||||
|
|
||||||
<para>This file was added in Shorewall 4.5.12 and is used to describe
|
<para>This file was added in Shorewall 4.5.12 and is used to describe
|
||||||
low-level rules managed by arptables (8). These rules only affect Address
|
low-level rules managed by arptables (8). These rules only affect Address
|
||||||
Resolution Protocol (ARP), Reverse Address Resolution Protocol (RARP) and
|
Resolution Protocol (ARP), Reverse Address Resolution Protocol (RARP) and
|
||||||
@@ -377,4 +379,10 @@ SNAT:10.1.10.11 - eth1:10.1.10.0/24 1</programlis
|
|||||||
|
|
||||||
<para>/etc/shorewall/arprules</para>
|
<para>/etc/shorewall/arprules</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1>
|
||||||
|
<title>See ALSO</title>
|
||||||
|
|
||||||
|
<para>shorewall(8)</para>
|
||||||
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>/etc/shorewall/blrules</command>
|
<command>/etc/shorewall[6]/blrules</command>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
@@ -27,12 +27,9 @@
|
|||||||
|
|
||||||
<para>This file is used to perform blacklisting and whitelisting.</para>
|
<para>This file is used to perform blacklisting and whitelisting.</para>
|
||||||
|
|
||||||
<para>Rules in this file are applied depending on the setting of
|
<para>Rules in this file are applied depending on the setting of BLACKLIST
|
||||||
BLACKLISTNEWONLY in <ulink
|
in <ulink
|
||||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5). If
|
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5).</para>
|
||||||
BLACKLISTNEWONLY=No, then they are applied regardless of the connection
|
|
||||||
tracking state of the packet. If BLACKLISTNEWONLY=Yes, they are applied to
|
|
||||||
connections in the NEW and INVALID states.</para>
|
|
||||||
|
|
||||||
<para>The format of rules in this file is the same as the format of rules
|
<para>The format of rules in this file is the same as the format of rules
|
||||||
in <ulink url="/manpages/shorewall-rules.html">shorewall-rules
|
in <ulink url="/manpages/shorewall-rules.html">shorewall-rules
|
||||||
@@ -118,10 +115,10 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>A_DROP and A_DROP!</term>
|
<term>A_DROP</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Audited versions of DROP. Requires AUDIT_TARGET support
|
<para>Audited version of DROP. Requires AUDIT_TARGET support
|
||||||
in the kernel and ip6tables.</para>
|
in the kernel and ip6tables.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -170,7 +167,7 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>queues matching packets to a back end logging daemon via
|
<para>queues matching packets to a back end logging daemon via
|
||||||
a netlink socket then continues to the next rule. See <ulink
|
a netlink socket then continues to the next rule. See <ulink
|
||||||
url="/shorewall.logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
|
url="shorewall-logging.html">shorewall-logging(5)</ulink>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -261,7 +258,7 @@
|
|||||||
<para>You may also specify <emphasis role="bold">NFLOG</emphasis>
|
<para>You may also specify <emphasis role="bold">NFLOG</emphasis>
|
||||||
(must be in upper case) as a log level.This will log to the NFLOG
|
(must be in upper case) as a log level.This will log to the NFLOG
|
||||||
target for routing to a separate log through use of ulogd (<ulink
|
target for routing to a separate log through use of ulogd (<ulink
|
||||||
url="http://www.netfilter.org/projects/ulogd/index.html">http://www.netfilter.org/projects/ulogd/index.html</ulink>).</para>
|
url="shorewall-logging.html">shorewall-logging.htm</ulink>).</para>
|
||||||
|
|
||||||
<para>Actions specifying logging may be followed by a log tag (a
|
<para>Actions specifying logging may be followed by a log tag (a
|
||||||
string of alphanumeric characters) which is appended to the string
|
string of alphanumeric characters) which is appended to the string
|
||||||
@@ -276,11 +273,11 @@
|
|||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Example</title>
|
<title>Examples</title>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>Example 1:</term>
|
<term>IPv4 Example 1:</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Drop Teredo packets from the net.</para>
|
<para>Drop Teredo packets from the net.</para>
|
||||||
@@ -290,7 +287,28 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>Example 2:</term>
|
<term>IPv4 Example 2:</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Don't subject packets from 2001:DB8::/64 to the remaining
|
||||||
|
rules in the file.</para>
|
||||||
|
|
||||||
|
<programlisting>WHITELIST net:[2001:DB8::/64] all</programlisting>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>IPv6 Example 1:</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Drop Teredo packets from the net.</para>
|
||||||
|
|
||||||
|
<programlisting>DROP net:[2001::/32] all</programlisting>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>IPv6 Example 2:</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Don't subject packets from 2001:DB8::/64 to the remaining
|
<para>Don't subject packets from 2001:DB8::/64 to the remaining
|
||||||
@@ -306,6 +324,8 @@
|
|||||||
<title>FILES</title>
|
<title>FILES</title>
|
||||||
|
|
||||||
<para>/etc/shorewall/blrules</para>
|
<para>/etc/shorewall/blrules</para>
|
||||||
|
|
||||||
|
<para>/etc/shorewall6/blrules</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
@@ -317,12 +337,6 @@
|
|||||||
<para><ulink
|
<para><ulink
|
||||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
||||||
|
|
||||||
<para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
|
<para>shorewall(8)</para>
|
||||||
shorewall-hosts(5), shorewall-interfaces(5), shorewall-maclist(5),
|
|
||||||
shorewall6-netmap(5),shorewall-params(5), shorewall-policy(5),
|
|
||||||
shorewall-providers(5), shorewall-rtrules(5), shorewall-routestopped(5),
|
|
||||||
shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5),
|
|
||||||
shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-mangle(5),
|
|
||||||
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>/etc/shorewall/conntrack</command>
|
<command>/etc/shorewall[6]/conntrack</command>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<emphasis role="bold">conntrack</emphasis>.</para>
|
<emphasis role="bold">conntrack</emphasis>.</para>
|
||||||
|
|
||||||
<para>The file supports three different column layouts: FORMAT 1, FORMAT
|
<para>The file supports three different column layouts: FORMAT 1, FORMAT
|
||||||
2, and FORMAT 3, FORMAT 1 being the default. The three differ as
|
2, and FORMAT 3 with FORMAT 1 being the default. The three differ as
|
||||||
follows:</para>
|
follows:</para>
|
||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
role="bold">CT</emphasis>:<emphasis
|
role="bold">CT</emphasis>:<emphasis
|
||||||
role="bold">helper</emphasis>:<replaceable>name</replaceable>[(<replaceable>arg</replaceable>=<replaceable>val</replaceable>[,...])|<emphasis
|
role="bold">helper</emphasis>:<replaceable>name</replaceable>[(<replaceable>arg</replaceable>=<replaceable>val</replaceable>[,...])|<emphasis
|
||||||
role="bold">CT:ctevents:<replaceable>event</replaceable>[,...]|CT:expevents:new</emphasis><emphasis
|
role="bold">CT:ctevents:<replaceable>event</replaceable>[,...]|CT:expevents:new</emphasis><emphasis
|
||||||
role="bold">|CT:notrack</emphasis>|DROP|LOG|ULOG(<replaceable>ulog-parameters</replaceable>):NFLOG(<replaceable>nflog-parameters</replaceable>)|IPTABLES(<replaceable>target</replaceable>)}[<replaceable>log-level</replaceable>[:<replaceable>log-tag</replaceable>]][:<replaceable>chain-designator</replaceable>]</term>
|
role="bold">|CT:notrack</emphasis>|DROP|LOG|ULOG(<replaceable>ulog-parameters</replaceable>):NFLOG(<replaceable>nflog-parameters</replaceable>)|IP[6]TABLES(<replaceable>target</replaceable>)}[<replaceable>log-level</replaceable>[:<replaceable>log-tag</replaceable>]][:<replaceable>chain-designator</replaceable>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This column is only present when FORMAT >= 2. Values other
|
<para>This column is only present when FORMAT >= 2. Values other
|
||||||
@@ -272,9 +272,32 @@
|
|||||||
will also be logged at that level.</para>
|
will also be logged at that level.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para><option>IP6TABLES</option>(<replaceable>target</replaceable>)</para>
|
||||||
|
|
||||||
|
<para>IPv6 only.</para>
|
||||||
|
|
||||||
|
<para>Added in Shorewall 4.6.0. Allows you to specify any
|
||||||
|
iptables <replaceable>target</replaceable> with target options
|
||||||
|
(e.g., "IP6TABLES(AUDIT --type drop)"). If the target is not one
|
||||||
|
recognized by Shorewall, the following error message will be
|
||||||
|
issued:</para>
|
||||||
|
|
||||||
|
<simplelist>
|
||||||
|
<member>ERROR: Unknown target
|
||||||
|
(<replaceable>target</replaceable>)</member>
|
||||||
|
</simplelist>
|
||||||
|
|
||||||
|
<para>This error message may be eliminated by adding
|
||||||
|
<replaceable>target</replaceable> as a builtin action in <ulink
|
||||||
|
url="/manpages/shorewall-actions.html">shorewall-actions</ulink>(5).</para>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para><option>IPTABLES</option>(<replaceable>target</replaceable>)</para>
|
<para><option>IPTABLES</option>(<replaceable>target</replaceable>)</para>
|
||||||
|
|
||||||
|
<para>IPv4 only.</para>
|
||||||
|
|
||||||
<para>Added in Shorewall 4.6.0. Allows you to specify any
|
<para>Added in Shorewall 4.6.0. Allows you to specify any
|
||||||
iptables <replaceable>target</replaceable> with target options
|
iptables <replaceable>target</replaceable> with target options
|
||||||
(e.g., "IPTABLES(AUDIT --type drop)"). If the target is not one
|
(e.g., "IPTABLES(AUDIT --type drop)"). If the target is not one
|
||||||
@@ -311,9 +334,9 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para><option>ULOG</option></para>
|
<para><option>ULOG</option></para>
|
||||||
|
|
||||||
<para>Added in Shoreawll 4.6.0. Queues the packet to a backend
|
<para>IPv4 only. Added in Shoreawll 4.6.0. Queues the packet to
|
||||||
logging daemon using the ULOG netfilter target with the
|
a backend logging daemon using the ULOG netfilter target with
|
||||||
specified <replaceable>ulog-parameters</replaceable>.</para>
|
the specified <replaceable>ulog-parameters</replaceable>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
@@ -447,7 +470,7 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This form combines the preceding two and requires that
|
<para>This form combines the preceding two and requires that
|
||||||
both the incoming interace and source address match.</para>
|
both the incoming interface and source address match.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -543,7 +566,7 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This form combines the preceding two and requires that
|
<para>This form combines the preceding two and requires that
|
||||||
both the outgoing interace and destination address
|
both the outgoing interface and destination address
|
||||||
match.</para>
|
match.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -579,14 +602,23 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>A protocol name from <filename>/etc/protocols</filename> or a
|
<para>A protocol name from <filename>/etc/protocols</filename> or a
|
||||||
protocol number.</para>
|
protocol number. tcp and 6 may be optionally followed by <emphasis
|
||||||
|
role="bold">:syn </emphasis>to match only the SYN packet (first
|
||||||
|
packet in the three-way handshake).</para>
|
||||||
|
|
||||||
<para>Beginning with Shorewall 4.5.12, this column is labeled
|
<para>Beginning with Shorewall 4.5.12, this column can accept a
|
||||||
<emphasis role="bold">PROTOS</emphasis> and can accept a
|
comma-separated list of protocols and either <emphasis
|
||||||
comma-separated list of protocols. Either <emphasis
|
|
||||||
role="bold">proto</emphasis> or <emphasis
|
role="bold">proto</emphasis> or <emphasis
|
||||||
role="bold">protos</emphasis> is accepted in the alternate input
|
role="bold">protos</emphasis> is accepted in the alternate input
|
||||||
format.</para>
|
format.</para>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 5.1.11, when <emphasis
|
||||||
|
role="bold">tcp</emphasis> or <emphasis role="bold">6</emphasis> is
|
||||||
|
specified and the ACTION is <emphasis role="bold">CT</emphasis>, the
|
||||||
|
compiler will default to <emphasis role="bold">:syn</emphasis>. If
|
||||||
|
you wish the rule to match packets with any valid combination of TCP
|
||||||
|
flags, you may specify <emphasis role="bold">tcp:all</emphasis> or
|
||||||
|
<emphasis role="bold">6:all</emphasis>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -689,31 +721,57 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>EXAMPLE</title>
|
<title>EXAMPLE</title>
|
||||||
|
|
||||||
<para>Example 1:</para>
|
<para>IPv4 Example 1:</para>
|
||||||
|
|
||||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
||||||
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
|
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
|
||||||
|
|
||||||
<para>Example 2 (Shorewall 4.5.10 or later):</para>
|
<para>IPv4 Example 2 (Shorewall 4.5.10 or later):</para>
|
||||||
|
|
||||||
<para>Drop traffic to/from all zones to IP address 1.2.3.4</para>
|
<para>Drop traffic to/from all zones to IP address 1.2.3.4</para>
|
||||||
|
|
||||||
<programlisting>FORMAT 2
|
<programlisting>?FORMAT 2
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
||||||
DROP all-:1.2.3.4 -
|
DROP all-:1.2.3.4 -
|
||||||
DROP all 1.2.3.4</programlisting>
|
DROP all 1.2.3.4</programlisting>
|
||||||
|
|
||||||
<para>or<programlisting>FORMAT 3
|
<para>or<programlisting>?FORMAT 3
|
||||||
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
||||||
DROP:P 1.2.3.4 -
|
DROP:P 1.2.3.4 -
|
||||||
DROP:PO - 1.2.3.4
|
DROP:PO - 1.2.3.4
|
||||||
</programlisting></para>
|
</programlisting></para>
|
||||||
|
|
||||||
|
<para>IPv6 Example 1:</para>
|
||||||
|
|
||||||
|
<para>Use the FTP helper for TCP port 21 connections from the firewall
|
||||||
|
itself.</para>
|
||||||
|
|
||||||
|
<programlisting>FORMAT 2
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
||||||
|
CT:helper:ftp(expevents=new) fw - tcp 21 </programlisting>
|
||||||
|
|
||||||
|
<para>IPv6 Example 2 (Shorewall 4.5.10 or later):</para>
|
||||||
|
|
||||||
|
<para>Drop traffic to/from all zones to IP address 2001:1.2.3::4</para>
|
||||||
|
|
||||||
|
<programlisting>FORMAT 2
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
||||||
|
DROP all-:2001:1.2.3::4 -
|
||||||
|
DROP all 2001:1.2.3::4
|
||||||
|
</programlisting>
|
||||||
|
|
||||||
|
<para>or<programlisting>FORMAT 3
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT USER
|
||||||
|
DROP:P 2001:1.2.3::4 -
|
||||||
|
DROP:PO - 2001:1.2.3::4</programlisting></para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>FILES</title>
|
<title>FILES</title>
|
||||||
|
|
||||||
<para>/etc/shorewall/conntrack</para>
|
<para>/etc/shorewall/conntrack</para>
|
||||||
|
|
||||||
|
<para>/etc/shorewall6/conntrack</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
@@ -722,14 +780,6 @@ DROP:PO - 1.2.3.4
|
|||||||
<para><ulink
|
<para><ulink
|
||||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
||||||
|
|
||||||
<para>shorewall(8), shorewall-accounting(5), shorewall-actions(5),
|
<para>shorewall(8)</para>
|
||||||
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
|
|
||||||
shorewall-ipsets(5), shorewall-masq(5), shorewall-nat(5),
|
|
||||||
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5),
|
|
||||||
shorewall-providers(5), shorewall-proxyarp(5), shorewall-rtrules(5),
|
|
||||||
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5),
|
|
||||||
shorewall-secmarks(5), shorewall-tcclasses(5), shorewall-tcdevices(5),
|
|
||||||
shorewall-mangle(5), shorewall-tos(5), shorewall-tunnels(5),
|
|
||||||
shorewall-zones(5)</para>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user