forked from extern/shorewall_code
Compare commits
20 Commits
5.2.0-base
...
5.2.0.4
Author | SHA1 | Date | |
---|---|---|---|
|
ec21b03c5b | ||
|
25dcf8c5d6 | ||
|
c02b71b530 | ||
|
78269d57bc | ||
|
fc91648315 | ||
|
067f435ac5 | ||
|
2039f38faf | ||
|
07654d8f8d | ||
|
b5e8f9bd50 | ||
|
9c950082f6 | ||
|
fc44eb7516 | ||
|
bb89d509ea | ||
|
6822803802 | ||
|
66edd76b10 | ||
|
99be0ce970 | ||
|
98d5bf8f55 | ||
|
370901e873 | ||
|
c59ff50de4 | ||
|
3df5c032da | ||
|
b997bfcd97 |
@@ -1201,11 +1201,17 @@ show_saves_command() {
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
for f in ${VARDIR}/*-iptables; do
|
for f in ${VARDIR}/*-iptables; do
|
||||||
fn=$(basename $f)
|
case $f in
|
||||||
fn=${fn%-iptables}
|
*\**)
|
||||||
mtime=$(ls -lt $f | tail -n 1 | cut -d ' ' -f '6 7 8' )
|
;;
|
||||||
[ $fn = "$RESTOREFILE" ] && fn="$fn (default)"
|
*)
|
||||||
echo " $mtime ${fn%-iptables}"
|
fn=$(basename $f)
|
||||||
|
fn=${fn%-iptables}
|
||||||
|
mtime=$(ls -lt $f | tail -n 1 | cut -d ' ' -f '6 7 8' )
|
||||||
|
[ $fn = "$RESTOREFILE" ] && fn="$fn (default)"
|
||||||
|
echo " $mtime ${fn%-iptables}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -3815,7 +3821,7 @@ iprange_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ipdecimal_command() {
|
ipdecimal_command() {
|
||||||
if [ $# eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
missing_argument
|
missing_argument
|
||||||
else
|
else
|
||||||
[ $# -eq 2 ] || too_many_arguments $3
|
[ $# -eq 2 ] || too_many_arguments $3
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Apple OS X Shorewall 5.0 rc file
|
# Apple OS X Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD=apple
|
BUILD=apple
|
||||||
HOST=apple
|
HOST=apple
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Arch Linux Shorewall 5.0 rc file
|
# Arch Linux Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD= #Default is to detect the build system
|
BUILD= #Default is to detect the build system
|
||||||
HOST=archlinux
|
HOST=archlinux
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Cygwin Shorewall 5.0 rc file
|
# Cygwin Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD=cygwin
|
BUILD=cygwin
|
||||||
HOST=cygwin
|
HOST=cygwin
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Debian Shorewall 5.0 rc file
|
# Debian Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD= #Default is to detect the build system
|
BUILD= #Default is to detect the build system
|
||||||
HOST=debian
|
HOST=debian
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Debian Shorewall 5.0 rc file
|
# Debian Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD= #Default is to detect the build system
|
BUILD= #Default is to detect the build system
|
||||||
HOST=debian
|
HOST=debian
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Default Shorewall 5.0 rc file
|
# Default Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD= #Default is to detect the build system
|
BUILD= #Default is to detect the build system
|
||||||
HOST=linux #Generic Linux
|
HOST=linux #Generic Linux
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# OpenWRT Shorewall 5.0 rc file
|
# OpenWRT/LEDE Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD= #Default is to detect the build system
|
BUILD= #Default is to detect the build system
|
||||||
HOST=openwrt
|
HOST=openwrt
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# RedHat/FedoraShorewall 5.0 rc file
|
# RedHat/FedoraShorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD= #Default is to detect the build system
|
BUILD= #Default is to detect the build system
|
||||||
HOST=redhat
|
HOST=redhat
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Slackware Shorewall 5.0 rc file
|
# Slackware Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD=slackware
|
BUILD=slackware
|
||||||
HOST=slackware
|
HOST=slackware
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# SuSE Shorewall 5.0 rc file
|
# SuSE Shorewall 5.2 rc file
|
||||||
#
|
#
|
||||||
BUILD= #Default is to detect the build system
|
BUILD= #Default is to detect the build system
|
||||||
HOST=suse
|
HOST=suse
|
||||||
|
@@ -135,7 +135,7 @@ if ( $command & $RESET_CMD ) {
|
|||||||
#
|
#
|
||||||
# if the event is armed, remove it and perform the action
|
# if the event is armed, remove it and perform the action
|
||||||
#
|
#
|
||||||
perl_action_helper( $action , "-m mark --mark $mark/$mark -m recent --remove --name $event" );
|
perl_action_helper( $action , "-m mark --mark $mark/$mark -m recent --remove --name $event $srcdst" );
|
||||||
} elsif ( $command & $UPDATE_CMD ) {
|
} elsif ( $command & $UPDATE_CMD ) {
|
||||||
perl_action_helper( $action, "-m recent --update ${duration}--hitcount $hitcount --name $event $srcdst" );
|
perl_action_helper( $action, "-m recent --update ${duration}--hitcount $hitcount --name $event $srcdst" );
|
||||||
} else {
|
} else {
|
||||||
|
9
Shorewall/Macros/macro.IPFS-API
Normal file
9
Shorewall/Macros/macro.IPFS-API
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.IPFS-API
|
||||||
|
#
|
||||||
|
# This macro handles IPFS API port (commands for the IPFS daemon).
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - tcp 5001
|
9
Shorewall/Macros/macro.IPFS-gateway
Normal file
9
Shorewall/Macros/macro.IPFS-gateway
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.IPFS-gateway
|
||||||
|
#
|
||||||
|
# This macro handles the IPFS gateway to HTTP.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - tcp 8080
|
9
Shorewall/Macros/macro.IPFS-swarm
Normal file
9
Shorewall/Macros/macro.IPFS-swarm
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Shorewall -- /usr/share/shorewall/macro.IPFS-swarm
|
||||||
|
#
|
||||||
|
# This macro handles IPFS data traffic (the connection to IPFS swarm).
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
#ACTION SOURCE DEST PROTO DPORT SPORT ORIGDEST RATE USER
|
||||||
|
|
||||||
|
PARAM - - tcp 4001
|
@@ -2529,6 +2529,10 @@ sub split_rawline2( $$;$$$ ) {
|
|||||||
# Delete trailing comment
|
# Delete trailing comment
|
||||||
#
|
#
|
||||||
$currentline =~ s/\s*#.*//;
|
$currentline =~ s/\s*#.*//;
|
||||||
|
#
|
||||||
|
# Convert ${...} to $...
|
||||||
|
#
|
||||||
|
$currentline =~ s/\$\{(.*?)\}/\$$1/g;
|
||||||
|
|
||||||
my @result = &split_line2( @_ );
|
my @result = &split_line2( @_ );
|
||||||
|
|
||||||
@@ -5459,7 +5463,7 @@ sub update_config_file( $ ) {
|
|||||||
update_default( 'BLACKLIST_DEFAULT', 'AllowICMPs,dropBcasts,dropNotSyn,dropInvalid' );
|
update_default( 'BLACKLIST_DEFAULT', 'AllowICMPs,dropBcasts,dropNotSyn,dropInvalid' );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( qw/DROP_DEFAULT REJECT_DEFAULT/ ) {
|
for ( qw/DROP_DEFAULT REJECT_DEFAULT BLACKLIST_DEFAULT/ ) {
|
||||||
my $policy = $config{ $_ };
|
my $policy = $config{ $_ };
|
||||||
|
|
||||||
if ( $policy =~ /\bA_(?:Drop|Reject)\b/ ) {
|
if ( $policy =~ /\bA_(?:Drop|Reject)\b/ ) {
|
||||||
@@ -6599,7 +6603,7 @@ sub get_configuration( $$$ ) {
|
|||||||
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' , '';
|
||||||
|
|
||||||
if ( ( $val = $config{AUTOMAKE} ) !~ /^[Rr]ecursive$/ ) {
|
if ( ( $val = ( $config{AUTOMAKE} || '' ) ) !~ /^[Rr]ecursive$/ ) {
|
||||||
default_yes_no( 'AUTOMAKE' , '' ) unless $val && $val =~ /^\d{1,2}$/;
|
default_yes_no( 'AUTOMAKE' , '' ) unless $val && $val =~ /^\d{1,2}$/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -810,7 +810,7 @@ sub add_common_rules ( $ ) {
|
|||||||
$dbl_dst_target = $dbl_src_target;
|
$dbl_dst_target = $dbl_src_target;
|
||||||
}
|
}
|
||||||
} elsif ( $dbl_level ) {
|
} elsif ( $dbl_level ) {
|
||||||
my $chainref = set_optflags( new_standard_chain( $dbl_src_target = 'dbl_log' ) , DONT_OPTIMIZE | DONT_DELETE );
|
my $chainref = set_optflags( new_standard_chain( $dbl_src_target = $dbl_dst_target = 'dbl_log' ) , DONT_OPTIMIZE | DONT_DELETE );
|
||||||
|
|
||||||
log_rule_limit( $dbl_level,
|
log_rule_limit( $dbl_level,
|
||||||
$chainref,
|
$chainref,
|
||||||
|
@@ -675,7 +675,7 @@ interface_is_usable() # $1 = interface
|
|||||||
status=0
|
status=0
|
||||||
|
|
||||||
if ! loopback_interface $1; then
|
if ! loopback_interface $1; then
|
||||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != 0.0.0.0 ]; then
|
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != 0.0.0.0 ] && [ -z "$($IP -$g_family link list dev $1 2> /dev/null | fgrep 'state DOWN')" ]; then
|
||||||
if [ "$COMMAND" != enable ]; then
|
if [ "$COMMAND" != enable ]; then
|
||||||
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
||||||
status=$?
|
status=$?
|
||||||
@@ -1101,7 +1101,7 @@ interface_is_usable() # $1 = interface
|
|||||||
status=0
|
status=0
|
||||||
|
|
||||||
if [ "$1" != lo ]; then
|
if [ "$1" != lo ]; then
|
||||||
if interface_is_up $1 && [ "$(find_first_interface_address_if_any $1)" != :: ]; 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 [ "$COMMAND" != enable ]; then
|
if [ "$COMMAND" != enable ]; then
|
||||||
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
[ ! -f ${VARDIR}/${1}_disabled ] && run_isusable_exit $1
|
||||||
status=$?
|
status=$?
|
||||||
|
@@ -412,10 +412,14 @@ uptodate() {
|
|||||||
elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print)" ]; then
|
elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print)" ]; then
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
elif [ $AUTOMAKE = recursive ]; then
|
elif [ "$AUTOMAKE" = recursive ]; then
|
||||||
if [ -n "$(${find} ${dir} -newer $1 -print -quit)" ]; then
|
if [ -n "$(${find} ${dir} -newer $1 -print -quit)" ]; then
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
|
elif [ -z "$AUTOMAKE" ]; then
|
||||||
|
if [ -n "$(${find} ${dir} -maxdepth 1 -type f -newer $1 -print -quit)" ]; then
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print -quit)" ]; then
|
elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print -quit)" ]; then
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
@@ -1063,6 +1067,41 @@ restart_command() {
|
|||||||
return $rc
|
return $rc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
read_yesno_with_timeout() {
|
||||||
|
local timeout
|
||||||
|
timeout=${1:-60}
|
||||||
|
|
||||||
|
case $timeout in
|
||||||
|
*s)
|
||||||
|
;;
|
||||||
|
*m)
|
||||||
|
timeout=$((${timeout%m} * 60))
|
||||||
|
;;
|
||||||
|
*h)
|
||||||
|
timeout=$((${timeout%h} * 3600))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
read -t $timeout yn 2> /dev/null
|
||||||
|
if [ $? -eq 2 ]
|
||||||
|
then
|
||||||
|
# read doesn't support timeout
|
||||||
|
test -x /bin/bash || return 2 # bash is not installed so the feature is not available
|
||||||
|
/bin/bash -c "read -t $timeout yn ; if [ \"\$yn\" == \"y\" ] ; then exit 0 ; else exit 1 ; fi" # invoke bash and use its version of read
|
||||||
|
return $?
|
||||||
|
else
|
||||||
|
# read supports timeout
|
||||||
|
case "$yn" in
|
||||||
|
y|Y)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Safe-start/safe-reload/safe-restart Command Executor
|
# Safe-start/safe-reload/safe-restart Command Executor
|
||||||
#
|
#
|
||||||
@@ -1441,13 +1480,11 @@ remote_capture() # $* = original arguments less the command.
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -f $g_shorewalldir/${PRODUCT}.conf ] || fatal_error "Missing file: $g_shorewalldir/${PRODUCT}.conf."
|
|
||||||
|
|
||||||
g_export=Yes
|
g_export=Yes
|
||||||
|
|
||||||
ensure_config_path
|
ensure_config_path
|
||||||
|
|
||||||
get_config No
|
get_config Yes
|
||||||
|
|
||||||
g_haveconfig=Yes
|
g_haveconfig=Yes
|
||||||
|
|
||||||
@@ -1468,7 +1505,7 @@ remote_capture() # $* = original arguments less the command.
|
|||||||
[ -n "$getcaps" ] && getrc=Yes
|
[ -n "$getcaps" ] && getrc=Yes
|
||||||
|
|
||||||
if [ -n "$getrc" -o ! -s $g_shorewalldir/shorewallrc ]; then
|
if [ -n "$getrc" -o ! -s $g_shorewalldir/shorewallrc ]; then
|
||||||
progress_message2 "Getting RC file on system $system..."
|
progress_message2 "Getting shorewallrc file on system $system..."
|
||||||
|
|
||||||
if [ -n "$remote_sw_dir_path" ]; then
|
if [ -n "$remote_sw_dir_path" ]; then
|
||||||
if ! rsh_command "/sbin/shorewall-lite show rc $remote_sw_dir_path" > $g_shorewalldir/shorewallrc; then
|
if ! rsh_command "/sbin/shorewall-lite show rc $remote_sw_dir_path" > $g_shorewalldir/shorewallrc; then
|
||||||
@@ -1619,23 +1656,15 @@ remote_commands() # $* = original arguments less the command.
|
|||||||
|
|
||||||
g_export=Yes
|
g_export=Yes
|
||||||
|
|
||||||
if [ -f $g_shorewalldir/${PRODUCT}.conf ]; then
|
ensure_config_path
|
||||||
if [ -f $g_shorewalldir/params ]; then
|
|
||||||
. $g_shorewalldir/params
|
|
||||||
fi
|
|
||||||
|
|
||||||
ensure_config_path
|
get_config Yes
|
||||||
|
|
||||||
get_config No
|
g_haveconfig=Yes
|
||||||
|
|
||||||
g_haveconfig=Yes
|
if [ -z "$system" ]; then
|
||||||
|
system=$FIREWALL
|
||||||
if [ -z "$system" ]; then
|
[ -n "$system" ] || fatal_error "No system name given and the FIREWALL option is not set"
|
||||||
system=$FIREWALL
|
|
||||||
[ -n "$system" ] || fatal_error "No system name given and the FIREWALL option is not set"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
fatal_error "$g_shorewalldir/$PRODUCT.conf does not exist"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$getcaps" ]; then
|
if [ -z "$getcaps" ]; then
|
||||||
@@ -1646,7 +1675,7 @@ remote_commands() # $* = original arguments less the command.
|
|||||||
if [ -n "$getcaps" ]; then
|
if [ -n "$getcaps" ]; then
|
||||||
[ -n "$DONT_LOAD" ] && DONT_LOAD="$(echo $DONT_LOAD | tr ',' ' ')"
|
[ -n "$DONT_LOAD" ] && DONT_LOAD="$(echo $DONT_LOAD | tr ',' ' ')"
|
||||||
|
|
||||||
progress_message "Getting Capabilities on system $system..."
|
progress_message2 "Getting Capabilities on system $system..."
|
||||||
if [ $g_family -eq 4 ]; then
|
if [ $g_family -eq 4 ]; then
|
||||||
if ! rsh_command "MODULESDIR=$MODULESDIR IPTABLES=$IPTABLES DONT_LOAD=\"$DONT_LOAD\" $libexec/shorewall-lite/shorecap" > $g_shorewalldir/capabilities; then
|
if ! rsh_command "MODULESDIR=$MODULESDIR IPTABLES=$IPTABLES DONT_LOAD=\"$DONT_LOAD\" $libexec/shorewall-lite/shorecap" > $g_shorewalldir/capabilities; then
|
||||||
fatal_error "Capturing capabilities on system $system failed"
|
fatal_error "Capturing capabilities on system $system failed"
|
||||||
@@ -1662,6 +1691,7 @@ remote_commands() # $* = original arguments less the command.
|
|||||||
#
|
#
|
||||||
# Handle nonstandard remote VARDIR
|
# Handle nonstandard remote VARDIR
|
||||||
#
|
#
|
||||||
|
progress_message2 "Getting VARDIR on system $system..."
|
||||||
temp=$(rsh_command $program show config 2> /dev/null | grep ^LITEDIR | sed 's/LITEDIR is //')
|
temp=$(rsh_command $program show config 2> /dev/null | grep ^LITEDIR | sed 's/LITEDIR is //')
|
||||||
|
|
||||||
[ -n "$temp" ] && litedir="$temp"
|
[ -n "$temp" ] && litedir="$temp"
|
||||||
|
@@ -42,7 +42,8 @@
|
|||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>The techniques described in this article were superseded in
|
<para>The techniques described in this article were superseded in
|
||||||
Shorewall 4.5.19 with the introduction of Shorewall Events.</para>
|
Shorewall 4.5.19 with the introduction of <ulink
|
||||||
|
url="Events.html">Shorewall Events</ulink>.</para>
|
||||||
</note>
|
</note>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
<year>2017</year>
|
<year>2017</year>
|
||||||
|
|
||||||
|
<year>2018</year>
|
||||||
|
|
||||||
<holder>Thomas M. Eastep</holder>
|
<holder>Thomas M. Eastep</holder>
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 54 KiB |
Reference in New Issue
Block a user