Compare commits

..

36 Commits

Author SHA1 Message Date
Matt Darfeuille
0e4c1cdac1 Init: Correct indentation
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-12 10:26:37 -08:00
Tom Eastep
27a0f0f7a0 Make TRACK_PROVIDERS=Yes the default
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-10 08:46:01 -08:00
Tom Eastep
9ac075fd56 Clear the connection mark in tunneled packets from tracked providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-09 17:12:14 -08:00
Tom Eastep
b2604583af Revert "Clear the connection mark in tunneled packets from tracked providers"
This reverts commit 62c6411cb0.
2018-01-09 17:01:51 -08:00
Tom Eastep
62c6411cb0 Clear the connection mark in tunneled packets from tracked providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-09 14:51:57 -08:00
Matt Darfeuille
6badf3ce1a Update supported Shorewall version
Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-08 09:08:53 -08:00
Tom Eastep
1bc90beb01 Update copyrights
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-07 15:01:46 -08:00
Tom Eastep
eaccf033c6 Update copyrights for 2018
- Update some header versions to 5.1

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-07 14:24:01 -08:00
Tom Eastep
056711d304 Remove anachronistic comment
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-06 13:58:20 -08:00
Tom Eastep
0aa0bebe07 Reword error message
- "Invalid action name ..." to "Reserved action name ..."

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-06 13:56:36 -08:00
Tom Eastep
1a68d87c94 Don't enable forwarding in 'clear'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-04 15:39:07 -08:00
Tom Eastep
c518cfaa4a Allow address variables to work correctly with the 'clear' command
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-03 08:58:28 -08:00
Tom Eastep
196a56ea3c Permit when firewall stopped when using an ipset for dynamic BL
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 13:26:32 -08:00
Tom Eastep
2c3f121835 Don't call setup_dbl() unconditionally
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 13:11:31 -08:00
Tom Eastep
18ba5c7311 Don't verify 'conntrack' utility for 'remote-' commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 11:52:35 -08:00
Tom Eastep
c8774110c6 Correct typo (rootonly => root_only)
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 11:51:42 -08:00
Tom Eastep
1479e955d4 Add FAQ 106 (startup at boot on Debian)
- mention reload as a faster alternative to restart

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2018-01-02 08:52:12 -08:00
Tom Eastep
09980cc75e Use split() in uptodate()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-31 15:59:28 -08:00
Tom Eastep
e0a757ea03 Quit find after finding the first newer file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-31 14:15:45 -08:00
Tom Eastep
550003f0f4 Only look at regular files when running 'find'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-31 14:09:51 -08:00
Tom Eastep
4f50303318 Merge branch '5.1.10'
# Conflicts:
#	Shorewall/lib.cli-std
2017-12-31 14:06:52 -08:00
Tom Eastep
5053999442 Don't run 'find' in the PWD
- Also remove -mindepth so as to catch deletions in the directories

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-31 13:33:16 -08:00
Tom Eastep
6b5889177b Correct startup_error() inadvertent change
- Switch ensure_root() back to calling startup_error()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-30 09:24:21 -08:00
Tom Eastep
71f8bad300 Tweak Shared Config doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-30 08:44:49 -08:00
Tom Eastep
377c9f5708 Only search files in each CONFIG_PATH directory - no recursion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-30 08:44:05 -08:00
Tom Eastep
45a164733b Fix breakage of ipp2p
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-30 08:38:14 -08:00
Tom Eastep
6f82bfe7d1 Handle PROTO '-' in conntrack file processing.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 15:54:15 -08:00
Tom Eastep
4e5b98d3d9 Only search files in each CONFIG_PATH directory - no recursion
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 15:42:09 -08:00
Tom Eastep
078c781dfa Allow override of :syn assumption in CT rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 15:15:33 -08:00
Tom Eastep
46f68c6dcb Move adjustment of the protocol in process_conntrack_rule()
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 13:51:33 -08:00
Tom Eastep
b42678269c Revert "Add :syn to each TCP entry in the conntrack file"
This reverts commit f861f8da35.
2017-12-29 13:08:27 -08:00
Tom Eastep
9bd10c0c00 Call fatal_error (not startup_error) when non-root does default compile
- Also reword the message
2017-12-29 12:49:43 -08:00
Tom Eastep
f861f8da35 Add :syn to each TCP entry in the conntrack file
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-29 12:38:58 -08:00
Tom Eastep
9e3cb27d0a Use the synchain name in log messages rather than the base chain name
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-28 14:13:50 -08:00
Tom Eastep
5b97800901 Tweak Shared Config doc
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-28 13:26:39 -08:00
Tom Eastep
d8a22d13dd Allow non-root to run many 'show' commands
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2017-12-28 10:49:09 -08:00
43 changed files with 318 additions and 189 deletions

View File

@@ -2,7 +2,7 @@
# #
# Shorewall Packet Filtering Firewall RPM configuration program - V4.6 # Shorewall Packet Filtering Firewall RPM configuration program - V4.6
# #
# (c) 2012,2014 - Tom Eastep (teastep@shorewall.net) # (c) 2012,2014,2017 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at http://www.shorewall.net
# #

View File

@@ -2,7 +2,7 @@
# #
# Script to install Shoreline Firewall Core Modules # Script to install Shoreline Firewall Core Modules
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at http://shorewall.net
# #

