mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-30 22:50:02 +02:00
Make IP[6]TABLES transparent
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
@ -292,6 +292,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
$target ,
|
$target ,
|
||||||
'' ,
|
'' ,
|
||||||
$disposition ,
|
$disposition ,
|
||||||
|
'' ,
|
||||||
'' );
|
'' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,6 +387,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
$target ,
|
$target ,
|
||||||
'' ,
|
'' ,
|
||||||
$disposition ,
|
$disposition ,
|
||||||
|
'' ,
|
||||||
'' ;
|
'' ;
|
||||||
|
|
||||||
if ( $rule2 || $jump ) {
|
if ( $rule2 || $jump ) {
|
||||||
@ -415,6 +417,7 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
|
|||||||
'' ,
|
'' ,
|
||||||
'' ,
|
'' ,
|
||||||
'' ,
|
'' ,
|
||||||
|
'' ,
|
||||||
'' );
|
'' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7428,7 +7428,7 @@ sub handle_exclusion( $$$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Returns the destination interface specified in the rule, if any.
|
# Returns the destination interface specified in the rule, if any.
|
||||||
#
|
#
|
||||||
sub expand_rule( $$$$$$$$$$$;$ )
|
sub expand_rule( $$$$$$$$$$$$;$ )
|
||||||
{
|
{
|
||||||
my ($chainref , # Chain
|
my ($chainref , # Chain
|
||||||
$restriction, # Determines what to do with interface names in the SOURCE or DEST
|
$restriction, # Determines what to do with interface names in the SOURCE or DEST
|
||||||
@ -7441,6 +7441,7 @@ sub expand_rule( $$$$$$$$$$$;$ )
|
|||||||
$loglevel , # Log level (and tag)
|
$loglevel , # Log level (and tag)
|
||||||
$disposition, # Primtive part of the target (RETURN, ACCEPT, ...)
|
$disposition, # Primtive part of the target (RETURN, ACCEPT, ...)
|
||||||
$exceptionrule,# Caller's matches used in exclusion case
|
$exceptionrule,# Caller's matches used in exclusion case
|
||||||
|
$usergenerated,# Rule came from the IP[6]TABLES target
|
||||||
$logname, # Name of chain to name in log messages
|
$logname, # Name of chain to name in log messages
|
||||||
) = @_;
|
) = @_;
|
||||||
|
|
||||||
@ -7605,9 +7606,9 @@ sub expand_rule( $$$$$$$$$$$;$ )
|
|||||||
|
|
||||||
my $cond3 = conditional_rule( $chainref, $dnet );
|
my $cond3 = conditional_rule( $chainref, $dnet );
|
||||||
|
|
||||||
if ( $loglevel eq '' ) {
|
if ( $loglevel eq '' || $usergenerated ) {
|
||||||
#
|
#
|
||||||
# No logging -- add the target rule with matches to the rule chain
|
# No logging or user-specified logging -- add the target rule with matches to the rule chain
|
||||||
#
|
#
|
||||||
if ( $targetref ) {
|
if ( $targetref ) {
|
||||||
add_expanded_jump( $chainref, $targetref , 0, $matches );
|
add_expanded_jump( $chainref, $targetref , 0, $matches );
|
||||||
|
@ -614,7 +614,8 @@ sub process_stoppedrules() {
|
|||||||
$target,
|
$target,
|
||||||
'',
|
'',
|
||||||
$disposition,
|
$disposition,
|
||||||
do_proto( $proto, '-', '-' ) );
|
do_proto( $proto, '-', '-' ),
|
||||||
|
'');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warning_message "Redundant OUTPUT rule ignored because ADMINISABSENTMINDED=Yes";
|
warning_message "Redundant OUTPUT rule ignored because ADMINISABSENTMINDED=Yes";
|
||||||
|
@ -345,7 +345,8 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
|||||||
$target ,
|
$target ,
|
||||||
'' ,
|
'' ,
|
||||||
'' ,
|
'' ,
|
||||||
$exceptionrule )
|
$exceptionrule ,
|
||||||
|
'' )
|
||||||
unless unreachable_warning( 0, $chainref );
|
unless unreachable_warning( 0, $chainref );
|
||||||
|
|
||||||
conditional_rule_end( $chainref ) if $detectaddress || $conditional;
|
conditional_rule_end( $chainref ) if $detectaddress || $conditional;
|
||||||
@ -795,7 +796,8 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
|
|||||||
$target ,
|
$target ,
|
||||||
$loglevel ,
|
$loglevel ,
|
||||||
$log_action ,
|
$log_action ,
|
||||||
$serverport ? do_proto( $proto, '', '' ) : '',
|
$serverport ? do_proto( $proto, '', '' ) : '' ,
|
||||||
|
'' ,
|
||||||
)
|
)
|
||||||
unless unreachable_warning( $wildcard, $chainref );
|
unless unreachable_warning( $wildcard, $chainref );
|
||||||
|
|
||||||
@ -867,6 +869,7 @@ sub handle_nonat_rule( $$$$$$$$$$$ ) {
|
|||||||
$loglevel,
|
$loglevel,
|
||||||
$log_action,
|
$log_action,
|
||||||
'',
|
'',
|
||||||
|
'',
|
||||||
dnat_chain( $sourcezone ) )
|
dnat_chain( $sourcezone ) )
|
||||||
unless unreachable_warning( $wildcard, $chn );
|
unless unreachable_warning( $wildcard, $chn );
|
||||||
|
|
||||||
@ -888,6 +891,7 @@ sub handle_nonat_rule( $$$$$$$$$$$ ) {
|
|||||||
$loglevel ,
|
$loglevel ,
|
||||||
$log_action ,
|
$log_action ,
|
||||||
'',
|
'',
|
||||||
|
'',
|
||||||
)
|
)
|
||||||
unless unreachable_warning( $wildcard, $nonat_chain );
|
unless unreachable_warning( $wildcard, $nonat_chain );
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,8 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
|||||||
$action = join( ":" , 'LOG', $action );
|
$action = join( ":" , 'LOG', $action );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $usergenerated;
|
||||||
|
|
||||||
if ( $action eq 'NOTRACK' ) {
|
if ( $action eq 'NOTRACK' ) {
|
||||||
#
|
#
|
||||||
# A patch that deimplements the NOTRACK target has been posted on the
|
# A patch that deimplements the NOTRACK target has been posted on the
|
||||||
@ -204,7 +206,8 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
|||||||
$action ,
|
$action ,
|
||||||
$level || '' ,
|
$level || '' ,
|
||||||
$disposition ,
|
$disposition ,
|
||||||
$exception_rule );
|
$exception_rule ,
|
||||||
|
$usergenerated && ! $level );
|
||||||
|
|
||||||
progress_message " Conntrack rule \"$currentline\" $done";
|
progress_message " Conntrack rule \"$currentline\" $done";
|
||||||
}
|
}
|
||||||
@ -247,6 +250,7 @@ sub handle_helper_rule( $$$$$$$$$$$ ) {
|
|||||||
$action_target ,
|
$action_target ,
|
||||||
'',
|
'',
|
||||||
'CT' ,
|
'CT' ,
|
||||||
|
'' ,
|
||||||
'' );
|
'' );
|
||||||
} else {
|
} else {
|
||||||
expand_rule( ensure_raw_chain( notrack_chain( $sourceref->{name} ) ) ,
|
expand_rule( ensure_raw_chain( notrack_chain( $sourceref->{name} ) ) ,
|
||||||
@ -261,6 +265,7 @@ sub handle_helper_rule( $$$$$$$$$$$ ) {
|
|||||||
$action_target ,
|
$action_target ,
|
||||||
'' ,
|
'' ,
|
||||||
'CT' ,
|
'CT' ,
|
||||||
|
'' ,
|
||||||
'' );
|
'' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2264,6 +2264,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
my $matches = $rule;
|
my $matches = $rule;
|
||||||
my $raw_matches = '';
|
my $raw_matches = '';
|
||||||
my $exceptionrule = '';
|
my $exceptionrule = '';
|
||||||
|
my $usergenerated;
|
||||||
|
|
||||||
if ( $inchain = defined $chainref ) {
|
if ( $inchain = defined $chainref ) {
|
||||||
( $inaction, undef, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 4 if $chainref->{action};
|
( $inaction, undef, undef, undef ) = split /:/, $normalized_action = $chainref->{action}, 4 if $chainref->{action};
|
||||||
@ -2287,6 +2288,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
|
|
||||||
fatal_error "Unknown ACTION ($action)" unless $actiontype;
|
fatal_error "Unknown ACTION ($action)" unless $actiontype;
|
||||||
|
|
||||||
|
$usergenerated = $actiontype & IPTABLES;
|
||||||
|
|
||||||
if ( $actiontype == MACRO ) {
|
if ( $actiontype == MACRO ) {
|
||||||
#
|
#
|
||||||
# process_macro() will call process_rule() recursively for each rule in the macro body
|
# process_macro() will call process_rule() recursively for each rule in the macro body
|
||||||
@ -2333,7 +2336,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$param = $param eq '' ? 'drop' : $param;
|
$param = $param eq '' ? 'drop' : $param;
|
||||||
fatal_error "Invalid AUDIT type ($param) -- must be 'accept', 'drop' or 'reject'" unless $param =~ /^(?:accept|drop|reject)$/;
|
fatal_error "Invalid AUDIT type ($param) -- must be 'accept', 'drop' or 'reject'" unless $param =~ /^(?:accept|drop|reject)$/;
|
||||||
$actiontype = STANDARD;
|
$actiontype = STANDARD;
|
||||||
} elsif ( $actiontype & NFLOG ) {
|
} elsif ( ! $usergenerated ) {
|
||||||
|
if ( $actiontype & NFLOG ) {
|
||||||
validate_level( $action );
|
validate_level( $action );
|
||||||
$loglevel = supplied $loglevel ? join( ':', $action, $loglevel ) : $action;
|
$loglevel = supplied $loglevel ? join( ':', $action, $loglevel ) : $action;
|
||||||
$action = 'LOG';
|
$action = 'LOG';
|
||||||
@ -2341,7 +2345,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
fatal_error "'builtin' actions may only be used in INLINE rules" if $actiontype == USERBUILTIN;
|
fatal_error "'builtin' actions may only be used in INLINE rules" if $actiontype == USERBUILTIN;
|
||||||
fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq '';
|
fatal_error "The $basictarget TARGET does not accept a parameter" unless $param eq '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#
|
#
|
||||||
# We can now dispense with the postfix character
|
# We can now dispense with the postfix character
|
||||||
#
|
#
|
||||||
@ -2909,7 +2913,8 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$action ,
|
$action ,
|
||||||
$loglevel ,
|
$loglevel ,
|
||||||
$log_action ,
|
$log_action ,
|
||||||
$exceptionrule )
|
$exceptionrule ,
|
||||||
|
$usergenerated && ! $loglevel )
|
||||||
unless unreachable_warning( $wildcard || $section == DEFAULTACTION_SECTION, $chainref );
|
unless unreachable_warning( $wildcard || $section == DEFAULTACTION_SECTION, $chainref );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,6 +227,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
our $designator;
|
our $designator;
|
||||||
our $ttl = 0;
|
our $ttl = 0;
|
||||||
my $fw = firewall_zone;
|
my $fw = firewall_zone;
|
||||||
|
my $usergenerated;
|
||||||
|
|
||||||
sub handle_mark_param( $$ ) {
|
sub handle_mark_param( $$ ) {
|
||||||
my ( $option, $marktype ) = @_;
|
my ( $option, $marktype ) = @_;
|
||||||
@ -290,7 +291,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
"$target $option " . join( '/', in_hex( $markval ) , $mask ) ,
|
"$target $option " . join( '/', in_hex( $markval ) , $mask ) ,
|
||||||
'',
|
'',
|
||||||
$target ,
|
$target ,
|
||||||
$exceptionrule );
|
$exceptionrule ,
|
||||||
|
'' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$done = 1;
|
$done = 1;
|
||||||
@ -525,6 +527,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
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;
|
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
|
||||||
$target = $params;
|
$target = $params;
|
||||||
|
$usergenerated = 1;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -540,6 +543,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
fatal_error "Unknown target ($tgt)" unless $target_type;
|
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;
|
fatal_error "The $tgt TARGET is not allowed in the mangle table" unless $target_type & MANGLE_TABLE;
|
||||||
$target = $params;
|
$target = $params;
|
||||||
|
$usergenerated = 1;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -850,7 +854,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$ ) {
|
|||||||
$target,
|
$target,
|
||||||
'' ,
|
'' ,
|
||||||
$target ,
|
$target ,
|
||||||
$exceptionrule ) )
|
$exceptionrule ,
|
||||||
|
$usergenerated ) )
|
||||||
&& $device ) {
|
&& $device ) {
|
||||||
#
|
#
|
||||||
# expand_rule() returns destination device if any
|
# expand_rule() returns destination device if any
|
||||||
@ -3118,6 +3123,7 @@ sub process_secmark_rule1( $$$$$$$$$ ) {
|
|||||||
$target ,
|
$target ,
|
||||||
'' ,
|
'' ,
|
||||||
$disposition,
|
$disposition,
|
||||||
|
'' ,
|
||||||
'' );
|
'' );
|
||||||
|
|
||||||
progress_message "Secmarks rule \"$currentline\" $done";
|
progress_message "Secmarks rule \"$currentline\" $done";
|
||||||
|
Reference in New Issue
Block a user