forked from extern/shorewall_code
Compare commits
194 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5053999442 | ||
|
71f8bad300 | ||
|
377c9f5708 | ||
|
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 | ||
|
975a14b94f | ||
|
cf3c304078 | ||
|
d1a21fb678 | ||
|
b9b7baf98d | ||
|
92e725de97 | ||
|
922bd9eeca | ||
|
d2b3fa476a | ||
|
4e978b687d |
@@ -335,9 +335,8 @@ for f in lib.* ; do
|
||||
done
|
||||
|
||||
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}/${PRODUCT}/lib.core
|
||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/${PRODUCT}/lib.cli
|
||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/lib.base
|
||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/lib.cli
|
||||
fi
|
||||
|
||||
#
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.base
|
||||
# Shorewall 5.1 -- /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
|
||||
#
|
||||
|
@@ -25,7 +25,7 @@
|
||||
# loaded after this one and replaces some of the functions declared here.
|
||||
#
|
||||
|
||||
SHOREWALL_CAPVERSION=50105
|
||||
SHOREWALL_CAPVERSION=50106
|
||||
|
||||
if [ -z "$g_basedir" ]; then
|
||||
#
|
||||
@@ -1137,16 +1137,31 @@ show_a_macro() {
|
||||
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()
|
||||
{
|
||||
awk \
|
||||
'BEGIN { skip=0; }; \
|
||||
/^src/ { skip=0; }; \
|
||||
/^src 0.0.0.0\/0/ { skip=1; }; \
|
||||
/^src ::\/0/ { skip=1; }; \
|
||||
{ if ( skip == 0 ) print; };'
|
||||
spd_filter() {
|
||||
#
|
||||
# af = Address Family (4 or 6)
|
||||
# afok = Address Family of entry matches af
|
||||
# p = print the contents of A (entry is not empty)
|
||||
# i = Number of lines stored in A
|
||||
#
|
||||
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
|
||||
@@ -1159,7 +1174,8 @@ heading() {
|
||||
|
||||
show_ipsec() {
|
||||
heading "PFKEY SPD"
|
||||
$IP -s xfrm policy | spd_filter
|
||||
$IP -s -$g_family xfrm policy | spd_filter
|
||||
|
||||
heading "PFKEY SAD"
|
||||
$IP -s -$g_family xfrm state | egrep -v '[[:space:]]+(auth-trunc|enc )' # Don't divulge the keys
|
||||
}
|
||||
@@ -1797,7 +1813,7 @@ do_dump_command() {
|
||||
|
||||
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
|
||||
heading "Traffic Control"
|
||||
@@ -2770,7 +2786,7 @@ determine_capabilities() {
|
||||
GOTO_TARGET=
|
||||
LOGMARK_TARGET=
|
||||
IPMARK_TARGET=
|
||||
LOG_TARGET=Yes
|
||||
LOG_TARGET=
|
||||
ULOG_TARGET=
|
||||
NFLOG_TARGET=
|
||||
PERSISTENT_SNAT=
|
||||
@@ -2804,6 +2820,7 @@ determine_capabilities() {
|
||||
CPU_FANOUT=
|
||||
NETMAP_TARGET=
|
||||
NFLOG_SIZE=
|
||||
RESTORE_WAIT_OPTION=
|
||||
|
||||
AMANDA_HELPER=
|
||||
FTP_HELPER=
|
||||
@@ -2827,9 +2844,11 @@ determine_capabilities() {
|
||||
qt $arptables -L OUT && ARPTABLESJF=Yes
|
||||
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
|
||||
WAIT_OPTION=Yes
|
||||
tool="$tool --wait"
|
||||
g_tool="$g_tool --wait"
|
||||
fi
|
||||
|
||||
chain=fooX$$
|
||||
@@ -3135,7 +3154,7 @@ determine_capabilities() {
|
||||
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 -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 MARK --set-mark 5 && MARK_ANYWHERE=Yes
|
||||
qt $g_tool -A $chain -m statistic --mode nth --every 2 --packet 1 && STATISTIC_MATCH=Yes
|
||||
@@ -3299,9 +3318,11 @@ report_capabilities_unsorted() {
|
||||
if [ $g_family -eq 4 ]; then
|
||||
report_capability "iptables -S (IPTABLES_S)" $IPTABLES_S
|
||||
report_capability "iptables --wait option (WAIT_OPTION)" $WAIT_OPTION
|
||||
report_capability "iptables-restore --wait option (RESTORE_WAIT_OPTION)" $RESTORE_WAIT_OPTION
|
||||
else
|
||||
report_capability "ip6tables -S (IPTABLES_S)" $IPTABLES_S
|
||||
report_capability "ip6tables --wait option (WAIT_OPTION)" $WAIT_OPTION
|
||||
report_capability "ip6tables-restore --wait option (RESTORE_WAIT_OPTION)" $RESTORE_WAIT_OPTION
|
||||
fi
|
||||
|
||||
report_capability "Basic Filter (BASIC_FILTER)" $BASIC_FILTER
|
||||
@@ -3417,6 +3438,7 @@ report_capabilities_unsorted1() {
|
||||
report_capability1 CPU_FANOUT
|
||||
report_capability1 NETMAP_TARGET
|
||||
report_capability1 NFLOG_SIZE
|
||||
report_capability1 RESTORE_WAIT_OPTION
|
||||
|
||||
report_capability1 AMANDA_HELPER
|
||||
report_capability1 FTP_HELPER
|
||||
@@ -3721,7 +3743,7 @@ ipcalc_command() {
|
||||
|
||||
valid_address $address || fatal_error "Invalid IP address: $address"
|
||||
[ -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"
|
||||
|
||||
address=$address/$vlsm
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.common.
|
||||
# Shorewall 5.1 -- /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
|
||||
#
|
||||
@@ -269,53 +269,48 @@ loadmodule() # $1 = module name, $2 - * arguments
|
||||
{
|
||||
local modulename
|
||||
modulename=$1
|
||||
shift
|
||||
local moduleoptions
|
||||
moduleoptions=$*
|
||||
local modulefile
|
||||
local suffix
|
||||
|
||||
if [ -d /sys/module/ ]; then
|
||||
if ! list_search $modulename $DONT_LOAD; then
|
||||
if [ ! -d /sys/module/$modulename ]; then
|
||||
shift
|
||||
|
||||
for suffix in $MODULE_SUFFIX ; do
|
||||
for directory in $moduledirectories; do
|
||||
modulefile=$directory/${modulename}.${suffix}
|
||||
|
||||
if [ -f $modulefile ]; then
|
||||
case $moduleloader in
|
||||
insmod)
|
||||
insmod $modulefile $*
|
||||
;;
|
||||
*)
|
||||
modprobe $modulename $*
|
||||
;;
|
||||
esac
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
case $moduleloader in
|
||||
insmod)
|
||||
for directory in $moduledirectories; do
|
||||
for modulefile in $directory/${modulename}.*; do
|
||||
if [ -f $modulefile ]; then
|
||||
insmod $modulefile $moduleoptions
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
;;
|
||||
*)
|
||||
modprobe -q $modulename $moduleoptions
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
elif ! list_search $modulename $DONT_LOAD $MODULES; then
|
||||
shift
|
||||
|
||||
for suffix in $MODULE_SUFFIX ; do
|
||||
for directory in $moduledirectories; do
|
||||
modulefile=$directory/${modulename}.${suffix}
|
||||
|
||||
if [ -f $modulefile ]; then
|
||||
case $moduleloader in
|
||||
insmod)
|
||||
insmod $modulefile $*
|
||||
;;
|
||||
*)
|
||||
modprobe $modulename $*
|
||||
;;
|
||||
esac
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
case $moduleloader in
|
||||
insmod)
|
||||
for directory in $moduledirectories; do
|
||||
for modulefile in $directory/${modulename}.*; do
|
||||
if [ -f $modulefile ]; then
|
||||
insmod $modulefile $moduleoptions
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
;;
|
||||
*)
|
||||
modprobe -q $modulename $moduleoptions
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -338,8 +333,6 @@ reload_kernel_modules() {
|
||||
moduleloader=insmod
|
||||
fi
|
||||
|
||||
[ -n "${MODULE_SUFFIX:=ko ko.gz ko.xz o o.gz o.xz gz xz}" ]
|
||||
|
||||
if [ -n "$MODULESDIR" ]; then
|
||||
case "$MODULESDIR" in
|
||||
+*)
|
||||
@@ -394,8 +387,6 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
|
||||
moduleloader=insmod
|
||||
fi
|
||||
|
||||
[ -n "${MODULE_SUFFIX:=o gz xz ko o.gz o.xz ko.gz ko.xz}" ]
|
||||
|
||||
if [ -n "$MODULESDIR" ]; then
|
||||
case "$MODULESDIR" in
|
||||
+*)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.core
|
||||
# Shorewall 5.1 -- /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
|
||||
#
|
||||
@@ -24,7 +24,7 @@
|
||||
# generated scripts.
|
||||
#
|
||||
|
||||
SHOREWALL_LIBVERSION=50100
|
||||
SHOREWALL_LIBVERSION=50108
|
||||
|
||||
#
|
||||
# Fatal Error
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer.
|
||||
# Shorewall 5.1 -- /usr/share/shorewall/lib.installer.
|
||||
#
|
||||
# (c) 2017 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/lib.installer.
|
||||
# Shorewall 5.1 -- /usr/share/shorewall/lib.installer.
|
||||
#
|
||||
# (c) 2017 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
|
||||
|
@@ -3187,14 +3187,15 @@
|
||||
shorewall-arprules(5), shorewall-blrules(5), shorewall.conf(5),
|
||||
shorewall-conntrack(5), shorewall-ecn(5), shorewall-exclusion(5),
|
||||
shorewall-hosts(5), shorewall-init(5), shorewall_interfaces(5),
|
||||
shorewall-ipsets(5), shorewall-maclist(5), shorewall-mangle(5),
|
||||
shorewall-masq(5), shorewall-modules(5), shorewall-nat(5),
|
||||
shorewall-nesting(5), shorewall-netmap(5), shorewall-params(5),
|
||||
shorewall-policy(5), shorewall-providers(5), 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>
|
||||
shorewall-ipsets(5), shorewall-logging(), shorewall-maclist(5),
|
||||
shorewall-mangle(5), shorewall-masq(5), shorewall-modules(5),
|
||||
shorewall-nat(5), shorewall-nesting(5), shorewall-netmap(5),
|
||||
shorewall-params(5), shorewall-policy(5), shorewall-providers(5),
|
||||
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>
|
||||
</refentry>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/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)
|
||||
#
|
||||
# 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'
|
||||
#
|
||||
################################################################################################
|
||||
#
|
||||
# Default product is Shorewall. PRODUCT will be set based on $0 and on passed -[46] and -l
|
||||
# options
|
||||
#
|
||||
PRODUCT=shorewall
|
||||
|
||||
#
|
||||
|
@@ -73,12 +73,16 @@ setstatedir() {
|
||||
|
||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
|
||||
|
||||
if [ $PRODUCT = shorewall ]; then
|
||||
${SBINDIR}/shorewall compile
|
||||
elif [ $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/shorewall -6 compile
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
return 0
|
||||
else
|
||||
return 0
|
||||
if [ $PRODUCT = shorewall ]; then
|
||||
${SBINDIR}/shorewall compile
|
||||
elif [ $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/shorewall -6 compile
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -108,16 +112,14 @@ shorewall_start () {
|
||||
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
)
|
||||
fi
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
)
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -145,9 +147,7 @@ shorewall_stop () {
|
||||
printf "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -159,8 +159,9 @@ shorewall_stop () {
|
||||
|
||||
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"
|
||||
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"
|
||||
echo_notdone
|
||||
fi
|
||||
|
||||
|
@@ -44,12 +44,14 @@ setstatedir() {
|
||||
|
||||
[ -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
|
||||
elif [ $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/shorewall -6 compile
|
||||
else
|
||||
return 0
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -66,20 +68,20 @@ start () {
|
||||
|
||||
printf "Initializing \"Shorewall-based firewalls\": "
|
||||
|
||||
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||
ipset -R < "$SAVE_IPSETS"
|
||||
fi
|
||||
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
setstatedir
|
||||
retval=$?
|
||||
|
||||
if [ $retval -eq 0 ]; then
|
||||
if [ -x "${STATEDIR}/firewall" ]; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
[ $retval -ne 0 ] && break
|
||||
else
|
||||
retval=6 #Product not configured
|
||||
break
|
||||
fi
|
||||
${STATEDIR}/firewall ${OPTIONS} stop 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
[ $retval -ne 0 ] && break
|
||||
else
|
||||
retval=6 #Product not configured
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -106,20 +108,25 @@ stop () {
|
||||
retval=$?
|
||||
|
||||
if [ $retval -eq 0 ]; then
|
||||
if [ -x "${STATEDIR}/firewall" ]; then
|
||||
${STATEDIR}/firewall ${OPTIONS} clear 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
[ $retval -ne 0 ] && break
|
||||
else
|
||||
retval=6 #Product not configured
|
||||
break
|
||||
fi
|
||||
${STATEDIR}/firewall ${OPTIONS} clear 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
[ $retval -ne 0 ] && break
|
||||
else
|
||||
retval=6 #Product not configured
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
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
|
||||
success
|
||||
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}
|
||||
|
||||
if [ $PRODUCT = shorewall ]; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
return 0
|
||||
elif [ $PRODUCT = shorewall ]; then
|
||||
${SBINDIR}/shorewall compile
|
||||
elif [ $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/shorewall -6 compile
|
||||
else
|
||||
return 0
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -92,10 +94,8 @@ start () {
|
||||
printf "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -103,6 +103,8 @@ start () {
|
||||
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||
ipset -R < "$SAVE_IPSETS"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
boot () {
|
||||
@@ -117,17 +119,19 @@ stop () {
|
||||
printf "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" ]; then
|
||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||
else
|
||||
rm -f "${SAVE_IPSETS}.tmp"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -69,10 +69,12 @@ setstatedir() {
|
||||
|
||||
[ -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
|
||||
else
|
||||
return 0
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -84,10 +86,8 @@ shorewall_start () {
|
||||
printf "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -107,16 +107,16 @@ shorewall_stop () {
|
||||
printf "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" ]; then
|
||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
||||
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
|
||||
|
||||
|
@@ -79,12 +79,14 @@ setstatedir() {
|
||||
|
||||
[ -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
|
||||
elif [ $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/shorewall -6 compile
|
||||
else
|
||||
return 0
|
||||
return 6
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -96,10 +98,8 @@ shorewall_start () {
|
||||
printf "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x $STATEDIR/firewall ]; then
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop
|
||||
fi
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
$STATEDIR/$PRODUCT/firewall ${OPTIONS} stop
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -117,16 +117,16 @@ shorewall_stop () {
|
||||
printf "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" ]; then
|
||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
||||
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
|
||||
}
|
||||
|
@@ -33,12 +33,12 @@ setstatedir() {
|
||||
|
||||
[ -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
|
||||
elif [ $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/shorewall -6 compile
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -67,16 +67,14 @@ shorewall_start () {
|
||||
printf "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
)
|
||||
fi
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
)
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -95,16 +93,16 @@ shorewall_stop () {
|
||||
printf "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" ]; then
|
||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
||||
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
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#
|
||||
# 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
|
||||
# be placed in a directory on the CONFIG_PATH to be used when compiling firewalls
|
||||
@@ -38,7 +38,6 @@
|
||||
#
|
||||
# IPTABLES - iptables
|
||||
# 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
|
||||
# used during firewall compilation, then the generated firewall program will likewise not
|
||||
|
@@ -13,7 +13,6 @@ DEFAULTS ACCEPT
|
||||
@1 - - icmp time-exceeded {comment="Needed ICMP types"}
|
||||
?else
|
||||
?COMMENT Needed ICMP types (RFC4890)
|
||||
|
||||
@1 - - ipv6-icmp destination-unreachable
|
||||
@1 - - ipv6-icmp packet-too-big
|
||||
@1 - - ipv6-icmp time-exceeded
|
||||
@@ -38,7 +37,7 @@ DEFAULTS ACCEPT
|
||||
@1 - - ipv6-icmp 148 # Certificate path solicitation
|
||||
@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 152 # Multicast router solicitation
|
||||
@1 fe80::/10 - ipv6-icmp 153 # Multicast router termination
|
||||
|
@@ -30,4 +30,4 @@
|
||||
|
||||
DEFAULTS ACCEPT,-
|
||||
|
||||
@1 - - ;;+ -p 6 --tcp-flags ACK,FIN,PSH ACK,FIN,PSH
|
||||
@1 - - ;;+ -p 6 --tcp-flags ACK,FIN ACK,FIN
|
||||
|
@@ -107,6 +107,11 @@ if ( $command & $REAP_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 ) {
|
||||
require_capability 'MARK_ANYWHERE', '"reset"', 's';
|
||||
|
||||
|
@@ -41,6 +41,11 @@ fatal_error "Invalid Src or Dest ($destination)" unless $destination =~ /^(?:src
|
||||
set_action_disposition( $disposition) if supplied $disposition;
|
||||
set_action_name_to_caller;
|
||||
|
||||
if ( ( $targets{$action} || 0 ) & NATRULE ) {
|
||||
perl_action_helper( "${action}-", "" );
|
||||
$action = 'ACCEPT';
|
||||
}
|
||||
|
||||
if ( $destination eq 'dst' ) {
|
||||
perl_action_helper( $action, '', '', "-m recent --name $event --remove --rdest" );
|
||||
} else {
|
||||
|
@@ -37,6 +37,11 @@ fatal_error "Invalid Src or Dest ($destination)" unless $destination =~ /^(?:src
|
||||
set_action_disposition( $disposition) if supplied $disposition;
|
||||
set_action_name_to_caller;
|
||||
|
||||
if ( ( $targets{$action} || 0 ) & NATRULE ) {
|
||||
perl_action_helper( "${action}-", "" );
|
||||
$action = 'ACCEPT';
|
||||
}
|
||||
|
||||
if ( $destination eq 'dst' ) {
|
||||
perl_action_helper( $action, '', '', "-m recent --name $event --set --rdest" );
|
||||
} 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 SYN,RST SYN,RST
|
||||
$tcpflags_action - - ;;+ -p 6 --tcp-flags SYN,FIN SYN,FIN
|
||||
$tcpflags_action - - ;;+ -p tcp --syn --sport 0
|
||||
$tcpflags_action - - ;;+ -p 6 --syn --sport 0
|
||||
|
@@ -15,6 +15,7 @@ PARAM - - tcp 3668,3669 # Virtual Media, Secure (Dell)
|
||||
PARAM - - tcp 5120,5123 # CD, floppy (Asus, Aten)
|
||||
PARAM - - tcp 5900,5901 # Remote Console (Aten, Dell)
|
||||
PARAM - - tcp 7578 # Remote Console (AMI)
|
||||
PARAM - - tcp 3520 # Remote Console (Redfish)
|
||||
PARAM - - udp 623 # RMCP
|
||||
HTTP
|
||||
HTTPS
|
||||
|
@@ -6,4 +6,5 @@
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
|
||||
PARAM - - udp 3389
|
||||
PARAM - - tcp 3389
|
||||
|
@@ -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
|
@@ -195,7 +195,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
||||
$ports = '' if $ports eq 'any' || $ports 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 $prerule = '';
|
||||
@@ -266,7 +266,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
||||
if ( $source eq 'any' || $source eq 'all' ) {
|
||||
$source = ALLIP;
|
||||
} 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 ) {
|
||||
|
@@ -1345,8 +1345,6 @@ sub format_rule( $$;$ ) {
|
||||
} else {
|
||||
$rule .= join( '' , ' --', $_, ' ', $value );
|
||||
}
|
||||
|
||||
next;
|
||||
} elsif ( $type == EXPENSIVE ) {
|
||||
#
|
||||
# Only emit expensive matches now if there are '-m nfacct' or '-m recent' matches in the rule
|
||||
@@ -1405,13 +1403,15 @@ sub compatible( $$ ) {
|
||||
}
|
||||
#
|
||||
# Don't combine chains where each specifies
|
||||
# -m policy
|
||||
# -m policy and the policies are different
|
||||
# or when one specifies
|
||||
# -m multiport
|
||||
# and the other specifies
|
||||
# --dport or --sport or -m multiport
|
||||
#
|
||||
return ! ( $ref1->{policy} && $ref2->{policy} ||
|
||||
my ( $p1, $p2 );
|
||||
|
||||
return ! ( ( ( $p1 = $ref1->{policy} ) && ( $p2 = $ref2->{policy} ) && $p1 ne $p2 ) ||
|
||||
( ( $ref1->{multiport} && ( $ref2->{dport} || $ref2->{sport} || $ref2->{multiport} ) ) ||
|
||||
( $ref2->{multiport} && ( $ref1->{dport} || $ref1->{sport} ) ) ) );
|
||||
}
|
||||
@@ -1929,7 +1929,7 @@ sub delete_reference( $$ ) {
|
||||
|
||||
assert( $toref );
|
||||
|
||||
delete $toref->{references}{$fromref->{name}} unless --$toref->{references}{$fromref->{name}} > 0;
|
||||
delete $toref->{references}{$fromref->{name}} if --$toref->{references}{$fromref->{name}} <= 0;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -2067,7 +2067,7 @@ sub adjust_reference_counts( $$$ ) {
|
||||
my ($toref, $name1, $name2) = @_;
|
||||
|
||||
if ( $toref ) {
|
||||
delete $toref->{references}{$name1} unless --$toref->{references}{$name1} > 0;
|
||||
delete $toref->{references}{$name1} if --$toref->{references}{$name1} <= 0;
|
||||
$toref->{references}{$name2}++;
|
||||
}
|
||||
}
|
||||
@@ -3275,8 +3275,10 @@ sub initialize_chain_table($) {
|
||||
$chainref = new_nat_chain( 'DOCKER' );
|
||||
set_optflags( $chainref, DONT_OPTIMIZE | DONT_DELETE | DONT_MOVE );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.nat_DOCKER ] && cat ${VARDIR}/.nat_DOCKER >&3' );
|
||||
$chainref = new_standard_chain( 'DOCKER-INGRESS' );
|
||||
$chainref = new_standard_chain( 'DOCKER-ISOLATION' );
|
||||
set_optflags( $chainref, DONT_OPTIMIZE | DONT_DELETE | DONT_MOVE );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-INGRESS ] && cat ${VARDIR}/.filter_DOCKER-INGRESS >&3' );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-ISOLATION ] && cat ${VARDIR}/.filter_DOCKER-ISOLATION >&3' );
|
||||
}
|
||||
|
||||
@@ -3673,7 +3675,7 @@ sub optimize_level4( $$ ) {
|
||||
#
|
||||
delete_chain_and_references( $chainref );
|
||||
$progress = 1;
|
||||
} elsif ( $chainref->{builtin} || ! $globals{KLUDGEFREE} || $firstrule->{policy} ) {
|
||||
} elsif ( $chainref->{builtin} || ! $globals{KLUDGEFREE} ) {
|
||||
#
|
||||
# This case requires a new rule merging algorithm. Ignore this chain from
|
||||
# now on.
|
||||
@@ -3900,6 +3902,15 @@ sub optimize_level8( $$$ ) {
|
||||
}
|
||||
|
||||
$combined{ $chainref1->{name} } = $chainref->{name};
|
||||
#
|
||||
# While rare, it is possible for a policy chain to be combined with a non-policy chain. So we need to preserve
|
||||
# the policy attributes in the combined chain
|
||||
#
|
||||
if ( $chainref->{policychain} ) {
|
||||
@{$chainref1}{qw(policychain policy)} = @{$chainref}{qw(policychain policy)} unless $chainref1->{policychain};
|
||||
} elsif ( $chainref1->{policychain} ) {
|
||||
@{$chainref}{qw(policychain policy)} = @{$chainref1}{qw(policychain policy)} unless $chainref->{policychain};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4826,7 +4837,7 @@ sub do_proto( $$$;$ )
|
||||
$multiport = 1;
|
||||
} else {
|
||||
fatal_error "Missing DEST PORT" unless supplied $ports;
|
||||
$ports = validate_portpair $pname , $ports;
|
||||
$ports = validate_portpair $pname , $ports unless $ports =~ /^\$/;
|
||||
$output .= ( $srcndst ? "-m multiport ${invert}--ports ${ports} " : "${invert}--dport ${ports} " );
|
||||
}
|
||||
}
|
||||
@@ -5033,7 +5044,7 @@ sub do_iproto( $$$ )
|
||||
$multiport = 1;
|
||||
} else {
|
||||
fatal_error "Missing DEST PORT" unless supplied $ports;
|
||||
$ports = validate_portpair $pname , $ports;
|
||||
$ports = validate_portpair $pname , $ports unless $ports =~ /^\$/;
|
||||
|
||||
if ( $srcndst ) {
|
||||
push @output, multiport => "${invert}--ports ${ports}";
|
||||
@@ -6318,7 +6329,7 @@ sub match_dest_net( $;$ ) {
|
||||
return '-d ' . record_runtime_address $1, $2;
|
||||
}
|
||||
|
||||
$net = validate_net $net, 1;
|
||||
$net = validate_net $net, 1 unless $net =~ /^\$/; # Don't validate if runtime address variable
|
||||
$net eq ALLIP ? '' : "-d $net ";
|
||||
}
|
||||
|
||||
@@ -6399,7 +6410,7 @@ sub imatch_dest_net( $;$ ) {
|
||||
return ( d => record_runtime_address( $1, $2, 1 ) );
|
||||
}
|
||||
|
||||
$net = validate_net $net, 1;
|
||||
$net = validate_net $net, 1 unless $net =~ /^\$/; # Don't validate if runtime address variable
|
||||
$net eq ALLIP ? () : ( d => $net );
|
||||
}
|
||||
|
||||
@@ -7058,6 +7069,8 @@ sub interface_gateway( $ ) {
|
||||
sub get_interface_gateway ( $;$$ ) {
|
||||
my ( $logical, $protect, $provider ) = @_;
|
||||
|
||||
$provider = '' unless defined $provider;
|
||||
|
||||
my $interface = get_physical $logical;
|
||||
my $variable = interface_gateway( $interface );
|
||||
my $gateway = get_interface_option( $interface, 'gateway' );
|
||||
@@ -7071,9 +7084,9 @@ sub get_interface_gateway ( $;$$ ) {
|
||||
}
|
||||
|
||||
if ( interface_is_optional $logical ) {
|
||||
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$(detect_gateway $interface));
|
||||
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$(detect_gateway $interface $provider));
|
||||
} else {
|
||||
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$(detect_gateway $interface)
|
||||
$interfacegateways{$interface} = qq([ -n "\$$variable" ] || $variable=\$(detect_gateway $interface $provider)
|
||||
[ -n "\$$variable" ] || startup_error "Unable to detect the gateway through interface $interface");
|
||||
}
|
||||
|
||||
@@ -7522,6 +7535,11 @@ sub isolate_dest_interface( $$$$ ) {
|
||||
|
||||
$rule .= "-d $variable ";
|
||||
}
|
||||
} elsif ( $dest =~ /^\$/ ) {
|
||||
#
|
||||
# Runtime address variable
|
||||
#
|
||||
$dnets = $dest;
|
||||
} elsif ( $family == F_IPV4 ) {
|
||||
if ( $dest =~ /^(.+?):(.+)$/ ) {
|
||||
$diface = $1;
|
||||
@@ -8445,6 +8463,7 @@ sub save_docker_rules($) {
|
||||
qq( $tool -t nat -S OUTPUT | tail -n +2 | fgrep DOCKER > \${VARDIR}/.nat_OUTPUT),
|
||||
qq( $tool -t nat -S POSTROUTING | tail -n +2 | fgrep -v SHOREWALL > \${VARDIR}/.nat_POSTROUTING),
|
||||
qq( $tool -t filter -S DOCKER | tail -n +2 > \${VARDIR}/.filter_DOCKER),
|
||||
qq( [ -n "\$g_dockeringress" ] && $tool -t filter -S DOCKER-INGRESS | tail -n +2 > \${VARDIR}/.filter_DOCKER-INGRESS),
|
||||
qq( [ -n "\$g_dockernetwork" ] && $tool -t filter -S DOCKER-ISOLATION | tail -n +2 > \${VARDIR}/.filter_DOCKER-ISOLATION)
|
||||
);
|
||||
|
||||
@@ -8460,6 +8479,7 @@ sub save_docker_rules($) {
|
||||
q( rm -f ${VARDIR}/.nat_OUTPUT),
|
||||
q( rm -f ${VARDIR}/.nat_POSTROUTING),
|
||||
q( rm -f ${VARDIR}/.filter_DOCKER),
|
||||
q( rm -f ${VARDIR}/.filter_DOCKER-INGRESS),
|
||||
q( rm -f ${VARDIR}/.filter_DOCKER-ISOLATION),
|
||||
q( rm -f ${VARDIR}/.filter_FORWARD),
|
||||
q(fi)
|
||||
@@ -8902,9 +8922,15 @@ sub create_netfilter_load( $ ) {
|
||||
my $UTILITY = $family == F_IPV4 ? 'IPTABLES_RESTORE' : 'IP6TABLES_RESTORE';
|
||||
|
||||
emit( '',
|
||||
'if [ "$COMMAND" = reload -a -n "$g_counters" ] && chain_exists $g_sha1sum1 && chain_exists $g_sha1sum2 ; then',
|
||||
' option="--counters"',
|
||||
'',
|
||||
'if [ "$COMMAND" = reload -a -n "$g_counters" ] && chain_exists $g_sha1sum1 && chain_exists $g_sha1sum2 ; then' );
|
||||
|
||||
if ( have_capability( 'RESTORE_WAIT_OPTION' ) ) {
|
||||
emit( ' option="--counters --wait "' . $config{MUTEX_TIMEOUT} );
|
||||
} else {
|
||||
emit( ' option="--counters"' );
|
||||
}
|
||||
|
||||
emit( '',
|
||||
' progress_message "Reusing existing ruleset..."',
|
||||
'',
|
||||
'else'
|
||||
@@ -8912,7 +8938,11 @@ sub create_netfilter_load( $ ) {
|
||||
|
||||
push_indent;
|
||||
|
||||
emit 'option=';
|
||||
if ( have_capability( 'RESTORE_WAIT_OPTION' ) ) {
|
||||
emit 'option="--wait "' . $config{MUTEX_TIMEOUT};
|
||||
} else {
|
||||
emit 'option=';
|
||||
}
|
||||
|
||||
save_progress_message "Preparing $utility input...";
|
||||
|
||||
@@ -8961,6 +8991,10 @@ sub create_netfilter_load( $ ) {
|
||||
enter_cmd_mode;
|
||||
emit( '[ -n "$g_dockernetwork" ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
enter_cat_mode;
|
||||
} elsif ( $name eq 'DOCKER-INGRESS' ) {
|
||||
enter_cmd_mode;
|
||||
emit( '[ -n "$g_dockeringress" ] && echo ":DOCKER-INGRESS - [0:0]" >&3' );
|
||||
enter_cat_mode;
|
||||
} else {
|
||||
emit_unindented ":$name - [0:0]";
|
||||
}
|
||||
@@ -9065,6 +9099,11 @@ sub preview_netfilter_load() {
|
||||
print( '[ -n "$g_dockernetwork" ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
print "\n";
|
||||
enter_cat_mode1;
|
||||
} elsif ( $name eq 'DOCKER-INGRESS' ) {
|
||||
enter_cmd_mode1 unless $mode == CMD_MODE;
|
||||
print( '[ -n "$g_dockeringress" ] && echo ":DOCKER-INGRESS - [0:0]" >&3' );
|
||||
print "\n";
|
||||
enter_cat_mode1;
|
||||
} else {
|
||||
enter_cmd_mode1 unless $mode == CMD_MODE;
|
||||
print( ":$name - [0:0]\n" );
|
||||
@@ -9302,6 +9341,10 @@ sub create_stop_load( $ ) {
|
||||
enter_cmd_mode;
|
||||
emit( '[ -n "$g_dockernetwork" ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
enter_cat_mode;
|
||||
} elsif ( $name eq 'DOCKER-INGRESS' ) {
|
||||
enter_cmd_mode;
|
||||
emit( '[ -n "$g_dockeringress" ] && echo ":DOCKER-INGRESS - [0:0]" >&3' );
|
||||
enter_cat_mode;
|
||||
} else {
|
||||
emit_unindented ":$name - [0:0]";
|
||||
}
|
||||
@@ -9327,7 +9370,11 @@ sub create_stop_load( $ ) {
|
||||
|
||||
enter_cmd_mode;
|
||||
|
||||
emit( '[ -n "$g_debug_iptables" ] && command=debug_restore_input || command=$' . $UTILITY );
|
||||
if ( have_capability( 'RESTORE_WAIT_OPTION' ) ) {
|
||||
emit( '[ -n "$g_debug_iptables" ] && command=debug_restore_input || command="$' . $UTILITY . ' --wait ' . $config{MUTEX_TIMEOUT} . '"' );
|
||||
} else {
|
||||
emit( '[ -n "$g_debug_iptables" ] && command=debug_restore_input || command=$' . $UTILITY );
|
||||
}
|
||||
|
||||
emit( '',
|
||||
'progress_message2 "Running $command..."',
|
||||
|
@@ -59,7 +59,7 @@ our $have_arptables;
|
||||
# Initilize the package-globals in the other modules
|
||||
#
|
||||
sub initialize_package_globals( $$$ ) {
|
||||
Shorewall::Config::initialize($family, $_[1], $_[2]);
|
||||
Shorewall::Config::initialize($family, $export, $_[1], $_[2]);
|
||||
Shorewall::Chains::initialize ($family, 1, $export );
|
||||
Shorewall::Zones::initialize ($family, $_[0]);
|
||||
Shorewall::Nat::initialize($family);
|
||||
@@ -109,7 +109,7 @@ sub generate_script_1( $ ) {
|
||||
################################################################################
|
||||
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 refresh refreshed restored enabled disabled/ ) {
|
||||
emit "\nrun_${exit}_exit() {";
|
||||
push_indent;
|
||||
append_file $exit or emit 'true';
|
||||
@@ -209,6 +209,8 @@ sub generate_script_2() {
|
||||
emit ( '[ -f ${g_confdir}/vardir ] && . ${g_confdir}/vardir' );
|
||||
emit ( qq([ -n "\${VARDIR:=$shorewallrc1{VARDIR}}" ]) );
|
||||
emit ( qq([ -n "\${VARLIB:=$shorewallrc1{VARLIB}}" ]) );
|
||||
emit ( qq([ -n "\${CONFDIR:=$shorewallrc1{CONFDIR}}" ]) );
|
||||
emit ( qq([ -n "\${SHAREDIR:=$shorewallrc1{SHAREDIR}}" ]) );
|
||||
|
||||
emit 'TEMPFILE=';
|
||||
|
||||
@@ -266,7 +268,8 @@ sub generate_script_2() {
|
||||
emit( '',
|
||||
'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( 'chain_exists DOCKER-ISOLATION && g_dockernetwork=Yes' );
|
||||
emit( '' );
|
||||
}
|
||||
|
||||
@@ -689,6 +692,7 @@ sub compiler {
|
||||
set_timestamp( $timestamp );
|
||||
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
|
||||
#
|
||||
get_configuration( $export , $update , $annotate , $inline );
|
||||
@@ -793,13 +797,10 @@ sub compiler {
|
||||
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
|
||||
# (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
|
||||
#
|
||||
my $tcinterfaces = process_tc;
|
||||
|
@@ -30,17 +30,97 @@
|
||||
# into those files (emitters) and finalizing those files (renaming
|
||||
# them to their final name and setting their mode appropriately).
|
||||
#
|
||||
# A significant portion of this module is dedicated to the preprocessor:
|
||||
#
|
||||
# process_compiler_directive() - processes compiler directives
|
||||
#
|
||||
# embedded_shell() - handles embedded shell scripting
|
||||
#
|
||||
# embedded_perl() - handles embedded perl scripting
|
||||
#
|
||||
# read_a_line() - Reads the next configuration file record to
|
||||
# be passed to the function processing the file.
|
||||
#
|
||||
# - Detects compiler directives and passes then to
|
||||
# process_compiler_directive() for handling.
|
||||
#
|
||||
# - Handles line continuation
|
||||
#
|
||||
# - Invokes a callback when the first (concatinated) non-directive
|
||||
# record is read from a file.
|
||||
#
|
||||
# - Conditionally expands variables.
|
||||
#
|
||||
# - Conditionally detects embedded Shell and Perl and passes them
|
||||
# off to embedded_shell() and embedded_perl() respectively.
|
||||
#
|
||||
# - Conditionally detects and handles [?}INCLUDE directives.
|
||||
#
|
||||
# - Conditionally detects and handles ?SECTION directives.
|
||||
# File processing functions can supply a callback to be
|
||||
# called during this processing.
|
||||
#
|
||||
# File processing routines may need to open a second (third, fourth, ...)
|
||||
# file while processing the main file (macro and/or action files). Two
|
||||
# functions are provided to make that possible:
|
||||
#
|
||||
# push_open() - open a file while leaving the current file open.
|
||||
#
|
||||
# pop_open() - close the current file, and make the previous
|
||||
# file (if any) the current one.
|
||||
#
|
||||
# Because this module expands variables, it must be aware of action
|
||||
# parameters.
|
||||
#
|
||||
# push_action_params() - populates the %actparams hash and
|
||||
# returns a reference to the previous
|
||||
# contents of that hash. The caller is
|
||||
# expected to store those contents locally.
|
||||
#
|
||||
# pop_action_params() - Restores the %actparams hash from
|
||||
# the reference returned by
|
||||
# push_action_params().
|
||||
#
|
||||
# The following routines are provided for INLINE PERL within
|
||||
# action bodies:
|
||||
#
|
||||
# default_action_params() - called to fill in omitted
|
||||
# arguments when a DEFAULTS
|
||||
# line is encountered.
|
||||
#
|
||||
# get_action_params() - returns an array of arguments.
|
||||
#
|
||||
# setup_audit_action() - helper for A_* actions.
|
||||
#
|
||||
# get_action_logging() - returns log level and tag
|
||||
# from the action's invocation.
|
||||
#
|
||||
# get_action_chain_name() - returns chain name.
|
||||
#
|
||||
# set_action_name_to_caller() - replace chain name
|
||||
# with that of invoking
|
||||
# chain for logging purposes.
|
||||
#
|
||||
# set_action_disposition() - set the current action
|
||||
# disposition for logging purposes.
|
||||
#
|
||||
# get_action_disposition() - get the current action disposition.
|
||||
#
|
||||
# set_action_param() - set the value of an argument.
|
||||
#
|
||||
package Shorewall::Config;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Basename;
|
||||
use File::Temp qw/ tempfile tempdir /;
|
||||
use File::Glob ':globally';
|
||||
use Cwd qw(abs_path getcwd);
|
||||
use autouse 'Carp' => qw(longmess confess);
|
||||
use Scalar::Util 'reftype';
|
||||
use FindBin;
|
||||
use Digest::SHA qw(sha1_hex);
|
||||
use Errno qw(:POSIX);
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
#
|
||||
@@ -315,7 +395,7 @@ our %renamed = ( AUTO_COMMENT => 'AUTOCOMMENT', BLACKLIST_LOGLEVEL => 'BLACKLIST
|
||||
#
|
||||
# Config options and global settings that are to be copied to output script
|
||||
#
|
||||
our @propagateconfig = qw/ DISABLE_IPV6 MODULESDIR MODULE_SUFFIX LOAD_HELPERS_ONLY LOCKFILE SUBSYSLOCK LOG_VERBOSITY RESTART/;
|
||||
our @propagateconfig = qw/ DISABLE_IPV6 MODULESDIR LOAD_HELPERS_ONLY LOCKFILE SUBSYSLOCK LOG_VERBOSITY RESTART/;
|
||||
#
|
||||
# From parsing the capabilities file or detecting capabilities
|
||||
#
|
||||
@@ -414,7 +494,8 @@ our %capdesc = ( NAT_ENABLED => 'NAT',
|
||||
CPU_FANOUT => 'NFQUEUE CPU Fanout',
|
||||
NETMAP_TARGET => 'NETMAP Target',
|
||||
NFLOG_SIZE => '--nflog-size support',
|
||||
|
||||
RESTORE_WAIT_OPTION
|
||||
=> 'iptables-restore --wait option',
|
||||
AMANDA_HELPER => 'Amanda Helper',
|
||||
FTP_HELPER => 'FTP Helper',
|
||||
FTP0_HELPER => 'FTP-0 Helper',
|
||||
@@ -594,6 +675,7 @@ our $debug; # Global debugging flag
|
||||
our $confess; # If true, use Carp to report errors with stack trace.
|
||||
|
||||
our $family; # Protocol family (4 or 6)
|
||||
our $export; # True when compiling for export
|
||||
our $toolname; # Name of the tool to use (iptables or iptables6)
|
||||
our $toolNAME; # Tool name in CAPS
|
||||
our $product; # Name of product that will run the generated script
|
||||
@@ -647,6 +729,7 @@ our %eliminated = ( LOGRATE => 1,
|
||||
HIGH_ROUTE_MARKS => 1,
|
||||
BLACKLISTNEWONLY => 1,
|
||||
CHAIN_SCRIPTS => 1,
|
||||
MODULE_SUFFIX => 1,
|
||||
);
|
||||
#
|
||||
# Variables involved in ?IF, ?ELSE ?ENDIF processing
|
||||
@@ -706,8 +789,8 @@ sub add_variables( \% );
|
||||
# 2. The compiler can run multiple times in the same process so it has to be
|
||||
# able to re-initialize its dependent modules' state.
|
||||
#
|
||||
sub initialize( $;$$) {
|
||||
( $family, my ( $shorewallrc, $shorewallrc1 ) ) = @_;
|
||||
sub initialize( $;$$$) {
|
||||
( $family, $export, my ( $shorewallrc, $shorewallrc1 ) ) = @_;
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
( $product, $Product, $toolname, $toolNAME ) = qw( shorewall Shorewall iptables IPTABLES );
|
||||
@@ -751,8 +834,8 @@ sub initialize( $;$$) {
|
||||
TC_SCRIPT => '',
|
||||
EXPORT => 0,
|
||||
KLUDGEFREE => '',
|
||||
VERSION => "5.1.5-RC1",
|
||||
CAPVERSION => 50105 ,
|
||||
VERSION => "5.1.8-Beta1",
|
||||
CAPVERSION => 50106 ,
|
||||
BLACKLIST_LOG_TAG => '',
|
||||
RELATED_LOG_TAG => '',
|
||||
MACLIST_LOG_TAG => '',
|
||||
@@ -847,7 +930,6 @@ sub initialize( $;$$) {
|
||||
BLACKLIST => undef,
|
||||
BLACKLISTNEWONLY => undef,
|
||||
DELAYBLACKLISTLOAD => undef,
|
||||
MODULE_SUFFIX => undef,
|
||||
DISABLE_IPV6 => undef,
|
||||
DYNAMIC_ZONES => undef,
|
||||
PKTTYPE=> undef,
|
||||
@@ -1007,7 +1089,7 @@ sub initialize( $;$$) {
|
||||
CONNLIMIT_MATCH => undef,
|
||||
TIME_MATCH => undef,
|
||||
GOTO_TARGET => undef,
|
||||
LOG_TARGET => 1, # Assume that we have it.
|
||||
LOG_TARGET => undef,
|
||||
ULOG_TARGET => undef,
|
||||
NFLOG_TARGET => undef,
|
||||
LOGMARK_TARGET => undef,
|
||||
@@ -1046,6 +1128,7 @@ sub initialize( $;$$) {
|
||||
CPU_FANOUT => undef,
|
||||
NETMAP_TARGET => undef,
|
||||
NFLOG_SIZE => undef,
|
||||
RESTORE_WAIT_OPTION => undef,
|
||||
|
||||
AMANDA_HELPER => undef,
|
||||
FTP_HELPER => undef,
|
||||
@@ -1990,6 +2073,7 @@ sub find_file($)
|
||||
for my $directory ( @config_path ) {
|
||||
my $file = "$directory$filename";
|
||||
return $file if -f $file;
|
||||
$!{ENOENT} || fatal_error "Unable to access $file: " . $!;
|
||||
}
|
||||
|
||||
"$config_path[0]$filename";
|
||||
@@ -2572,7 +2656,7 @@ sub open_file( $;$$$$ ) {
|
||||
$max_format = supplied $mf ? $mf : 1;
|
||||
$comments_allowed = supplied $ca ? $ca : 0;
|
||||
$nocomment = $nc;
|
||||
do_open_file $fname;;
|
||||
do_open_file $fname;
|
||||
} else {
|
||||
$ifstack = @ifstack;
|
||||
'';
|
||||
@@ -4285,7 +4369,7 @@ sub which( $ ) {
|
||||
# Load the kernel modules defined in the 'modules' file.
|
||||
#
|
||||
sub load_kernel_modules( ) {
|
||||
my $moduleloader = which( 'modprobe' ) || ( which 'insmod' );
|
||||
my $moduleloader = which( 'modprobe' ) || which( 'insmod' );
|
||||
|
||||
my $modulesdir = $config{MODULESDIR};
|
||||
|
||||
@@ -4318,25 +4402,20 @@ sub load_kernel_modules( ) {
|
||||
|
||||
close LSMOD;
|
||||
|
||||
$config{MODULE_SUFFIX} = 'o gz xz ko o.gz o.xz ko.gz ko.xz' unless $config{MODULE_SUFFIX};
|
||||
|
||||
my @suffixes = split /\s+/ , $config{MODULE_SUFFIX};
|
||||
|
||||
MODULE:
|
||||
while ( read_a_line( NORMAL_READ ) ) {
|
||||
fatal_error "Invalid modules file entry" unless ( $currentline =~ /^loadmodule\s+([a-zA-Z]\w*)\s*(.*)$/ );
|
||||
my ( $module, $arguments ) = ( $1, $2 );
|
||||
unless ( $loadedmodules{ $module } ) {
|
||||
for my $directory ( @moduledirectories ) {
|
||||
for my $suffix ( @suffixes ) {
|
||||
my $modulefile = "$directory/$module.$suffix";
|
||||
if ( -f $modulefile ) {
|
||||
if ( $moduleloader eq 'insmod' ) {
|
||||
system ("insmod $modulefile $arguments" );
|
||||
} else {
|
||||
system( "modprobe $module $arguments" );
|
||||
}
|
||||
|
||||
if ( $moduleloader =~ /modprobe$/ ) {
|
||||
system( "modprobe -q $module $arguments" );
|
||||
$loadedmodules{ $module } = 1;
|
||||
} else {
|
||||
for my $directory ( @moduledirectories ) {
|
||||
for my $modulefile ( <$directory/$module.*> ) {
|
||||
system ("insmod $modulefile $arguments" );
|
||||
$loadedmodules{ $module } = 1;
|
||||
next MODULE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4948,6 +5027,10 @@ sub Cpu_Fanout() {
|
||||
have_capability( 'NFQUEUE_TARGET' ) && qt1( "$iptables -A $sillyname -j NFQUEUE --queue-balance 0:3 --queue-cpu-fanout" );
|
||||
}
|
||||
|
||||
sub Restore_Wait_Option() {
|
||||
length( `${iptables}-restore --wait < /dev/null 2>&1` ) == 0;
|
||||
}
|
||||
|
||||
our %detect_capability =
|
||||
( ACCOUNT_TARGET =>\&Account_Target,
|
||||
AMANDA_HELPER => \&Amanda_Helper,
|
||||
@@ -5028,6 +5111,7 @@ our %detect_capability =
|
||||
REALM_MATCH => \&Realm_Match,
|
||||
REAP_OPTION => \&Reap_Option,
|
||||
RECENT_MATCH => \&Recent_Match,
|
||||
RESTORE_WAIT_OPTION => \&Restore_Wait_Option,
|
||||
RPFILTER_MATCH => \&RPFilter_Match,
|
||||
SANE_HELPER => \&SANE_Helper,
|
||||
SANE0_HELPER => \&SANE0_Helper,
|
||||
@@ -5195,6 +5279,8 @@ sub determine_capabilities() {
|
||||
$capabilities{CPU_FANOUT} = detect_capability( 'CPU_FANOUT' );
|
||||
$capabilities{NETMAP_TARGET} = detect_capability( 'NETMAP_TARGET' );
|
||||
$capabilities{NFLOG_SIZE} = detect_capability( 'NFLOG_SIZE' );
|
||||
$capabilities{RESTORE_WAIT_OPTION}
|
||||
= detect_capability( 'RESTORE_WAIT_OPTION' );
|
||||
|
||||
unless ( have_capability 'CT_TARGET' ) {
|
||||
$capabilities{HELPER_MATCH} = detect_capability 'HELPER_MATCH';
|
||||
@@ -5243,7 +5329,13 @@ sub ensure_config_path() {
|
||||
fatal_error "CONFIG_PATH not found in $f" unless $config{CONFIG_PATH};
|
||||
}
|
||||
|
||||
@config_path = split /:/, $config{CONFIG_PATH};
|
||||
my $path = $config{CONFIG_PATH};
|
||||
|
||||
my $chop = ( $path =~ s/^:// );
|
||||
|
||||
@config_path = split /:/, $path;
|
||||
|
||||
shift @config_path if $chop && ( $export || $> != 0 );
|
||||
|
||||
#
|
||||
# To accomodate Cygwin-based compilation, we have separate directories for files whose names
|
||||
@@ -6061,7 +6153,6 @@ sub get_configuration( $$$$ ) {
|
||||
#
|
||||
# get_capabilities requires that the true settings of these options be established
|
||||
#
|
||||
default 'MODULE_PREFIX', 'ko ko.gz o o.gz gz';
|
||||
default_yes_no 'LOAD_HELPERS_ONLY' , 'Yes';
|
||||
|
||||
if ( ! $export && $> == 0 ) {
|
||||
@@ -6247,7 +6338,7 @@ sub get_configuration( $$$$ ) {
|
||||
$config{LOG_VERBOSITY} = -1;
|
||||
}
|
||||
|
||||
default_yes_no 'ADD_IP_ALIASES' , 'Yes';
|
||||
default_yes_no 'ADD_IP_ALIASES' , $family == F_IPV4 ? 'Yes' : '';
|
||||
default_yes_no 'ADD_SNAT_ALIASES' , '';
|
||||
default_yes_no 'DETECT_DNAT_IPADDRS' , '';
|
||||
default_yes_no 'DETECT_DNAT_IPADDRS' , '';
|
||||
@@ -6833,6 +6924,12 @@ sub get_configuration( $$$$ ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( supplied( $val = $config{MUTEX_TIMEOUT} ) ) {
|
||||
fatal_error "Invalid value ($val) for MUTEX_TIMEOUT" unless $val && $val =~ /^\d+$/;
|
||||
} else {
|
||||
$config{MUTEX_TIMEOUT} = 60;
|
||||
}
|
||||
|
||||
add_variables %config;
|
||||
|
||||
while ( my ($var, $val ) = each %renamed ) {
|
||||
|
@@ -667,6 +667,7 @@ sub create_docker_rules() {
|
||||
|
||||
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', );
|
||||
|
||||
if ( my $dockerref = known_interface('docker0') ) {
|
||||
@@ -2447,7 +2448,7 @@ sub setup_mss( ) {
|
||||
my $clampmss = $config{CLAMPMSS};
|
||||
my $option;
|
||||
my @match;
|
||||
my $chainref = $filter_table->{FORWARD};
|
||||
my $chainref = $mangle_table->{FORWARD};
|
||||
|
||||
if ( $clampmss ) {
|
||||
if ( "\L$clampmss" eq 'yes' ) {
|
||||
|
@@ -941,7 +941,17 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
|
||||
} else {
|
||||
$server = $1 if $family == F_IPV6 && $server =~ /^\[(.+)\]$/;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -125,7 +125,7 @@ sub initialize( $ ) {
|
||||
# Set up marking for 'tracked' interfaces.
|
||||
#
|
||||
sub setup_route_marking() {
|
||||
my $mask = in_hex( $globals{PROVIDER_MASK} );
|
||||
my $mask = in_hex( $globals{PROVIDER_MASK} );
|
||||
my $exmask = have_capability( 'EXMARK' ) ? "/$mask" : '';
|
||||
|
||||
require_capability( $_ , q(The provider 'track' option) , 's' ) for qw/CONNMARK_MATCH CONNMARK/;
|
||||
@@ -502,7 +502,7 @@ sub process_a_provider( $ ) {
|
||||
|
||||
if ( ( $gw = lc $gateway ) eq 'detect' ) {
|
||||
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';
|
||||
set_interface_option( $interface, 'gateway', 'detect' );
|
||||
} elsif ( $gw eq 'none' ) {
|
||||
@@ -512,6 +512,9 @@ sub process_a_provider( $ ) {
|
||||
set_interface_option( $interface, 'gateway', 'none' );
|
||||
} elsif ( $gateway && $gateway ne '-' ) {
|
||||
( $gateway, $mac ) = split_host_list( $gateway, 0 );
|
||||
|
||||
$gateway = $1 if $family == F_IPV6 && $gateway =~ /^\[(.+)\]$/;
|
||||
|
||||
validate_address $gateway, 0;
|
||||
|
||||
if ( defined $mac ) {
|
||||
@@ -602,6 +605,7 @@ sub process_a_provider( $ ) {
|
||||
} elsif ( $option eq 'nohostroute' ) {
|
||||
$hostroute = 0;
|
||||
} 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;
|
||||
} else {
|
||||
fatal_error "Invalid option ($option)";
|
||||
@@ -688,7 +692,6 @@ sub process_a_provider( $ ) {
|
||||
|
||||
$pref = 10000 + $number - 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unless ( $loose || $pseudo ) {
|
||||
@@ -847,7 +850,7 @@ sub add_a_provider( $$ ) {
|
||||
if ( $tproxy ) {
|
||||
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
|
||||
} else {
|
||||
emit "run_ip route add default dev $physical table $id";
|
||||
emit "run_ip route replace default dev $physical table $id";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,7 +866,7 @@ 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( "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) );
|
||||
}
|
||||
|
||||
@@ -873,24 +876,24 @@ sub add_a_provider( $$ ) {
|
||||
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" );
|
||||
} else {
|
||||
emit ( "find_interface_addresses $physical | while read address; do" );
|
||||
emit ( " qt \$IP -$family rule del from \$address" );
|
||||
emit ( " run_ip rule add from \$address pref 20000 table $id",
|
||||
emit ( "find_interface_addresses $physical | while read address; do",
|
||||
" 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",
|
||||
' rulenum=$(($rulenum + 1))',
|
||||
'done'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( @{$providerref->{persistent_routes}} ) {
|
||||
emit '';
|
||||
emit $_ for @{$providers{$table}->{persistent_routes}};
|
||||
}
|
||||
if ( @{$providerref->{persistent_routes}} ) {
|
||||
emit '';
|
||||
emit $_ for @{$providers{$table}->{persistent_routes}};
|
||||
}
|
||||
|
||||
if ( @{$providerref->{persistent_rules}} ) {
|
||||
emit '';
|
||||
emit $_ for @{$providers{$table}->{persistent_rules}};
|
||||
}
|
||||
if ( @{$providerref->{persistent_rules}} ) {
|
||||
emit '';
|
||||
emit $_ for @{$providers{$table}->{persistent_rules}};
|
||||
}
|
||||
|
||||
pop_indent;
|
||||
@@ -898,7 +901,6 @@ sub add_a_provider( $$ ) {
|
||||
emit( qq(fi\n),
|
||||
qq(echo 1 > \${VARDIR}/${physical}_disabled) );
|
||||
|
||||
|
||||
pop_indent;
|
||||
|
||||
emit( "}\n" );
|
||||
@@ -924,7 +926,7 @@ sub add_a_provider( $$ ) {
|
||||
if ( $tproxy ) {
|
||||
emit 'run_ip route add local ' . ALLIP . " dev $physical table $id";
|
||||
} else {
|
||||
emit "run_ip route add default dev $physical table $id";
|
||||
emit "run_ip route replace default dev $physical table $id";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -956,7 +958,7 @@ CEOF
|
||||
my $hexmark = in_hex( $mark );
|
||||
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",
|
||||
"echo \"\$IP -$family rule del fwmark ${hexmark}${mask} > /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing"
|
||||
@@ -985,7 +987,7 @@ CEOF
|
||||
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 ) {
|
||||
@@ -997,14 +999,16 @@ CEOF
|
||||
emit '';
|
||||
if ( $gateway ) {
|
||||
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 -4 route del $gateway/32 dev $physical table $id > /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing) if $family == F_IPV4;
|
||||
} 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( 'g_fallback=Yes' ) if $persistent;
|
||||
|
||||
$metrics = 1;
|
||||
}
|
||||
|
||||
@@ -1026,12 +1030,13 @@ CEOF
|
||||
} elsif ( ! $noautosrc ) {
|
||||
if ( $shared ) {
|
||||
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( echo "\$IP -$family rule del from $address pref 20000> /dev/null 2>&1" >> \${VARDIR}/undo_${table}_routing ),
|
||||
qq(fi) );
|
||||
} 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" ,
|
||||
"echo \"\$IP -$family rule del from $address pref 20000> /dev/null 2>&1\" >> \${VARDIR}/undo_${table}_routing" );
|
||||
}
|
||||
@@ -1088,7 +1093,21 @@ CEOF
|
||||
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 );
|
||||
|
||||
if ( get_interface_option( $interface, 'used_address_variable' ) || get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
||||
@@ -1233,12 +1252,14 @@ CEOF
|
||||
"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 ) {
|
||||
emit( "progress_message2 \" Optional Interface $table stopped\"" );
|
||||
emit( "progress_message2 \"Optional Interface $table stopped\"" );
|
||||
} else {
|
||||
emit( "progress_message2 \" Provider $table ($number) stopped\"" );
|
||||
emit( "progress_message2 \"Provider $table ($number) stopped\"" );
|
||||
}
|
||||
|
||||
pop_indent;
|
||||
@@ -1339,7 +1360,7 @@ sub add_an_rtrule1( $$$$$ ) {
|
||||
|
||||
$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";
|
||||
|
||||
if ( $persistent ) {
|
||||
@@ -1437,22 +1458,22 @@ sub add_a_route( ) {
|
||||
|
||||
if ( $gateway ne '-' ) {
|
||||
if ( $device ne '-' ) {
|
||||
push @$routes, qq(run_ip route add $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 @$routes, qq(run_ip route replace $dest via $gateway dev $physical table $id);
|
||||
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;
|
||||
} elsif ( $null ) {
|
||||
push @$routes, qq(run_ip route add $null $dest table $id);
|
||||
push @$persistent_routes, qq(run_ip route add $null $dest table $id) if $persistent;
|
||||
push @$routes, qq(run_ip route replace $null $dest table $id);
|
||||
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;
|
||||
} else {
|
||||
push @$routes, qq(run_ip route add $dest via $gateway table $id);
|
||||
push @$persistent_routes, qq(run_ip route add $dest via $gateway table $id) if $persistent;
|
||||
push @$routes, qq(run_ip route replace $dest via $gateway table $id);
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
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 @$persistent_routes, qq(run_ip route add $dest dev $physical table $id) if $persistent;
|
||||
push @$routes, qq(run_ip route replace $dest dev $physical table $id);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1554,7 +1575,7 @@ sub finish_providers() {
|
||||
emit ( " run_ip route replace default scope global table $table \$DEFAULT_ROUTE" );
|
||||
} else {
|
||||
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 route add default scope global table $table \$DEFAULT_ROUTE",
|
||||
' else',
|
||||
" run_ip route replace default scope global table $table \$DEFAULT_ROUTE",
|
||||
@@ -1575,7 +1596,7 @@ sub finish_providers() {
|
||||
' error_message "WARNING: No Default route added (all \'balance\' providers are down)"' );
|
||||
|
||||
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 {
|
||||
emit qq( qt \$IP -$family route del default table $table && error_message "WARNING: Default route deleted from table $table");
|
||||
}
|
||||
@@ -1602,7 +1623,7 @@ sub finish_providers() {
|
||||
}
|
||||
|
||||
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",
|
||||
' true',
|
||||
@@ -1617,7 +1638,7 @@ sub finish_providers() {
|
||||
if ( $family == F_IPV4 ) {
|
||||
emit( " run_ip route replace default scope global table $default \$FALLBACK_ROUTE" );
|
||||
} 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" );
|
||||
}
|
||||
|
||||
@@ -1630,7 +1651,10 @@ sub finish_providers() {
|
||||
'fi',
|
||||
'' );
|
||||
} 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",
|
||||
''
|
||||
);
|
||||
}
|
||||
@@ -1675,7 +1699,7 @@ sub process_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' );
|
||||
|
||||
@@ -1914,7 +1938,6 @@ sub setup_providers() {
|
||||
|
||||
emit "fi\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@@ -96,7 +96,7 @@ use constant { NULL_SECTION => 0x00,
|
||||
INVALID_SECTION => 0x10,
|
||||
UNTRACKED_SECTION => 0x20,
|
||||
NEW_SECTION => 0x40,
|
||||
DEFAULTACTION_SECTION => 0x80 };
|
||||
POLICYACTION_SECTION => 0x80 };
|
||||
#
|
||||
# Number of elements in the action tuple
|
||||
#
|
||||
@@ -216,6 +216,10 @@ our %statetable;
|
||||
# Tracks which of the state match actions (action.Invalid, etc.) that is currently being expanded
|
||||
#
|
||||
our $statematch;
|
||||
#
|
||||
# Remembers NAT-oriented columns from top-level action invocations
|
||||
#
|
||||
our %nat_columns;
|
||||
|
||||
#
|
||||
# Action/Inline options
|
||||
@@ -384,6 +388,8 @@ sub initialize( $ ) {
|
||||
);
|
||||
}
|
||||
|
||||
%nat_columns = ( dest => '-', proto => '-', ports => '-' );
|
||||
|
||||
############################################################################
|
||||
# Initialize variables moved from the Tc module in Shorewall 5.0.7 #
|
||||
############################################################################
|
||||
@@ -391,7 +397,7 @@ sub initialize( $ ) {
|
||||
%tcdevices = ();
|
||||
%tcclasses = ();
|
||||
$sticky = 0;
|
||||
$divertref = 0;
|
||||
$divertref = 0;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -921,6 +927,28 @@ sub process_policies()
|
||||
#
|
||||
sub process_inline ($$$$$$$$$$$$$$$$$$$$$$);
|
||||
|
||||
#
|
||||
# Determine the protocol to be used in the jump to the passed action
|
||||
#
|
||||
sub determine_action_protocol( $$ ) {
|
||||
my ( $action, $proto ) = @_;
|
||||
|
||||
if ( my $actionproto = $actions{$action}{proto} ) {
|
||||
if ( $proto eq '-' ) {
|
||||
$proto = $actionproto;
|
||||
} else {
|
||||
if ( defined( my $protonum = resolve_proto( $proto ) ) ) {
|
||||
fatal_error( "The $action action is only usable with " . proto_name( $actionproto ) ) unless $actionproto == $protonum;
|
||||
$proto = $protonum;
|
||||
} else {
|
||||
fatal_error( "Unknown protocol ($proto)" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$proto;
|
||||
}
|
||||
|
||||
sub add_policy_rules( $$$$$ ) {
|
||||
my ( $chainref , $target, $loglevel, $pactions, $dropmulticast ) = @_;
|
||||
|
||||
@@ -936,12 +964,16 @@ sub add_policy_rules( $$$$$ ) {
|
||||
|
||||
if ( ( $targets{$action} || 0 ) & ACTION ) {
|
||||
#
|
||||
# Default action is a regular action -- jump to the action chain
|
||||
# Policy action is a regular action -- jump to the action chain
|
||||
#
|
||||
add_ijump $chainref, j => use_policy_action( $paction, $chainref->{name} );
|
||||
if ( ( my $proto = determine_action_protocol( $action, '-' ) ) ne '-' ) {
|
||||
add_ijump( $chainref, j => use_policy_action( $paction, $chainref->{name} ), p => $proto );
|
||||
} else {
|
||||
add_ijump $chainref, j => use_policy_action( $paction, $chainref->{name} );
|
||||
}
|
||||
} else {
|
||||
#
|
||||
# Default action is an inline
|
||||
# Policy action is an inline
|
||||
#
|
||||
( undef, my $level ) = split /:/, $paction, 2;
|
||||
( $action, my $param ) = get_target_param( $action );
|
||||
@@ -1256,7 +1288,7 @@ sub finish_chain_section ($$$) {
|
||||
if ( $chain1ref->{is_policy} ) {
|
||||
if ( $chain1ref->{synparams} ) {
|
||||
my $synchainref = ensure_chain 'filter', syn_flood_chain $chain1ref;
|
||||
if ( $section == DEFAULTACTION_SECTION ) {
|
||||
if ( $section == POLICYACTION_SECTION ) {
|
||||
if ( $chain1ref->{policy} =~ /^(ACCEPT|CONTINUE|QUEUE|NFQUEUE)/ ) {
|
||||
add_ijump $chain1ref, j => $synchainref, p => 'tcp --syn';
|
||||
}
|
||||
@@ -1292,7 +1324,7 @@ sub ensure_rules_chain( $ )
|
||||
$chainref = new_rules_chain( $chain ) unless $chainref;
|
||||
|
||||
unless ( $chainref->{referenced} ) {
|
||||
if ( $section & ( NEW_SECTION | DEFAULTACTION_SECTION ) ) {
|
||||
if ( $section & ( NEW_SECTION | POLICYACTION_SECTION ) ) {
|
||||
finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED,INVALID,UNTRACKED';
|
||||
} elsif ( $section == UNTRACKED_SECTION ) {
|
||||
finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED,INVALID';
|
||||
@@ -1411,13 +1443,13 @@ sub external_name( $ ) {
|
||||
#
|
||||
# Define an Action
|
||||
#
|
||||
sub new_action( $$$$$ ) {
|
||||
sub new_action( $$$$$$ ) {
|
||||
|
||||
my ( $action , $type, $options , $actionfile , $state ) = @_;
|
||||
my ( $action , $type, $options , $actionfile , $state, $proto ) = @_;
|
||||
|
||||
fatal_error "Invalid action name($action)" if reserved_name( $action );
|
||||
|
||||
$actions{$action} = { file => $actionfile, actchain => '' , type => $type, options => $options , state => $state };
|
||||
$actions{$action} = { file => $actionfile, actchain => '' , type => $type, options => $options , state => $state, proto => $proto };
|
||||
|
||||
$targets{$action} = $type;
|
||||
}
|
||||
@@ -1635,7 +1667,7 @@ sub merge_inline_source_dest( $$ ) {
|
||||
return join( ':', $invocation, $body );
|
||||
}
|
||||
} else {
|
||||
fatal_error 'Interface names cannot appear in the DEST column within an action body' if $body =~ /:\[|:\+|/;
|
||||
fatal_error 'Interface names cannot appear in the DEST column within an action body' if $body =~ /:\[|:\+/;
|
||||
|
||||
if ( $invocation =~ /:\[|:\+/ ) {
|
||||
$invocation =~ s/:.*//;
|
||||
@@ -1652,6 +1684,19 @@ sub merge_inline_source_dest( $$ ) {
|
||||
$body || '';
|
||||
}
|
||||
|
||||
#
|
||||
# This one is used by perl_action_helper()
|
||||
#
|
||||
sub merge_action_column( $$ ) {
|
||||
my ( $body, $invocation ) = @_;
|
||||
|
||||
if ( supplied( $body ) && $body ne '-' ) {
|
||||
$body;
|
||||
} else {
|
||||
$invocation;
|
||||
}
|
||||
}
|
||||
|
||||
sub merge_macro_column( $$ ) {
|
||||
my ( $body, $invocation ) = @_;
|
||||
|
||||
@@ -1732,6 +1777,14 @@ sub process_action(\$\$$) {
|
||||
fatal_error "Action $action may not be used in the mangle file" if $chainref->{table} eq 'mangle';
|
||||
}
|
||||
|
||||
if ( $type & NAT_TABLE ) {
|
||||
fatal_error "Action $action may only be used in the snat file" unless $chainref->{table} eq 'nat';
|
||||
} else {
|
||||
fatal_error "Action $action may not be used in the snat file" if $chainref->{table} eq 'nat';
|
||||
}
|
||||
|
||||
$param = $1 if $param =~ /^.*\|(.*)$/; #Strip interface name off of the parameters
|
||||
|
||||
my $actionfile = $actionref->{file};
|
||||
|
||||
progress_message2 "$doing $actionfile for chain $chainref->{name}...";
|
||||
@@ -1920,7 +1973,7 @@ sub process_action(\$\$$) {
|
||||
|
||||
for my $proto (split_list( $protos, 'Protocol' ) ) {
|
||||
process_snat1( $chainref,
|
||||
$action,
|
||||
$nolog ? $action : merge_levels( join(':', @actparams{'chain','loglevel','logtag'}), $action ),
|
||||
$source,
|
||||
$dest,
|
||||
$proto,
|
||||
@@ -2022,9 +2075,10 @@ sub process_actions() {
|
||||
my $opts = $type == INLINE ? NOLOG_OPT : 0;
|
||||
|
||||
my $state = '';
|
||||
my $proto = 0;
|
||||
|
||||
if ( $action =~ /:/ ) {
|
||||
warning_message 'Default Actions are now specified in /etc/shorewall/shorewall.conf';
|
||||
warning_message 'Policy Actions are now specified in /etc/shorewall/shorewall.conf';
|
||||
$action =~ s/:.*$//;
|
||||
}
|
||||
|
||||
@@ -2038,6 +2092,9 @@ sub process_actions() {
|
||||
} else {
|
||||
fatal_error( q(The 'state' option is reserved for use in the actions.std file) );
|
||||
}
|
||||
} elsif ( /^proto=(.+)$/ ) {
|
||||
fatal_error "Unknown Protocol ($1)" unless defined( $proto = resolve_proto( $1 ) );
|
||||
fatal_error "A protocol may not be specified on the REJECT_ACTION ($action)" if $action eq $config{REJECT_ACTION};
|
||||
} else {
|
||||
fatal_error "Invalid option ($_)" unless $options{$_};
|
||||
$opts |= $options{$_};
|
||||
@@ -2047,9 +2104,9 @@ sub process_actions() {
|
||||
unless ( $type & INLINE ) {
|
||||
$type = INLINE if $opts & INLINE_OPT;
|
||||
}
|
||||
}
|
||||
|
||||
fatal_error "Conflicting OPTIONS ($options)" if ( $opts & NOINLINE_OPT && $type == INLINE ) || ( $opts & INLINE_OPT && $opts & BUILTIN_OPT );
|
||||
fatal_error "Conflicting OPTIONS ($options)" if ( $opts & NOINLINE_OPT && $type == INLINE ) || ( $opts & INLINE_OPT && $opts & BUILTIN_OPT );
|
||||
}
|
||||
|
||||
if ( my $actiontype = $targets{$action} ) {
|
||||
if ( ( $actiontype & ACTION ) && ( $type == INLINE ) ) {
|
||||
@@ -2058,6 +2115,11 @@ sub process_actions() {
|
||||
next;
|
||||
}
|
||||
|
||||
$proto = $actions{$action}{proto} unless $proto;
|
||||
delete $actions{$action};
|
||||
delete $targets{$action};
|
||||
} elsif ( ( $actiontype & INLINE ) && ( $type == ACTION ) && $opts & NOINLINE_OPT ) {
|
||||
$proto = $actions{$action}{proto} unless $proto;
|
||||
delete $actions{$action};
|
||||
delete $targets{$action};
|
||||
} else {
|
||||
@@ -2067,6 +2129,8 @@ sub process_actions() {
|
||||
}
|
||||
|
||||
if ( $opts & BUILTIN_OPT ) {
|
||||
warning_message( "The 'proto' option has no effect when specified on a builtin action" ) if $proto;
|
||||
|
||||
my $actiontype = USERBUILTIN | OPTIONS;
|
||||
$actiontype |= MANGLE_TABLE if $opts & MANGLE_OPT;
|
||||
$actiontype |= RAW_TABLE if $opts & RAW_OPT;
|
||||
@@ -2099,7 +2163,7 @@ sub process_actions() {
|
||||
|
||||
fatal_error "Missing Action File ($actionfile)" unless -f $actionfile;
|
||||
|
||||
new_action ( $action, $type, $opts, $actionfile , $state );
|
||||
new_action ( $action, $type, $opts, $actionfile , $state , $proto );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2137,7 +2201,7 @@ sub process_reject_action() {
|
||||
#
|
||||
# This gets called very early in the compilation process so we fake the section
|
||||
#
|
||||
$section = DEFAULTACTION_SECTION;
|
||||
$section = POLICYACTION_SECTION;
|
||||
|
||||
if ( ( $targets{$action} || 0 ) == ACTION ) {
|
||||
add_ijump $rejectref, j => use_policy_action( $action, $rejectref->{name} );
|
||||
@@ -2471,7 +2535,7 @@ sub verify_audit($;$$) {
|
||||
# the target is a macro, the macro is expanded and this function is called recursively for each rule in the expansion.
|
||||
# Similarly, if a new action tuple is encountered, this function is called recursively for each rule in the action
|
||||
# body. In this latter case, a reference to the tuple's chain is passed in the first ($chainref) argument. A chain
|
||||
# reference is also passed when rules are being generated during processing of a macro used as a default action.
|
||||
# reference is also passed when rules are being generated during processing of a macro used as a policy action.
|
||||
#
|
||||
|
||||
sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
@@ -2510,6 +2574,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
my $exceptionrule = '';
|
||||
my $usergenerated;
|
||||
my $prerule = '';
|
||||
my %save_nat_columns = %nat_columns;
|
||||
my $generated = 0;
|
||||
#
|
||||
# Subroutine for handling MARK and CONNMARK.
|
||||
#
|
||||
@@ -2591,32 +2657,30 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
|
||||
$current_param = $param unless $param eq '' || $param eq 'PARAM';
|
||||
|
||||
my $generated = process_macro( $basictarget,
|
||||
$chainref,
|
||||
$rule . $raw_matches,
|
||||
$matches1,
|
||||
$target,
|
||||
$current_param,
|
||||
$source,
|
||||
$dest,
|
||||
$proto,
|
||||
$ports,
|
||||
$sports,
|
||||
$origdest,
|
||||
$ratelimit,
|
||||
$user,
|
||||
$mark,
|
||||
$connlimit,
|
||||
$time,
|
||||
$headers,
|
||||
$condition,
|
||||
$helper,
|
||||
$wildcard );
|
||||
$generated = process_macro( $basictarget,
|
||||
$chainref,
|
||||
$rule . $raw_matches,
|
||||
$matches1,
|
||||
$target,
|
||||
$current_param,
|
||||
$source,
|
||||
$dest,
|
||||
$proto,
|
||||
$ports,
|
||||
$sports,
|
||||
$origdest,
|
||||
$ratelimit,
|
||||
$user,
|
||||
$mark,
|
||||
$connlimit,
|
||||
$time,
|
||||
$headers,
|
||||
$condition,
|
||||
$helper,
|
||||
$wildcard );
|
||||
|
||||
$macro_nest_level--;
|
||||
|
||||
return $generated;
|
||||
|
||||
goto EXIT;
|
||||
} elsif ( $actiontype & NFQ ) {
|
||||
$action = handle_nfqueue( $param,
|
||||
1 # Allow 'bypass'
|
||||
@@ -2688,6 +2752,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
|
||||
REDIRECT => sub () {
|
||||
my $z = $actiontype & NATONLY ? '' : firewall_zone;
|
||||
|
||||
if ( $dest eq '-' ) {
|
||||
if ( $family == F_IPV4 ) {
|
||||
$dest = ( $inchain ) ? '' : join( '', $z, '::' , $ports =~ /[:,]/ ? '' : $ports );
|
||||
@@ -2816,6 +2881,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Isolate and validate source and destination zones
|
||||
#
|
||||
@@ -2909,7 +2975,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
#
|
||||
if ( $destref->{type} & BPORT ) {
|
||||
unless ( $sourceref->{bridge} eq $destref->{bridge} || single_interface( $sourcezone ) eq $destref->{bridge} ) {
|
||||
return 0 if $wildcard;
|
||||
goto EXIT if $wildcard;
|
||||
fatal_error "Rules with a DESTINATION Bridge Port zone must have a SOURCE zone on the same bridge";
|
||||
}
|
||||
}
|
||||
@@ -2924,7 +2990,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
my $policy = $chainref->{policy};
|
||||
|
||||
if ( $policy eq 'NONE' ) {
|
||||
return 0 if $wildcard;
|
||||
goto EXIT if $wildcard;
|
||||
fatal_error "Rules may not override a NONE policy";
|
||||
}
|
||||
#
|
||||
@@ -2933,9 +2999,9 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
if ( $optimize == 1 && $section == NEW_SECTION ) {
|
||||
my $loglevel = $filter_table->{$chainref->{policychain}}{loglevel};
|
||||
if ( $loglevel ne '' ) {
|
||||
return 0 if $target eq "${policy}:${loglevel}";
|
||||
goto EXIT if $target eq "${policy}:${loglevel}";
|
||||
} else {
|
||||
return 0 if $basictarget eq $policy;
|
||||
goto EXIT if $basictarget eq $policy;
|
||||
}
|
||||
}
|
||||
#
|
||||
@@ -2980,6 +3046,25 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
my $actionchain; # Name of the action chain
|
||||
|
||||
if ( $actiontype & ACTION ) {
|
||||
#
|
||||
# Verify action 'proto', if any
|
||||
#
|
||||
$proto = determine_action_protocol( $basictarget, $proto );
|
||||
#
|
||||
# Save NAT-oriented column contents
|
||||
#
|
||||
@nat_columns{'dest', 'proto', 'ports' } = ( $dest,
|
||||
$proto eq '-' ? $nat_columns{proto} : $proto,
|
||||
$ports eq '-' ? $nat_columns{ports} : $ports );
|
||||
#
|
||||
# Push the current column array onto the column stack
|
||||
#
|
||||
my @savecolumns = @columns;
|
||||
#
|
||||
# And store the (modified) columns into the columns array for use by perl_action[_tcp]_helper. We
|
||||
# only need the NAT-oriented columns
|
||||
#
|
||||
@columns = ( undef , undef, $dest, $proto, $ports);
|
||||
#
|
||||
# Handle 'section' option
|
||||
#
|
||||
@@ -3023,6 +3108,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
}
|
||||
|
||||
$action = $basictarget; # Remove params, if any, from $action.
|
||||
|
||||
@columns = @savecolumns;
|
||||
} elsif ( $actiontype & INLINE ) {
|
||||
#
|
||||
# process_inline() will call process_rule() recursively for each rule in the action body
|
||||
@@ -3039,34 +3126,34 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
|
||||
$actionresult = 0;
|
||||
|
||||
my $generated = process_inline( $basictarget,
|
||||
$chainref,
|
||||
$prerule . $rule,
|
||||
$matches1 . $raw_matches,
|
||||
$loglevel,
|
||||
$target,
|
||||
$param,
|
||||
$source,
|
||||
$dest,
|
||||
$proto,
|
||||
$ports,
|
||||
$sports,
|
||||
$origdest,
|
||||
$ratelimit,
|
||||
$user,
|
||||
$mark,
|
||||
$connlimit,
|
||||
$time,
|
||||
$headers,
|
||||
$condition,
|
||||
$helper,
|
||||
$wildcard ) || $actionresult;
|
||||
$generated = process_inline( $basictarget,
|
||||
$chainref,
|
||||
$prerule . $rule,
|
||||
$matches1 . $raw_matches,
|
||||
$loglevel,
|
||||
$target,
|
||||
$param,
|
||||
$source,
|
||||
$dest,
|
||||
$proto,
|
||||
$ports,
|
||||
$sports,
|
||||
$origdest,
|
||||
$ratelimit,
|
||||
$user,
|
||||
$mark,
|
||||
$connlimit,
|
||||
$time,
|
||||
$headers,
|
||||
$condition,
|
||||
$helper,
|
||||
$wildcard ) || $actionresult;
|
||||
|
||||
( $actionresult, @columns ) = @$savecolumns;;
|
||||
|
||||
$macro_nest_level--;
|
||||
|
||||
return $generated;
|
||||
goto EXIT;
|
||||
}
|
||||
#
|
||||
# Generate Fixed part of the rule
|
||||
@@ -3113,7 +3200,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
);
|
||||
}
|
||||
|
||||
unless ( $section & ( NEW_SECTION | DEFAULTACTION_SECTION ) ||
|
||||
unless ( $section & ( NEW_SECTION | POLICYACTION_SECTION ) ||
|
||||
$inaction ||
|
||||
$blacklist ||
|
||||
$basictarget eq 'dropInvalid' ) {
|
||||
@@ -3249,10 +3336,17 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
$log_action ,
|
||||
$exceptionrule ,
|
||||
$usergenerated && ! $loglevel )
|
||||
unless unreachable_warning( $wildcard || $section == DEFAULTACTION_SECTION, $chainref );
|
||||
unless unreachable_warning( $wildcard || $section == POLICYACTION_SECTION, $chainref );
|
||||
}
|
||||
|
||||
return 1;
|
||||
$generated = 1;
|
||||
|
||||
EXIT:
|
||||
{
|
||||
%nat_columns = %save_nat_columns;
|
||||
}
|
||||
|
||||
return $generated;
|
||||
}
|
||||
|
||||
|
||||
@@ -3320,7 +3414,7 @@ sub check_state( $ ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $section & ( NEW_SECTION | DEFAULTACTION_SECTION ) ) {
|
||||
if ( $section & ( NEW_SECTION | POLICYACTION_SECTION ) ) {
|
||||
if ( $state eq 'NEW' ) {
|
||||
#
|
||||
# If an INVALID or UNTRACKED rule would be emitted then we must include the state match
|
||||
@@ -3406,27 +3500,60 @@ sub perl_action_helper($$;$$) {
|
||||
'', # CurrentParam
|
||||
@columns );
|
||||
} else {
|
||||
$result = process_rule( $chainref,
|
||||
$matches,
|
||||
$matches1,
|
||||
merge_target( $actions{$action}, $target ),
|
||||
'', # Current Param
|
||||
'-', # Source
|
||||
'-', # Dest
|
||||
'-', # Proto
|
||||
'-', # Port(s)
|
||||
'-', # Source Port(s)
|
||||
'-', # Original Dest
|
||||
'-', # Rate Limit
|
||||
'-', # User
|
||||
'-', # Mark
|
||||
'-', # Connlimit
|
||||
'-', # Time
|
||||
'-', # Headers,
|
||||
'-', # condition,
|
||||
'-', # helper,
|
||||
0, # Wildcard
|
||||
);
|
||||
if ( ( $targets{$target} || 0 ) & NATRULE ) {
|
||||
$result = process_rule( $chainref,
|
||||
$matches,
|
||||
$matches1,
|
||||
merge_target( $actions{$action}, $target ),
|
||||
'', # Current Param
|
||||
'-', # Source
|
||||
merge_action_column( # Dest
|
||||
$columns[2],
|
||||
$nat_columns{dest}
|
||||
),
|
||||
merge_action_column( #Proto
|
||||
$columns[3],
|
||||
$nat_columns{proto}
|
||||
),
|
||||
merge_action_column( #Ports
|
||||
$columns[4],
|
||||
$nat_columns{ports}),
|
||||
'-', # Source Port(s)
|
||||
'-', # Original Dest
|
||||
'-', # Rate Limit
|
||||
'-', # User
|
||||
'-', # Mark
|
||||
'-', # Connlimit
|
||||
'-', # Time
|
||||
'-', # Headers,
|
||||
'-', # condition,
|
||||
'-', # helper,
|
||||
0, # Wildcard
|
||||
);
|
||||
} else {
|
||||
$result = process_rule( $chainref,
|
||||
$matches,
|
||||
$matches1,
|
||||
merge_target( $actions{$action}, $target ),
|
||||
'', # Current Param
|
||||
'-', # Source
|
||||
'-', # Dest
|
||||
'-', # Proto
|
||||
'-', # Port(s)
|
||||
'-', # Source Port(s)
|
||||
'-', # Original Dest
|
||||
'-', # Rate Limit
|
||||
'-', # User
|
||||
'-', # Mark
|
||||
'-', # Connlimit
|
||||
'-', # Time
|
||||
'-', # Headers,
|
||||
'-', # condition,
|
||||
'-', # helper,
|
||||
0, # Wildcard
|
||||
);
|
||||
}
|
||||
|
||||
allow_optimize( $chainref );
|
||||
}
|
||||
#
|
||||
@@ -3492,7 +3619,8 @@ sub perl_action_tcp_helper($$) {
|
||||
'-', # condition,
|
||||
'-', # helper,
|
||||
0, # Wildcard
|
||||
);
|
||||
);
|
||||
|
||||
allow_optimize( $chainref );
|
||||
}
|
||||
#
|
||||
@@ -3827,7 +3955,7 @@ sub process_rules() {
|
||||
#
|
||||
# No need to finish the NEW section since no rules need to be generated
|
||||
#
|
||||
$section = $next_section = DEFAULTACTION_SECTION;
|
||||
$section = $next_section = POLICYACTION_SECTION;
|
||||
}
|
||||
|
||||
sub process_mangle_inline( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
@@ -4063,10 +4191,10 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
|
||||
expand_rule( $chainref,
|
||||
$restriction,
|
||||
$prerule ,
|
||||
do_proto( $proto, $ports, $sports ) .
|
||||
$match .
|
||||
do_user( $user ) .
|
||||
do_test( $testval, $globals{TC_MASK} ) .
|
||||
do_test( $testval, $globals{TC_MASK} ) .
|
||||
do_test( $testval, $mask ) .
|
||||
do_length( $length ) .
|
||||
do_tos( $tos ) .
|
||||
do_connbytes( $connbytes ) .
|
||||
@@ -4074,6 +4202,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
|
||||
do_headers( $headers ) .
|
||||
do_probability( $probability ) .
|
||||
do_dscp( $dscp ) .
|
||||
do_time( $time ) .
|
||||
do_condition( $condition, $chainref->{name} ) .
|
||||
state_match( $state ) .
|
||||
$raw_matches ,
|
||||
@@ -4509,6 +4638,52 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
|
||||
},
|
||||
},
|
||||
|
||||
TCPMSS => {
|
||||
defaultchain => FORWARD,
|
||||
allowedchains => FORWARD | POSTROUTING,
|
||||
minparams => 0,
|
||||
maxparams => 2,
|
||||
function => sub () {
|
||||
if ( $proto eq '-' ) {
|
||||
$proto = TCP;
|
||||
} else {
|
||||
fatal_error 'TCPMSS only valid with TCP' unless $proto eq '6' || $proto eq 'tcp';
|
||||
}
|
||||
|
||||
$target = 'TCPMSS ';
|
||||
$matches .= '--tcp-flags SYN,RST SYN ';
|
||||
|
||||
if ( supplied $params ) {
|
||||
my ( $mss, $ipsec ) = split /,/, $params;
|
||||
|
||||
if ( supplied $mss ) {
|
||||
if ( $mss eq 'pmtu' ) {
|
||||
$target .= '--clamp-mss-to-pmtu';
|
||||
} else {
|
||||
my $num = numeric_value $mss;
|
||||
fatal_error "Invalid MSS ($mss)" unless defined $num && $num >= 500 && $num < 65534;
|
||||
$target .= "--set-mss $num";
|
||||
}
|
||||
} else {
|
||||
$target .= '--clamp-mss-to-pmtu';
|
||||
}
|
||||
if ( supplied $ipsec && $ipsec ne 'all' ) {
|
||||
if ( $ipsec eq '-' || $ipsec eq 'none' ) {
|
||||
$matches .= '-m policy --pol none --dir out ';
|
||||
} elsif ( $ipsec eq 'ipsec' ) {
|
||||
$matches .= '-m policy --pol ipsec --dir out ';
|
||||
} else {
|
||||
fatal_error "Invalid ipsec parameter ($ipsec)";
|
||||
}
|
||||
|
||||
require_capability 'POLICY_MATCH', "The $ipsec ipsec option", 's';
|
||||
}
|
||||
} else {
|
||||
$target .= '--clamp-mss-to-pmtu';
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
TOS => {
|
||||
defaultchain => 0,
|
||||
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
|
||||
@@ -4532,8 +4707,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
|
||||
my ( $port, $ip, $bad );
|
||||
|
||||
if ( $params ) {
|
||||
( $port, $ip, $bad ) = split_list $params, 'Parameter';
|
||||
fatal_error "Invalid TPROXY specification( TPROXY($params) )" if defined $bad;
|
||||
( $port, $ip ) = split /,/, $params, 2;
|
||||
}
|
||||
|
||||
my $mark = in_hex( $globals{TPROXY_MARK} ) . '/' . in_hex( $globals{TPROXY_MARK} );
|
||||
@@ -4600,6 +4774,10 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ ) {
|
||||
function => sub() {
|
||||
fatal_error( qq(Action $cmd may not be used in the mangle file) ) unless $actiontype & MANGLE_TABLE;
|
||||
#
|
||||
# Verify action 'proto', if any
|
||||
#
|
||||
$proto = determine_action_protocol( $cmd, $proto );
|
||||
#
|
||||
# Create the action:level:tag:param tuple.
|
||||
#
|
||||
my $normalized_target = normalize_action( $cmd, '', $params );
|
||||
@@ -5125,18 +5303,23 @@ sub process_mangle_rule( $ ) {
|
||||
}
|
||||
}
|
||||
|
||||
sub process_snat_inline( $$$$$$$$$$$$$ ) {
|
||||
my ($inline, $chainref, $params, $source, $dest, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||
sub process_snat_inline( $$$$$$$$$$$$$$ ) {
|
||||
my ($inline, $chainref, $params, $loglevel, $source, $dest, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||
|
||||
my ( $level,
|
||||
$tag ) = split( ':', $loglevel, 2 );
|
||||
my $oldparms = push_action_params( $inline,
|
||||
$chainref,
|
||||
$params,
|
||||
'none',
|
||||
'' ,
|
||||
supplied $level ? $level : 'none',
|
||||
defined $tag ? $tag : '' ,
|
||||
$chainref->{name} );
|
||||
|
||||
my $inlinefile = $actions{$inline}{file};
|
||||
my $matches = fetch_inline_matches;
|
||||
my $actionref = $actions{$inline};
|
||||
my $inlinefile = $actionref->{file};
|
||||
my $options = $actionref->{options};
|
||||
my $nolog = $options & NOLOG_OPT;
|
||||
my $matches = fetch_inline_matches;
|
||||
|
||||
progress_message "..Expanding inline action $inlinefile...";
|
||||
|
||||
@@ -5170,6 +5353,8 @@ sub process_snat_inline( $$$$$$$$$$$$$ ) {
|
||||
next;
|
||||
}
|
||||
|
||||
$maction = merge_levels( join(':', @actparams{'chain','loglevel','logtag'}), $maction ) unless $nolog;
|
||||
|
||||
$msource = $source if $msource eq '-';
|
||||
|
||||
if ( $mdest eq '-' ) {
|
||||
@@ -5214,7 +5399,7 @@ sub process_snat_inline( $$$$$$$$$$$$$ ) {
|
||||
# Process a record in the snat file
|
||||
#
|
||||
sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
my ( $chainref, $action, $source, $dest, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||
my ( $chainref, $origaction, $source, $dest, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||
|
||||
my $inchain;
|
||||
my $inaction;
|
||||
@@ -5231,6 +5416,9 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
my $actiontype;
|
||||
my $interfaces;
|
||||
my $normalized_action;
|
||||
my ( $action, $loglevel ) = split_action( $origaction );
|
||||
my $logaction;
|
||||
my $param;
|
||||
|
||||
if ( $action =~ /^MASQUERADE(\+)?(?:\((.+)\))?$/ ) {
|
||||
$target = 'MASQUERADE';
|
||||
@@ -5239,6 +5427,7 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
$addresses = ( $2 || '' );
|
||||
$options = 'random' if $addresses =~ s/:?random$//;
|
||||
$add_snat_aliases = '';
|
||||
$logaction = 'MASQ';
|
||||
} elsif ( $action =~ /^SNAT(\+)?\((.+)\)$/ ) {
|
||||
$pre_nat = $1;
|
||||
$addresses = $2;
|
||||
@@ -5247,13 +5436,16 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
$options .= ':persistent' if $addresses =~ s/:persistent//;
|
||||
$options .= ':random' if $addresses =~ s/:random//;
|
||||
$options =~ s/^://;
|
||||
$logaction = 'SNAT';
|
||||
} elsif ( $action =~ /^CONTINUE(\+)?$/ ) {
|
||||
$add_snat_aliases = 0;
|
||||
$actiontype = $builtin_target{$target = 'RETURN'};
|
||||
$pre_nat = $1;
|
||||
$logaction = 'RETURN';
|
||||
} elsif ( $action eq 'MASQUERADE' ) {
|
||||
$actiontype = $builtin_target{$target = 'MASQUERADE'};
|
||||
$add_snat_aliases = '';
|
||||
$logaction = 'MASQ';
|
||||
} else {
|
||||
( $target , $params ) = get_target_param1( $action );
|
||||
|
||||
@@ -5261,11 +5453,24 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
|
||||
$actiontype = ( $targets{$target} || 0 );
|
||||
|
||||
fatal_error "Invalid ACTION ($action)" unless $actiontype & ( ACTION | INLINE );
|
||||
if ( $actiontype & LOGRULE ) {
|
||||
$logaction = 'LOG';
|
||||
if ( $target eq 'LOG' ) {
|
||||
fatal_error 'LOG requires a log level' unless supplied $loglevel;
|
||||
} else {
|
||||
$target = "$target($params)";
|
||||
validate_level( $action );
|
||||
$loglevel = supplied $loglevel ? join( ':', $target, $loglevel ) : $target;
|
||||
$target = 'LOG';
|
||||
}
|
||||
} else {
|
||||
fatal_error "Invalid ACTION ($action)" unless $actiontype & ( ACTION | INLINE );
|
||||
$logaction = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $inchain = defined $chainref ) {
|
||||
( $inaction, undef, $interfaces, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 5 if $chainref->{action};
|
||||
( $inaction, undef,undef,undef,$param ) = split( /:/, $normalized_action = $chainref->{action}) if $chainref->{action};
|
||||
fatal_error q('+' is not allowed within an action body) if $pre_nat;
|
||||
}
|
||||
#
|
||||
@@ -5273,6 +5478,8 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
#
|
||||
if ( $inaction ) {
|
||||
$destnets = $dest;
|
||||
assert( $param =~ /^(.*)\|/ );
|
||||
$interfaces=$1;
|
||||
} elsif ( $family == F_IPV4 ) {
|
||||
if ( $dest =~ /^([^:]+)::([^:]*)$/ ) {
|
||||
$add_snat_aliases = 0;
|
||||
@@ -5286,7 +5493,7 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
$interfaces = $1;
|
||||
} elsif ( $dest =~ /^([^:]+):([^:]*)$/ ) {
|
||||
my ( $one, $two ) = ( $1, $2 );
|
||||
if ( $2 =~ /\./ || $2 =~ /^%/ ) {
|
||||
if ( $2 =~ /\./ || $2 =~ /^[+%!]/ ) {
|
||||
$interfaces = $one;
|
||||
$destnets = $two;
|
||||
} else {
|
||||
@@ -5514,6 +5721,7 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
process_snat_inline( $target,
|
||||
$chainref,
|
||||
$params,
|
||||
$loglevel,
|
||||
$source,
|
||||
supplied $destnets && $destnets ne '-' ? $inaction ? $destnets : join( ':', $interface, $destnets ) : $inaction ? '-' : $interface,
|
||||
$proto,
|
||||
@@ -5528,10 +5736,14 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
if ( $actiontype & ACTION ) {
|
||||
fatal_error( qq(Action $target may not be used in the snat file) ) unless $actiontype & NAT_TABLE;
|
||||
#
|
||||
# Verify action 'proto', if any
|
||||
#
|
||||
$proto = determine_action_protocol( $target, $proto );
|
||||
#
|
||||
# Create the action:level:tag:param tuple. Since we don't allow logging out of nat POSTROUTING, we store
|
||||
# the interface name in the log tag
|
||||
#
|
||||
my $normalized_target = normalize_action( $target, "none:$interface", $params );
|
||||
my $normalized_target = normalize_action( $target, "$loglevel", "$interface|$params" );
|
||||
fatal_error( "Action $target invoked Recursively (" . join( '->', map( external_name( $_ ), @actionstack , $normalized_target ) ) . ')' ) if $active{$target};
|
||||
|
||||
my $ref = use_action( 'nat', $normalized_target );
|
||||
@@ -5541,9 +5753,6 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
# First reference to this tuple - process_action may modify both $normalized_target and $ref!!!
|
||||
#
|
||||
process_action( $normalized_target, $ref, $chainref->{name} );
|
||||
#
|
||||
# Capture the name of the action chain
|
||||
#
|
||||
} else {
|
||||
#
|
||||
# We've seen this tuple before
|
||||
@@ -5552,6 +5761,12 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
}
|
||||
|
||||
$target = $ref->{name};
|
||||
|
||||
if ( $actions{$target}{options} & LOGJUMP_OPT ) {
|
||||
$logaction = $target;
|
||||
} else {
|
||||
$loglevel = '';
|
||||
}
|
||||
} else {
|
||||
for my $option ( split_list2( $options , 'option' ) ) {
|
||||
if ( $option eq 'random' ) {
|
||||
@@ -5580,8 +5795,8 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
$destnets ,
|
||||
$origdest ,
|
||||
$target ,
|
||||
'' ,
|
||||
'' ,
|
||||
$loglevel ,
|
||||
$logaction ,
|
||||
$exceptionrule ,
|
||||
'' )
|
||||
unless unreachable_warning( 0, $chainref );
|
||||
|
@@ -225,11 +225,11 @@ sub handle_in_bandwidth( $$$ ) {
|
||||
if ( have_capability 'BASIC_FILTER' ) {
|
||||
if ( $in_rate ) {
|
||||
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 {
|
||||
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\",
|
||||
" estimator $in_interval $in_decay basic \\",
|
||||
" police drop avrate ${in_avrate}kbit\n" );
|
||||
" police avrate ${in_avrate}kbit drop\n" );
|
||||
}
|
||||
} else {
|
||||
emit( "run_tc filter add dev $physical parent ffff: protocol all prio 10 \\" ,
|
||||
@@ -1434,7 +1434,7 @@ sub process_tc_filter2( $$$$$$$$$ ) {
|
||||
|
||||
while ( @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;
|
||||
}
|
||||
|
||||
|
@@ -90,9 +90,8 @@ our @EXPORT = ( qw( NOTHING
|
||||
interface_is_optional
|
||||
interface_is_required
|
||||
find_interfaces_by_option
|
||||
find_interfaces_by_option1
|
||||
get_interface_option
|
||||
get_interface_origin
|
||||
get_interface_origin
|
||||
interface_has_option
|
||||
set_interface_option
|
||||
interface_zone
|
||||
@@ -114,31 +113,31 @@ our $VERSION = 'MODULEVERSION';
|
||||
# @zones contains the ordered list of zones with sub-zones appearing before their parents.
|
||||
#
|
||||
# %zones{<zone1> => {name => <name>,
|
||||
# type => <zone type> FIREWALL, IP, IPSEC, BPORT;
|
||||
# complex => 0|1
|
||||
# super => 0|1
|
||||
# options => { in_out => < policy match string >
|
||||
# in => < policy match string >
|
||||
# out => < policy match string >
|
||||
# }
|
||||
# parents => [ <parents> ] Parents, Children and interfaces are listed by name
|
||||
# children => [ <children> ]
|
||||
# interfaces => { <interfaces1> => 1, ... }
|
||||
# bridge => <bridge>
|
||||
# hosts { <type> } => [ { <interface1> => { ipsec => 'ipsec'|'none'
|
||||
# options => { <option1> => <value1>
|
||||
# ...
|
||||
# }
|
||||
# hosts => [ <net1> , <net2> , ... ]
|
||||
# exclusions => [ <net1>, <net2>, ... ]
|
||||
# origin => <where defined>
|
||||
# }
|
||||
# <interface2> => ...
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# <zone2> => ...
|
||||
# }
|
||||
# type => <zone type> FIREWALL, IP, IPSEC, BPORT;
|
||||
# complex => 0|1
|
||||
# super => 0|1
|
||||
# options => { in_out => < policy match string >
|
||||
# in => < policy match string >
|
||||
# out => < policy match string >
|
||||
# }
|
||||
# parents => [ <parents> ] Parents, Children and interfaces are listed by name
|
||||
# children => [ <children> ]
|
||||
# interfaces => { <interfaces1> => 1, ... }
|
||||
# bridge => <bridge>
|
||||
# hosts { <type> } => [ { <interface1> => { ipsec => 'ipsec'|'none'
|
||||
# options => { <option1> => <value1>
|
||||
# ...
|
||||
# }
|
||||
# hosts => [ <net1> , <net2> , ... ]
|
||||
# exclusions => [ <net1>, <net2>, ... ]
|
||||
# origin => <where defined>
|
||||
# }
|
||||
# <interface2> => ...
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# <zone2> => ...
|
||||
# }
|
||||
#
|
||||
# $firewall_zone names the firewall zone.
|
||||
#
|
||||
@@ -160,27 +159,27 @@ our %reservedName = ( all => 1,
|
||||
#
|
||||
# @interfaces lists the interface names in the order that they appear in the interfaces file.
|
||||
#
|
||||
# %interfaces { <interface1> => { name => <name of interface>
|
||||
# root => <name without trailing '+'>
|
||||
# options => { port => undef|1
|
||||
# { <option1> } => <val1> , #See %validinterfaceoptions
|
||||
# ...
|
||||
# }
|
||||
# zone => <zone name>
|
||||
# multizone => undef|1 #More than one zone interfaces through 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.
|
||||
# ports => <number of port on this bridge>
|
||||
# ipsec => undef|1 # Has an ipsec host group
|
||||
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
|
||||
# number => <ordinal position in the interfaces file>
|
||||
# physical => <physical interface name>
|
||||
# base => <shell variable base representing this interface>
|
||||
# wildcard => undef|1 # Wildcard Name
|
||||
# zones => { zone1 => 1, ... }
|
||||
# origin => <where defined>
|
||||
# }
|
||||
# }
|
||||
# %interfaces { <interface1> => { name => <name of interface>
|
||||
# root => <name without trailing '+'>
|
||||
# options => { port => undef|1
|
||||
# { <option1> } => <val1> , #See %validinterfaceoptions
|
||||
# ...
|
||||
# }
|
||||
# zone => <zone name>
|
||||
# multizone => undef|1 #More than one zone interfaces through 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.
|
||||
# ports => <number of port on this bridge>
|
||||
# ipsec => undef|1 # Has an ipsec host group
|
||||
# broadcasts => 'none', 'detect' or [ <addr1>, <addr2>, ... ]
|
||||
# number => <ordinal position in the interfaces file>
|
||||
# physical => <physical interface name>
|
||||
# base => <shell variable base representing this interface>
|
||||
# wildcard => undef|1 # Wildcard Name
|
||||
# zones => { zone1 => 1, ... }
|
||||
# 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 same order as the interfaces are encountered in the configuration files.
|
||||
@@ -253,6 +252,17 @@ use constant { NO_UPDOWN => 1,
|
||||
|
||||
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 = (
|
||||
blacklist => 1,
|
||||
bridge => 1,
|
||||
@@ -317,7 +327,7 @@ sub initialize( $$ ) {
|
||||
%mapbase = ();
|
||||
%mapbase1 = ();
|
||||
$baseseq = 0;
|
||||
$minroot = 0;
|
||||
$minroot = undef;
|
||||
$loopback_interface = '';
|
||||
|
||||
%validzoneoptions = ( mss => NUMERIC,
|
||||
@@ -339,7 +349,7 @@ sub initialize( $$ ) {
|
||||
arp_ignore => ENUM_IF_OPTION,
|
||||
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||
bridge => SIMPLE_IF_OPTION,
|
||||
dbl => ENUM_IF_OPTION,
|
||||
dbl => ENUM_IF_OPTION + IF_OPTION_WILDOK,
|
||||
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||
detectnets => OBSOLETE_IF_OPTION,
|
||||
dhcp => SIMPLE_IF_OPTION,
|
||||
@@ -363,9 +373,9 @@ sub initialize( $$ ) {
|
||||
upnp => SIMPLE_IF_OPTION,
|
||||
upnpclient => SIMPLE_IF_OPTION,
|
||||
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,
|
||||
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||
wait => NUMERIC_IF_OPTION,
|
||||
);
|
||||
%validhostoptions = (
|
||||
blacklist => 1,
|
||||
@@ -390,7 +400,7 @@ sub initialize( $$ ) {
|
||||
%validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION,
|
||||
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||
bridge => SIMPLE_IF_OPTION,
|
||||
dbl => ENUM_IF_OPTION,
|
||||
dbl => ENUM_IF_OPTION + IF_OPTION_WILDOK,
|
||||
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||
dhcp => SIMPLE_IF_OPTION,
|
||||
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||
@@ -402,18 +412,18 @@ sub initialize( $$ ) {
|
||||
optional => SIMPLE_IF_OPTION,
|
||||
proxyndp => BINARY_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,
|
||||
sfilter => IPLIST_IF_OPTION,
|
||||
sourceroute => BINARY_IF_OPTION,
|
||||
tcpflags => BINARY_IF_OPTION + IF_OPTION_HOST,
|
||||
mss => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||
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,
|
||||
upnp => SIMPLE_IF_OPTION,
|
||||
upnpclient => SIMPLE_IF_OPTION,
|
||||
wait => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||
wait => NUMERIC_IF_OPTION,
|
||||
);
|
||||
%validhostoptions = (
|
||||
blacklist => 1,
|
||||
@@ -701,6 +711,40 @@ sub haveipseczones() {
|
||||
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.
|
||||
#
|
||||
@@ -738,7 +782,7 @@ sub zone_report()
|
||||
if ( $family == F_IPV4 ) {
|
||||
progress_message_nocompress " $iref->{physical}:$grouplist";
|
||||
} else {
|
||||
progress_message_nocompress " $iref->{physical}:<$grouplist>";
|
||||
progress_message_nocompress " $iref->{physical}:[$grouplist]";
|
||||
}
|
||||
$printed = 1;
|
||||
}
|
||||
@@ -747,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 ) {
|
||||
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;
|
||||
@@ -1159,15 +1214,16 @@ sub process_interface( $$ ) {
|
||||
}
|
||||
|
||||
my $wildcard = 0;
|
||||
my $physwild = 0;
|
||||
my $root;
|
||||
|
||||
if ( $interface =~ /\+$/ ) {
|
||||
$wildcard = 1;
|
||||
$wildcard = $physwild = 1; # Default physical name is the logical name
|
||||
$root = substr( $interface, 0, -1 );
|
||||
$roots{$root} = $interface;
|
||||
my $len = length $root;
|
||||
|
||||
if ( $minroot ) {
|
||||
if ( defined $minroot ) {
|
||||
$minroot = $len if $minroot > $len;
|
||||
} else {
|
||||
$minroot = $len;
|
||||
@@ -1213,8 +1269,6 @@ sub process_interface( $$ ) {
|
||||
my %hostoptions = ( dynamic => 0 );
|
||||
|
||||
for my $option (split_list1 $options, 'option' ) {
|
||||
next if $option eq '-';
|
||||
|
||||
( $option, my $value ) = split /=/, $option;
|
||||
|
||||
fatal_error "Invalid Interface option ($option)" unless my $type = $validinterfaceoptions{$option};
|
||||
@@ -1251,7 +1305,6 @@ sub process_interface( $$ ) {
|
||||
} elsif ( $type == BINARY_IF_OPTION ) {
|
||||
$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 "The '$option' option may not be used with a wild-card interface name" if $wildcard && ! $type && IF_OPTION_WILDOK;
|
||||
$options{$option} = $value;
|
||||
$hostoptions{$option} = $value if $hostopt;
|
||||
} elsif ( $type == ENUM_IF_OPTION ) {
|
||||
@@ -1275,7 +1328,6 @@ sub process_interface( $$ ) {
|
||||
assert( 0 );
|
||||
}
|
||||
} 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;
|
||||
fatal_error "The '$option' option requires a value" unless defined $value;
|
||||
my $numval = numeric_value $value;
|
||||
@@ -1327,7 +1379,9 @@ sub process_interface( $$ ) {
|
||||
|
||||
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;
|
||||
} else {
|
||||
assert(0);
|
||||
@@ -1355,6 +1409,14 @@ sub process_interface( $$ ) {
|
||||
$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' ) {
|
||||
my $ipset = $family == F_IPV4 ? "${zone}" : "6_${zone}";
|
||||
$ipset = join( '_', $ipset, var_base1( $physical ) ) unless $zoneref->{options}{in_out}{dynamic_shared};
|
||||
@@ -1413,6 +1475,7 @@ sub process_interface( $$ ) {
|
||||
zones => {},
|
||||
origin => shortlineinfo( '' ),
|
||||
wildcard => $wildcard,
|
||||
physwild => $physwild, # Currently unused
|
||||
};
|
||||
|
||||
$interfaces{$physical} = $interfaceref if $physical ne $interface;
|
||||
@@ -1571,13 +1634,11 @@ sub known_interface($)
|
||||
|
||||
my $iface = $interface;
|
||||
|
||||
if ( $minroot ) {
|
||||
if ( defined $minroot ) {
|
||||
#
|
||||
# We have wildcard interfaces -- see if this interface matches one of their roots
|
||||
#
|
||||
while ( length $iface > $minroot ) {
|
||||
chop $iface;
|
||||
|
||||
while ( length $iface >= $minroot ) {
|
||||
if ( my $i = $roots{$iface} ) {
|
||||
#
|
||||
# Found one
|
||||
@@ -1599,6 +1660,8 @@ sub known_interface($)
|
||||
};
|
||||
return $interfaceref;
|
||||
}
|
||||
|
||||
chop $iface;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1812,7 +1875,8 @@ sub find_interfaces_by_option( $;$ ) {
|
||||
for my $interface ( @interfaces ) {
|
||||
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};
|
||||
if ( $nonzero ) {
|
||||
@@ -1827,35 +1891,6 @@ sub find_interfaces_by_option( $;$ ) {
|
||||
\@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
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# (c) 1999-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 1999-2017 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -369,7 +369,7 @@ replace_default_route() # $1 = USE_DEFAULT_RT
|
||||
delete_default_routes() # $1 = table number
|
||||
{
|
||||
$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
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ restore_default_route() # $1 = USE_DEFAULT_RT
|
||||
conditionally_flush_conntrack() {
|
||||
|
||||
if [ -n "$g_purge" ]; then
|
||||
if [ -n $(mywhich conntrack) ]; then
|
||||
if [ -n "$(mywhich conntrack)" ]; then
|
||||
conntrack -F
|
||||
else
|
||||
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_gateway() # $1 = interface
|
||||
detect_gateway() # $1 = interface $2 = table number
|
||||
{
|
||||
local interface
|
||||
interface=$1
|
||||
@@ -912,6 +912,8 @@ detect_gateway() # $1 = interface
|
||||
# Maybe there's a default route through this gateway already
|
||||
#
|
||||
[ -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?
|
||||
#
|
||||
|
@@ -78,11 +78,13 @@ reload_command() {
|
||||
detect_configuration
|
||||
define_firewall
|
||||
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 +129,10 @@ g_counters=
|
||||
g_compiled=
|
||||
g_file=
|
||||
g_docker=
|
||||
g_dockeringress=
|
||||
g_dockernetwork=
|
||||
g_forcereload=
|
||||
g_fallback=
|
||||
|
||||
[ -n "$SERVICEDIR" ] && SUBSYSLOCK=
|
||||
|
||||
@@ -264,8 +268,10 @@ case "$COMMAND" in
|
||||
error_message "$g_product is not running"
|
||||
status=2
|
||||
elif [ $# -eq 1 ]; then
|
||||
$g_tool -Z
|
||||
$g_tool -t mangle -Z
|
||||
for table in raw mangle nat filter; do
|
||||
qt $g_tool -t $table -Z
|
||||
done
|
||||
|
||||
date > ${VARDIR}/restarted
|
||||
status=0
|
||||
progress_message3 "$g_product Counters Reset"
|
||||
@@ -418,9 +424,12 @@ case "$COMMAND" in
|
||||
[ $# -ne 1 ] && usage 2
|
||||
mutex_on
|
||||
if product_is_started; then
|
||||
COMMAND=disable
|
||||
detect_configuration $1
|
||||
COMMAND=enable disable_provider $1 Yes
|
||||
COMMAND=disable enable_provider $1 Yes
|
||||
disable_provider $1 Yes
|
||||
COMMAND=enable
|
||||
detect_configuration $1
|
||||
enable_provider $1 Yes
|
||||
fi
|
||||
mutex_off
|
||||
status=0
|
||||
|
@@ -77,7 +77,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
|
||||
ARPTABLES=
|
||||
|
||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -205,8 +205,6 @@ MINIUPNPD=No
|
||||
|
||||
MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
|
||||
MULTICAST=No
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# 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
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -14,4 +14,4 @@
|
||||
?FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0
|
||||
net NET_IF dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0,physical=eth0
|
||||
|
@@ -88,7 +88,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
|
||||
ARPTABLES=
|
||||
|
||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -216,8 +216,6 @@ MINIUPNPD=No
|
||||
|
||||
MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
|
||||
MULTICAST=No
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# 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
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -14,6 +14,6 @@
|
||||
?FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 tcpflags,dhcp,nosmurfs,routefilter,logmartians,sourceroute=0
|
||||
loc eth1 tcpflags,nosmurfs,routefilter,logmartians
|
||||
dmz eth2 tcpflags,nosmurfs,routefilter,logmartians
|
||||
net NET_IF tcpflags,dhcp,nosmurfs,routefilter,logmartians,sourceroute=0,physical=eth0
|
||||
loc LOC_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth1
|
||||
dmz DMZ_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth2
|
||||
|
@@ -85,7 +85,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
|
||||
ARPTABLES=
|
||||
|
||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -213,8 +213,6 @@ MINIUPNPD=No
|
||||
|
||||
MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
|
||||
MULTICAST=No
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# 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
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,4 +20,4 @@
|
||||
MASQUERADE 10.0.0.0/8,\
|
||||
169.254.0.0/16,\
|
||||
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.
|
||||
# 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
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -13,8 +13,8 @@
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||
# PORT(S) PORT(S)
|
||||
ACCEPT eth1 -
|
||||
ACCEPT - eth1
|
||||
ACCEPT eth2 -
|
||||
ACCEPT - eth2
|
||||
ACCEPT LOC_IF -
|
||||
ACCEPT - LOC_IF
|
||||
ACCEPT DMZ_IF -
|
||||
ACCEPT - DMZ_IF
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# 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
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -14,5 +14,5 @@
|
||||
?FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0
|
||||
loc eth1 tcpflags,nosmurfs,routefilter,logmartians
|
||||
net NET_IF dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0,physical=eth0
|
||||
loc LOC_IF tcpflags,nosmurfs,routefilter,logmartians,physical=eth1
|
||||
|
@@ -88,7 +88,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
|
||||
ARPTABLES=
|
||||
|
||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -216,8 +216,6 @@ MINIUPNPD=No
|
||||
|
||||
MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
|
||||
MULTICAST=No
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# 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
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,4 +20,4 @@
|
||||
MASQUERADE 10.0.0.0/8,\
|
||||
169.254.0.0/16,\
|
||||
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.
|
||||
# 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
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -13,5 +13,5 @@
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||
# PORT(S) PORT(S)
|
||||
ACCEPT eth1 -
|
||||
ACCEPT - eth1
|
||||
ACCEPT LOC_IF -
|
||||
ACCEPT - LOC_IF
|
||||
|
@@ -21,35 +21,46 @@ allowMcast inline # Silently Allow Multicast
|
||||
AutoBL noinline # Auto-blacklist IPs that exceed thesholds
|
||||
AutoBLL noinline # Helper for AutoBL
|
||||
BLACKLIST logjump,section # Add sender to the dynamic blacklist
|
||||
?if __ADDRTYPE
|
||||
Broadcast inline,audit # Handles Broadcast/Anycast
|
||||
?else
|
||||
Broadcast noinline,audit # Handles Broadcast/Anycast
|
||||
DNSAmp # Matches one-question recursive DNS queries
|
||||
?endif
|
||||
DNSAmp proto=17 # Matches one-question recursive DNS queries
|
||||
Drop # Default Action for DROP policy (deprecated)
|
||||
dropBcast inline # Silently Drop Broadcast
|
||||
dropBcasts inline # Silently Drop Broadcast
|
||||
dropBcasts inline # Silently Drop Broadcast
|
||||
dropInvalid inline # Drops packets in the INVALID conntrack state
|
||||
dropMcast inline # Silently Drop Multicast
|
||||
dropNotSyn noinline # Silently Drop Non-syn TCP packets
|
||||
DropDNSrep inline # Drops DNS replies
|
||||
dropNotSyn noinline,proto=6 # Silently Drop Non-syn TCP packets
|
||||
DropDNSrep inline,proto=17 # Drops DNS replies
|
||||
DropSmurfs noinline # Drop smurf packets
|
||||
Established inline,\ # Handles packets in the ESTABLISHED state
|
||||
state=ESTABLISHED #
|
||||
FIN inline,audit # Handles ACK,FIN,PSH packets
|
||||
FIN inline,audit,\ # Handles ACK,FIN packets
|
||||
proto=6
|
||||
forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces.
|
||||
GlusterFS inline # Handles GlusterFS
|
||||
IfEvent noinline # Perform an action based on an event
|
||||
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
|
||||
state=INVALID #
|
||||
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
|
||||
?endif
|
||||
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
|
||||
rejNotSyn noinline # Silently Reject Non-syn TCP packets
|
||||
NotSyn inline,audit,\ # Handles TCP packets which do not have SYN=1 and ACK=0
|
||||
proto=6
|
||||
rejNotSyn noinline,proto=6 # Silently Reject Non-syn TCP packets
|
||||
Reject # Default Action for REJECT policy (deprecated)
|
||||
Related inline,\ # Handles packets in the RELATED conntrack state
|
||||
state=RELATED #
|
||||
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
|
||||
TCPFlags # Handle bad flag combinations.
|
||||
TCPFlags proto=6 # Handle bad flag combinations.
|
||||
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
|
||||
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
|
@@ -77,7 +77,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
|
||||
ARPTABLES=
|
||||
|
||||
CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -205,8 +205,6 @@ MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MINIUPNPD=No
|
||||
|
||||
MODULE_SUFFIX=ko
|
||||
|
||||
MULTICAST=No
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
@@ -3,4 +3,4 @@
|
||||
#
|
||||
# /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
@@ -211,30 +211,35 @@ get_config() {
|
||||
LOG_VERBOSITY=-1
|
||||
fi
|
||||
|
||||
if [ -n "$SHOREWALL_SHELL" -a -z "$g_export" ]; then
|
||||
if [ ! -x "$SHOREWALL_SHELL" ]; then
|
||||
echo " WARNING: The program specified in SHOREWALL_SHELL does not exist or is not executable; falling back to /bin/sh" >&2
|
||||
SHOREWALL_SHELL=/bin/sh
|
||||
if [ -z "${g_export}${g_test}" ]; then
|
||||
if [ -n "$SHOREWALL_SHELL" ]; then
|
||||
if [ ! -x "$SHOREWALL_SHELL" ]; then
|
||||
echo " WARNING: The program specified in SHOREWALL_SHELL does not exist or is not executable; falling back to /bin/sh" >&2
|
||||
SHOREWALL_SHELL=/bin/sh
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$IP" ]; then
|
||||
case "$IP" in
|
||||
*/*)
|
||||
if [ ! -x "$IP" ] ; then
|
||||
fatal_error "The program specified in IP ($IP) does not exist or is not executable"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
prog="$(mywhich $IP 2> /dev/null)"
|
||||
if [ -z "$prog" ] ; then
|
||||
fatal_error "Can't find $IP executable"
|
||||
fi
|
||||
IP=$prog
|
||||
;;
|
||||
esac
|
||||
if [ -n "$IP" ]; then
|
||||
case "$IP" in
|
||||
*/*)
|
||||
if [ ! -x "$IP" ] ; then
|
||||
fatal_error "The program specified in IP ($IP) does not exist or is not executable"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
prog="$(mywhich $IP 2> /dev/null)"
|
||||
if [ -z "$prog" ] ; then
|
||||
fatal_error "Can't find $IP executable"
|
||||
fi
|
||||
IP=$prog
|
||||
;;
|
||||
esac
|
||||
else
|
||||
IP='ip'
|
||||
fi
|
||||
else
|
||||
IP='ip'
|
||||
[ -n "$SHOREWALL_SHELL" ] || SHOREWALL_SHELL=/bin/sh
|
||||
[ -n "$IP" ] || IP='ip'
|
||||
fi
|
||||
|
||||
case $VERBOSITY in
|
||||
@@ -367,13 +372,21 @@ uptodate() {
|
||||
local dir
|
||||
local ifs
|
||||
|
||||
if [ -n "$g_shorewalldir" ]; then
|
||||
if [ -n "$(find ${dir} -maxdepth 1 -newer $1)" ]; then
|
||||
return 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
ifs="$IFS"
|
||||
IFS=':'
|
||||
|
||||
for dir in $g_shorewalldir $CONFIG_PATH; do
|
||||
if [ -n "$(find ${dir} -newer $1)" ]; then
|
||||
IFS="$ifs"
|
||||
return 1;
|
||||
for dir in $CONFIG_PATH; do
|
||||
if [ -n "$dir" ]; then
|
||||
if [ -n "$(find ${dir} -maxdepth 1 -newer $1)" ]; then
|
||||
IFS="$ifs"
|
||||
return 1;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -770,6 +783,10 @@ check_command() {
|
||||
g_profile=Yes
|
||||
option=${option#p}
|
||||
;;
|
||||
t*)
|
||||
g_test=Yes
|
||||
option=${option#t}
|
||||
;;
|
||||
d*)
|
||||
g_debug=Yes;
|
||||
option=${option#d}
|
||||
@@ -854,6 +871,10 @@ update_command() {
|
||||
g_profile=Yes
|
||||
option=${option#p}
|
||||
;;
|
||||
t*)
|
||||
g_test=Yes
|
||||
option=${option#t}
|
||||
;;
|
||||
d*)
|
||||
g_debug=Yes;
|
||||
option=${option#d}
|
||||
@@ -1527,6 +1548,8 @@ remote_reload_command() # $* = original arguments less the command.
|
||||
litedir="${VARDIR}-lite"
|
||||
fi
|
||||
|
||||
g_export=Yes
|
||||
|
||||
if [ -f $g_shorewalldir/${PRODUCT}.conf ]; then
|
||||
if [ -f $g_shorewalldir/params ]; then
|
||||
. $g_shorewalldir/params
|
||||
@@ -1556,18 +1579,16 @@ remote_reload_command() # $* = original arguments less the command.
|
||||
|
||||
progress_message "Getting Capabilities on system $system..."
|
||||
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"
|
||||
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"
|
||||
fi
|
||||
fi
|
||||
|
||||
file=$(resolve_file $g_shorewalldir/firewall)
|
||||
|
||||
g_export=Yes
|
||||
|
||||
program=$sbindir/${PRODUCT}-lite
|
||||
#
|
||||
# Handle nonstandard remote VARDIR
|
||||
|
@@ -791,11 +791,7 @@
|
||||
<title>See ALSO</title>
|
||||
|
||||
<para><ulink
|
||||
url="/Accounting.html">http://www.shorewall.net/Accounting.html
|
||||
</ulink></para>
|
||||
|
||||
<para><ulink
|
||||
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink></para>
|
||||
url="shorewall-logging.htm">shorewall-logging(5)</ulink></para>
|
||||
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
||||
|
@@ -191,6 +191,27 @@
|
||||
</listitem>
|
||||
</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>
|
||||
<term><option>section</option></term>
|
||||
|
||||
|
@@ -167,7 +167,7 @@
|
||||
<listitem>
|
||||
<para>queues matching packets to a back end logging daemon via
|
||||
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>
|
||||
</varlistentry>
|
||||
|
||||
@@ -258,7 +258,7 @@
|
||||
<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
|
||||
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
|
||||
string of alphanumeric characters) which is appended to the string
|
||||
|
@@ -447,7 +447,7 @@
|
||||
|
||||
<listitem>
|
||||
<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>
|
||||
</varlistentry>
|
||||
|
||||
@@ -543,7 +543,7 @@
|
||||
|
||||
<listitem>
|
||||
<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>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@@ -104,9 +104,7 @@ loc eth2 -</programlisting>
|
||||
<para>You may use wildcards here by specifying a prefix followed by
|
||||
the plus sign ("+"). For example, if you want to make an entry that
|
||||
applies to all PPP interfaces, use 'ppp+'; that would match ppp0,
|
||||
ppp1, ppp2, … Please note that the '+' means '<emphasis
|
||||
role="bold">one</emphasis> or more additional characters' so 'ppp'
|
||||
does not match 'ppp+'.</para>
|
||||
ppp1, ppp2, …</para>
|
||||
|
||||
<para>When using Shorewall versions before 4.1.4, care must be
|
||||
exercised when using wildcards where there is another zone that uses
|
||||
@@ -114,7 +112,10 @@ loc eth2 -</programlisting>
|
||||
url="/manpages/shorewall-nesting.html">shorewall-nesting</ulink>(5)
|
||||
for a discussion of this problem.</para>
|
||||
|
||||
<para>Shorewall allows '+' as an interface name.</para>
|
||||
<para>Shorewall allows '+' as an interface name, but that usage is
|
||||
deprecated. A better approach is to specify
|
||||
'<option>physical</option>=+' in the OPTIONS column (see
|
||||
below).</para>
|
||||
|
||||
<para>There is no need to define the loopback interface (lo) in this
|
||||
file.</para>
|
||||
@@ -195,6 +196,54 @@ loc eth2 -</programlisting>
|
||||
should have no embedded white-space.</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">accept_ra</emphasis>[={0|1|2}]</term>
|
||||
|
||||
<listitem>
|
||||
<para>IPv6 only; added in Shorewall 4.5.16. Values are:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>0</term>
|
||||
|
||||
<listitem>
|
||||
<para>Do not accept Router Advertisements.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>1</term>
|
||||
|
||||
<listitem>
|
||||
<para>Accept Route Advertisements if forwarding is
|
||||
disabled.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>2</term>
|
||||
|
||||
<listitem>
|
||||
<para>Overrule forwarding behavior. Accept Route
|
||||
Advertisements even if forwarding is enabled.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>If the option is specified without a value, then the
|
||||
value 1 is assumed.</para>
|
||||
|
||||
<note>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">arp_filter[={0|1}]</emphasis></term>
|
||||
|
||||
@@ -211,12 +260,12 @@ loc eth2 -</programlisting>
|
||||
changed; the value assigned to the setting will be the value
|
||||
specified (if any) or 1 if no value is given.</para>
|
||||
|
||||
<para/>
|
||||
|
||||
<note>
|
||||
<para>This option does not work with a wild-card
|
||||
<replaceable>interface</replaceable> name (e.g., eth0.+) in
|
||||
the INTERFACE column.</para>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -245,16 +294,14 @@ loc eth2 -</programlisting>
|
||||
|
||||
<para>8 - do not reply for all local addresses</para>
|
||||
|
||||
<para/>
|
||||
|
||||
<note>
|
||||
<para>This option does not work with a wild-card
|
||||
<replaceable>interface</replaceable> name (e.g., eth0.+) in
|
||||
the INTERFACE column.</para>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
|
||||
<para/>
|
||||
|
||||
<warning>
|
||||
<para>Do not specify <emphasis
|
||||
role="bold">arp_ignore</emphasis> for any interface involved
|
||||
@@ -432,6 +479,25 @@ loc eth2 -</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">forward</emphasis>[={0|1}]</term>
|
||||
|
||||
<listitem>
|
||||
<para>IPv6 only Sets the
|
||||
/proc/sys/net/ipv6/conf/interface/forwarding option to the
|
||||
specified value. If no value is supplied, then 1 is
|
||||
assumed.</para>
|
||||
|
||||
<note>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">ignore[=1]</emphasis></term>
|
||||
|
||||
@@ -498,9 +564,11 @@ loc eth2 -</programlisting>
|
||||
<para/>
|
||||
|
||||
<note>
|
||||
<para>This option does not work with a wild-card
|
||||
<replaceable>interface</replaceable> name (e.g., eth0.+) in
|
||||
the INTERFACE column.</para>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
|
||||
<blockquote>
|
||||
@@ -627,7 +695,10 @@ loc eth2 -</programlisting>
|
||||
|
||||
<para>If the <emphasis>interface</emphasis> name is a wildcard
|
||||
name (ends with '+'), then the physical
|
||||
<emphasis>name</emphasis> must also end in '+'.</para>
|
||||
<emphasis>name</emphasis> must also end in '+'. The physical
|
||||
<replaceable>name</replaceable> may end in '+' (or be exactly
|
||||
'+') when the <replaceable>interface</replaceable> name is not
|
||||
a wildcard name.</para>
|
||||
|
||||
<para>If <option>physical</option> is not specified, then it's
|
||||
value defaults to the <emphasis>interface</emphasis>
|
||||
@@ -649,9 +720,13 @@ loc eth2 -</programlisting>
|
||||
url="http://tldp.org/HOWTO/Proxy-ARP-Subnet/index.html">http://tldp.org/HOWTO/Proxy-ARP-Subnet/index.html.
|
||||
</ulink></para>
|
||||
|
||||
<para><emphasis role="bold">Note</emphasis>: This option does
|
||||
not work with a wild-card <replaceable>interface</replaceable>
|
||||
name (e.g., eth0.+) in the INTERFACE column.</para>
|
||||
<note>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
|
||||
<para>Only those interfaces with the <option>proxyarp</option>
|
||||
option will have their setting changed; the value assigned to
|
||||
@@ -667,9 +742,13 @@ loc eth2 -</programlisting>
|
||||
<para>IPv6 only. Sets
|
||||
/proc/sys/net/ipv6/conf/<emphasis>interface</emphasis>/proxy_ndp.</para>
|
||||
|
||||
<para><emphasis role="bold">Note</emphasis>: This option does
|
||||
not work with a wild-card <replaceable>interface</replaceable>
|
||||
name (e.g., eth0.+) in the INTERFACE column.</para>
|
||||
<note>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
|
||||
<para>Only those interfaces with the <option>proxyndp</option>
|
||||
option will have their setting changed; the value assigned to
|
||||
@@ -733,9 +812,11 @@ loc eth2 -</programlisting>
|
||||
filtering.</para>
|
||||
|
||||
<note>
|
||||
<para>This option does not work with a wild-card
|
||||
<replaceable>interface</replaceable> name (e.g., eth0.+) in
|
||||
the INTERFACE column.</para>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
|
||||
<para>This option can also be enabled globally via the
|
||||
@@ -844,9 +925,11 @@ loc eth2 -</programlisting>
|
||||
specified (if any) or 1 if no value is given.</para>
|
||||
|
||||
<note>
|
||||
<para>This option does not work with a wild-card
|
||||
<replaceable>interface</replaceable> name (e.g., eth0.+) in
|
||||
the INTERFACE column.</para>
|
||||
<para>This option does not work with a wild-card <emphasis
|
||||
role="bold">physical</emphasis> name (e.g., eth0.+).
|
||||
Beginning with Shorewall 5.1.10, If this option is
|
||||
specified, a warning is issued and the option is
|
||||
ignored.</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
385
Shorewall/manpages/shorewall-logging.xml
Normal file
385
Shorewall/manpages/shorewall-logging.xml
Normal file
@@ -0,0 +1,385 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<refentry>
|
||||
<refmeta>
|
||||
<refentrytitle>shorewall-logging</refentrytitle>
|
||||
|
||||
<manvolnum>5</manvolnum>
|
||||
|
||||
<refmiscinfo>Configuration Files</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>logging</refname>
|
||||
|
||||
<refpurpose>Shorewall logging</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command><replaceable>action</replaceable>:<replaceable>level</replaceable></command>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>NFLOG(<replaceable>nflog-parameters</replaceable>)</command>
|
||||
</cmdsynopsis>
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>ULOG(<replaceable>ulog-parameters</replaceable>)</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>The disposition of packets entering a Shorewall firewall is
|
||||
determined by one of a number of Shorewall facilities. Only some of these
|
||||
facilities permit logging.</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>The packet is part of an established connection. While the
|
||||
packet can be logged using LOG rules in the ESTABLISHED section of
|
||||
<ulink
|
||||
url="manpages/shorewall-rules.html">/etc/shorewall/rules</ulink>, that
|
||||
is not recommended because of the large amount of information that may
|
||||
be logged.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The packet represents a connection request that is related to an
|
||||
established connection (such as a <ulink url="FTP.html">data
|
||||
connection associated with an FTP control connection</ulink>). These
|
||||
packets may be logged using LOG rules in the RELATED section of <ulink
|
||||
url="manpages/shorewall-rules.html">shorewall-rules(5)</ulink>.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The packet is rejected because of an option in <ulink
|
||||
url="manpages/shorewall.conf.html">shorewall.conf</ulink>(5) or <ulink
|
||||
url="manpages/shorewall-interfaces.html">shorewall-interfaces(5)</ulink>.
|
||||
These packets can be logged by setting the appropriate logging-related
|
||||
option in <ulink
|
||||
url="manpages/shorewall.conf.html">/etc/shorewall/shorewall.conf</ulink>.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The packet matches a rule in <ulink
|
||||
url="manpages/shorewall-rules.html">shorewall-rules</ulink>(5). By
|
||||
including a syslog level (see below) in the ACTION column of a rule
|
||||
(e.g., <quote>ACCEPT<emphasis role="bold">:info</emphasis> net $FW tcp
|
||||
22</quote>), the connection attempt will be logged at that
|
||||
level.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The packet doesn't match a rule so it is handled by a policy
|
||||
defined in <ulink
|
||||
url="manpages/shorewall-policy.html">shorewall-policy(5)</ulink>.
|
||||
These may be logged by specifying a syslog level in the LOG LEVEL
|
||||
column of the policy's entry (e.g., <quote>loc net ACCEPT <emphasis
|
||||
role="bold">info</emphasis></quote>).</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Default Logging</title>
|
||||
|
||||
<para>By default, Shorewall directs Netfilter to log using syslog (8).
|
||||
Syslog classifies log messages by a <emphasis>facility</emphasis> and a
|
||||
<emphasis>priority</emphasis> (using the notation
|
||||
<emphasis>facility.priority</emphasis>).</para>
|
||||
|
||||
<para>The facilities defined by syslog are <emphasis>auth, authpriv, cron,
|
||||
daemon, kern, lpr, mail, mark, news, syslog, user, uucp</emphasis> and
|
||||
<emphasis>local0</emphasis> through <emphasis>local7.</emphasis></para>
|
||||
|
||||
<para>Throughout the Shorewall documentation, the term
|
||||
<emphasis>level</emphasis> rather than <emphasis>priority is used,
|
||||
</emphasis>since <emphasis>level</emphasis> is the term used by Netfilter.
|
||||
The syslog documentation uses the term
|
||||
<emphasis>priority</emphasis>.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Syslog Levels</title>
|
||||
|
||||
<para>Syslog levels are a method of describing to syslog (8) the
|
||||
importance of a message. A number of Shorewall parameters have a syslog
|
||||
level as their value.</para>
|
||||
|
||||
<para>Valid levels are:</para>
|
||||
|
||||
<simplelist>
|
||||
<member>7 - <emphasis role="bold">debug</emphasis> (Debug-level
|
||||
messages)</member>
|
||||
|
||||
<member>6 - <emphasis role="bold">info</emphasis>
|
||||
(Informational)</member>
|
||||
|
||||
<member>5 - <emphasis role="bold">notice</emphasis> (Normal but
|
||||
significant Condition)</member>
|
||||
|
||||
<member>4 - <emphasis role="bold">warning</emphasis> (Warning
|
||||
Condition)</member>
|
||||
|
||||
<member>3 - <emphasis role="bold">err</emphasis> (Error
|
||||
Condition)</member>
|
||||
|
||||
<member>2 - <emphasis role="bold">crit</emphasis> (Critical
|
||||
Conditions)</member>
|
||||
|
||||
<member>1 - <emphasis role="bold">alert</emphasis> (must be handled
|
||||
immediately)</member>
|
||||
|
||||
<member>0 - <emphasis role="bold">emerg</emphasis> (System is
|
||||
unusable)</member>
|
||||
</simplelist>
|
||||
|
||||
<para>For most Shorewall logging, a level of 6 (info) is appropriate.
|
||||
Shorewall log messages are generated by Netfilter and are logged using the
|
||||
<emphasis>kern</emphasis> facility and the level that you specify. If you
|
||||
are unsure of the level to choose, 6 (info) is a safe bet. You may specify
|
||||
levels by name or by number.</para>
|
||||
|
||||
<para>Beginning with Shorewall 4.5.5, the <replaceable>level</replaceable>
|
||||
name or number may be optionally followed by a comma-separated list of one
|
||||
or more<replaceable> log options</replaceable>. The list is enclosed in
|
||||
parentheses. Log options cause additional information to be included in
|
||||
each log message.</para>
|
||||
|
||||
<para>Valid log options are:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">ip_options</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Log messages will include the option settings from the IP
|
||||
header.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">macdecode</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Decode the MAC address and protocol.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">tcp_sequence</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Include TCP sequence numbers.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">tcp_options</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Include options from the TCP header.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">uid</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Include the UID of the sending program; only valid for packets
|
||||
originating on the firewall itself.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>Example: <emphasis
|
||||
role="bold">info(tcp_options,tcp_sequence)</emphasis></para>
|
||||
|
||||
<para>Syslogd writes log messages to files (typically in <filename
|
||||
class="directory">/var/log/</filename>*) based on their facility and
|
||||
level. The mapping of these facility/level pairs to log files is done in
|
||||
/etc/syslog.conf (5). If you make changes to this file, you must restart
|
||||
syslogd before the changes can take effect.</para>
|
||||
|
||||
<para>Syslog may also write to your system console. See <ulink
|
||||
url="FAQ.htm#faq16">Shorewall FAQ 16</ulink> for ways to avoid having
|
||||
Shorewall messages written to the console.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Configuring a Separate Log for Shorewall Messages (ulogd)</title>
|
||||
|
||||
<para>There are a couple of limitations to syslogd-based logging:</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>If you give, for example, kern.info its own log destination then
|
||||
that destination will also receive all kernel messages of levels 5
|
||||
(notice) through 0 (emerg).</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>All kernel.info messages will go to that destination and not
|
||||
just those from Netfilter.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Netfilter (Shorewall) messages show up in
|
||||
<command>dmesg</command>.</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>If your kernel has NFLOG target support (and most vendor-supplied
|
||||
kernels do), you may also specify a log level of NFLOG (must be all caps).
|
||||
When NFLOG is used, Shorewall will direct Netfilter to log the related
|
||||
messages via the NFLOG target which will send them to a process called
|
||||
<quote>ulogd</quote>. The ulogd program is included in most
|
||||
distributions.</para>
|
||||
|
||||
<note>
|
||||
<para>The NFLOG logging mechanism is <emphasis
|
||||
role="underline">completely separate</emphasis> from syslog. Once you
|
||||
switch to NFLOG, the settings in <filename>/etc/syslog.conf</filename>
|
||||
have absolutely no effect on your Shorewall logging (except for
|
||||
Shorewall status messages which still go to syslog).</para>
|
||||
</note>
|
||||
|
||||
<para>You will need to change all instances of log levels (usually
|
||||
<quote>info</quote>) in your Shorewall configuration files to
|
||||
<quote>NFLOG</quote> - this includes entries in the policy, rules and
|
||||
shorewall.conf files. If you initially installed using Shorewall 5.1.2 or
|
||||
later, you can simply change the setting of LOG_LEVEL in
|
||||
shorewall.conf.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Understanding the Contents of Shorewall Log Messages</title>
|
||||
|
||||
<para>For general information on the contents of Netfilter log messages,
|
||||
see <ulink
|
||||
url="http://logi.cc/en/2010/07/netfilter-log-format/">http://logi.cc/en/2010/07/netfilter-log-format/</ulink>.</para>
|
||||
|
||||
<para>For Shorewall-specific information, see <ulink
|
||||
url="/FAQ.htm#faq17">FAQ #17</ulink>.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Customizing the Content of Shorewall Log Messages</title>
|
||||
|
||||
<para>In a Shorewall logging rule, the log level can be followed by a
|
||||
<firstterm>log tag</firstterm> as in "DROP:NFLOG:junk". The generated log
|
||||
message will include "<emphasis>chain-name</emphasis> junk DROP".</para>
|
||||
|
||||
<para>By setting the LOGTAGONLY option to Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink> or <ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>, the
|
||||
disposition ('DROP' in the above example) will be omitted. Consider the
|
||||
following rule:</para>
|
||||
|
||||
<programlisting>#ACTION SOURCE DEST PROTO
|
||||
REJECT(icmp-proto-unreachable):notice:IPv6 loc net 41 # who's using IPv6 tunneling</programlisting>
|
||||
|
||||
<para>This rule generates the following warning at compile time:</para>
|
||||
|
||||
<simplelist>
|
||||
<member>WARNING: Log Prefix shortened to "Shorewall:IPv6:REJECT(icmp-p "
|
||||
/etc/shorewall/rules (line 212)</member>
|
||||
</simplelist>
|
||||
|
||||
<para>and produces the rather ugly prefix "Shorewall:IPv6:REJECT(icmp-p
|
||||
".</para>
|
||||
|
||||
<para>Now consider this similar rule:</para>
|
||||
|
||||
<programlisting>#ACTION SOURCE DEST PROTO
|
||||
REJECT(icmp-proto-unreachable):notice:IPv6,tunneling loc net 41 # who's using IPv6 tunneling</programlisting>
|
||||
|
||||
<para>With LOGTAGONLY=Yes, no warning is generated and the prefix becomes
|
||||
"Shorewall:IPv6:tunneling:"</para>
|
||||
|
||||
<para>See the <ulink url="shorewall.conf.html">shorewall[6].conf man
|
||||
page</ulink> for further information about how LOGTAGONLY=Yes can be
|
||||
used.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Log Backends</title>
|
||||
|
||||
<para>Netfilter logging allows configuration of multiple backends. Logging
|
||||
backends provide the The low-level forward of log messages. There are
|
||||
currently three backends:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>LOG (ipt_LOG and ip6t_LOG).</term>
|
||||
|
||||
<listitem>
|
||||
<para>Normal kernel-based logging to a syslog daemon.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>ULOG (ipt_ULOG)</term>
|
||||
|
||||
<listitem>
|
||||
<para>ULOG logging as described ablve. Only available for
|
||||
IPv4.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>netlink (nfnetlink_log)</term>
|
||||
|
||||
<listitem>
|
||||
<para>The logging backend behind NFLOG, defined above.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>The currently-available and currently-selected IPv4 and IPv6
|
||||
backends are shown in /proc/sys/net/netfilter/nf_log:</para>
|
||||
|
||||
<programlisting>cat /proc/net/netfilter/nf_log
|
||||
0 NONE (nfnetlink_log)
|
||||
1 NONE (nfnetlink_log)
|
||||
2 ipt_ULOG (ipt_ULOG,ipt_LOG,nfnetlink_log)
|
||||
3 NONE (nfnetlink_log)
|
||||
4 NONE (nfnetlink_log)
|
||||
5 NONE (nfnetlink_log)
|
||||
6 NONE (nfnetlink_log)
|
||||
7 NONE (nfnetlink_log)
|
||||
8 NONE (nfnetlink_log)
|
||||
9 NONE (nfnetlink_log)
|
||||
10 ip6t_LOG (ip6t_LOG,nfnetlink_log)
|
||||
11 NONE (nfnetlink_log)
|
||||
12 NONE (nfnetlink_log)</programlisting>
|
||||
|
||||
<para>The magic numbers (0-12) are Linux address family numbers (AF_INET
|
||||
is 2 and AF_INET6 is 10).</para>
|
||||
|
||||
<para>The name immediately following the number is the currently-selected
|
||||
backend, and the ones in parentheses are the ones that are available. You
|
||||
can change the currently selected backend by echoing it's name into
|
||||
/proc/net/netfilter/nf_log.<replaceable>number</replaceable>.</para>
|
||||
|
||||
<para>Example - change the IPv4 backend to LOG:</para>
|
||||
|
||||
<programlisting>sysctl net.netfilter.nf_log.2=ipt_LOG</programlisting>
|
||||
|
||||
<para>Beginning with Shorewall 4.6.4, you can configure the backend using
|
||||
the LOG_BACKEND option in <ulink
|
||||
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink> and <ulink
|
||||
url="manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>SEE ALSO</title>
|
||||
|
||||
<para><ulink
|
||||
url="/shorewall_logging.htm">http://www.shorewall.net/shorewall_logging.html</ulink></para>
|
||||
</refsect1>
|
||||
</refentry>
|
@@ -674,6 +674,43 @@ SAME $FW 0.0.0.0/0 tcp 80,443</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">TCPMSS</emphasis>([<replaceable>mss</replaceable>[,<replaceable>ipsec</replaceable>]])</term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.1.9. This target only applies to
|
||||
TCP traffic and alters the MSS value in SYN packets. It may be
|
||||
used in the FORWARD and POSTROUTING chains; the default is
|
||||
FORWARD.</para>
|
||||
|
||||
<para>The <replaceable>mss</replaceable> parameter may be
|
||||
either <option>pmtu</option> or an integer in the range
|
||||
500:65533. The value <option>pmtu</option> automatically
|
||||
clamps the MSS value to (path_MTU - 40 for IPv4; -60 for
|
||||
IPv6). This may not function as desired where asymmetric
|
||||
routes with differing path MTU exist — the kernel uses the
|
||||
path MTU which it would use to send packets from itself to the
|
||||
source and destination IP addresses. Prior to Linux 2.6.25,
|
||||
only the path MTU to the destination IP address was considered
|
||||
by this option; subsequent kernels also consider the path MTU
|
||||
to the source IP address. If an integer is given, the MSS
|
||||
option is set to the specified value. If the MSS of the packet
|
||||
is already lower than <replaceable>mss</replaceable>, it will
|
||||
not be increased (from Linux 2.6.25 onwards) to avoid more
|
||||
problems with hosts relying on a proper MSS. If
|
||||
<replaceable>mss</replaceable> is omitted,
|
||||
<option>pmtu</option> is assumed.</para>
|
||||
|
||||
<para>The <replaceable>ipsec</replaceable> parameter
|
||||
determines whether the rule applies to IPSEC traffic
|
||||
(<option>ipsec</option> is passed), non-IPSEC traffic
|
||||
(<option>none</option> is passed) or both
|
||||
(<option>all</option> is passed). If omitted,
|
||||
<option>all</option> is assumed.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">TOS</emphasis>(<replaceable>tos</replaceable>[/<replaceable>mask</replaceable>])</term>
|
||||
@@ -710,7 +747,7 @@ Normal-Service => 0x00</programlisting>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">TPROXY</emphasis>([<replaceable>port</replaceable>][,<replaceable>address</replaceable>])</term>
|
||||
role="bold">TPROXY</emphasis>([<replaceable>port</replaceable>[,<replaceable>address</replaceable>]])</term>
|
||||
|
||||
<listitem>
|
||||
<para>Transparently redirects a packet without altering the IP
|
||||
|
@@ -51,7 +51,7 @@
|
||||
|
||||
<para>The <replaceable>modulename</replaceable> names a kernel module
|
||||
(without suffix). Shorewall will search for modules based on your
|
||||
MODULESDIR and MODULE_SUFFIX settings in <ulink
|
||||
MODULESDIR setting in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(8). The
|
||||
<replaceable>moduleoption</replaceable>s are passed to modprobe (if
|
||||
installed) or to insmod.</para>
|
||||
|
@@ -279,8 +279,8 @@
|
||||
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>
|
||||
|
||||
<para>For a description of log levels, see <ulink
|
||||
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
|
||||
<para>For a description of logging, see <ulink
|
||||
url="/shorewall_logging.html">shorewall-logging(5)</ulink>.</para>
|
||||
|
||||
<para>If you don't want to log but need to specify the following
|
||||
column, place "-" here.</para>
|
||||
|
@@ -84,7 +84,7 @@
|
||||
|
||||
<para>If PROVIDER_OFFSET is non-zero in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>, then
|
||||
the value must be a mutiple of 2^^PROVIDER_OFFSET. In all cases, the
|
||||
the value must be a multiple of 2^^PROVIDER_OFFSET. In all cases, the
|
||||
number of significant bits may not exceed PROVIDER_OFFSET +
|
||||
PROVIDER_BITS.</para>
|
||||
</listitem>
|
||||
@@ -214,7 +214,14 @@
|
||||
BALANCE_PROVIDERS=Yes, <option>balance=1</option> is assumed
|
||||
unless the <option>fallback</option>, <option>loose</option>,
|
||||
<option>load</option> or <option>tproxy</option> option is
|
||||
specified.</para>
|
||||
specified.I</para>
|
||||
|
||||
<caution>
|
||||
<para>In IPV6, the <option>balance</option> option does not
|
||||
cause balanced default routes to be created; it rather
|
||||
causes a sequence of default routes with different metrics
|
||||
to be created.</para>
|
||||
</caution>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -337,6 +344,14 @@
|
||||
<para>Prior to Shorewall 4.4.24, the option is ignored with a
|
||||
warning message if USE_DEFAULT_RT=Yes in
|
||||
<filename>shorewall.conf</filename>.</para>
|
||||
|
||||
<caution>
|
||||
<para>In IPV6, specifying the <option>fallback</option>
|
||||
option on multiple providers does not cause balanced
|
||||
fallback routes to be created; it rather causes a sequence
|
||||
of fallback routes with different metrics to be
|
||||
created.</para>
|
||||
</caution>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -423,6 +438,14 @@
|
||||
<command>enable</command> and <command>reenable</command>
|
||||
commands can reenable the provider.</para>
|
||||
</note>
|
||||
|
||||
<important>
|
||||
<para>RESTORE_DEFAULT_OPTION=Yes in shorewall[6].conf is not
|
||||
recommended when the <option>persistent</option> option is
|
||||
used, as restoring default routes to the main routing table
|
||||
can prevent link status monitors such as foolsm from
|
||||
correctly detecting non-working providers.</para>
|
||||
</important>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
@@ -67,7 +67,7 @@
|
||||
this section.</para>
|
||||
|
||||
<para>The only ACTIONs allowed in this section are ACCEPT, DROP,
|
||||
REJECT, LOG, NFQUEUE and QUEUE</para>
|
||||
REJECT, LOG, NFLOG, NFQUEUE and QUEUE</para>
|
||||
|
||||
<para>There is an implicit ACCEPT rule inserted at the end of this
|
||||
section.</para>
|
||||
@@ -82,7 +82,7 @@
|
||||
section.</para>
|
||||
|
||||
<para>The only ACTIONs allowed in this section are ACCEPT, DROP,
|
||||
REJECT, LOG, NFQUEUE and QUEUE</para>
|
||||
REJECT, LOG, NFLOG, NFQUEUE and QUEUE</para>
|
||||
|
||||
<para>There is an implicit rule added at the end of this section
|
||||
that invokes the RELATED_DISPOSITION (<ulink
|
||||
@@ -98,7 +98,7 @@
|
||||
processed by rules in this section.</para>
|
||||
|
||||
<para>The only Actions allowed in this section are ACCEPT, DROP,
|
||||
REJECT, LOG, NFQUEUE and QUEUE.</para>
|
||||
REJECT, LOG, NFLOG, NFQUEUE and QUEUE.</para>
|
||||
|
||||
<para>There is an implicit rule added at the end of this section
|
||||
that invokes the INVALID_DISPOSITION (<ulink
|
||||
@@ -114,7 +114,7 @@
|
||||
processed by rules in this section.</para>
|
||||
|
||||
<para>The only Actions allowed in this section are ACCEPT, DROP,
|
||||
REJECT, LOG, NFQUEUE and QUEUE.</para>
|
||||
REJECT, LOG, NFLOG, NFQUEUE and QUEUE.</para>
|
||||
|
||||
<para>There is an implicit rule added at the end of this section
|
||||
that invokes the UNTRACKED_DISPOSITION (<ulink
|
||||
@@ -908,7 +908,7 @@
|
||||
<para>IPv4 only. Added in Shorewall 4.5.10. Queues matching
|
||||
packets to a back end logging daemon via 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>
|
||||
|
||||
<para>Similar to<emphasis role="bold">
|
||||
LOG:ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)],
|
||||
@@ -956,7 +956,7 @@
|
||||
(IPv4 only) or <emphasis role="bold">NFLOG</emphasis> (must be in
|
||||
upper case) as a log level.This will log to the ULOG or NFLOG 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(5)</ulink>).</para>
|
||||
|
||||
<para>Actions specifying logging may be followed by a log tag (a
|
||||
string of alphanumeric characters) which is appended to the string
|
||||
@@ -2636,15 +2636,15 @@
|
||||
<refsect1>
|
||||
<title>See ALSO</title>
|
||||
|
||||
<para><ulink
|
||||
url="shorewall-logging.html">shorewall-logging(5)</ulink></para>
|
||||
|
||||
<para><ulink
|
||||
url="/ipsets.html">http://www.shorewall.net/ipsets.html</ulink></para>
|
||||
|
||||
<para><ulink
|
||||
url="/configuration_file_basics.htm#Pairs">http://www.shorewall.net/configuration_file_basics.htm#Pairs</ulink></para>
|
||||
|
||||
<para><ulink
|
||||
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink></para>
|
||||
|
||||
<para>shorewall(8)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -52,12 +52,52 @@
|
||||
<term><emphasis role="bold">ACTION</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Defines the type of rule to generate. Choices are:</para>
|
||||
<para>Defines the type of rule to generate. Beginning with Shorewall
|
||||
5.1.9, with the exception of NFLOG and ULOG, the action may be
|
||||
followed by a colon (":") and a <replaceable>log level</replaceable>
|
||||
(see <ulink
|
||||
url="shorewall-logging.html">shorewall-logging(5)</ulink>).</para>
|
||||
|
||||
<para>Choices for ACTION are:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">MASQUERADE[+]</emphasis>[([<replaceable>lowport</replaceable>-<replaceable>highport</replaceable>][<option>random</option>])]</term>
|
||||
role="bold"><replaceable>action</replaceable></emphasis>[+][(<replaceable>parameter</replaceable>,...)][:<replaceable>level</replaceable>]</term>
|
||||
|
||||
<listitem>
|
||||
<para>where <replaceable>action</replaceable> is an action
|
||||
declared in <ulink
|
||||
url="/manpages/shorewall-actions.html">shorewall-actions(5)</ulink>
|
||||
with the <option>nat</option> option. See <ulink
|
||||
url="/Actions.html">www.shorewall.net/Actions.html</ulink> for
|
||||
further information.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">CONTINUE</emphasis>[+]:<replaceable>level</replaceable></term>
|
||||
|
||||
<listitem>
|
||||
<para>Causes matching packets to be exempted from any
|
||||
following rules in the file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">LOG:<replaceable>level</replaceable></emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.1.9. Simply log the packet and
|
||||
continue with the next rule.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">MASQUERADE[+]</emphasis>[([<replaceable>lowport</replaceable>-<replaceable>highport</replaceable>][<option>random</option>])][:<replaceable>level</replaceable>]</term>
|
||||
|
||||
<listitem>
|
||||
<para>Causes matching outgoing packages to have their source
|
||||
@@ -73,12 +113,52 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">NFLOG</emphasis>[(<replaceable>nflog-parameters</replaceable>)]</term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.1.9. Queues matching packets to a
|
||||
back end logging daemon via a netlink socket then continues to
|
||||
the next rule. See <ulink
|
||||
url="shorewall-logging.html">shorewall-logging(5)</ulink>.</para>
|
||||
|
||||
<para>The <replaceable>nflog-parameters</replaceable> are a
|
||||
comma-separated list of up to 3 numbers:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>The first number specifies the netlink group
|
||||
(0-65535). If omitted (e.g., NFLOG(,0,10)) then a value of
|
||||
0 is assumed.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The second number specifies the maximum number of
|
||||
bytes to copy. If omitted, 0 (no limit) is assumed.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>The third number specifies the number of log
|
||||
messages that should be buffered in the kernel before they
|
||||
are sent to user space. The default is 1.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>NFLOG is similar to<emphasis role="bold">
|
||||
LOG:NFLOG</emphasis>[(<replaceable>nflog-parameters</replaceable>)],
|
||||
except that the log level is not changed when this ACTION is
|
||||
used in an action or macro body and the invocation of that
|
||||
action or macro specifies a log level.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">SNAT[+]</emphasis>([<emphasis>address-or-address-range</emphasis>][:<emphasis>lowport</emphasis><emphasis
|
||||
role="bold">-</emphasis><emphasis>highport</emphasis>][<emphasis
|
||||
role="bold">:random</emphasis>][:<option>persistent</option>]|<emphasis
|
||||
role="bold">detect</emphasis>|</term>
|
||||
role="bold">detect</emphasis>)[:<replaceable>level</replaceable>]</term>
|
||||
|
||||
<listitem>
|
||||
<para>If you specify an address here, matching packets will
|
||||
@@ -132,26 +212,21 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">CONTINUE</emphasis>[+]</term>
|
||||
|
||||
<listitem>
|
||||
<para>Causes matching packets to be exempted from any
|
||||
following rules in the file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold"><replaceable>action</replaceable></emphasis>[+][(<replaceable>parameter</replaceable>,...)]</term>
|
||||
role="bold">ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)]</term>
|
||||
|
||||
<listitem>
|
||||
<para>where <replaceable>action</replaceable> is an action
|
||||
declared in <ulink
|
||||
url="/manpages/shorewall-actions.html">shorewall-actions(5)</ulink>
|
||||
with the <option>nat</option> option. See <ulink
|
||||
url="/Actions.html">www.shorewall.net/Actions.html</ulink> for
|
||||
further information.</para>
|
||||
<para>IPv4 only. Added in Shorewall 5.1.9. Queues matching
|
||||
packets to a back end logging daemon via a netlink socket then
|
||||
continues to the next rule. See <ulink
|
||||
url="shorewall-logging.html">shorewall-logging(5)</ulink>.</para>
|
||||
|
||||
<para>Similar to<emphasis role="bold">
|
||||
LOG:ULOG</emphasis>[(<replaceable>ulog-parameters</replaceable>)],
|
||||
except that the log level is not changed when this ACTION is
|
||||
used in an action or macro body and the invocation of that
|
||||
action or macro specifies a log level.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
@@ -673,7 +748,7 @@
|
||||
address changed to 206.124.146.177.</para>
|
||||
|
||||
<programlisting> #ACTION SOURCE DEST
|
||||
SNAT(206.124.146.177) - eth0+myset[dst]</programlisting>
|
||||
SNAT(206.124.146.177) - eth0:+myset[dst]</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@@ -160,7 +160,9 @@
|
||||
how often the rate is estimated and how many samples are retained
|
||||
for estimating. Please see <ulink
|
||||
url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink>
|
||||
for details.</para>
|
||||
for details. If not specified, the default
|
||||
<replaceable>interval</replaceable> is 250ms and the default
|
||||
<replaceable>decay_interval</replaceable> is 4sec.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@@ -172,7 +172,9 @@
|
||||
how often the rate is estimated and how many samples are retained
|
||||
for estimating. Please see <ulink
|
||||
url="http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/estimators.txt</ulink>
|
||||
for details.</para>
|
||||
for details. If not specified, the default
|
||||
<replaceable>interval</replaceable> is 250ms and the default
|
||||
<replaceable>decay_interval</replaceable> is 4sec.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@@ -107,7 +107,7 @@
|
||||
<simplelist>
|
||||
<member>2 + 6 + 2*M + 1 = 29</member>
|
||||
|
||||
<member>2M = 29 - 2 + 6 + 1 = 20</member>
|
||||
<member>2M = 29 - 2 - 6 - 1 = 20</member>
|
||||
|
||||
<member>M = 10</member>
|
||||
</simplelist>
|
||||
|
@@ -406,8 +406,9 @@
|
||||
<listitem>
|
||||
<para>Formerly named AUTO_COMMENT. If set, if there is not a current
|
||||
comment when a macro is invoked, the behavior is as if the first
|
||||
line of the macro file was "COMMENT <macro name>". The
|
||||
AUTO_COMMENT option has a default value of 'Yes'.</para>
|
||||
line of the macro file was "COMMENT <macro name>". If not
|
||||
specified, the AUTO_COMMENT option has a default value of
|
||||
'Yes'.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -473,7 +474,7 @@
|
||||
command, then the compilation step is skipped and the compiled
|
||||
script that executed the last <command>start</command>, <emphasis
|
||||
role="bold">reload</emphasis> or <command>restart</command> command
|
||||
is used. The default is AUTOMAKE=No.</para>
|
||||
is used. If not specified, the default is AUTOMAKE=No.</para>
|
||||
|
||||
<para>The setting of the AUTOMAKE option is ignored if the
|
||||
<command>start</command>, <emphasis role="bold">reload</emphasis> or
|
||||
@@ -672,7 +673,7 @@
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">CONFIG_PATH</emphasis>=[<emphasis>directory</emphasis>[:<emphasis>directory</emphasis>]...]</term>
|
||||
role="bold">CONFIG_PATH</emphasis>=[[:]<emphasis>directory</emphasis>[:<emphasis>directory</emphasis>]...]</term>
|
||||
|
||||
<listitem>
|
||||
<para>Specifies where configuration files other than
|
||||
@@ -700,6 +701,16 @@
|
||||
/etc/shorewall:/usr/share/shorewall but your particular distribution
|
||||
may set it differently. See the output of shorewall show config for
|
||||
the default on your system.</para>
|
||||
|
||||
<para>Beginning with Shorewall 5.1.10, the CONFIG_PATH setting may
|
||||
begin with a colon (":"), to signal that the first
|
||||
<replaceable>directory</replaceable> listed will be skipped if the
|
||||
user performing a compilation is not root or if the configuration is
|
||||
being compiled for export (-e option specified or if running one of
|
||||
the remote-* commands) . This prevents the compiler from looking in
|
||||
<filename>/etc/shorewall[6]</filename>/ when compilation is being
|
||||
done by a non-root user or if the generated script is to be sent to
|
||||
a remote firewall system.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -719,6 +730,14 @@
|
||||
and <command>restart</command> commands will succeed even if no DNS
|
||||
server is reachable (assuming that the configuration hasn't changed
|
||||
since the compiled script was last generated).</para>
|
||||
|
||||
<important>
|
||||
<para>When DEFER_DNS_RESOLUTION=No and AUTOMAKE=Yes and a DNS
|
||||
change makes it necessary to recompile an existing firewall
|
||||
script, the <option>-c</option> option must be used with the
|
||||
<command>reload</command> or <command>restart</command> command to
|
||||
force recompilation.</para>
|
||||
</important>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -1565,10 +1584,9 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
||||
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
||||
If not assigned or if assigned an empty value, /var/log/messages is
|
||||
assumed. For further information, see <ulink
|
||||
url="/manpages/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.
|
||||
Beginning with Shorewall 5.0.10.1, you may specify
|
||||
<option>systemd</option> to use <command>journelctl -r</command> to
|
||||
read the log.</para>
|
||||
url="shorewall-logging.html">shorewall-logging(8)</ulink>. Beginning
|
||||
with Shorewall 5.0.10.1, you may specify <option>systemd</option> to
|
||||
use <command>journelctl -r</command> to read the log.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -1891,18 +1909,6 @@ LOG:info:,bar net fw</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">MODULE_SUFFIX=</emphasis>[<emphasis
|
||||
role="bold">"</emphasis><emphasis>extension</emphasis> ...<emphasis
|
||||
role="bold">"</emphasis>]</term>
|
||||
|
||||
<listitem>
|
||||
<para>The value of this option determines the possible file
|
||||
extensions of kernel modules. The default value is "ko ko.gz ko.xz o
|
||||
o.gz o.xz gz xz".</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis
|
||||
role="bold">MODULESDIR=</emphasis>[[+]<emphasis>pathname</emphasis>[<emphasis
|
||||
@@ -2212,8 +2218,9 @@ LOG:info:,bar net fw</programlisting>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>The default value is zero which disables all
|
||||
optimizations.</para>
|
||||
<para>In versions prior to 5.1.0, the default value is zero which
|
||||
disables all optimizations. Beginning with Shorewall 5.1.0, the
|
||||
default value is All which enables all optimizations.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#
|
||||
# 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
|
||||
# be placed in a directory on the CONFIG_PATH to be used when compiling firewalls
|
||||
@@ -38,7 +38,6 @@
|
||||
#
|
||||
# IPTABLES - iptables
|
||||
# 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
|
||||
# used during firewall compilation, then the generated firewall program will likewise not
|
||||
|
@@ -8,6 +8,7 @@
|
||||
Description=Shorewall IPv6 firewall (lite)
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
After=shorewall-lite.service
|
||||
Conflicts=ip6tables.service firewalld.service
|
||||
|
||||
[Service]
|
||||
|
@@ -7,6 +7,7 @@
|
||||
Description=Shorewall IPv6 firewall (lite)
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
After=shorewall-lite.service
|
||||
Conflicts=ip6tables.service firewalld.service
|
||||
|
||||
[Service]
|
||||
|
@@ -1,82 +0,0 @@
|
||||
# Shorewall6 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/shorewall6-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/shorewall6-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
|
||||
shorewall6 compile -e . firewall
|
||||
#
|
||||
# Only reload on demand.
|
||||
#
|
||||
install: firewall
|
||||
scp firewall firewall.conf root@$(HOST):$(LITEDIR)
|
||||
ssh root@$(HOST) "/sbin/shorewall6-lite restart"
|
||||
#
|
||||
# Save running configuration
|
||||
#
|
||||
save:
|
||||
ssh root@$(HOST) "/sbin/shorewall6-lite save"
|
||||
#
|
||||
# Remove generated files
|
||||
#
|
||||
clean:
|
||||
rm -f capabilities firewall firewall.conf reload
|
@@ -11,5 +11,5 @@
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
- lo ignore
|
||||
net all dhcp,physical=+,routeback,sourceroute=0
|
||||
net all dhcp,physical=+,routeback
|
||||
|
||||
|
@@ -74,7 +74,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -190,8 +190,6 @@ MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MINIUPNPD=No
|
||||
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
||||
OPTIMIZE=All
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Shorewall6 version 5 - Sample Interfaces File for one-interface configuration.
|
||||
# Copyright (C) 2006-2015 by the Shorewall Team
|
||||
# Shorewall6 - Sample Interfaces File for one-interface configuration.
|
||||
# Copyright (C) 2006-2017 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -14,4 +14,4 @@
|
||||
?FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 tcpflags
|
||||
net NET_IF tcpflags,physical=eth0
|
||||
|
@@ -75,7 +75,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH="${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall"
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -191,8 +191,6 @@ MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MINIUPNPD=No
|
||||
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
||||
OPTIMIZE=All
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Shorewall6 version 4 - Sample Interfaces File for three-interface configuration.
|
||||
# Copyright (C) 2006-2014by the Shorewall Team
|
||||
# Shorewall6 - Sample Interfaces File for three-interface configuration.
|
||||
# Copyright (C) 2006-2017 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -14,6 +14,6 @@
|
||||
?FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 tcpflags,forward=1,sourceroute=0
|
||||
loc eth1 tcpflags,forward=1
|
||||
dmz eth2 tcpflags,forward=1
|
||||
net NET_IF tcpflags,forward=1,sourceroute=0,physical=eth0
|
||||
loc LOC_IF tcpflags,forward=1,physical=eth1
|
||||
dmz DMZ_IF tcpflags,forward=1,physical=eth2
|
||||
|
@@ -74,7 +74,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -190,8 +190,6 @@ MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MINIUPNPD=No
|
||||
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
||||
OPTIMIZE=All
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Shorewall6 version 4.5 Sample Stoppedrules File for three-interface configuration.
|
||||
# Copyright (C) 2012-2014 by the Shorewall Team
|
||||
# Shorewall6 - Sample Stoppedrules File for three-interface configuration.
|
||||
# Copyright (C) 2012-2017 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -13,8 +13,7 @@
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||
# PORT(S) PORT(S)
|
||||
ACCEPT eth1 -
|
||||
ACCEPT - eth1
|
||||
ACCEPT eth2 -
|
||||
ACCEPT - eth2
|
||||
|
||||
ACCEPT LOC_IF -
|
||||
ACCEPT - LOC_IF
|
||||
ACCEPT DMZ_IF -
|
||||
ACCEPT - DMZ_IF
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Shorewall6 version 4.0 - Sample Interfaces File for two-interface configuration.
|
||||
# Copyright (C) 2006-2014 by the Shorewall Team
|
||||
# Shorewall6 - Sample Interfaces File for two-interface configuration.
|
||||
# Copyright (C) 2006-2017 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -14,5 +14,5 @@
|
||||
?FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 tcpflags,forward=1,sourceroute=0
|
||||
loc eth1 tcpflags,forward=1
|
||||
net NET_IF tcpflags,forward=1,sourceroute=0,physical=eth0
|
||||
loc LOC_IF tcpflags,forward=1,physical=eth1
|
||||
|
@@ -74,7 +74,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -190,8 +190,6 @@ MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MINIUPNPD=No
|
||||
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
||||
OPTIMIZE=All
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Shorewall6 version 4.5 Sample Stoppedrules File for two-interface configuration.
|
||||
# Copyright (C) 2012-2014 by the Shorewall Team
|
||||
# Shorewall6 - Sample Stoppedrules File for two-interface configuration.
|
||||
# Copyright (C) 2012-2017 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -13,5 +13,5 @@
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||
# PORT(S) PORT(S)
|
||||
ACCEPT eth1 -
|
||||
ACCEPT - eth1
|
||||
ACCEPT LOC_IF -
|
||||
ACCEPT - LOC_IF
|
||||
|
@@ -8,42 +8,43 @@
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION
|
||||
A_Drop # Audited Default Action for DROP policy
|
||||
A_Reject # Audited Default Action for REJECT policy
|
||||
A_AllowICMPs # Audited Accept needed ICMP6 types
|
||||
AllowICMPs # Accept needed ICMP6 types
|
||||
A_Drop # Audited Default Action for DROP policy
|
||||
A_Reject # Audited Default Action for REJECT policy
|
||||
A_AllowICMPs proto=58 # Audited Accept needed ICMP6 types
|
||||
AllowICMPs proto=58 # Accept needed ICMP6 types
|
||||
allowBcast inline # Silently Allow Broadcast
|
||||
allowInvalid inline # Accepts packets in the INVALID conntrack state
|
||||
allowMcast inline # Silently Allow Multicast
|
||||
AutoBL noinline # Auto-blacklist IPs that exceed thesholds
|
||||
AutoBLL noinline # Helper for AutoBL
|
||||
AutoBL noinline # Auto-blacklist IPs that exceed thesholds
|
||||
AutoBLL noinline # Helper for AutoBL
|
||||
BLACKLIST logjump,section # Add sender to the dynamic blacklist
|
||||
Broadcast noinline # Handles Broadcast/Anycast
|
||||
Drop # Default Action for DROP policy (deprecated)
|
||||
Broadcast noinline # Handles Broadcast/Anycast
|
||||
Drop # Default Action for DROP policy (deprecated)
|
||||
dropBcast inline # Silently Drop Broadcast
|
||||
dropBcasts inline # Silently Drop Broadcast
|
||||
dropInvalid inline # Drops packets in the INVALID conntrack state
|
||||
dropMcast inline # Silently Drop Multicast
|
||||
dropNotSyn noinline # Silently Drop Non-syn TCP packets
|
||||
DropDNSrep inline # Drops DNS replies
|
||||
DropSmurfs noinline # Handles packets with a broadcast source address
|
||||
dropNotSyn noinline,proto=6 # Silently Drop Non-syn TCP packets
|
||||
DropDNSrep inline,proto=17 # Drops DNS replies
|
||||
DropSmurfs noinline # Handles packets with a broadcast source address
|
||||
Established inline,\ # Handles packets in the ESTABLISHED state
|
||||
state=ESTABLISHED
|
||||
FIN inline,audit # Handles ACK,FIN,PSH packets
|
||||
FIN inline,audit,\ # Handles ACK,FIN,PSH packets
|
||||
proto=6
|
||||
forwardUPnP noinline # Allow traffic that upnpd has redirected from 'upnp' interfaces.
|
||||
IfEvent noinline # Perform an action based on an event
|
||||
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
|
||||
state=INVALID
|
||||
Multicast noinline # Handles Multicast
|
||||
IfEvent noinline # Perform an action based on an event
|
||||
Invalid inline,audit,\ # Handles packets in the INVALID conntrack state
|
||||
state=INVALID
|
||||
Multicast noinline # Handles Multicast
|
||||
New inline,state=NEW # Handles packets in the NEW conntrack state
|
||||
NotSyn inline # Handles TCP packets that do not have SYN=1 and ACK=0
|
||||
Reject # Default Action for REJECT policy (deprecated)
|
||||
rejNotSyn noinline # Silently Reject Non-syn TCP packets
|
||||
Related inline,\ # Handles packets in the RELATED conntrack state
|
||||
state=RELATED
|
||||
NotSyn inline,proto=6 # Handles TCP packets that do not have SYN=1 and ACK=0
|
||||
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
|
||||
state=RELATED
|
||||
ResetEvent inline # Reset an Event
|
||||
RST inline # Handle packets with RST set
|
||||
RST inline,proto=6 # Handle packets with RST set
|
||||
SetEvent inline # Initialize an event
|
||||
TCPFlags # Handles bad flags combinations
|
||||
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
|
||||
TCPFlags proto=6 # Handles bad flags combinations
|
||||
Untracked inline,\ # Handles packets in the UNTRACKED conntrack state
|
||||
state=UNTRACKED
|
||||
|
12
Shorewall6/configfiles/disabled
Normal file
12
Shorewall6/configfiles/disabled
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Shorewall6 -- /etc/shorewall6/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
Shorewall6/configfiles/enabled
Normal file
12
Shorewall6/configfiles/enabled
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Shorewall6 -- /etc/shorewall6/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
|
@@ -74,7 +74,7 @@ UNTRACKED_LOG_LEVEL=
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH="${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall"
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall"
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
@@ -190,8 +190,6 @@ MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MINIUPNPD=No
|
||||
|
||||
MODULE_SUFFIX=ko
|
||||
|
||||
MUTEX_TIMEOUT=60
|
||||
|
||||
OPTIMIZE=All
|
||||
|
@@ -3,4 +3,4 @@
|
||||
#
|
||||
# /usr/share/shorewall6/configpath
|
||||
#
|
||||
CONFIG_PATH=${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall
|
||||
CONFIG_PATH=":${CONFDIR}/shorewall6:${SHAREDIR}/shorewall6:${SHAREDIR}/shorewall"
|
||||
|
@@ -7,6 +7,7 @@
|
||||
Description=Shorewall IPv6 firewall
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
After=shorewall.service
|
||||
Conflicts=ip6tables.service firewalld.service
|
||||
|
||||
[Service]
|
||||
|
@@ -8,6 +8,7 @@
|
||||
Description=Shorewall IPv6 firewall
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
After=shorewall.service
|
||||
Conflicts=ip6tables.service firewalld.service
|
||||
|
||||
[Service]
|
||||
|
@@ -162,8 +162,7 @@
|
||||
<entry><ulink url="traffic_shaping.htm">Bandwidth
|
||||
Control</ulink></entry>
|
||||
|
||||
<entry>Manpages (<ulink url="Manpages.html">IPv4</ulink>) (<ulink
|
||||
url="Manpages6.html">IPv6</ulink>)</entry>
|
||||
<entry><ulink url="Manpages.html">Manpages</ulink></entry>
|
||||
|
||||
<entry><ulink
|
||||
url="starting_and_stopping_shorewall.htm">Starting/stopping the
|
||||
|
@@ -475,10 +475,8 @@ root@gateway:~# </programlisting>
|
||||
<section>
|
||||
<title>Automatic Blacklisting</title>
|
||||
|
||||
<para>This example is taken from <ulink
|
||||
url="http://www.briandowney.net/blog/2009/08/20/firewalling-brute-force-attempts-with-iptables/">this
|
||||
article</ulink> which explains the nice benefits of this approach. This
|
||||
example is for ssh, but it can be adapted for any application.</para>
|
||||
<para>This example is for ssh, but it can be adapted for any
|
||||
application.</para>
|
||||
|
||||
<para>The name SSH has been changed to SSHLIMIT so as not to override
|
||||
the Shorewall macro of the same name.</para>
|
||||
|
63
docs/FAQ.xml
63
docs/FAQ.xml
@@ -175,8 +175,8 @@
|
||||
</section>
|
||||
|
||||
<section id="faq76">
|
||||
<title>(FAQ 76) I just upgraded my Debian (Ubuntu, Kubuntu, ...) system
|
||||
and now masquerading doesn't work? What happened?</title>
|
||||
<title>(FAQ 76) I just upgraded my system and now masquerading doesn't
|
||||
work? What happened?</title>
|
||||
|
||||
<para><emphasis role="bold">Answer:</emphasis> This happens to people
|
||||
who ignore <ulink url="Install.htm#Upgrade_Deb">our advice</ulink> and
|
||||
@@ -185,7 +185,7 @@
|
||||
default settings. Failure to forward traffic (such as during masqueraded
|
||||
net access from a local network) usually means that <filename><ulink
|
||||
url="manpages/shorewall.conf.html">/etc/shorewall/shorewall.conf</ulink></filename>
|
||||
contains the Debian default setting IP_FORWARDING=Keep; it should be
|
||||
contains the default setting IP_FORWARDING=Keep; it should be
|
||||
IP_FORWARDING=On.</para>
|
||||
|
||||
<para><emphasis role="bold">Update</emphasis>: Beginning with Shorewall
|
||||
@@ -776,12 +776,7 @@ SNAT(<emphasis role="bold">130.151.100.69</emphasis>) 192.168.1.0/24 eth1:19
|
||||
|
||||
<para>That rule (and the second one in the previous bullet) only
|
||||
works of course if you have a static external IP address. If you
|
||||
have a dynamic IP address then include this in
|
||||
<filename>/etc/shorewall/params</filename>.</para>
|
||||
|
||||
<programlisting><command>ETH0_IP=$(find_first_interface_address eth0)</command> </programlisting>
|
||||
|
||||
<para>and make your DNAT rule:</para>
|
||||
have a dynamic IP address then make your DNAT rule:</para>
|
||||
|
||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
||||
|
||||
@@ -793,34 +788,17 @@ SNAT(<emphasis role="bold">130.151.100.69</emphasis>) 192.168.1.0/24 eth1:19
|
||||
?SECTION NEW
|
||||
|
||||
DNAT loc loc:192.168.1.5 tcp www - <emphasis
|
||||
role="bold">$ETH0_IP</emphasis></programlisting>
|
||||
role="bold">&eth0</emphasis></programlisting>
|
||||
|
||||
<para>Using this technique, you will want to configure your
|
||||
DHCP/PPPoE/PPTP/… client to automatically restart Shorewall each
|
||||
time that you get a new IP address.</para>
|
||||
DHCP/PPPoE/PPTP/… client to automatically reload Shorewall each time
|
||||
that you get a new IP address.</para>
|
||||
|
||||
<note>
|
||||
<para>If your local interface is a bridge, see <link
|
||||
linkend="faq2e">FAQ 2e</link> for additional configuration
|
||||
steps.</para>
|
||||
</note>
|
||||
|
||||
<note>
|
||||
<para>For optional interfaces, use the function <emphasis
|
||||
role="bold">find_first_interface_address_if_any()</emphasis>
|
||||
rather than <emphasis
|
||||
role="bold">find_first_interface_address()</emphasis>. The former
|
||||
will return 0.0.0.0 if the interface has no configured IP address;
|
||||
the latter terminates the calling program.</para>
|
||||
</note>
|
||||
|
||||
<note id="Call">
|
||||
<para>If you run Shorewall-lite on your firewall, you must use the
|
||||
following in the firewall's configuration directory
|
||||
<filename>params</filename> file:</para>
|
||||
|
||||
<programlisting><command>ETH0_IP=$(ssh root@firewall "/sbin/shorewall-lite call find_first_interface_address eth0")</command></programlisting>
|
||||
</note>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
@@ -928,14 +906,8 @@ MASQUERADE 192.168.1.0/24 eth2:192.168.1.2 tcp www</programlisting>
|
||||
|
||||
<emphasis role="bold">DNAT loc dmz:192.168.2.4 tcp 80 - 206.124.146.176</emphasis></programlisting>
|
||||
|
||||
<para>If your external IP address is dynamic, then you must do the
|
||||
following:</para>
|
||||
|
||||
<para>In <filename>/etc/shorewall/params</filename>:</para>
|
||||
|
||||
<programlisting><command>ETH0_IP=`find_first_interface_address eth0`</command> </programlisting>
|
||||
|
||||
<para>and make your DNAT rule:</para>
|
||||
<para>If your external IP address is dynamic, then you must make your
|
||||
DNAT rule:</para>
|
||||
|
||||
<programlisting>#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST
|
||||
|
||||
@@ -947,7 +919,7 @@ MASQUERADE 192.168.1.0/24 eth2:192.168.1.2 tcp www</programlisting>
|
||||
?SECTION NEW
|
||||
|
||||
DNAT loc dmz:192.168.2.4 tcp 80 - <emphasis
|
||||
role="bold">$ETH0_IP</emphasis></programlisting>
|
||||
role="bold">&eth0</emphasis></programlisting>
|
||||
|
||||
<warning>
|
||||
<para>With dynamic IP addresses, you probably don't want to use
|
||||
@@ -956,21 +928,6 @@ DNAT loc dmz:192.168.2.4 tcp 80 - <emphasi
|
||||
save</command> and <command>shorewall[-lite]
|
||||
restore</command></ulink>.</para>
|
||||
</warning>
|
||||
|
||||
<note>
|
||||
<para>For optional interfaces, use the function <emphasis
|
||||
role="bold">find_first_interface_address_if_any()</emphasis> rather
|
||||
than <emphasis
|
||||
role="bold">find_first_interface_address()</emphasis>. The former
|
||||
will return 0.0.0.0 if the interface has no configured IP address;
|
||||
the latter terminates the calling program.</para>
|
||||
</note>
|
||||
|
||||
<note>
|
||||
<para>If you use Shorewall-lite, then you need to configure the
|
||||
params file in the firewall's configuration directory as described
|
||||
<link linkend="Call">above</link>.</para>
|
||||
</note>
|
||||
</section>
|
||||
|
||||
<section id="faq2c">
|
||||
|
@@ -71,7 +71,7 @@
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>PPTP (TCP 1729)</para>
|
||||
<para>PPTP (TCP 1723)</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
@@ -121,9 +121,10 @@
|
||||
of your system.</para>
|
||||
|
||||
<para>Many of the modules allow parameters to be specified when the
|
||||
module is loaded. Among the common parameters is the ports parameter
|
||||
that lists one or more ports that the module is to monitor. This allows
|
||||
running the application on a non-standard port.</para>
|
||||
module is loaded. Among the common parameters is the
|
||||
<option>ports</option> parameter that lists one or more ports that the
|
||||
module is to monitor. This allows running the application on a
|
||||
non-standard port.</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
@@ -387,7 +387,7 @@
|
||||
|
||||
<listitem>
|
||||
<para>Directory where the Shorewall Perl modules are installed.
|
||||
Then will be installed in this directory under the sub-directory
|
||||
They will be installed in this directory under the sub-directory
|
||||
Shorewall. Default is distribution-specific.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -597,7 +597,7 @@
|
||||
...</member>
|
||||
</simplelist>
|
||||
|
||||
<para>The possible values for option are the same as those shone above
|
||||
<para>The possible values for option are the same as those shown above
|
||||
in the shorewallrc file. They may be specified in either upper or
|
||||
lower case and may optionally be prefixed by '--'. To facilitate use
|
||||
with the rpm %configure script, the following options are
|
||||
@@ -634,7 +634,7 @@
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>Note that %configure may dsgenerate option/value pairs that are
|
||||
<para>Note that %configure may generate option/value pairs that are
|
||||
incompatible with the <command>configure</command> script. The current
|
||||
%configure macro is:</para>
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
||||
|
||||
<copyright>
|
||||
<year>2007-2015</year>
|
||||
<year>2007-2017</year>
|
||||
|
||||
<holder>Thomas M. Eastep</holder>
|
||||
</copyright>
|
||||
@@ -83,6 +83,9 @@
|
||||
Describes how to specify set names in Shorewall configuration
|
||||
files.</member>
|
||||
|
||||
<member><ulink url="manpages/shorewall-logging.html">logging</ulink> -
|
||||
Provides an overview of Shorewall packet logging facilities</member>
|
||||
|
||||
<member><ulink url="manpages/shorewall-maclist.html">maclist</ulink> -
|
||||
Define MAC verification.</member>
|
||||
|
||||
@@ -115,7 +118,11 @@
|
||||
routing tables, usually for multiple Internet links.</member>
|
||||
|
||||
<member><ulink url="manpages/shorewall-proxyarp.html">proxyarp</ulink>
|
||||
- Define Proxy ARP.</member>
|
||||
- Define Proxy ARP (IPv4)</member>
|
||||
|
||||
<member><ulink
|
||||
url="manpages6/shorewall-proxyndp.html">proxyndp</ulink> - Define
|
||||
Proxy NDP (IPv6)</member>
|
||||
|
||||
<member><ulink url="manpages/shorewall-rtrules.html">rtrules</ulink> -
|
||||
Define routing rules.</member>
|
||||
@@ -157,10 +164,18 @@
|
||||
url="manpages/shorewall.conf.html">shorewall.conf</ulink> - Specify
|
||||
values for global Shorewall options.</member>
|
||||
|
||||
<member><ulink
|
||||
url="manpages6/shorewall6.conf.html">shorewall6.conf</ulink> - Specify
|
||||
values for global Shorewall6 options.</member>
|
||||
|
||||
<member><ulink
|
||||
url="manpages/shorewall-lite.conf.html">shorewall-lite.conf</ulink> -
|
||||
Specify values for global Shorewall Lite options.</member>
|
||||
|
||||
<member><ulink
|
||||
url="manpages6/shorewall6-lite.conf.html">shorewall6-lite.conf</ulink>
|
||||
- Specify values for global Shorewall6 Lite options.</member>
|
||||
|
||||
<member><ulink url="manpages/shorewall-vardir.html">vardir</ulink> -
|
||||
Redefine the directory where Shorewall keeps its state
|
||||
information.</member>
|
||||
@@ -182,16 +197,8 @@
|
||||
<blockquote>
|
||||
<simplelist>
|
||||
<member><ulink url="manpages/shorewall.html">shorewall</ulink> -
|
||||
/sbin/shorewall command syntax and semantics.</member>
|
||||
|
||||
<member><ulink
|
||||
url="manpages/shorewall-init.html">shorewall-init</ulink> - Companion
|
||||
package that allows for automatic start/stop of other Shorewall
|
||||
products based on network events.</member>
|
||||
|
||||
<member><ulink
|
||||
url="manpages/shorewall-lite.html">shorewall-lite</ulink> -
|
||||
/sbin/shorewall-lite command syntax and semantics.</member>
|
||||
/sbin/shorewall, /sbin/shorewall6/, /sbin/shorewall-lite and
|
||||
/sbin/shorewall6-line command syntax and semantics.</member>
|
||||
</simplelist>
|
||||
</blockquote>
|
||||
</section>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<article>
|
||||
<!--$Id$-->
|
||||
<!--mangle$Id$-->
|
||||
|
||||
<articleinfo>
|
||||
<title>Shared Shorewall and Shorewall6 Configuration</title>
|
||||
@@ -43,6 +43,12 @@
|
||||
While Shorewall also separates the address families in this way, it is
|
||||
possible for Shorewall and Shorewall6 to share almost all of the
|
||||
configuration files. This article gives an example.</para>
|
||||
|
||||
<caution>
|
||||
<para>What is shown here currently works best with Debian and
|
||||
derivatives, or when the tarball installer is used and the SPARSE option
|
||||
is enabled when running configure[.pl].</para>
|
||||
</caution>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -59,6 +65,10 @@
|
||||
mail exchanger, and an IMAPS mail access server. The second bridge (br1)
|
||||
provides access to a container running irssi under screen, allowing
|
||||
constant access to and monitoring of IRC channels.</para>
|
||||
|
||||
<para>Here is a diagram of this installation:</para>
|
||||
|
||||
<graphic fileref="images/Network2017.png"/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -66,20 +76,76 @@
|
||||
|
||||
<para>Here are the contents of /etc/shorewall/ and /etc/shorewal6/:</para>
|
||||
|
||||
<programlisting>root@gateway:/etc# ls shorewall shorewall6
|
||||
shorewall:
|
||||
action.Mirrors conntrack interfaces mangle params providers rtrules shorewall.conf started zones
|
||||
actions hosts isusable mirrors policy proxyarp rules snat tunnels
|
||||
|
||||
shorewall6:
|
||||
shorewall6.conf
|
||||
root@gateway:/etc#</programlisting>
|
||||
<programlisting>root@gateway:~# ls -l /etc/shorewall/
|
||||
total 92
|
||||
-rw-r--r-- 1 root root 201 Mar 19 2017 action.Mirrors
|
||||
-rw-r--r-- 1 root root 109 Oct 20 09:18 actions
|
||||
-rw-r--r-- 1 root root 654 Oct 13 13:46 conntrack
|
||||
-rw-r--r-- 1 root root 104 Oct 13 13:21 hosts
|
||||
-rw-r--r-- 1 root root 867 Jul 1 10:50 interfaces
|
||||
-rw-r--r-- 1 root root 107 Jun 29 15:14 isusable
|
||||
-rw-r--r-- 1 root root 240 Oct 13 13:34 macro.FTP
|
||||
-rw-r--r-- 1 root root 559 Oct 19 12:56 mangle
|
||||
-rw-r--r-- 1 root root 1290 Jun 29 15:16 mirrors
|
||||
-rw-r--r-- 1 root root 2687 Oct 15 14:20 params
|
||||
-rw-r--r-- 1 root root 738 Oct 15 12:16 policy
|
||||
-rw-r--r-- 1 root root 1838 Oct 11 08:29 providers
|
||||
-rw-r--r-- 1 root root 398 Mar 18 2017 proxyarp
|
||||
-rw-r--r-- 1 root root 738 Nov 8 09:34 routes
|
||||
-rw-r--r-- 1 root root 729 Nov 7 12:52 rtrules
|
||||
-rw-r--r-- 1 root root 6367 Oct 13 13:21 rules
|
||||
-rw-r--r-- 1 root root 5520 Oct 19 10:01 shorewall.conf
|
||||
-rw-r--r-- 1 root root 1090 Oct 25 15:17 snat
|
||||
-rw-r--r-- 1 root root 181 Jun 29 15:12 started
|
||||
-rw-r--r-- 1 root root 435 Oct 13 13:21 tunnels
|
||||
-rw-r--r-- 1 root root 941 Oct 15 11:27 zones
|
||||
root@gateway:~# ls -l /etc/shorewall6/
|
||||
total 8
|
||||
lrwxrwxrwx 1 root root 20 Jul 6 16:35 mirrors -> ../shorewall/mirrors
|
||||
lrwxrwxrwx 1 root root 19 Jul 6 12:48 params -> ../shorewall/params
|
||||
-rw-r--r-- 1 root root 5332 Oct 14 11:53 shorewall6.conf
|
||||
root@gateway:~#
|
||||
</programlisting>
|
||||
|
||||
<para>The various configuration files are described in the sections that
|
||||
follow. Note that in all cases, these files use the <ulink
|
||||
url="/configuration_file_basics.htm#Pairs">alternate format for column
|
||||
specification</ulink>.</para>
|
||||
|
||||
<section>
|
||||
<title>/usr/share/shorewall/shorewallrc</title>
|
||||
|
||||
<para>The key setting here is SPARSE=Very</para>
|
||||
|
||||
<programlisting>#
|
||||
# Created by Shorewall Core version 5.0.12-RC1 configure.pl - Sep 25 2016 09:30:55
|
||||
# rc file: shorewallrc.debian.systemd
|
||||
#
|
||||
HOST=debian
|
||||
PREFIX=/usr
|
||||
SHAREDIR=${PREFIX}/share
|
||||
LIBEXECDIR=${PREFIX}/share
|
||||
PERLLIBDIR=${PREFIX}/share/shorewall
|
||||
CONFDIR=/etc
|
||||
SBINDIR=/sbin
|
||||
MANDIR=${PREFIX}/share/man
|
||||
INITDIR=
|
||||
INITSOURCE=init.debian.sh
|
||||
INITFILE=
|
||||
AUXINITSOURCE=
|
||||
AUXINITFILE=
|
||||
SERVICEDIR=/lib/systemd/system
|
||||
SERVICEFILE=$PRODUCT.service.debian
|
||||
SYSCONFFILE=default.debian
|
||||
SYSCONFDIR=/etc/default
|
||||
SPARSE=Very
|
||||
ANNOTATED=
|
||||
VARLIB=/var/lib
|
||||
VARDIR=${VARLIB}/$PRODUCT
|
||||
DEFAULT_PAGER=/usr/bin/less
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>shorewall.conf and shorewall6.conf</title>
|
||||
|
||||
@@ -87,11 +153,11 @@ root@gateway:/etc#</programlisting>
|
||||
address families. The key setting is CONFIG_PATH in
|
||||
shorewall6.conf:</para>
|
||||
|
||||
<programlisting>CONFIG_PATH="${CONFDIR}/shorewall6:<emphasis role="bold">${CONFDIR}/shorewall:</emphasis>/usr/share/shorewall6:${SHAREDIR}/shorewall"A</programlisting>
|
||||
<programlisting>CONFIG_PATH="<emphasis role="bold">${CONFDIR}/shorewall6:${CONFDIR}/shorewall:</emphasis>/usr/share/shorewall6:${SHAREDIR}/shorewall"</programlisting>
|
||||
|
||||
<para>Any Shorewall6 configuration file not found in
|
||||
/etc/shorewall/shorewall6/ will be searched for in
|
||||
/etc/shorewall/.</para>
|
||||
<para><filename>/etc/shorewall6/</filename> is only used for processing
|
||||
the <filename>params</filename> and <filename>shorewall6.conf</filename>
|
||||
files.</para>
|
||||
|
||||
<section>
|
||||
<title>shorewall.conf</title>
|
||||
@@ -100,6 +166,13 @@ root@gateway:/etc#</programlisting>
|
||||
follows:</para>
|
||||
|
||||
<programlisting>###############################################################################
|
||||
#
|
||||
# Shorewall Version 5 -- /etc/shorewall/shorewall.conf
|
||||
#
|
||||
# For information about the settings in this file, type "man shorewall.conf"
|
||||
#
|
||||
# Manpage also online at http://www.shorewall.net/manpages/shorewall.conf.html
|
||||
###############################################################################
|
||||
# S T A R T U P E N A B L E D
|
||||
###############################################################################
|
||||
STARTUP_ENABLED=Yes
|
||||
@@ -196,7 +269,7 @@ DYNAMIC_BLACKLIST="ipset-only,disconnect,timeout=7200"
|
||||
EXPAND_POLICIES=Yes
|
||||
EXPORTMODULES=Yes
|
||||
FASTACCEPT=Yes
|
||||
FORWARD_CLEAR_MARK=Yes
|
||||
FORWARD_CLEAR_MARK=No
|
||||
HELPERS="ftp,irc"
|
||||
IGNOREUNKNOWNVARIABLES=No
|
||||
IMPLICIT_CONTINUE=No
|
||||
@@ -210,8 +283,7 @@ MACLIST_TTL=60
|
||||
MANGLE_ENABLED=Yes
|
||||
MAPOLDACTIONS=No
|
||||
MARK_IN_FORWARD_CHAIN=No
|
||||
MINIUPNPD=Yes
|
||||
MODULE_SUFFIX="ko ko.xz"
|
||||
MINIUPNPD=No
|
||||
MULTICAST=No
|
||||
MUTEX_TIMEOUT=60
|
||||
NULL_ROUTE_RFC1918=unreachable
|
||||
@@ -233,13 +305,13 @@ TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
|
||||
TRACK_PROVIDERS=Yes
|
||||
TRACK_RULES=No
|
||||
USE_DEFAULT_RT=Yes
|
||||
USE_NFLOG_SIZE=No
|
||||
USE_NFLOG_SIZE=Yes
|
||||
USE_PHYSICAL_NAMES=Yes
|
||||
USE_RT_NAMES=Yes
|
||||
VERBOSE_MESSAGES=No
|
||||
WARNOLDCAPVERSION=Yes
|
||||
WORKAROUNDS=No
|
||||
ZERO_MARKS=Yes
|
||||
ZERO_MARKS=No
|
||||
ZONE2ZONE=-
|
||||
###############################################################################
|
||||
# P A C K E T D I S P O S I T I O N
|
||||
@@ -270,6 +342,14 @@ ZONE_BITS=0
|
||||
<para>The contents of /etc/shorewall6/shorewall6.conf are:</para>
|
||||
|
||||
<programlisting>###############################################################################
|
||||
#
|
||||
# Shorewall Version 5 -- /etc/shorewall6/shorewall6.conf
|
||||
#
|
||||
# For information about the settings in this file, type "man shorewall6.conf"
|
||||
#
|
||||
# Manpage also online at
|
||||
# http://www.shorewall.net/manpages6/shorewall6.conf.html
|
||||
###############################################################################
|
||||
# S T A R T U P E N A B L E D
|
||||
###############################################################################
|
||||
STARTUP_ENABLED=Yes
|
||||
@@ -344,7 +424,7 @@ ACCOUNTING=Yes
|
||||
ACCOUNTING_TABLE=mangle
|
||||
ADMINISABSENTMINDED=Yes
|
||||
AUTOCOMMENT=Yes
|
||||
AUTOHELPERS=Yes
|
||||
AUTOHELPERS=No
|
||||
AUTOMAKE=Yes
|
||||
BALANCE_PROVIDERS=No
|
||||
BASIC_FILTERS=No
|
||||
@@ -359,8 +439,8 @@ DYNAMIC_BLACKLIST="ipset-only,disconnect,timeout=7200"
|
||||
EXPAND_POLICIES=Yes
|
||||
EXPORTMODULES=Yes
|
||||
FASTACCEPT=Yes
|
||||
FORWARD_CLEAR_MARK=Yes
|
||||
HELPERS=
|
||||
FORWARD_CLEAR_MARK=No
|
||||
HELPERS=ftp
|
||||
IGNOREUNKNOWNVARIABLES=No
|
||||
IMPLICIT_CONTINUE=No
|
||||
INLINE_MATCHES=No
|
||||
@@ -372,8 +452,7 @@ MACLIST_TABLE=filter
|
||||
MACLIST_TTL=
|
||||
MANGLE_ENABLED=Yes
|
||||
MARK_IN_FORWARD_CHAIN=No
|
||||
MINIUPNPD=Yes
|
||||
MODULE_SUFFIX=ko
|
||||
MINIUPNPD=No
|
||||
MUTEX_TIMEOUT=60
|
||||
OPTIMIZE=All
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
@@ -381,7 +460,7 @@ PERL_HASH_SEED=0
|
||||
REJECT_ACTION=
|
||||
REQUIRE_INTERFACE=No
|
||||
RESTART=restart
|
||||
RESTORE_DEFAULT_ROUTE=Yes
|
||||
RESTORE_DEFAULT_ROUTE=No
|
||||
RESTORE_ROUTEMARKS=Yes
|
||||
SAVE_IPSETS=No
|
||||
TC_ENABLED=Shared
|
||||
@@ -390,10 +469,10 @@ TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
|
||||
TRACK_PROVIDERS=Yes
|
||||
TRACK_RULES=No
|
||||
USE_DEFAULT_RT=Yes
|
||||
USE_NFLOG_SIZE=No
|
||||
USE_NFLOG_SIZE=Yes
|
||||
USE_PHYSICAL_NAMES=No
|
||||
USE_RT_NAMES=No
|
||||
VERBOSE_MESSAGES=Yes
|
||||
VERBOSE_MESSAGES=No
|
||||
WARNOLDCAPVERSION=Yes
|
||||
WORKAROUNDS=No
|
||||
ZERO_MARKS=No
|
||||
@@ -427,12 +506,12 @@ ZONE_BITS=0
|
||||
|
||||
<para>Because addresses and interfaces are different between the two
|
||||
address families, they cannot be hard-coded in the configuration files.
|
||||
/etc/shorewall/params is used to set shell variables whose contents will
|
||||
vary between Shorewall and Shorewall6. In the params file and in
|
||||
run-time extension files, the shell variable <emphasis
|
||||
role="bold">g_family</emphasis> can be used to determine which address
|
||||
family to use; if IPv4, then $g_family will expand to 4 and if IPv6,
|
||||
$g_family will expand to 6.</para>
|
||||
<filename>/etc/shorewall/params</filename> is used to set shell
|
||||
variables whose contents will vary between Shorewall and Shorewall6. In
|
||||
the <filename>params</filename> file and in run-time extension files,
|
||||
the shell variable <emphasis role="bold">g_family</emphasis> can be used
|
||||
to determine which address family to use; if IPv4, then $g_family will
|
||||
expand to 4 and if IPv6, $g_family will expand to 6.</para>
|
||||
|
||||
<para>The contents of /etc/shorewall/params is as follows:</para>
|
||||
|
||||
@@ -451,11 +530,12 @@ if [ $g_family = 4 ]; then
|
||||
LISTS=70.90.191.124 # IP address of lists.shorewall.net (MX)
|
||||
MAIL=70.90.191.122 # IP address of mail.shorewall.net (IMAPS)
|
||||
SERVER=70.90.191.125 # IP address of www.shorewall.org
|
||||
PROXY=Yes # Use TPROXY for local web access
|
||||
PROXY= # Use TPROXY for local web access
|
||||
ALL=0.0.0.0/0 # Entire address space
|
||||
LOC_ADDR=172.20.1.253 # IP address of the local LAN interface
|
||||
FAST_GATEWAY=10.2.10.1 # Default gateway through the IF_FAST interface
|
||||
FAST_MARK=0x20000 # Multi-ISP mark setting for IF_FAST
|
||||
IPSECMSS=1460
|
||||
#
|
||||
# Interface Options
|
||||
#
|
||||
@@ -474,11 +554,12 @@ else
|
||||
LISTS=[2001:470:b:227::42] # IP address of lists.shorewall.net (MX and HTTPS)
|
||||
MAIL=[2001:470:b:227::45] # IP address of mail.shorewall.net (IMAPS and HTTPS)
|
||||
SERVER=[2001:470:b:227::43] # IP address of www.shorewall.org (HTTP, FTP and RSYNC)
|
||||
PROXY=Yes # Use TPROXY for local web access
|
||||
PROXY=3 # Use TPROXY for local web access
|
||||
ALL=[::]/0 # Entire address space
|
||||
LOC_ADDR=[2601:601:8b00:bf0::1] # IP address of the local LAN interface
|
||||
LOC_ADDR=[2601:601:a000:16f0::1] # IP address of the local LAN interface
|
||||
FAST_GATEWAY=fe80::22e5:2aff:feb7:f2cf # Default gateway through the IF_FAST interface
|
||||
FAST_MARK=0x100 # Multi-ISP mark setting for IF_FAST
|
||||
IPSECMSS=1440
|
||||
#
|
||||
# Interface Options
|
||||
#
|
||||
@@ -487,8 +568,7 @@ else
|
||||
LOC_OPTIONS=forward=1,nodbl,routeback,physical=eth2
|
||||
DMZ_OPTIONS=routeback,forward=1,required,wait=30,nodbl,physical=br0
|
||||
IRC_OPTIONS=routeback,forward=1,required,wait=30,nodbl,physical=br1
|
||||
fi
|
||||
</programlisting>
|
||||
fi</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -496,17 +576,20 @@ fi
|
||||
|
||||
<para>Here is the /etc/shorewall/zones file:</para>
|
||||
|
||||
<programlisting>#ZONE TYPE OPTIONS IN OUT
|
||||
<programlisting>###############################################################################
|
||||
#ZONE TYPE OPTIONS IN OUT
|
||||
# OPTIONS OPTIONS
|
||||
|
||||
#
|
||||
# By using the 'ip' type, both Shorewall and Shorewall6 can share this file
|
||||
#
|
||||
|
||||
fw { TYPE=firewall }
|
||||
net { TYPE=ip }
|
||||
loc { TYPE=ip }
|
||||
dmz { TYPE=ip }
|
||||
apps { TYPE=ip }
|
||||
vpn1 { TYPE=ipsec, OPTIONS=mode=tunnel,proto=esp }
|
||||
vpn { TYPE=ipsec, OPTIONS=mode=tunnel,proto=esp,mss=$IPSECMSS }
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
@@ -517,6 +600,8 @@ vpn1 { TYPE=ipsec, OPTIONS=mode=tunnel,proto=esp }
|
||||
/etc/shorewall/params:</para>
|
||||
|
||||
<programlisting>#
|
||||
# The two address families use different production interfaces and different
|
||||
#
|
||||
# LOC_IF is the local LAN for both families
|
||||
# FAST_IF is a Comcast IPv6 beta uplink which is used for internet access from the local lan for both families
|
||||
# PROD_IF is the interface used by shorewall.org servers
|
||||
@@ -529,7 +614,8 @@ loc { INTERFACE=LOC_IF, OPTIONS=$LOC_OPTIONS }
|
||||
net { INTERFACE=FAST_IF, OPTIONS=$FAST_OPTIONS }
|
||||
net { INTERFACE=PROD_IF, OPTIONS=$PROD_OPTIONS }
|
||||
dmz { INTERFACE=DMZ_IF, OPTIONS=$DMZ_OPTIONS }
|
||||
apps { INTERFACE=IRC_IF, OPTIONS=$IRC_OPTIONS }</programlisting>
|
||||
apps { INTERFACE=IRC_IF, OPTIONS=$IRC_OPTIONS }
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -538,9 +624,9 @@ apps { INTERFACE=IRC_IF, OPTIONS=$IRC_OPTIONS }</programlisting>
|
||||
<para>/etc/shorewall/hosts is used to define the vpn zone:</para>
|
||||
|
||||
<programlisting>#ZONE HOSTS OPTIONS
|
||||
vpn1 { HOSTS=PROD_IF:$ALL }
|
||||
vpn1 { HOSTS=FAST_IF:$ALL }
|
||||
vpn1 { HOSTS=LOC_IF:$ALL }
|
||||
vpn { HOSTS=PROD_IF:$ALL }
|
||||
vpn { HOSTS=FAST_IF:$ALL }
|
||||
vpn { HOSTS=LOC_IF:$ALL }
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
@@ -549,17 +635,22 @@ vpn1 { HOSTS=LOC_IF:$ALL }
|
||||
|
||||
<para>The same set of policies apply to both address families:</para>
|
||||
|
||||
<programlisting>#SOURCE DEST POLICY LOGLEVEL RATE
|
||||
$FW { DEST=dmz,net, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
$FW { DEST=all, POLICY=ACCEPT }
|
||||
loc { DEST=net, POLICY=ACCEPT }
|
||||
loc,vpn1,apps { DEST=loc,vpn1,apps POLICY=ACCEPT }
|
||||
loc { DEST=fw, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
net { DEST=net, POLICY=NONE }
|
||||
net { DEST=fw, POLICY=BLACKLIST:+Broadcast(DROP),Multicast(DROP),DropDNSrep:$LOG_LEVEL, LOGLEVEL=$LOG_LEVEL, RATE=8/sec:30 }
|
||||
net { DEST=all, POLICY=BLACKLIST:+DropDNSrep:$LOG_LEVEL, LOGLEVEL=$LOG_LEVEL, RATE=8/sec:30 }
|
||||
dmz { DEST=fw, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
all { DEST=all, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
<programlisting>#SOURCE DEST POLICY LOGLEVEL RATE
|
||||
|
||||
$FW { DEST=dmz,net, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
$FW { DEST=all, POLICY=ACCEPT }
|
||||
|
||||
loc { DEST=net, POLICY=ACCEPT }
|
||||
loc,vpn,apps { DEST=loc,vpn,apps POLICY=ACCEPT }
|
||||
loc { DEST=fw, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
|
||||
net { DEST=net, POLICY=NONE }
|
||||
net { DEST=fw, POLICY=BLACKLIST:+Broadcast(DROP),Multicast(DROP),DropDNSrep:$LOG_LEVEL, LOGLEVEL=$LOG_LEVEL, RATE=8/sec:30 }
|
||||
net { DEST=all, POLICY=BLACKLIST:+DropDNSrep:$LOG_LEVEL, LOGLEVEL=$LOG_LEVEL, RATE=8/sec:30 }
|
||||
|
||||
dmz { DEST=fw, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
|
||||
all { DEST=all, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
@@ -597,7 +688,7 @@ all { DEST=all, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
# FAST_IF is primary, PROD_IF is fallback
|
||||
#
|
||||
?info Compiling with FALLBACK
|
||||
IPv6Fast { NUMBER=1, MARK=$FAST_MARK, INTERFACE=FAST_IF, GATEWAY=$FAST_GATEWAY, OPTIONS=loose,primary,persistent }
|
||||
IPv6Beta { NUMBER=1, MARK=$FAST_MARK, INTERFACE=FAST_IF, GATEWAY=$FAST_GATEWAY, OPTIONS=loose,primary,persistent,noautosrc }
|
||||
?if __IPV4
|
||||
ComcastB { NUMBER=4, MARK=0x10000, INTERFACE=PROD_IF, GATEWAY=10.1.10.1, OPTIONS=loose,fallback,persistent }
|
||||
?else
|
||||
@@ -607,19 +698,19 @@ all { DEST=all, POLICY=REJECT, LOGLEVEL=$LOG_LEVEL }
|
||||
# Statistically balance traffic between FAST_IF and PROD_IF
|
||||
?info Compiling with STATISTICAL
|
||||
?if __IPV4
|
||||
IPv6Fast { NUMBER=1, MARK=0x20000, INTERFACE=FAST_IF, GATEWAY=$FAST_GATEWAY, OPTIONS=loose,load=0.66666667,primary }
|
||||
IPv6Beta { NUMBER=1, MARK=0x20000, INTERFACE=FAST_IF, GATEWAY=$FAST_GATEWAY, OPTIONS=loose,load=0.66666667,primary }
|
||||
?else
|
||||
HE { NUMBER=2, MARK=0x200, INTERFACE=PROD_IF, OPTIONS=track,load=0.33333333,persistent }
|
||||
?endif
|
||||
?else
|
||||
?INFO Compiling with BALANCE
|
||||
IPv6Fast { NUMBER=1, MARK=0x100, INTERFACE=eth0, GATEWAY=$FAST_GATEWAY, OPTIONS=track,balance=2,loose,persistent }
|
||||
IPv6Beta { NUMBER=1, MARK=0x100, INTERFACE=eth0, GATEWAY=$FAST_GATEWAY, OPTIONS=track,balance=2,loose,persistent }
|
||||
?if __IPV4
|
||||
ComcastB { NUMBER=4, MARK=0x10000, INTERFACE=IPV4_IF, GATEWAY=10.1.10.1, OPTIONS=nohostroute,loose,balance,persistent }
|
||||
?else
|
||||
?warning No BALANCE IPv6 configuration - using FALLBACK
|
||||
?warning No BALANCE IPv6 configuration
|
||||
HE { NUMBER=2, MARK=0x200, INTERFACE=PROD_IF, OPTIONS=fallback,persistent }
|
||||
?endif
|
||||
?endif
|
||||
?endif
|
||||
|
||||
Tproxy { NUMBER=3, INTERFACE=lo, OPTIONS=tproxy }
|
||||
@@ -636,19 +727,35 @@ Tproxy { NUMBER=3, INTERFACE=lo, OPTIONS=tproxy }
|
||||
|
||||
#
|
||||
# This file ensures that the DMZ is routed out of the IF_PROD interface
|
||||
# and that the IPv6 subnets delegated by the Fast router are routed out
|
||||
# and that the IPv6 subnets delegated by the Beta router are routed out
|
||||
# of the IF_FAST interface.
|
||||
#
|
||||
?if __IPV4
|
||||
{ SOURCE=70.90.191.121,70.90.191.123, PROVIDER=ComcastB, PRIORITY=1000! }
|
||||
{ SOURCE=&FAST_IF, PROVIDER=IPv6Fast, PRIORITY=1000! }
|
||||
{ SOURCE=br0, PROVIDER=ComcastB, PRIORITY=11000 }
|
||||
{ SOURCE=70.90.191.121,70.90.191.123,10.1.10.1 PROVIDER=ComcastB, PRIORITY=1000! }
|
||||
{ SOURCE=&FAST_IF, PROVIDER=IPv6Beta, PRIORITY=1000! }
|
||||
{ SOURCE=br0, PROVIDER=ComcastB, PRIORITY=11000 }
|
||||
?else
|
||||
{ SOURCE=2001:470:A:227::/64, PROVIDER=HE, PRIORITY=1000! }
|
||||
{ SOURCE=2001:470:B:227::/64, PROVIDER=HE, PRIORITY=11000 }
|
||||
{ SOURCE=2601:601:8b00:bf0::/56 PROVIDER=IPv6Fast, PRIORITY=11000 }
|
||||
?endif
|
||||
</programlisting>
|
||||
{ SOURCE=2601:601:a000:1600::/64 PROVIDER=IPv6Beta, PRIORITY=1000! }
|
||||
{ SOURCE=2001:470:B:227::/64, PROVIDER=HE, PRIORITY=1000! }
|
||||
{ SOURCE=2601:601:a000:16f0::/60 PROVIDER=IPv6Beta, PRIORITY=11000 }
|
||||
?endif</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>routes</title>
|
||||
|
||||
<para>This file is used only for IPv6:</para>
|
||||
|
||||
<programlisting>#PROVIDER DEST GATEWAY DEVICE OPTIONS
|
||||
?if __IPV6
|
||||
#
|
||||
# In my version of FOOLSM (1.0.10), the 'sourceip' option doesn't work.
|
||||
# As a result, routing rules that specify the source IPv6 address are
|
||||
# not effective in routing the 'ping' request packets out of FAST_IF.
|
||||
# The following route solves that problem.
|
||||
#
|
||||
{ PROVIDER=main, DEST=2001:558:4082:d3::1/128, GATEWAY=fe80::22e5:2aff:feb7:f2cf, DEVICE=FAST_IF, OPTIONS=persistent }
|
||||
?endif</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -671,6 +778,20 @@ $1 $MIRRORS
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Macros</title>
|
||||
|
||||
<para>/etc/shorewall/macro.FTP:</para>
|
||||
|
||||
<programlisting>###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||
PARAM - - tcp 21
|
||||
</programlisting>
|
||||
|
||||
<para>This is just the normal Shorewall FTP macro without the helper
|
||||
logic -- we take care of that in the conntrack file below.</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>conntrack</title>
|
||||
|
||||
@@ -715,6 +836,8 @@ Trcrt(ACCEPT) { SOURCE=net, DEST=all, RATE=d:ping:2/sec:10 }
|
||||
ACCEPT { SOURCE=all, DEST=dmz:$SERVER, PROTO=tcp, DPORT=61001:62000, helper=ftp }
|
||||
ACCEPT { SOURCE=dmz, DEST=all, PROTO=tcp, helper=ftp }
|
||||
ACCEPT { SOURCE=all, DEST=net, PROTO=tcp, helper=ftp }
|
||||
ACCEPT { SOURCE=$FW, DEST=loc, PROTO=tcp, helper=ftp }
|
||||
ACCEPT { SOURCE=loc, DEST=$FW, PROTO=tcp, helper=ftp }
|
||||
ACCEPT { SOURCE=all, DEST=all, PROTO=icmp }
|
||||
RST(ACCEPT) { SOURCE=all, DEST=all }
|
||||
ACCEPT { SOURCE=dmz, DEST=dmz }
|
||||
@@ -739,8 +862,8 @@ CONTINUE { SOURCE=$FW, DEST=all }
|
||||
######################################################################################################
|
||||
# Stop certain outgoing traffic to the net
|
||||
#
|
||||
REJECT:$LOG_LEVEL { SOURCE=loc,vpn1,apps DEST=net, PROTO=tcp, DPORT=25 } #Stop direct loc->net SMTP (Comcast uses submission).
|
||||
REJECT:$LOG_LEVEL { SOURCE=loc,vpn1,apps DEST=net, PROTO=udp, DPORT=1025:1031 } #MS Messaging
|
||||
REJECT:$LOG_LEVEL { SOURCE=loc,vpn,apps DEST=net, PROTO=tcp, DPORT=25 } #Stop direct loc->net SMTP (Comcast uses submission).
|
||||
REJECT:$LOG_LEVEL { SOURCE=loc,vpn,apps DEST=net, PROTO=udp, DPORT=1025:1031 } #MS Messaging
|
||||
|
||||
REJECT { SOURCE=all, DEST=net, PROTO=tcp, DPORT=137,445, comment="Stop NETBIOS Crap" }
|
||||
REJECT { SOURCE=all, DEST=net, PROTO=udp, DPORT=137:139, comment="Stop NETBIOS Crap" }
|
||||
@@ -761,7 +884,7 @@ REJECT { SOURCE=all, DEST=net, PROTO=udp, DPORT=3544, comment="Stop Teredo" }
|
||||
######################################################################################################
|
||||
# Ping
|
||||
#
|
||||
Ping(ACCEPT) { SOURCE=$FW,loc,dmz,vpn1, DEST=$FW,loc,dmz,vpn1 }
|
||||
Ping(ACCEPT) { SOURCE=$FW,loc,dmz,vpn, DEST=$FW,loc,dmz,vpn }
|
||||
Ping(ACCEPT) { SOURCE=all, DEST=net }
|
||||
######################################################################################################
|
||||
# SSH
|
||||
@@ -775,7 +898,7 @@ SSH(DNAT-) { SOURCE=net, DEST=172.20.2.44, PROTO=tcp, DPORT=ssh,
|
||||
######################################################################################################
|
||||
# DNS
|
||||
#
|
||||
DNS(ACCEPT) { SOURCE=loc,dmz,vpn1,apps, DEST=$FW }
|
||||
DNS(ACCEPT) { SOURCE=loc,dmz,vpn,apps, DEST=$FW }
|
||||
DNS(ACCEPT) { SOURCE=$FW, DEST=net }
|
||||
######################################################################################################
|
||||
# Traceroute
|
||||
@@ -791,27 +914,31 @@ SMTP(REJECT) { SOURCE=dmz:$LISTS, DEST=net }
|
||||
IMAPS(ACCEPT) { SOURCE=all, DEST=dmz:$MAIL }
|
||||
Submission(ACCEPT) { SOURCE=all, DEST=dmz:$LISTS }
|
||||
SMTPS(ACCEPT) { SOURCE=all, DEST=dmz:$LISTS }
|
||||
IMAP(ACCEPT) { SOURCE=loc,vpn1, DEST=net }
|
||||
IMAP(ACCEPT) { SOURCE=loc,vpn, DEST=net }
|
||||
######################################################################################################
|
||||
# NTP
|
||||
#
|
||||
NTP(ACCEPT) { SOURCE=all, DEST=net }
|
||||
NTP(ACCEPT) { SOURCE=loc,vpn1,dmz,apps DEST=$FW }
|
||||
NTP(ACCEPT) { SOURCE=loc,vpn,dmz,apps DEST=$FW }
|
||||
######################################################################################################
|
||||
# Squid
|
||||
ACCEPT { SOURCE=loc,vpn, DEST=$FW, PROTO=tcp, DPORT=3128 }
|
||||
######################################################################################################
|
||||
# HTTP/HTTPS
|
||||
#
|
||||
Web(ACCEPT) { SOURCE=loc,vpn1 DEST=$FW }
|
||||
Web(ACCEPT) { SOURCE=loc,vpn DEST=$FW }
|
||||
Web(ACCEPT) { SOURCE=$FW, DEST=net, USER=proxy }
|
||||
Web(DROP) { SOURCE=net, DEST=fw, PROTO=tcp, comment="Do not blacklist web crawlers" }
|
||||
HTTP(ACCEPT) { SOURCE=net,loc,vpn1,apps,$FW DEST=dmz:$SERVER,$LISTS }
|
||||
HTTPS(ACCEPT) { SOURCE=net,loc,vpn1,apps,$FW DEST=dmz:$LISTS,$MAIL }
|
||||
HTTP(ACCEPT) { SOURCE=net,loc,vpn,apps,$FW DEST=dmz:$SERVER,$LISTS,$MAIL }
|
||||
HTTPS(ACCEPT) { SOURCE=net,loc,vpn,apps,$FW DEST=dmz:$LISTS,$MAIL }
|
||||
Web(ACCEPT) { SOURCE=dmz,apps DEST=net,$FW }
|
||||
Web(ACCEPT) { SOURCE=$FW, DEST=net, USER=root }
|
||||
Web(ACCEPT) { SOURCE=$FW, DEST=net, USER=teastep }
|
||||
Web(ACCEPT) { SOURCE=$FW, DEST=net, USER=_apt }
|
||||
######################################################################################################
|
||||
# FTP
|
||||
#
|
||||
FTP(ACCEPT) { SOURCE=loc,vpn1,apps DEST=net }
|
||||
FTP(ACCEPT) { SOURCE=loc,vpn,apps DEST=net }
|
||||
FTP(ACCEPT) { SOURCE=dmz, DEST=net }
|
||||
FTP(ACCEPT) { SOURCE=$FW, DEST=net, USER=root }
|
||||
FTP(ACCEPT) { SOURCE=all, DEST=dmz:$SERVER }
|
||||
@@ -832,11 +959,11 @@ Whois(ACCEPT) { SOURCE=all, DEST=net }
|
||||
# SMB
|
||||
#
|
||||
SMBBI(ACCEPT) { SOURCE=loc, DEST=$FW }
|
||||
SMBBI(ACCEPT) { SOURCE=vpn1, DEST=$FW }
|
||||
SMBBI(ACCEPT) { SOURCE=vpn, DEST=$FW }
|
||||
######################################################################################################
|
||||
# IRC
|
||||
#
|
||||
IRC(ACCEPT) { SOURCE=loc,vpn1,apps:IRC_IF, DEST=net }
|
||||
IRC(ACCEPT) { SOURCE=loc,apps, DEST=net }
|
||||
######################################################################################################
|
||||
# Rsync
|
||||
#
|
||||
@@ -879,13 +1006,13 @@ Mirrors(ACCEPT:none) { SOURCE=net, DEST=dmz:$SERVER, PROTO=tcp, DPORT=873 }
|
||||
<programlisting>#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
||||
|
||||
?if __IPV4
|
||||
MASQUERADE { SOURCE=172.20.1.0/24,172.20.2.0/24, DEST=FAST_IF }
|
||||
MASQUERADE { SOURCE=172.20.1.0/24,172.20.2.0/23, DEST=FAST_IF }
|
||||
MASQUERADE { SOURCE=70.90.191.120/29, DEST=FAST_IF }
|
||||
SNAT(70.90.191.121) { SOURCE=!70.90.191.120/29, DEST=PROD_IF, PROBABILITY=0.50, COMMENT="Masquerade Local Network" }
|
||||
SNAT(70.90.191.123) { SOURCE=!70.90.191.120/29, DEST=PROD_IF, COMMENT="Masquerade Local Network" }
|
||||
SNAT(172.20.1.253) { SOURCE=172.20.3.0/24, DEST=LOC_IF:172.20.1.100 }
|
||||
?else
|
||||
SNAT(&PROD_IF) { SOURCE=2601:601:8b00:bf0::56, DEST=PROD_IF }
|
||||
SNAT(&PROD_IF) { SOURCE=2601:601:8b00:bf0::/60, DEST=PROD_IF }
|
||||
SNAT(&FAST_IF) { SOURCE=2001:470:b:227::/64,2001:470:a:227::2, DEST=FAST_IF }
|
||||
?endif
|
||||
</programlisting>
|
||||
@@ -897,8 +1024,8 @@ Mirrors(ACCEPT:none) { SOURCE=net, DEST=dmz:$SERVER, PROTO=tcp, DPORT=873 }
|
||||
<para>Both address families define IPSEC tunnels:</para>
|
||||
|
||||
<programlisting>#TYPE ZONE GATEWAY GATEWAY_ZONE
|
||||
ipsecnat {ZONE=net, GATEWAY=$ALL, GATEWAY_ZONE=vpn1 }
|
||||
ipsecnat {ZONE=loc, GATEWAY=$ALL, GATEWAY_ZONE=vpn1 }
|
||||
ipsecnat {ZONE=net, GATEWAY=$ALL, GATEWAY_ZONE=vpn }
|
||||
ipsecnat {ZONE=loc, GATEWAY=$ALL, GATEWAY_ZONE=vpn }
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
|
@@ -147,7 +147,7 @@
|
||||
|
||||
<para>To integrate with NetworkManager and ifup/ifdown, additional steps
|
||||
are required. You probably don't want to enable this feature if you run a
|
||||
link status monitor like swping or LSM.</para>
|
||||
link status monitor like FOOLSM.</para>
|
||||
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user