forked from extern/shorewall_code
Compare commits
216 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
109ae7e038 | ||
|
49ba75252e | ||
|
c835fead34 | ||
|
d1d8371eb8 | ||
|
5d58b5da72 | ||
|
4469ddb861 | ||
|
cd5409d633 | ||
|
2f58d4e368 | ||
|
31844d22cd | ||
|
628f5f0903 | ||
|
ce73c783dc | ||
|
e7318459f1 | ||
|
467d41f0cc | ||
|
ff64539de3 | ||
|
418f96082e | ||
|
b761a6eaa0 | ||
|
f8b7815375 | ||
|
d643f57bc1 | ||
|
d1c7b3d9da | ||
|
d399fd0815 | ||
|
3dc14e3575 | ||
|
7ba6ac71e3 | ||
|
10aef23ab1 | ||
|
e3f139bbdb | ||
|
e4f24f41fd | ||
|
d0e4c53bd0 | ||
|
43ac903085 | ||
|
28b92dae32 | ||
|
bac493c2c5 | ||
|
3ed1cdec94 | ||
|
3f5bdfd705 | ||
|
c9512dfaf8 | ||
|
5cc626fa1d | ||
|
a39ecf5b2b | ||
|
631bec2762 | ||
|
aa126270b7 | ||
|
af2b7e6fc1 | ||
|
01bfdabd5a | ||
|
c234a1a0ec | ||
|
4c50f3b9bf | ||
|
3390897a45 | ||
|
7ca18c410b | ||
|
e2aeed898d | ||
|
2eb1c88555 | ||
|
117e9ba5bd | ||
|
3ce04a8ef3 | ||
|
737aca6a3d | ||
|
d89d35a9f0 | ||
|
220e89755e | ||
|
1d875b2909 | ||
|
011638ad7d | ||
|
3f5c47695e | ||
|
fb14b0aafc | ||
|
54ab7cdeb5 | ||
|
aa47554604 | ||
|
07160c5ed1 | ||
|
527533ecb6 | ||
|
4ac64a545c | ||
|
6612ea6b8c | ||
|
2646ec79a5 | ||
|
023437a0e0 | ||
|
ffb6ac178e | ||
|
726d7cde65 | ||
|
c061d87919 | ||
|
5af7dce96b | ||
|
eb5bc3d8a4 | ||
|
b34474df11 | ||
|
16a3384a70 | ||
|
67b421dc00 | ||
|
c518887a19 | ||
|
5493a7e4a6 | ||
|
1093f1ac32 | ||
|
7882c87afe | ||
|
7343b19abc | ||
|
f27ab4704c | ||
|
e5e8e6fbc0 | ||
|
c11b647b1b | ||
|
5706c5a860 | ||
|
fd1d4a3f35 | ||
|
2bf9048057 | ||
|
d618fd5812 | ||
|
177cdb1b98 | ||
|
dddde56454 | ||
|
9b196e87e9 | ||
|
c30a4fd080 | ||
|
0a9d2d9a33 | ||
|
39de88563f | ||
|
e14798b4a2 | ||
|
3042ae815e | ||
|
86ebb22dd3 | ||
|
18360471ab | ||
|
086f7a0e6d | ||
|
057a2dec70 | ||
|
16af9ee2de | ||
|
cabadd4846 | ||
|
3c06be28be | ||
|
7d4d409799 | ||
|
32ca53706c | ||
|
0adb9c8f87 | ||
|
381d55760b | ||
|
88a799b860 | ||
|
5101a6be4a | ||
|
15ca726c49 | ||
|
27510d9ed6 | ||
|
f832846a8d | ||
|
64bf5882db | ||
|
6841fc9eb2 | ||
|
caa0290cb2 | ||
|
4e1262ec7e | ||
|
53b05aa5fb | ||
|
072053995c | ||
|
1be78f8f15 | ||
|
b6f5b6ba98 | ||
|
3c36d638a5 | ||
|
9d3da44dad | ||
|
a5d4cbd76c | ||
|
4e83d0788e | ||
|
a49a9f9f9d | ||
|
6dc99e77ae | ||
|
92b25d88b0 | ||
|
42a505c99d | ||
|
5e648a9379 | ||
|
ed2fa863c3 | ||
|
386dff4c33 | ||
|
e49f31fb42 | ||
|
3f0e4959a1 | ||
|
112c4dc38a | ||
|
137cc48779 | ||
|
f9003fab43 | ||
|
78da975989 | ||
|
be924ff765 | ||
|
6f484da821 | ||
|
82d2863b29 | ||
|
e855d03332 | ||
|
09712254e8 | ||
|
de39f7d3aa | ||
|
54a70e4632 | ||
|
c80462c283 | ||
|
a2e56492df | ||
|
3222a380c3 | ||
|
e82307f61e | ||
|
ae4f86a1e5 | ||
|
c33a72594c | ||
|
8496bf0ff3 | ||
|
a6c1cd6d7b | ||
|
2604378646 | ||
|
d24179173f | ||
|
803853c719 | ||
|
57f1f8658f | ||
|
0a34e4e685 | ||
|
b52a330f41 | ||
|
de761ac657 | ||
|
d3de75dd12 | ||
|
ca59556d44 | ||
|
639dc86e1b | ||
|
fa1aa4b481 | ||
|
3e2d7cf990 | ||
|
95d3486788 | ||
|
657673927c | ||
|
a345be20fb | ||
|
9f3534dc1f | ||
|
f63f0bb2f1 | ||
|
646f01a3a4 | ||
|
65e101f306 | ||
|
000f120c61 | ||
|
f221ca290f | ||
|
8b99f8caac | ||
|
8b2c79e5ce | ||
|
dcde2bfa4a | ||
|
1ec81b7d7b | ||
|
387b861759 | ||
|
f4e6d2fa56 | ||
|
6798c2f2b0 | ||
|
caa7475483 | ||
|
3f5e1b5b60 | ||
|
e8f49bc9c7 | ||
|
5021154867 | ||
|
f831d9a988 | ||
|
31b558b7f9 | ||
|
367a5f7d97 | ||
|
4efac2fda1 | ||
|
5f50b70618 | ||
|
b437f609e5 | ||
|
b897fe2b9d | ||
|
802ff1da4e | ||
|
f05bd969af | ||
|
7aaa04149e | ||
|
093e55083c | ||
|
c9eb443574 | ||
|
0aabb81c03 | ||
|
c763525e78 | ||
|
533e2472da | ||
|
08da235896 | ||
|
77cad81ba7 | ||
|
9213d7e707 | ||
|
157abcbd37 | ||
|
6da498510c | ||
|
2b7a37e42a | ||
|
84a220a651 | ||
|
51b9589c48 | ||
|
762df5e18c | ||
|
cb56991fee | ||
|
54c7e1a607 | ||
|
c4d5bb904b | ||
|
40f6192e19 | ||
|
7051daeb08 | ||
|
a9c42e1eaa | ||
|
8df70406df | ||
|
8b0cfdf779 | ||
|
c127cec76c | ||
|
6b21135ade | ||
|
2f66381a4a | ||
|
aa97b1b283 | ||
|
53495ec0a8 | ||
|
2f3f6ffa15 | ||
|
60f2f3b0d0 |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*targetname export-ignore
|
@@ -18,7 +18,7 @@ Shoreline Firewall (Shorewall) Version 5
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Please see http://www.shorewall.net/Install.htm for installation
|
||||
Please see https://shorewall.org/Install.htm for installation
|
||||
instructions.
|
||||
|
||||
|
||||
|
1
Shorewall-core/Shorewall-core-targetname
Normal file
1
Shorewall-core/Shorewall-core-targetname
Normal file
@@ -0,0 +1 @@
|
||||
5.2.6-base
|
2
Shorewall-core/configure
vendored
2
Shorewall-core/configure
vendored
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# (c) 2012,2014,2017 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://www.shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# (c) 2012, 2014 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://www.shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# (c) 2000-2018 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# (c) 1999-2017 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -937,11 +937,28 @@ show_events() {
|
||||
fi
|
||||
}
|
||||
|
||||
sort_actions() {
|
||||
local sep #separates sort keys from the action[.std] record
|
||||
sep="##"
|
||||
|
||||
awk -v sep="$sep" \
|
||||
'BEGIN { action = ""; ifrec = ""; nr = 0; };\
|
||||
/^#/ { next; };\
|
||||
/^\?(if|IF|If)/ { ifrec = $0; nr = NR; next; };\
|
||||
/^( |\t|\?)/ { if ( action != "" ) print action, NR, sep $0; next; };\
|
||||
{ action = $1; };\
|
||||
nr != 0 { print action , nr, sep ifrec; nr = 0; };\
|
||||
{ print action , NR, sep $0; }' | sort -k 1,2 | sed "s/^.*${sep}//"
|
||||
}
|
||||
|
||||
show_actions() {
|
||||
if [ -f ${g_confdir}/actions ]; then
|
||||
cat ${g_sharedir}/actions.std ${g_confdir}/actions | grep -Ev '^[#?[:space:]]|^$'
|
||||
local actions
|
||||
actions=$(find_file actions)
|
||||
|
||||
if [ -f ${actions} ]; then
|
||||
cat ${actions} ${g_sharedir}/actions.std | sort_actions
|
||||
else
|
||||
grep -Ev '^[#?[:space:]]|^$' ${g_sharedir}/actions.std
|
||||
sort_actions < ${g_sharedir}/actions.std
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1108,10 +1125,6 @@ show_blacklists() {
|
||||
show_bl;
|
||||
}
|
||||
|
||||
show_actions_sorted() {
|
||||
show_actions | sort
|
||||
}
|
||||
|
||||
show_macros() {
|
||||
for directory in $(split $CONFIG_PATH); do
|
||||
temp=
|
||||
@@ -1543,7 +1556,7 @@ show_command() {
|
||||
;;
|
||||
actions)
|
||||
[ $# -gt 1 ] && too_many_arguments $2
|
||||
eval show_actions_sorted $g_pager
|
||||
eval show_actions $g_pager
|
||||
return
|
||||
;;
|
||||
macro)
|
||||
@@ -2651,6 +2664,7 @@ allow_command() {
|
||||
if [ -n "$g_blacklistipset" ]; then
|
||||
if qt $IPSET -D $g_blacklistipset $1; then
|
||||
allowed=Yes
|
||||
[ -n "$g_dbllog" ] && mylogger daemon.info "$g_product: $1 Allowed"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -2667,6 +2681,7 @@ allow_command() {
|
||||
*)
|
||||
if [ -n "$g_blacklistipset" ]; then
|
||||
if qt $IPSET -D $g_blacklistipset $1; then
|
||||
[ -n "$g_dbllog" ] && mylogger daemon.info "$g_product: $1 Allowed"
|
||||
allowed=Yes
|
||||
fi
|
||||
fi
|
||||
@@ -3622,6 +3637,7 @@ reject_command() {
|
||||
|
||||
blacklist_command() {
|
||||
local family
|
||||
local timeout
|
||||
|
||||
[ $# -gt 0 ] || fatal_error "Missing address"
|
||||
|
||||
@@ -3639,10 +3655,17 @@ blacklist_command() {
|
||||
;;
|
||||
esac
|
||||
|
||||
if $IPSET -A $g_blacklistipset $@ -exist; then
|
||||
if [ $COMMAND = 'blacklist!' ]; then
|
||||
timeout='timeout 0'
|
||||
else
|
||||
echo "$@" | fgrep -q ' timeout ' || timeout="timeout $g_dbltimeout"
|
||||
fi
|
||||
|
||||
if $IPSET -A $g_blacklistipset $@ $timeout -exist; then
|
||||
local message
|
||||
|
||||
progress_message2 "$1 Blacklisted"
|
||||
[ -n "$g_dbllog" ] && mylogger daemon.info "$g_product: $1 Blacklisted"
|
||||
|
||||
if [ -n "$g_disconnect" ]; then
|
||||
message="$(conntrack -D -s $1 2>&1)"
|
||||
@@ -3897,7 +3920,7 @@ setup_dbl() {
|
||||
case $DYNAMIC_BLACKLIST in
|
||||
ipset*,src-dst*)
|
||||
#
|
||||
# This utility doesn't need to know about 'src-dst'
|
||||
# Capture 'src-dst'
|
||||
#
|
||||
DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed 's/,src-dst//')
|
||||
|
||||
@@ -3905,11 +3928,49 @@ setup_dbl() {
|
||||
;;
|
||||
esac
|
||||
|
||||
case $DYNAMIC_BLACKLIST in
|
||||
ipset*,log*)
|
||||
#
|
||||
# Capture 'log'
|
||||
#
|
||||
DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed 's/,log//')
|
||||
|
||||
g_dbllog=Yes
|
||||
;;
|
||||
esac
|
||||
|
||||
case $DYNAMIC_BLACKLIST in
|
||||
ipset*,noupdate*)
|
||||
#
|
||||
# This utility doesn't use this option
|
||||
#
|
||||
DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed 's/,noupdate//')
|
||||
;;
|
||||
esac
|
||||
|
||||
case $DYNAMIC_BLACKLIST in
|
||||
ipset*,timeout*)
|
||||
#
|
||||
# This utility doesn't need to know about 'timeout=nnn'
|
||||
# Capture timeout
|
||||
#
|
||||
local ifs
|
||||
local f
|
||||
|
||||
ifs=$IFS
|
||||
IFS=','
|
||||
|
||||
for f in $DYNAMIC_BLACKLIST; do
|
||||
case $f in
|
||||
timeout=*)
|
||||
g_dbltimeout=${f#timeout=}
|
||||
g_dbltimeout=${g_dbltimeout%%:*}
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
IFS=$ifs
|
||||
|
||||
DYNAMIC_BLACKLIST=$(echo $DYNAMIC_BLACKLIST | sed -r 's/,timeout=[[:digit:]]+//')
|
||||
;;
|
||||
esac
|
||||
@@ -3964,7 +4025,7 @@ get_config() {
|
||||
|
||||
ensure_config_path
|
||||
|
||||
[ -f $g_firewall.conf ] && . ${VARDIR}/firewall.conf
|
||||
[ -f ${VARDIR}/firewall.conf ] && . ${VARDIR}/firewall.conf
|
||||
|
||||
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
@@ -4120,14 +4181,14 @@ start_command() {
|
||||
|
||||
if [ -x $g_firewall ]; then
|
||||
if [ -n "$g_fast" -a -x ${VARDIR}/${RESTOREFILE} -a ! $g_firewall -nt ${VARDIR}/${RESTOREFILE} ]; then
|
||||
run_it ${VARDIR}/${RESTOREFILE} $g_debugging restore
|
||||
run_it ${VARDIR}/${RESTOREFILE} restore
|
||||
else
|
||||
run_it $g_firewall $g_debugging start
|
||||
run_it $g_firewall start
|
||||
fi
|
||||
rc=$?
|
||||
else
|
||||
error_message "$g_firewall is missing or is not executable"
|
||||
mylogger kern.err "ERROR:$g_product start failed"
|
||||
mylogger daemon.err "ERROR:$g_product start failed"
|
||||
rc=6
|
||||
fi
|
||||
|
||||
@@ -4256,11 +4317,11 @@ restart_command() {
|
||||
[ -n "$g_nolock" ] || mutex_on
|
||||
|
||||
if [ -x $g_firewall ]; then
|
||||
run_it $g_firewall $g_debugging $COMMAND
|
||||
run_it $g_firewall $COMMAND
|
||||
rc=$?
|
||||
else
|
||||
error_message "$g_firewall is missing or is not executable"
|
||||
mylogger kern.err "ERROR:$g_product $COMMAND failed"
|
||||
mylogger daemon.err "ERROR:$g_product $COMMAND failed"
|
||||
rc=6
|
||||
fi
|
||||
|
||||
@@ -4270,7 +4331,7 @@ restart_command() {
|
||||
|
||||
run_command() {
|
||||
if [ -x $g_firewall ] ; then
|
||||
run_it $g_firewall $g_debugging $@
|
||||
run_it $g_firewall $@
|
||||
else
|
||||
fatal_error "$g_firewall does not exist or is not executable"
|
||||
fi
|
||||
@@ -4287,14 +4348,20 @@ ecko() {
|
||||
#
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
echo "Usage: $(basename $0) [debug|trace] [nolock] [ -q ] [ -v[-1|{0-2}] ] [ -t ] <command>"
|
||||
echo "Usage: $(basename $0) [ -T ] [ -D ] [ -N ] [ -q ] [ -v[-1|{0-2}] ] [ -t ] <command>"
|
||||
echo " -T : Direct the generated script to produce a shell trace to standard error"
|
||||
echo " -D : Debug iptables commands"
|
||||
echo " -N : Don't take the master shorewall lock"
|
||||
echo " -q : Standard Shorewall verbosity control"
|
||||
echo " -v : Standard Shorewall verbosity control"
|
||||
echo " -t : Timestamp all messages"
|
||||
echo "where <command> is one of:"
|
||||
echo " add <interface>[:<host-list>] ... <zone>"
|
||||
echo " allow <address> ..."
|
||||
echo " blacklist <address> [ <option> ... ]"
|
||||
ecko " [ check | ck ] [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ -i ] [ <directory> ]"
|
||||
ecko " [ check | ck ] [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ -i ] [ -D ] [ <directory> ]"
|
||||
echo " clear"
|
||||
ecko " [ compile | co ] [ -e ] [ -p ] [ -t ] [ -c ] [ -d ] [ -T ] [ -i ] [ <directory name> ] [ <path name> ]"
|
||||
ecko " [ compile | co ] [ -e ] [ -p ] [ -t ] [ -c ] [ -d ] [ -T ] [ -i ] [ -D ] [ <directory name> ] [ <path name> ]"
|
||||
echo " close <source> <dest> [ <protocol> [ <port> ] ]"
|
||||
echo " delete <interface>[:<host-list>] ... <zone>"
|
||||
echo " disable <interface>"
|
||||
@@ -4317,7 +4384,6 @@ usage() # $1 = exit status
|
||||
echo " iptrace <ip6tables match expression>"
|
||||
fi
|
||||
|
||||
ecko " load [ -s ] [ -c ] [ -r <root user> ] [ -T ] [ -i ] [ <directory> ] <system>"
|
||||
echo " logdrop <address> ..."
|
||||
echo " logreject <address> ..."
|
||||
echo " logwatch [<refresh interval>]"
|
||||
@@ -4335,7 +4401,7 @@ usage() # $1 = exit status
|
||||
if [ -n "$g_lite" ]; then
|
||||
echo " reload [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]"
|
||||
else
|
||||
echo " reload [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ <directory> ]"
|
||||
echo " reload [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ -D ] [ <directory> ]"
|
||||
fi
|
||||
|
||||
if [ -z "$g_lite" ]; then
|
||||
@@ -4351,7 +4417,7 @@ usage() # $1 = exit status
|
||||
if [ -n "$g_lite" ]; then
|
||||
echo " restart [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]"
|
||||
else
|
||||
echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ <directory> ]"
|
||||
echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ -C ] [ -D ] [ <directory> ]"
|
||||
fi
|
||||
|
||||
echo " restore [ -n ] [ -p ] [ -C ] [ <file name> ]"
|
||||
@@ -4415,20 +4481,16 @@ usage() # $1 = exit status
|
||||
# here if that lib is loaded below.
|
||||
#
|
||||
shorewall_cli() {
|
||||
g_debugging=
|
||||
|
||||
if [ $# -gt 0 ] && [ "x$1" = "xdebug" -o "x$1" = "xtrace" ]; then
|
||||
g_debugging=$1
|
||||
shift
|
||||
fi
|
||||
|
||||
g_nolock=
|
||||
|
||||
#
|
||||
# We'll keep this around for a while so we don't break people's started scripts
|
||||
#
|
||||
if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
|
||||
g_nolock=nolock
|
||||
shift
|
||||
fi
|
||||
|
||||
g_debugging=
|
||||
g_noroutes=
|
||||
g_purge=
|
||||
g_ipt_options="-nv"
|
||||
@@ -4456,6 +4518,9 @@ shorewall_cli() {
|
||||
g_blacklistipset=
|
||||
g_disconnect=
|
||||
g_havemutex=
|
||||
g_trace=
|
||||
g_dbltimeout=
|
||||
g_dbllog=
|
||||
|
||||
VERBOSE=
|
||||
VERBOSITY=1
|
||||
@@ -4587,6 +4652,17 @@ shorewall_cli() {
|
||||
finished=1
|
||||
option=
|
||||
;;
|
||||
T*)
|
||||
g_debugging=trace
|
||||
option=${option#T}
|
||||
;;
|
||||
D*)
|
||||
g_debugging=debug
|
||||
option=${option#D}
|
||||
;;
|
||||
N*)
|
||||
g_nolock=nolock
|
||||
;;
|
||||
*)
|
||||
option_error $option
|
||||
;;
|
||||
@@ -4639,7 +4715,7 @@ shorewall_cli() {
|
||||
get_config
|
||||
[ -x $g_firewall ] || fatal_error "$g_product has never been started"
|
||||
[ -n "$g_nolock" ] || mutex_on
|
||||
run_it $g_firewall $g_debugging $COMMAND
|
||||
run_it $g_firewall $COMMAND
|
||||
[ -n "$g_nolock" ] || mutex_off
|
||||
;;
|
||||
reset)
|
||||
@@ -4648,7 +4724,7 @@ shorewall_cli() {
|
||||
shift
|
||||
[ -n "$g_nolock" ] || mutex_on
|
||||
[ -x $g_firewall ] || fatal_error "$g_product has never been started"
|
||||
run_it $g_firewall $g_debugging reset $@
|
||||
run_it $g_firewall reset $@
|
||||
[ -n "$g_nolock" ] || mutex_off
|
||||
;;
|
||||
reload|restart)
|
||||
@@ -4661,12 +4737,12 @@ shorewall_cli() {
|
||||
only_root
|
||||
get_config Yes
|
||||
if product_is_started; then
|
||||
run_it $g_firewall $g_debugging $@
|
||||
run_it $g_firewall $@
|
||||
else
|
||||
fatal_error "$g_product is not running"
|
||||
fi
|
||||
;;
|
||||
blacklist)
|
||||
blacklist|blacklist!)
|
||||
only_root
|
||||
get_config Yes
|
||||
shift
|
||||
@@ -4744,7 +4820,7 @@ shorewall_cli() {
|
||||
;;
|
||||
allow)
|
||||
only_root
|
||||
get_config
|
||||
get_config Yes
|
||||
allow_command $@
|
||||
;;
|
||||
add)
|
||||
@@ -4816,7 +4892,7 @@ shorewall_cli() {
|
||||
# It isn't a function visible to this script -- try
|
||||
# the compiled firewall
|
||||
#
|
||||
run_it $g_firewall $g_debugging call $@
|
||||
run_it $g_firewall call $@
|
||||
fi
|
||||
else
|
||||
missing_argument
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# (c) 2010-2018 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -55,13 +55,13 @@ startup_error() # $* = Error Message
|
||||
|
||||
case $COMMAND in
|
||||
start)
|
||||
mylogger kern.err "ERROR:$g_product start failed:Firewall state not changed"
|
||||
mylogger daemon.err "ERROR:$g_product start failed:Firewall state not changed"
|
||||
;;
|
||||
restart)
|
||||
mylogger kern.err "ERROR:$g_product restart failed:Firewall state not changed"
|
||||
mylogger daemon.err "ERROR:$g_product restart failed:Firewall state not changed"
|
||||
;;
|
||||
restore)
|
||||
mylogger kern.err "ERROR:$g_product restore failed:Firewall state not changed"
|
||||
mylogger daemon.err "ERROR:$g_product restore failed:Firewall state not changed"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -92,18 +92,20 @@ startup_error() # $* = Error Message
|
||||
#
|
||||
run_it() {
|
||||
local script
|
||||
local options
|
||||
local options='-'
|
||||
|
||||
export VARDIR
|
||||
|
||||
script=$1
|
||||
shift
|
||||
|
||||
if [ x$1 = xtrace -o x$1 = xdebug ]; then
|
||||
options="$1 -"
|
||||
shift;
|
||||
|
||||
if [ "$g_debugging" = debug ]; then
|
||||
options='-D'
|
||||
elif [ "$g_debugging" = trace ]; then
|
||||
options='-T'
|
||||
else
|
||||
options='-'
|
||||
options='-';
|
||||
fi
|
||||
|
||||
[ -n "$g_noroutes" ] && options=${options}n
|
||||
@@ -736,8 +738,8 @@ truncate() # $1 = length
|
||||
|
||||
#
|
||||
# Call this function to assert mutual exclusion with Shorewall. If you invoke the
|
||||
# /sbin/shorewall program while holding mutual exclusion, you should pass "nolock" as
|
||||
# the first argument. Example "shorewall nolock refresh"
|
||||
# /sbin/shorewall program while holding mutual exclusion, you should pass -N as
|
||||
# the first argument. Example "shorewall -N refresh"
|
||||
#
|
||||
# This function uses the lockfile utility from procmail if it exists.
|
||||
# Otherwise, it uses a somewhat race-prone algorithm to attempt to simulate the
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# (c) 1999-2017 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -337,8 +337,15 @@ ensure_config_path() {
|
||||
. $F
|
||||
fi
|
||||
|
||||
if [ -n "$g_shorewalldir" ]; then
|
||||
[ "${CONFIG_PATH%%:*}" = "$g_shorewalldir" ] || CONFIG_PATH=$g_shorewalldir:$CONFIG_PATH
|
||||
if [ -n "$g_shorewalldir" ] && [ "${CONFIG_PATH%%:*}" = "$g_shorewalldir" ];then
|
||||
case $CONFIG_PATH in
|
||||
:*)
|
||||
CONFIG_PATH=${g_shorewalldir}${CONFIG_PATH}
|
||||
;;
|
||||
*)
|
||||
CONFIG_PATH=$g_shorewalldir:$CONFIG_PATH
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# (c) 2017 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# (c) 2017 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -21,9 +21,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg rep="norepeat">options</arg>
|
||||
|
||||
<arg choice="plain"><option>add {</option></arg>
|
||||
@@ -39,9 +36,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>allow</option></arg>
|
||||
@@ -52,12 +46,9 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>blacklist</option></arg>
|
||||
<arg choice="plain"><option>blacklist[!]</option></arg>
|
||||
|
||||
<arg
|
||||
choice="plain"><replaceable>address</replaceable><arg><replaceable>option</replaceable>
|
||||
@@ -67,9 +58,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>call</option></arg>
|
||||
@@ -106,9 +94,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg
|
||||
@@ -118,9 +103,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>close</option><arg choice="req">
|
||||
@@ -159,9 +141,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg rep="norepeat">options</arg>
|
||||
|
||||
<arg choice="plain"><option>delete {</option></arg>
|
||||
@@ -177,9 +156,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>disable</option></arg>
|
||||
@@ -191,9 +167,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>drop</option></arg>
|
||||
@@ -204,8 +177,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>dump</option></arg>
|
||||
@@ -222,9 +193,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>enable</option></arg>
|
||||
@@ -236,9 +204,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>export</option></arg>
|
||||
@@ -252,9 +217,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>forget</option></arg>
|
||||
@@ -265,8 +227,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>help</option></arg>
|
||||
@@ -275,8 +235,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg
|
||||
@@ -286,8 +244,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>ipcalc</option></arg>
|
||||
@@ -304,8 +260,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>iprange</option></arg>
|
||||
@@ -317,8 +271,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>iptrace</option></arg>
|
||||
@@ -330,9 +282,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>logdrop</option></arg>
|
||||
@@ -343,8 +292,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>logwatch</option></arg>
|
||||
@@ -357,9 +304,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>logreject</option></arg>
|
||||
@@ -370,8 +314,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>noiptrace</option></arg>
|
||||
@@ -394,9 +336,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>reenable</option></arg>
|
||||
@@ -408,9 +347,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>reject</option></arg>
|
||||
@@ -421,9 +357,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>reload</option></arg>
|
||||
@@ -448,10 +381,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>remote-getcaps</option></arg>
|
||||
|
||||
<arg><option>-s</option></arg>
|
||||
@@ -472,8 +401,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>remote-getrc</option></arg>
|
||||
@@ -496,8 +423,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>remote-start</option></arg>
|
||||
@@ -520,8 +445,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>remote-reload</option></arg>
|
||||
@@ -544,8 +467,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>remote-restart</option></arg>
|
||||
@@ -568,9 +489,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg
|
||||
@@ -581,9 +499,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>restart</option></arg>
|
||||
@@ -608,9 +523,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg
|
||||
@@ -622,9 +534,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>run</option></arg>
|
||||
@@ -637,9 +546,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>safe-restart</option></arg>
|
||||
@@ -656,8 +562,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>safe-start</option></arg>
|
||||
@@ -674,9 +578,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg
|
||||
@@ -688,9 +589,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>savesets</option></arg>
|
||||
@@ -699,8 +597,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -713,8 +609,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -735,8 +629,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -761,8 +653,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -774,8 +664,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -787,8 +675,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -800,8 +686,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -814,8 +698,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -827,8 +709,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -841,8 +721,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -853,8 +731,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="req"><option>show | list | ls </option></arg>
|
||||
@@ -867,8 +743,7 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
@@ -892,9 +767,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg
|
||||
@@ -904,8 +776,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><arg
|
||||
@@ -915,9 +785,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg
|
||||
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>try</option></arg>
|
||||
@@ -930,8 +797,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg choice="plain"><option>update</option></arg>
|
||||
@@ -956,8 +821,6 @@
|
||||
<cmdsynopsis>
|
||||
<command>shorewall[6][-lite]</command>
|
||||
|
||||
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
|
||||
|
||||
<arg>options</arg>
|
||||
|
||||
<arg
|
||||
@@ -1025,16 +888,7 @@
|
||||
<refsect1>
|
||||
<title>Options</title>
|
||||
|
||||
<para>The <option>trace</option> and <option>debug</option> options are
|
||||
used for debugging. See <ulink
|
||||
url="/starting_and_stopping_shorewall.htm#Trace">http://www.shorewall.net/starting_and_stopping_shorewall.htm#Trace</ulink>.</para>
|
||||
|
||||
<para>The <option>nolock</option> option prevents the command from
|
||||
attempting to acquire the Shorewall lockfile. It is useful if you need to
|
||||
include <command>shorewall</command> commands in
|
||||
<filename>/etc/shorewall/started</filename>.</para>
|
||||
|
||||
<para>Other <replaceable>options</replaceable> are:</para>
|
||||
<para>The <replaceable>options</replaceable> are:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
@@ -1141,7 +995,7 @@
|
||||
setting in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
|
||||
<para>When no <replaceable>verbosity</replaceable> is specified,
|
||||
each instance of this option causes 1 to be added to the effective
|
||||
@@ -1162,7 +1016,7 @@
|
||||
setting in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
|
||||
<para>Each instance of this option causes 1 to be subtracted from
|
||||
the effective verbosity.</para>
|
||||
@@ -1176,7 +1030,66 @@
|
||||
<para>Causes all progress messages to be timestamped.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>-T</term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.2.4 to replace the earlier
|
||||
<command>trace</command> keyword.. If the command invokes the
|
||||
generated firewall script, the script's execution will be traced to
|
||||
standard error.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>-D</term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 5.2.4 to replace the earlier debug keyword.
|
||||
If the command invokes the generated firewall script, individual
|
||||
invocations of the ip[6]tables utility will be used to configure the
|
||||
ruleset rather than ip[6]tables-restore. This is useful for
|
||||
diagnosing ip[6]tables-restore failures on a *COMMIT command.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<note>
|
||||
<para>Prior to Shorewall 5.2.4, the general syntax for a CLI command
|
||||
was:</para>
|
||||
|
||||
<cmdsynopsis>
|
||||
<arg><option>trace|debug</option></arg>
|
||||
|
||||
<arg><option>nolock</option></arg>
|
||||
|
||||
<arg><replaceable>options</replaceable></arg>
|
||||
|
||||
<arg choice="plain"><replaceable>command</replaceable></arg>
|
||||
|
||||
<arg><replaceable>command-options</replaceable></arg>
|
||||
|
||||
<arg><replaceable>command-arguments</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
|
||||
<para>Examples:</para>
|
||||
|
||||
<programlisting> shorewall debug -tv2 reload
|
||||
shorewall trace check
|
||||
shorewall nolock enable eth0</programlisting>
|
||||
|
||||
<para>In Shorewall 5.2.4 and later, those commands would be:</para>
|
||||
|
||||
<programlisting> shorewall -Dtv2 reload
|
||||
shorewall check -D
|
||||
shorewall -N enable eth0</programlisting>
|
||||
|
||||
<para>While not shown in the command synopses at the top of this page,
|
||||
the <option>nolock</option> keyword is still supported in Shorewall
|
||||
5.2.4 and later, but is deprecated in favor of the -<option>N
|
||||
</option>option.</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -1199,7 +1112,7 @@
|
||||
defined in the <ulink
|
||||
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6-interfaces.html">shorewall6-interfaces</ulink>(5))file.
|
||||
url="/manpages/shorewall-interfaces.html">shorewall6-interfaces</ulink>(5))file.
|
||||
A <emphasis>host-list</emphasis> is comma-separated list whose
|
||||
elements are host or network addresses.<caution>
|
||||
<para>The <command>add</command> command is not very robust. If
|
||||
@@ -1214,11 +1127,12 @@
|
||||
<para>Beginning with Shorewall 4.5.9, the <emphasis
|
||||
role="bold">dynamic_shared</emphasis> zone option (<ulink
|
||||
url="/manpages/shorewall-zones.html">shorewall-zones</ulink>(5),<ulink
|
||||
url="???">shorewall6-zones</ulink>(5)) allows a single ipset to
|
||||
handle entries for multiple interfaces. When that option is
|
||||
specified for a zone, the <command>add</command> command has the
|
||||
alternative syntax in which the <replaceable>zone</replaceable> name
|
||||
precedes the <replaceable>host-list</replaceable>.</para>
|
||||
url="/manpages/shorewall-zones.html">shorewall6-zones</ulink>(5))
|
||||
allows a single ipset to handle entries for multiple interfaces.
|
||||
When that option is specified for a zone, the <command>add</command>
|
||||
command has the alternative syntax in which the
|
||||
<replaceable>zone</replaceable> name precedes the
|
||||
<replaceable>host-list</replaceable>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -1237,7 +1151,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">blacklist</emphasis>
|
||||
<term><emphasis role="bold">blacklist[!]</emphasis>
|
||||
<replaceable>address</replaceable> [ <replaceable>option</replaceable>
|
||||
... ]</term>
|
||||
|
||||
@@ -1251,7 +1165,17 @@
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5). The
|
||||
<replaceable>address</replaceable> along with any
|
||||
<replaceable>option</replaceable>s are passed to the <command>ipset
|
||||
add</command> command.</para>
|
||||
add</command> command. Probably the most useful
|
||||
<replaceable>option</replaceable> is the <option>timeout</option>
|
||||
option. For example, to permanently blacklist 192.0.2.22, the
|
||||
command would be:</para>
|
||||
|
||||
<programlisting> shorewall blacklist 192.0.2.22 timeout 0</programlisting>
|
||||
|
||||
<para>Beginning with Shorewall 5.2.5, the above command can be
|
||||
shortened to:</para>
|
||||
|
||||
<programlisting> shorewall blacklist! 192.0.2.22</programlisting>
|
||||
|
||||
<para>If the <option>disconnect</option> option is specified in the
|
||||
DYNAMIC_BLACKLISTING setting, then the effective VERBOSITY
|
||||
@@ -1294,7 +1218,7 @@
|
||||
<term><emphasis role="bold">check</emphasis> [-<option>e</option>]
|
||||
[-<option>d</option>] [-<option>p</option>] [-<option>r</option>]
|
||||
[-<option>T</option>] [-<option>i</option>]
|
||||
[<replaceable>directory</replaceable>]</term>
|
||||
[-D][<replaceable>directory</replaceable>]</term>
|
||||
|
||||
<listitem>
|
||||
<para>Not available with Shorewall[6]-lite.</para>
|
||||
@@ -1332,7 +1256,11 @@
|
||||
set to Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
|
||||
<para>The <emphasis role="bold">-D </emphasis>option was added in
|
||||
Shoewall 5.2.4 and causes the compiler to write a large amount of
|
||||
debugging information to standard output.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -1383,8 +1311,9 @@
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">compile </emphasis>[-<option>e</option>]
|
||||
[-<option>c</option>] [-<option>d</option>] [-<option>p</option>]
|
||||
[-<option>T</option>] [-<option>i</option>] [<replaceable> directory
|
||||
</replaceable>] [<replaceable> pathname</replaceable> ]</term>
|
||||
[-<option>T</option>] [-<option>i</option>] [-D] [<replaceable>
|
||||
directory </replaceable>] [<replaceable> pathname</replaceable>
|
||||
]</term>
|
||||
|
||||
<listitem>
|
||||
<para>Not available with shorewall[6]-lite.</para>
|
||||
@@ -1440,7 +1369,11 @@
|
||||
set to Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
|
||||
<para>The <emphasis role="bold">-D </emphasis>option was added in
|
||||
Shoewall 5.2.4 and causes the compiler to write a large amount of
|
||||
debugging information to standard output.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -1458,7 +1391,7 @@
|
||||
defined in the <ulink
|
||||
url="/manpages/shorewall-interfaces.html">shorewall-interfaces</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6-interfaces.html">shorewall6-interfaces</ulink>(5)
|
||||
url="/manpages/shorewall-interfaces.html">shorewall6-interfaces</ulink>(5)
|
||||
file. A <emphasis>host-list</emphasis> is comma-separated list whose
|
||||
elements are a host or network address.</para>
|
||||
|
||||
@@ -1466,7 +1399,7 @@
|
||||
role="bold">dynamic_shared</emphasis> zone option (<ulink
|
||||
url="/manpages/shorewall-zones.html">shorewall-zones</ulink>(5),
|
||||
<ulink
|
||||
url="/manpages6/shorewall6-zones.html">shorewall6-zones</ulink>(5))
|
||||
url="/manpages/shorewall-zones.html">shorewall6-zones</ulink>(5))
|
||||
allows a single ipset to handle entries for multiple interfaces.
|
||||
When that option is specified for a zone, the
|
||||
<command>delete</command> command has the alternative syntax in
|
||||
@@ -1493,7 +1426,7 @@
|
||||
command removes any routes added from <ulink
|
||||
url="/manpages/shorewall-routes.html">shorewall-routes</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages/shorewall6-routes.html">shorewall6-routes</ulink>(5))and
|
||||
url="/manpages/shorewall-routes.html">shorewall6-routes</ulink>(5))and
|
||||
any traffic shaping configuration for the interface.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -1554,7 +1487,7 @@
|
||||
adds any route specified in <ulink
|
||||
url="/manpages/shorewall-routes.html">shorewall-routes</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages/shorewall6-routes.html">shorewall6-routes</ulink>(5))
|
||||
url="/manpages/shorewall-routes.html">shorewall6-routes</ulink>(5))
|
||||
and installs the interface's traffic shaping configuration, if
|
||||
any.</para>
|
||||
</listitem>
|
||||
@@ -1599,7 +1532,7 @@
|
||||
given then the file specified by RESTOREFILE in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)) is
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)) is
|
||||
assumed.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -1684,7 +1617,7 @@
|
||||
specified by the BLACKLIST_LOGLEVEL setting in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink> (5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).
|
||||
This command requires that the firewall be in the started state and
|
||||
that DYNAMIC_BLACKLIST=Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf
|
||||
@@ -1700,16 +1633,16 @@
|
||||
<para>Monitors the log file specified by the LOGFILE option in
|
||||
<ulink url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5))
|
||||
and produces an audible alarm when new Shorewall messages are
|
||||
logged. The <emphasis role="bold">-m</emphasis> option causes the
|
||||
MAC address of each packet source to be displayed if that
|
||||
information is available. The
|
||||
<replaceable>refresh-interval</replaceable> specifies the time in
|
||||
seconds between screen refreshes. You can enter a negative number by
|
||||
preceding the number with "--" (e.g., <command>shorewall logwatch --
|
||||
-30</command>). In this case, when a packet count changes, you will
|
||||
be prompted to hit any key to resume screen refreshes.</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)) and
|
||||
produces an audible alarm when new Shorewall messages are logged.
|
||||
The <emphasis role="bold">-m</emphasis> option causes the MAC
|
||||
address of each packet source to be displayed if that information is
|
||||
available. The <replaceable>refresh-interval</replaceable> specifies
|
||||
the time in seconds between screen refreshes. You can enter a
|
||||
negative number by preceding the number with "--" (e.g.,
|
||||
<command>shorewall logwatch -- -30</command>). In this case, when a
|
||||
packet count changes, you will be prompted to hit any key to resume
|
||||
screen refreshes.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -1723,7 +1656,7 @@
|
||||
specified by the BLACKLIST_LOGLEVEL setting in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink> (5),
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).
|
||||
This command requires that the firewall be in the started state and
|
||||
that DYNAMIC_BLACKLIST=Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf
|
||||
@@ -1824,7 +1757,8 @@
|
||||
<term><emphasis role="bold">reload </emphasis>[-<option>n</option>]
|
||||
[-<option>p</option>] [-<option>d</option>] [-<option>f</option>]
|
||||
[-<option>c</option>] [-<option>T</option>] [-<option>i</option>]
|
||||
[-<option>C</option>] [ <replaceable>directory</replaceable> ]</term>
|
||||
[-<option>C</option>] [-D] [ <replaceable>directory</replaceable>
|
||||
]</term>
|
||||
|
||||
<listitem>
|
||||
<para>This command was re-implemented in Shorewall 5.0.0. The
|
||||
@@ -1878,17 +1812,21 @@
|
||||
INLINE_MATCHES is set to Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5))..</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5))..</para>
|
||||
|
||||
<para>The <option>-C</option> option was added in Shorewall
|
||||
4.6.5 and is only meaningful when AUTOMAKE=Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).
|
||||
If an existing firewall script is used and if that script was
|
||||
the one that generated the current running configuration, then
|
||||
the running netfilter configuration will be reloaded as is so
|
||||
as to preserve the iptables packet and byte counters.</para>
|
||||
|
||||
<para>The <emphasis role="bold">-D </emphasis>option was added
|
||||
in Shoewall 5.2.4 and causes the compiler to write a large
|
||||
amount of debugging information to standard output.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -2006,7 +1944,7 @@
|
||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
||||
option setting in <ulink
|
||||
url="shorewall.conf.html">shorewall.conf</ulink>(5) (<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>) is
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf(5)</ulink>) is
|
||||
assumed. In that case, if you want to specify a
|
||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
||||
option must be given.</para>
|
||||
@@ -2071,8 +2009,9 @@
|
||||
Beginning with Shorewall 5.0.13, if
|
||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
||||
option setting in <ulink
|
||||
url="shorewall6.conf.html">shorewall6.conf(5)</ulink> (<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)) is
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf(5)</ulink>
|
||||
(<ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)) is
|
||||
assumed. In that case, if you want to specify a
|
||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
||||
option must be given.</para>
|
||||
@@ -2104,7 +2043,7 @@
|
||||
set to Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -2144,8 +2083,9 @@
|
||||
Beginning with Shorewall 5.0.13, if
|
||||
<replaceable>system</replaceable> is omitted, then the FIREWALL
|
||||
option setting in <ulink
|
||||
url="shorewall6.conf.html">shorewall6.conf(5)</ulink> (<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)) is
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf(5)</ulink>
|
||||
(<ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)) is
|
||||
assumed. In that case, if you want to specify a
|
||||
<replaceable>directory</replaceable>, then the <option>-D</option>
|
||||
option must be given.</para>
|
||||
@@ -2177,7 +2117,7 @@
|
||||
set to Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -2204,7 +2144,8 @@
|
||||
<term><emphasis role="bold">restart </emphasis>[-<option>n</option>]
|
||||
[-<option>p</option>] [-<option>d</option>] [-<option>f</option>]
|
||||
[-<option>c</option>] [-<option>T</option>] [-<option>i</option>]
|
||||
[-<option>C</option>] [ <replaceable>directory</replaceable> ]</term>
|
||||
[-<option>C</option>] [-D] [ <replaceable>directory</replaceable>
|
||||
]</term>
|
||||
|
||||
<listitem>
|
||||
<para>Beginning with Shorewall 5.0.0, this command performs a true
|
||||
@@ -2264,6 +2205,10 @@
|
||||
the one that generated the current running configuration, then
|
||||
the running netfilter configuration will be reloaded as is so
|
||||
as to preserve the iptables packet and byte counters.</para>
|
||||
|
||||
<para>The <emphasis role="bold">-D </emphasis>option was added
|
||||
in Shoewall 5.2.4 and causes the compiler to write a large
|
||||
amount of debugging information to standard output.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -2304,7 +2249,7 @@
|
||||
restored from the file specified by the RESTOREFILE option in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
|
||||
<caution>
|
||||
<para>If your iptables ruleset depends on variables that are
|
||||
@@ -2460,7 +2405,7 @@
|
||||
in the file specified by the RESTOREFILE option in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
|
||||
<para>The <option>-C</option> option, added in Shorewall 4.6.5,
|
||||
causes the iptables packet and byte counters to be saved along with
|
||||
@@ -2477,7 +2422,7 @@
|
||||
the SAVE_IPSETS option in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink> (5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).
|
||||
This command may be used to proactively save your ipset contents in
|
||||
the event that a system failure occurs prior to issuing a
|
||||
<command>stop</command> command.</para>
|
||||
@@ -2645,7 +2590,7 @@
|
||||
accounting counters (<ulink
|
||||
url="/manpages/shorewall-accounting.html">shorewall-accounting</ulink>
|
||||
(5), <ulink
|
||||
url="/manpages6/shorewall6-accounting.html">shorewall6-accounting</ulink>(5)).</para>
|
||||
url="/manpages/shorewall-accounting.html">shorewall6-accounting</ulink>(5)).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -2669,7 +2614,7 @@
|
||||
file specified by the LOGFILE option in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).
|
||||
The <emphasis role="bold">-m</emphasis> option causes the MAC
|
||||
address of each packet source to be displayed if that
|
||||
information is available.</para>
|
||||
@@ -2831,8 +2776,8 @@
|
||||
<term><emphasis role="bold">start </emphasis><emphasis role="bold">
|
||||
</emphasis>[-<option>n</option>] [-<option>p</option>]
|
||||
[-<option>d</option>] [-<option>f</option>] [-<option>c</option>]
|
||||
[-<option>T</option>] [-<option>i</option>] [-<option>C</option>] [
|
||||
<replaceable>directory</replaceable> ]</term>
|
||||
[-<option>T</option>] [-<option>i</option>] [-<option>C</option>] [-D]
|
||||
[ <replaceable>directory</replaceable> ]</term>
|
||||
|
||||
<listitem>
|
||||
<para><variablelist>
|
||||
@@ -2851,7 +2796,7 @@
|
||||
in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5))
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5))
|
||||
will be restored if that saved configuration exists and has
|
||||
been modified more recently than the files in
|
||||
/etc/shorewall. When <emphasis role="bold">-f</emphasis> is
|
||||
@@ -2862,7 +2807,7 @@
|
||||
option was added to <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).
|
||||
When LEGACY_FASTSTART=No, the modification times of files in
|
||||
/etc/shorewall are compared with that of
|
||||
/var/lib/shorewall/firewall (the compiled script that last
|
||||
@@ -2881,7 +2826,7 @@
|
||||
overriding the AUTOMAKE setting in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5)
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).
|
||||
When both <option>-f</option> and <option>-c</option>are
|
||||
present, the result is determined by the option that appears
|
||||
last.</para>
|
||||
@@ -2897,7 +2842,7 @@
|
||||
INLINE_MATCHES is set to Yes in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf(5)</ulink>
|
||||
(<ulink
|
||||
url="/manpages6/shorewall6.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
url="/manpages/shorewall.conf.html">shorewall6.conf</ulink>(5)).</para>
|
||||
|
||||
<para>The <option>-C</option> option was added in Shorewall
|
||||
4.6.5 and is only meaningful when the <option>-f</option>
|
||||
@@ -2906,6 +2851,11 @@
|
||||
option was also specified in the <emphasis
|
||||
role="bold">save</emphasis> command, then the packet and
|
||||
byte counters will be restored.</para>
|
||||
|
||||
<para>The <emphasis role="bold">-D </emphasis>option was
|
||||
added in Shoewall 5.2.4 and causes the compiler to write a
|
||||
large amount of debugging information to standard
|
||||
output.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -2947,25 +2897,18 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">stop</emphasis>
|
||||
[-<option>f</option>]</term>
|
||||
<term><emphasis role="bold">stop</emphasis></term>
|
||||
|
||||
<listitem>
|
||||
<para>Stops the firewall. All existing connections, except those
|
||||
listed in <ulink
|
||||
url="/manpages/shorewall-routestopped.html">shorewall-routestopped</ulink>(5)
|
||||
url="/manpages/shorewall-stoppedrules.html">shorewall-stoppedrules</ulink>(5)
|
||||
or permitted by the ADMINISABSENTMINDED option in <ulink
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink>(5), are
|
||||
taken down. The only new traffic permitted through the firewall is
|
||||
from systems listed in <ulink
|
||||
url="/manpages/shorewall-routestopped.html">shorewall-routestopped</ulink>(5)
|
||||
url="/manpages/shorewall.conf.html">shorewall.conf</ulink> The only
|
||||
new traffic permitted through the firewall is from systems listed in
|
||||
<ulink
|
||||
url="/manpages/shorewall-stoppedrules.html">shorewall-stoppedrules</ulink>(5)
|
||||
or by ADMINISABSENTMINDED.</para>
|
||||
|
||||
<para>If <option>-f</option> is given, the command will be processed
|
||||
by the compiled script that executed the last successful <emphasis
|
||||
role="bold">start</emphasis>, <emphasis
|
||||
role="bold">restart</emphasis> or <emphasis
|
||||
role="bold">reload</emphasis> command if that script exists.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -3226,7 +3169,7 @@
|
||||
|
||||
<simplelist>
|
||||
<member><ulink
|
||||
url="/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink>
|
||||
url="/starting_and_stopping_shorewall.htm">https://shorewall.org/starting_and_stopping_shorewall.htm</ulink>
|
||||
- Describes operational aspects of Shorewall.</member>
|
||||
|
||||
<member><ulink url="shorewall-files.html">shorewall-files(5)</ulink> -
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# (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
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://www.shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#
|
||||
# This file is installed in /usr/share/shorewall/wait4ifup
|
||||
#
|
||||
# Shorewall documentation is available at http://www.shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#
|
||||
# (c) 2010,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
@@ -110,7 +110,7 @@ case $0 in
|
||||
;;
|
||||
*)
|
||||
#
|
||||
# Debian ifupdown system
|
||||
# Debian ifupdown system - MODE and INTERFACE inherited from the environment
|
||||
#
|
||||
INTERFACE="$IFACE"
|
||||
|
||||
@@ -127,6 +127,17 @@ esac
|
||||
[ -n "$LOGFILE" ] || LOGFILE=/dev/null
|
||||
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if [ -n "$ADDRFAM" -a ${COMMAND} = up ]; then
|
||||
case $PRODUCT in
|
||||
*6*)
|
||||
[ ${ADDRFAM} = inet6 ] || continue
|
||||
;;
|
||||
*)
|
||||
[ ${ADDRFAM} = inet ] || continue
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
setstatedir
|
||||
|
||||
if [ -x $VARLIB/$PRODUCT/firewall ]; then
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#
|
||||
# (c) 2010,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
@@ -90,7 +90,14 @@ case $0 in
|
||||
COMMAND=down
|
||||
;;
|
||||
*dispatcher.d*)
|
||||
COMMAND="$2"
|
||||
case "$2" in
|
||||
up|down)
|
||||
COMMAND="$2"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#
|
||||
# (c) 2010,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
@@ -120,7 +120,14 @@ case $0 in
|
||||
case $0 in
|
||||
*dispatcher.d*)
|
||||
INTERFACE="$1"
|
||||
COMMAND="$2"
|
||||
case "$2" in
|
||||
up|down)
|
||||
COMMAND="$2"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*if-up.d*)
|
||||
COMMAND=up
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2010 - Roberto C. Sanchez (roberto@connexer.com)
|
||||
#
|
||||
# Shorewall documentation is available at http://shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -169,7 +169,7 @@ if [ -z "$BUILD" ]; then
|
||||
;;
|
||||
*)
|
||||
if [ -f /etc/os-release ]; then
|
||||
eval $(cat /etc/os-release | grep ^ID=)
|
||||
ID=$(grep '^ID=' /etc/os-release | sed 's/ID=//; s/"//g;')
|
||||
|
||||
case $ID in
|
||||
fedora|rhel|centos|foobar)
|
||||
@@ -357,12 +357,11 @@ fi
|
||||
if [ $HOST = debian ]; then
|
||||
if [ -n "${DESTDIR}" ]; then
|
||||
make_parent_directory ${DESTDIR}${ETC}/network/if-up.d 0755
|
||||
make_parent_directory ${DESTDIR}${ETC}/network/if-down.d 0755
|
||||
make_parent_directory ${DESTDIR}${ETC}/network/if-post-down.d 0755
|
||||
elif [ $configure -eq 0 ]; then
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-up.d 0755
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-down.d 0755
|
||||
make_parent_directory ${DESTDIR}${CONFDIR}/network/if-post-down.d 0755
|
||||
make_parent_directory ${CONFDIR}/network/if-up.d 0755
|
||||
make_parent_directory ${CONFDIR}/network/if-post-down.d 0755
|
||||
rm -f ${CONFDIR}/network/if-down.d/shorewall
|
||||
fi
|
||||
|
||||
if [ ! -f ${DESTDIR}${CONFDIR}/default/$PRODUCT ]; then
|
||||
@@ -388,7 +387,7 @@ else
|
||||
elif [ $HOST = openwrt ]; then
|
||||
# Not implemented on OpenWRT
|
||||
/bin/true
|
||||
else
|
||||
elif [ "$HOST" != debian ]; then
|
||||
make_parent_directory ${DESTDIR}/${ETC}/NetworkManager/dispatcher.d 0755
|
||||
fi
|
||||
fi
|
||||
@@ -417,19 +416,22 @@ if [ $HOST != openwrt ]; then
|
||||
fi
|
||||
|
||||
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
|
||||
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755
|
||||
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
|
||||
if [ "$HOST" = debian ]; then
|
||||
rm -f ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall
|
||||
else
|
||||
[ $configure -eq 1 ] || make_parent_directory ${DESTDIR}${CONFDIR}/NetworkManager/dispatcher.d 0755
|
||||
install_file ifupdown ${DESTDIR}${ETC}/NetworkManager/dispatcher.d/01-shorewall 0544
|
||||
fi
|
||||
fi
|
||||
|
||||
case $HOST in
|
||||
debian)
|
||||
if [ $configure -eq 1 ]; then
|
||||
install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544
|
||||
install_file ifupdown ${DESTDIR}/etc/network/if-down.d/shorewall 0544
|
||||
install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
|
||||
rm -f ${DESTDIR}/etc/network/if-down.d/shorewall
|
||||
else
|
||||
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-up.d/shorewall 0544
|
||||
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-down.d/shorewall 0544
|
||||
install_file ifupdown ${DESTDIR}${CONFDIR}/network/if-post-down.d/shorewall 0544
|
||||
fi
|
||||
;;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
# On most distributions, this file should be called
|
||||
# /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -25,6 +25,7 @@
|
||||
#
|
||||
###############################################################################
|
||||
# set the STATEDIR variable
|
||||
|
||||
setstatedir() {
|
||||
local statedir
|
||||
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
||||
@@ -42,6 +43,67 @@ setstatedir() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize the firewalls
|
||||
|
||||
shorewall_init_start () {
|
||||
local PRODUCT
|
||||
local STATEDIR
|
||||
|
||||
printf "Initializing \"Shorewall-based firewalls\": "
|
||||
|
||||
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||
ipset -R < "$SAVE_IPSETS"
|
||||
fi
|
||||
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
)
|
||||
fi
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Clear the firewalls
|
||||
|
||||
shorewall_init_stop () {
|
||||
local PRODUCT
|
||||
local STATEDIR
|
||||
|
||||
printf "Clearing \"Shorewall-based firewalls\": "
|
||||
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
#
|
||||
# Run in sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
)
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" ]; then
|
||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||
else
|
||||
rm -f "${SAVE_IPSETS}.tmp"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# This is modified by the installer when ${SHAREDIR} <> /usr/share
|
||||
#
|
||||
@@ -59,62 +121,12 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local PRODUCT
|
||||
local STATEDIR
|
||||
|
||||
printf "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
if ! ${STATEDIR}/firewall status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall ${OPTIONS} stop
|
||||
fi
|
||||
)
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||
ipset -R < "$SAVE_IPSETS"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Clear the firewall
|
||||
shorewall_stop () {
|
||||
local PRODUCT
|
||||
local STATEDIR
|
||||
|
||||
printf "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if setstatedir; then
|
||||
${STATEDIR}/firewall ${OPTIONS} clear
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" ]; then
|
||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" || rm -f "${SAVE_IPSETS}.tmp"
|
||||
else
|
||||
rm -f "${SAVE_IPSETS}.tmp"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
shorewall_start
|
||||
shorewall_init_start
|
||||
;;
|
||||
stop)
|
||||
shorewall_stop
|
||||
shorewall_init_stop
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}"
|
||||
|
1
Shorewall-lite/Shorewall-lite-targetname
Normal file
1
Shorewall-lite/Shorewall-lite-targetname
Normal file
@@ -0,0 +1 @@
|
||||
5.2.4.1
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -7,7 +7,7 @@ RCDLINKS="2,S41 3,S41 6,K41"
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://shorewall.net
|
||||
# Shorewall documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# (c) 2011,2014 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -183,7 +183,7 @@
|
||||
<title>See ALSO</title>
|
||||
|
||||
<para><ulink
|
||||
url="http://www.shorewall.net/Documentation_Index.html">http://www.shorewall.net/Documentation_Index.html</ulink></para>
|
||||
url="https://shorewall.org/Documentation_Index.html">https://shorewall.org/Documentation_Index.html</ulink></para>
|
||||
|
||||
<para>shorewall-lite(8), shorewall-accounting(5), shorewall-actions(5),
|
||||
shorewall-blacklist(5), shorewall-hosts(5), shorewall-interfaces(5),
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# "man shorewall-lite.conf"
|
||||
#
|
||||
# Manpage also online at
|
||||
# http://www.shorewall.net/manpages/shorewall-lite.conf.html
|
||||
# https://shorewall.org/manpages/shorewall-lite.conf.html
|
||||
###############################################################################
|
||||
# N 0 T E
|
||||
###############################################################################
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -27,7 +27,7 @@
|
||||
# the IP address that are older than <duration> seconds.
|
||||
# Disposition - Disposition for any event generated.
|
||||
#
|
||||
# For additional information, see http://www.shorewall.net/Events.html
|
||||
# For additional information, see https://shorewall.org/Events.html
|
||||
#
|
||||
###############################################################################
|
||||
# DO NOT REMOVE THE FOLLOWING LINE
|
||||
@@ -114,8 +114,6 @@ if ( ( $targets{$action} || 0 ) & NATRULE ) {
|
||||
|
||||
if ( $command & $RESET_CMD ) {
|
||||
require_capability 'MARK_ANYWHERE', '"reset"', 's';
|
||||
|
||||
print "Resetting....\n";
|
||||
|
||||
my $mark = $globals{EVENT_MARK};
|
||||
#
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# address (dst)
|
||||
# Disposition - Disposition for any rule generated.
|
||||
#
|
||||
# For additional information, see http://www.shorewall.net/Events.html
|
||||
# For additional information, see https://shorewall.org/Events.html
|
||||
#
|
||||
###############################################################################
|
||||
# DO NOT REMOVE THE FOLLOWING LINE
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# address (dst)
|
||||
# Disposition - Disposition for any event generated.
|
||||
#
|
||||
# For additional information, see http://www.shorewall.net/Events.html
|
||||
# For additional information, see https://shorewall.org/Events.html
|
||||
#
|
||||
|
||||
DEFAULTS -,ACCEPT,src
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# 2. Copy this file to /etc/shorewall/action.<action name>
|
||||
# 3. Add the desired rules to that file.
|
||||
#
|
||||
# Please see http://shorewall.net/Actions.html for additional
|
||||
# Please see https://shorewall.org/Actions.html for additional
|
||||
# information.
|
||||
#
|
||||
# Columns are the same as in /etc/shorewall/mangle.
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2017 Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# 2. Copy this file to /etc/shorewall/action.<action name>
|
||||
# 3. Add the desired rules to that file.
|
||||
#
|
||||
# Please see http://shorewall.net/Actions.html for additional
|
||||
# Please see https://shorewall.org/Actions.html for additional
|
||||
# information.
|
||||
#
|
||||
# Columns are the same as in /etc/shorewall/rules.
|
||||
|
@@ -21,7 +21,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# For information about this script, see http://www.shorewall.net/MultiISP.html#swping.
|
||||
# For information about this script, see https://shorewall.org/MultiISP.html#swping.
|
||||
#
|
||||
###########################################################################################
|
||||
#
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
|
@@ -18,7 +18,7 @@ Shoreline Firewall (Shorewall) Version 5
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Please see http://www.shorewall.net/Install.htm for installation
|
||||
Please see https://shorewall.org/Install.htm for installation
|
||||
instructions.
|
||||
|
||||
|
||||
|
8
Shorewall/Macros/macro.BitcoinRegtest
Normal file
8
Shorewall/Macros/macro.BitcoinRegtest
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Shorewall --/usr/share/shorewall/macro.BitcoinRegtest
|
||||
#
|
||||
# Macro for handling Bitcoin P2P traffic (Regtest mode)
|
||||
#
|
||||
##############################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
PARAM - - tcp 18444
|
8
Shorewall/Macros/macro.BitcoinTestnet
Normal file
8
Shorewall/Macros/macro.BitcoinTestnet
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Shorewall --/usr/share/shorewall/macro.BitcoinTestnet
|
||||
#
|
||||
# Macro for handling Bitcoin P2P traffic (Testnet mode)
|
||||
#
|
||||
##############################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
PARAM - - tcp 18333
|
8
Shorewall/Macros/macro.BitcoinTestnetRPC
Normal file
8
Shorewall/Macros/macro.BitcoinTestnetRPC
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Shorewall --/usr/share/shorewall/macro.BitcoinTestnetRPC
|
||||
#
|
||||
# Macro for handling Bitcoin RPC traffic (Testnet and Regtest mode)
|
||||
#
|
||||
##############################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
PARAM - - tcp 18332
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2013 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -37,6 +37,7 @@ use Shorewall::Config qw(:DEFAULT :internal);
|
||||
use Shorewall::Zones;
|
||||
use Shorewall::IPAddrs;
|
||||
use strict;
|
||||
use sort 'stable';
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = ( qw(
|
||||
@@ -319,6 +320,7 @@ our $VERSION = 'MODULEVERSION';
|
||||
# %chain_table { <table> => { <chain1> => { name => <chain name>
|
||||
# table => <table name>
|
||||
# is_policy => undef|1 -- if 1, this is a policy chain
|
||||
# wild => undef|1 -- If 1, source or dest is 'all'. Only applies to policy chains
|
||||
# provisional => undef|1 -- See below.
|
||||
# referenced => undef|1 -- If 1, will be written to the iptables-restore-input.
|
||||
# builtin => undef|1 -- If 1, one of Netfilter's built-in chains.
|
||||
@@ -536,6 +538,9 @@ our $ipset_rules;
|
||||
#
|
||||
use constant { ALL_COMMANDS => 1, NOT_RESTORE => 2 };
|
||||
|
||||
#
|
||||
# Chain optimization flags
|
||||
#
|
||||
use constant { DONT_OPTIMIZE => 1 , DONT_DELETE => 2, DONT_MOVE => 4, RETURNS => 8, RETURNS_DONT_MOVE => 12 };
|
||||
|
||||
our %dscpmap = ( CS0 => 0x00,
|
||||
@@ -694,7 +699,7 @@ use constant { UNIQUE => 1, # Simple header matches - only allowed on
|
||||
CONTROL => 16, # Unsed internally by the compiler - does not contribute to the iptables rule
|
||||
COMPLEX => 32, # Currently means 'contrack --cstate'
|
||||
NFACCT => 64, # nfacct match
|
||||
EXPENSIVE => 128, # Has high rule-processing cost in the kernel
|
||||
EXPENSIVE => 128, # Has high match-processing cost in the kernel
|
||||
RECENT => 256, # recent match
|
||||
};
|
||||
|
||||
@@ -722,6 +727,7 @@ our %opttype = ( rule => CONTROL,
|
||||
'icmpv6-type' => UNIQUE,
|
||||
|
||||
comment => CONTROL,
|
||||
digest => CONTROL,
|
||||
|
||||
policy => MATCH,
|
||||
state => EXCLUSIVE,
|
||||
@@ -888,7 +894,7 @@ sub validate_port( $$ ) {
|
||||
|
||||
fatal_error "The separator for a port range is ':', not '-' ($port)" if $port =~ /^\d+-\d+$/;
|
||||
|
||||
fatal_error "Invalid/Unknown $proto port/service ($_[1])" unless defined $value;
|
||||
fatal_error "Invalid/Unknown $proto port/service ($_[1])";
|
||||
}
|
||||
|
||||
#
|
||||
@@ -1140,16 +1146,30 @@ sub set_rule_option( $$$ ) {
|
||||
#
|
||||
# Consider each subtype as a separate type
|
||||
#
|
||||
my ( $invert, $subtype, $val, $rest ) = split ' ', $value;
|
||||
if ( have_capability( 'OLD_CONNTRACK_MATCH' ) ) {
|
||||
my ( $subtype, $invert, $val, $rest ) = split ' ', $value;
|
||||
|
||||
if ( $invert eq '!' ) {
|
||||
assert( ! supplied $rest );
|
||||
$option = join( ' ', $option, $invert, $subtype );
|
||||
$value = $val;
|
||||
if ( $invert eq '!' ) {
|
||||
assert( ! supplied $rest );
|
||||
$option = join( ' ', $option, $subtype );
|
||||
$value = join( ' ', $invert, $val );
|
||||
} else {
|
||||
assert( ! supplied $val );
|
||||
$option = join( ' ', $invert , $option );
|
||||
$value = $invert;
|
||||
}
|
||||
} else {
|
||||
assert( ! supplied $val );
|
||||
$option = join( ' ', $option, $invert );
|
||||
$value = $subtype;
|
||||
my ( $invert, $subtype, $val, $rest ) = split ' ', $value;
|
||||
|
||||
if ( $invert eq '!' ) {
|
||||
assert( ! supplied $rest );
|
||||
$option = join( ' ', $option, $invert, $subtype );
|
||||
$value = $val;
|
||||
} else {
|
||||
assert( ! supplied $val );
|
||||
$option = join( ' ', $option, $invert );
|
||||
$value = $subtype;
|
||||
}
|
||||
}
|
||||
|
||||
$opttype = EXCLUSIVE;
|
||||
@@ -1222,8 +1242,8 @@ sub transform_rule( $;\$ ) {
|
||||
$option = $2;
|
||||
} elsif ( $input =~ s/^(!\s+)?--([^\s]+)\s*// ) {
|
||||
$invert = '!' if $1;
|
||||
my $opt = $option = $2;
|
||||
fatal_error "Unrecognized iptables option ($opt}" unless $option = $aliases{$option};
|
||||
my $opt = $2;
|
||||
fatal_error "Unrecognized iptables option ($opt}" unless $option = $aliases{$opt};
|
||||
} else {
|
||||
fatal_error "Unrecognized iptables option string ($input)";
|
||||
}
|
||||
@@ -1422,7 +1442,7 @@ sub compatible( $$ ) {
|
||||
}
|
||||
}
|
||||
#
|
||||
# Don't combine chains where each specifies
|
||||
# Don't combine rules where each specifies
|
||||
# -m policy and the policies are different
|
||||
# or when one specifies
|
||||
# -m multiport
|
||||
@@ -3366,13 +3386,13 @@ sub initialize_chain_table($) {
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.nat_DOCKER ] && cat ${VARDIR}/.nat_DOCKER >&3' );
|
||||
$chainref = new_standard_chain( 'DOCKER-INGRESS' );
|
||||
set_optflags( $chainref, DONT_OPTIMIZE | DONT_DELETE | DONT_MOVE );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-INGRESS ] && cat ${VARDIR}/.filter_DOCKER-INGRESS >&3' );
|
||||
$chainref = new_standard_chain( 'DOCKER-USER' );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-INGRESS ] && cat ${VARDIR}/.filter_DOCKER-INGRESS >&3' );
|
||||
$chainref = new_standard_chain( 'DOCKER-USER' );
|
||||
set_optflags( $chainref, DONT_OPTIMIZE | DONT_DELETE | DONT_MOVE );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-USER ] && cat ${VARDIR}/.filter_DOCKER-USER >&3' );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-USER ] && cat ${VARDIR}/.filter_DOCKER-USER >&3' );
|
||||
$chainref = new_standard_chain( 'DOCKER-ISOLATION' );
|
||||
set_optflags( $chainref, DONT_OPTIMIZE | DONT_DELETE | DONT_MOVE );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-ISOLATION ] && cat ${VARDIR}/.filter_DOCKER-ISOLATION >&3' );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-ISOLATION ] && cat ${VARDIR}/.filter_DOCKER-ISOLATION >&3' );
|
||||
$chainref = new_standard_chain( 'DOCKER-ISOLATION-STAGE-1' );
|
||||
set_optflags( $chainref, DONT_OPTIMIZE | DONT_DELETE | DONT_MOVE );
|
||||
add_commands( $chainref, '[ -f ${VARDIR}/.filter_DOCKER-ISOLATION-STAGE-1 ] && cat ${VARDIR}/.filter_DOCKER-ISOLATION-STAGE-1 >&3' );
|
||||
@@ -3503,6 +3523,33 @@ sub irule_to_string( $ ) {
|
||||
$string;
|
||||
}
|
||||
|
||||
#
|
||||
# This one omits the comment
|
||||
#
|
||||
sub irule_to_string1( $ ) {
|
||||
my ( $ruleref ) = @_;
|
||||
|
||||
return $ruleref->{cmd} if exists $ruleref->{cmd};
|
||||
|
||||
my $string = '';
|
||||
|
||||
for ( grep ! ( get_opttype( $_, 0 ) & ( CONTROL | TARGET ) ), @{$ruleref->{matches}}) {
|
||||
my $value = $ruleref->{$_};
|
||||
if ( reftype $value ) {
|
||||
$string .= "$_=" . join( ',', @$value ) . ' ';
|
||||
} else {
|
||||
$string .= "$_=$value ";
|
||||
}
|
||||
}
|
||||
|
||||
if ( $ruleref->{target} ) {
|
||||
$string .= join( ' ', " -$ruleref->{jump}", $ruleref->{target} );
|
||||
$string .= join( '', ' ', $ruleref->{targetopts} ) if $ruleref->{targetopts};
|
||||
}
|
||||
|
||||
$string;
|
||||
}
|
||||
|
||||
sub calculate_digest( $ ) {
|
||||
my $chainref = shift;
|
||||
my $rules = '';
|
||||
@@ -3689,6 +3736,16 @@ sub optimize_level0() {
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Conditionally sort a list of chain table entry references by name, if -t was specified
|
||||
#
|
||||
sub sortchainsiftest(\%) {
|
||||
my $hashref = shift;
|
||||
|
||||
return sort { $a->{name} cmp $b->{name} } values %$hashref if $test;
|
||||
return values %$hashref;
|
||||
}
|
||||
|
||||
sub optimize_level4( $$ ) {
|
||||
my ( $table, $tableref ) = @_;
|
||||
my $progress = 1;
|
||||
@@ -3910,7 +3967,7 @@ sub optimize_level4( $$ ) {
|
||||
my @chains = grep ( $_->{referenced} &&
|
||||
! $_->{optflags} &&
|
||||
@{$_->{rules}} < 4 &&
|
||||
keys %{$_->{references}} == 1 , values %$tableref );
|
||||
keys %{$_->{references}} == 1 , sortchainsiftest %$tableref );
|
||||
|
||||
if ( my $chains = @chains ) {
|
||||
$passes++;
|
||||
@@ -3919,7 +3976,7 @@ sub optimize_level4( $$ ) {
|
||||
|
||||
for my $chainref ( @chains ) {
|
||||
my $name = $chainref->{name};
|
||||
for my $sourceref ( map $tableref->{$_}, keys %{$chainref->{references}} ) {
|
||||
for my $sourceref ( map $tableref->{$_}, sortkeysiftest %{$chainref->{references}} ) {
|
||||
my $name1 = $sourceref->{name};
|
||||
|
||||
if ( $chainref->{references}{$name1} == 1 ) {
|
||||
@@ -4023,7 +4080,7 @@ sub optimize_level8( $$$ ) {
|
||||
|
||||
if ( $config{RENAME_COMBINED} && $chainref->{name} !~ /^[~%]/ ) {
|
||||
#
|
||||
# For simple use of the BLACKLIST section, we can end up with many identical
|
||||
# For simple use of the blrules file, we can end up with many identical
|
||||
# chains. To distinguish them from other renamed chains, we keep track of
|
||||
# these chains via the 'blacklistsection' member.
|
||||
#
|
||||
@@ -4049,7 +4106,7 @@ sub optimize_level8( $$$ ) {
|
||||
#
|
||||
# First create aliases for each renamed chain and change the {name} member.
|
||||
#
|
||||
for my $oldname ( @rename ) {
|
||||
for my $oldname ( sortiftest @rename ) {
|
||||
my $newname = $renamed{ $oldname } = $rename{ $oldname } . $chainseq++;
|
||||
|
||||
trace( $tableref->{$oldname}, 'RN', 0, " Renamed $newname" ) if $debug;
|
||||
@@ -4162,10 +4219,10 @@ sub get_multi_sports( $ ) {
|
||||
}
|
||||
|
||||
#
|
||||
# Return an array of keys for the passed rule. 'dport', 'comment', and 'origin' are omitted;
|
||||
# Return an array of keys for the passed rule. 'dport', 'comment', 'origin' and 'digest' are omitted;
|
||||
#
|
||||
sub get_keys( $ ) {
|
||||
my %skip = ( dport => 1, comment => 1, origin => 1 );
|
||||
my %skip = ( dport => 1, comment => 1, origin => 1, digest => 1 );
|
||||
|
||||
sort grep ! $skip{$_}, keys %{$_[0]};
|
||||
}
|
||||
@@ -4346,64 +4403,54 @@ sub delete_duplicates {
|
||||
my @rules;
|
||||
my $chainref = shift;
|
||||
my $lastrule = @_;
|
||||
my $baseref = pop;
|
||||
my $ruleref;
|
||||
my %skip = ( comment => 1, origin => 1 );
|
||||
|
||||
for ( @_ ) {
|
||||
$_->{digest} = sha1_hex irule_to_string1( $_ );
|
||||
}
|
||||
|
||||
my $baseref = pop;
|
||||
|
||||
while ( @_ ) {
|
||||
my $docheck;
|
||||
my $duplicate = 0;
|
||||
|
||||
if ( $baseref->{mode} == CAT_MODE && $baseref->{target} ) {
|
||||
my $ports1;
|
||||
my @keys1 = sort( grep ! $skip{$_}, keys( %$baseref ) );
|
||||
my $bad_key;
|
||||
my $rulenum = @_;
|
||||
my $adjacent = 1;
|
||||
|
||||
{
|
||||
RULE:
|
||||
my $digest = $baseref->{digest};
|
||||
|
||||
while ( --$rulenum >= 0 ) {
|
||||
$ruleref = $_[$rulenum];
|
||||
for ( grep ! $skip{$_}, keys( %$baseref ) ) {
|
||||
$bad_key = 1, last if $bad_match{$_};
|
||||
}
|
||||
|
||||
last unless $ruleref->{mode} == CAT_MODE;
|
||||
while ( --$rulenum >= 0 ) {
|
||||
$ruleref = $_[$rulenum];
|
||||
|
||||
my @keys2 = sort(grep ! $skip{$_}, keys( %$ruleref ) );
|
||||
last unless $ruleref->{mode} == CAT_MODE;
|
||||
|
||||
next unless @keys1 == @keys2 ;
|
||||
next unless $digest eq $ruleref->{digest};
|
||||
|
||||
my $keynum = 0;
|
||||
|
||||
if ( $adjacent > 0 ) {
|
||||
#
|
||||
# There are no non-duplicate rules between this rule and the base rule
|
||||
#
|
||||
for my $key ( @keys1 ) {
|
||||
next RULE unless $key eq $keys2[$keynum++];
|
||||
next RULE unless compare_values( $baseref->{$key}, $ruleref->{$key} );
|
||||
}
|
||||
} else {
|
||||
#
|
||||
# There are non-duplicate rules between this rule and the base rule
|
||||
#
|
||||
for my $key ( @keys1 ) {
|
||||
next RULE unless $key eq $keys2[$keynum++];
|
||||
next RULE unless compare_values( $baseref->{$key}, $ruleref->{$key} );
|
||||
last RULE if $bad_match{$key};
|
||||
}
|
||||
}
|
||||
unless ( $adjacent > 0 ) {
|
||||
#
|
||||
# This rule is a duplicate
|
||||
# There are non-duplicate rules between this rule and the base rule
|
||||
#
|
||||
$duplicate = 1;
|
||||
#
|
||||
# Increment $adjacent so that the continue block won't set it to zero
|
||||
#
|
||||
$adjacent++;
|
||||
|
||||
} continue {
|
||||
$adjacent--;
|
||||
last if $bad_key;
|
||||
}
|
||||
#
|
||||
# This rule is a duplicate
|
||||
#
|
||||
$duplicate = 1;
|
||||
#
|
||||
# Increment $adjacent so that the continue block won't set it to zero
|
||||
#
|
||||
$adjacent++;
|
||||
|
||||
} continue {
|
||||
$adjacent--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4440,10 +4487,10 @@ sub get_conntrack( $ ) {
|
||||
}
|
||||
|
||||
#
|
||||
# Return an array of keys for the passed rule. 'conntrack', 'comment' & 'origin' are omitted;
|
||||
# Return an array of keys for the passed rule. 'conntrack', 'comment', 'origin' and 'digest' are omitted;
|
||||
#
|
||||
sub get_keys1( $ ) {
|
||||
my %skip = ( comment => 1, origin => 1 , 'conntrack --ctstate' => 1 );
|
||||
my %skip = ( comment => 1, origin => 1 , digest => 1, 'conntrack --ctstate' => 1 );
|
||||
|
||||
sort grep ! $skip{$_}, keys %{$_[0]};
|
||||
}
|
||||
@@ -4562,7 +4609,7 @@ sub combine_states {
|
||||
|
||||
sub optimize_level16( $$$ ) {
|
||||
my ( $table, $tableref , $passes ) = @_;
|
||||
my @chains = ( grep $_->{referenced}, values %{$tableref} );
|
||||
my @chains = ( grep $_->{referenced}, sortchainsiftest %{$tableref} );
|
||||
my @chains1 = @chains;
|
||||
my $chains = @chains;
|
||||
|
||||
@@ -4679,7 +4726,7 @@ sub setup_zone_mss() {
|
||||
|
||||
my $hosts = find_zone_hosts_by_option( $zone, 'mss' );
|
||||
|
||||
for my $hostref ( @$hosts ) {
|
||||
for my $hostref ( $test ? sort { $a->[0] cmp $b->[0] } @$hosts : @$hosts ) {
|
||||
my $mss = $hostref->[4];
|
||||
my @mssmatch = have_capability( 'TCPMSS_MATCH' ) ? ( tcpmss => "--mss $mss:" ) : ();
|
||||
my @sourcedev = imatch_source_dev $hostref->[0];
|
||||
@@ -4991,10 +5038,10 @@ sub do_proto( $$$;$ )
|
||||
|
||||
$invert = $sports =~ s/^!// ? '! ' : '';
|
||||
|
||||
if ( $ports =~ /^\+/ ) {
|
||||
if ( $sports =~ /^\+/ ) {
|
||||
$output .= $invert;
|
||||
$output .= '-m set ';
|
||||
$output .= get_set_flags( $ports, 'src' );
|
||||
$output .= get_set_flags( $sports, 'src' );
|
||||
} elsif ( $multiport ) {
|
||||
if ( port_count( $sports ) > 15 ) {
|
||||
if ( $restricted ) {
|
||||
@@ -5207,8 +5254,8 @@ sub do_iproto( $$$ )
|
||||
fatal_error "'=' in the SOURCE PORT(S) column requires one or more ports in the DEST PORT(S) column" if $sports eq '=';
|
||||
$invert = $sports =~ s/^!// ? '! ' : '';
|
||||
|
||||
if ( $ports =~ /^\+/ ) {
|
||||
push @output, set => ${invert} . get_set_flags( $ports, 'src' );
|
||||
if ( $sports =~ /^\+/ ) {
|
||||
push @output, set => ${invert} . get_set_flags( $sports, 'src' );
|
||||
} elsif ( $multiport ) {
|
||||
if ( port_count( $sports ) > 15 ) {
|
||||
if ( $restricted ) {
|
||||
@@ -5747,10 +5794,25 @@ sub validate_helper( $;$ ) {
|
||||
|
||||
my $protonum = -1;
|
||||
|
||||
fatal_error "Unknown PROTO ($proto)" unless defined ( $protonum = resolve_proto( $proto ) );
|
||||
fatal_error "Unknown PROTO ($proto)" unless $proto eq '-' || defined ( $protonum = resolve_proto( $proto ) );
|
||||
|
||||
unless ( $protonum == $helper_proto ) {
|
||||
fatal_error "The $helper_base helper requires PROTO=" . (proto_name $helper_proto );
|
||||
if ( reftype( $helper_proto ) ) {
|
||||
#
|
||||
# More than one protocol allowed with this helper, so $helper_proto is an array reference
|
||||
#
|
||||
my $found;
|
||||
my $names = '';
|
||||
|
||||
for ( @$helper_proto ) {
|
||||
$names = $names ? join( ',', $names, proto_name( $_ ) ) : proto_name( $_ );
|
||||
$found = 1 if $protonum == $_;
|
||||
}
|
||||
|
||||
fatal_error "The $helper_base helper requires PROTO to be one of '$names'" unless $found;
|
||||
} else {
|
||||
unless ( $protonum == $helper_proto ) {
|
||||
fatal_error "The $helper_base helper requires PROTO=" . (proto_name( $helper_proto ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -7423,13 +7485,13 @@ sub set_global_variables( $$ ) {
|
||||
if ( $conditional ) {
|
||||
my ( $interface, @interfaces );
|
||||
|
||||
@interfaces = keys %interfaceaddr;
|
||||
@interfaces = sortkeysiftest %interfaceaddr;
|
||||
|
||||
for $interface ( @interfaces ) {
|
||||
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfaceaddr{$interface}) );
|
||||
}
|
||||
|
||||
@interfaces = keys %interfacegateways;
|
||||
@interfaces = sortkeysiftest %interfacegateways;
|
||||
|
||||
for $interface ( @interfaces ) {
|
||||
emit( qq(if [ -z "\$interface" -o "\$interface" = "$interface" ]; then) );
|
||||
@@ -7439,29 +7501,29 @@ sub set_global_variables( $$ ) {
|
||||
emit( qq(fi\n) );
|
||||
}
|
||||
|
||||
@interfaces = keys %interfacemacs;
|
||||
@interfaces = sortkeysiftest %interfacemacs;
|
||||
|
||||
for $interface ( @interfaces ) {
|
||||
emit( qq([ -z "\$interface" -o "\$interface" = "$interface" ] && $interfacemacs{$interface}) );
|
||||
}
|
||||
} else {
|
||||
emit $_ for values %interfaceaddr;
|
||||
emit "$_\n" for values %interfacegateways;
|
||||
emit $_ for values %interfacemacs;
|
||||
emit $interfaceaddr{$_} for sortkeysiftest %interfaceaddr;
|
||||
emit "$interfacegateways{$_}\n" for sortkeysiftest %interfacegateways;
|
||||
emit $interfacemacs{$_} for sortkeysiftest %interfacemacs;
|
||||
}
|
||||
|
||||
if ( $setall ) {
|
||||
emit $_ for values %interfaceaddrs;
|
||||
emit $_ for values %interfacenets;
|
||||
emit $interfaceaddr{$_} for sortkeysiftest %interfaceaddr;
|
||||
emit $interfacenets{$_} for sortkeysiftest %interfacenets;
|
||||
|
||||
unless ( have_capability( 'ADDRTYPE' ) ) {
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
emit 'ALL_BCASTS="$(get_all_bcasts) 255.255.255.255"';
|
||||
emit $_ for values %interfacebcasts;
|
||||
emit $interfacebcasts{$_} for sortkeysiftest %interfacebcasts;
|
||||
} else {
|
||||
emit 'ALL_ACASTS="$(get_all_acasts)"';
|
||||
emit $_ for values %interfaceacasts;
|
||||
emit $interfaceacasts{$_} for sortkeysiftest %interfaceacasts;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7652,11 +7714,13 @@ sub isolate_source_interface( $ ) {
|
||||
) {
|
||||
$iiface = $1;
|
||||
$inets = $2;
|
||||
$inets =~ s/\]-\[/-/;
|
||||
} elsif ( $source =~ /:/ ) {
|
||||
if ( $source =~ /^\[(?:.+),\[(?:.+)\]$/ ){
|
||||
$inets = $source;
|
||||
} elsif ( $source =~ /^\[(.+)\]$/ ) {
|
||||
$inets = $1;
|
||||
$inets =~ s/\]-\[/-/;
|
||||
} else {
|
||||
$inets = $source;
|
||||
}
|
||||
@@ -7774,6 +7838,7 @@ sub isolate_dest_interface( $$$$ ) {
|
||||
if ( $dest =~ /^(.+?):(\[(?:.+),\[(?:.+)\])$/ ) {
|
||||
$diface = $1;
|
||||
$dnets = $2;
|
||||
$dnets =~ s/\]-\[/-/;
|
||||
} elsif ( $dest =~ /^(.+?):\[(.+)\]\s*$/ ||
|
||||
$dest =~ /^(.+?):(!?\+.+)$/ ||
|
||||
$dest =~ /^(.+?):(!?[&%].+)$/ ||
|
||||
@@ -7786,6 +7851,7 @@ sub isolate_dest_interface( $$$$ ) {
|
||||
$dnets = $dest;
|
||||
} elsif ( $dest =~ /^\[(.+)\]$/ ) {
|
||||
$dnets = $1;
|
||||
$dnets =~ s/\]-\[/-/;
|
||||
} else {
|
||||
$dnets = $dest;
|
||||
}
|
||||
@@ -8421,7 +8487,7 @@ sub add_interface_options( $ ) {
|
||||
# Insert jumps to the interface chains into the rules chains
|
||||
#
|
||||
for my $zone1 ( off_firewall_zones ) {
|
||||
my @input_interfaces = keys %{zone_interfaces( $zone1 )};
|
||||
my @input_interfaces = sortkeysiftest %{zone_interfaces( $zone1 )};
|
||||
my @forward_interfaces = @input_interfaces;
|
||||
|
||||
if ( @input_interfaces > 1 ) {
|
||||
@@ -8507,7 +8573,7 @@ sub add_interface_options( $ ) {
|
||||
for my $zone1 ( firewall_zone, vserver_zones ) {
|
||||
for my $zone2 ( off_firewall_zones ) {
|
||||
my $chainref = $filter_table->{rules_chain( $zone1, $zone2 )};
|
||||
my @interfaces = keys %{zone_interfaces( $zone2 )};
|
||||
my @interfaces = sortkeysiftest %{zone_interfaces( $zone2 )};
|
||||
my $chain1ref;
|
||||
|
||||
for my $interface ( @interfaces ) {
|
||||
@@ -8691,32 +8757,29 @@ sub emitr1( $$ ) {
|
||||
sub save_docker_rules($) {
|
||||
my $tool = $_[0];
|
||||
|
||||
my $bridge = $config{DOCKER_BRIDGE};
|
||||
|
||||
emit( qq(if [ -n "\$g_docker" ]; then),
|
||||
qq( $tool -t nat -S DOCKER | tail -n +2 > \${VARDIR}/.nat_DOCKER),
|
||||
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 nat -S POSTROUTING | tail -n +2 | fgrep -v SHOREWALL | fgrep -v LIBVIRT > \${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_dockeruser" ] && $tool -t filter -S DOCKER-USER | tail -n +2 > \${VARDIR}/.filter_DOCKER-USER),
|
||||
qq( rm -f \${VARDIR}/.filter_DOCKER-*),
|
||||
qq( [ -n "\$g_dockeringress" ] && $tool -t filter -S DOCKER-INGRESS | tail -n +2 > \${VARDIR}/.filter_DOCKER-INGRESS),
|
||||
qq( [ -n "\$g_dockeruser" ] && $tool -t filter -S DOCKER-USER | tail -n +2 > \${VARDIR}/.filter_DOCKER-USER),
|
||||
qq( [ -n "\$g_dockeriso" ] && $tool -t filter -S DOCKER-ISOLATION | tail -n +2 > \${VARDIR}/.filter_DOCKER-ISOLATION),
|
||||
qq(),
|
||||
qq( case "\$g_dockernetwork" in),
|
||||
qq( One\)),
|
||||
qq( rm -f \${VARDIR}/.filter_DOCKER-ISOLATION*),
|
||||
qq( $tool -t filter -S DOCKER-ISOLATION | tail -n +2 > \${VARDIR}/.filter_DOCKER-ISOLATION),
|
||||
qq( ;;),
|
||||
qq( Two\)),
|
||||
qq( rm -f \${VARDIR}/.filter_DOCKER-ISOLATION*),
|
||||
qq( $tool -t filter -S DOCKER-ISOLATION-STAGE-1 | tail -n +2 > \${VARDIR}/.filter_DOCKER-ISOLATION-STAGE-1),
|
||||
qq( $tool -t filter -S DOCKER-ISOLATION-STAGE-2 | tail -n +2 > \${VARDIR}/.filter_DOCKER-ISOLATION-STAGE-2),
|
||||
qq( ;;),
|
||||
qq( esac),
|
||||
qq( if [ -n "\$g_dockerisostage" ]; then),
|
||||
qq( $tool -t filter -S DOCKER-ISOLATION-STAGE-1 | tail -n +2 > \${VARDIR}/.filter_DOCKER-ISOLATION-STAGE-1),
|
||||
qq( $tool -t filter -S DOCKER-ISOLATION-STAGE-2 | tail -n +2 > \${VARDIR}/.filter_DOCKER-ISOLATION-STAGE-2),
|
||||
qq( fi),
|
||||
qq(),
|
||||
);
|
||||
|
||||
if ( known_interface( 'docker0' ) ) {
|
||||
if ( known_interface( $bridge ) ) {
|
||||
emit( qq( $tool -t filter -S FORWARD | grep '^-A FORWARD.*[io] br-[a-z0-9]\\{12\\}' > \${VARDIR}/.filter_FORWARD) );
|
||||
} else {
|
||||
emit( qq( $tool -t filter -S FORWARD | egrep '^-A FORWARD.*[io] (docker0|br-[a-z0-9]{12})' > \${VARDIR}/.filter_FORWARD) );
|
||||
emit( qq( $tool -t filter -S FORWARD | egrep '^-A FORWARD.*[io] ($bridge|br-[a-z0-9]{12})' > \${VARDIR}/.filter_FORWARD) );
|
||||
}
|
||||
|
||||
emit( q( [ -s ${VARDIR}/.filter_FORWARD ] || rm -f ${VARDIR}/.filter_FORWARD),
|
||||
@@ -8828,7 +8891,7 @@ sub ensure_ipsets( @ ) {
|
||||
my $set;
|
||||
my $counters = have_capability( 'IPSET_MATCH_COUNTERS' ) ? ' counters' : '';
|
||||
|
||||
if ( $globals{DBL_TIMEOUT} ne '' && $_[0] eq $globals{DBL_IPSET} ) {
|
||||
if ( $_[0] eq $globals{DBL_IPSET} ) {
|
||||
shift;
|
||||
|
||||
emit( qq( if ! qt \$IPSET list $globals{DBL_IPSET}; then));
|
||||
@@ -8839,12 +8902,12 @@ sub ensure_ipsets( @ ) {
|
||||
emit( q( #),
|
||||
q( # Set the timeout for the dynamic blacklisting ipset),
|
||||
q( #),
|
||||
qq( \$IPSET -exist create $globals{DBL_IPSET} hash:net family inet timeout $globals{DBL_TIMEOUT}${counters}) );
|
||||
qq( \$IPSET -exist create $globals{DBL_IPSET} hash:net family inet timeout 0${counters}) );
|
||||
} else {
|
||||
emit( q( #),
|
||||
q( # Set the timeout for the dynamic blacklisting ipset),
|
||||
q( #),
|
||||
qq( \$IPSET -exist create $globals{DBL_IPSET} hash:net family inet6 timeout $globals{DBL_TIMEOUT}${counters}) );
|
||||
qq( \$IPSET -exist create $globals{DBL_IPSET} hash:net family inet6 timeout 0${counters}) );
|
||||
}
|
||||
|
||||
pop_indent;
|
||||
@@ -8951,7 +9014,7 @@ sub create_save_ipsets() {
|
||||
#
|
||||
$ipsets{$_} = 1 for ( @ipsets, @{$globals{SAVED_IPSETS}} );
|
||||
|
||||
my @sets = keys %ipsets;
|
||||
my @sets = sortkeysiftest %ipsets;
|
||||
|
||||
emit( '' ,
|
||||
' rm -f $file' ,
|
||||
@@ -9021,10 +9084,14 @@ sub create_load_ipsets() {
|
||||
# Requires V5 or later
|
||||
#
|
||||
emit( '' ,
|
||||
" for set in \$(\$IPSET save | grep '$select' | cut -d' ' -f2); do" ,
|
||||
' $IPSET flush $set' ,
|
||||
' $IPSET destroy $set' ,
|
||||
" done" ,
|
||||
' if [ -f ${VARDIR}/ipsets.save ]; then' ,
|
||||
' while read verb set rest; do' ,
|
||||
' if [ $verb = create ]; then' ,
|
||||
' $IPSET flush $set' ,
|
||||
' $IPSET destroy $set' ,
|
||||
' fi' ,
|
||||
' done < ${VARDIR}/ipsets.save' ,
|
||||
' fi',
|
||||
);
|
||||
} else {
|
||||
#
|
||||
@@ -9067,7 +9134,7 @@ sub create_load_ipsets() {
|
||||
emit( ' #',
|
||||
' # Update the dynamic blacklisting ipset timeout value',
|
||||
' #',
|
||||
qq( awk '/create $set/ { sub( /timeout [0-9]+/, "timeout $globals{DBL_TIMEOUT}" ) }; {print};' \${VARDIR}/ipsets.save > \${VARDIR}/ipsets.temp),
|
||||
qq( awk '/create $set/ { sub( /timeout [0-9]+/, "timeout 0" ) }; {print};' \${VARDIR}/ipsets.save > \${VARDIR}/ipsets.temp),
|
||||
' zap_ipsets',
|
||||
' $IPSET restore < ${VARDIR}/ipsets.temp',
|
||||
' fi' );
|
||||
@@ -9120,7 +9187,7 @@ sub create_load_ipsets() {
|
||||
#
|
||||
sub create_nfobjects() {
|
||||
|
||||
my @objects = ( keys %nfobjects );
|
||||
my @objects = ( sortkeysiftest %nfobjects );
|
||||
|
||||
if ( @objects ) {
|
||||
if ( $config{NFACCT} ) {
|
||||
@@ -9135,7 +9202,7 @@ sub create_nfobjects() {
|
||||
}
|
||||
}
|
||||
|
||||
for ( keys %nfobjects ) {
|
||||
for ( @objects ) {
|
||||
emit( qq(if ! qt \$NFACCT get $_; then),
|
||||
qq( \$NFACCT add $_),
|
||||
qq(fi\n) );
|
||||
@@ -9230,10 +9297,10 @@ sub create_netfilter_load( $ ) {
|
||||
emit( '[ -n "$g_docker" ] && echo ":DOCKER - [0:0]" >&3' );
|
||||
} elsif ( $name eq 'DOCKER-ISOLATION' ) {
|
||||
ensure_cmd_mode;
|
||||
emit( '[ "$g_dockernetwork" = One ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
} elsif ( $name =~ /^DOCKER-ISOLATION-/ ) {
|
||||
emit( '[ -n "$g_dockeriso" ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
} elsif ( $name =~ /^DOCKER-ISOLATION/ ) {
|
||||
ensure_cmd_mode;
|
||||
emit( qq([ "\$g_dockernetwork" = Two ] && echo ":$name - [0:0]" >&3) );
|
||||
emit( qq([ -n "\$g_dockerisostage" ] && echo ":$name - [0:0]" >&3) );
|
||||
} elsif ( $name eq 'DOCKER-INGRESS' ) {
|
||||
ensure_cmd_mode;
|
||||
emit( '[ -n "$g_dockeringress" ] && echo ":DOCKER-INGRESS - [0:0]" >&3' );
|
||||
@@ -9345,11 +9412,11 @@ sub preview_netfilter_load() {
|
||||
print "\n";
|
||||
} elsif ( $name eq 'DOCKER-ISOLATION' ) {
|
||||
ensure_cmd_mode1;
|
||||
print( '[ "$g_dockernetwork" = One ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
print( '[ -n "$g_dockeriso" ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
print "\n";
|
||||
} elsif ( $name =~ /^DOCKER-ISOLATION-/ ) {
|
||||
} elsif ( $name =~ /^DOCKER-ISOLATION/ ) {
|
||||
ensure_cmd_mode1;
|
||||
print( qq([ "\$g_dockernetwork" = Two ] && echo ":$name - [0:0]" >&3) );
|
||||
print( qq([ "\$g_dockeisostage" ] && echo ":$name - [0:0]" >&3) );
|
||||
print "\n";
|
||||
} elsif ( $name eq 'DOCKER-INGRESS' ) {
|
||||
ensure_cmd_mode1;
|
||||
@@ -9446,10 +9513,10 @@ sub create_stop_load( $ ) {
|
||||
emit( '[ -n "$g_docker" ] && echo ":DOCKER - [0:0]" >&3' );
|
||||
} elsif ( $name eq 'DOCKER-ISOLATION' ) {
|
||||
ensure_cmd_mode;
|
||||
emit( '[ -n "$g_dockernetwork" ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
} elsif ( $name =~ /^DOCKER-ISOLATION-/ ) {
|
||||
emit( '[ -n "$g_dockeriso" ] && echo ":DOCKER-ISOLATION - [0:0]" >&3' );
|
||||
} elsif ( $name =~ /^DOCKER-ISOLATION/ ) {
|
||||
ensure_cmd_mode;
|
||||
emit( qq([ "\$g_dockernetwork" = Two ] && echo ":$name - [0:0]" >&3) );
|
||||
emit( qq([ -n "\$g_dockerisostage" ] && echo ":$name - [0:0]" >&3) );
|
||||
} elsif ( $name eq 'DOCKER-INGRESS' ) {
|
||||
ensure_cmd_mode;
|
||||
emit( '[ -n "$g_dockeringress" ] && echo ":DOCKER-INGRESS - [0:0]" >&3' );
|
||||
@@ -9508,7 +9575,7 @@ sub create_stop_load( $ ) {
|
||||
}
|
||||
|
||||
sub initialize_switches() {
|
||||
if ( keys %switches ) {
|
||||
if ( sortkeysiftest %switches ) {
|
||||
emit( 'if [ $COMMAND = start ]; then' );
|
||||
push_indent;
|
||||
for my $switch ( keys %switches ) {
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -49,8 +49,6 @@ our $VERSION = 'MODULEVERSION';
|
||||
|
||||
our $export; # True when compiling for export
|
||||
|
||||
our $test; # True when running regression tests
|
||||
|
||||
our $family; # IP address family (4 or 6)
|
||||
|
||||
our $have_arptables; # True if we have arptables rules
|
||||
@@ -58,8 +56,8 @@ our $have_arptables; # True if we have arptables rules
|
||||
#
|
||||
# Initilize the package-globals in the other modules
|
||||
#
|
||||
sub initialize_package_globals( $$$ ) {
|
||||
Shorewall::Config::initialize($family, $export, $_[1], $_[2]);
|
||||
sub initialize_package_globals( $$$$ ) {
|
||||
Shorewall::Config::initialize($family, $export, $_[1], $_[2], $_[3]);
|
||||
Shorewall::Chains::initialize ($family, 1, $export );
|
||||
Shorewall::Zones::initialize ($family, $_[0]);
|
||||
Shorewall::Nat::initialize($family);
|
||||
@@ -268,13 +266,10 @@ sub generate_script_2() {
|
||||
emit( '',
|
||||
'chain_exists DOCKER nat && chain_exists DOCKER && g_docker=Yes',
|
||||
);
|
||||
emit( 'chain_exists DOCKER-INGRESS && g_dockeringress=Yes' );
|
||||
emit( 'chain_exists DOCKER-USER && g_dockeruser=Yes' );
|
||||
emit( 'if chain_exists DOCKER-ISOLATION; then',
|
||||
' g_dockernetwork=One',
|
||||
'elif chain_exists DOCKER-ISOLATION-STAGE-1; then',
|
||||
' g_dockernetwork=Two',
|
||||
'fi' );
|
||||
emit( 'chain_exists DOCKER-INGRESS && g_dockeringress=Yes' );
|
||||
emit( 'chain_exists DOCKER-USER && g_dockeruser=Yes' );
|
||||
emit( 'chain_exists DOCKER-ISOLATION && g_dockeriso=Yes' );
|
||||
emit( 'chain_exists DOCKER-ISOLATION-STAGE-1 && g_dockerisostage=Yes' );
|
||||
}
|
||||
|
||||
pop_indent;
|
||||
@@ -548,13 +543,13 @@ date > ${VARDIR}/restarted
|
||||
|
||||
case $COMMAND in
|
||||
start)
|
||||
mylogger kern.info "$g_product started"
|
||||
mylogger daemon.info "$g_product started"
|
||||
;;
|
||||
reload)
|
||||
mylogger kern.info "$g_product reloaded"
|
||||
mylogger daemon.info "$g_product reloaded"
|
||||
;;
|
||||
restore)
|
||||
mylogger kern.info "$g_product restored"
|
||||
mylogger daemon.info "$g_product restored"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
@@ -591,7 +586,7 @@ sub compiler {
|
||||
( '', '', -1, '', 0, '', -1, 0, 0, 0, 0, , '' , '/usr/share/shorewall/shorewallrc', '' );
|
||||
|
||||
$export = 0;
|
||||
$test = 0;
|
||||
my $test = 0;
|
||||
$have_arptables = 0;
|
||||
|
||||
sub validate_boolean( $ ) {
|
||||
@@ -644,18 +639,19 @@ sub compiler {
|
||||
#
|
||||
# Now that we know the address family (IPv4/IPv6), we can initialize the other modules' globals
|
||||
#
|
||||
initialize_package_globals( $update, $shorewallrc, $shorewallrc1 );
|
||||
|
||||
initialize_package_globals( $update, $test, $shorewallrc, $shorewallrc1 );
|
||||
#
|
||||
# Rather than continuing to extend the argument list of Config::initialize(),
|
||||
# we use a set of small functions to export settings to the Config module.
|
||||
#
|
||||
set_config_path( $config_path ) if $config_path;
|
||||
|
||||
set_shorewall_dir( $directory ) if $directory ne '';
|
||||
|
||||
$verbosity = 1 if $debug && $verbosity < 1;
|
||||
|
||||
set_verbosity( $verbosity );
|
||||
set_log($log, $log_verbosity) if $log;
|
||||
set_timestamp( $timestamp );
|
||||
set_debug( $debug , $confess );
|
||||
set_command( 'compile', 'Compiling', 'Compiled' );
|
||||
#
|
||||
# S H O R E W A L L R C ,
|
||||
# S H O R E W A L L . C O N F A N D C A P A B I L I T I E S
|
||||
@@ -673,12 +669,7 @@ sub compiler {
|
||||
#
|
||||
# Create a temp file to hold the script
|
||||
#
|
||||
if ( $scriptfilename ) {
|
||||
set_command( 'compile', 'Compiling', 'Compiled' );
|
||||
create_temp_script( $scriptfilename , $export );
|
||||
} else {
|
||||
set_command( 'check', 'Checking', 'Checked' );
|
||||
}
|
||||
create_temp_script( $scriptfilename , $export ) if $scriptfilename;
|
||||
#
|
||||
# Z O N E D E F I N I T I O N
|
||||
# (Produces no output to the compiled script)
|
||||
@@ -867,13 +858,13 @@ sub compiler {
|
||||
if ( ( my $optimize = $config{OPTIMIZE} ) & OPTIMIZE_MASK ) {
|
||||
progress_message2 'Optimizing Ruleset...';
|
||||
#
|
||||
# Optimize the ruleet
|
||||
#
|
||||
optimize_ruleset if $optimize & OPTIMIZE_RULESET_MASK;
|
||||
#
|
||||
# Optimize Policy Chains
|
||||
#
|
||||
optimize_policy_chains if ( $optimize & OPTIMIZE_POLICY_MASK2n4 ) == OPTIMIZE_POLICY_MASK; # Level 2 but not 4
|
||||
#
|
||||
# More Optimization
|
||||
#
|
||||
optimize_ruleset if $config{OPTIMIZE} & OPTIMIZE_RULESET_MASK;
|
||||
optimize_policy_chains if $optimize & OPTIMIZE_POLICY_MASK;
|
||||
}
|
||||
|
||||
enable_script;
|
||||
@@ -916,7 +907,7 @@ sub compiler {
|
||||
#
|
||||
# Close, rename and secure the script
|
||||
#
|
||||
finalize_script ( $export );
|
||||
finalize_script ( $export, $test );
|
||||
#
|
||||
# And generate the auxilary config file
|
||||
#
|
||||
@@ -937,16 +928,16 @@ sub compiler {
|
||||
|
||||
optimize_level0;
|
||||
|
||||
if ( ( my $optimize = $config{OPTIMIZE} ) & 0x1e ) {
|
||||
if ( ( my $optimize = $config{OPTIMIZE} ) & OPTIMIZE_MASK ) {
|
||||
progress_message2 'Optimizing Ruleset...';
|
||||
#
|
||||
# Optimize Policy Chains
|
||||
#
|
||||
optimize_policy_chains if ( $optimize & OPTIMIZE_POLICY_MASK2n4 ) == OPTIMIZE_POLICY_MASK; # Level 2 but not 4
|
||||
#
|
||||
# Ruleset Optimization
|
||||
#
|
||||
optimize_ruleset if $optimize & OPTIMIZE_RULESET_MASK;
|
||||
#
|
||||
# Optimize Policy Chains
|
||||
#
|
||||
optimize_policy_chains if $optimize & OPTIMIZE_POLICY_MASK;
|
||||
}
|
||||
|
||||
enable_script if $debug;
|
||||
@@ -981,11 +972,7 @@ sub compiler {
|
||||
#
|
||||
report_used_capabilities;
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
progress_message3 "Shorewall configuration verified";
|
||||
} else {
|
||||
progress_message3 "Shorewall6 configuration verified";
|
||||
}
|
||||
progress_message3 "$Product configuration verified";
|
||||
}
|
||||
|
||||
close_log if $log;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -162,10 +162,15 @@ our @EXPORT = qw(
|
||||
|
||||
have_capability
|
||||
require_capability
|
||||
require_mangle_capability
|
||||
report_used_capabilities
|
||||
kernel_version
|
||||
|
||||
compiletime
|
||||
compiletime
|
||||
|
||||
sortkeysiftest
|
||||
sortvaluesiftest
|
||||
sortiftest
|
||||
|
||||
F_IPV4
|
||||
F_IPV6
|
||||
@@ -263,6 +268,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
||||
$debug
|
||||
$file_format
|
||||
$comment
|
||||
$test
|
||||
|
||||
%config
|
||||
%origin
|
||||
@@ -305,7 +311,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
||||
|
||||
OPTIMIZE_MASK
|
||||
OPTIMIZE_POLICY_MASK
|
||||
OPTIMIZE_POLICY_MASK2n4
|
||||
OPTIMIZE_RULESET_MASK
|
||||
OPTIMIZE_ALL
|
||||
) , ] ,
|
||||
@@ -549,7 +554,6 @@ use constant {
|
||||
#
|
||||
use constant {
|
||||
OPTIMIZE_POLICY_MASK => 0x02 , # Call optimize_policy_chains()
|
||||
OPTIMIZE_POLICY_MASK2n4 => 0x06 ,
|
||||
OPTIMIZE_RULESET_MASK => 0x1C , # Call optimize_ruleset()
|
||||
OPTIMIZE_MASK => 0x1E , # Do optimizations beyond level 1
|
||||
OPTIMIZE_ALL => 0x1F , # Maximum value for documented categories.
|
||||
@@ -651,6 +655,30 @@ our %params;
|
||||
#
|
||||
our %compiler_params;
|
||||
#
|
||||
# Entries conditionally exported to the compiled script via the aux config file
|
||||
#
|
||||
our @exported_params = ( qw(
|
||||
VERBOSITY
|
||||
LOGFILE
|
||||
LOGFORMAT
|
||||
APRTABLES
|
||||
IPTABLES
|
||||
IP6TABLES
|
||||
IP
|
||||
TC
|
||||
IPSET
|
||||
PATH
|
||||
SHOREWALL_SHELL
|
||||
SHELL
|
||||
SUBSYSLOCK
|
||||
LOCKFILE
|
||||
RESTOREFILE
|
||||
RESTART
|
||||
DYNAMIC_BLACKLIST
|
||||
PAGER
|
||||
)
|
||||
);
|
||||
#
|
||||
# Action parameters
|
||||
#
|
||||
our %actparams;
|
||||
@@ -684,7 +712,6 @@ our $shorewall_dir; # Shorewall Directory; if non-empty, search here fi
|
||||
|
||||
our $debug; # Global debugging flag
|
||||
our $confess; # If true, use Carp to report errors with stack trace.
|
||||
our $update; # True if this is an update
|
||||
|
||||
our $family; # Protocol family (4 or 6)
|
||||
our $export; # True when compiling for export
|
||||
@@ -793,6 +820,8 @@ our %filecache;
|
||||
|
||||
our $compiletime;
|
||||
|
||||
our $test;
|
||||
|
||||
sub process_shorewallrc($$);
|
||||
sub add_variables( \% );
|
||||
#
|
||||
@@ -804,9 +833,12 @@ 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, $export, my ( $shorewallrc, $shorewallrc1 ) ) = @_;
|
||||
####################################################################################################
|
||||
# Do not change the required part of this prototype unless you want to take on a lot of additional
|
||||
# work (This function is called from build).
|
||||
####################################################################################################
|
||||
sub initialize($;$$$$) {
|
||||
( $family, $export, $test, my ( $shorewallrc, $shorewallrc1 ) ) = @_;
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
( $product, $Product, $toolname, $toolNAME ) = qw( shorewall Shorewall iptables IPTABLES );
|
||||
@@ -851,7 +883,7 @@ sub initialize( $;$$$) {
|
||||
TC_SCRIPT => '',
|
||||
EXPORT => 0,
|
||||
KLUDGEFREE => '',
|
||||
VERSION => '5.2.0-Beta1',
|
||||
VERSION => '5.2.4.1',
|
||||
CAPVERSION => 50200 ,
|
||||
BLACKLIST_LOG_TAG => '',
|
||||
RELATED_LOG_TAG => '',
|
||||
@@ -1010,6 +1042,7 @@ sub initialize( $;$$$) {
|
||||
PERL_HASH_SEED => undef ,
|
||||
USE_NFLOG_SIZE => undef ,
|
||||
RENAME_COMBINED => undef ,
|
||||
DOCKER_BRIDGE => undef ,
|
||||
#
|
||||
# Packet Disposition
|
||||
#
|
||||
@@ -1192,7 +1225,6 @@ sub initialize( $;$$$) {
|
||||
|
||||
$debug = 0;
|
||||
$confess = 0;
|
||||
$update = 0;
|
||||
|
||||
%params = ();
|
||||
|
||||
@@ -1828,6 +1860,30 @@ sub set_command( $$$ ) {
|
||||
($command, $doing, $done) = @_;
|
||||
}
|
||||
|
||||
#
|
||||
# Return the keys or values of the passed hash. If $test, the keys/values will be sorted by their own values
|
||||
#
|
||||
sub sortkeysiftest(\%) {
|
||||
my ( $hashref ) = @_;
|
||||
|
||||
return sort keys %$hashref if $test;
|
||||
return keys %$hashref;
|
||||
}
|
||||
|
||||
sub sortvaluesiftest(\%) {
|
||||
my ( $hashref ) = @_;
|
||||
|
||||
return sort values %$hashref if $test;
|
||||
return keys %$hashref;
|
||||
}
|
||||
|
||||
#
|
||||
# Sort a list by the list elements if $test
|
||||
#
|
||||
sub sortiftest(@) {
|
||||
return $test ? sort @_ : @_;
|
||||
}
|
||||
|
||||
#
|
||||
# Print the current TOD to STDOUT.
|
||||
#
|
||||
@@ -2015,28 +2071,30 @@ sub generate_sha1() {
|
||||
#
|
||||
# Finalize the script file
|
||||
#
|
||||
sub finalize_script( $ ) {
|
||||
my $export = $_[0];
|
||||
sub finalize_script( $$ ) {
|
||||
my ( $export, $test ) = @_;
|
||||
close $script;
|
||||
$script = 0;
|
||||
|
||||
if ( $file ne '-' ) {
|
||||
my $sha1sum = generate_sha1;
|
||||
my $sha1sum1 = join( '-', 'sha-lh', substr( $sha1sum, 0, 20 ) );
|
||||
my $sha1sum2 = join( '-', 'sha-rh', substr( $sha1sum, -20 ) );
|
||||
unless ( $test ) {
|
||||
my $sha1sum = generate_sha1;
|
||||
my $sha1sum1 = join( '-', 'sha-lh', substr( $sha1sum, 0, 20 ) );
|
||||
my $sha1sum2 = join( '-', 'sha-rh', substr( $sha1sum, -20 ) );
|
||||
|
||||
@ARGV = ( $tempfile );
|
||||
$^I = '';
|
||||
@ARGV = ( $tempfile );
|
||||
$^I = '';
|
||||
|
||||
while ( <> ) {
|
||||
s/g_sha1sum1=/g_sha1sum1=$sha1sum1/;
|
||||
s/g_sha1sum2=/g_sha1sum2=$sha1sum2/;
|
||||
print;
|
||||
while ( <> ) {
|
||||
s/g_sha1sum1=/g_sha1sum1=$sha1sum1/;
|
||||
s/g_sha1sum2=/g_sha1sum2=$sha1sum2/;
|
||||
print;
|
||||
}
|
||||
}
|
||||
|
||||
rename $tempfile, $file or fatal_error "Cannot Rename $tempfile to $file: $!";
|
||||
chmod 0700, $file or fatal_error "Cannot secure $file for execute access";
|
||||
progress_message3 "Shorewall configuration compiled to $file" unless $export;
|
||||
progress_message3 "$Product configuration compiled to $file" unless $export;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2058,7 +2116,7 @@ sub finalize_aux_config() {
|
||||
close $script;
|
||||
$script = 0;
|
||||
rename $tempfile, "$file.conf" or fatal_error "Cannot Rename $tempfile to $file.conf: $!";
|
||||
progress_message3 "Shorewall configuration compiled to $file";
|
||||
progress_message3 "$Product configuration compiled to $file";
|
||||
}
|
||||
|
||||
#
|
||||
@@ -4023,9 +4081,9 @@ sub read_a_line($) {
|
||||
#
|
||||
handle_first_entry if $first_entry;
|
||||
#
|
||||
# Save Raw Image if we are updating
|
||||
# Save Raw Image
|
||||
#
|
||||
$rawcurrentline = $currentline if $update;
|
||||
$rawcurrentline = $currentline;
|
||||
#
|
||||
# Expand Shell Variables using %params and %actparams
|
||||
#
|
||||
@@ -4075,14 +4133,16 @@ sub process_shorewallrc( $$ ) {
|
||||
my ( $shorewallrc , $product ) = @_;
|
||||
|
||||
$shorewallrc{PRODUCT} = $product;
|
||||
$variables{PRODUCT} = $product;
|
||||
|
||||
if ( open_file $shorewallrc ) {
|
||||
while ( read_a_line( STRIP_COMMENTS | SUPPRESS_WHITESPACE | CHECK_GUNK ) ) {
|
||||
while ( read_a_line( STRIP_COMMENTS | SUPPRESS_WHITESPACE | CHECK_GUNK | EXPAND_VARIABLES ) ) {
|
||||
if ( $currentline =~ /^([a-zA-Z]\w*)=(.*)$/ ) {
|
||||
my ($var, $val) = ($1, $2);
|
||||
$val = $1 if $val =~ /^\"([^\"]*)\"$/;
|
||||
expand_shorewallrc_variables($val) if supplied $val;
|
||||
$shorewallrc{$var} = $val;
|
||||
$variables{$var} = $val;
|
||||
} else {
|
||||
fatal_error "Unrecognized shorewallrc entry";
|
||||
}
|
||||
@@ -4353,7 +4413,9 @@ sub validate_level( $;$ ) {
|
||||
sub default_log_level( $$ ) {
|
||||
my ( $level, $default ) = @_;
|
||||
|
||||
my $value = $config{$level};
|
||||
my $value = $config{$level} || '';
|
||||
|
||||
$value = $config{LOG_LEVEL} if $value eq '$LOG_LEVEL'; #This can happen during update
|
||||
|
||||
unless ( supplied $value ) {
|
||||
$config{$level} = validate_level $default, $level;
|
||||
@@ -4603,7 +4665,11 @@ sub New_Conntrack_Match() {
|
||||
}
|
||||
|
||||
sub Old_Conntrack_Match() {
|
||||
! qt1( "$iptables $iptablesw -A $sillyname -m conntrack ! --ctorigdst 1.2.3.4" );
|
||||
if ( $family == F_IPV4 ) {
|
||||
! qt1( "$iptables $iptablesw -A $sillyname -m conntrack ! --ctorigdst 1.2.3.4" );
|
||||
} else {
|
||||
! qt1( "$iptables $iptablesw -A $sillyname -m conntrack ! --ctorigdst ::1" );
|
||||
}
|
||||
}
|
||||
|
||||
sub Multiport() {
|
||||
@@ -5263,6 +5329,16 @@ sub require_capability( $$$ ) {
|
||||
fatal_error "$description require${singular} $capdesc{$capability} in your kernel and iptables" unless have_capability $capability, 1;
|
||||
}
|
||||
|
||||
sub require_mangle_capability( $$$ ) {
|
||||
my ( $capability, $description, $singular ) = @_;
|
||||
|
||||
if ( $config{MANGLE_ENABLED} ) {
|
||||
&require_capability( @_ );
|
||||
} else {
|
||||
fatal_error "$description " . ( $singular ? 'is' : 'are' ) . " not available when MANGLE_ENABLED=No in $shorewallrc{PRODUCT}.conf";
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Return Kernel Version
|
||||
#
|
||||
@@ -5298,17 +5374,12 @@ sub ensure_config_path() {
|
||||
|
||||
my $chop = ( $path =~ s/^:// );
|
||||
|
||||
$path =~ s/:+/:/g;
|
||||
|
||||
@config_path = split /:/, $path;
|
||||
|
||||
shift @config_path if $chop && ( $export || $> != 0 );
|
||||
|
||||
#
|
||||
# To accomodate Cygwin-based compilation, we have separate directories for files whose names
|
||||
# clash on a case-insensitive filesystem.
|
||||
#
|
||||
push @config_path, $globals{SHAREDIR} . "/deprecated";
|
||||
push @config_path, $shorewallrc{SHAREDIR}. '/shorewall/deprecated' unless $globals{PRODUCT} eq 'shorewall';
|
||||
|
||||
for ( @config_path ) {
|
||||
$_ .= '/' unless m|/$|;
|
||||
s|//|/|g;
|
||||
@@ -5441,6 +5512,7 @@ sub update_config_file( $ ) {
|
||||
update_default( 'PAGER', $shorewallrc1{DEFAULT_PAGER} );
|
||||
update_default( 'LOGFORMAT', 'Shorewall:%s:%s:' );
|
||||
update_default( 'LOGLIMIT', '' );
|
||||
update_default( 'AUTOMAKE', 'No' );
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
update_default( 'BLACKLIST_DEFAULT', 'dropBcasts,dropNotSyn,dropInvalid' );
|
||||
@@ -5451,6 +5523,8 @@ sub update_config_file( $ ) {
|
||||
for ( qw/DROP_DEFAULT REJECT_DEFAULT BLACKLIST_DEFAULT/ ) {
|
||||
my $policy = $config{ $_ };
|
||||
|
||||
$policy = '' unless defined $policy;
|
||||
|
||||
if ( $policy =~ /\bA_(?:Drop|Reject)\b/ ) {
|
||||
if ( $family == F_IPV4 ) {
|
||||
$policy =~ s/A_(?:Drop|Reject)/Broadcast(A_DROP),Multicast(A_DROP)/;
|
||||
@@ -5593,8 +5667,8 @@ EOF
|
||||
#
|
||||
# Small functions called by get_configuration. We separate them so profiling is more useful
|
||||
#
|
||||
sub process_shorewall_conf( $ ) {
|
||||
my ( $annotate ) = @_;
|
||||
sub process_shorewall_conf( $$ ) {
|
||||
my ( $update, $annotate ) = @_;
|
||||
my $file = find_file "$product.conf";
|
||||
my @vars;
|
||||
|
||||
@@ -6175,7 +6249,7 @@ sub convert_to_version_5_2() {
|
||||
#
|
||||
sub get_configuration( $$$ ) {
|
||||
|
||||
( my $export, $update, my $annotate ) = @_;
|
||||
my ( $export, $update, $annotate ) = @_;
|
||||
|
||||
$globals{EXPORT} = $export;
|
||||
|
||||
@@ -6237,9 +6311,17 @@ sub get_configuration( $$$ ) {
|
||||
|
||||
get_params( $export );
|
||||
|
||||
process_shorewall_conf( $annotate );
|
||||
process_shorewall_conf( $update, $annotate );
|
||||
|
||||
ensure_config_path;
|
||||
#
|
||||
# To accomodate Cygwin-based compilation, we have separate directories for files whose names
|
||||
# clash on a case-insensitive filesystem.
|
||||
#
|
||||
push @config_path, $globals{SHAREDIR} . "/deprecated/" unless $config_path[-1] eq $globals{SHAREDIR} . "/deprecated/";
|
||||
push @config_path, $shorewallrc{SHAREDIR}. '/shorewall/deprecated/' unless $globals{PRODUCT} eq 'shorewall';
|
||||
|
||||
$config{CONFIG_PATH} = join( ':', @config_path );
|
||||
|
||||
@INC = @originalinc;
|
||||
|
||||
@@ -6553,6 +6635,9 @@ sub get_configuration( $$$ ) {
|
||||
fatal_error "DOCKER=Yes is not allowed in Shorewall6" if $family == F_IPV6;
|
||||
require_capability( 'IPTABLES_S', 'DOCKER=Yes', 's' );
|
||||
require_capability( 'ADDRTYPE', ' DOCKER=Yes', 's' );
|
||||
default( 'DOCKER_BRIDGE' , 'docker0' );
|
||||
} elsif ( $family == F_IPV6 ) {
|
||||
warning_message( "DOCKER_BRIDGE=$val ignored by shorewall6" ) if supplied( $val = $config{DOCKER_BRIDGE} );
|
||||
}
|
||||
|
||||
if ( supplied( $val = $config{RESTART} ) ) {
|
||||
@@ -6606,6 +6691,7 @@ sub get_configuration( $$$ ) {
|
||||
if ( supplied $config{ACCOUNTING_TABLE} ) {
|
||||
my $value = $config{ACCOUNTING_TABLE};
|
||||
fatal_error "Invalid ACCOUNTING_TABLE setting ($value)" unless $value eq 'filter' || $value eq 'mangle';
|
||||
fatal_error "ACCOUNTING_TABLE=mangle not allowed with MANGLE_ENABLED=No" if $value eq 'mangle' and ! $config{MANGLE_ENABLED};
|
||||
} else {
|
||||
$config{ACCOUNTING_TABLE} = 'filter';
|
||||
}
|
||||
@@ -6614,7 +6700,7 @@ sub get_configuration( $$$ ) {
|
||||
|
||||
if ( supplied( $val = $config{DYNAMIC_BLACKLIST} ) ) {
|
||||
if ( $val =~ /^ipset/ ) {
|
||||
my %simple_options = ( 'src-dst' => 1, 'disconnect' => 1 );
|
||||
my %simple_options = ( 'src-dst' => 1, 'disconnect' => 1, 'log' => 1, 'noupdate' => 1, );
|
||||
|
||||
my ( $key, $set, $level, $tag, $rest ) = split( ':', $val , 5 );
|
||||
|
||||
@@ -6681,7 +6767,7 @@ sub get_configuration( $$$ ) {
|
||||
|
||||
$config{IPSET} = '' if supplied $config{IPSET} && $config{IPSET} eq 'ipset';
|
||||
|
||||
require_capability 'MARK' , 'FORWARD_CLEAR_MARK=Yes', 's', if $config{FORWARD_CLEAR_MARK};
|
||||
require_mangle_capability 'MARK' , 'FORWARD_CLEAR_MARK=Yes', 's', if $config{FORWARD_CLEAR_MARK};
|
||||
|
||||
numeric_option 'TC_BITS' , 8, 0;
|
||||
numeric_option 'MASK_BITS' , 8, 0;
|
||||
@@ -6753,6 +6839,12 @@ sub get_configuration( $$$ ) {
|
||||
|
||||
require_capability 'AUDIT_TARGET', "SMURF_DISPOSITION=$val", 's' if $val =~ /^A_/;
|
||||
|
||||
if ( supplied( $val = $config{LOG_LEVEL} ) ) {
|
||||
validate_level( $val );
|
||||
} else {
|
||||
$config{LOG_LEVEL} = 'info';
|
||||
}
|
||||
|
||||
default_log_level 'BLACKLIST_LOG_LEVEL', '';
|
||||
default_log_level 'MACLIST_LOG_LEVEL', '';
|
||||
default_log_level 'TCP_FLAGS_LOG_LEVEL', '';
|
||||
@@ -6761,12 +6853,6 @@ sub get_configuration( $$$ ) {
|
||||
default_log_level 'INVALID_LOG_LEVEL', '';
|
||||
default_log_level 'UNTRACKED_LOG_LEVEL', '';
|
||||
|
||||
if ( supplied( $val = $config{LOG_LEVEL} ) ) {
|
||||
validate_level( $val );
|
||||
} else {
|
||||
$config{LOG_LEVEL} = 'info';
|
||||
}
|
||||
|
||||
if ( supplied( $val = $config{LOG_BACKEND} ) ) {
|
||||
if ( $family == F_IPV4 && $val eq 'ULOG' ) {
|
||||
$val = 'ipt_ULOG';
|
||||
@@ -6925,7 +7011,7 @@ sub get_configuration( $$$ ) {
|
||||
|
||||
if ( $config{TC_ENABLED} ) {
|
||||
fatal_error "TC_ENABLED=$config{TC_ENABLED} is not allowed with MANGLE_ENABLED=No" unless $config{MANGLE_ENABLED};
|
||||
require_capability 'MANGLE_ENABLED', "TC_ENABLED=$config{TC_ENABLED}", 's';
|
||||
require_mangle_capability 'MANGLE_ENABLED', "TC_ENABLED=$config{TC_ENABLED}", 's';
|
||||
}
|
||||
|
||||
if ( supplied( $val = $config{TC_PRIOMAP} ) ) {
|
||||
@@ -6942,9 +7028,7 @@ sub get_configuration( $$$ ) {
|
||||
}
|
||||
|
||||
default 'RESTOREFILE' , 'restore';
|
||||
|
||||
default 'DROP_DEFAULT' , 'none';
|
||||
|
||||
default 'REJECT_DEFAULT' , 'none';
|
||||
default 'BLACKLIST_DEFAULT' , 'none';
|
||||
default 'QUEUE_DEFAULT' , 'none';
|
||||
@@ -7008,9 +7092,9 @@ sub get_configuration( $$$ ) {
|
||||
}
|
||||
|
||||
require_capability( 'MULTIPORT' , "Shorewall $globals{VERSION}" , 's' );
|
||||
require_capability( 'RECENT_MATCH' , 'MACLIST_TTL' , 's' ) if $config{MACLIST_TTL};
|
||||
require_capability( 'XCONNMARK' , 'HIGH_ROUTE_MARKS=Yes' , 's' ) if $config{PROVIDER_OFFSET} > 0;
|
||||
require_capability( 'MANGLE_ENABLED' , 'Traffic Shaping' , 's' ) if $config{TC_ENABLED};
|
||||
require_capability( 'RECENT_MATCH' , 'MACLIST_TTL' , 's' ) if $config{MACLIST_TTL};
|
||||
require_capability( 'XCONNMARK' , 'HIGH_ROUTE_MARKS=Yes' , 's' ) if $config{PROVIDER_OFFSET} > 0;
|
||||
require_capability( 'MANGLE_ENABLED' , 'Traffic Shaping' , 's' ) if $config{TC_ENABLED};
|
||||
|
||||
if ( $config{WARNOLDCAPVERSION} ) {
|
||||
if ( $capabilities{CAPVERSION} ) {
|
||||
@@ -7141,8 +7225,8 @@ sub generate_aux_config() {
|
||||
|
||||
emit "#\n# Shorewall auxiliary configuration file created by Shorewall version $globals{VERSION} - $date\n#";
|
||||
|
||||
for my $option ( qw(VERBOSITY LOGFILE LOGFORMAT ARPTABLES IPTABLES IP6TABLES IP TC IPSET PATH SHOREWALL_SHELL SUBSYSLOCK LOCKFILE RESTOREFILE WORKAROUNDS RESTART DYNAMIC_BLACKLIST PAGER) ) {
|
||||
conditionally_add_option $option;
|
||||
for my $param ( @exported_params ) {
|
||||
conditionally_add_option $param;
|
||||
}
|
||||
|
||||
conditionally_add_option1 'TC_ENABLED';
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -34,6 +34,7 @@ use Shorewall::Zones;
|
||||
use Shorewall::Chains qw(:DEFAULT :internal);
|
||||
use Shorewall::Rules;
|
||||
use Shorewall::Proc;
|
||||
use sort 'stable';
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -97,7 +98,7 @@ sub setup_ecn()
|
||||
if ( my $fn = open_file 'ecn' ) {
|
||||
|
||||
first_entry( sub { progress_message2 "$doing $fn...";
|
||||
require_capability 'MANGLE_ENABLED', 'Entries in the ecn file', '';
|
||||
require_mangle_capability 'MANGLE_ENABLED', 'Entries in the ecn file', '';
|
||||
warning_message 'ECN will not be applied to forwarded packets' unless have_capability 'MANGLE_FORWARD';
|
||||
} );
|
||||
|
||||
@@ -130,7 +131,7 @@ sub setup_ecn()
|
||||
}
|
||||
|
||||
if ( @hosts ) {
|
||||
my @interfaces = ( keys %interfaces );
|
||||
my @interfaces = ( sortkeysiftest %interfaces );
|
||||
|
||||
progress_message "$doing ECN control on @interfaces...";
|
||||
|
||||
@@ -335,7 +336,7 @@ sub convert_blacklist() {
|
||||
#
|
||||
# For information about entries in this file, type "man shorewall-blrules"
|
||||
#
|
||||
# Please see http://shorewall.net/blacklisting_support.htm for additional
|
||||
# Please see https://shorewall.org/blacklisting_support.htm for additional
|
||||
# information.
|
||||
#
|
||||
###################################################################################################################################################################################################
|
||||
@@ -434,9 +435,9 @@ sub convert_routestopped() {
|
||||
# For information about entries in this file, type "man shorewall-stoppedrules"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# http://www.shorewall.net/manpages/shorewall-stoppedrules.html
|
||||
# https://shorewall.org/manpages/shorewall-stoppedrules.html
|
||||
#
|
||||
# See http://shorewall.net/starting_and_stopping_shorewall.htm for additional
|
||||
# See https://shorewall.org/starting_and_stopping_shorewall.htm for additional
|
||||
# information.
|
||||
#
|
||||
###############################################################################
|
||||
@@ -675,30 +676,24 @@ sub process_stoppedrules() {
|
||||
# Generate the rules required when DOCKER=Yes
|
||||
#
|
||||
sub create_docker_rules() {
|
||||
my $bridge = $config{DOCKER_BRIDGE};
|
||||
|
||||
add_commands( $nat_table->{PREROUTING} , '[ -n "$g_docker" ] && echo "-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER" >&3' );
|
||||
|
||||
my $chainref = $filter_table->{FORWARD};
|
||||
|
||||
add_commands( $chainref, '[ -n "$g_dockeringress" ] && echo "-A FORWARD -j DOCKER-INGRESS" >&3', );
|
||||
add_commands( $chainref, '[ -n "$g_dockeruser" ] && echo "-A FORWARD -j DOCKER-USER" >&3', );
|
||||
add_commands( $chainref ,
|
||||
'',
|
||||
'case "$g_dockernetwork" in',
|
||||
' One)',
|
||||
' echo "-A FORWARD -j DOCKER-ISOLATION" >&3',
|
||||
' ;;',
|
||||
' Two)',
|
||||
' echo "-A FORWARD -j DOCKER-ISOLATION-STAGE-1" >&3',
|
||||
' ;;',
|
||||
'esac' );
|
||||
add_commands( $chainref, '[ -n "$g_dockeringress" ] && echo "-A FORWARD -j DOCKER-INGRESS" >&3' );
|
||||
add_commands( $chainref, '[ -n "$g_dockeruser" ] && echo "-A FORWARD -j DOCKER-USER" >&3' );
|
||||
add_commands( $chainref, '[ -n "$g_dockeriso" ] && echo "-A FORWARD -j DOCKER-ISOLATION" >&3' );
|
||||
add_commands( $chainref, '[ -n "$g_dockerisostage" ] && echo "-A FORWARD -j DOCKER-ISOLATION-STAGE-1" >&3' );
|
||||
|
||||
if ( my $dockerref = known_interface('docker0') ) {
|
||||
if ( my $dockerref = known_interface( $bridge ) ) {
|
||||
add_commands( $chainref, 'if [ -n "$g_docker" ]; then' );
|
||||
incr_cmd_level( $chainref );
|
||||
add_ijump( $chainref, j => 'DOCKER', o => 'docker0' );
|
||||
add_ijump( $chainref, j => 'ACCEPT', o => 'docker0', state_imatch 'ESTABLISHED,RELATED' );
|
||||
add_ijump( $chainref, j => 'ACCEPT', i => 'docker0', o => '! docker0' );
|
||||
add_ijump( $chainref, j => 'ACCEPT', i => 'docker0', o => 'docker0' ) if $dockerref->{options}{routeback};
|
||||
add_ijump( $chainref, j => 'DOCKER', o => $bridge );
|
||||
add_ijump( $chainref, j => 'ACCEPT', o => $bridge , state_imatch 'ESTABLISHED,RELATED' );
|
||||
add_ijump( $chainref, j => 'ACCEPT', i => $bridge , o => "! $bridge" );
|
||||
add_ijump( $chainref, j => 'ACCEPT', i => $bridge , o => $bridge ) if $dockerref->{options}{routeback};
|
||||
decr_cmd_level( $chainref );
|
||||
add_commands( $chainref, 'fi' );
|
||||
|
||||
@@ -740,6 +735,7 @@ sub add_common_rules ( $ ) {
|
||||
my $dbl_tag;
|
||||
my $dbl_src_target;
|
||||
my $dbl_dst_target;
|
||||
my $dbl_options;
|
||||
|
||||
if ( $config{REJECT_ACTION} ) {
|
||||
process_reject_action;
|
||||
@@ -801,9 +797,10 @@ sub add_common_rules ( $ ) {
|
||||
|
||||
if ( $dbl_ipset ) {
|
||||
if ( $val = $globals{DBL_TIMEOUT} ) {
|
||||
$dbl_src_target = $globals{DBL_OPTIONS} =~ /src-dst/ ? 'dbl_src' : 'dbl_log';
|
||||
$dbl_options = $globals{DBL_OPTIONS};
|
||||
$dbl_src_target = $dbl_options =~ /src-dst/ ? 'dbl_src' : 'dbl_log';
|
||||
|
||||
my $chainref = set_optflags( new_standard_chain( $dbl_src_target ) , DONT_OPTIMIZE | DONT_DELETE );
|
||||
my $chainref = new_standard_chain( $dbl_src_target );
|
||||
|
||||
log_rule_limit( $dbl_level,
|
||||
$chainref,
|
||||
@@ -814,11 +811,11 @@ sub add_common_rules ( $ ) {
|
||||
'add',
|
||||
'',
|
||||
$origin{DYNAMIC_BLACKLIST} ) if $dbl_level;
|
||||
add_ijump_extended( $chainref, j => "SET --add-set $dbl_ipset src --exist --timeout $val", $origin{DYNAMIC_BLACKLIST} );
|
||||
add_ijump_extended( $chainref, j => "SET --add-set $dbl_ipset src --exist --timeout $val", $origin{DYNAMIC_BLACKLIST} ) unless $dbl_options =~ /noupdate/;
|
||||
add_ijump_extended( $chainref, j => 'DROP', $origin{DYNAMIC_BLACKLIST} );
|
||||
|
||||
if ( $dbl_src_target eq 'dbl_src' ) {
|
||||
$chainref = set_optflags( new_standard_chain( $dbl_dst_target = 'dbl_dst' ) , DONT_OPTIMIZE | DONT_DELETE );
|
||||
$chainref = new_standard_chain( $dbl_dst_target = 'dbl_dst' );
|
||||
|
||||
log_rule_limit( $dbl_level,
|
||||
$chainref,
|
||||
@@ -835,7 +832,7 @@ sub add_common_rules ( $ ) {
|
||||
$dbl_dst_target = $dbl_src_target;
|
||||
}
|
||||
} elsif ( $dbl_level ) {
|
||||
my $chainref = set_optflags( new_standard_chain( $dbl_src_target = $dbl_dst_target = 'dbl_log' ) , DONT_OPTIMIZE | DONT_DELETE );
|
||||
my $chainref = new_standard_chain( $dbl_src_target = $dbl_dst_target = 'dbl_log' );
|
||||
|
||||
log_rule_limit( $dbl_level,
|
||||
$chainref,
|
||||
@@ -1328,7 +1325,7 @@ sub setup_mac_lists( $ ) {
|
||||
$maclist_interfaces{ $hostref->[0] } = 1;
|
||||
}
|
||||
|
||||
my @maclist_interfaces = ( keys %maclist_interfaces );
|
||||
my @maclist_interfaces = ( sortkeysiftest %maclist_interfaces );
|
||||
|
||||
if ( $phase == 1 ) {
|
||||
|
||||
@@ -1414,7 +1411,7 @@ sub setup_mac_lists( $ ) {
|
||||
#
|
||||
# Generate jumps from the input and forward chains
|
||||
#
|
||||
for my $hostref ( @$maclist_hosts ) {
|
||||
for my $hostref ( $test ? sort { $a->[0] cmp $b->[0] } @$maclist_hosts : @$maclist_hosts ) {
|
||||
my $interface = $hostref->[0];
|
||||
my $ipsec = $hostref->[1];
|
||||
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
||||
@@ -1807,7 +1804,7 @@ sub handle_complex_zone( $$ ) {
|
||||
my $type = $zoneref->{type};
|
||||
my $source_ref = ( $zoneref->{hosts}{ipsec} ) || {};
|
||||
|
||||
for my $interface ( keys %$source_ref ) {
|
||||
for my $interface ( sortkeysiftest %$source_ref ) {
|
||||
my $sourcechainref = $filter_table->{forward_chain $interface};
|
||||
my @interfacematch;
|
||||
my $interfaceref = find_interface $interface;
|
||||
@@ -1947,7 +1944,7 @@ sub add_output_jumps( $$$$$$$$ ) {
|
||||
my $use_output = 0;
|
||||
my @dest = imatch_dest_net $net;
|
||||
my @ipsec_out_match = match_ipsec_out $zone , $hostref;
|
||||
my @zone_interfaces = keys %{zone_interfaces( $zone )};
|
||||
my @zone_interfaces = sortkeysiftest %{zone_interfaces( $zone )};
|
||||
|
||||
if ( @vservers || use_interface_chain( $interface, 'use_output_chain' ) || ( @{$interfacechainref->{rules}} && ! $chain1ref ) || @zone_interfaces > 1 ) {
|
||||
#
|
||||
@@ -2291,10 +2288,13 @@ sub generate_matrix() {
|
||||
#
|
||||
for my $zone ( @zones ) {
|
||||
my $zoneref = find_zone( $zone );
|
||||
if ( @zones > 2 || $zoneref->{complex} ) {
|
||||
handle_complex_zone( $zone, $zoneref );
|
||||
} else {
|
||||
new_standard_chain zone_forward_chain( $zone ) if @zones > 1;
|
||||
|
||||
unless ( $zoneref->{type} == LOCAL ) {
|
||||
if ( @zones > 2 || $zoneref->{complex} ) {
|
||||
handle_complex_zone( $zone, $zoneref );
|
||||
} else {
|
||||
new_standard_chain zone_forward_chain( $zone ) if @zones > 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
@@ -2319,9 +2319,9 @@ sub generate_matrix() {
|
||||
#
|
||||
# Take care of PREROUTING, INPUT and OUTPUT jumps
|
||||
#
|
||||
for my $type ( keys %$source_hosts_ref ) {
|
||||
for my $type ( sortkeysiftest %$source_hosts_ref ) {
|
||||
my $typeref = $source_hosts_ref->{$type};
|
||||
for my $interface ( keys %$typeref ) {
|
||||
for my $interface ( sortkeysiftest %$typeref ) {
|
||||
if ( get_physical( $interface ) eq '+' ) {
|
||||
#
|
||||
# Insert the interface-specific jumps before this one which is not interface-specific
|
||||
@@ -2406,9 +2406,9 @@ sub generate_matrix() {
|
||||
|
||||
my $chainref = $filter_table->{$chain}; #Will be null if $chain is a Netfilter Built-in target like ACCEPT
|
||||
|
||||
for my $type ( keys %{$zone1ref->{hosts}} ) {
|
||||
for my $type ( sortkeysiftest %{$zone1ref->{hosts}} ) {
|
||||
my $typeref = $zone1ref->{hosts}{$type};
|
||||
for my $interface ( keys %$typeref ) {
|
||||
for my $interface ( sortkeysiftest %$typeref ) {
|
||||
for my $hostref ( @{$typeref->{$interface}} ) {
|
||||
next if $hostref->{options}{sourceonly};
|
||||
if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) {
|
||||
@@ -2540,6 +2540,7 @@ sub compile_stop_firewall( $$$$ ) {
|
||||
my $input = $filter_table->{INPUT};
|
||||
my $output = $filter_table->{OUTPUT};
|
||||
my $forward = $filter_table->{FORWARD};
|
||||
my $absentminded = $config{ ADMINISABSENTMINDED };
|
||||
|
||||
emit <<'EOF';
|
||||
#
|
||||
@@ -2547,7 +2548,7 @@ sub compile_stop_firewall( $$$$ ) {
|
||||
#
|
||||
stop_firewall() {
|
||||
EOF
|
||||
$output->{policy} = 'ACCEPT' if $config{ADMINISABSENTMINDED};
|
||||
$output->{policy} = 'ACCEPT' if $absentminded;
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
emit <<'EOF';
|
||||
@@ -2584,13 +2585,13 @@ EOF
|
||||
emit <<'EOF';
|
||||
case $COMMAND in
|
||||
start)
|
||||
mylogger kern.err "ERROR:$g_product start failed"
|
||||
mylogger daemon.err "ERROR:$g_product start failed"
|
||||
;;
|
||||
reload)
|
||||
mylogger kern.err "ERROR:$g_product reload failed"
|
||||
mylogger daemon.err "ERROR:$g_product reload failed"
|
||||
;;
|
||||
enable)
|
||||
mylogger kern.err "ERROR:$g_product 'enable $g_interface' failed"
|
||||
mylogger daemon.err "ERROR:$g_product 'enable $g_interface' failed"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -2706,7 +2707,7 @@ EOF
|
||||
#
|
||||
create_docker_rules if $config{DOCKER};
|
||||
|
||||
if ( $config{ADMINISABSENTMINDED} ) {
|
||||
if ( $absentminded ) {
|
||||
add_ijump $filter_table ->{$_}, j => 'ACCEPT', state_imatch 'ESTABLISHED,RELATED' for qw/INPUT FORWARD/;
|
||||
}
|
||||
|
||||
@@ -2715,7 +2716,7 @@ EOF
|
||||
add_ijump $input, j => 'ACCEPT', d => IPv6_LINKLOCAL;
|
||||
add_ijump $input, j => 'ACCEPT', d => IPv6_MULTICAST;
|
||||
|
||||
unless ( $config{ADMINISABSENTMINDED} ) {
|
||||
unless ( $absentminded ) {
|
||||
add_ijump $output, j => 'ACCEPT', d => IPv6_LINKLOCAL;
|
||||
add_ijump $output, j => 'ACCEPT', d => IPv6_MULTICAST;
|
||||
}
|
||||
@@ -2729,12 +2730,25 @@ EOF
|
||||
|
||||
process_stoppedrules;
|
||||
|
||||
if ( $family == F_IPV6 ) {
|
||||
my $chain = new_action_chain( 'filter', 'AllowICMPs' );
|
||||
|
||||
for my $type ( 1, 2, 3, 4, 130, 131, 132, 133, 134, 135, 136, 137, 141, 142, 143, 148, 149, 151, 152, 153 ) {
|
||||
add_ijump( $chain, j => 'ACCEPT', p => IPv6_ICMP . " --icmpv6-type $type" );
|
||||
}
|
||||
|
||||
for $chain ( $input, $output, $forward ) {
|
||||
next if $chain eq $output && $absentminded;
|
||||
add_ijump( $chain, j => 'AllowICMPs', p => IPv6_ICMP );
|
||||
}
|
||||
}
|
||||
|
||||
if ( have_capability 'IFACE_MATCH' ) {
|
||||
add_ijump $input, j => 'ACCEPT', iface => '--dev-in --loopback';
|
||||
add_ijump $output, j => 'ACCEPT', iface => '--dev-out --loopback' unless $config{ADMINISABSENTMINDED};
|
||||
add_ijump $output, j => 'ACCEPT', iface => '--dev-out --loopback' unless $absentminded;
|
||||
} else {
|
||||
add_ijump $input, j => 'ACCEPT', i => loopback_interface;
|
||||
add_ijump $output, j => 'ACCEPT', o => loopback_interface unless $config{ADMINISABSENTMINDED};
|
||||
add_ijump $output, j => 'ACCEPT', o => loopback_interface unless $absentminded;
|
||||
}
|
||||
|
||||
my $interfaces = find_interfaces_by_option 'dhcp';
|
||||
@@ -2744,7 +2758,7 @@ EOF
|
||||
|
||||
for my $interface ( @$interfaces ) {
|
||||
add_ijump $input, j => 'ACCEPT', p => "udp --dport $ports", imatch_source_dev( $interface );
|
||||
add_ijump $output, j => 'ACCEPT', p => "udp --dport $ports", imatch_dest_dev( $interface ) unless $config{ADMINISABSENTMINDED};
|
||||
add_ijump $output, j => 'ACCEPT', p => "udp --dport $ports", imatch_dest_dev( $interface ) unless $absentminded;
|
||||
#
|
||||
# This might be a bridge
|
||||
#
|
||||
@@ -2800,7 +2814,7 @@ EOF
|
||||
emit '
|
||||
|
||||
set_state "Stopped"
|
||||
mylogger kern.info "$g_product Stopped"
|
||||
mylogger daemon.info "$g_product Stopped"
|
||||
|
||||
case $COMMAND in
|
||||
stop|clear)
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -316,9 +316,9 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
||||
fatal_error "Invalid IPv6 Address ($addr)" unless $addr =~ /^\[(.+)\]$/;
|
||||
|
||||
$addr = $1;
|
||||
$addr =~ s/\]-\[/-/;
|
||||
|
||||
if ( $addr =~ /^(.+)-(.+)$/ ) {
|
||||
fatal_error "Correct address range syntax is '[<addr1>-<addr2>]'" if $addr =~ /]-\[/;
|
||||
validate_range( $1, $2 );
|
||||
} else {
|
||||
validate_address $addr, 0;
|
||||
@@ -561,7 +561,7 @@ sub open_snat_for_output( $ ) {
|
||||
#
|
||||
# For information about entries in this file, type "man shorewall-snat"
|
||||
#
|
||||
# See http://shorewall.net/manpages/shorewall-snat.html for additional information
|
||||
# See https://shorewall.org/manpages/shorewall-snat.html for additional information
|
||||
EOF
|
||||
} else {
|
||||
print $snat <<'EOF';
|
||||
@@ -570,7 +570,7 @@ EOF
|
||||
#
|
||||
# For information about entries in this file, type "man shorewall6-snat"
|
||||
#
|
||||
# See http://shorewall.net/manpages6/shorewall6-snat.html for additional information
|
||||
# See https://shorewall.org/manpages/shorewall-snat.html for additional information
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -930,7 +930,7 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
|
||||
|
||||
if ( $server =~ /^\[(.+)\]$/ ) {
|
||||
$server = $1;
|
||||
fatal_error "Correct address range syntax is '[<addr1>-<addr2>]'" if $server =~ /]-\[/;
|
||||
$server =~ s/\]-\[/-/;
|
||||
assert( $server =~ /^(.+)-(.+)$/ );
|
||||
( $addr1, $addr2 ) = ( $1, $2 );
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -594,7 +594,7 @@ sub process_a_provider( $ ) {
|
||||
unless ( $options eq '-' ) {
|
||||
for my $option ( split_list $options, 'option' ) {
|
||||
if ( $option eq 'track' ) {
|
||||
require_capability( 'MANGLE_ENABLED' , q(The 'track' option) , 's' );
|
||||
require_mangle_capability( 'MANGLE_ENABLED' , q(The 'track' option) , 's' );
|
||||
$track = 1;
|
||||
} elsif ( $option eq 'notrack' ) {
|
||||
$track = 0;
|
||||
@@ -714,7 +714,7 @@ sub process_a_provider( $ ) {
|
||||
$mark = ( $lastmark += ( 1 << $config{PROVIDER_OFFSET} ) ) if $mark eq '-' && $track;
|
||||
|
||||
if ( $mark ne '-' ) {
|
||||
require_capability( 'MANGLE_ENABLED' , 'Provider marks' , '' );
|
||||
require_mangle_capability( 'MANGLE_ENABLED' , 'Provider marks' , '' );
|
||||
|
||||
if ( $tproxy && ! $local ) {
|
||||
$val = $globals{TPROXY_MARK};
|
||||
@@ -1180,14 +1180,14 @@ CEOF
|
||||
emit "fi\n";
|
||||
|
||||
if ( get_interface_option( $interface, 'used_address_variable' ) ) {
|
||||
my $variable = interface_address( $interface );
|
||||
my $variable = get_interface_address( $interface );
|
||||
|
||||
emit( "echo \$$variable > \${VARDIR}/${physical}.address" );
|
||||
emit( "echo $variable > \${VARDIR}/${physical}.address" );
|
||||
}
|
||||
|
||||
if ( get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
||||
my $variable = interface_gateway( $interface );
|
||||
emit( qq(echo "\$$variable" > \${VARDIR}/${physical}.gateway\n) );
|
||||
my $variable = get_interface_gateway( $interface );
|
||||
emit( qq(echo "$variable" > \${VARDIR}/${physical}.gateway\n) );
|
||||
}
|
||||
} else {
|
||||
emit( qq(progress_message "Provider $table ($number) Started") );
|
||||
@@ -1892,8 +1892,8 @@ sub map_provider_to_interface() {
|
||||
|
||||
my $haveoptional;
|
||||
|
||||
for my $providerref ( values %providers ) {
|
||||
if ( $providerref->{optional} ) {
|
||||
for my $provider ( @providers ) {
|
||||
if ( ( my $providerref=$providers{$provider} )->{optional} ) {
|
||||
unless ( $haveoptional++ ) {
|
||||
emit( 'if [ -n "$interface" ]; then',
|
||||
' case $interface in' );
|
||||
@@ -2054,8 +2054,7 @@ sub compile_updown() {
|
||||
);
|
||||
}
|
||||
|
||||
my @nonshared = ( grep $providers{$_}->{optional},
|
||||
values %provider_interfaces );
|
||||
my @nonshared = ( grep $providers{$_}->{optional}, sortvaluesiftest %provider_interfaces );
|
||||
|
||||
if ( @nonshared ) {
|
||||
my $interfaces = join( '|', map $providers{$_}->{physical}, @nonshared );
|
||||
@@ -2065,12 +2064,12 @@ sub compile_updown() {
|
||||
push_indent;
|
||||
|
||||
emit( q(if [ "$state" = started ]; then) ,
|
||||
q( if [ "$COMMAND" = up ]; then) ,
|
||||
q( if [ "$COMMAND" = up ]; then) ,
|
||||
q( progress_message3 "Attempting enable on interface $1") ,
|
||||
q( COMMAND=enable) ,
|
||||
q( detect_configuration $1),
|
||||
q( enable_provider $1),
|
||||
q( elif [ "$PHASE" != post-down ]; then # pre-down or not Debian) ,
|
||||
q( else),
|
||||
q( progress_message3 "Attempting disable on interface $1") ,
|
||||
q( COMMAND=disable) ,
|
||||
q( detect_configuration $1),
|
||||
@@ -2111,7 +2110,7 @@ sub compile_updown() {
|
||||
emit( ' progress_message3 "$g_product attempting $COMMAND"',
|
||||
' detect_configuration',
|
||||
' define_firewall',
|
||||
' elif [ "$PHASE" != pre-down ]; then # Not Debian pre-down phase'
|
||||
' else' ,
|
||||
);
|
||||
|
||||
push_indent;
|
||||
@@ -2246,9 +2245,11 @@ sub handle_optional_interfaces() {
|
||||
# names but they might derive from wildcard interface entries. Optional interfaces which do not have
|
||||
# wildcard physical names are also included in the providers table.
|
||||
#
|
||||
for my $providerref ( grep $_->{optional} , values %providers ) {
|
||||
push @interfaces, $providerref->{interface};
|
||||
$wildcards ||= $providerref->{wildcard};
|
||||
for my $provider ( @providers ) {
|
||||
if ( ( my $providerref = $providers{$provider} )->{optional} ) {
|
||||
push @interfaces, $providerref->{interface};
|
||||
$wildcards ||= $providerref->{wildcard};
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
@@ -2296,17 +2297,7 @@ sub handle_optional_interfaces() {
|
||||
|
||||
emit( "$physical)" ), push_indent if $wildcards;
|
||||
|
||||
if ( $provider eq $physical ) {
|
||||
#
|
||||
# Just an optional interface, or provider and interface are the same
|
||||
#
|
||||
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
||||
} else {
|
||||
#
|
||||
# Provider
|
||||
#
|
||||
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
||||
}
|
||||
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
||||
|
||||
push_indent;
|
||||
|
||||
@@ -2323,22 +2314,22 @@ sub handle_optional_interfaces() {
|
||||
emit( 'fi' );
|
||||
|
||||
if ( get_interface_option( $interface, 'used_address_variable' ) ) {
|
||||
my $variable = interface_address( $interface );
|
||||
my $variable = get_interface_address( $interface );
|
||||
|
||||
emit( '',
|
||||
"if [ -f \${VARDIR}/${physical}.address ]; then",
|
||||
" if [ \$(cat \${VARDIR}/${physical}.address) != \$$variable ]; then",
|
||||
" if [ \$(cat \${VARDIR}/${physical}.address) != $variable ]; then",
|
||||
' g_forcereload=Yes',
|
||||
' fi',
|
||||
'fi' );
|
||||
}
|
||||
|
||||
if ( get_interface_option( $interface, 'used_gateway_variable' ) ) {
|
||||
my $variable = interface_gateway( $interface );
|
||||
my $variable = get_interface_gateway( $interface );
|
||||
|
||||
emit( '',
|
||||
"if [ -f \${VARDIR}/${physical}.gateway ]; then",
|
||||
" if [ \$(cat \${VARDIR}/${physical}.gateway) != \"\$$variable\" ]; then",
|
||||
" if [ \$(cat \${VARDIR}/${physical}.gateway) != \"$variable\" ]; then",
|
||||
' g_forcereload=Yes',
|
||||
' fi',
|
||||
'fi' );
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -155,7 +155,7 @@ sub setup_proxy_arp() {
|
||||
|
||||
emit '';
|
||||
|
||||
for my $interface ( keys %reset ) {
|
||||
for my $interface ( sortkeysiftest %reset ) {
|
||||
unless ( $set{interface} ) {
|
||||
my $physical = get_physical $interface;
|
||||
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
|
||||
@@ -164,7 +164,7 @@ sub setup_proxy_arp() {
|
||||
}
|
||||
}
|
||||
|
||||
for my $interface ( keys %set ) {
|
||||
for my $interface ( sortkeysiftest %set ) {
|
||||
my $physical = get_physical $interface;
|
||||
emit ( "if [ -f /proc/sys/net/ipv$family/conf/$physical/$proc_file ]; then" ,
|
||||
" echo 1 > /proc/sys/net/ipv$family/conf/$physical/$proc_file" );
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2009-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -443,6 +443,7 @@ sub convert_to_policy_chain($$$$$$)
|
||||
my ($chainref, $source, $dest, $policy, $provisional, $audit ) = @_;
|
||||
|
||||
$chainref->{is_policy} = 1;
|
||||
$chainref->{wild} = $source eq 'all' || $dest eq 'all';
|
||||
$chainref->{policy} = $policy;
|
||||
$chainref->{provisional} = $provisional;
|
||||
$chainref->{audit} = $audit;
|
||||
@@ -611,8 +612,8 @@ sub process_policy_actions( $$$ ) {
|
||||
#
|
||||
# Verify an NFQUEUE specification and return the appropriate ip[6]tables target
|
||||
#
|
||||
sub handle_nfqueue( $$ ) {
|
||||
my ($params, $allow_bypass ) = @_;
|
||||
sub handle_nfqueue( $ ) {
|
||||
my ($params) = @_;
|
||||
my ( $action, $bypass, $fanout );
|
||||
my ( $queue1, $queue2, $queuenum1, $queuenum2 );
|
||||
|
||||
@@ -625,7 +626,6 @@ sub handle_nfqueue( $$ ) {
|
||||
|
||||
if ( supplied $queue ) {
|
||||
if ( $queue eq 'bypass' ) {
|
||||
fatal_error "'bypass' is not allowed in this context" unless $allow_bypass;
|
||||
fatal_error "Invalid NFQUEUE options (bypass,$bypass)" if supplied $bypass;
|
||||
return 'NFQUEUE --queue-bypass';
|
||||
}
|
||||
@@ -653,7 +653,6 @@ sub handle_nfqueue( $$ ) {
|
||||
|
||||
if ( supplied $bypass ) {
|
||||
fatal_error "Invalid NFQUEUE option ($bypass)" if $bypass ne 'bypass';
|
||||
fatal_error "'bypass' is not allowed in this context" unless $allow_bypass;
|
||||
|
||||
$bypass =' --queue-bypass';
|
||||
} else {
|
||||
@@ -662,7 +661,7 @@ sub handle_nfqueue( $$ ) {
|
||||
|
||||
if ( supplied $queue2 ) {
|
||||
require_capability 'CPU_FANOUT', '"c"', 's' if $fanout;
|
||||
return "NFQUEUE --queue-balance ${queuenum1}:${queuenum2}${fanout}${bypass}";
|
||||
return "NFQUEUE --queue-balance ${queuenum1}:${queuenum2}${bypass}${fanout}";
|
||||
} else {
|
||||
return "NFQUEUE --queue-num ${queuenum1}${bypass}";
|
||||
}
|
||||
@@ -721,7 +720,13 @@ sub process_a_policy1($$$$$$$) {
|
||||
|
||||
require_capability 'AUDIT_TARGET', ":audit", "s" if $audit;
|
||||
|
||||
my ( $policy, $pactions ) = split( /:/, $originalpolicy, 2 );
|
||||
my ( $policy, $pactions );
|
||||
|
||||
if ( $originalpolicy =~ /^NFQUEUE\((.*?)\)(?::?(.*))/ ) {
|
||||
( $policy, $pactions ) = ( "NFQUEUE($1)", $2 );
|
||||
} else {
|
||||
( $policy, $pactions ) = split( /:/, $originalpolicy, 2 );
|
||||
}
|
||||
|
||||
fatal_error "Invalid or missing POLICY ($originalpolicy)" unless $policy;
|
||||
|
||||
@@ -736,9 +741,7 @@ sub process_a_policy1($$$$$$$) {
|
||||
my $pactionref = process_policy_actions( $originalpolicy, $policy, $pactions );
|
||||
|
||||
if ( defined $queue ) {
|
||||
$policy = handle_nfqueue( $queue,
|
||||
0 # Don't allow 'bypass'
|
||||
);
|
||||
$policy = handle_nfqueue( $queue );
|
||||
} elsif ( $policy eq 'NONE' ) {
|
||||
fatal_error "NONE policy not allowed with \"all\""
|
||||
if $clientwild || $serverwild;
|
||||
@@ -998,6 +1001,24 @@ sub determine_action_protocol( $$ ) {
|
||||
$proto;
|
||||
}
|
||||
|
||||
sub determine_action_dport( $$$ ) {
|
||||
my ( $action, $proto, $dport ) = @_;
|
||||
|
||||
if ( my $actiondport = $actions{$action}{dport} ) {
|
||||
if ( $dport eq '-' ) {
|
||||
$dport = $actiondport;
|
||||
} else {
|
||||
fatal_error( "The $action action is only usable with destination port $actiondport" ) if $dport =~ /[,]/;
|
||||
if ( ( my $portnum = validate_port( $proto, $dport ) ) ne '-' ) {
|
||||
fatal_error( "The $action action is only usable with destination port $actiondport" ) unless $actiondport = $portnum;
|
||||
$dport = $portnum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dport;
|
||||
}
|
||||
|
||||
sub add_policy_rules( $$$$$ ) {
|
||||
my ( $chainref , $target, $loglevel, $pactions, $dropmulticast ) = @_;
|
||||
|
||||
@@ -1012,7 +1033,11 @@ sub add_policy_rules( $$$$$ ) {
|
||||
# Policy action is a regular action -- jump to the action chain
|
||||
#
|
||||
if ( ( my $proto = determine_action_protocol( $action, '-' ) ) ne '-' ) {
|
||||
add_ijump( $chainref, j => use_policy_action( $paction, $chainref->{name} ), p => $proto );
|
||||
if ( my $dport = determine_action_dport( $action, $proto, '' ) ) {
|
||||
add_ijump( $chainref, j => use_policy_action( $paction, $chainref->{name} ), p => $proto, dport => $dport );
|
||||
} else {
|
||||
add_ijump( $chainref, j => use_policy_action( $paction, $chainref->{name} ), p => $proto );
|
||||
}
|
||||
} else {
|
||||
add_ijump $chainref, j => use_policy_action( $paction, $chainref->{name} );
|
||||
}
|
||||
@@ -1145,7 +1170,7 @@ sub complete_policy_chains() {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $name =~ /^all[-2]|[-2]all$/ ) {
|
||||
if ( $chainref->{wild} ) {
|
||||
add_policy_rules $chainref , $policy, $loglevel , $defaults, $config{MULTICAST};
|
||||
}
|
||||
}
|
||||
@@ -1250,6 +1275,7 @@ sub finish_chain_section ($$$) {
|
||||
$state ) = @_;
|
||||
my $chain = $chainref->{name};
|
||||
my $save_comment = push_comment;
|
||||
my $wild = $chainref->{wild} && ! $config{EXPAND_RULES};
|
||||
my %state;
|
||||
|
||||
$state{$_} = 1 for split ',', $state;
|
||||
@@ -1260,74 +1286,76 @@ sub finish_chain_section ($$$) {
|
||||
|
||||
$chain1ref->{sections}{$_} = 1 for keys %state;
|
||||
|
||||
for ( qw( ESTABLISHED RELATED INVALID UNTRACKED ) ) {
|
||||
if ( $state{$_} ) {
|
||||
my ( $char, $level, $tag, $target , $origin, $level_origin ) = @{$statetable{$_}};
|
||||
my $twochains = substr( $chainref->{name}, 0, 1 ) eq $char;
|
||||
unless ( $wild ) {
|
||||
for ( qw( ESTABLISHED RELATED INVALID UNTRACKED ) ) {
|
||||
if ( $state{$_} ) {
|
||||
my ( $char, $level, $tag, $target , $origin, $level_origin ) = @{$statetable{$_}};
|
||||
my $twochains = substr( $chainref->{name}, 0, 1 ) eq $char;
|
||||
|
||||
if ( $twochains || $level || $target ne 'ACCEPT' ) {
|
||||
if ( $level ) {
|
||||
my $chain2ref;
|
||||
if ( $twochains || $level || $target ne 'ACCEPT' ) {
|
||||
if ( $level ) {
|
||||
my $chain2ref;
|
||||
|
||||
if ( $twochains ) {
|
||||
$chain2ref = $chainref;
|
||||
} else {
|
||||
$chain2ref = new_chain( 'filter', "${char}$chainref->{name}" , "${char}$chainref->{logname}" );
|
||||
}
|
||||
|
||||
log_rule_limit( $level,
|
||||
$chain2ref,
|
||||
$chain2ref->{logname},
|
||||
uc $target,
|
||||
$globals{LOGLIMIT},
|
||||
$tag ,
|
||||
'add' ,
|
||||
'',
|
||||
$level_origin );
|
||||
|
||||
$target = ensure_audit_chain( $target ) if ( $targets{$target} || 0 ) & AUDIT;
|
||||
|
||||
add_ijump_extended( $chain2ref, g => $target , $origin ) if $target;
|
||||
|
||||
$target = $chain2ref->{name} unless $twochains;
|
||||
}
|
||||
|
||||
if ( $twochains ) {
|
||||
$chain2ref = $chainref;
|
||||
} else {
|
||||
$chain2ref = new_chain( 'filter', "${char}$chainref->{name}" , "${char}$chainref->{logname}" );
|
||||
add_ijump_extended $chainref, g => $target , $origin if $target;
|
||||
delete $state{$_};
|
||||
last;
|
||||
}
|
||||
|
||||
log_rule_limit( $level,
|
||||
$chain2ref,
|
||||
$chain2ref->{logname},
|
||||
uc $target,
|
||||
$globals{LOGLIMIT},
|
||||
$tag ,
|
||||
'add' ,
|
||||
'',
|
||||
$level_origin );
|
||||
if ( $target ) {
|
||||
$target = ensure_audit_chain( $target ) if ( $targets{$target} || 0 ) & AUDIT;
|
||||
#
|
||||
# Always handle ESTABLISHED first
|
||||
#
|
||||
if ( $state{ESTABLISHED} && $_ ne 'ESTABLISHED' ) {
|
||||
add_ijump( $chain1ref, j => 'ACCEPT', state_imatch 'ESTABLISHED' );
|
||||
delete $state{ESTABLISHED};
|
||||
}
|
||||
|
||||
$target = ensure_audit_chain( $target ) if ( $targets{$target} || 0 ) & AUDIT;
|
||||
add_ijump_extended( $chainref, j => $target, $origin, state_imatch $_ );
|
||||
}
|
||||
|
||||
add_ijump_extended( $chain2ref, g => $target , $origin ) if $target;
|
||||
|
||||
$target = $chain2ref->{name} unless $twochains;
|
||||
}
|
||||
|
||||
if ( $twochains ) {
|
||||
add_ijump_extended $chainref, g => $target , $origin if $target;
|
||||
delete $state{$_};
|
||||
last;
|
||||
}
|
||||
|
||||
if ( $target ) {
|
||||
$target = ensure_audit_chain( $target ) if ( $targets{$target} || 0 ) & AUDIT;
|
||||
#
|
||||
# Always handle ESTABLISHED first
|
||||
#
|
||||
if ( $state{ESTABLISHED} && $_ ne 'ESTABLISHED' ) {
|
||||
add_ijump( $chain1ref, j => 'ACCEPT', state_imatch 'ESTABLISHED' );
|
||||
delete $state{ESTABLISHED};
|
||||
}
|
||||
|
||||
add_ijump_extended( $chainref, j => $target, $origin, state_imatch $_ );
|
||||
}
|
||||
|
||||
delete $state{$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( keys %state ) {
|
||||
my @state;
|
||||
|
||||
unless ( $config{FASTACCEPT} ) {
|
||||
for ( qw/ESTABLISHED RELATED/ ) {
|
||||
push @state, $_ if $state{$_};
|
||||
}
|
||||
}
|
||||
|
||||
push( @state, 'UNTRACKED' ),if $state{UNTRACKED} && $globals{UNTRACKED_TARGET} eq 'ACCEPT';
|
||||
if ( keys %state ) {
|
||||
my @state;
|
||||
|
||||
add_ijump( $chain1ref, j => 'ACCEPT', state_imatch join(',', @state ) ) if @state;
|
||||
unless ( $config{FASTACCEPT} ) {
|
||||
for ( qw/ESTABLISHED RELATED/ ) {
|
||||
push @state, $_ if $state{$_};
|
||||
}
|
||||
}
|
||||
|
||||
push( @state, 'UNTRACKED' ),if $state{UNTRACKED} && $globals{UNTRACKED_TARGET} eq 'ACCEPT';
|
||||
|
||||
add_ijump( $chain1ref, j => 'ACCEPT', state_imatch join(',', @state ) ) if @state;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sections{NEW} ) {
|
||||
@@ -1495,13 +1523,13 @@ sub external_name( $ ) {
|
||||
#
|
||||
# Define an Action
|
||||
#
|
||||
sub new_action( $$$$$$ ) {
|
||||
sub new_action( $$$$$$$ ) {
|
||||
|
||||
my ( $action , $type, $options , $actionfile , $state, $proto ) = @_;
|
||||
my ( $action , $type, $options , $actionfile , $state, $proto, $dport ) = @_;
|
||||
|
||||
fatal_error "Reserved action name ($action)" if reserved_name( $action );
|
||||
|
||||
$actions{$action} = { file => $actionfile, actchain => '' , type => $type, options => $options , state => $state, proto => $proto };
|
||||
$actions{$action} = { file => $actionfile, actchain => '' , type => $type, options => $options , state => $state, proto => $proto, dport => $dport };
|
||||
|
||||
$targets{$action} = $type;
|
||||
}
|
||||
@@ -1604,8 +1632,8 @@ sub merge_levels ($$) {
|
||||
|
||||
return $subordinate if $subordinate =~ /^(?:FORMAT|COMMENT|DEFAULTS?)$/;
|
||||
|
||||
my @supparts = split /:/, $superior;
|
||||
my @subparts = split /:/, $subordinate;
|
||||
my @supparts = split_list2( $superior , 'Action' );
|
||||
my @subparts = split_list2( $subordinate , 'Action' );
|
||||
|
||||
my $subparts = @subparts;
|
||||
|
||||
@@ -1772,7 +1800,7 @@ sub isolate_basic_target( $ ) {
|
||||
|
||||
sub process_rule ( $$$$$$$$$$$$$$$$$$$$ );
|
||||
sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$$ );
|
||||
sub process_snat1( $$$$$$$$$$$$ );
|
||||
sub process_snat1( $$$$$$$$$$$$$ );
|
||||
sub perl_action_helper( $$;$$ );
|
||||
|
||||
#
|
||||
@@ -1966,23 +1994,49 @@ sub process_action(\$\$$) {
|
||||
set_inline_matches( $matches );
|
||||
}
|
||||
} else {
|
||||
my ( $action, $source, $dest, $protos, $port, $ipsec, $mark, $user, $condition, $origdest, $probability) =
|
||||
split_line2( 'snat file',
|
||||
{ action =>0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
port => 4,
|
||||
ipsec => 5,
|
||||
mark => 6,
|
||||
user => 7,
|
||||
switch => 8,
|
||||
origdest => 9,
|
||||
probability => 10,
|
||||
},
|
||||
{},
|
||||
11,
|
||||
1 );
|
||||
my ( $action, $source, $dest, $protos, $port, $sport, $ipsec, $mark, $user, $condition, $origdest, $probability);
|
||||
|
||||
if ( $file_format == 1 ) {
|
||||
( $action, $source, $dest, $protos, $port, $ipsec, $mark, $user, $condition, $origdest, $probability) =
|
||||
split_line2( 'snat file',
|
||||
{ action =>0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
port => 4,
|
||||
dport => 4,
|
||||
ipsec => 5,
|
||||
mark => 6,
|
||||
user => 7,
|
||||
switch => 8,
|
||||
origdest => 9,
|
||||
probability => 10,
|
||||
},
|
||||
{},
|
||||
11,
|
||||
1 );
|
||||
$sport = '-';
|
||||
} else {
|
||||
( $action, $source, $dest, $protos, $port, $sport, $ipsec, $mark, $user, $condition, $origdest, $probability) =
|
||||
split_line2( 'snat file',
|
||||
{ action =>0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
port => 4,
|
||||
dport => 4,
|
||||
sport => 5,
|
||||
ipsec => 6,
|
||||
mark => 7,
|
||||
user => 8,
|
||||
switch => 9,
|
||||
origdest => 10,
|
||||
probability => 11,
|
||||
},
|
||||
{},
|
||||
12,
|
||||
1 );
|
||||
}
|
||||
|
||||
fatal_error 'ACTION must be specified' if $action eq '-';
|
||||
|
||||
@@ -1998,6 +2052,7 @@ sub process_action(\$\$$) {
|
||||
$dest,
|
||||
$proto,
|
||||
$port,
|
||||
$sport,
|
||||
$ipsec,
|
||||
$mark,
|
||||
$user,
|
||||
@@ -2096,6 +2151,7 @@ sub process_actions() {
|
||||
|
||||
my $state = '';
|
||||
my $proto = 0;
|
||||
my $dport = 0;
|
||||
|
||||
if ( $action =~ /:/ ) {
|
||||
warning_message 'Policy Actions are now specified in /etc/shorewall/shorewall.conf';
|
||||
@@ -2115,6 +2171,10 @@ sub process_actions() {
|
||||
} 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};
|
||||
} elsif ( /^dport=(.+)$/ ) {
|
||||
fatal_error "The 'dport' option requires the 'proto' option" unless $proto;
|
||||
$dport = validate_port($proto, $1);
|
||||
fatal_error "A destination port may not be specified on the REJECT_ACTION ($action)" if $action eq $config{REJECT_ACTION};
|
||||
} else {
|
||||
fatal_error "Invalid option ($_)" unless $options{$_};
|
||||
$opts |= $options{$_};
|
||||
@@ -2136,10 +2196,12 @@ sub process_actions() {
|
||||
}
|
||||
|
||||
$proto = $actions{$action}{proto} unless $proto;
|
||||
$dport = $actions{$action}{dport} unless $dport;
|
||||
delete $actions{$action};
|
||||
delete $targets{$action};
|
||||
} elsif ( ( $actiontype & INLINE ) && ( $type == ACTION ) && $opts & NOINLINE_OPT ) {
|
||||
$proto = $actions{$action}{proto} unless $proto;
|
||||
$dport = $actions{$action}{dport} unless $dport;
|
||||
delete $actions{$action};
|
||||
delete $targets{$action};
|
||||
} else {
|
||||
@@ -2183,7 +2245,7 @@ sub process_actions() {
|
||||
|
||||
fatal_error "Missing Action File ($actionfile)" unless -f $actionfile;
|
||||
|
||||
new_action ( $action, $type, $opts, $actionfile , $state , $proto );
|
||||
new_action ( $action, $type, $opts, $actionfile , $state , $proto , $dport );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2698,9 +2760,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
$macro_nest_level--;
|
||||
goto EXIT;
|
||||
} elsif ( $actiontype & NFQ ) {
|
||||
$action = handle_nfqueue( $param,
|
||||
1 # Allow 'bypass'
|
||||
);
|
||||
$action = handle_nfqueue( $param );
|
||||
} elsif ( $actiontype & SET ) {
|
||||
require_capability( 'IPSET_MATCH', 'SET and UNSET rules', '' );
|
||||
fatal_error "$action rules require a set name parameter" unless $param;
|
||||
@@ -2888,6 +2948,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
fatal_error "Invalid flags ($flags)" unless defined $flags && $flags =~ /^(dst|src)(,(dst|src)){0,5}$/;
|
||||
|
||||
$action = join( ' ', 'SET --' . $xlate{$basictarget} , $setname , $flags );
|
||||
$log_action = "$basictarget($setname)";
|
||||
|
||||
if ( supplied $timeout ) {
|
||||
fatal_error "A timeout may only be supplied in an ADD rule" unless $basictarget eq 'ADD';
|
||||
@@ -3063,9 +3124,11 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
|
||||
if ( $actiontype & ACTION ) {
|
||||
#
|
||||
# Verify action 'proto', if any
|
||||
# Verify action 'proto', and 'dport' if any
|
||||
#
|
||||
$proto = determine_action_protocol( $basictarget, $proto );
|
||||
if ( ( $proto = determine_action_protocol( $basictarget, $proto ) ) ne '-' ) {
|
||||
$ports = determine_action_dport( $basictarget, $proto, $ports );
|
||||
}
|
||||
#
|
||||
# Save NAT-oriented column contents
|
||||
#
|
||||
@@ -3923,9 +3986,8 @@ sub process_rules() {
|
||||
#
|
||||
for my $zone ( @zones ) {
|
||||
my $zoneref = find_zone( $zone );
|
||||
my $simple = @zones <= 2 && ! $zoneref->{complex};
|
||||
|
||||
unless ( @zones <= 2 && ! $zoneref->{complex} ) {
|
||||
unless ( $zoneref->{type} == LOCAL || ( @zones <= 2 && ! $zoneref->{complex} ) ) {
|
||||
#
|
||||
# Complex zone or we have more than one non-firewall zone -- create a zone forwarding chain
|
||||
#
|
||||
@@ -4817,9 +4879,11 @@ 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
|
||||
# Verify action 'proto' and 'dport' if any
|
||||
#
|
||||
$proto = determine_action_protocol( $cmd, $proto );
|
||||
if ( ( $proto = determine_action_protocol( $cmd, $proto ) ) ne '-' ) {
|
||||
$ports = determine_action_dport( $cmd, $proto, $ports );
|
||||
}
|
||||
#
|
||||
# Create the action:level:tag:param tuple.
|
||||
#
|
||||
@@ -5363,8 +5427,8 @@ sub process_mangle_rule( $ ) {
|
||||
}
|
||||
}
|
||||
|
||||
sub process_snat_inline( $$$$$$$$$$$$$$ ) {
|
||||
my ($inline, $chainref, $params, $loglevel, $source, $dest, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||
sub process_snat_inline( $$$$$$$$$$$$$$$ ) {
|
||||
my ($inline, $chainref, $params, $loglevel, $source, $dest, $protos, $ports, $sports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||
|
||||
my ( $level,
|
||||
$tag ) = split( ':', $loglevel, 2 );
|
||||
@@ -5383,28 +5447,54 @@ sub process_snat_inline( $$$$$$$$$$$$$$ ) {
|
||||
|
||||
progress_message "..Expanding inline action $inlinefile...";
|
||||
|
||||
push_open $inlinefile, 2, 1, undef , 2;
|
||||
push_open $inlinefile, 2, 1, undef , 1;
|
||||
|
||||
my $save_comment = push_comment;
|
||||
|
||||
while ( read_a_line( NORMAL_READ ) ) {
|
||||
my ( $maction, $msource, $mdest, $mprotos, $mports, $mipsec, $mmark, $muser, $mcondition, $morigdest, $mprobability) =
|
||||
split_line2( 'snat file',
|
||||
{ action =>0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
port => 4,
|
||||
ipsec => 5,
|
||||
mark => 6,
|
||||
user => 7,
|
||||
switch => 8,
|
||||
origdest => 9,
|
||||
probability => 10,
|
||||
},
|
||||
{},
|
||||
11,
|
||||
1 );
|
||||
my ( $maction, $msource, $mdest, $mprotos, $mports, $msports, $mipsec, $mmark, $muser, $mcondition, $morigdest, $mprobability);
|
||||
|
||||
if ( $file_format == 1 ) {
|
||||
( $maction, $msource, $mdest, $mprotos, $mports, $mipsec, $mmark, $muser, $mcondition, $morigdest, $mprobability) =
|
||||
split_line2( 'snat file',
|
||||
{ action =>0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
port => 4,
|
||||
dport => 4,
|
||||
ipsec => 5,
|
||||
mark => 6,
|
||||
user => 7,
|
||||
switch => 8,
|
||||
origdest => 9,
|
||||
probability => 10,
|
||||
},
|
||||
{},
|
||||
11,
|
||||
1 );
|
||||
$msports = '-';
|
||||
} else {
|
||||
( $maction, $msource, $mdest, $mprotos, $mports, $msports, $mipsec, $mmark, $muser, $mcondition, $morigdest, $mprobability) =
|
||||
split_line2( 'snat file',
|
||||
{ action =>0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
port => 4,
|
||||
dport => 4,
|
||||
sport => 5,
|
||||
ipsec => 6,
|
||||
mark => 7,
|
||||
user => 8,
|
||||
switch => 9,
|
||||
origdest => 10,
|
||||
probability => 11,
|
||||
},
|
||||
{},
|
||||
12,
|
||||
1 );
|
||||
}
|
||||
|
||||
fatal_error 'ACTION must be specified' if $maction eq '-';
|
||||
|
||||
@@ -5432,6 +5522,7 @@ sub process_snat_inline( $$$$$$$$$$$$$$ ) {
|
||||
$mdest,
|
||||
$proto,
|
||||
merge_macro_column( $mports, $ports ),
|
||||
merge_macro_column( $msports, $sports ),
|
||||
merge_macro_column( $mipsec, $ipsec ),
|
||||
merge_macro_column( $mmark, $mark ),
|
||||
merge_macro_column( $muser, $user ),
|
||||
@@ -5458,8 +5549,8 @@ sub process_snat_inline( $$$$$$$$$$$$$$ ) {
|
||||
#
|
||||
# Process a record in the snat file
|
||||
#
|
||||
sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
my ( $chainref, $origaction, $source, $dest, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||
sub process_snat1( $$$$$$$$$$$$$ ) {
|
||||
my ( $chainref, $origaction, $source, $dest, $proto, $ports, $sports, $ipsec, $mark, $user, $condition, $origdest, $probability ) = @_;
|
||||
|
||||
my $inchain;
|
||||
my $inaction;
|
||||
@@ -5479,6 +5570,13 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
my ( $action, $loglevel ) = split_action( $origaction );
|
||||
my $logaction;
|
||||
my $param;
|
||||
#
|
||||
# Handle early matches
|
||||
#
|
||||
if ( $inlinematches =~ s/^s*\+// ) {
|
||||
$prerule = $inlinematches;
|
||||
$inlinematches = '';
|
||||
}
|
||||
|
||||
if ( $action =~ /^MASQUERADE(\+)?(?:\((.+)\))?$/ ) {
|
||||
$target = 'MASQUERADE';
|
||||
@@ -5571,7 +5669,7 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
#
|
||||
# Handle Protocol, Ports and Condition
|
||||
#
|
||||
$baserule .= do_proto( $proto, $ports, '' );
|
||||
$baserule .= do_proto( $proto, $ports, $sports );
|
||||
#
|
||||
# Handle Mark
|
||||
#
|
||||
@@ -5767,9 +5865,9 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
fatal_error "Invalid IPv6 Address ($addr)" unless $addr =~ /^\[(.+)\]$/;
|
||||
|
||||
$addr = $1;
|
||||
$addr =~ s/\]-\[/-/;
|
||||
|
||||
if ( $addr =~ /^(.+)-(.+)$/ ) {
|
||||
fatal_error "Correct address range syntax is '[<addr1>-<addr2>]'" if $addr =~ /]-\[/;
|
||||
validate_range( $1, $2 );
|
||||
} else {
|
||||
validate_address $addr, 0;
|
||||
@@ -5818,6 +5916,7 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
supplied( $destnets ) && $destnets ne '-' ? $inaction || $interface ? join( ':', $interface, $destnets ) : $destnets : $inaction ? '-' : $interface,
|
||||
$proto,
|
||||
$ports,
|
||||
$sports,
|
||||
$ipsec,
|
||||
$mark,
|
||||
$user,
|
||||
@@ -5828,9 +5927,11 @@ 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
|
||||
# Verify action 'proto' and 'dport', if any
|
||||
#
|
||||
$proto = determine_action_protocol( $target, $proto );
|
||||
if ( ( $proto = determine_action_protocol( $target, $proto ) ) ne '-' ) {
|
||||
$ports = determine_action_dport( $target, $proto, $ports );
|
||||
}
|
||||
#
|
||||
# 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
|
||||
@@ -5928,18 +6029,30 @@ sub process_snat1( $$$$$$$$$$$$ ) {
|
||||
|
||||
sub process_snat( )
|
||||
{
|
||||
my ($action, $source, $dest, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) =
|
||||
split_line2( 'snat file',
|
||||
{ action => 0, source => 1, dest => 2, proto => 3, port => 4, ipsec => 5, mark => 6, user => 7, switch => 8, origdest => 9, probability => 10 },
|
||||
{}, #Nopad
|
||||
undef, #Columns
|
||||
1 ); #Allow inline matches
|
||||
my ($action, $source, $dest, $protos, $ports, $sports, $ipsec, $mark, $user, $condition, $origdest, $probability );
|
||||
|
||||
if ( $file_format == 1 ) {
|
||||
($action, $source, $dest, $protos, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability ) =
|
||||
split_line2( 'snat file',
|
||||
{ action => 0, source => 1, dest => 2, proto => 3, port => 4, dport => 4, ipsec => 5, mark => 6, user => 7, switch => 8, origdest => 9, probability => 10 },
|
||||
{}, #Nopad
|
||||
11, #Columns
|
||||
1 ); #Allow inline matches
|
||||
$sports = '-';
|
||||
} else {
|
||||
($action, $source, $dest, $protos, $ports, $sports, $ipsec, $mark, $user, $condition, $origdest, $probability ) =
|
||||
split_line2( 'snat file',
|
||||
{ action => 0, source => 1, dest => 2, proto => 3, port => 4, dport => 4, sport => 5, ipsec => 6, mark => 7, user => 8, switch => 9, origdest => 10, probability => 11 },
|
||||
{}, #Nopad
|
||||
12, #Columns
|
||||
1 ); #Allow inline matches
|
||||
}
|
||||
|
||||
fatal_error 'ACTION must be specified' if $action eq '-';
|
||||
fatal_error 'DEST must be specified' if $dest eq '-';
|
||||
|
||||
for my $proto ( split_list $protos, 'Protocol' ) {
|
||||
process_snat1( undef, $action, $source, $dest, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest, $probability );
|
||||
process_snat1( undef, $action, $source, $dest, $proto, $ports, $sports, $ipsec, $mark, $user, $condition, $origdest, $probability );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5954,7 +6067,7 @@ sub setup_snat()
|
||||
#
|
||||
# Masq file was empty or didn't exist
|
||||
#
|
||||
if ( $fn = open_file( 'snat', 1, 1 ) ) {
|
||||
if ( $fn = open_file( 'snat', 2, 1, undef, 1 ) ) {
|
||||
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty snat file" , 's'; } );
|
||||
process_snat while read_a_line( NORMAL_READ );
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
# Modified by Tom Eastep for integration into the Shorewall distribution
|
||||
# published under GPL Version 2#
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -2284,11 +2284,11 @@ sub open_mangle_for_output( $ ) {
|
||||
#
|
||||
# For information about entries in this file, type "man shorewall-mangle"
|
||||
#
|
||||
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
||||
# See https://shorewall.org/traffic_shaping.htm for additional information.
|
||||
# For usage in selecting among multiple ISPs, see
|
||||
# http://shorewall.net/MultiISP.html
|
||||
# https://shorewall.org/MultiISP.html
|
||||
#
|
||||
# See http://shorewall.net/PacketMarking.html for a detailed description of
|
||||
# See https://shorewall.org/PacketMarking.html for a detailed description of
|
||||
# the Netfilter/Shorewall packet marking mechanism.
|
||||
##############################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP SWITCH
|
||||
@@ -2300,11 +2300,11 @@ EOF
|
||||
#
|
||||
# For information about entries in this file, type "man shorewall6-mangle"
|
||||
#
|
||||
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
||||
# See https://shorewall.org/traffic_shaping.htm for additional information.
|
||||
# For usage in selecting among multiple ISPs, see
|
||||
# http://shorewall.net/MultiISP.html
|
||||
# https://shorewall.org/MultiISP.html
|
||||
#
|
||||
# See http://shorewall.net/PacketMarking.html for a detailed description of
|
||||
# See https://shorewall.org/PacketMarking.html for a detailed description of
|
||||
# the Netfilter/Shorewall packet marking mechanism.
|
||||
#
|
||||
######################################################################################################################################################################
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# (c) 2007-2019 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
@@ -29,6 +29,7 @@ package Shorewall::Zones;
|
||||
require Exporter;
|
||||
use Shorewall::Config qw(:DEFAULT :internal);
|
||||
use Shorewall::IPAddrs;
|
||||
use sort 'stable';
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -559,7 +560,8 @@ sub process_zone( \$ ) {
|
||||
@parents = split_list $2, 'zone';
|
||||
}
|
||||
|
||||
fatal_error "Invalid zone name ($zone)" unless $zone =~ /^[a-z]\w*$/i && length $zone <= $globals{MAXZONENAMELENGTH};
|
||||
fatal_error "Invalid zone name ($zone)" unless $zone =~ /^[a-z]\w*$/i;
|
||||
fatal_error "Zone name ($zone) too long" unless length $zone <= $globals{MAXZONENAMELENGTH};
|
||||
fatal_error "Invalid zone name ($zone)" if $reservedName{$zone} || $zone =~ /^all2|2all$/;
|
||||
fatal_error( "Duplicate zone name ($zone)" ) if $zones{$zone};
|
||||
|
||||
@@ -847,10 +849,10 @@ sub dump_zone_contents() {
|
||||
$entry .= ( " mark=" . in_hex( $zoneref->{mark} ) ) if exists $zoneref->{mark};
|
||||
|
||||
if ( $hostref ) {
|
||||
for my $type ( keys %$hostref ) {
|
||||
for my $type ( sortkeysiftest %$hostref ) {
|
||||
my $interfaceref = $hostref->{$type};
|
||||
|
||||
for my $interface ( keys %$interfaceref ) {
|
||||
for my $interface ( sortkeysiftest %$interfaceref ) {
|
||||
my $iref = $interfaces{$interface};
|
||||
my $arrayref = $interfaceref->{$interface};
|
||||
|
||||
@@ -1241,7 +1243,7 @@ sub process_interface( $$ ) {
|
||||
fatal_error "Invalid INTERFACE ($originalinterface)" if ! $interface || defined $extra;
|
||||
|
||||
if ( supplied $port ) {
|
||||
fatal_error qq("Virtual" interfaces are not supported -- see http://www.shorewall.net/Shorewall_and_Aliased_Interfaces.html) if $port =~ /^\d+$/;
|
||||
fatal_error qq("Virtual" interfaces are not supported -- see https://shorewall.org/Shorewall_and_Aliased_Interfaces.html) if $port =~ /^\d+$/;
|
||||
require_capability( 'PHYSDEV_MATCH', 'Bridge Ports', '');
|
||||
fatal_error "Your iptables is not recent enough to support bridge ports" unless $globals{KLUDGEFREE};
|
||||
|
||||
@@ -2027,7 +2029,7 @@ sub verify_required_interfaces( $ ) {
|
||||
|
||||
push_indent;
|
||||
|
||||
emit( 'start|reload|restore)' );
|
||||
emit( 'start|reload|restore|enable)' );
|
||||
|
||||
push_indent;
|
||||
|
||||
@@ -2320,9 +2322,9 @@ sub find_hosts_by_option( $ ) {
|
||||
}
|
||||
|
||||
for my $zone ( grep ! ( $zones{$_}{type} & FIREWALL ) , @zones ) {
|
||||
for my $type (keys %{$zones{$zone}{hosts}} ) {
|
||||
for my $type (sortkeysiftest %{$zones{$zone}{hosts}} ) {
|
||||
my $interfaceref = $zones{$zone}{hosts}->{$type};
|
||||
for my $interface ( keys %$interfaceref ) {
|
||||
for my $interface ( sortkeysiftest %$interfaceref ) {
|
||||
my $arrayref = $interfaceref->{$interface};
|
||||
for my $host ( @{$arrayref} ) {
|
||||
my $ipsec = $host->{ipsec};
|
||||
@@ -2350,9 +2352,9 @@ sub find_zone_hosts_by_option( $$ ) {
|
||||
my @hosts;
|
||||
|
||||
unless ( $zones{$zone}{type} & FIREWALL ) {
|
||||
for my $type (keys %{$zones{$zone}{hosts}} ) {
|
||||
for my $type (sortkeysiftest %{$zones{$zone}{hosts}} ) {
|
||||
my $interfaceref = $zones{$zone}{hosts}->{$type};
|
||||
for my $interface ( keys %$interfaceref ) {
|
||||
for my $interface ( sortkeysiftest %$interfaceref ) {
|
||||
my $arrayref = $interfaceref->{$interface};
|
||||
for my $host ( @{$arrayref} ) {
|
||||
if ( my $value = $host->{options}{$option} ) {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2014 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# (c) 2010,2011,2014 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
# Complete documentation is available at https://shorewall.org
|
||||
#
|
||||
# This program is part of Shorewall.
|
||||
#
|
||||
|
@@ -1089,7 +1089,7 @@ clear_firewall() {
|
||||
|
||||
set_state "Cleared"
|
||||
|
||||
logger -p kern.info "$g_product Cleared"
|
||||
logger -p daemon.info "$g_product Cleared"
|
||||
}
|
||||
|
||||
#
|
||||
@@ -1113,7 +1113,7 @@ interface_is_usable() # $1 = interface
|
||||
status=0
|
||||
|
||||
if [ "$1" != lo ]; then
|
||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ] && [ -z "$($IP -$g_family link list dev $1 2> /dev/null | fgrep 'state DOWN')" ]; then
|
||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ]; then
|
||||
if [ "$COMMAND" != enable ]; then
|
||||
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
||||
status=$?
|
||||
@@ -1389,7 +1389,7 @@ clear_firewall() {
|
||||
|
||||
set_state "Cleared"
|
||||
|
||||
logger -p kern.info "$g_product Cleared"
|
||||
logger -p daemon.info "$g_product Cleared"
|
||||
}
|
||||
|
||||
?endif # IPv6-specific functions.
|
||||
|
@@ -42,6 +42,7 @@ usage() {
|
||||
echo " up <interface>"
|
||||
echo " savesets <file>"
|
||||
echo " call <function> [ <parameter> ... ]"
|
||||
echo " help"
|
||||
echo " version"
|
||||
echo " info"
|
||||
echo
|
||||
@@ -54,6 +55,8 @@ usage() {
|
||||
echo " -c Save/restore iptables counters"
|
||||
echo " -V <verbosity> Set verbosity explicitly"
|
||||
echo " -R <file> Override RESTOREFILE setting"
|
||||
echo " -T Trace execution"
|
||||
echo " -D Debug iptables"
|
||||
exit $1
|
||||
}
|
||||
|
||||
@@ -109,20 +112,6 @@ reload_command() {
|
||||
# E X E C U T I O N B E G I N S H E R E #
|
||||
################################################################################
|
||||
#
|
||||
# Start trace if first arg is "debug" or "trace"
|
||||
#
|
||||
g_debug_iptables=
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
if [ "x$1" = "xtrace" ]; then
|
||||
set -x
|
||||
shift
|
||||
elif [ "x$1" = "xdebug" ]; then
|
||||
g_debug_iptables=Yes
|
||||
shift
|
||||
fi
|
||||
fi
|
||||
#
|
||||
# Map VERBOSE to VERBOSITY for compatibility with old Shorewall[6]-lite installations
|
||||
#
|
||||
[ -z "$VERBOSITY" ] && [ -n "$VERBOSE" ] && VERBOSITY=$VERBOSE
|
||||
@@ -148,9 +137,11 @@ g_compiled=
|
||||
g_file=
|
||||
g_docker=
|
||||
g_dockeringress=
|
||||
g_dockernetwork=
|
||||
g_dockeriso=
|
||||
g_dockerisostage=
|
||||
g_forcereload=
|
||||
g_fallback=
|
||||
g_debug_iptables=
|
||||
|
||||
[ -n "$SERVICEDIR" ] && SUBSYSLOCK=
|
||||
|
||||
@@ -257,6 +248,14 @@ while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||
RESTOREFILE=$option
|
||||
option=
|
||||
;;
|
||||
T*)
|
||||
set -x;
|
||||
option=${option#T}
|
||||
;;
|
||||
D*)
|
||||
g_debug_iptables=Yes
|
||||
option=${option#D}
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
For instructions on using these sample configurations, please see
|
||||
|
||||
http://www.shorewall.net/shorewall_quickstart_guide.htm
|
||||
https://shorewall.org/shorewall_quickstart_guide.htm
|
||||
|
||||
Shorewall Samples
|
||||
Copyright (C) 2006 by the following authors:
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# For information about entries in this file, type "man shorewall-interfaces"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# http://www.shorewall.net/manpages/shorewall-interfaces.html
|
||||
# https://shorewall.org/manpages/shorewall-interfaces.html
|
||||
#
|
||||
###############################################################################
|
||||
?FORMAT 2
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# For information about entries in this file, type "man shorewall-policy"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# http://www.shorewall.net/manpages/shorewall-policy.html
|
||||
# https://shorewall.org/manpages/shorewall-policy.html
|
||||
#
|
||||
###############################################################################
|
||||
#SOURCE DEST POLICY LOGLEVEL RATE CONNLIMIT
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# For information on the settings in this file, type "man shorewall-rules"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# http://www.shorewall.net/manpages/shorewall-rules.html
|
||||
# https://shorewall.org/manpages/shorewall-rules.html
|
||||
#
|
||||
######################################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# For information about the settings in this file, type "man shorewall.conf"
|
||||
#
|
||||
# Manpage also online at http://www.shorewall.net/manpages/shorewall.conf.html
|
||||
# Manpage also online at https://shorewall.org/manpages/shorewall.conf.html
|
||||
###############################################################################
|
||||
# S T A R T U P E N A B L E D
|
||||
###############################################################################
|
||||
@@ -163,6 +163,8 @@ DISABLE_IPV6=No
|
||||
|
||||
DOCKER=No
|
||||
|
||||
DOCKER_BRIDGE=docker0
|
||||
|
||||
DELETE_THEN_ADD=Yes
|
||||
|
||||
DETECT_DNAT_IPADDRS=No
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# For information about this file, type "man shorewall-zones"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# http://www.shorewall.net/manpages/shorewall-zones.html
|
||||
# https://shorewall.org/manpages/shorewall-zones.html
|
||||
#
|
||||
###############################################################################
|
||||
#ZONE TYPE OPTIONS IN OUT
|
||||
|
@@ -1,6 +1,6 @@
|
||||
For instructions on using this sample configuration, please see
|
||||
|
||||
http://www.shorewall.net/standalone.htm
|
||||
https://shorewall.org/standalone.htm
|
||||
|
||||
Shorewall Samples
|
||||
Copyright (C) 2006-2015 by the following authors:
|
||||
|
@@ -14,7 +14,7 @@
|
||||
# For information about the settings in this file, type "man shorewall.conf"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# http://shorewall.net/manpages/shorewall.conf.html
|
||||
# https://shorewall.org/manpages/shorewall.conf.html
|
||||
#
|
||||
###############################################################################
|
||||
# S T A R T U P E N A B L E D
|
||||
@@ -174,6 +174,8 @@ DISABLE_IPV6=No
|
||||
|
||||
DOCKER=No
|
||||
|
||||
DOCKER_BRIDGE=docker0
|
||||
|
||||
DELETE_THEN_ADD=Yes
|
||||
|
||||
DETECT_DNAT_IPADDRS=No
|
||||
|
@@ -1,6 +1,6 @@
|
||||
For instructions on using these sample configurations, please see
|
||||
|
||||
http://www.shorewall.net/three-interface.htm
|
||||
https://shorewall.org/three-interface.htm
|
||||
|
||||
Shorewall Samples
|
||||
Copyright (C) 2006-2015 by the following authors:
|
||||
|
@@ -14,7 +14,7 @@
|
||||
# For information about the settings in this file, type "man shorewall.conf"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# http://shorewall.net/manpages/shorewall.conf.html
|
||||
# https://shorewall.org/manpages/shorewall.conf.html
|
||||
#
|
||||
###############################################################################
|
||||
STARTUP_ENABLED=No
|
||||
@@ -171,6 +171,8 @@ DISABLE_IPV6=No
|
||||
|
||||
DOCKER=No
|
||||
|
||||
DOCKER_BRIDGE=docker0
|
||||
|
||||
DELETE_THEN_ADD=Yes
|
||||
|
||||
DETECT_DNAT_IPADDRS=No
|
||||
|
@@ -11,9 +11,10 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-snat"
|
||||
#
|
||||
# See http://shorewall.net/manpages/shorewall-snat.html for more information
|
||||
###########################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
||||
# See https://shorewall.org/manpages/shorewall-snat.html for more information
|
||||
?FORMAT 2
|
||||
###################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DPORT SPORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
||||
#
|
||||
# Rules generated from masq file /home/teastep/shorewall/trunk/Shorewall/Samples/three-interfaces/masq by Shorewall 5.0.13-RC1 - Sat Oct 15 11:43:47 PDT 2016
|
||||
#
|
||||
|
@@ -1,6 +1,6 @@
|
||||
For instructions on using these sample configurations, please see
|
||||
|
||||
http://www.shorewall.net/two-interface.htm
|
||||
https://shorewall.org/two-interface.htm
|
||||
|
||||
Shorewall Samples
|
||||
Copyright (C) 2006-2015 by the following authors:
|
||||
|
@@ -14,7 +14,7 @@
|
||||
# For information about the settings in this file, type "man shorewall.conf"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# http://shorewall.net/manpages/shorewall.conf.html
|
||||
# https://shorewall.org/manpages/shorewall.conf.html
|
||||
#
|
||||
###############################################################################
|
||||
# S T A R T U P E N A B L E D
|
||||
@@ -174,6 +174,8 @@ DISABLE_IPV6=No
|
||||
|
||||
DOCKER=No
|
||||
|
||||
DOCKER_BRIDGE=docker0
|
||||
|
||||
DELETE_THEN_ADD=Yes
|
||||
|
||||
DETECT_DNAT_IPADDRS=No
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user