forked from extern/shorewall_code
Compare commits
29 Commits
5.0.9.1
...
5.0.11-bas
Author | SHA1 | Date | |
---|---|---|---|
|
72e21be89d | ||
|
1b1e2c58f9 | ||
|
d3591c071d | ||
|
decf9d3b3e | ||
|
a05623f49e | ||
|
0b9cd93769 | ||
|
d9e992b164 | ||
|
372359839b | ||
|
40dea5f597 | ||
|
4a6338d857 | ||
|
55ee0113ea | ||
|
65d5249bd8 | ||
|
0364c15be1 | ||
|
76b2b0de78 | ||
|
7c9876241c | ||
|
8b36c2c1cf | ||
|
a02c745a83 | ||
|
094fd8129c | ||
|
544be8c937 | ||
|
47557aa4f7 | ||
|
93ee4432de | ||
|
8c543ca6f8 | ||
|
e71fb3249a | ||
|
56b6db1a3d | ||
|
ea56d4ed19 | ||
|
c65721a139 | ||
|
f979ccb16d | ||
|
cd0837beb5 | ||
|
4869f61a25 |
@@ -191,6 +191,8 @@ setup_logread() {
|
|||||||
else
|
else
|
||||||
g_logread="logread"
|
g_logread="logread"
|
||||||
fi
|
fi
|
||||||
|
elif [ "$LOGFILE" = "systemd" ]; then
|
||||||
|
g_logread="journalctl -r"
|
||||||
elif [ -r $LOGFILE ]; then
|
elif [ -r $LOGFILE ]; then
|
||||||
if qt mywhich tac; then
|
if qt mywhich tac; then
|
||||||
g_logread="tac $LOGFILE"
|
g_logread="tac $LOGFILE"
|
||||||
@@ -2522,21 +2524,46 @@ hits_command() {
|
|||||||
# 'allow' command executor
|
# 'allow' command executor
|
||||||
#
|
#
|
||||||
allow_command() {
|
allow_command() {
|
||||||
|
|
||||||
[ -n "$g_debugging" ] && set -x
|
[ -n "$g_debugging" ] && set -x
|
||||||
[ $# -eq 1 ] && missing_argument
|
[ $# -eq 1 ] && missing_argument
|
||||||
|
|
||||||
if product_is_started ; then
|
if product_is_started ; then
|
||||||
|
local allowed
|
||||||
local which
|
local which
|
||||||
which='-s'
|
which='-s'
|
||||||
local range
|
local range
|
||||||
range='--src-range'
|
range='--src-range'
|
||||||
|
local dynexists
|
||||||
|
|
||||||
if ! chain_exists dynamic; then
|
if [ -n "$g_blacklistipset" ]; then
|
||||||
|
|
||||||
|
case ${IPSET:=ipset} in
|
||||||
|
*/*)
|
||||||
|
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"
|
fatal_error "Dynamic blacklisting is not enabled in the current $g_product configuration"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$g_nolock" ] || mutex_on
|
[ -n "$g_nolock" ] || mutex_on
|
||||||
|
|
||||||
while [ $# -gt 1 ]; do
|
while [ $# -gt 1 ]; do
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
allowed=''
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
from)
|
from)
|
||||||
which='-s'
|
which='-s'
|
||||||
@@ -2549,29 +2576,48 @@ allow_command() {
|
|||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
*-*)
|
*-*)
|
||||||
if qt $g_tool -D dynamic -m iprange $range $1 -j reject ||\
|
if [ -n "$g_blacklistipset" ]; then
|
||||||
qt $g_tool -D dynamic -m iprange $range $1 -j DROP ||\
|
if qt $IPSET -D $g_blacklistipset $1; then
|
||||||
qt $g_tool -D dynamic -m iprange $range $1 -j logdrop ||\
|
allowed=Yes
|
||||||
qt $g_tool -D dynamic -m iprange $range $1 -j logreject
|
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
|
then
|
||||||
echo "$1 Allowed"
|
allowed=Yes
|
||||||
else
|
fi
|
||||||
echo "$1 Not Dropped or Rejected"
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if qt $g_tool -D dynamic $which $1 -j reject ||\
|
if [ -n "$g_blacklistipset" ]; then
|
||||||
qt $g_tool -D dynamic $which $1 -j DROP ||\
|
if qt $IPSET -D $g_blacklistipset $1; then
|
||||||
qt $g_tool -D dynamic $which $1 -j logdrop ||\
|
allowed=Yes
|
||||||
qt $g_tool -D dynamic $which $1 -j logreject
|
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
|
then
|
||||||
echo "$1 Allowed"
|
allowed=Yes
|
||||||
else
|
fi
|
||||||
echo "$1 Not Dropped or Rejected"
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ -n "$allowed" ]; then
|
||||||
|
progress_message2 "$1 Allowed"
|
||||||
|
else
|
||||||
|
error_message "WARNING: $1 already allowed (not dynamically blacklisted)"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$g_nolock" ] || mutex_off
|
[ -n "$g_nolock" ] || mutex_off
|
||||||
else
|
else
|
||||||
error_message "ERROR: $g_product is not started"
|
error_message "ERROR: $g_product is not started"
|
||||||
@@ -3507,7 +3553,7 @@ blacklist_command() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
$IPSET -A $g_blacklistipset $@ || { error_message "ERROR: Address $1 not blacklisted"; return 1; }
|
$IPSET -A $g_blacklistipset $@ && progress_message2 "$1 Blacklisted" || { error_message "ERROR: Address $1 not blacklisted"; return 1; }
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@@ -7,15 +7,15 @@ PREFIX=/usr #Top-level directory for s
|
|||||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||||
LIBEXECDIR=${PREFIX}/lib #Directory for executable scripts.
|
LIBEXECDIR=${PREFIX}/lib #Directory for executable scripts.
|
||||||
PERLLIBDIR=${PREFIX}/lib/perl5/vendor_perl/5.14.2 #Directory to install Shorewall Perl module directory
|
PERLLIBDIR=${PREFIX}/lib/perl5/site-perl #Directory to install Shorewall Perl module directory
|
||||||
SBINDIR=/usr/sbin #Directory where system administration programs are installed
|
SBINDIR=/usr/sbin #Directory where system administration programs are installed
|
||||||
MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed.
|
MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed.
|
||||||
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
|
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
|
||||||
INITFILE=$PRODUCT #Name of the product's SysV init script
|
INITFILE= #Name of the product's SysV init script
|
||||||
INITSOURCE=init.suse.sh #Name of the distributed file to be installed as the SysV init script
|
INITSOURCE=init.suse.sh #Name of the distributed file to be installed as the SysV init script
|
||||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
ANNOTATED= #If non-zero, annotated configuration files are installed
|
||||||
SERVICEDIR= #Directory where .service files are installed (systems running systemd only)
|
SERVICEDIR=/usr/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
|
||||||
SERVICEFILE= #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
|
SERVICEFILE=$PRODUCT.service #Name of the file to install in $SYSTEMD. Default is $PRODUCT.service
|
||||||
SYSCONFFILE=sysconfig #Name of the distributed file to be installed in $SYSCONFDIR
|
SYSCONFFILE=sysconfig #Name of the distributed file to be installed in $SYSCONFDIR
|
||||||
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
|
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
|
||||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
# Required-Stop: $local_fs
|
# Required-Stop: $local_fs
|
||||||
# X-Stop-After: $network
|
# X-Stop-After: $network
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: Initialize the firewall at boot time
|
# Short-Description: Initialize the firewall at boot time
|
||||||
# Description: Place the firewall in a safe state at boot time prior to
|
# Description: Place the firewall in a safe state at boot time prior to
|
||||||
# bringing up the network
|
# bringing up the network
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
# Required-Start: $network $remote_fs
|
# Required-Start: $network $remote_fs
|
||||||
# Required-Stop: $network $remote_fs
|
# Required-Stop: $network $remote_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: Configure the firewall at boot time
|
# Short-Description: Configure the firewall at boot time
|
||||||
# Description: Configure the firewall according to the rules specified in
|
# Description: Configure the firewall according to the rules specified in
|
||||||
# /etc/shorewall-lite
|
# /etc/shorewall-lite
|
||||||
@@ -92,10 +92,11 @@ shorewall_start () {
|
|||||||
|
|
||||||
# stop the firewall
|
# stop the firewall
|
||||||
shorewall_stop () {
|
shorewall_stop () {
|
||||||
echo -n "Stopping \"Shorewall firewall\": "
|
|
||||||
if [ "$SAFESTOP" = 1 ]; then
|
if [ "$SAFESTOP" = 1 ]; then
|
||||||
|
echo -n "Stopping \"Shorewall Lite firewall\": "
|
||||||
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
else
|
else
|
||||||
|
echo -n "Clearing all \"Shorewall Lite firewall\" rules: "
|
||||||
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@@ -702,7 +702,9 @@
|
|||||||
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
||||||
role="bold">logdrop</emphasis>, <emphasis
|
role="bold">logdrop</emphasis>, <emphasis
|
||||||
role="bold">reject</emphasis>, or <emphasis
|
role="bold">reject</emphasis>, or <emphasis
|
||||||
role="bold">logreject</emphasis> command.</para>
|
role="bold">logreject</emphasis> command. Beginning with Shorewall
|
||||||
|
5.0.10, this command can also re-enable addresses blacklisted using
|
||||||
|
the <command>blacklist</command> command.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -1337,7 +1337,14 @@ sub push_rule( $$ ) {
|
|||||||
push @{$chainref->{rules}}, $ruleref;
|
push @{$chainref->{rules}}, $ruleref;
|
||||||
$chainref->{referenced} = 1;
|
$chainref->{referenced} = 1;
|
||||||
$chainref->{optflags} |= RETURNS_DONT_MOVE if ( $ruleref->{target} || '' ) eq 'RETURN';
|
$chainref->{optflags} |= RETURNS_DONT_MOVE if ( $ruleref->{target} || '' ) eq 'RETURN';
|
||||||
trace( $chainref, 'A', @{$chainref->{rules}}, "-A $chainref->{name} $_[1] $ruleref->{comment}" ) if $debug;
|
|
||||||
|
if ( $debug ) {
|
||||||
|
if ( $ruleref->{comment} ) {
|
||||||
|
trace( $chainref, 'A', @{$chainref->{rules}}, "-A $chainref->{name} $_[1] -m comment --comment \"$ruleref->{comment}\"" );
|
||||||
|
} else {
|
||||||
|
trace( $chainref, 'A', @{$chainref->{rules}}, "-A $chainref->{name} $_[1]" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$chainref->{complete} = 1 if $complete;
|
$chainref->{complete} = 1 if $complete;
|
||||||
|
|
||||||
@@ -4012,7 +4019,7 @@ sub delete_duplicates {
|
|||||||
my $docheck;
|
my $docheck;
|
||||||
my $duplicate = 0;
|
my $duplicate = 0;
|
||||||
|
|
||||||
if ( $baseref->{mode} == CAT_MODE ) {
|
if ( $baseref->{mode} == CAT_MODE && $baseref->{target} ) {
|
||||||
my $ports1;
|
my $ports1;
|
||||||
my @keys1 = sort( grep ! $skip{$_}, keys( %$baseref ) );
|
my @keys1 = sort( grep ! $skip{$_}, keys( %$baseref ) );
|
||||||
my $rulenum = @_;
|
my $rulenum = @_;
|
||||||
@@ -5220,6 +5227,8 @@ sub do_user( $ ) {
|
|||||||
|
|
||||||
if ( supplied $2 ) {
|
if ( supplied $2 ) {
|
||||||
$user = $2;
|
$user = $2;
|
||||||
|
$user =~ s/:$//;
|
||||||
|
|
||||||
if ( $user =~ /^(\d+)(-(\d+))?$/ ) {
|
if ( $user =~ /^(\d+)(-(\d+))?$/ ) {
|
||||||
if ( supplied $2 ) {
|
if ( supplied $2 ) {
|
||||||
fatal_error "Invalid User Range ($user)" unless $3 >= $1;
|
fatal_error "Invalid User Range ($user)" unless $3 >= $1;
|
||||||
|
@@ -165,6 +165,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
|||||||
directive_callback
|
directive_callback
|
||||||
add_ipset
|
add_ipset
|
||||||
all_ipsets
|
all_ipsets
|
||||||
|
transfer_permissions
|
||||||
|
|
||||||
$product
|
$product
|
||||||
$Product
|
$Product
|
||||||
@@ -576,6 +577,7 @@ our $max_format; # Max format value
|
|||||||
our $comment; # Current COMMENT
|
our $comment; # Current COMMENT
|
||||||
our $comments_allowed; # True if [?]COMMENT is allowed in the current file
|
our $comments_allowed; # True if [?]COMMENT is allowed in the current file
|
||||||
our $nocomment; # When true, ignore [?]COMMENT in the current file
|
our $nocomment; # When true, ignore [?]COMMENT in the current file
|
||||||
|
our $sr_comment; # When true, $comment should only be applied to the current rule
|
||||||
our $warningcount; # Used to suppress duplicate warnings about missing COMMENT support
|
our $warningcount; # Used to suppress duplicate warnings about missing COMMENT support
|
||||||
our $checkinline; # The -i option to check/compile/etc.
|
our $checkinline; # The -i option to check/compile/etc.
|
||||||
our $directive_callback; # Function to call in compiler_directive
|
our $directive_callback; # Function to call in compiler_directive
|
||||||
@@ -730,6 +732,7 @@ sub initialize( $;$$) {
|
|||||||
# Contents of last COMMENT line.
|
# Contents of last COMMENT line.
|
||||||
#
|
#
|
||||||
$comment = '';
|
$comment = '';
|
||||||
|
$sr_comment = '';
|
||||||
$warningcount = 0;
|
$warningcount = 0;
|
||||||
#
|
#
|
||||||
# Misc Globals
|
# Misc Globals
|
||||||
@@ -2155,6 +2158,47 @@ sub split_list3( $$ ) {
|
|||||||
@list2;
|
@list2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# This version spits a list on white-space with optional leading comma. It prevents double-quoted
|
||||||
|
# strings from being split.
|
||||||
|
#
|
||||||
|
sub split_list4( $ ) {
|
||||||
|
my ($list ) = @_;
|
||||||
|
my @list1 = split( /,?\s+/, $list );
|
||||||
|
my @list2;
|
||||||
|
my $element = '';
|
||||||
|
my $opencount = 0;
|
||||||
|
|
||||||
|
return @list1 unless $list =~ /"/;
|
||||||
|
|
||||||
|
@list1 = split( /(,?\s+)/, $list );
|
||||||
|
|
||||||
|
for ( my $i = 0; $i < @list1; $i += 2 ) {
|
||||||
|
my $e = $list1[$i];
|
||||||
|
|
||||||
|
if ( $e =~ /[^\\]"/ ) {
|
||||||
|
if ( $e =~ /[^\\]".*[^\\]"/ ) {
|
||||||
|
fatal_error 'Unescaped embedded quote (' . join( $list1[$i - 1], $element, $e ) . ')' if $element ne '';
|
||||||
|
push @list2, $e;
|
||||||
|
} elsif ( $element ne '' ) {
|
||||||
|
fatal_error 'Quoting Error (' . join( $list1[$i - 1], $element, $e ) . ')' unless $e =~ /"$/;
|
||||||
|
push @list2, join( $list1[$i - 1], $element, $e );
|
||||||
|
$element = '';
|
||||||
|
} else {
|
||||||
|
$element = $e;
|
||||||
|
}
|
||||||
|
} elsif ( $element ne '' ) {
|
||||||
|
$element = join( $list1[$i - 1], $element, $e );
|
||||||
|
} else {
|
||||||
|
push @list2, $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fatal_error "Mismatched_quotes ($list)" if $element ne '';
|
||||||
|
|
||||||
|
@list2;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Splits the columns of a config file record
|
# Splits the columns of a config file record
|
||||||
#
|
#
|
||||||
@@ -2224,6 +2268,8 @@ sub passed( $ ) {
|
|||||||
defined $val && $val ne '' && $val ne '-';
|
defined $val && $val ne '' && $val ne '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub clear_comment();
|
||||||
|
|
||||||
#
|
#
|
||||||
# Pre-process a line from a configuration file.
|
# Pre-process a line from a configuration file.
|
||||||
|
|
||||||
@@ -2247,6 +2293,8 @@ sub split_line2( $$;$$$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$inline_matches = '';
|
$inline_matches = '';
|
||||||
|
|
||||||
|
clear_comment if $sr_comment;
|
||||||
#
|
#
|
||||||
# First, see if there are double semicolons on the line; what follows will be raw iptables input
|
# First, see if there are double semicolons on the line; what follows will be raw iptables input
|
||||||
#
|
#
|
||||||
@@ -2353,18 +2401,37 @@ sub split_line2( $$;$$$ ) {
|
|||||||
$pairs =~ s/^\s*//;
|
$pairs =~ s/^\s*//;
|
||||||
$pairs =~ s/\s*$//;
|
$pairs =~ s/\s*$//;
|
||||||
|
|
||||||
my @pairs = split( /,?\s+/, $pairs );
|
my @pairs = split_list4( $pairs );
|
||||||
|
|
||||||
for ( @pairs ) {
|
for ( @pairs ) {
|
||||||
fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/;
|
fatal_error "Invalid column/value pair ($_)" unless /^(\w+)(?:=>?|:)(.+)$/;
|
||||||
my ( $column, $value ) = ( lc( $1 ), $2 );
|
my ( $column, $value ) = ( lc( $1 ), $2 );
|
||||||
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
|
|
||||||
$column = $columnsref->{$column};
|
if ( $value =~ /"$/ ) {
|
||||||
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
fatal_error "Invalid value ( $value )" unless $value =~ /^"(.*)"$/;
|
||||||
$value = $1 if $value =~ /^"([^"]+)"$/;
|
$value = $1;
|
||||||
fatal_error "Column values may not contain embedded double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/;
|
}
|
||||||
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
|
|
||||||
$line[$column] = $value;
|
if ( $column eq 'comment' ) {
|
||||||
|
if ( $comments_allowed ) {
|
||||||
|
if ( have_capability( 'COMMENTS' ) ) {
|
||||||
|
$comment = $value;
|
||||||
|
$sr_comment = 1;
|
||||||
|
} else {
|
||||||
|
warning_message '"comment" ignored -- requires comment support in iptables/Netfilter' unless $warningcount++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fatal_error '"comment" is not allowed in this file';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
|
||||||
|
$column = $columnsref->{$column};
|
||||||
|
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
||||||
|
$value = $1 if $value =~ /^"([^"]+)"$/;
|
||||||
|
$value =~ s/\\"/"/g;
|
||||||
|
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
|
||||||
|
$line[$column] = $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2394,6 +2461,7 @@ sub no_comment() {
|
|||||||
sub clear_comment() {
|
sub clear_comment() {
|
||||||
$comment = '';
|
$comment = '';
|
||||||
$nocomment = 0;
|
$nocomment = 0;
|
||||||
|
$sr_comment = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2489,7 +2557,8 @@ sub push_include() {
|
|||||||
$max_format,
|
$max_format,
|
||||||
$comment,
|
$comment,
|
||||||
$nocomment,
|
$nocomment,
|
||||||
$section_function ];
|
$section_function,
|
||||||
|
$sr_comment ];
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2513,7 +2582,8 @@ sub pop_include() {
|
|||||||
$max_format,
|
$max_format,
|
||||||
$comment,
|
$comment,
|
||||||
$nocomment,
|
$nocomment,
|
||||||
$section_function ) = @$arrayref;
|
$section_function,
|
||||||
|
$sr_comment ) = @$arrayref;
|
||||||
} else {
|
} else {
|
||||||
$currentfile = undef;
|
$currentfile = undef;
|
||||||
$currentlinenumber = 'EOF';
|
$currentlinenumber = 'EOF';
|
||||||
@@ -2882,6 +2952,7 @@ sub process_compiler_directive( $$$$ ) {
|
|||||||
if ( have_capability( 'COMMENTS' ) ) {
|
if ( have_capability( 'COMMENTS' ) ) {
|
||||||
( $comment = $line ) =~ s/^\s*\?COMMENT\s*//;
|
( $comment = $line ) =~ s/^\s*\?COMMENT\s*//;
|
||||||
$comment =~ s/\s*$//;
|
$comment =~ s/\s*$//;
|
||||||
|
$sr_comment = '';
|
||||||
} else {
|
} else {
|
||||||
directive_warning( 'Yes', "COMMENTs ignored -- require comment support in iptables/Netfilter" , $filename, $linenumber ) unless $warningcount++;
|
directive_warning( 'Yes', "COMMENTs ignored -- require comment support in iptables/Netfilter" , $filename, $linenumber ) unless $warningcount++;
|
||||||
}
|
}
|
||||||
@@ -3235,6 +3306,7 @@ sub push_open( $;$$$$ ) {
|
|||||||
push @openstack, \@a;
|
push @openstack, \@a;
|
||||||
@includestack = ();
|
@includestack = ();
|
||||||
$currentfile = undef;
|
$currentfile = undef;
|
||||||
|
$sr_comment = '';
|
||||||
open_file( $file , $max, $comments_allowed || $ca, $nc , $cf );
|
open_file( $file , $max, $comments_allowed || $ca, $nc , $cf );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5089,6 +5161,19 @@ sub update_default($$) {
|
|||||||
$config{$var} = $val unless defined $config{$var};
|
$config{$var} = $val unless defined $config{$var};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Transfer the permissions from an old .bak file to a newly-created file
|
||||||
|
#
|
||||||
|
sub transfer_permissions( $$ ) {
|
||||||
|
my ( $old, $new ) = @_;
|
||||||
|
|
||||||
|
my @stat = stat $old;
|
||||||
|
|
||||||
|
if ( @stat ) {
|
||||||
|
fatal_error "Can't transfer permissions from $old to $new" unless chmod( $stat[2] & 0777, $new );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub update_config_file( $ ) {
|
sub update_config_file( $ ) {
|
||||||
my ( $annotate ) = @_;
|
my ( $annotate ) = @_;
|
||||||
|
|
||||||
@@ -5238,6 +5323,7 @@ EOF
|
|||||||
|
|
||||||
if ( system( "diff -q $configfile $configfile.bak > /dev/null" ) ) {
|
if ( system( "diff -q $configfile $configfile.bak > /dev/null" ) ) {
|
||||||
progress_message3 "Configuration file $configfile updated - old file renamed $configfile.bak";
|
progress_message3 "Configuration file $configfile updated - old file renamed $configfile.bak";
|
||||||
|
transfer_permissions( "$configfile.bak", $configfile );
|
||||||
} else {
|
} else {
|
||||||
if ( rename "$configfile.bak", $configfile ) {
|
if ( rename "$configfile.bak", $configfile ) {
|
||||||
progress_message3 "No update required to configuration file $configfile; $configfile.bak not saved";
|
progress_message3 "No update required to configuration file $configfile; $configfile.bak not saved";
|
||||||
@@ -5767,7 +5853,7 @@ sub get_configuration( $$$$ ) {
|
|||||||
|
|
||||||
close_file;
|
close_file;
|
||||||
|
|
||||||
warning_message "Version Mismatch: Shorewall6 is version $currentline, while the Shorewal version is $globals{VERSION}" unless $currentline eq $globals{VERSION};
|
warning_message "Version Mismatch: Shorewall6 is version $currentline, while the Shorewall version is $globals{VERSION}" unless $currentline eq $globals{VERSION};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $have_capabilities;
|
my $have_capabilities;
|
||||||
@@ -6185,8 +6271,10 @@ sub get_configuration( $$$$ ) {
|
|||||||
require_capability( 'IPSET_V5', 'DYNAMIC_BLACKLIST=ipset...', 's' );
|
require_capability( 'IPSET_V5', 'DYNAMIC_BLACKLIST=ipset...', 's' );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
default_yes_no( 'DYNAMIC_BLACKLIST' , 'Yes' );
|
default_yes_no( 'DYNAMIC_BLACKLIST', 'Yes' );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
default_yes_no( 'DYNAMIC_BLACKLIST', 'Yes' );
|
||||||
}
|
}
|
||||||
|
|
||||||
default_yes_no 'REQUIRE_INTERFACE' , '';
|
default_yes_no 'REQUIRE_INTERFACE' , '';
|
||||||
|
@@ -200,6 +200,7 @@ sub remove_blacklist( $ ) {
|
|||||||
if ( $changed ) {
|
if ( $changed ) {
|
||||||
rename $fn, "$fn.bak" or fatal_error "Unable to rename $fn to $fn.bak: $!";
|
rename $fn, "$fn.bak" or fatal_error "Unable to rename $fn to $fn.bak: $!";
|
||||||
rename "$fn.new", $fn or fatal_error "Unable to rename $fn.new to $fn: $!";
|
rename "$fn.new", $fn or fatal_error "Unable to rename $fn.new to $fn: $!";
|
||||||
|
transfer_permissions( "$fn.bak", $fn );
|
||||||
progress_message2 "\u$file file $fn saved in $fn.bak"
|
progress_message2 "\u$file file $fn saved in $fn.bak"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,6 +309,7 @@ sub convert_blacklist() {
|
|||||||
open $blrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
open $blrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
||||||
} else {
|
} else {
|
||||||
open $blrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
open $blrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
||||||
|
transfer_permissions( $fn, $fn1 );
|
||||||
print $blrules <<'EOF';
|
print $blrules <<'EOF';
|
||||||
#
|
#
|
||||||
# Shorewall version 5.0 - Blacklist Rules File
|
# Shorewall version 5.0 - Blacklist Rules File
|
||||||
@@ -401,6 +403,7 @@ sub convert_routestopped() {
|
|||||||
open $stoppedrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
open $stoppedrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
||||||
} else {
|
} else {
|
||||||
open $stoppedrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
open $stoppedrules, '>', $fn1 or fatal_error "Unable to open $fn1: $!";
|
||||||
|
transfer_permissions( $fn, $fn1 );
|
||||||
print $stoppedrules <<'EOF';
|
print $stoppedrules <<'EOF';
|
||||||
#
|
#
|
||||||
# Shorewall version 5 - Stopped Rules File
|
# Shorewall version 5 - Stopped Rules File
|
||||||
@@ -866,13 +869,30 @@ sub add_common_rules ( $ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $dbl_ipset && ! get_interface_option( $interface, 'nodbl' ) ) {
|
if ( $dbl_ipset && ( ( my $setting = get_interface_option( $interface, 'dbl' ) ) ne '0:0' ) ) {
|
||||||
add_ijump_extended( $filter_table->{input_option_chain($interface)}, j => $dbl_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset src" );
|
|
||||||
add_ijump_extended( $filter_table->{output_option_chain($interface)}, j => $dbl_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset dst" ) if $dbl_type =~ /,src-dst$/;
|
my ( $in, $out ) = split /:/, $setting;
|
||||||
|
|
||||||
|
if ( $in == 1 ) {
|
||||||
|
#
|
||||||
|
# src
|
||||||
|
#
|
||||||
|
add_ijump_extended( $filter_table->{input_option_chain($interface)}, j => $dbl_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset src" );
|
||||||
|
add_ijump_extended( $filter_table->{forward_option_chain($interface)}, j => $dbl_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset src" );
|
||||||
|
} elsif ( $in == 2 ) {
|
||||||
|
add_ijump_extended( $filter_table->{forward_option_chain($interface)}, j => $dbl_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset dst" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $out == 2 ) {
|
||||||
|
#
|
||||||
|
# dst
|
||||||
|
#
|
||||||
|
add_ijump_extended( $filter_table->{output_option_chain($interface)}, j => $dbl_target, $origin{DYNAMIC_BLACKLIST}, @state, set => "--match-set $dbl_ipset dst" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( option_chains( $interface ) ) {
|
for ( option_chains( $interface ) ) {
|
||||||
add_ijump_extended( $filter_table->{$_}, j => $dynamicref, $origin{DYNAMIC_BLACKLIST}, @state ) if $dynamicref && ! get_interface_option( $interface, 'nodbl' );
|
add_ijump_extended( $filter_table->{$_}, j => $dynamicref, $origin{DYNAMIC_BLACKLIST}, @state ) if $dynamicref && ( get_interface_option( $interface, 'dbl' ) ne '0:0' );
|
||||||
add_ijump_extended( $filter_table->{$_}, j => 'ACCEPT', $origin{FASTACCEPT}, state_imatch $faststate )->{comment} = '' if $config{FASTACCEPT};
|
add_ijump_extended( $filter_table->{$_}, j => 'ACCEPT', $origin{FASTACCEPT}, state_imatch $faststate )->{comment} = '' if $config{FASTACCEPT};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -686,6 +686,7 @@ sub process_a_provider( $ ) {
|
|||||||
interface => $interface ,
|
interface => $interface ,
|
||||||
physical => $physical ,
|
physical => $physical ,
|
||||||
optional => $optional ,
|
optional => $optional ,
|
||||||
|
wildcard => $interfaceref->{wildcard} || 0,
|
||||||
gateway => $gateway ,
|
gateway => $gateway ,
|
||||||
gatewaycase => $gatewaycase ,
|
gatewaycase => $gatewaycase ,
|
||||||
shared => $shared ,
|
shared => $shared ,
|
||||||
@@ -2113,9 +2114,31 @@ sub provider_realm( $ ) {
|
|||||||
#
|
#
|
||||||
sub handle_optional_interfaces( $ ) {
|
sub handle_optional_interfaces( $ ) {
|
||||||
|
|
||||||
my ( $interfaces, $wildcards ) = find_interfaces_by_option1 'optional';
|
my @interfaces;
|
||||||
|
my $wildcards;
|
||||||
|
|
||||||
if ( @$interfaces ) {
|
#
|
||||||
|
# First do the provider interfacess. Those that are real providers will never have wildcard physical
|
||||||
|
# names but they might derive from wildcard interface entries. Optional interfaces which do not have
|
||||||
|
# wildcard physical names are also included in the providers table.
|
||||||
|
#
|
||||||
|
for my $providerref ( grep $_->{optional} , sort { $a->{number} <=> $b->{number} } values %providers ) {
|
||||||
|
push @interfaces, $providerref->{interface};
|
||||||
|
$wildcards ||= $providerref->{wildcard};
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Now do the optional wild interfaces
|
||||||
|
#
|
||||||
|
for my $interface ( grep interface_is_optional($_) && ! $provider_interfaces{$_}, all_real_interfaces ) {
|
||||||
|
push@interfaces, $interface;
|
||||||
|
unless ( $wildcards ) {
|
||||||
|
my $interfaceref = find_interface($interface);
|
||||||
|
$wildcards = 1 if $interfaceref->{wildcard};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( @interfaces ) {
|
||||||
my $require = $config{REQUIRE_INTERFACE};
|
my $require = $config{REQUIRE_INTERFACE};
|
||||||
my $gencase = shift;
|
my $gencase = shift;
|
||||||
|
|
||||||
@@ -2126,7 +2149,7 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
#
|
#
|
||||||
# Clear the '_IS_USABLE' variables
|
# Clear the '_IS_USABLE' variables
|
||||||
#
|
#
|
||||||
emit( join( '_', 'SW', uc var_base( get_physical( $_ ) ) , 'IS_USABLE=' ) ) for @$interfaces;
|
emit( join( '_', 'SW', uc var_base( get_physical( $_ ) ) , 'IS_USABLE=' ) ) for @interfaces;
|
||||||
|
|
||||||
if ( $wildcards ) {
|
if ( $wildcards ) {
|
||||||
#
|
#
|
||||||
@@ -2143,74 +2166,76 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
emit '';
|
emit '';
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $interface ( grep $provider_interfaces{$_}, @$interfaces ) {
|
for my $interface ( @interfaces ) {
|
||||||
my $provider = $provider_interfaces{$interface};
|
if ( my $provider = $provider_interfaces{ $interface } ) {
|
||||||
my $physical = get_physical $interface;
|
my $physical = get_physical $interface;
|
||||||
my $base = uc var_base( $physical );
|
my $base = uc var_base( $physical );
|
||||||
my $providerref = $providers{$provider};
|
my $providerref = $providers{$provider};
|
||||||
|
my $interfaceref = known_interface( $interface );
|
||||||
|
my $wildbase = uc $interfaceref->{base};
|
||||||
|
|
||||||
emit( "$physical)" ), push_indent if $wildcards;
|
emit( "$physical)" ), push_indent if $wildcards;
|
||||||
|
|
||||||
if ( $provider eq $physical ) {
|
if ( $provider eq $physical ) {
|
||||||
#
|
#
|
||||||
# Just an optional interface, or provider and interface are the same
|
# Just an optional interface, or provider and interface are the same
|
||||||
#
|
#
|
||||||
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
# Provider
|
# Provider
|
||||||
#
|
#
|
||||||
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
emit qq(if [ -z "\$interface" -o "\$interface" = "$physical" ]; then);
|
||||||
}
|
}
|
||||||
|
|
||||||
push_indent;
|
|
||||||
if ( $providerref->{gatewaycase} eq 'detect' ) {
|
|
||||||
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
|
|
||||||
} else {
|
|
||||||
emit qq(if interface_is_usable $physical; then);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit( ' HAVE_INTERFACE=Yes' ) if $require;
|
|
||||||
|
|
||||||
emit( " SW_${base}_IS_USABLE=Yes" ,
|
|
||||||
'fi' );
|
|
||||||
|
|
||||||
pop_indent;
|
|
||||||
|
|
||||||
emit( "fi\n" );
|
|
||||||
|
|
||||||
emit( ';;' ), pop_indent if $wildcards;
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $interface ( grep ! $provider_interfaces{$_}, @$interfaces ) {
|
|
||||||
my $physical = get_physical $interface;
|
|
||||||
my $base = uc var_base( $physical );
|
|
||||||
my $case = $physical;
|
|
||||||
my $wild = $case =~ s/\+$/*/;
|
|
||||||
|
|
||||||
if ( $wildcards ) {
|
|
||||||
emit( "$case)" );
|
|
||||||
push_indent;
|
push_indent;
|
||||||
|
if ( $providerref->{gatewaycase} eq 'detect' ) {
|
||||||
|
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
|
||||||
|
} else {
|
||||||
|
emit qq(if interface_is_usable $physical; then);
|
||||||
|
}
|
||||||
|
|
||||||
if ( $wild ) {
|
emit( ' HAVE_INTERFACE=Yes' ) if $require;
|
||||||
emit( qq(if [ -z "\$SW_${base}_IS_USABLE" ]; then) );
|
|
||||||
|
emit( " SW_${base}_IS_USABLE=Yes" );
|
||||||
|
emit( " SW_${wildbase}_IS_USABLE=Yes" ) if $interfaceref->{wildcard};
|
||||||
|
emit( 'fi' );
|
||||||
|
|
||||||
|
pop_indent;
|
||||||
|
|
||||||
|
emit( "fi\n" );
|
||||||
|
|
||||||
|
emit( ';;' ), pop_indent if $wildcards;
|
||||||
|
} else {
|
||||||
|
my $physical = get_physical $interface;
|
||||||
|
my $base = uc var_base( $physical );
|
||||||
|
my $case = $physical;
|
||||||
|
my $wild = $case =~ s/\+$/*/;
|
||||||
|
|
||||||
|
if ( $wildcards ) {
|
||||||
|
emit( "$case)" );
|
||||||
push_indent;
|
push_indent;
|
||||||
emit ( 'if interface_is_usable $interface; then' );
|
|
||||||
|
if ( $wild ) {
|
||||||
|
emit( qq(if [ -z "\$SW_${base}_IS_USABLE" ]; then) );
|
||||||
|
push_indent;
|
||||||
|
emit ( 'if interface_is_usable $interface; then' );
|
||||||
|
} else {
|
||||||
|
emit ( "if interface_is_usable $physical; then" );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
emit ( "if interface_is_usable $physical; then" );
|
emit ( "if interface_is_usable $physical; then" );
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
emit ( "if interface_is_usable $physical; then" );
|
|
||||||
}
|
|
||||||
|
|
||||||
emit ( ' HAVE_INTERFACE=Yes' ) if $require;
|
emit ( ' HAVE_INTERFACE=Yes' ) if $require;
|
||||||
emit ( " SW_${base}_IS_USABLE=Yes" ,
|
emit ( " SW_${base}_IS_USABLE=Yes" ,
|
||||||
'fi' );
|
'fi' );
|
||||||
|
|
||||||
if ( $wildcards ) {
|
if ( $wildcards ) {
|
||||||
pop_indent, emit( 'fi' ) if $wild;
|
pop_indent, emit( 'fi' ) if $wild;
|
||||||
emit( ';;' );
|
emit( ';;' );
|
||||||
pop_indent;
|
pop_indent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -369,11 +369,18 @@ sub setup_conntrack($) {
|
|||||||
my $conntrack;
|
my $conntrack;
|
||||||
my $empty = 1;
|
my $empty = 1;
|
||||||
my $date = compiletime;
|
my $date = compiletime;
|
||||||
|
my $fn1 = find_writable_file 'conntrack';
|
||||||
|
|
||||||
if ( $fn ) {
|
$fn = open_file( 'notrack' , 3, 1 ) || fatal_error "Unable to open the notrack file for conversion: $!";
|
||||||
open $conntrack, '>>', $fn or fatal_error "Unable to open $fn for notrack conversion: $!";
|
|
||||||
|
if ( -f $fn1 ) {
|
||||||
|
open $conntrack, '>>', $fn1 or fatal_error "Unable to open $fn for notrack conversion: $!";
|
||||||
} else {
|
} else {
|
||||||
open $conntrack, '>', $fn = find_file 'conntrack' or fatal_error "Unable to open $fn for notrack conversion: $!";
|
open $conntrack, '>' , $fn1 or fatal_error "Unable to open $fn for notrack conversion: $!";
|
||||||
|
#
|
||||||
|
# Transfer permissions from the existing notrack file
|
||||||
|
#
|
||||||
|
transfer_permissions( $fn, $fn1 );
|
||||||
|
|
||||||
print $conntrack <<'EOF';
|
print $conntrack <<'EOF';
|
||||||
#
|
#
|
||||||
@@ -396,8 +403,6 @@ EOF
|
|||||||
"# Rules generated from notrack file $fn by Shorewall $globals{VERSION} - $date\n" ,
|
"# Rules generated from notrack file $fn by Shorewall $globals{VERSION} - $date\n" ,
|
||||||
"#\n" );
|
"#\n" );
|
||||||
|
|
||||||
$fn = open_file( 'notrack' , 3, 1 ) || fatal_error "Unable to open the notrack file for conversion: $!";
|
|
||||||
|
|
||||||
while ( read_a_line( PLAIN_READ ) ) {
|
while ( read_a_line( PLAIN_READ ) ) {
|
||||||
#
|
#
|
||||||
# Don't copy the header comments from the old notrack file
|
# Don't copy the header comments from the old notrack file
|
||||||
|
@@ -4299,7 +4299,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
DSCP => {
|
DSCP => {
|
||||||
defaultchain => 0,
|
defaultchain => POSTROUTING,
|
||||||
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
|
allowedchains => PREROUTING | FORWARD | OUTPUT | POSTROUTING,
|
||||||
minparams => 1,
|
minparams => 1,
|
||||||
maxparams => 1,
|
maxparams => 1,
|
||||||
@@ -4749,10 +4749,6 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unless ( ( $chain || $default_chain ) == OUTPUT ) {
|
|
||||||
fatal_error 'A USER/GROUP may only be specified when the SOURCE is $FW' unless $user eq '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $dest ne '-' ) {
|
if ( $dest ne '-' ) {
|
||||||
if ( $dest eq $fw ) {
|
if ( $dest eq $fw ) {
|
||||||
fatal_error 'Rules with DEST $FW must use the INPUT chain' if $designator && $designator ne INPUT;
|
fatal_error 'Rules with DEST $FW must use the INPUT chain' if $designator && $designator ne INPUT;
|
||||||
@@ -4795,6 +4791,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
fatal_error "Duplicate STATE ($_)" if $state{$_}++;
|
fatal_error "Duplicate STATE ($_)" if $state{$_}++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Call the command's processing function
|
# Call the command's processing function
|
||||||
#
|
#
|
||||||
@@ -4805,12 +4802,23 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
if ( $chain == ACTIONCHAIN ) {
|
if ( $chain == ACTIONCHAIN ) {
|
||||||
fatal_error "$cmd rules are not allowed in the $chainlabels{$chain} chain" unless $commandref->{allowedchains} & $chainref->{allowedchains};
|
fatal_error "$cmd rules are not allowed in the $chainlabels{$chain} chain" unless $commandref->{allowedchains} & $chainref->{allowedchains};
|
||||||
$chainref->{allowedchains} &= $commandref->{allowedchains};
|
$chainref->{allowedchains} &= $commandref->{allowedchains};
|
||||||
|
$chainref->{allowedchains} &= (OUTPUT | POSTROUTING ) if $user ne '-';
|
||||||
} else {
|
} else {
|
||||||
|
#
|
||||||
|
# Inline within one of the standard chains
|
||||||
|
#
|
||||||
fatal_error "$cmd rules are not allowed in the $chainlabels{$chain} chain" unless $commandref->{allowedchains} & $chain;
|
fatal_error "$cmd rules are not allowed in the $chainlabels{$chain} chain" unless $commandref->{allowedchains} & $chain;
|
||||||
|
unless ( $chain == OUTPUT || $chain == POSTROUTING ) {
|
||||||
|
fatal_error 'A USER/GROUP may only be specified when the SOURCE is $FW' unless $user eq '-';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$resolve_chain->();
|
$resolve_chain->();
|
||||||
fatal_error "$cmd rules are not allowed in the $chainlabels{$chain} chain" unless $commandref->{allowedchains} & $chain;
|
fatal_error "$cmd rules are not allowed in the $chainlabels{$chain} chain" unless $commandref->{allowedchains} & $chain;
|
||||||
|
unless ( $chain == OUTPUT || $chain == POSTROUTING ) {
|
||||||
|
fatal_error 'A USER/GROUP may only be specified when the SOURCE is $FW' unless $user eq '-';
|
||||||
|
}
|
||||||
|
|
||||||
$chainref = ensure_chain( 'mangle', $chainnames{$chain} );
|
$chainref = ensure_chain( 'mangle', $chainnames{$chain} );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4976,6 +4984,13 @@ sub process_tc_rule1( $$$$$$$$$$$$$$$$ ) {
|
|||||||
$mark = $rest;
|
$mark = $rest;
|
||||||
} elsif ( supplied $2 ) {
|
} elsif ( supplied $2 ) {
|
||||||
$mark = $2;
|
$mark = $2;
|
||||||
|
if ( supplied $mark && $command eq 'IPMARK' ) {
|
||||||
|
my @params = split ',', $mark;
|
||||||
|
$params[1] = '0xff' unless supplied $params[1];
|
||||||
|
$params[2] = '0x00' unless supplied $params[2];
|
||||||
|
$params[3] = '0' unless supplied $params[3];
|
||||||
|
$mark = join ',', @params;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$mark = '';
|
$mark = '';
|
||||||
}
|
}
|
||||||
@@ -4986,7 +5001,7 @@ sub process_tc_rule1( $$$$$$$$$$$$$$$$ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$command = ( $command ? "$command($mark)" : $mark ) . $designator;
|
$command = ( $command ? supplied $mark ? "$command($mark)" : $command : $mark ) . $designator;
|
||||||
my $line = ( $family == F_IPV6 ?
|
my $line = ( $family == F_IPV6 ?
|
||||||
"$command\t$source\t$dest\t$proto\t$ports\t$sports\t$user\t$testval\t$length\t$tos\t$connbytes\t$helper\t$headers\t$probability\t$dscp\t$state" :
|
"$command\t$source\t$dest\t$proto\t$ports\t$sports\t$user\t$testval\t$length\t$tos\t$connbytes\t$helper\t$headers\t$probability\t$dscp\t$state" :
|
||||||
"$command\t$source\t$dest\t$proto\t$ports\t$sports\t$user\t$testval\t$length\t$tos\t$connbytes\t$helper\t$probability\t$dscp\t$state" );
|
"$command\t$source\t$dest\t$proto\t$ports\t$sports\t$user\t$testval\t$length\t$tos\t$connbytes\t$helper\t$probability\t$dscp\t$state" );
|
||||||
|
@@ -350,9 +350,10 @@ sub process_simple_device() {
|
|||||||
|
|
||||||
for ( my $i = 1; $i <= 3; $i++ ) {
|
for ( my $i = 1; $i <= 3; $i++ ) {
|
||||||
my $prio = 16 | $i;
|
my $prio = 16 | $i;
|
||||||
|
my $j = $i + 3;
|
||||||
emit "run_tc qdisc add dev $physical parent $number:$i handle ${number}${i}: sfq quantum 1875 limit 127 perturb 10";
|
emit "run_tc qdisc add dev $physical parent $number:$i handle ${number}${i}: sfq quantum 1875 limit 127 perturb 10";
|
||||||
emit "run_tc filter add dev $physical protocol all prio $prio parent $number: handle $i fw classid $number:$i";
|
emit "run_tc filter add dev $physical protocol all prio $prio parent $number: handle $i fw classid $number:$i";
|
||||||
emit "run_tc filter add dev $physical protocol all prio 1 parent ${number}$i: flow hash keys $type divisor 1024" if $type ne '-' && have_capability 'FLOW_FILTER';
|
emit "run_tc filter add dev $physical protocol all prio 1 parent ${number}$i: handle $j flow hash keys $type divisor 1024" if $type ne '-' && have_capability 'FLOW_FILTER';
|
||||||
emit '';
|
emit '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2234,13 +2235,19 @@ sub convert_tos($$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub open_mangle_for_output() {
|
sub open_mangle_for_output( $ ) {
|
||||||
|
my ($fn ) = @_;
|
||||||
my ( $mangle, $fn1 );
|
my ( $mangle, $fn1 );
|
||||||
|
|
||||||
if ( -f ( $fn1 = find_writable_file( 'mangle' ) ) ) {
|
if ( -f ( $fn1 = find_writable_file( 'mangle' ) ) ) {
|
||||||
open( $mangle , '>>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
open( $mangle , '>>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
||||||
} else {
|
} else {
|
||||||
open( $mangle , '>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
open( $mangle , '>', $fn1 ) || fatal_error "Unable to open $fn1:$!";
|
||||||
|
#
|
||||||
|
# Transfer permissions from the existing tcrules file to the new mangle file
|
||||||
|
#
|
||||||
|
transfer_permissions( $fn, $fn1 );
|
||||||
|
|
||||||
print $mangle <<'EOF';
|
print $mangle <<'EOF';
|
||||||
#
|
#
|
||||||
# Shorewall version 4 - Mangle File
|
# Shorewall version 4 - Mangle File
|
||||||
@@ -2326,7 +2333,7 @@ sub setup_tc( $ ) {
|
|||||||
#
|
#
|
||||||
# We are going to convert this tcrules file to the equivalent mangle file
|
# We are going to convert this tcrules file to the equivalent mangle file
|
||||||
#
|
#
|
||||||
( $mangle, $fn1 ) = open_mangle_for_output;
|
( $mangle, $fn1 ) = open_mangle_for_output( $fn );
|
||||||
|
|
||||||
directive_callback( sub () { print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT'; 0; } );
|
directive_callback( sub () { print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT'; 0; } );
|
||||||
|
|
||||||
@@ -2376,7 +2383,7 @@ sub setup_tc( $ ) {
|
|||||||
#
|
#
|
||||||
# We are going to convert this tosfile to the equivalent mangle file
|
# We are going to convert this tosfile to the equivalent mangle file
|
||||||
#
|
#
|
||||||
( $mangle, $fn1 ) = open_mangle_for_output;
|
( $mangle, $fn1 ) = open_mangle_for_output( $fn );
|
||||||
convert_tos( $mangle, $fn1 );
|
convert_tos( $mangle, $fn1 );
|
||||||
close $mangle;
|
close $mangle;
|
||||||
}
|
}
|
||||||
|
@@ -337,6 +337,7 @@ sub initialize( $$ ) {
|
|||||||
arp_ignore => ENUM_IF_OPTION,
|
arp_ignore => ENUM_IF_OPTION,
|
||||||
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
bridge => SIMPLE_IF_OPTION,
|
bridge => SIMPLE_IF_OPTION,
|
||||||
|
dbl => ENUM_IF_OPTION,
|
||||||
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
detectnets => OBSOLETE_IF_OPTION,
|
detectnets => OBSOLETE_IF_OPTION,
|
||||||
dhcp => SIMPLE_IF_OPTION,
|
dhcp => SIMPLE_IF_OPTION,
|
||||||
@@ -387,6 +388,7 @@ sub initialize( $$ ) {
|
|||||||
%validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION,
|
%validinterfaceoptions = ( accept_ra => NUMERIC_IF_OPTION,
|
||||||
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
blacklist => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
bridge => SIMPLE_IF_OPTION,
|
bridge => SIMPLE_IF_OPTION,
|
||||||
|
dbl => ENUM_IF_OPTION,
|
||||||
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
destonly => SIMPLE_IF_OPTION + IF_OPTION_HOST,
|
||||||
dhcp => SIMPLE_IF_OPTION,
|
dhcp => SIMPLE_IF_OPTION,
|
||||||
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
ignore => NUMERIC_IF_OPTION + IF_OPTION_WILDOK,
|
||||||
@@ -1191,6 +1193,7 @@ sub process_interface( $$ ) {
|
|||||||
my %options;
|
my %options;
|
||||||
|
|
||||||
$options{port} = 1 if $port;
|
$options{port} = 1 if $port;
|
||||||
|
$options{dbl} = $config{DYNAMIC_BLACKLIST} =~ /^ipset(-only)?,src-dst/ ? '1:2' : $config{DYNAMIC_BLACKLIST} ? '1:0' : '0:0';
|
||||||
|
|
||||||
my $hostoptionsref = {};
|
my $hostoptionsref = {};
|
||||||
|
|
||||||
@@ -1234,6 +1237,8 @@ sub process_interface( $$ ) {
|
|||||||
} else {
|
} else {
|
||||||
warning_message "The 'blacklist' option is ignored on multi-zone interfaces";
|
warning_message "The 'blacklist' option is ignored on multi-zone interfaces";
|
||||||
}
|
}
|
||||||
|
} elsif ( $option eq 'nodbl' ) {
|
||||||
|
$options{dbl} = '0:0';
|
||||||
} else {
|
} else {
|
||||||
$options{$option} = 1;
|
$options{$option} = 1;
|
||||||
$hostoptions{$option} = 1 if $hostopt;
|
$hostoptions{$option} = 1 if $hostopt;
|
||||||
@@ -1256,6 +1261,11 @@ sub process_interface( $$ ) {
|
|||||||
} else {
|
} else {
|
||||||
$options{arp_ignore} = 1;
|
$options{arp_ignore} = 1;
|
||||||
}
|
}
|
||||||
|
} elsif ( $option eq 'dbl' ) {
|
||||||
|
my %values = ( none => '0:0', src => '1:0', dst => '2:0', 'src-dst' => '1:2' );
|
||||||
|
|
||||||
|
fatal_error q(The 'dbl' option requires a value) unless defined $value;
|
||||||
|
fatal_error qq(Invalid setting ($value) for 'dbl') unless defined ( $options{dbl} = $values{$value} );
|
||||||
} else {
|
} else {
|
||||||
assert( 0 );
|
assert( 0 );
|
||||||
}
|
}
|
||||||
@@ -1577,7 +1587,7 @@ sub known_interface($)
|
|||||||
name => $i ,
|
name => $i ,
|
||||||
number => $interfaceref->{number} ,
|
number => $interfaceref->{number} ,
|
||||||
physical => $physical ,
|
physical => $physical ,
|
||||||
base => var_base( $physical ) ,
|
base => $interfaceref->{base} ,
|
||||||
wildcard => $interfaceref->{wildcard} ,
|
wildcard => $interfaceref->{wildcard} ,
|
||||||
zones => $interfaceref->{zones} ,
|
zones => $interfaceref->{zones} ,
|
||||||
};
|
};
|
||||||
@@ -1906,7 +1916,7 @@ sub verify_required_interfaces( $ ) {
|
|||||||
|
|
||||||
my $returnvalue = 0;
|
my $returnvalue = 0;
|
||||||
|
|
||||||
my $interfaces = find_interfaces_by_option 'wait';
|
my $interfaces = find_interfaces_by_option( 'wait');
|
||||||
|
|
||||||
if ( @$interfaces ) {
|
if ( @$interfaces ) {
|
||||||
my $first = 1;
|
my $first = 1;
|
||||||
@@ -1972,7 +1982,7 @@ sub verify_required_interfaces( $ ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$interfaces = find_interfaces_by_option 'required';
|
$interfaces = find_interfaces_by_option( 'required' );
|
||||||
|
|
||||||
if ( @$interfaces ) {
|
if ( @$interfaces ) {
|
||||||
|
|
||||||
@@ -2160,7 +2170,7 @@ sub process_host( ) {
|
|||||||
#
|
#
|
||||||
$interface = '%vserver%' if $type & VSERVER;
|
$interface = '%vserver%' if $type & VSERVER;
|
||||||
|
|
||||||
add_group_to_zone( $zone, $type , $interface, [ split_list( $hosts, 'host' ) ] , $optionsref, 1 );
|
add_group_to_zone( $zone, $type , $interface, [ split_list( $hosts, 'host' ) ] , $optionsref, 0 );
|
||||||
|
|
||||||
progress_message " Host \"$currentline\" validated";
|
progress_message " Host \"$currentline\" validated";
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
# Required-Start: $network $remote_fs
|
# Required-Start: $network $remote_fs
|
||||||
# Required-Stop: $network $remote_fs
|
# Required-Stop: $network $remote_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: Configure the firewall at boot time
|
# Short-Description: Configure the firewall at boot time
|
||||||
# Description: Configure the firewall according to the rules specified in
|
# Description: Configure the firewall according to the rules specified in
|
||||||
# /etc/shorewall
|
# /etc/shorewall
|
||||||
@@ -97,10 +97,11 @@ shorewall_start () {
|
|||||||
|
|
||||||
# stop the firewall
|
# stop the firewall
|
||||||
shorewall_stop () {
|
shorewall_stop () {
|
||||||
echo -n "Stopping \"Shorewall firewall\": "
|
|
||||||
if [ "$SAFESTOP" = 1 ]; then
|
if [ "$SAFESTOP" = 1 ]; then
|
||||||
|
echo -n "Stopping \"Shorewall firewall\": "
|
||||||
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
else
|
else
|
||||||
|
echo -n "Clearing all \"Shorewall firewall\" rules: "
|
||||||
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -145,7 +146,7 @@ case "$1" in
|
|||||||
restart)
|
restart)
|
||||||
shorewall_restart
|
shorewall_restart
|
||||||
;;
|
;;
|
||||||
force0reload|reload)
|
force-reload|reload)
|
||||||
shorewall_reload
|
shorewall_reload
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
|
@@ -306,6 +306,72 @@ loc eth2 -</programlisting>
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><emphasis
|
||||||
|
role="bold">dbl={none|src|dst|src-dst}</emphasis></term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shorewall 5.0.10. This option defined whether
|
||||||
|
or not dynamic blacklisting is applied to packets entering the
|
||||||
|
firewall through this interface and whether the source address
|
||||||
|
and/or destination address is to be compared against the
|
||||||
|
ipset-based dynamic blacklist (DYNAMIC_BLACKLIST=ipset... in
|
||||||
|
<ulink
|
||||||
|
url="manpages/shorewall.conf.html">shorewall.conf(5)</ulink>).
|
||||||
|
The default is determine by the setting of
|
||||||
|
DYNAMIC_BLACKLIST:</para>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term>DYNAMIC_BLACKLIST=No</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Default is <emphasis role="bold">none</emphasis>
|
||||||
|
(e.g., no dynamic blacklist checking).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>DYNAMIC_BLACKLIST=Yes</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Default is <emphasis role="bold">src</emphasis>
|
||||||
|
(e.g., the source IP address is checked).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>DYNAMIC_BLACKLIST=ipset[-only]</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Default is <emphasis
|
||||||
|
role="bold">src</emphasis>.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>DYNAMIC_BLACKLIST=ipset[-only],src-dst...</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Default is <emphasis
|
||||||
|
role="bold">src-dst</emphasis> (e.g., the source IP
|
||||||
|
addresses in checked against the ipset on input and the
|
||||||
|
destination IP address is checked against the ipset on
|
||||||
|
packets originating from the firewall and leaving
|
||||||
|
through this interface).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
|
||||||
|
<para>The normal setting for this option will be <emphasis
|
||||||
|
role="bold">dst</emphasis> or <emphasis
|
||||||
|
role="bold">none</emphasis> for internal interfaces and
|
||||||
|
<emphasis role="bold">src</emphasis> or <emphasis
|
||||||
|
role="bold">src-dst</emphasis> for Internet-facing
|
||||||
|
interfaces.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">destonly</emphasis></term>
|
<term><emphasis role="bold">destonly</emphasis></term>
|
||||||
|
|
||||||
@@ -348,7 +414,7 @@ loc eth2 -</programlisting>
|
|||||||
url="../bridge-Shorewall-perl.html">Shorewall-perl for
|
url="../bridge-Shorewall-perl.html">Shorewall-perl for
|
||||||
firewall/bridging</ulink>, then you need to include
|
firewall/bridging</ulink>, then you need to include
|
||||||
DHCP-specific rules in <ulink
|
DHCP-specific rules in <ulink
|
||||||
url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(8).
|
url="/manpages/shorewall-rules.html">shorewall-rules</ulink>(5).
|
||||||
DHCP uses UDP ports 67 and 68.</para>
|
DHCP uses UDP ports 67 and 68.</para>
|
||||||
</note>
|
</note>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -380,7 +446,7 @@ loc eth2 -</programlisting>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>loopback</term>
|
<term><emphasis role="bold">loopback</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.6.6. Designates the interface as
|
<para>Added in Shorewall 4.6.6. Designates the interface as
|
||||||
@@ -451,8 +517,8 @@ loc eth2 -</programlisting>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis role="bold"><emphasis
|
||||||
role="bold">mss</emphasis>=<emphasis>number</emphasis></term>
|
role="bold">mss</emphasis>=</emphasis><emphasis>number</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.0.3. Causes forwarded TCP SYN
|
<para>Added in Shorewall 4.0.3. Causes forwarded TCP SYN
|
||||||
@@ -493,7 +559,10 @@ loc eth2 -</programlisting>
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 5.0.8. When specified, dynamic
|
<para>Added in Shorewall 5.0.8. When specified, dynamic
|
||||||
blacklisting is disabled on the interface.</para>
|
blacklisting is disabled on the interface. Beginning with
|
||||||
|
Shorewall 5.0.10, <emphasis role="bold">nodbl</emphasis> is
|
||||||
|
equivalent to <emphasis
|
||||||
|
role="bold">dbl=none</emphasis>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -355,7 +355,8 @@ DIVERTHA - - tcp</programlisting>
|
|||||||
EF => 0x2e</programlisting>
|
EF => 0x2e</programlisting>
|
||||||
|
|
||||||
<para>To indicate more than one class, add their hex values
|
<para>To indicate more than one class, add their hex values
|
||||||
together and specify the result.</para>
|
together and specify the result. By default, DSCP rules are
|
||||||
|
placed in the POSTROUTING chain.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -1354,7 +1354,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>]</term>
|
role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>|<option>systemd</option>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This parameter tells the /sbin/shorewall program where to look
|
<para>This parameter tells the /sbin/shorewall program where to look
|
||||||
@@ -1364,7 +1364,10 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
||||||
If not assigned or if assigned an empty value, /var/log/messages is
|
If not assigned or if assigned an empty value, /var/log/messages is
|
||||||
assumed. For further information, see <ulink
|
assumed. For further information, see <ulink
|
||||||
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.</para>
|
url="/shorewall_logging.html">http://www.shorewall.net/shorewall_logging.html</ulink>.
|
||||||
|
Beginning with Shorewall 5.0.10.1, you may specify
|
||||||
|
<option>systemd</option> to use <command>journelctl -r</command> to
|
||||||
|
read the log.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -964,7 +964,9 @@
|
|||||||
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
||||||
role="bold">logdrop</emphasis>, <emphasis
|
role="bold">logdrop</emphasis>, <emphasis
|
||||||
role="bold">reject</emphasis>, or <emphasis
|
role="bold">reject</emphasis>, or <emphasis
|
||||||
role="bold">logreject</emphasis> command.</para>
|
role="bold">logreject</emphasis> command. Beginning with Shorewall
|
||||||
|
5.0.10, this command can also re-enable addresses blacklisted using
|
||||||
|
the <command>blacklist</command> command.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
# Required-Start: $network $remote_fs
|
# Required-Start: $network $remote_fs
|
||||||
# Required-Stop: $network $remote_fs
|
# Required-Stop: $network $remote_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: Configure the firewall at boot time
|
# Short-Description: Configure the firewall at boot time
|
||||||
# Description: Configure the firewall according to the rules specified in
|
# Description: Configure the firewall according to the rules specified in
|
||||||
# /etc/shorewall6-lite
|
# /etc/shorewall6-lite
|
||||||
@@ -92,10 +92,11 @@ shorewall6_start () {
|
|||||||
|
|
||||||
# stop the firewall
|
# stop the firewall
|
||||||
shorewall6_stop () {
|
shorewall6_stop () {
|
||||||
echo -n "Stopping \"Shorewall6 Lite firewall\": "
|
|
||||||
if [ "$SAFESTOP" = 1 ]; then
|
if [ "$SAFESTOP" = 1 ]; then
|
||||||
|
echo -n "Stopping \"Shorewall6 Lite firewall\": "
|
||||||
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
else
|
else
|
||||||
|
echo -n "Clearing all \"Shorewall6 Lite firewall\" rules: "
|
||||||
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@@ -679,7 +679,9 @@
|
|||||||
<para>Re-enables receipt of packets from hosts previously
|
<para>Re-enables receipt of packets from hosts previously
|
||||||
blacklisted by a <command>drop</command>,
|
blacklisted by a <command>drop</command>,
|
||||||
<command>logdrop</command>, <command>reject</command>, or
|
<command>logdrop</command>, <command>reject</command>, or
|
||||||
<command>logreject</command> command.</para>
|
<command>logreject</command> command. Beginning with Shorewall
|
||||||
|
5.0.10, this command can also re-enable addresses blacklisted using
|
||||||
|
the <command>blacklist</command> command.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
# Required-Start: $network $remote_fs
|
# Required-Start: $network $remote_fs
|
||||||
# Required-Stop: $network $remote_fs
|
# Required-Stop: $network $remote_fs
|
||||||
# Default-Start: S
|
# Default-Start: S
|
||||||
# Default-Stop: 0 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: Configure the firewall at boot time
|
# Short-Description: Configure the firewall at boot time
|
||||||
# Description: Configure the firewall according to the rules specified in
|
# Description: Configure the firewall according to the rules specified in
|
||||||
# /etc/shorewall6
|
# /etc/shorewall6
|
||||||
@@ -97,10 +97,11 @@ shorewall6_start () {
|
|||||||
|
|
||||||
# stop the firewall
|
# stop the firewall
|
||||||
shorewall6_stop () {
|
shorewall6_stop () {
|
||||||
echo -n "Stopping \"Shorewall6 firewall\": "
|
|
||||||
if [ "$SAFESTOP" = 1 ]; then
|
if [ "$SAFESTOP" = 1 ]; then
|
||||||
|
echo -n "Stopping \"Shorewall6 firewall\": "
|
||||||
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS stop >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
else
|
else
|
||||||
|
echo -n "Clearing all \"Shorewall6 firewall\" rules: "
|
||||||
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
$SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@@ -237,6 +237,66 @@ loc eth2 -</programlisting>
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><emphasis
|
||||||
|
role="bold">dbl={none|src|dst|src-dst}</emphasis></term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Added in Shorewall 5.0.10. This option defined whether
|
||||||
|
or not dynamic blacklisting is applied to packets entering the
|
||||||
|
firewall through this interface and whether the source address
|
||||||
|
and/or destination address is to be compared against the
|
||||||
|
ipset-based dynamic blacklist (DYNAMIC_BLACKLIST=ipset... in
|
||||||
|
<ulink
|
||||||
|
url="manpages6/shorewall6.conf.html">shorewall6.conf(5)</ulink>).
|
||||||
|
The default is determine by the setting of
|
||||||
|
DYNAMIC_BLACKLIST:</para>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term>DYNAMIC_BLACKLIST=No</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Default is <emphasis role="bold">none</emphasis>
|
||||||
|
(e.g., no dynamic blacklist checking).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>DYNAMIC_BLACKLIST=Yes</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Default is <emphasis role="bold">src</emphasis>
|
||||||
|
(e.g., the source IP address is checked against the
|
||||||
|
ipset).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>DYNAMIC_BLACKLIST=ipset[-only]</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Default is <emphasis
|
||||||
|
role="bold">src</emphasis>.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>DYNAMIC_BLACKLIST=ipset[-only],src-dst...</term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Default is <emphasis
|
||||||
|
role="bold">src-dst</emphasis> (e.g., the source IP
|
||||||
|
addresses in checked against the ipset on input and the
|
||||||
|
destination IP address is checked against the ipset on
|
||||||
|
packets originating from the firewall and leaving
|
||||||
|
through this interface).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">destonly</emphasis></term>
|
<term><emphasis role="bold">destonly</emphasis></term>
|
||||||
|
|
||||||
@@ -321,7 +381,7 @@ loc eth2 -</programlisting>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>loopback</term>
|
<term><emphasis role="bold">loopback</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.6.6. Designates the interface as
|
<para>Added in Shorewall 4.6.6. Designates the interface as
|
||||||
@@ -370,7 +430,10 @@ loc eth2 -</programlisting>
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 5.0.8. When specified, dynamic
|
<para>Added in Shorewall 5.0.8. When specified, dynamic
|
||||||
blacklisting is disabled on the interface.</para>
|
blacklisting is disabled on the interface. Beginning with
|
||||||
|
Shorewall 5.0.10, <emphasis role="bold">nodbl</emphasis> is
|
||||||
|
equivalent to <emphasis
|
||||||
|
role="bold">dbl=none</emphasis>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -356,7 +356,8 @@ DIVERTHA - - tcp</programlisting>
|
|||||||
EF => 0x2e</programlisting>
|
EF => 0x2e</programlisting>
|
||||||
|
|
||||||
<para>To indicate more than one class, add their hex values
|
<para>To indicate more than one class, add their hex values
|
||||||
together and specify the result.</para>
|
together and specify the result. By default, DSCP rules are
|
||||||
|
placed in the POSTROUTING chain.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -633,7 +634,7 @@ INLINE eth0 - ; -p tcp -j MARK --set
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>The third number specifies the number of log
|
<para>The third number specifies the number of log
|
||||||
messages that should be buffered in the kernel before they
|
messages that should be buffered in the kernel before they
|
||||||
are sent to user space. The default is 1. </para>
|
are sent to user space. The default is 1.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
@@ -1166,7 +1166,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis
|
<term><emphasis
|
||||||
role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>]</term>
|
role="bold">LOGFILE=</emphasis>[<emphasis>pathname</emphasis>|<option>systemd</option>]</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This parameter tells the /sbin/shorewall6 program where to
|
<para>This parameter tells the /sbin/shorewall6 program where to
|
||||||
@@ -1175,7 +1175,9 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
role="bold">logwatch</emphasis>, <emphasis role="bold">show
|
role="bold">logwatch</emphasis>, <emphasis role="bold">show
|
||||||
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
log</emphasis>, and <emphasis role="bold">hits</emphasis> commands.
|
||||||
If not assigned or if assigned an empty value, /var/log/messages is
|
If not assigned or if assigned an empty value, /var/log/messages is
|
||||||
assumed.</para>
|
assumed. Beginning with Shorewall 5.0.10.1, you may specify
|
||||||
|
<option>systemd</option> to use <command>journelctl -r</command> to
|
||||||
|
read the log.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -932,7 +932,9 @@
|
|||||||
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
blacklisted by a <emphasis role="bold">drop</emphasis>, <emphasis
|
||||||
role="bold">logdrop</emphasis>, <emphasis
|
role="bold">logdrop</emphasis>, <emphasis
|
||||||
role="bold">reject</emphasis>, or <emphasis
|
role="bold">reject</emphasis>, or <emphasis
|
||||||
role="bold">logreject</emphasis> command.</para>
|
role="bold">logreject</emphasis> command. Beginning with Shorewall
|
||||||
|
5.0.10, this command can also re-enable addresses blacklisted using
|
||||||
|
the <command>blacklist</command> command.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para><emphasis role="bold">Shorewall6</emphasis>. This package
|
<para><emphasis role="bold">Shorewall6</emphasis>. This package
|
||||||
requires the Shorewall package and adds those components needed to
|
requires the Shorewall package and adds those components needed to
|
||||||
create an IPv6 fireawall.</para>
|
create an IPv6 firewall.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
<year>2011</year>
|
<year>2011</year>
|
||||||
|
|
||||||
|
<year>2016</year>
|
||||||
|
|
||||||
<holder>Thomas M. Eastep</holder>
|
<holder>Thomas M. Eastep</holder>
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
@@ -89,7 +91,9 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para><ulink url="two-interface.htm">Two-interface</ulink> Linux System
|
<para><ulink url="two-interface.htm">Two-interface</ulink> Linux System
|
||||||
acting as a firewall/router for a small local network</para>
|
acting as a firewall/router for a small local network. For
|
||||||
|
Redhat-specific install/configure information, see <ulink url="???">this
|
||||||
|
article </ulink>contributed by Digimer.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -398,7 +398,7 @@ ACCEPT net $FW tcp 22</programlisting>
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para><emphasis role="bold">Shorewall6</emphasis>. This package
|
<para><emphasis role="bold">Shorewall6</emphasis>. This package
|
||||||
requires the Shorewall package and adds those components needed to
|
requires the Shorewall package and adds those components needed to
|
||||||
create an IPv6 fireawall.</para>
|
create an IPv6 firewall.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
||||||
|
|
||||||
<copyright>
|
<copyright>
|
||||||
<year>2001-2013</year>
|
<year>2001-2016</year>
|
||||||
|
|
||||||
<holder>Thomas M. Eastep</holder>
|
<holder>Thomas M. Eastep</holder>
|
||||||
</copyright>
|
</copyright>
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
</articleinfo>
|
</articleinfo>
|
||||||
|
|
||||||
<caution>
|
<caution>
|
||||||
<para><emphasis role="bold">This article applies to Shorewall 4.3 and
|
<para><emphasis role="bold">This article applies to Shorewall 5.0 and
|
||||||
later. If you are running a version of Shorewall earlier than Shorewall
|
later. If you are running a version of Shorewall earlier than Shorewall
|
||||||
4.3.5 then please see the documentation for that
|
5.0.0 then please see the documentation for that
|
||||||
release.</emphasis></para>
|
release.</emphasis></para>
|
||||||
</caution>
|
</caution>
|
||||||
|
|
||||||
|
@@ -297,8 +297,8 @@ State:Stopped (Thu Mar 30 14:08:11 PDT 2006)</programlisting>
|
|||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Post the <filename>/tmp/status.txt</filename> file as an
|
<para>Post the <filename>/tmp/shorewall_dump.txt</filename> file
|
||||||
attachment compressed with gzip or bzip2.</para>
|
as an attachment compressed with gzip or bzip2.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
|
Reference in New Issue
Block a user