forked from extern/shorewall_code
Compare commits
22 Commits
5.0.10.1
...
5.0.12-Bet
Author | SHA1 | Date | |
---|---|---|---|
|
afc212495f | ||
|
059b1c6c8c | ||
|
2f75901068 | ||
|
8bb7c2363b | ||
|
2c90a8bfb5 | ||
|
3954636fb5 | ||
|
bb8af36d3f | ||
|
4ec2c2087d | ||
|
a05b957498 | ||
|
31d35e0cbd | ||
|
bcacce7ed0 | ||
|
646c20491a | ||
|
fa1173baaa | ||
|
72e21be89d | ||
|
1b1e2c58f9 | ||
|
d3591c071d | ||
|
decf9d3b3e | ||
|
a05623f49e | ||
|
0b9cd93769 | ||
|
d9e992b164 | ||
|
372359839b | ||
|
40dea5f597 |
@@ -337,7 +337,7 @@ our $VERSION = 'MODULEVERSION';
|
|||||||
# digest => SHA1 digest of the string representation of the chain's rules for use in optimization
|
# digest => SHA1 digest of the string representation of the chain's rules for use in optimization
|
||||||
# level 8.
|
# level 8.
|
||||||
# complete => The last rule in the chain is a -g or a simple -j to a terminating target
|
# complete => The last rule in the chain is a -g or a simple -j to a terminating target
|
||||||
# Suppresses adding additional rules to the chain end of the chain
|
# Suppresses adding additional rules to the end of the chain
|
||||||
# sections => { <section> = 1, ... } - Records sections that have been completed.
|
# sections => { <section> = 1, ... } - Records sections that have been completed.
|
||||||
# chainnumber => Numeric enumeration of the builtin chains (mangle table only).
|
# chainnumber => Numeric enumeration of the builtin chains (mangle table only).
|
||||||
# allowedchains
|
# allowedchains
|
||||||
@@ -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;
|
||||||
|
|
||||||
@@ -3179,17 +3186,17 @@ sub delete_references( $ ) {
|
|||||||
#
|
#
|
||||||
sub calculate_digest( $ ) {
|
sub calculate_digest( $ ) {
|
||||||
my $chainref = shift;
|
my $chainref = shift;
|
||||||
my $digest = '';
|
my $rules = '';
|
||||||
|
|
||||||
for ( @{$chainref->{rules}} ) {
|
for ( @{$chainref->{rules}} ) {
|
||||||
if ( $digest ) {
|
if ( $rules ) {
|
||||||
$digest .= ' |' . format_rule( $chainref, $_, 1 );
|
$rules .= ' |' . format_rule( $chainref, $_, 1 );
|
||||||
} else {
|
} else {
|
||||||
$digest = format_rule( $chainref, $_, 1 );
|
$rules = format_rule( $chainref, $_, 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$chainref->{digest} = sha1_hex $digest;
|
$chainref->{digest} = sha1_hex $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -3478,7 +3485,7 @@ sub optimize_level4( $$ ) {
|
|||||||
$progress = 1;
|
$progress = 1;
|
||||||
} elsif ( $chainref->{builtin} || ! $globals{KLUDGEFREE} || $firstrule->{policy} ) {
|
} elsif ( $chainref->{builtin} || ! $globals{KLUDGEFREE} || $firstrule->{policy} ) {
|
||||||
#
|
#
|
||||||
# This case requires a new rule merging algorithm. Ignore this chain for
|
# This case requires a new rule merging algorithm. Ignore this chain from
|
||||||
# now on.
|
# now on.
|
||||||
#
|
#
|
||||||
$chainref->{optflags} |= DONT_OPTIMIZE;
|
$chainref->{optflags} |= DONT_OPTIMIZE;
|
||||||
@@ -3486,7 +3493,7 @@ sub optimize_level4( $$ ) {
|
|||||||
#
|
#
|
||||||
# Replace references to this chain with the target and add the matches
|
# Replace references to this chain with the target and add the matches
|
||||||
#
|
#
|
||||||
$progress = 1 if replace_references1 $chainref, $firstrule;
|
$progress = 1 if replace_references1( $chainref, $firstrule );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -3532,7 +3539,7 @@ sub optimize_level4( $$ ) {
|
|||||||
#empty builtin chain -- change it's policy
|
#empty builtin chain -- change it's policy
|
||||||
#
|
#
|
||||||
$chainref->{policy} = $target;
|
$chainref->{policy} = $target;
|
||||||
trace( $chainref, 'P', undef, 'ACCEPT' ) if $debug;
|
trace( $chainref, 'P', undef, $target ) if $debug;
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3686,7 +3693,12 @@ sub optimize_level8( $$$ ) {
|
|||||||
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
||||||
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
||||||
$progress = 1;
|
$progress = 1;
|
||||||
replace_references $chainref1, $chainref->{name}, undef, '', '', 1;
|
replace_references( $chainref1,
|
||||||
|
$chainref->{name},
|
||||||
|
undef, # Target Opts
|
||||||
|
'', # Comment
|
||||||
|
'', # Origin
|
||||||
|
1 ); # Recalculate digests of modified chains
|
||||||
|
|
||||||
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
||||||
#
|
#
|
||||||
@@ -4012,7 +4024,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 = @_;
|
||||||
|
@@ -577,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
|
||||||
@@ -731,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
|
||||||
@@ -2156,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
|
||||||
#
|
#
|
||||||
@@ -2225,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.
|
||||||
|
|
||||||
@@ -2248,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
|
||||||
#
|
#
|
||||||
@@ -2354,20 +2401,39 @@ 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 );
|
||||||
|
|
||||||
|
if ( $value =~ /"$/ ) {
|
||||||
|
fatal_error "Invalid value ( $value )" unless $value =~ /^"(.*)"$/;
|
||||||
|
$value = $1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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};
|
fatal_error "Unknown column ($1)" unless exists $columnsref->{$column};
|
||||||
$column = $columnsref->{$column};
|
$column = $columnsref->{$column};
|
||||||
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
fatal_error "Non-ASCII gunk in file" if $columns =~ /[^\s[:print:]]/;
|
||||||
$value = $1 if $value =~ /^"([^"]+)"$/;
|
$value = $1 if $value =~ /^"([^"]+)"$/;
|
||||||
fatal_error "Column values may not contain embedded double quotes, single back quotes or backslashes" if $columns =~ /["`\\]/;
|
$value =~ s/\\"/"/g;
|
||||||
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
|
fatal_error "Non-ASCII gunk in the value of the $column column" if $columns =~ /[^\s[:print:]]/;
|
||||||
$line[$column] = $value;
|
$line[$column] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@line;
|
@line;
|
||||||
}
|
}
|
||||||
@@ -2395,6 +2461,7 @@ sub no_comment() {
|
|||||||
sub clear_comment() {
|
sub clear_comment() {
|
||||||
$comment = '';
|
$comment = '';
|
||||||
$nocomment = 0;
|
$nocomment = 0;
|
||||||
|
$sr_comment = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2490,7 +2557,8 @@ sub push_include() {
|
|||||||
$max_format,
|
$max_format,
|
||||||
$comment,
|
$comment,
|
||||||
$nocomment,
|
$nocomment,
|
||||||
$section_function ];
|
$section_function,
|
||||||
|
$sr_comment ];
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2514,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';
|
||||||
@@ -2883,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++;
|
||||||
}
|
}
|
||||||
@@ -3236,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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3329,7 +3400,7 @@ sub embedded_shell( $ ) {
|
|||||||
sub embedded_perl( $ ) {
|
sub embedded_perl( $ ) {
|
||||||
my $multiline = shift;
|
my $multiline = shift;
|
||||||
|
|
||||||
my ( $command , $linenumber ) = ( qq(package Shorewall::User;\nno strict;\n# line $currentlinenumber "$currentfilename"\n$currentline), $currentlinenumber );
|
my ( $command , $linenumber ) = ( qq(package Shorewall::User;\nno strict;\nuse Shorewall::Config (qw/shorewall/);\n# line $currentlinenumber "$currentfilename"\n$currentline), $currentlinenumber );
|
||||||
|
|
||||||
$directive_callback->( 'PERL', $currentline ) if $directive_callback;
|
$directive_callback->( 'PERL', $currentline ) if $directive_callback;
|
||||||
|
|
||||||
@@ -3782,7 +3853,7 @@ sub process_shorewallrc( $$ ) {
|
|||||||
$shorewallrc{VARDIR} = "$shorewallrc{VARLIB}/$product";
|
$shorewallrc{VARDIR} = "$shorewallrc{VARLIB}/$product";
|
||||||
}
|
}
|
||||||
} elsif ( supplied $shorewallrc{VARLIB} ) {
|
} elsif ( supplied $shorewallrc{VARLIB} ) {
|
||||||
$shorewallrc{VARDIR} = "$shorewallrc{VARLIB}/$product" unless supplied $shorewallrc{VARDIR};
|
$shorewallrc{VARDIR} = "$shorewallrc{VARLIB}/$product";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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,11 +2166,13 @@ 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;
|
||||||
|
|
||||||
@@ -2172,17 +2197,16 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
|
|
||||||
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' );
|
emit( " SW_${wildbase}_IS_USABLE=Yes" ) if $interfaceref->{wildcard};
|
||||||
|
emit( 'fi' );
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
|
|
||||||
emit( "fi\n" );
|
emit( "fi\n" );
|
||||||
|
|
||||||
emit( ';;' ), pop_indent if $wildcards;
|
emit( ';;' ), pop_indent if $wildcards;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
for my $interface ( grep ! $provider_interfaces{$_}, @$interfaces ) {
|
|
||||||
my $physical = get_physical $interface;
|
my $physical = get_physical $interface;
|
||||||
my $base = uc var_base( $physical );
|
my $base = uc var_base( $physical );
|
||||||
my $case = $physical;
|
my $case = $physical;
|
||||||
@@ -2213,6 +2237,7 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
pop_indent;
|
pop_indent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $wildcards ) {
|
if ( $wildcards ) {
|
||||||
emit( '*)' ,
|
emit( '*)' ,
|
||||||
|
@@ -295,7 +295,7 @@ our %validstates = ( NEW => 0,
|
|||||||
# known until the compiler has started.
|
# known until the compiler has started.
|
||||||
#
|
#
|
||||||
# 2. The compiler can run multiple times in the same process so it has to be
|
# 2. The compiler can run multiple times in the same process so it has to be
|
||||||
# able to re-initialize its dependent modules' state.
|
# able to re-initialize the state of its dependent modules.
|
||||||
#
|
#
|
||||||
sub initialize( $ ) {
|
sub initialize( $ ) {
|
||||||
$family = shift;
|
$family = shift;
|
||||||
@@ -345,11 +345,11 @@ sub initialize( $ ) {
|
|||||||
#
|
#
|
||||||
$macro_nest_level = 0;
|
$macro_nest_level = 0;
|
||||||
#
|
#
|
||||||
# All builtin actions plus those mentioned in /etc/shorewall[6]/actions and /usr/share/shorewall[6]/actions
|
# All builtin actions plus those mentioned in /etc/shorewall[6]/actions and /usr/share/shorewall[6]/actions.std
|
||||||
#
|
#
|
||||||
%actions = ();
|
%actions = ();
|
||||||
#
|
#
|
||||||
# Action variants actually used. Key is <action>:<loglevel>:<tag>:<params>; value is corresponding chain name
|
# Action variants actually used. Key is <action>:<loglevel>:<tag>:<caller>:<params>; value is corresponding chain name
|
||||||
#
|
#
|
||||||
%usedactions = ();
|
%usedactions = ();
|
||||||
|
|
||||||
@@ -628,29 +628,20 @@ sub handle_nfqueue( $$ ) {
|
|||||||
#
|
#
|
||||||
# Process an entry in the policy file.
|
# Process an entry in the policy file.
|
||||||
#
|
#
|
||||||
sub process_a_policy() {
|
sub process_a_policy1($$$$$$$) {
|
||||||
|
|
||||||
our %validpolicies;
|
our %validpolicies;
|
||||||
our @zonelist;
|
our @zonelist;
|
||||||
|
|
||||||
my ( $client, $server, $originalpolicy, $loglevel, $synparams, $connlimit ) =
|
my ( $client, $server, $originalpolicy, $loglevel, $synparams, $connlimit, $intrazone ) = @_;
|
||||||
split_line 'policy file', { source => 0, dest => 1, policy => 2, loglevel => 3, limit => 4, connlimit => 5 } ;
|
|
||||||
|
|
||||||
$loglevel = '' if $loglevel eq '-';
|
|
||||||
$synparams = '' if $synparams eq '-';
|
|
||||||
$connlimit = '' if $connlimit eq '-';
|
|
||||||
|
|
||||||
fatal_error 'SOURCE must be specified' if $client eq '-';
|
|
||||||
fatal_error 'DEST must be specified' if $server eq '-';
|
|
||||||
fatal_error 'POLICY must be specified' if $originalpolicy eq '-';
|
|
||||||
|
|
||||||
my $clientwild = ( "\L$client" =~ /^all(\+)?$/ );
|
my $clientwild = ( "\L$client" =~ /^all(\+)?$/ );
|
||||||
my $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 );
|
||||||
|
|
||||||
my $serverwild = ( "\L$server" =~ /^all(\+)?/ );
|
my $serverwild = ( "\L$server" =~ /^all(\+)?/ );
|
||||||
$intrazone ||= $serverwild && $1;
|
$intrazone ||= ( $serverwild && $1 );
|
||||||
|
|
||||||
fatal_error "Undefined zone ($server)" unless $serverwild || defined_zone( $server );
|
fatal_error "Undefined zone ($server)" unless $serverwild || defined_zone( $server );
|
||||||
|
|
||||||
@@ -758,6 +749,40 @@ sub process_a_policy() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub process_a_policy() {
|
||||||
|
|
||||||
|
our %validpolicies;
|
||||||
|
our @zonelist;
|
||||||
|
|
||||||
|
my ( $clients, $servers, $policy, $loglevel, $synparams, $connlimit ) =
|
||||||
|
split_line 'policy file', { source => 0, dest => 1, policy => 2, loglevel => 3, limit => 4, connlimit => 5 } ;
|
||||||
|
|
||||||
|
$loglevel = '' if $loglevel eq '-';
|
||||||
|
$synparams = '' if $synparams eq '-';
|
||||||
|
$connlimit = '' if $connlimit eq '-';
|
||||||
|
|
||||||
|
my $intrazone;
|
||||||
|
|
||||||
|
if ( $intrazone = $clients =~ /.*,.*\+$/) {
|
||||||
|
$clients =~ s/\+$//;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $servers =~ /.*,.*\+$/ ) {
|
||||||
|
$servers =~ s/\+$//;
|
||||||
|
$intrazone = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate contents of the /var/lib/shorewall[6]/.policies file as 'here documents' in the generated script
|
# Generate contents of the /var/lib/shorewall[6]/.policies file as 'here documents' in the generated script
|
||||||
#
|
#
|
||||||
@@ -1352,7 +1377,7 @@ sub new_action( $$$$$ ) {
|
|||||||
# Create and record a log action chain -- Log action chains have names
|
# Create and record a log action chain -- Log action chains have names
|
||||||
# that are formed from the action name by prepending a "%" and appending
|
# that are formed from the action name by prepending a "%" and appending
|
||||||
# a 1- or 2-digit sequence number. In the functions that follow,
|
# a 1- or 2-digit sequence number. In the functions that follow,
|
||||||
# the $chain, $level and $tag variable serves as arguments to the user's
|
# the $chain, $level and $tag variables serve as arguments to the user's
|
||||||
# exit. We call the exit corresponding to the name of the action but we
|
# exit. We call the exit corresponding to the name of the action but we
|
||||||
# set $chain to the name of the iptables chain where rules are to be added.
|
# set $chain to the name of the iptables chain where rules are to be added.
|
||||||
# Similarly, $level and $tag contain the log level and log tag respectively.
|
# Similarly, $level and $tag contain the log level and log tag respectively.
|
||||||
@@ -1533,7 +1558,7 @@ sub find_macro( $ )
|
|||||||
{
|
{
|
||||||
my $macro = $_[0];
|
my $macro = $_[0];
|
||||||
|
|
||||||
$macro =~ s/^macro.//;
|
$macro =~ s/^macro\.//;
|
||||||
|
|
||||||
my $macrofile = find_file "macro.$macro";
|
my $macrofile = find_file "macro.$macro";
|
||||||
|
|
||||||
@@ -2957,8 +2982,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
# And we need the dest zone for local/loopback/off-firewall/destonly checks
|
# And we need the dest zone for local/loopback/off-firewall/destonly checks
|
||||||
#
|
#
|
||||||
$destref = find_zone( $chainref->{destzone} ) if $chainref->{destzone};
|
$destref = find_zone( $chainref->{destzone} ) if $chainref->{destzone};
|
||||||
} else {
|
} elsif ( ! ( $actiontype & NATONLY ) ) {
|
||||||
unless ( $actiontype & NATONLY ) {
|
|
||||||
#
|
#
|
||||||
# Check for illegal bridge port rule
|
# Check for illegal bridge port rule
|
||||||
#
|
#
|
||||||
@@ -3017,7 +3041,6 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
$chainref = $auxref;
|
$chainref = $auxref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#
|
#
|
||||||
# Handle 'local/loopback' warnings
|
# Handle 'local/loopback' warnings
|
||||||
#
|
#
|
||||||
@@ -3033,7 +3056,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
#
|
#
|
||||||
# Handle actions
|
# Handle actions
|
||||||
#
|
#
|
||||||
my $actionchain; #Name of the action chain
|
my $actionchain; # Name of the action chain
|
||||||
|
|
||||||
if ( $actiontype & ACTION ) {
|
if ( $actiontype & ACTION ) {
|
||||||
#
|
#
|
||||||
@@ -3562,7 +3585,7 @@ sub perl_action_tcp_helper($$) {
|
|||||||
sub process_section ($) {
|
sub process_section ($) {
|
||||||
my $sect = shift;
|
my $sect = shift;
|
||||||
#
|
#
|
||||||
# split_line1 has already verified that there are exactly two tokens on the line
|
# split_line2 has already verified that there are exactly two tokens on the line
|
||||||
#
|
#
|
||||||
fatal_error "Invalid SECTION ($sect)" unless defined $sections{$sect};
|
fatal_error "Invalid SECTION ($sect)" unless defined $sections{$sect};
|
||||||
fatal_error "Duplicate or out of order SECTION $sect" if $sections{$sect};
|
fatal_error "Duplicate or out of order SECTION $sect" if $sections{$sect};
|
||||||
@@ -3706,7 +3729,7 @@ sub process_raw_rule ( ) {
|
|||||||
fatal_error "Invalid or missing ACTION ($target)" unless defined $action;
|
fatal_error "Invalid or missing ACTION ($target)" unless defined $action;
|
||||||
|
|
||||||
if ( @protos > 1 ) {
|
if ( @protos > 1 ) {
|
||||||
fatal_error "Inversion not allowed in a PROTO list" if $protos =~ tr/!/!/;
|
fatal_error "Inversion not allowed in a PROTO list" if $protos =~ /!/;
|
||||||
}
|
}
|
||||||
|
|
||||||
for $source ( @source ) {
|
for $source ( @source ) {
|
||||||
@@ -4173,8 +4196,8 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
CHECKSUM => {
|
CHECKSUM => {
|
||||||
defaultchain => 0,
|
defaultchain => POSTROUTING,
|
||||||
allowedchains => ALLCHAINS,
|
allowedchains => POSTROUTING | FORWARD | OUTPUT,
|
||||||
minparams => 0,
|
minparams => 0,
|
||||||
maxparams => 0 ,
|
maxparams => 0 ,
|
||||||
function => sub() {
|
function => sub() {
|
||||||
@@ -4299,7 +4322,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,
|
||||||
|
@@ -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 '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1587,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} ,
|
||||||
};
|
};
|
||||||
|
@@ -41,10 +41,7 @@
|
|||||||
# --shorewallrc1=<path> # Path to export shorewallrc file.
|
# --shorewallrc1=<path> # Path to export shorewallrc file.
|
||||||
# --config_path=<path-list> # Search path for config files
|
# --config_path=<path-list> # Search path for config files
|
||||||
# --inline # Update alternative column specifications
|
# --inline # Update alternative column specifications
|
||||||
# --update # Update configuration to this release
|
# --update # Update configuration to current release
|
||||||
# --tcrules # Create mangle from tcrules
|
|
||||||
# --routestopped # Create stoppedrules from routestopped
|
|
||||||
# --notrack # Create conntrack from notrack
|
|
||||||
#
|
#
|
||||||
use strict;
|
use strict;
|
||||||
use FindBin;
|
use FindBin;
|
||||||
|
@@ -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>
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
<para>This file determines what to do with a new connection request if
|
<para>This file determines what to do with a new connection request if
|
||||||
we don't get a match from the /etc/shorewall/rules file . For each
|
we don't get a match from the /etc/shorewall/rules file . For each
|
||||||
source/destination pair, the file is processed in order until a match is
|
source/destination pair, the file is processed in order until a match is
|
||||||
found ("all" will match any client or server).</para>
|
found ("all" will match any source or destination).</para>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
<important>
|
<important>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SOURCE</emphasis> -
|
<term><emphasis role="bold">SOURCE</emphasis> -
|
||||||
<emphasis>zone</emphasis>|<emphasis
|
<emphasis>zone</emphasis>[,...[+]]|<emphasis
|
||||||
role="bold">$FW</emphasis>|<emphasis
|
role="bold">$FW</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis
|
||||||
role="bold">all+</emphasis></term>
|
role="bold">all+</emphasis></term>
|
||||||
@@ -74,12 +74,18 @@
|
|||||||
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
||||||
not override the implicit intra-zone ACCEPT policy while "all+"
|
not override the implicit intra-zone ACCEPT policy while "all+"
|
||||||
does.</para>
|
does.</para>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 5.0.12, multiple zones may be listed
|
||||||
|
separated by commas. As above, if '+' is specified after two or more
|
||||||
|
zone names, then the policy overrides the implicit intra-zone ACCEPT
|
||||||
|
policy if the same <replaceable>zone</replaceable> appears in both
|
||||||
|
the SOURCE and DEST columns.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DEST</emphasis> -
|
<term><emphasis role="bold">DEST</emphasis> -
|
||||||
<emphasis>zone</emphasis>|<emphasis
|
<emphasis>zone</emphasis>[,...[+]]|<emphasis
|
||||||
role="bold">$FW</emphasis>|<emphasis
|
role="bold">$FW</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis
|
||||||
role="bold">all+</emphasis></term>
|
role="bold">all+</emphasis></term>
|
||||||
@@ -95,6 +101,12 @@
|
|||||||
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
||||||
not override the implicit intra-zone ACCEPT policy while "all+"
|
not override the implicit intra-zone ACCEPT policy while "all+"
|
||||||
does.</para>
|
does.</para>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 5.0.12, multiple zones may be listed
|
||||||
|
separated by commas. As above, if '+' is specified after two or more
|
||||||
|
zone names, then the policy overrides the implicit intra-zone ACCEPT
|
||||||
|
policy if the same <replaceable>zone</replaceable> appears in both
|
||||||
|
the SOURCE and DEST columns.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -307,6 +307,9 @@
|
|||||||
that were active when Shorewall stopped continue to work and
|
that were active when Shorewall stopped continue to work and
|
||||||
all new connections from the firewall system itself are
|
all new connections from the firewall system itself are
|
||||||
allowed.</para>
|
allowed.</para>
|
||||||
|
|
||||||
|
<para>Note that the routestopped file is not supported in
|
||||||
|
Shorewall 5.0 and later versions.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -481,8 +484,8 @@
|
|||||||
|
|
||||||
<para>ALL sends all packets through the blacklist chains.</para>
|
<para>ALL sends all packets through the blacklist chains.</para>
|
||||||
|
|
||||||
<para>Note: The ESTABLISHED state may not be specified if FASTACCEPT
|
<para>Note: The ESTABLISHED state may not be specified if
|
||||||
is specified.</para>
|
FASTACCEPT=Yes is specified.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -577,13 +580,14 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>If this option is set to <emphasis role="bold">No</emphasis>
|
<para>If this option is set to <emphasis role="bold">No</emphasis>
|
||||||
then Shorewall won't clear the current traffic control rules during
|
then Shorewall won't clear the current traffic control rules during
|
||||||
[re]start. This setting is intended for use by people who prefer to
|
[<command>re</command>]<command>start</command> or
|
||||||
configure traffic shaping when the network interfaces come up rather
|
<command>reload</command>. This setting is intended for use by
|
||||||
than when the firewall is started. If that is what you want to do,
|
people who prefer to configure traffic shaping when the network
|
||||||
set TC_ENABLED=Yes and CLEAR_TC=No and do not supply an
|
interfaces come up rather than when the firewall is started. If that
|
||||||
/etc/shorewall/tcstart file. That way, your traffic shaping rules
|
is what you want to do, set TC_ENABLED=Yes and CLEAR_TC=No and do
|
||||||
can still use the “fwmark” classifier based on packet marking
|
not supply an /etc/shorewall/tcstart file. That way, your traffic
|
||||||
defined in <ulink
|
shaping rules can still use the “fwmark” classifier based on packet
|
||||||
|
marking defined in <ulink
|
||||||
url="/manpages/shorewall-tcrules.html">shorewall-tcrules</ulink>(5).
|
url="/manpages/shorewall-tcrules.html">shorewall-tcrules</ulink>(5).
|
||||||
If not specified, CLEAR_TC=Yes is assumed.</para>
|
If not specified, CLEAR_TC=Yes is assumed.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -677,8 +681,8 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>If set to Yes (the default value), entries in the
|
<para>If set to Yes (the default value), entries in the
|
||||||
/etc/shorewall/route_stopped files cause an 'ip rule del' command to
|
/etc/shorewall/rtrules files cause an 'ip rule del' command to be
|
||||||
be generated in addition to an 'ip rule add' command. Setting this
|
generated in addition to an 'ip rule add' command. Setting this
|
||||||
option to No, causes the 'ip rule del' command to be omitted.</para>
|
option to No, causes the 'ip rule del' command to be omitted.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -829,7 +833,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
helpers file from the administrative system into the script. When
|
helpers file from the administrative system into the script. When
|
||||||
set to No or not specified, the compiler will not copy the modules
|
set to No or not specified, the compiler will not copy the modules
|
||||||
or helpers file from <filename>/usr/share/shorewall</filename> but
|
or helpers file from <filename>/usr/share/shorewall</filename> but
|
||||||
will copy the found in another location on the CONFIG_PATH.</para>
|
will copy those found in another location on the CONFIG_PATH.</para>
|
||||||
|
|
||||||
<para>When compiling for direct use by Shorewall, causes the
|
<para>When compiling for direct use by Shorewall, causes the
|
||||||
contents of the local module or helpers file to be copied into the
|
contents of the local module or helpers file to be copied into the
|
||||||
@@ -863,7 +867,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.11 Beta 3. Traditionally, Shorewall has
|
<para>Added in Shorewall 4.4.11. Traditionally, Shorewall has
|
||||||
cleared the packet mark in the first rule in the mangle FORWARD
|
cleared the packet mark in the first rule in the mangle FORWARD
|
||||||
chain. This behavior is maintained with the default setting of this
|
chain. This behavior is maintained with the default setting of this
|
||||||
option (FORWARD_CLEAR_MARK=Yes). If FORWARD_CLEAR_MARK is set to
|
option (FORWARD_CLEAR_MARK=Yes). If FORWARD_CLEAR_MARK is set to
|
||||||
@@ -2194,18 +2198,18 @@ LOG:info:,bar net fw</programlisting>
|
|||||||
#TARGET SOURCE DEST PROTO
|
#TARGET SOURCE DEST PROTO
|
||||||
Broadcast(DROP) - - -
|
Broadcast(DROP) - - -
|
||||||
DROP - - 2
|
DROP - - 2
|
||||||
INLINE - - 6 ; -j REJECT --reject-with tcp-reset
|
INLINE - - 6 ;; -j REJECT --reject-with tcp-reset
|
||||||
?if __ENHANCED_REJECT
|
?if __ENHANCED_REJECT
|
||||||
INLINE - - 17 ; -j REJECT
|
INLINE - - 17 ;; -j REJECT
|
||||||
?if __IPV4
|
?if __IPV4
|
||||||
INLINE - - 1 ; -j REJECT --reject-with icmp-host-unreachable
|
INLINE - - 1 ;; -j REJECT --reject-with icmp-host-unreachable
|
||||||
INLINE - - - ; -j REJECT --reject-with icmp-host-prohibited
|
INLINE - - - ;; -j REJECT --reject-with icmp-host-prohibited
|
||||||
?else
|
?else
|
||||||
INLINE - - 58 ; -j REJECT --reject-with icmp6-addr-unreachable
|
INLINE - - 58 ;; -j REJECT --reject-with icmp6-addr-unreachable
|
||||||
INLINE - - - ; -j REJECT --reject-with icmp6-adm-prohibited
|
INLINE - - - ;; -j REJECT --reject-with icmp6-adm-prohibited
|
||||||
?endif
|
?endif
|
||||||
?else
|
?else
|
||||||
INLINE - - - ; -j REJECT
|
INLINE - - - ;; -j REJECT
|
||||||
?endif</programlisting>
|
?endif</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -2275,7 +2279,7 @@ INLINE - - - ; -j REJECT
|
|||||||
restored unconditionally at the top of the mangle OUTPUT and
|
restored unconditionally at the top of the mangle OUTPUT and
|
||||||
PREROUTING chains, even if the saved mark is zero. When this option
|
PREROUTING chains, even if the saved mark is zero. When this option
|
||||||
is set to <emphasis role="bold">No</emphasis>, the mark is restored
|
is set to <emphasis role="bold">No</emphasis>, the mark is restored
|
||||||
even when it is zero. If you have problems with IPSEC ESP packets
|
only if it is non-zero. If you have problems with IPSEC ESP packets
|
||||||
not being routed correctly on output, try setting this option to
|
not being routed correctly on output, try setting this option to
|
||||||
<emphasis role="bold">No</emphasis>.</para>
|
<emphasis role="bold">No</emphasis>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -2451,10 +2455,9 @@ INLINE - - - ; -j REJECT
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This option is used to specify the shell program to be used to
|
<para>This option is used to specify the shell program to be used to
|
||||||
run the Shorewall compiler and to interpret the compiled script. If
|
interpret the compiled script. If not specified or specified as a
|
||||||
not specified or specified as a null value, /bin/sh is assumed.
|
null value, /bin/sh is assumed. Using a light-weight shell such as
|
||||||
Using a light-weight shell such as ash or dash can significantly
|
ash or dash can significantly improve performance.</para>
|
||||||
improve performance.</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>
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
<para>This file determines what to do with a new connection request if
|
<para>This file determines what to do with a new connection request if
|
||||||
we don't get a match from the /etc/shorewall6/rules file . For each
|
we don't get a match from the /etc/shorewall6/rules file . For each
|
||||||
source/destination pair, the file is processed in order until a match is
|
source/destination pair, the file is processed in order until a match is
|
||||||
found ("all" will match any client or server).</para>
|
found ("all" will match any source or destination).</para>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
<important>
|
<important>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">SOURCE</emphasis> -
|
<term><emphasis role="bold">SOURCE</emphasis> -
|
||||||
<emphasis>zone</emphasis>|<emphasis
|
<emphasis>zone</emphasis>[,...[+]]|<emphasis
|
||||||
role="bold">$FW</emphasis>|<emphasis
|
role="bold">$FW</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis
|
||||||
role="bold">all+</emphasis></term>
|
role="bold">all+</emphasis></term>
|
||||||
@@ -74,12 +74,18 @@
|
|||||||
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
||||||
not override the implicit intra-zone ACCEPT policy while "all+"
|
not override the implicit intra-zone ACCEPT policy while "all+"
|
||||||
does.</para>
|
does.</para>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 5.0.12, multiple zones may be listed
|
||||||
|
separated by commas. As above, if '+' is specified after two or more
|
||||||
|
zone names, then the policy overrides the implicit intra-zone ACCEPT
|
||||||
|
policy if the same <replaceable>zone</replaceable> appears in both
|
||||||
|
the SOURCE and DEST columns.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">DEST</emphasis> -
|
<term><emphasis role="bold">DEST</emphasis> -
|
||||||
<emphasis>zone</emphasis>|<emphasis
|
<emphasis>zone</emphasis>[,...[+]]|<emphasis
|
||||||
role="bold">$FW</emphasis>|<emphasis
|
role="bold">$FW</emphasis>|<emphasis
|
||||||
role="bold">all</emphasis>|<emphasis
|
role="bold">all</emphasis>|<emphasis
|
||||||
role="bold">all+</emphasis></term>
|
role="bold">all+</emphasis></term>
|
||||||
@@ -95,6 +101,12 @@
|
|||||||
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
<para>Support for "all+" was added in Shorewall 4.5.17. "all" does
|
||||||
not override the implicit intra-zone ACCEPT policy while "all+"
|
not override the implicit intra-zone ACCEPT policy while "all+"
|
||||||
does.</para>
|
does.</para>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 5.0.12, multiple zones may be listed
|
||||||
|
separated by commas. As above, if '+' is specified after two or more
|
||||||
|
zone names, then the policy overrides the implicit intra-zone ACCEPT
|
||||||
|
policy if the same <replaceable>zone</replaceable> appears in both
|
||||||
|
the SOURCE and DEST columns.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@@ -239,6 +239,9 @@
|
|||||||
that were active when Shorewall stopped continue to work and
|
that were active when Shorewall stopped continue to work and
|
||||||
all new connections from the firewall system itself are
|
all new connections from the firewall system itself are
|
||||||
allowed.</para>
|
allowed.</para>
|
||||||
|
|
||||||
|
<para>Note that the routestopped file is not supported in
|
||||||
|
Shorewall 5.0 and later versions.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -497,13 +500,14 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>If this option is set to <emphasis role="bold">No</emphasis>
|
<para>If this option is set to <emphasis role="bold">No</emphasis>
|
||||||
then Shorewall6 won't clear the current traffic control rules during
|
then Shorewall6 won't clear the current traffic control rules during
|
||||||
[re]start. This setting is intended for use by people that prefer to
|
[<command>re</command>]<command>start</command> or
|
||||||
configure traffic shaping when the network interfaces come up rather
|
<command>reload</command>. This setting is intended for use by
|
||||||
than when the firewall is started. If that is what you want to do,
|
people that prefer to configure traffic shaping when the network
|
||||||
set TC_ENABLED=Yes and CLEAR_TC=No and do not supply an
|
interfaces come up rather than when the firewall is started. If that
|
||||||
/etc/shorewall6/tcstart file. That way, your traffic shaping rules
|
is what you want to do, set TC_ENABLED=Yes and CLEAR_TC=No and do
|
||||||
can still use the “fwmark” classifier based on packet marking
|
not supply an /etc/shorewall6/tcstart file. That way, your traffic
|
||||||
defined in <ulink
|
shaping rules can still use the “fwmark” classifier based on packet
|
||||||
|
marking defined in <ulink
|
||||||
url="/manpages6/shorewall6-tcrules.html">shorewall6-tcrules</ulink>(5).
|
url="/manpages6/shorewall6-tcrules.html">shorewall6-tcrules</ulink>(5).
|
||||||
If not specified, CLEAR_TC=No is assumed.</para>
|
If not specified, CLEAR_TC=No is assumed.</para>
|
||||||
|
|
||||||
@@ -604,10 +608,9 @@
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>If set to Yes (the default value), entries in the
|
<para>If set to Yes (the default value), entries in the
|
||||||
/etc/shorewall6/route_stopped files cause an 'ip rule del' command
|
/etc/shorewall6/rtrules file cause an 'ip rule del' command to be
|
||||||
to be generated in addition to an 'ip rule add' command. Setting
|
generated in addition to an 'ip rule add' command. Setting this
|
||||||
this option to No, causes the 'ip rule del' command to be
|
option to No, causes the 'ip rule del' command to be omitted.</para>
|
||||||
omitted.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -691,7 +694,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
helpers file from the administrative system into the script. When
|
helpers file from the administrative system into the script. When
|
||||||
set to No or not specified, the compiler will not copy the modules
|
set to No or not specified, the compiler will not copy the modules
|
||||||
or helpers file from <filename>/usr/share/shorewall6</filename> but
|
or helpers file from <filename>/usr/share/shorewall6</filename> but
|
||||||
will copy the found in another location on the CONFIG_PATH.</para>
|
will copy those found in another location on the CONFIG_PATH.</para>
|
||||||
|
|
||||||
<para>When compiling for direct use by Shorewall6, causes the
|
<para>When compiling for direct use by Shorewall6, causes the
|
||||||
contents of the local module or helpers file to be copied into the
|
contents of the local module or helpers file to be copied into the
|
||||||
@@ -725,7 +728,7 @@ net all DROP info</programlisting>then the chain name is 'net-all'
|
|||||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.11 Beta 3. Traditionally, Shorewall has
|
<para>Added in Shorewall 4.4.11. Traditionally, Shorewall has
|
||||||
cleared the packet mark in the first rule in the mangle FORWARD
|
cleared the packet mark in the first rule in the mangle FORWARD
|
||||||
chain. This behavior is maintained with the default setting of this
|
chain. This behavior is maintained with the default setting of this
|
||||||
option (FORWARD_CLEAR_MARK=Yes). If FORWARD_CLEAR_MARK is set to
|
option (FORWARD_CLEAR_MARK=Yes). If FORWARD_CLEAR_MARK is set to
|
||||||
@@ -1922,18 +1925,18 @@ LOG:info:,bar net fw</programlisting>
|
|||||||
#TARGET SOURCE DEST PROTO
|
#TARGET SOURCE DEST PROTO
|
||||||
Broadcast(DROP) - - -
|
Broadcast(DROP) - - -
|
||||||
DROP - - 2
|
DROP - - 2
|
||||||
INLINE - - 6 ; -j REJECT --reject-with tcp-reset
|
INLINE - - 6 ;; -j REJECT --reject-with tcp-reset
|
||||||
?if __ENHANCED_REJECT
|
?if __ENHANCED_REJECT
|
||||||
INLINE - - 17 ; -j REJECT
|
INLINE - - 17 ;; -j REJECT
|
||||||
?if __IPV4
|
?if __IPV4
|
||||||
INLINE - - 1 ; -j REJECT --reject-with icmp-host-unreachable
|
INLINE - - 1 ;; -j REJECT --reject-with icmp-host-unreachable
|
||||||
INLINE - - - ; -j REJECT --reject-with icmp-host-prohibited
|
INLINE - - - ;; -j REJECT --reject-with icmp-host-prohibited
|
||||||
?else
|
?else
|
||||||
INLINE - - 58 ; -j REJECT --reject-with icmp6-addr-unreachable
|
INLINE - - 58 ;; -j REJECT --reject-with icmp6-addr-unreachable
|
||||||
INLINE - - - ; -j REJECT --reject-with icmp6-adm-prohibited
|
INLINE - - - ;; -j REJECT --reject-with icmp6-adm-prohibited
|
||||||
?endif
|
?endif
|
||||||
?else
|
?else
|
||||||
INLINE - - - ; -j REJECT
|
INLINE - - - ;; -j REJECT
|
||||||
?endif</programlisting>
|
?endif</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -1982,7 +1985,7 @@ INLINE - - - ; -j REJECT
|
|||||||
restored unconditionally at the top of the mangle OUTPUT and
|
restored unconditionally at the top of the mangle OUTPUT and
|
||||||
PREROUTING chains, even if the saved mark is zero. When this option
|
PREROUTING chains, even if the saved mark is zero. When this option
|
||||||
is set to <emphasis role="bold">No</emphasis>, the mark is restored
|
is set to <emphasis role="bold">No</emphasis>, the mark is restored
|
||||||
even when it is zero. If you have problems with IPSEC ESP packets
|
only if it is non-zero. If you have problems with IPSEC ESP packets
|
||||||
not being routed correctly on output, try setting this option to
|
not being routed correctly on output, try setting this option to
|
||||||
<emphasis role="bold">No</emphasis>.</para>
|
<emphasis role="bold">No</emphasis>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
@@ -774,6 +774,17 @@ DNAT net loc:10.0.0.1 tcp 80 ; mark="88"</pro
|
|||||||
<programlisting>{ action=>DNAT, source=>net, dest=>loc:10.0.0.1, proto=>tcp, dport=>80, mark=>88 }
|
<programlisting>{ action=>DNAT, source=>net, dest=>loc:10.0.0.1, proto=>tcp, dport=>80, mark=>88 }
|
||||||
; action:"DNAT" source:"net" dest:"loc:10.0.0.1" proto:"tcp" dport:"80" mark:"88"
|
; action:"DNAT" source:"net" dest:"loc:10.0.0.1" proto:"tcp" dport:"80" mark:"88"
|
||||||
DNAT { source=net dest=loc:10.0.0.1 proto=tcp dport=80 mark=88 }</programlisting>
|
DNAT { source=net dest=loc:10.0.0.1 proto=tcp dport=80 mark=88 }</programlisting>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 5.0.11, ip[6]table comments can be attached
|
||||||
|
to individual rules using the <option>comment</option> keyword.</para>
|
||||||
|
|
||||||
|
<para>Example from the rules file:</para>
|
||||||
|
|
||||||
|
<programlisting> ACCEPT net $FW { proto=tcp, dport=22, comment="Accept \"SSH\"" }</programlisting>
|
||||||
|
|
||||||
|
<para> As shown in that example, when the comment contains whitespace, it
|
||||||
|
must be enclosed in double quotes and any embedded double quotes must be
|
||||||
|
escaped using a backslash ("\").</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
@@ -1371,6 +1382,10 @@ SSH(ACCEPT) net:$MYIP $FW
|
|||||||
?COMMENT line in the rules file and the generated rule will show <emphasis
|
?COMMENT line in the rules file and the generated rule will show <emphasis
|
||||||
role="bold">/* Allow SSH from home */</emphasis> when displayed through
|
role="bold">/* Allow SSH from home */</emphasis> when displayed through
|
||||||
the Shorewall show and dump commands.</para>
|
the Shorewall show and dump commands.</para>
|
||||||
|
|
||||||
|
<para>Beginning with Shorewall 5.0.11, the <link linkend="Pairs">alternate
|
||||||
|
input format </link>allows attaching comments to individual rules in the
|
||||||
|
files listed above.</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="CONFIG_PATH">
|
<section id="CONFIG_PATH">
|
||||||
|
@@ -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