forked from extern/shorewall_code
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
63d7580219 | ||
|
1d1068ac74 | ||
|
5bc724c268 | ||
|
c6fab61c3d | ||
|
03a9b92a14 | ||
|
b3b637d663 | ||
|
363679bb4c | ||
|
458c26c2d6 | ||
|
e229849c5b |
@@ -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
|
||||
#
|
||||
@@ -1733,12 +1746,10 @@ do_dump_command() {
|
||||
heading "Events"
|
||||
show_events
|
||||
|
||||
if qt mywhich setkey; then
|
||||
heading "PFKEY SPD"
|
||||
setkey -DP
|
||||
heading "PFKEY SAD"
|
||||
setkey -D | grep -Ev '^[[:space:]](A:|E:)' # Don't divulge the keys
|
||||
fi
|
||||
heading "PFKEY SPD"
|
||||
$IP -s xfrm policy | spd_filter
|
||||
heading "PFKEY SAD"
|
||||
$IP -s -$g_family xfrm state | egrep -v '[[:space:]]+(auth-trunc|enc )' # Don't divulge the keys
|
||||
|
||||
heading "/proc"
|
||||
show_proc /proc/version
|
||||
|
@@ -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} ) ) ) );
|
||||
}
|
||||
|
||||
#
|
||||
|
@@ -2000,6 +2000,21 @@ sub find_writable_file($) {
|
||||
"$config_path[0]$filename";
|
||||
}
|
||||
|
||||
#
|
||||
# Determine if a value has been supplied
|
||||
#
|
||||
sub supplied( $ ) {
|
||||
my $val = shift;
|
||||
|
||||
defined $val && $val ne '';
|
||||
}
|
||||
|
||||
sub passed( $ ) {
|
||||
my $val = shift;
|
||||
|
||||
defined $val && $val ne '' && $val ne '-';
|
||||
}
|
||||
|
||||
#
|
||||
# Split a comma-separated list into a Perl array
|
||||
#
|
||||
@@ -2058,7 +2073,7 @@ sub split_list1( $$;$ ) {
|
||||
sub split_list2( $$ ) {
|
||||
my ($list, $type ) = @_;
|
||||
|
||||
fatal_error "Invalid $type ($list)" if $list =~ /^:|::/;
|
||||
fatal_error "Invalid $type ($list)" if $list =~ /^:/;
|
||||
|
||||
my @list1 = split /:/, $list;
|
||||
my @list2;
|
||||
@@ -2095,6 +2110,7 @@ sub split_list2( $$ ) {
|
||||
fatal_error "Invalid $type ($list)" if $opencount < 0;
|
||||
}
|
||||
} elsif ( $element eq '' ) {
|
||||
fatal_error "Invalid $type ($list)" unless supplied $_;
|
||||
push @list2 , $_;
|
||||
} else {
|
||||
$element = join ':', $element , $_;
|
||||
@@ -2260,21 +2276,6 @@ sub split_columns( $ ) {
|
||||
@list2;
|
||||
}
|
||||
|
||||
#
|
||||
# Determine if a value has been supplied
|
||||
#
|
||||
sub supplied( $ ) {
|
||||
my $val = shift;
|
||||
|
||||
defined $val && $val ne '';
|
||||
}
|
||||
|
||||
sub passed( $ ) {
|
||||
my $val = shift;
|
||||
|
||||
defined $val && $val ne '' && $val ne '-';
|
||||
}
|
||||
|
||||
sub clear_comment();
|
||||
|
||||
#
|
||||
|
@@ -122,7 +122,7 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
||||
fatal_error "Invalid conntrack ACTION (IPTABLES)" unless $1;
|
||||
}
|
||||
|
||||
my ( $tgt, $options ) = split( ' ', $2 );
|
||||
my ( $tgt, $options ) = split( ' ', $2, 2 );
|
||||
my $target_type = $builtin_target{$tgt};
|
||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
||||
fatal_error "The $tgt TARGET is not allowed in the raw table" unless $target_type & RAW_TABLE;
|
||||
|
@@ -638,7 +638,8 @@ sub process_a_policy1($$$$$$$) {
|
||||
my ( $client, $server, $originalpolicy, $loglevel, $synparams, $connlimit, $intrazone ) = @_;
|
||||
|
||||
my $clientwild = ( "\L$client" =~ /^all(\+)?$/ );
|
||||
$intrazone = $clientwild && $1;
|
||||
|
||||
$intrazone ||= $clientwild && $1;
|
||||
|
||||
fatal_error "Undefined zone ($client)" unless $clientwild || defined_zone( $client );
|
||||
|
||||
@@ -763,25 +764,28 @@ sub process_a_policy() {
|
||||
$synparams = '' if $synparams eq '-';
|
||||
$connlimit = '' if $connlimit eq '-';
|
||||
|
||||
my $intrazone;
|
||||
my ( $intrazone, $clientlist, $serverlist );
|
||||
|
||||
if ( $intrazone = $clients =~ /.*,.*\+$/) {
|
||||
$clients =~ s/\+$//;
|
||||
if ( $clientlist = ( $clients =~ /,/ ) ) {
|
||||
$intrazone = ( $clients =~ s/\+$// );
|
||||
}
|
||||
|
||||
if ( $servers =~ /.*,.*\+$/ ) {
|
||||
$servers =~ s/\+$//;
|
||||
$intrazone = 1;
|
||||
if ( $serverlist = ( $servers =~ /,/ ) ) {
|
||||
$intrazone ||= ( $servers =~ s/\+$// );
|
||||
}
|
||||
|
||||
fatal_error 'SOURCE must be specified' if $clients eq '-';
|
||||
fatal_error 'DEST must be specified' if $servers eq '-';
|
||||
fatal_error 'POLICY must be specified' if $policy eq '-';
|
||||
|
||||
for my $client ( split_list( $clients, 'zone' ) ) {
|
||||
for my $server ( split_list( $servers, 'zone' ) ) {
|
||||
process_a_policy1( $client, $server, $policy, $loglevel, $synparams, $connlimit, $intrazone );
|
||||
if ( $clientlist || $serverlist ) {
|
||||
for my $client ( split_list( $clients, 'zone' ) ) {
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2911,7 +2915,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
IPTABLES => sub {
|
||||
if ( $param ) {
|
||||
fatal_error "Unknown ACTION (IPTABLES)" unless $family == F_IPV4;
|
||||
my ( $tgt, $options ) = split / /, $param;
|
||||
my ( $tgt, $options ) = split / /, $param, 2;
|
||||
my $target_type = $builtin_target{$tgt};
|
||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
||||
fatal_error "The $tgt TARGET is not allowed in the filter table" unless $target_type & FILTER_TABLE;
|
||||
@@ -2924,7 +2928,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
IP6TABLES => sub {
|
||||
if ( $param ) {
|
||||
fatal_error "Unknown ACTION (IP6TABLES)" unless $family == F_IPV6;
|
||||
my ( $tgt, $options ) = split / /, $param;
|
||||
my ( $tgt, $options ) = split / /, $param, 2;
|
||||
my $target_type = $builtin_target{$tgt};
|
||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
||||
fatal_error "The $tgt TARGET is not allowed in the filter table" unless $target_type & FILTER_TABLE;
|
||||
@@ -4495,7 +4499,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
||||
maxparams => 1,
|
||||
function => sub () {
|
||||
fatal_error "Invalid ACTION (IPTABLES)" unless $family == F_IPV4;
|
||||
my ( $tgt, $options ) = split( ' ', $params );
|
||||
my ( $tgt, $options ) = split( ' ', $params, 2 );
|
||||
my $target_type = $builtin_target{$tgt};
|
||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
||||
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
|
||||
@@ -4511,7 +4515,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
||||
maxparams => 1,
|
||||
function => sub () {
|
||||
fatal_error "Invalid ACTION (IP6TABLES)" unless $family == F_IPV6;
|
||||
my ( $tgt, $options ) = split( ' ', $params );
|
||||
my ( $tgt, $options ) = split( ' ', $params, 2 );
|
||||
my $target_type = $builtin_target{$tgt};
|
||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
||||
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
|
||||
|
@@ -1235,7 +1235,7 @@ safe_commands() {
|
||||
echo "New configuration has been accepted"
|
||||
else
|
||||
if [ "$command" = "restart" -o "$command" = "reload" ]; then
|
||||
run_it ${VARDIR}/.safe restore
|
||||
run_it ${VARDIR}/.safe -r restore
|
||||
else
|
||||
run_it ${VARDIR}/.$command clear
|
||||
fi
|
||||
|
@@ -28,6 +28,7 @@
|
||||
|
||||
VERSION=xxx #The Build script inserts the actual version
|
||||
PRODUCT=shorewall
|
||||
Product=Shorewall
|
||||
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
|
Reference in New Issue
Block a user