Compare commits

...

6 Commits

Author SHA1 Message Date
Tom Eastep
c6fab61c3d Remove redundent test
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-12-20 14:42:20 -08:00
Tom Eastep
03a9b92a14 Use 'ip -s xfrm' to dump the SPD and SAD
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-12-20 09:30:49 -08:00
Matt Darfeuille
b3b637d663 shorewall: Correct displaying of shorewall version
Add the Product name variable to properly display the product name
when the '-v' option is passed to the script.

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-12-20 09:30:16 -08:00
Tom Eastep
363679bb4c Correct merge compatibility change
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-12-20 09:29:50 -08:00
Tom Eastep
458c26c2d6 Exercise care when merging rules including -m multiport
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-12-20 09:29:36 -08:00
Tom Eastep
e229849c5b Correct intra-zone handling in policies
Signed-off-by: Tom Eastep <teastep@shorewall.net>
2016-12-19 09:12:14 -08:00
4 changed files with 41 additions and 18 deletions

View File

@@ -1583,6 +1583,19 @@ show_status() {
} }
#
# Don't dump empty SPD entries
#
spd_filter()
{
awk \
'BEGIN { skip=0; }; \
/^src/ { skip=0; }; \
/^src 0.0.0.0\/0/ { skip=1; }; \
/^src ::\/0/ { skip=1; }; \
{ if ( skip == 0 ) print; };'
}
# #
# Dump Command Executor # Dump Command Executor
# #
@@ -1733,12 +1746,10 @@ do_dump_command() {
heading "Events" heading "Events"
show_events show_events
if qt mywhich setkey; then heading "PFKEY SPD"
heading "PFKEY SPD" $IP -s xfrm policy | spd_filter
setkey -DP heading "PFKEY SAD"
heading "PFKEY SAD" $IP -s -$g_family xfrm state | egrep -v '[[:space:]]+(auth-trunc|enc )' # Don't divulge the keys
setkey -D | grep -Ev '^[[:space:]](A:|E:)' # Don't divulge the keys
fi
heading "/proc" heading "/proc"
show_proc /proc/version show_proc /proc/version

View File

@@ -1195,9 +1195,16 @@ sub compatible( $$ ) {
} }
} }
# #
# Don't combine chains where each specifies '-m policy' # Don't combine chains where each specifies
# -m policy
# or when one specifies
# -m multiport
# and the other specifies
# --dport or --sport or -m multiport
# #
return ! ( $ref1->{policy} && $ref2->{policy} ); return ! ( $ref1->{policy} && $ref2->{policy} ||
( ( $ref1->{multiport} && ( $ref2->{dport} || $ref2->{sport} || $ref2->{multiport} ) ) ||
( $ref2->{multiport} && ( $ref1->{dport} || $ref1->{sport} ) ) ) );
} }
# #

View File

@@ -638,7 +638,8 @@ sub process_a_policy1($$$$$$$) {
my ( $client, $server, $originalpolicy, $loglevel, $synparams, $connlimit, $intrazone ) = @_; my ( $client, $server, $originalpolicy, $loglevel, $synparams, $connlimit, $intrazone ) = @_;
my $clientwild = ( "\L$client" =~ /^all(\+)?$/ ); my $clientwild = ( "\L$client" =~ /^all(\+)?$/ );
$intrazone = $clientwild && $1;
$intrazone ||= $clientwild && $1;
fatal_error "Undefined zone ($client)" unless $clientwild || defined_zone( $client ); fatal_error "Undefined zone ($client)" unless $clientwild || defined_zone( $client );
@@ -763,25 +764,28 @@ sub process_a_policy() {
$synparams = '' if $synparams eq '-'; $synparams = '' if $synparams eq '-';
$connlimit = '' if $connlimit eq '-'; $connlimit = '' if $connlimit eq '-';
my $intrazone; my ( $intrazone, $clientlist, $serverlist );
if ( $intrazone = $clients =~ /.*,.*\+$/) { if ( $clientlist = ( $clients =~ /,/ ) ) {
$clients =~ s/\+$//; $intrazone = ( $clients =~ s/\+$// );
} }
if ( $servers =~ /.*,.*\+$/ ) { if ( $serverlist = ( $servers =~ /,/ ) ) {
$servers =~ s/\+$//; $intrazone ||= ( $servers =~ s/\+$// );
$intrazone = 1;
} }
fatal_error 'SOURCE must be specified' if $clients eq '-'; fatal_error 'SOURCE must be specified' if $clients eq '-';
fatal_error 'DEST must be specified' if $servers eq '-'; fatal_error 'DEST must be specified' if $servers eq '-';
fatal_error 'POLICY must be specified' if $policy eq '-'; fatal_error 'POLICY must be specified' if $policy eq '-';
for my $client ( split_list( $clients, 'zone' ) ) { if ( $clientlist || $serverlist ) {
for my $server ( split_list( $servers, 'zone' ) ) { for my $client ( split_list( $clients, 'zone' ) ) {
process_a_policy1( $client, $server, $policy, $loglevel, $synparams, $connlimit, $intrazone ); for my $server ( split_list( $servers, 'zone' ) ) {
process_a_policy1( $client, $server, $policy, $loglevel, $synparams, $connlimit, $intrazone ) if $intrazone || $client ne $server;
}
} }
} else {
process_a_policy1( $clients, $servers, $policy, $loglevel, $synparams, $connlimit, 0 );
} }
} }

View File

@@ -28,6 +28,7 @@
VERSION=xxx #The Build script inserts the actual version VERSION=xxx #The Build script inserts the actual version
PRODUCT=shorewall PRODUCT=shorewall
Product=Shorewall
usage() # $1 = exit status usage() # $1 = exit status
{ {