View File

@@ -1,7 +1,7 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.cli. # Shorewall 5.1 -- /usr/share/shorewall/lib.cli.
# #
# (c) 1999-2015 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -47,6 +47,10 @@ startup_error() {
exit 1 exit 1
} }
only_root() {
[ "$(id -u)" != 0 ] && fatal_error "The '$COMMAND' command may only be run by root"
}
# #
# Display a chain if it exists # Display a chain if it exists
# #
@@ -1203,6 +1207,7 @@ show_command() {
show_macro() { show_macro() {
foo=`grep 'This macro' $macro | sed 's/This macro //'` foo=`grep 'This macro' $macro | sed 's/This macro //'`
if [ -n "$foo" ]; then if [ -n "$foo" ]; then
macro=$(basename $macro)
macro=${macro#*.} macro=${macro#*.}
foo=${foo%.*} foo=${foo%.*}
if [ ${#macro} -gt 5 ]; then if [ ${#macro} -gt 5 ]; then
@@ -1297,37 +1302,47 @@ show_command() {
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
COMMAND="$COMMAND $1"
case "$1" in case "$1" in
connections) connections)
only_root
eval show_connections $@ $g_pager eval show_connections $@ $g_pager
;; ;;
nat) nat)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_nat $g_pager eval show_nat $g_pager
;; ;;
raw) raw)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_raw $g_pager eval show_raw $g_pager
;; ;;
tos|mangle) tos|mangle)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_mangle $g_pager eval show_mangle $g_pager
;; ;;
log) log)
[ $# -gt 2 ] && too_many_arguments $2 [ $# -gt 2 ] && too_many_arguments $2
only_root
setup_logread setup_logread
eval show_log $g_pager eval show_log $g_pager
;; ;;
tc) tc)
only_root
[ $# -gt 2 ] && too_many_arguments $2 [ $# -gt 2 ] && too_many_arguments $2
eval show_tc $@ $g_pager eval show_tc $@ $g_pager
;; ;;
classifiers|filters) classifiers|filters)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_classifiers_command $g_pager eval show_classifiers_command $g_pager
;; ;;
zones) zones)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
if [ -f ${VARDIR}/zones ]; then if [ -f ${VARDIR}/zones ]; then
echo "$g_product $SHOREWALL_VERSION Zones at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION Zones at $g_hostname - $(date)"
@@ -1351,6 +1366,7 @@ show_command() {
fi fi
;; ;;
capabilities) capabilities)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
determine_capabilities determine_capabilities
VERBOSITY=2 VERBOSITY=2
@@ -1387,6 +1403,7 @@ show_command() {
fi fi
;; ;;
chain) chain)
only_root
shift shift
eval show_chain $@ $g_pager eval show_chain $@ $g_pager
;; ;;
@@ -1394,26 +1411,31 @@ show_command() {
echo $VARDIR; echo $VARDIR;
;; ;;
policies) policies)
only_root
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_policies $g_pager eval show_policies $g_pager
;; ;;
ipa) ipa)
only_root
[ $g_family -eq 4 ] || fatal_error "'show ipa' is now available in $g_product" [ $g_family -eq 4 ] || fatal_error "'show ipa' is now available in $g_product"
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_ipa $g_pager eval show_ipa $g_pager
;; ;;
marks) marks)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
echo "$g_product $SHOREWALL_VERSION Mark Layout at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION Mark Layout at $g_hostname - $(date)"
echo echo
[ -f ${VARDIR}/marks ] && cat ${VARDIR}/marks; [ -f ${VARDIR}/marks ] && cat ${VARDIR}/marks;
;; ;;
nfacct) nfacct)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
eval show_nfacct_command $g_pager eval show_nfacct_command $g_pager
;; ;;
arptables) arptables)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
resolve_arptables resolve_arptables
if [ -n "$arptables" -a -x $arptables ]; then if [ -n "$arptables" -a -x $arptables ]; then
eval show_arptables $g_pager eval show_arptables $g_pager
@@ -1423,6 +1445,7 @@ show_command() {
;; ;;
event) event)
[ $# -gt 1 ] || too_many_arguments $2 [ $# -gt 1 ] || too_many_arguments $2
only_root
echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION events at $g_hostname - $(date)"
echo echo
shift shift
@@ -1430,14 +1453,18 @@ show_command() {
;; ;;
events) events)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
eval show_events_command $g_pager eval show_events_command $g_pager
;; ;;
bl|blacklists) bl|blacklists)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
setup_dbl
eval show_blacklists $g_pager eval show_blacklists $g_pager
;; ;;
opens) opens)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
echo "$g_product $SHOREWALL_VERSION Temporarily opened connections at $g_hostname - $(date)" echo "$g_product $SHOREWALL_VERSION Temporarily opened connections at $g_hostname - $(date)"
if chain_exists dynamic; then if chain_exists dynamic; then
@@ -1448,6 +1475,7 @@ show_command() {
;; ;;
ipsec) ipsec)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
only_root
eval show_ipsec_command $g_pager eval show_ipsec_command $g_pager
;; ;;
*) *)
@@ -1496,6 +1524,8 @@ show_command() {
;; ;;
esac esac
only_root
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
if [ $1 = dynamic -a $# -gt 1 ]; then if [ $1 = dynamic -a $# -gt 1 ]; then
shift shift
@@ -2545,109 +2575,114 @@ hits_command() {
fi fi
} }
#
# Issue an error message and terminate if the firewall isn't started
#
require_started() {
if ! product_is_started; then
error_message "ERROR: $g_product is not started"
exit 2
fi
}
# #
# 'allow' command executor # 'allow' command executor
# #
allow_command() { allow_command() {
local allowed
local which
which='-s'
local range
range='--src-range'
local dynexists
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && missing_argument [ $# -eq 1 ] && missing_argument
if product_is_started ; then if [ -n "$g_blacklistipset" ]; then
local allowed case ${IPSET:=ipset} in
local which */*)
which='-s' if [ ! -x "$IPSET" ]; then
local range fatal_error "IPSET=$IPSET does not exist or is not executable"
range='--src-range' fi
local dynexists ;;
*)
if [ -n "$g_blacklistipset" ]; then IPSET="$(mywhich $IPSET)"
[ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"
case ${IPSET:=ipset} in ;;
*/*) esac
if [ ! -x "$IPSET" ]; then
fatal_error "IPSET=$IPSET does not exist or is not executable"
fi
;;
*)
IPSET="$(mywhich $IPSET)"
[ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"
;;
esac
fi
if chain_exists dynamic; then
dynexists=Yes
elif [ -z "$g_blacklistipset" ]; then
fatal_error "Dynamic blacklisting is not enabled in the current $g_product configuration"
fi
[ -n "$g_nolock" ] || mutex_on
while [ $# -gt 1 ]; do
shift
allowed=''
case $1 in
from)
which='-s'
range='--src-range'
continue
;;
to)
which='-d'
range='--dst-range'
continue
;;
*-*)
if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes
fi
fi
if [ -n "$dynexists" ]; then
if qt $g_tool -D dynamic -m iprange $range $1 -j reject ||\
qt $g_tool -D dynamic -m iprange $range $1 -j DROP ||\
qt $g_tool -D dynamic -m iprange $range $1 -j logdrop ||\
qt $g_tool -D dynamic -m iprange $range $1 -j logreject
then
allowed=Yes
fi
fi
;;
*)
if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes
fi
fi
if [ -n "$dynexists" ]; then
if qt $g_tool -D dynamic $which $1 -j reject ||\
qt $g_tool -D dynamic $which $1 -j DROP ||\
qt $g_tool -D dynamic $which $1 -j logdrop ||\
qt $g_tool -D dynamic $which $1 -j logreject
then
allowed=Yes
fi
fi
;;
esac
if [ -n "$allowed" ]; then
progress_message2 "$1 Allowed"
else
error_message "WARNING: $1 already allowed (not dynamically blacklisted)"
fi
done
[ -n "$g_nolock" ] || mutex_off
else
error_message "ERROR: $g_product is not started"
exit 2
fi fi
if chain_exists dynamic; then
dynexists=Yes
elif [ -z "$g_blacklistipset" ]; then
require_started
fatal_error "Dynamic blacklisting is not enabled in the current $g_product configuration"
fi
[ -n "$g_nolock" ] || mutex_on
while [ $# -gt 1 ]; do
shift
allowed=''
case $1 in
from)
which='-s'
range='--src-range'
continue
;;
to)
which='-d'
range='--dst-range'
continue
;;
*-*)
if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes
fi
fi
if [ -n "$dynexists" ]; then
if qt $g_tool -D dynamic -m iprange $range $1 -j reject ||\
qt $g_tool -D dynamic -m iprange $range $1 -j DROP ||\
qt $g_tool -D dynamic -m iprange $range $1 -j logdrop ||\
qt $g_tool -D dynamic -m iprange $range $1 -j logreject
then
allowed=Yes
fi
fi
;;
*)
if [ -n "$g_blacklistipset" ]; then
if qt $IPSET -D $g_blacklistipset $1; then
allowed=Yes
fi
fi
if [ -n "$dynexists" ]; then
if qt $g_tool -D dynamic $which $1 -j reject ||\
qt $g_tool -D dynamic $which $1 -j DROP ||\
qt $g_tool -D dynamic $which $1 -j logdrop ||\
qt $g_tool -D dynamic $which $1 -j logreject
then
allowed=Yes
fi
fi
;;
esac
if [ -n "$allowed" ]; then
progress_message2 "$1 Allowed"
else
error_message "WARNING: $1 already allowed (not dynamically blacklisted)"
fi
done
[ -n "$g_nolock" ] || mutex_off
} }
# #
@@ -4585,12 +4620,14 @@ shorewall_cli() {
case "$COMMAND" in case "$COMMAND" in
start) start)
only_root
get_config Yes Yes get_config Yes Yes
shift shift
start_command $@ start_command $@
;; ;;
stop|clear) stop|clear)
[ $# -ne 1 ] && too_many_arguments $2 [ $# -ne 1 ] && too_many_arguments $2
only_root
get_config get_config
[ -x $g_firewall ] || fatal_error "$g_product has never been started" [ -x $g_firewall ] || fatal_error "$g_product has never been started"
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
@@ -4598,6 +4635,7 @@ shorewall_cli() {
[ -n "$g_nolock" ] || mutex_off [ -n "$g_nolock" ] || mutex_off
;; ;;
reset) reset)
only_root
get_config get_config
shift shift
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
@@ -4606,11 +4644,13 @@ shorewall_cli() {
[ -n "$g_nolock" ] || mutex_off [ -n "$g_nolock" ] || mutex_off
;; ;;
reload|restart) reload|restart)
only_root
get_config Yes Yes get_config Yes Yes
shift shift
restart_command $@ restart_command $@
;; ;;
disable|enable|reenable) disable|enable|reenable)
only_root
get_config Yes get_config Yes
if product_is_started; then if product_is_started; then
run_it ${VARDIR}/firewall $g_debugging $@ run_it ${VARDIR}/firewall $g_debugging $@
@@ -4619,6 +4659,7 @@ shorewall_cli() {
fi fi
;; ;;
blacklist) blacklist)
only_root
get_config Yes get_config Yes
shift shift
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
@@ -4627,6 +4668,7 @@ shorewall_cli() {
;; ;;
run) run)
[ $# -gt 1 ] || fatal_error "Missing function name" [ $# -gt 1 ] || fatal_error "Missing function name"
only_root
get_config Yes get_config Yes
run_command $@ run_command $@
;; ;;
@@ -4636,18 +4678,20 @@ shorewall_cli() {
show_command $@ show_command $@
;; ;;
status) status)
[ "$(id -u)" != 0 ] && fatal_error "The status command may only be run by root" only_root
get_config get_config
shift shift
status_command $@ status_command $@
;; ;;
dump) dump)
only_root
get_config Yes No Yes get_config Yes No Yes
shift shift
dump_command $@ dump_command $@
;; ;;
hits) hits)
[ $g_family -eq 6 ] && fatal_error "$g_product does not support the hits command" [ $g_family -eq 6 ] && fatal_error "$g_product does not support the hits command"
only_root
get_config Yes No Yes get_config Yes No Yes
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
shift shift
@@ -4658,53 +4702,63 @@ shorewall_cli() {
version_command $@ version_command $@
;; ;;
logwatch) logwatch)
only_root
get_config Yes Yes Yes get_config Yes Yes Yes
banner="${g_product}-$SHOREWALL_VERSION Logwatch at $g_hostname -" banner="${g_product}-$SHOREWALL_VERSION Logwatch at $g_hostname -"
logwatch_command $@ logwatch_command $@
;; ;;
drop) drop)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && missing_argument [ $# -eq 1 ] && missing_argument
drop_command $@ drop_command $@
;; ;;
logdrop) logdrop)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && missing_argument [ $# -eq 1 ] && missing_argument
logdrop_command $@ logdrop_command $@
;; ;;
reject|logreject) reject|logreject)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
[ $# -eq 1 ] && missing_argument [ $# -eq 1 ] && missing_argument
reject_command $@ reject_command $@
;; ;;
open|close) open|close)
only_root
get_config get_config
shift shift
open_close_command $@ open_close_command $@
;; ;;
allow) allow)
only_root
get_config get_config
allow_command $@ allow_command $@
;; ;;
add) add)
only_root
get_config get_config
shift shift
add_command $@ add_command $@
;; ;;
delete) delete)
only_root
get_config get_config
shift shift
delete_command $@ delete_command $@
;; ;;
save) save)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
save_command $@ save_command $@
;; ;;
forget) forget)
only_root
get_config get_config
forget_command $@ forget_command $@
;; ;;
@@ -4721,11 +4775,13 @@ shorewall_cli() {
ipdecimal_command $@ ipdecimal_command $@
;; ;;
restore) restore)
only_root
get_config get_config
shift shift
restore_command $@ restore_command $@
;; ;;
call) call)
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
# #
@@ -4763,17 +4819,20 @@ shorewall_cli() {
usage usage
;; ;;
iptrace) iptrace)
only_root
get_config get_config
shift shift
iptrace_command $@ iptrace_command $@
;; ;;
noiptrace) noiptrace)
only_root
get_config get_config
shift shift
noiptrace_command $@ noiptrace_command $@
;; ;;
savesets) savesets)
[ $# -eq 1 ] || too_many_arguments $2 [ $# -eq 1 ] || too_many_arguments $2
only_root
get_config get_config
[ -n "$g_debugging" ] && set -x [ -n "$g_debugging" ] && set -x
savesets1 savesets1

View File

@@ -34,7 +34,7 @@ setstatedir() {
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT} [ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARLIB}/${PRODUCT}
if [ -x ${STATEDIR}/firewall ]; then if [ -x ${STATEDIR}/firewall ]; then
return 0 return 0
elif [ $PRODUCT = shorewall ]; then elif [ $PRODUCT = shorewall ]; then
${SBINDIR}/shorewall compile ${SBINDIR}/shorewall compile
elif [ $PRODUCT = shorewall6 ]; then elif [ $PRODUCT = shorewall6 ]; then

View File

@@ -1,11 +1,11 @@
# #
# Shorewall -- /usr/share/shorewall/action.A_REJECTWITH # Shorewall -- /usr/share/shorewall/action.A_REJECT
# #
# A_REJECT Action. # A_REJECT Action.
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -3,7 +3,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net) # (c) 2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -4,7 +4,7 @@
# Invalid Action # Invalid Action
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -3,7 +3,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2012-2016 Tom Eastep (teastep@shorewall.net) # (c) 2012-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -3,7 +3,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -5,7 +5,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2011-2016 Tom Eastep (teastep@shorewall.net) # (c) 2011-2017 Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Accounting.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Accounting.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Chains.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Chains.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -4782,6 +4782,7 @@ sub do_proto( $$$;$ )
if ( $proto ne '' ) { if ( $proto ne '' ) {
my $synonly = ( $proto =~ s/:(!)?syn$//i ); my $synonly = ( $proto =~ s/:(!)?syn$//i );
my $all = ( $proto =~ s/:all$//i );
my $notsyn = $1; my $notsyn = $1;
my $invert = ( $proto =~ s/^!// ? '! ' : '' ); my $invert = ( $proto =~ s/^!// ? '! ' : '' );
my $protonum = resolve_proto $proto; my $protonum = resolve_proto $proto;
@@ -4797,6 +4798,7 @@ sub do_proto( $$$;$ )
# $proto now contains the protocol number and $pname contains the canonical name of the protocol # $proto now contains the protocol number and $pname contains the canonical name of the protocol
# #
unless ( $synonly ) { unless ( $synonly ) {
fatal_error '":all" is only allowed with tcp' if $all && $proto != TCP;
$output = "${invert}-p ${proto} "; $output = "${invert}-p ${proto} ";
} else { } else {
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert; fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
@@ -4936,6 +4938,8 @@ sub do_proto( $$$;$ )
} else { } else {
fatal_error '":syn" is only allowed with tcp' if $synonly; fatal_error '":syn" is only allowed with tcp' if $synonly;
$proto = $proto . ':all' if $all;
if ( $proto =~ /^(ipp2p(:(tcp|udp|all))?)$/i ) { if ( $proto =~ /^(ipp2p(:(tcp|udp|all))?)$/i ) {
my $p = $2 ? lc $3 : 'tcp'; my $p = $2 ? lc $3 : 'tcp';
require_capability( 'IPP2P_MATCH' , "PROTO = $proto" , 's' ); require_capability( 'IPP2P_MATCH' , "PROTO = $proto" , 's' );
@@ -4992,6 +4996,7 @@ sub do_iproto( $$$ )
if ( $proto ne '' ) { if ( $proto ne '' ) {
my $synonly = ( $proto =~ s/:syn$//i ); my $synonly = ( $proto =~ s/:syn$//i );
my $all = ( $proto =~ s/:all$//i );
my $invert = ( $proto =~ s/^!// ? '! ' : '' ); my $invert = ( $proto =~ s/^!// ? '! ' : '' );
my $protonum = resolve_proto $proto; my $protonum = resolve_proto $proto;
@@ -5006,6 +5011,7 @@ sub do_iproto( $$$ )
# $proto now contains the protocol number and $pname contains the canonical name of the protocol # $proto now contains the protocol number and $pname contains the canonical name of the protocol
# #
unless ( $synonly ) { unless ( $synonly ) {
fatal_error '":all" is only allowed with tcp' if $all && $proto != TCP;
@output = ( p => "${invert}${proto}" ); @output = ( p => "${invert}${proto}" );
} else { } else {
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert; fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
@@ -5140,6 +5146,8 @@ sub do_iproto( $$$ )
} else { } else {
fatal_error '":syn" is only allowed with tcp' if $synonly; fatal_error '":syn" is only allowed with tcp' if $synonly;
$proto = $proto . ':all' if $all;
if ( $proto =~ /^(ipp2p(:(tcp|udp|all))?)$/i ) { if ( $proto =~ /^(ipp2p(:(tcp|udp|all))?)$/i ) {
my $p = $2 ? lc $3 : 'tcp'; my $p = $2 ? lc $3 : 'tcp';
require_capability( 'IPP2P_MATCH' , "PROTO = $proto" , 's' ); require_capability( 'IPP2P_MATCH' , "PROTO = $proto" , 's' );

View File

@@ -4,7 +4,7 @@
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Config.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Config.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -6491,7 +6491,7 @@ sub get_configuration( $$$$ ) {
default_yes_no 'USE_DEFAULT_RT' , ''; default_yes_no 'USE_DEFAULT_RT' , '';
default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes'; default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes';
default_yes_no 'AUTOMAKE' , ''; default_yes_no 'AUTOMAKE' , '';
default_yes_no 'TRACK_PROVIDERS' , ''; default_yes_no 'TRACK_PROVIDERS' , 'Yes';
default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : ''; default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : '';
default_yes_no 'USE_NFLOG_SIZE' , ''; default_yes_no 'USE_NFLOG_SIZE' , '';

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/IPAddrs.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/IPAddrs.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2015 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Misc.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Misc.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Nat.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Nat.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Providers.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Providers.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -161,6 +161,15 @@ sub setup_route_marking() {
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref, $origin, i => $physical, mark => "--mark 0/$mask"; add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref, $origin, i => $physical, mark => "--mark 0/$mask";
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref1, $origin, i => "! $physical", mark => "--mark $mark/$mask"; add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref1, $origin, i => "! $physical", mark => "--mark $mark/$mask";
add_ijump_extended $mangle_table->{OUTPUT} , j => $chainref2, $origin, mark => "--mark $mark/$mask"; add_ijump_extended $mangle_table->{OUTPUT} , j => $chainref2, $origin, mark => "--mark $mark/$mask";
if ( have_ipsec ) {
if ( have_capability( 'MARK_ANYWHERE' ) ) {
add_ijump_extended $filter_table->{forward_chain($interface)}, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", , state_imatch('NEW'), policy => '--dir in --pol ipsec';
} elsif ( have_capability( 'MANGLE_FORWARD' ) ) {
add_ijump_extended $mangle_table->{FORWARD}, j => 'CONNMARK', $origin, targetopts => "--set-mark 0${exmask}", i => $physical, state_imatch('NEW'), policy => '--dir in --pol ipsec';
}
}
$marked_interfaces{$interface} = 1; $marked_interfaces{$interface} = 1;
} }

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Proxyarp.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Proxyarp.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Raw.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Raw.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2009-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2009-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -91,7 +91,7 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
my $disposition = $action; my $disposition = $action;
my $exception_rule = ''; my $exception_rule = '';
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_condition( $switch , $chainref->{name} );
my $level = ''; my $level = '';
if ( $action =~ /^(?:NFLOG|ULOG)/ ) { if ( $action =~ /^(?:NFLOG|ULOG)/ ) {
@@ -138,6 +138,14 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
require_capability 'CT_TARGET', 'CT entries in the conntrack file', ''; require_capability 'CT_TARGET', 'CT entries in the conntrack file', '';
if ( $proto ne '-' ) {
if ( $proto =~ s/:all$// ) {
fatal_error '":all" may only be used with TCP' unless resolve_proto( $proto ) == TCP;
} else {
$proto = TCP . ':syn' if $proto !~ /:syn/ && resolve_proto( $proto ) == TCP;
}
}
if ( $option eq 'notrack' ) { if ( $option eq 'notrack' ) {
fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args; fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args;
$action = 'CT --notrack'; $action = 'CT --notrack';
@@ -199,7 +207,9 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
expand_rule( $chainref , expand_rule( $chainref ,
$restriction , $restriction ,
'', '',
$rule, do_proto( $proto, $ports, $sports ) .
do_user ( $user ) .
do_condition( $switch , $chainref->{name} ),
$source , $source ,
$dest , $dest ,
'' , '' ,

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Rules.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Rules.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -1159,7 +1159,7 @@ sub setup_syn_flood_chains() {
add_rule $synchainref , "${limit}-j RETURN"; add_rule $synchainref , "${limit}-j RETURN";
log_irule_limit( $level , log_irule_limit( $level ,
$synchainref , $synchainref ,
$chainref->{name} , $synchainref->{name} ,
'DROP', 'DROP',
@{$globals{LOGILIMIT}} ? $globals{LOGILIMIT} : [ limit => "--limit 5/min --limit-burst 5" ] , @{$globals{LOGILIMIT}} ? $globals{LOGILIMIT} : [ limit => "--limit 5/min --limit-burst 5" ] ,
'' , '' ,
@@ -1447,7 +1447,7 @@ sub new_action( $$$$$$ ) {
my ( $action , $type, $options , $actionfile , $state, $proto ) = @_; my ( $action , $type, $options , $actionfile , $state, $proto ) = @_;
fatal_error "Invalid action name($action)" if reserved_name( $action ); 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 };
@@ -1457,11 +1457,7 @@ sub new_action( $$$$$$ ) {
# #
# Create and record a log action chain -- Log action chains have names # Create and record a log action chain -- Log action chains have names
# that are formed from the action name by prepending a "%" and appending # that are formed from the action name by prepending a "%" and appending
# a 1- or 2-digit sequence number. In the functions that follow, # a 1- or 2-digit sequence number.
# the $chain, $level and $tag variables serve as arguments to the user's
# exit. We call the exit corresponding to the name of the action but we
# set $chain to the name of the iptables chain where rules are to be added.
# Similarly, $level and $tag contain the log level and log tag respectively.
# #
# The maximum length of a chain name is 30 characters -- since the log # The maximum length of a chain name is 30 characters -- since the log
# action chain name is 2-3 characters longer than the base chain name, # action chain name is 2-3 characters longer than the base chain name,

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Tc.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Tc.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2007-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Traffic Control is from tc4shorewall Version 0.5 # Traffic Control is from tc4shorewall Version 0.5
# (c) 2005 Arne Bernin <arne@ucbering.de> # (c) 2005 Arne Bernin <arne@ucbering.de>

View File

@@ -1,9 +1,9 @@
# #
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Zones.pm # Shorewall 5.1 -- /usr/share/shorewall/Shorewall/Zones.pm
# #
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
# #
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net) # (c) 2007,2008,2009,2010,2011-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #

View File

@@ -1,4 +1,4 @@
# (c) 1999-2017 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
# #
# This program is part of Shorewall. # This program is part of Shorewall.
# #
@@ -1065,8 +1065,6 @@ clear_firewall() {
run_iptables -F run_iptables -F
qt $IPTABLES -t raw -F qt $IPTABLES -t raw -F
echo 1 > /proc/sys/net/ipv4/ip_forward
if [ -n "$DISABLE_IPV6" ]; then if [ -n "$DISABLE_IPV6" ]; then
if [ -x $IP6TABLES ]; then if [ -x $IP6TABLES ]; then
$IP6TABLES -P INPUT ACCEPT 2> /dev/null $IP6TABLES -P INPUT ACCEPT 2> /dev/null
@@ -1375,8 +1373,6 @@ clear_firewall() {
run_iptables -F run_iptables -F
qt $IP6TABLES -t raw -F qt $IP6TABLES -t raw -F
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
run_clear_exit run_clear_exit
set_state "Cleared" set_state "Cleared"

View File

@@ -1,5 +1,23 @@
############################################################################### ###############################################################################
# Code imported from /usr/share/shorewall/prog.footer # Code imported from /usr/share/shorewall/prog.footer
#
# (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
#
# This program is part of Shorewall.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 2 of the license or, at your
# option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
############################################################################### ###############################################################################
# #
# Give Usage Information # Give Usage Information
@@ -355,6 +373,7 @@ case "$COMMAND" in
clear) clear)
[ $# -ne 1 ] && usage 2 [ $# -ne 1 ] && usage 2
progress_message3 "Clearing $g_product...." progress_message3 "Clearing $g_product...."
detect_configuration
clear_firewall clear_firewall
status=0 status=0
if [ -n "$SUBSYSLOCK" ]; then if [ -n "$SUBSYSLOCK" ]; then

View File

@@ -241,7 +241,7 @@ TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2" TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
TRACK_PROVIDERS=No TRACK_PROVIDERS=Yes
TRACK_RULES=No TRACK_RULES=No

View File

@@ -2,7 +2,7 @@
# #
# Script to install Shoreline Firewall # Script to install Shoreline Firewall
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://shorewall.net # Shorewall documentation is available at http://shorewall.net
# #

View File

@@ -1,7 +1,7 @@
# #
# Shorewall 5.0 -- /usr/share/shorewall/lib.cli-std. # Shorewall 5.1 -- /usr/share/shorewall/lib.cli-std.
# #
# (c) 1999-2015 - Tom Eastep (teastep@shorewall.net) # (c) 1999-2018 - Tom Eastep (teastep@shorewall.net)
# #
# Complete documentation is available at http://shorewall.net # Complete documentation is available at http://shorewall.net
# #
@@ -47,11 +47,10 @@ get_config() {
fi fi
fi fi
if [ "$(id -u)" -eq 0 ]; then if [ -n "$g_shorewalldir" ]; then
config=$(find_file ${PRODUCT}.conf)
else
[ -n "$g_shorewalldir" ] || fatal_error "Ordinary users may not $COMMAND the $CONFDIR/$PRODUCT configuration"
config="$g_shorewalldir/$PRODUCT.conf" config="$g_shorewalldir/$PRODUCT.conf"
else
config=$(find_file ${PRODUCT}.conf)
fi fi
if [ -f $config ]; then if [ -f $config ]; then
@@ -342,8 +341,12 @@ get_config() {
fi fi
fi fi
if [ -n "$DYNAMIC_BLACKLIST" ]; then if [ -n "$DYNAMIC_BLACKLIST" -a "$(id -u)" = 0 ]; then
setup_dbl case $COMMAND in
blacklist|allow|drop|logdrop|reject)
setup_dbl
;;
esac
fi fi
if [ -z "$PERL_HASH_SEED" ]; then if [ -z "$PERL_HASH_SEED" ]; then
@@ -363,6 +366,17 @@ get_config() {
[ -f $lib ] && . $lib [ -f $lib ] && . $lib
} }
#
# Ensure that the effective UID is 0 or that we are dealing with a private configuration
#
ensure_root() {
if [ $(id -u) -ne 0 ]; then
if [ -z "$g_shorewalldir" -o "$g_shorewalldir" = $CONFDIR/$PRODUCT ]; then
startup_error "Ordinary users may not $COMMAND the default $PRODUCT configuration"
fi
fi
}
# #
# Determine if there are config files newer than the passed object # Determine if there are config files newer than the passed object
# #
@@ -370,20 +384,13 @@ uptodate() {
[ -x $1 ] || return 1 [ -x $1 ] || return 1
local dir local dir
local ifs
ifs="$IFS" for dir in $g_shorewalldir $(split $CONFIG_PATH); do
IFS=':' if [ -n "$(find ${dir} -maxdepth 1 -type f -newer $1 -print -quit)" ]; then
for dir in $g_shorewalldir $CONFIG_PATH; do
if [ -n "$(find ${dir} -newer $1)" ]; then
IFS="$ifs"
return 1; return 1;
fi fi
done done
IFS="$ifs"
return 0 return 0
} }
@@ -413,11 +420,7 @@ compiler() {
pc=${LIBEXECDIR}/shorewall/compiler.pl pc=${LIBEXECDIR}/shorewall/compiler.pl
if [ $(id -u) -ne 0 ]; then ensure_root
if [ -z "$g_shorewalldir" -o "$g_shorewalldir" = $CONFDIR/$PRODUCT ]; then
startup_error "Ordinary users may not $COMMAND the $CONFDIR/$PRODUCT configuration"
fi
fi
# #
# We've now set g_shorewalldir so recalculate CONFIG_PATH # We've now set g_shorewalldir so recalculate CONFIG_PATH
# #
@@ -1741,6 +1744,7 @@ compiler_command() {
compile_command $@ compile_command $@
;; ;;
refresh) refresh)
only_root
get_config Yes Yes get_config Yes Yes
shift shift
refresh_command $@ refresh_command $@
@@ -1762,11 +1766,13 @@ compiler_command() {
export_command $@ export_command $@
;; ;;
try) try)
only_root
get_config Yes get_config Yes
shift shift
try_command $@ try_command $@
;; ;;
safe-reload|safe-restart|safe-start) safe-reload|safe-restart|safe-start)
only_root
get_config Yes get_config Yes
shift shift
safe_commands $@ safe_commands $@

View File

@@ -579,14 +579,23 @@
<listitem> <listitem>
<para>A protocol name from <filename>/etc/protocols</filename> or a <para>A protocol name from <filename>/etc/protocols</filename> or a
protocol number.</para> protocol number. tcp and 6 may be optionally followed by <emphasis
role="bold">:syn </emphasis>to match only the SYN packet (first
packet in the three-way handshake).</para>
<para>Beginning with Shorewall 4.5.12, this column is labeled <para>Beginning with Shorewall 4.5.12, this column can accept a
<emphasis role="bold">PROTOS</emphasis> and can accept a comma-separated list of protocols and either <emphasis
comma-separated list of protocols. Either <emphasis
role="bold">proto</emphasis> or <emphasis role="bold">proto</emphasis> or <emphasis
role="bold">protos</emphasis> is accepted in the alternate input role="bold">protos</emphasis> is accepted in the alternate input
format.</para> format.</para>
<para>Beginning with Shorewall 5.1.11, when <emphasis
role="bold">tcp</emphasis> or <emphasis role="bold">6</emphasis> is
specified and the ACTION is <emphasis role="bold">CT</emphasis>, the
compiler will default to <emphasis role="bold">:syn</emphasis>. If
you wish the rule to match packets with any valid combination of TCP
flags, you may specify <emphasis role="bold">tcp:all</emphasis> or
<emphasis role="bold">6:all</emphasis>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@@ -2,7 +2,7 @@
# #
# Script to back uninstall Shoreline Firewall # Script to back uninstall Shoreline Firewall
# #
# (c) 2000-2016 - Tom Eastep (teastep@shorewall.net) # (c) 2000-2017 - Tom Eastep (teastep@shorewall.net)
# #
# Shorewall documentation is available at http://www.shorewall.net # Shorewall documentation is available at http://www.shorewall.net
# #

View File

@@ -216,7 +216,7 @@ TC_EXPERT=No
TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2" TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"
TRACK_PROVIDERS=No TRACK_PROVIDERS=Yes
TRACK_RULES=No TRACK_RULES=No

View File

@@ -2340,6 +2340,15 @@ gateway:~# </programlisting>
option 8 combines identical chains which can result in a smaller option 8 combines identical chains which can result in a smaller
ruleset, but it slows down the compilation of large rulesets.</para> ruleset, but it slows down the compilation of large rulesets.</para>
</listitem> </listitem>
<listitem>
<para>Rather than <command>restart</command>, use
<command>reload</command>. With the default setting of
RESTART=restart, <command>restart</command> performs
<command>stop</command> then <command>start</command>, while
<command>reload</command> avoids the <command>stop</command>
part.</para>
</listitem>
</orderedlist> </orderedlist>
</section> </section>
@@ -2367,6 +2376,14 @@ gateway:~# </programlisting>
capabiities of your system. If you system doesn't support a command, it capabiities of your system. If you system doesn't support a command, it
will generally issue a kernel log message.</para> will generally issue a kernel log message.</para>
</section> </section>
<section>
<title id="faq106">(FAQ 106) Shorewall is not starting at boot on Debian
with systemd</title>
<para><emphasis role="bold">Answer:</emphasis> To enable start at boot,
run <command>systemctl enable shorewall.service</command></para>
</section>
</section> </section>
<section id="MultiISP"> <section id="MultiISP">

View File

@@ -963,7 +963,7 @@ SMBBI(ACCEPT) { SOURCE=vpn, DEST=$FW }
###################################################################################################### ######################################################################################################
# IRC # IRC
# #
IRC(ACCEPT) { SOURCE=loc,vpn,apps:IRC_IF, DEST=net } IRC(ACCEPT) { SOURCE=loc,apps, DEST=net }
###################################################################################################### ######################################################################################################
# Rsync # Rsync
# #

View File

@@ -42,10 +42,10 @@
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>The currently-supported Shorewall <ulink <para>The currently-supported Shorewall <ulink
url="ReleaseModel.html">major release</ulink>s are 4.5 and 4.6.</para> url="ReleaseModel.html">major release</ulink>s are 5.0 and 5.1.</para>
<note> <note>
<para>Shorewall versions earlier than 4.5.0 are no longer supported; <para>Shorewall versions earlier than 5.0.0 are no longer supported;
we will try to help but we will not spend time reading earlier code we will try to help but we will not spend time reading earlier code
to try to help you solve a problem and we will not release a patch to try to help you solve a problem and we will not release a patch
to correct any defect found.</para> to correct any defect found.</para>