forked from extern/shorewall_code
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ad91501e79 | ||
|
395ea90cd7 | ||
|
ce861dd0a3 | ||
|
8fca17a0ef | ||
|
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
|
||||
|
@ -16,7 +16,7 @@ RemainAfterExit=yes
|
||||
EnvironmentFile=-/etc/default/shorewall-lite
|
||||
StandardOutput=syslog
|
||||
ExecStart=/sbin/shorewall-lite $OPTIONS start $STARTOPTIONS
|
||||
ExecStop=/sbin/shorewall-lite $OPTIONS stop
|
||||
ExecStop=/sbin/shorewall-lite $OPTIONS clear
|
||||
ExecReload=/sbin/shorewall-lite $OPTIONS reload $RELOADOPTIONS
|
||||
|
||||
[Install]
|
||||
|
@ -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();
|
||||
|
||||
#
|
||||
@ -3666,6 +3667,7 @@ sub expand_variables( \$ ) {
|
||||
$usedcaller = USEDCALLER if $var eq 'caller';
|
||||
} else {
|
||||
fatal_error "Undefined shell variable (\$$var)" unless $config{IGNOREUNKNOWNVARIABLES} || exists $config{$var};
|
||||
$val = $config{$var};
|
||||
}
|
||||
|
||||
$val = '' unless defined $val;
|
||||
|
@ -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 );
|
||||
|
||||
@ -730,22 +731,21 @@ sub process_a_policy1($$$$$$$) {
|
||||
if ( $serverwild ) {
|
||||
for my $zone ( @zonelist ) {
|
||||
for my $zone1 ( @zonelist ) {
|
||||
set_policy_chain rules_chain( ${zone}, ${zone1} ), $client, $server, $chainref, $policy, $intrazone;
|
||||
set_policy_chain rules_chain( ${zone}, ${zone1} ), $zone, $zone1, $chainref, $policy, $intrazone;
|
||||
print_policy $zone, $zone1, $originalpolicy, $chain;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for my $zone ( all_zones ) {
|
||||
set_policy_chain rules_chain( ${zone}, ${server} ), $client, $server, $chainref, $policy, $intrazone;
|
||||
set_policy_chain rules_chain( ${zone}, ${server} ), $zone, $server, $chainref, $policy, $intrazone;
|
||||
print_policy $zone, $server, $originalpolicy, $chain;
|
||||
}
|
||||
}
|
||||
} elsif ( $serverwild ) {
|
||||
for my $zone ( @zonelist ) {
|
||||
set_policy_chain rules_chain( ${client}, ${zone} ), $client, $server, $chainref, $policy, $intrazone;
|
||||
set_policy_chain rules_chain( ${client}, ${zone} ), $client, $zone, $chainref, $policy, $intrazone;
|
||||
print_policy $client, $zone, $originalpolicy, $chain;
|
||||
}
|
||||
|
||||
} else {
|
||||
print_policy $client, $server, $originalpolicy, $chain;
|
||||
}
|
||||
@ -763,25 +763,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 +2914,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 +2927,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 +4498,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 +4514,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;
|
||||
|
@ -20,4 +20,4 @@
|
||||
MASQUERADE 10.0.0.0/8,\
|
||||
169.254.0.0/16,\
|
||||
172.16.0.0/12,\
|
||||
92.168.0.0/16 eth0
|
||||
192.168.0.0/16 eth0
|
||||
|
@ -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
|
||||
|
@ -16,7 +16,7 @@ RemainAfterExit=yes
|
||||
EnvironmentFile=-/etc/default/shorewall
|
||||
StandardOutput=syslog
|
||||
ExecStart=/sbin/shorewall $OPTIONS start $STARTOPTIONS
|
||||
ExecStop=/sbin/shorewall $OPTIONS stop
|
||||
ExecStop=/sbin/shorewall $OPTIONS clear
|
||||
ExecReload=/sbin/shorewall $OPTIONS reload $RELOADOPTIONS
|
||||
|
||||
[Install]
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
VERSION=xxx #The Build script inserts the actual version
|
||||
PRODUCT=shorewall
|
||||
Product=Shorewall
|
||||
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ RemainAfterExit=yes
|
||||
EnvironmentFile=-/etc/default/shorewall6-lite
|
||||
StandardOutput=syslog
|
||||
ExecStart=/sbin/shorewall6-lite $OPTIONS start
|
||||
ExecStop=/sbin/shorewall6-lite $OPTIONS stop
|
||||
ExecStop=/sbin/shorewall6-lite $OPTIONS clear
|
||||
ExecReload=/sbin/shorewall6-lite $OPTIONS reload
|
||||
|
||||
[Install]
|
||||
|
@ -16,7 +16,7 @@ RemainAfterExit=yes
|
||||
EnvironmentFile=-/etc/default/shorewall6
|
||||
StandardOutput=syslog
|
||||
ExecStart=/sbin/shorewall6 $OPTIONS start $STARTOPTIONS
|
||||
ExecStop=/sbin/shorewall6 $OPTIONS stop
|
||||
ExecStop=/sbin/shorewall6 $OPTIONS clear
|
||||
ExecReload=/sbin/shorewall6 $OPTIONS reload $RELOADOPTIONS
|
||||
|
||||
[Install]
|
||||
|
Loading…
Reference in New Issue
Block a user