forked from extern/shorewall_code
Compare commits
44 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1553e6b831 | ||
|
a219778aa3 | ||
|
8ac0f96029 | ||
|
894a98f24e | ||
|
1c4815358b | ||
|
1fa2ecf6b9 | ||
|
10e84b8505 | ||
|
bd9e8142b9 | ||
|
916a392fb0 | ||
|
28983a0194 | ||
|
2a56f50d99 | ||
|
2cd098ba31 | ||
|
9188f7efa3 | ||
|
95a029316a | ||
|
d4bea3d3ec | ||
|
6085c6092f | ||
|
48df3d9627 | ||
|
94442abfcf | ||
|
86f2e23f33 | ||
|
6e9d5f45ec | ||
|
039fd6ddd8 | ||
|
57288086bf | ||
|
f999acda63 | ||
|
b4723da07c | ||
|
3860a1dc72 | ||
|
e756820ca1 | ||
|
866cb04cbb | ||
|
6ef136a546 | ||
|
9b3b4579a2 | ||
|
3e404b765f | ||
|
2235641c9f | ||
|
3fe4619f66 | ||
|
247698a14d | ||
|
73b20c832c | ||
|
8ac754caed | ||
|
c85ced09af | ||
|
1abb77d66d | ||
|
a28f3012d5 | ||
|
7d443b5e2e | ||
|
a945b3e0dd | ||
|
ec6c233666 | ||
|
4059e9de95 | ||
|
1ee645cd79 | ||
|
1fedb26f1d |
@@ -908,6 +908,26 @@ show_events() {
|
||||
fi
|
||||
}
|
||||
|
||||
show_actions() {
|
||||
echo "A_ACCEPT # Audit and accept the connection"
|
||||
echo "A_DROP # Audit and drop the connection"
|
||||
echo "A_REJECT # Audit and reject the connection "
|
||||
echo "allowBcast # Silently Allow Broadcast/multicast"
|
||||
echo "allowInvalid # Accept packets that are in the INVALID conntrack state."
|
||||
echo "allowinUPnP # Allow UPnP inbound (to firewall) traffic"
|
||||
echo "allowoutUPnP # Allow traffic from local command 'upnpd' (does not work with kernels after 2.6.13)"
|
||||
echo "dropBcast # Silently Drop Broadcast/multicast"
|
||||
echo "dropInvalid # Silently Drop packets that are in the INVALID conntrack state"
|
||||
echo "dropNotSyn # Silently Drop Non-syn TCP packets"
|
||||
echo "forwardUPnP # Allow traffic that upnpd has redirected from"
|
||||
echo "rejNotSyn # Silently Reject Non-syn TCP packets"
|
||||
|
||||
if [ -f ${g_confdir}/actions ]; then
|
||||
cat ${g_sharedir}/actions.std ${g_confdir}/actions | grep -Ev '^\#|^$'
|
||||
else
|
||||
grep -Ev '^\#|^$' ${g_sharedir}/actions.std
|
||||
fi
|
||||
}
|
||||
#
|
||||
# Show Command Executor
|
||||
#
|
||||
@@ -1277,25 +1297,7 @@ show_command() {
|
||||
case $1 in
|
||||
actions)
|
||||
[ $# -gt 1 ] && usage 1
|
||||
echo "A_ACCEPT # Audit and accept the connection"
|
||||
echo "A_DROP # Audit and drop the connection"
|
||||
echo "A_REJECT # Audit and reject the connection "
|
||||
echo "allowBcast # Silently Allow Broadcast/multicast"
|
||||
echo "allowInvalid # Accept packets that are in the INVALID conntrack state."
|
||||
echo "allowinUPnP # Allow UPnP inbound (to firewall) traffic"
|
||||
echo "allowoutUPnP # Allow traffic from local command 'upnpd' (does not work with kernels after 2.6.13)"
|
||||
echo "dropBcast # Silently Drop Broadcast/multicast"
|
||||
echo "dropInvalid # Silently Drop packets that are in the INVALID conntrack state"
|
||||
echo "dropNotSyn # Silently Drop Non-syn TCP packets"
|
||||
echo "forwardUPnP # Allow traffic that upnpd has redirected from"
|
||||
echo "rejNotSyn # Silently Reject Non-syn TCP packets"
|
||||
|
||||
if [ -f ${g_confdir}/actions ]; then
|
||||
cat ${g_sharedir}/actions.std ${g_confdir}/actions | grep -Ev '^\#|^$'
|
||||
else
|
||||
grep -Ev '^\#|^$' ${g_sharedir}/actions.std
|
||||
fi
|
||||
|
||||
show_actions | sort
|
||||
return
|
||||
;;
|
||||
macro)
|
||||
|
@@ -24,4 +24,3 @@ RELOADOPTIONS=""
|
||||
STOPOPTIONS=""
|
||||
|
||||
# EOF
|
||||
>>>>>>> 39caa74... Improved sysconfig files
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# /usr/share/shorewall/macro.ActiveDir
|
||||
#
|
||||
# This macro handles ports for Samba 4 Active Directory Service
|
||||
# This macro handles ports for Samba 4 Active Directory Service
|
||||
#
|
||||
# You can comment out the ports you do not want open
|
||||
#
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# /usr/share/shorewall/macro.Tinc Macro
|
||||
#
|
||||
# This macro handles tinc traffic.
|
||||
# This macro handles tinc traffic.
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Shorewall 4.5 -- /usr/share/shorewall/Shorewall/ARP.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/ARP.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Accounting.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Accounting.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.5 -- /usr/share/shorewall/Shorewall/Chains.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Chains.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
@@ -47,6 +47,7 @@ our @EXPORT = ( qw(
|
||||
add_irule
|
||||
add_jump
|
||||
add_ijump
|
||||
add_ijump_extended
|
||||
insert_rule
|
||||
insert_irule
|
||||
clone_irule
|
||||
@@ -622,9 +623,12 @@ our %ipset_exists;
|
||||
# Omitted, if target is ''.
|
||||
# target => Rule target, if jump is 'j' or 'g'.
|
||||
# targetopts => Target options. Only included if non-empty
|
||||
# matches => List of matches in the rule
|
||||
# <option> => iptables/ip6tables -A options (e.g., i => eth0)
|
||||
# <match> => iptables match. Value may be a scalar or array.
|
||||
# if an array, multiple "-m <match>"s will be generated
|
||||
# <origin> => configuration file and line number that generated the rule
|
||||
# May be empty.
|
||||
# }
|
||||
#
|
||||
# The following constants and hash are used to classify keys in a rule hash
|
||||
@@ -642,6 +646,7 @@ use constant { UNIQUE => 1,
|
||||
|
||||
our %opttype = ( rule => CONTROL,
|
||||
cmd => CONTROL,
|
||||
origin => CONTROL,
|
||||
|
||||
dhcp => CONTROL,
|
||||
|
||||
@@ -917,7 +922,7 @@ sub set_rule_option( $$$ ) {
|
||||
|
||||
sub transform_rule( $;\$ ) {
|
||||
my ( $input, $completeref ) = @_;
|
||||
my $ruleref = { mode => CAT_MODE, matches => [], target => '' };
|
||||
my $ruleref = { mode => CAT_MODE, matches => [], target => '' , origin => shortlineinfo( '' ) };
|
||||
my $simple = 1;
|
||||
my $target = '';
|
||||
my $jump = '';
|
||||
@@ -1186,6 +1191,8 @@ sub merge_rules( $$$ ) {
|
||||
$toref->{comment} = $fromref->{comment} if exists $fromref->{comment};
|
||||
}
|
||||
|
||||
$toref->{origin} = $fromref->{origin} if $fromref->{origin};
|
||||
|
||||
$toref->{target} = $target;
|
||||
|
||||
if ( my $targetref = $tableref->{$target} ) {
|
||||
@@ -1241,6 +1248,23 @@ sub add_commands ( $$;@ ) {
|
||||
$chainref->{optflags} |= ( DONT_OPTIMIZE | DONT_MOVE );
|
||||
}
|
||||
|
||||
#
|
||||
# Set the comment member of an irule
|
||||
#
|
||||
sub set_irule_comment( $$ ) {
|
||||
my ( $chainref, $ruleref ) = @_;
|
||||
|
||||
our $rule_comments;
|
||||
|
||||
$ruleref->{origin} ||= $chainref->{origin};
|
||||
|
||||
if ( $rule_comments ) {
|
||||
$ruleref->{comment} = $ruleref->{origin} || $comment;
|
||||
} else {
|
||||
$ruleref->{comment} = $comment;
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Transform the passed rule and add it to the end of the passed chain's rule list.
|
||||
#
|
||||
@@ -1252,7 +1276,8 @@ sub push_rule( $$ ) {
|
||||
my $complete = 0;
|
||||
my $ruleref = transform_rule( $_[1], $complete );
|
||||
|
||||
$ruleref->{comment} = shortlineinfo($chainref->{origin}) || $comment;
|
||||
set_irule_comment( $chainref, $ruleref );
|
||||
|
||||
$ruleref->{mode} = CMD_MODE if $ruleref->{cmdlevel} = $chainref->{cmdlevel};
|
||||
|
||||
push @{$chainref->{rules}}, $ruleref;
|
||||
@@ -1473,7 +1498,7 @@ sub create_irule( $$$;@ ) {
|
||||
|
||||
( $target, my $targetopts ) = split ' ', $target, 2;
|
||||
|
||||
my $ruleref = { matches => [] };
|
||||
my $ruleref = { matches => [] , origin => shortlineinfo( $chainref->{origin} ) };
|
||||
|
||||
$ruleref->{mode} = ( $ruleref->{cmdlevel} = $chainref->{cmdlevel} ) ? CMD_MODE : CAT_MODE;
|
||||
|
||||
@@ -1486,7 +1511,7 @@ sub create_irule( $$$;@ ) {
|
||||
$ruleref->{target} = '';
|
||||
}
|
||||
|
||||
$ruleref->{comment} = shortlineinfo($chainref->{origin}) || $ruleref->{comment} || $comment;
|
||||
set_irule_comment( $chainref, $ruleref );
|
||||
|
||||
$iprangematch = 0;
|
||||
|
||||
@@ -1642,7 +1667,7 @@ sub insert_rule1($$$)
|
||||
|
||||
my $ruleref = transform_rule( $rule );
|
||||
|
||||
$ruleref->{comment} = shortlineinfo($chainref->{origin}) || $comment;
|
||||
set_irule_comment( $chainref, $ruleref );
|
||||
|
||||
assert( ! ( $ruleref->{cmdlevel} = $chainref->{cmdlevel}) , $chainref->{name} );
|
||||
$ruleref->{mode} = CAT_MODE;
|
||||
@@ -1668,7 +1693,7 @@ sub insert_irule( $$$$;@ ) {
|
||||
my ( $chainref, $jump, $target, $number, @matches ) = @_;
|
||||
|
||||
my $rulesref = $chainref->{rules};
|
||||
my $ruleref = {};
|
||||
my $ruleref = { origin => shortlineinfo( $chainref->{origin} ) };
|
||||
|
||||
$ruleref->{mode} = ( $ruleref->{cmdlevel} = $chainref->{cmdlevel} ) ? CMD_MODE : CAT_MODE;
|
||||
|
||||
@@ -1684,8 +1709,7 @@ sub insert_irule( $$$$;@ ) {
|
||||
$chainref->{optflags} |= push_matches( $ruleref, @matches );
|
||||
}
|
||||
|
||||
|
||||
$ruleref->{comment} = shortlineinfo( $chainref->{origin} ) || $ruleref->{comment} || $comment;
|
||||
set_irule_comment( $chainref, $ruleref );
|
||||
|
||||
if ( $number >= @$rulesref ) {
|
||||
#
|
||||
@@ -2300,6 +2324,7 @@ sub new_chain($$)
|
||||
references => {},
|
||||
filtered => 0,
|
||||
optflags => 0,
|
||||
origin => shortlineinfo( '' ),
|
||||
};
|
||||
|
||||
trace( $chainref, 'N', undef, '' ) if $debug;
|
||||
@@ -2388,12 +2413,12 @@ sub add_expanded_jump( $$$$ ) {
|
||||
add_reference( $chainref, $toref ) while --$splitcount > 0;
|
||||
}
|
||||
|
||||
sub add_ijump_internal( $$$$;@ ) {
|
||||
my ( $fromref, $jump, $to, $expandports, @matches ) = @_;
|
||||
sub add_ijump_internal( $$$$$;@ ) {
|
||||
my ( $fromref, $jump, $to, $expandports, $origin, @matches ) = @_;
|
||||
|
||||
return $dummyrule if $fromref->{complete};
|
||||
|
||||
our $splitcount;
|
||||
our ( $splitcount, $file_comments, $rule_comments );
|
||||
|
||||
my $toref;
|
||||
my $ruleref;
|
||||
@@ -2410,6 +2435,7 @@ sub add_ijump_internal( $$$$;@ ) {
|
||||
my ( $target ) = split ' ', $to;
|
||||
$toref = $chain_table{$fromref->{table}}{$target};
|
||||
fatal_error "Unknown rule target ($to)" unless $toref || $builtin_target{$target};
|
||||
$origin ||= $fromref->{origin} if $file_comments || $rule_comments;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -2419,6 +2445,7 @@ sub add_ijump_internal( $$$$;@ ) {
|
||||
$toref->{referenced} = 1;
|
||||
add_reference $fromref, $toref;
|
||||
$jump = 'j' unless have_capability 'GOTO_TARGET';
|
||||
$origin ||= $toref->{origin} if $file_comments || $rule_comments;
|
||||
$ruleref = create_irule ($fromref, $jump => $to, @matches );
|
||||
} else {
|
||||
$ruleref = create_irule( $fromref, 'j' => $to, @matches );
|
||||
@@ -2428,12 +2455,19 @@ sub add_ijump_internal( $$$$;@ ) {
|
||||
$fromref->{complete} = 1 if $jump eq 'g' || $terminating{$to};
|
||||
}
|
||||
|
||||
$ruleref->{origin} = $origin if $origin;
|
||||
|
||||
$expandports ? handle_port_ilist( $fromref, $ruleref, 1 ) : push_irule( $fromref, $ruleref );
|
||||
}
|
||||
|
||||
sub add_ijump( $$$;@ ) {
|
||||
my ( $fromref, $jump, $to, @matches ) = @_;
|
||||
add_ijump_internal( $fromref, $jump, $to, 0, @matches );
|
||||
add_ijump_internal( $fromref, $jump, $to, 0, '', @matches );
|
||||
}
|
||||
|
||||
sub add_ijump_extended( $$$$;@ ) {
|
||||
my ( $fromref, $jump, $to, $origin, @matches ) = @_;
|
||||
add_ijump_internal( $fromref, $jump, $to, 0, $origin, @matches );
|
||||
}
|
||||
|
||||
sub insert_ijump( $$$$;@ ) {
|
||||
@@ -2727,7 +2761,7 @@ sub ensure_manual_chain($) {
|
||||
$chainref;
|
||||
}
|
||||
|
||||
sub log_irule_limit( $$$$$$$@ );
|
||||
sub log_irule_limit( $$$$$$$$@ );
|
||||
|
||||
sub ensure_blacklog_chain( $$$$$ ) {
|
||||
my ( $target, $disposition, $level, $tag, $audit ) = @_;
|
||||
@@ -2738,7 +2772,7 @@ sub ensure_blacklog_chain( $$$$$ ) {
|
||||
$target =~ s/A_//;
|
||||
$target = 'reject' if $target eq 'REJECT';
|
||||
|
||||
log_irule_limit( $level , $logchainref , 'blacklst' , $disposition , $globals{LOGILIMIT} , $tag, 'add' );
|
||||
log_irule_limit( $level , $logchainref , 'blacklst' , $disposition , $globals{LOGILIMIT} , $tag, 'add', '' );
|
||||
|
||||
add_ijump( $logchainref, j => 'AUDIT', targetopts => '--type ' . lc $target ) if $audit;
|
||||
add_ijump( $logchainref, g => $target );
|
||||
@@ -2753,7 +2787,7 @@ sub ensure_audit_blacklog_chain( $$$ ) {
|
||||
unless ( $filter_table->{A_blacklog} ) {
|
||||
my $logchainref = new_manual_chain 'A_blacklog';
|
||||
|
||||
log_irule_limit( $level , $logchainref , 'blacklst' , $disposition , $globals{LOGILIMIT} , '', 'add' );
|
||||
log_irule_limit( $level , $logchainref , 'blacklst' , $disposition , $globals{LOGILIMIT} , '', 'add' , '' );
|
||||
|
||||
add_ijump( $logchainref, j => 'AUDIT', targetopts => '--type ' . lc $target );
|
||||
|
||||
@@ -2967,6 +3001,9 @@ sub initialize_chain_table($) {
|
||||
$globals{iLOGLIMIT} =
|
||||
( $ruleref->{hashlimit} ? [ hashlimit => $ruleref->{hashlimit} ] :
|
||||
$ruleref->{limit} ? [ limit => $ruleref->{limit} ] : [] );
|
||||
|
||||
our $file_comments = $config{TRACK_RULES} eq 'File';
|
||||
our $rule_comments = $config{TRACK_RULES} eq 'Yes';
|
||||
}
|
||||
|
||||
#
|
||||
@@ -3071,8 +3108,8 @@ sub calculate_digest( $ ) {
|
||||
#
|
||||
# Replace jumps to the passed chain with jumps to the passed target
|
||||
#
|
||||
sub replace_references( $$$$;$ ) {
|
||||
my ( $chainref, $target, $targetopts, $comment, $digest ) = @_;
|
||||
sub replace_references( $$$$$;$ ) {
|
||||
my ( $chainref, $target, $targetopts, $comment, $origin, $digest ) = @_;
|
||||
my $tableref = $chain_table{$chainref->{table}};
|
||||
my $count = 0;
|
||||
my $name = $chainref->{name};
|
||||
@@ -3090,6 +3127,7 @@ sub replace_references( $$$$;$ ) {
|
||||
$_->{target} = $target;
|
||||
$_->{targetopts} = $targetopts if $targetopts;
|
||||
$_->{comment} = $comment unless $_->{comment};
|
||||
$_->{origin} = $origin if $origin;
|
||||
|
||||
if ( $targetref ) {
|
||||
add_reference ( $fromref, $targetref );
|
||||
@@ -3340,7 +3378,8 @@ sub optimize_level4( $$ ) {
|
||||
replace_references( $chainref,
|
||||
$firstrule->{target},
|
||||
$firstrule->{targetopts},
|
||||
$firstrule->{comment} );
|
||||
$firstrule->{comment},
|
||||
$firstrule->{origin} );
|
||||
$progress = 1;
|
||||
}
|
||||
} elsif ( $firstrule->{target} ) {
|
||||
@@ -3560,7 +3599,7 @@ sub optimize_level8( $$$ ) {
|
||||
if ( $chainref->{digest} eq $chainref1->{digest} ) {
|
||||
progress_message " Chain $chainref1->{name} combined with $chainref->{name}";
|
||||
$progress = 1;
|
||||
replace_references $chainref1, $chainref->{name}, undef, '', 1;
|
||||
replace_references $chainref1, $chainref->{name}, undef, '', '', 1;
|
||||
|
||||
unless ( $chainref->{name} =~ /^~/ || $chainref1->{name} =~ /^%/ ) {
|
||||
#
|
||||
@@ -3694,10 +3733,12 @@ sub get_multi_sports( $ ) {
|
||||
}
|
||||
|
||||
#
|
||||
# Return an array of keys for the passed rule. 'dport' and 'comment' are omitted;
|
||||
# Return an array of keys for the passed rule. 'dport', 'comment', and 'origin' are omitted;
|
||||
#
|
||||
sub get_keys( $ ) {
|
||||
sort grep $_ ne 'dport' && $_ ne 'comment', keys %{$_[0]};
|
||||
my %skip = ( dport => 1, comment => 1, origin => 1 );
|
||||
|
||||
sort grep ! $skip{$_}, keys %{$_[0]};
|
||||
}
|
||||
|
||||
#
|
||||
@@ -3731,6 +3772,8 @@ sub combine_dports {
|
||||
my $comment = $baseref->{comment} || '';
|
||||
my $lastcomment = $comment;
|
||||
my $multi_sports = get_multi_sports( $baseref );
|
||||
my $origin = $baseref->{origin} || '';
|
||||
my $lastorigin = $origin;
|
||||
|
||||
RULE:
|
||||
|
||||
@@ -3744,6 +3787,7 @@ sub combine_dports {
|
||||
# We have a candidate
|
||||
#
|
||||
my $comment2 = $ruleref->{comment} || '';
|
||||
my $origin2 = $ruleref->{origin} || '';
|
||||
|
||||
last if $comment2 ne $lastcomment && length( $comment ) + length( $comment2 ) > 253;
|
||||
|
||||
@@ -3784,6 +3828,25 @@ sub combine_dports {
|
||||
$lastcomment = $comment2;
|
||||
}
|
||||
|
||||
if ( $origin2 ) {
|
||||
if ( $origin ) {
|
||||
$origin .= ", $origin2" unless $origin2 eq $lastorigin;
|
||||
} else {
|
||||
$origin = 'Others and ';
|
||||
$origin .= $origin2;
|
||||
}
|
||||
|
||||
$lastorigin = $origin2;
|
||||
} else {
|
||||
if ( $origin ) {
|
||||
unless ( ( $origin2 = ' and others' ) eq $lastorigin ) {
|
||||
$origin .= $origin2;
|
||||
}
|
||||
}
|
||||
|
||||
$lastorigin = $origin2;
|
||||
}
|
||||
|
||||
push @ports, split ',', $ports2;
|
||||
|
||||
trace( $chainref, 'D', $rulenum, $ruleref ) if $debug;
|
||||
@@ -3817,6 +3880,7 @@ sub combine_dports {
|
||||
}
|
||||
|
||||
$baseref->{comment} = $comment if $comment;
|
||||
$baseref->{origin} = $origin if $origin;
|
||||
|
||||
trace ( $chainref, 'R', $basenum, $baseref ) if $debug;
|
||||
}
|
||||
@@ -3855,6 +3919,7 @@ sub delete_duplicates {
|
||||
my $lastrule = @_;
|
||||
my $baseref = pop;
|
||||
my $ruleref;
|
||||
my %skip = ( comment => 1, origin => 1 );
|
||||
|
||||
while ( @_ ) {
|
||||
my $docheck;
|
||||
@@ -3862,7 +3927,7 @@ sub delete_duplicates {
|
||||
|
||||
if ( $baseref->{mode} == CAT_MODE ) {
|
||||
my $ports1;
|
||||
my @keys1 = sort( grep $_ ne 'comment', keys( %$baseref ) );
|
||||
my @keys1 = sort( grep ! $skip{$_}, keys( %$baseref ) );
|
||||
my $rulenum = @_;
|
||||
my $adjacent = 1;
|
||||
|
||||
@@ -3874,7 +3939,7 @@ sub delete_duplicates {
|
||||
|
||||
last unless $ruleref->{mode} == CAT_MODE;
|
||||
|
||||
my @keys2 = sort(grep $_ ne 'comment', keys( %$ruleref ) );
|
||||
my @keys2 = sort(grep ! $skip{$_}, keys( %$ruleref ) );
|
||||
|
||||
next unless @keys1 == @keys2 ;
|
||||
|
||||
@@ -3946,10 +4011,12 @@ sub get_conntrack( $ ) {
|
||||
}
|
||||
|
||||
#
|
||||
# Return an array of keys for the passed rule. 'conntrack' and 'comment' are omitted;
|
||||
# Return an array of keys for the passed rule. 'conntrack', 'comment' & origin are omitted;
|
||||
#
|
||||
sub get_keys1( $ ) {
|
||||
sort grep $_ ne 'conntrack --ctstate' && $_ ne 'comment', keys %{$_[0]};
|
||||
my %skip = ( comment => 1, origin => 1 , 'conntrack --ctstate' => 1 );
|
||||
|
||||
sort grep ! $skip{$_}, keys %{$_[0]};
|
||||
}
|
||||
|
||||
#
|
||||
@@ -4235,7 +4302,8 @@ sub logchain( $$$$$$ ) {
|
||||
$disposition ,
|
||||
[] ,
|
||||
$logtag,
|
||||
'add' );
|
||||
'add',
|
||||
'' );
|
||||
add_jump( $logchainref, $target, 0, $exceptionrule );
|
||||
}
|
||||
|
||||
@@ -5753,8 +5821,6 @@ sub match_source_net( $;$\$ ) {
|
||||
}
|
||||
|
||||
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
||||
fatal_error "A countrycode list may not be used in this context" if $restriction & ( OUTPUT_RESTRICT | POSTROUTE_RESTRICT );
|
||||
|
||||
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
||||
|
||||
load_isocodes unless %isocodes;
|
||||
@@ -5842,8 +5908,6 @@ sub imatch_source_net( $;$\$ ) {
|
||||
}
|
||||
|
||||
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
||||
fatal_error "A countrycode list may not be used in this context" if $restriction & ( OUTPUT_RESTRICT | POSTROUTE_RESTRICT );
|
||||
|
||||
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
||||
|
||||
load_isocodes unless %isocodes;
|
||||
@@ -5928,8 +5992,6 @@ sub match_dest_net( $;$ ) {
|
||||
}
|
||||
|
||||
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
||||
fatal_error "A countrycode list may not be used in this context" if $restriction & (PREROUTE_RESTRICT | INPUT_RESTRICT );
|
||||
|
||||
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
||||
|
||||
load_isocodes unless %isocodes;
|
||||
@@ -6011,8 +6073,6 @@ sub imatch_dest_net( $;$ ) {
|
||||
}
|
||||
|
||||
if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
|
||||
fatal_error "A countrycode list may not be used in this context" if $restriction & (PREROUTE_RESTRICT | INPUT_RESTRICT );
|
||||
|
||||
require_capability 'GEOIP_MATCH', 'A country-code', '';
|
||||
|
||||
load_isocodes unless %isocodes;
|
||||
@@ -6202,16 +6262,18 @@ sub do_ipsec($$) {
|
||||
#
|
||||
# Generate a log message
|
||||
#
|
||||
sub log_rule_limit( $$$$$$$$ ) {
|
||||
my ($level, $chainref, $chn, $dispo, $limit, $tag, $command, $matches ) = @_;
|
||||
sub log_rule_limit( $$$$$$$$;$ ) {
|
||||
my ($level, $chainref, $chn, $dispo, $limit, $tag, $command, $matches, $origin ) = @_;
|
||||
|
||||
my $prefix = '';
|
||||
my $chain = get_action_chain_name || $chn;
|
||||
my $disposition = get_action_disposition || $dispo;
|
||||
my $chain = get_action_chain_name || $chn;
|
||||
my $disposition = get_action_disposition || $dispo;
|
||||
my $original_matches = $matches;
|
||||
my $ruleref;
|
||||
|
||||
$level = validate_level $level; # Do this here again because this function can be called directly from user exits.
|
||||
|
||||
return 1 if $level eq '';
|
||||
return $dummyrule if $level eq '';
|
||||
|
||||
$matches .= ' ' if $matches && substr( $matches, -1, 1 ) ne ' ';
|
||||
|
||||
@@ -6289,19 +6351,24 @@ sub log_rule_limit( $$$$$$$$ ) {
|
||||
}
|
||||
|
||||
if ( $command eq 'add' ) {
|
||||
add_rule ( $chainref, $matches . $prefix , 1 );
|
||||
$ruleref = add_rule ( $chainref, $matches . $prefix , $original_matches );
|
||||
} else {
|
||||
insert_rule1 ( $chainref , 0 , $matches . $prefix );
|
||||
$ruleref = insert_rule1 ( $chainref , 0 , $matches . $prefix );
|
||||
}
|
||||
|
||||
$ruleref->{origin} = $origin if reftype( $ruleref ) && $origin;
|
||||
|
||||
$ruleref;
|
||||
}
|
||||
|
||||
sub log_irule_limit( $$$$$$$@ ) {
|
||||
my ($level, $chainref, $chn, $dispo, $limit, $tag, $command, @matches ) = @_;
|
||||
sub log_irule_limit( $$$$$$$$@ ) {
|
||||
my ($level, $chainref, $chn, $dispo, $limit, $tag, $command, $origin, @matches ) = @_;
|
||||
|
||||
my $prefix = '';
|
||||
my %matches;
|
||||
my $chain = get_action_chain_name || $chn;
|
||||
my $disposition = get_action_disposition || $dispo;
|
||||
my $original_matches = @matches;
|
||||
|
||||
$level = validate_level $level; # Do this here again because this function can be called directly from user exits.
|
||||
|
||||
@@ -6383,7 +6450,7 @@ sub log_irule_limit( $$$$$$$@ ) {
|
||||
}
|
||||
|
||||
if ( $command eq 'add' ) {
|
||||
add_ijump_internal ( $chainref, j => $prefix , 1, @matches );
|
||||
add_ijump_internal ( $chainref, j => $prefix , $original_matches, $origin, @matches );
|
||||
} else {
|
||||
insert_ijump ( $chainref, j => $prefix, 0 , @matches );
|
||||
}
|
||||
@@ -6398,7 +6465,7 @@ sub log_rule( $$$$ ) {
|
||||
sub log_irule( $$$;@ ) {
|
||||
my ( $level, $chainref, $disposition, @matches ) = @_;
|
||||
|
||||
log_irule_limit $level, $chainref, $chainref->{name} , $disposition, $globals{LOGILIMIT} , '', 'add', @matches;
|
||||
log_irule_limit $level, $chainref, $chainref->{name} , $disposition, $globals{LOGILIMIT} , '', 'add', '', @matches;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -7408,7 +7475,8 @@ sub handle_exclusion( $$$$$$$$$$$$$$$$$$$$$ ) {
|
||||
$actparms{disposition} || ( $disposition eq 'reject' ? 'REJECT' : $disposition ),
|
||||
[] ,
|
||||
$logtag ,
|
||||
'add' )
|
||||
'add' ,
|
||||
'' )
|
||||
if $loglevel;
|
||||
#
|
||||
# Generate Final Rule
|
||||
@@ -7783,9 +7851,10 @@ sub add_interface_options( $ ) {
|
||||
} else {
|
||||
for my $interface ( @input_interfaces ) {
|
||||
$chain1ref = $input_chains{$interface};
|
||||
add_ijump ( $chainref ,
|
||||
j => $chain1ref->{name},
|
||||
@input_interfaces > 1 ? imatch_source_dev( $interface ) : () )->{comment} = interface_origin( $interface ) if @{$chain1ref->{rules}};
|
||||
add_ijump_extended ( $chainref ,
|
||||
j => $chain1ref->{name},
|
||||
interface_origin( $interface ) ,
|
||||
@input_interfaces > 1 ? imatch_source_dev( $interface ) : () );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -7798,7 +7867,10 @@ sub add_interface_options( $ ) {
|
||||
} else {
|
||||
for my $interface ( @forward_interfaces ) {
|
||||
$chain1ref = $forward_chains{$interface};
|
||||
add_ijump ( $chainref , j => $chain1ref->{name}, @forward_interfaces > 1 ? imatch_source_dev( $interface ) : () )->{comment} = interface_origin( $interface ) if @{$chain1ref->{rules}};
|
||||
add_ijump_extended( $chainref ,
|
||||
j => $chain1ref->{name},
|
||||
interface_origin( $interface ) ,
|
||||
@forward_interfaces > 1 ? imatch_source_dev( $interface ) : () );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7887,6 +7959,8 @@ sub enter_cmd_mode() {
|
||||
sub emitr( $$ ) {
|
||||
my ( $chainref, $ruleref ) = @_;
|
||||
|
||||
our $file_comments;
|
||||
|
||||
assert( $chainref );
|
||||
|
||||
if ( $ruleref ) {
|
||||
@@ -7895,6 +7969,11 @@ sub emitr( $$ ) {
|
||||
# A rule
|
||||
#
|
||||
enter_cat_mode unless $mode == CAT_MODE;
|
||||
|
||||
if ( $file_comments && ( my $origin = $ruleref->{origin} ) ) {
|
||||
emit_unindented '# ' . $origin;
|
||||
}
|
||||
|
||||
emit_unindented format_rule( $chainref, $ruleref );
|
||||
} else {
|
||||
#
|
||||
@@ -7905,6 +7984,9 @@ sub emitr( $$ ) {
|
||||
if ( exists $ruleref->{cmd} ) {
|
||||
emit join( '', ' ' x $ruleref->{cmdlevel}, $ruleref->{cmd} );
|
||||
} else {
|
||||
if ( $file_comments && ( my $origin = $ruleref->{origin} ) ) {
|
||||
emit join( '', ' ' x $ruleref->{cmdlevel} , '# ' , $origin );
|
||||
}
|
||||
#
|
||||
# Must preserve quotes in the rule
|
||||
#
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#! /usr/bin/perl -w
|
||||
#
|
||||
# The Shoreline Firewall Packet Filtering Firewall Compiler - V4.5
|
||||
# The Shoreline Firewall Packet Filtering Firewall Compiler - V5.0
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Config.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Config.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
@@ -174,6 +174,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
||||
$comment
|
||||
|
||||
%config
|
||||
%origin
|
||||
%globals
|
||||
%config_files
|
||||
%shorewallrc
|
||||
@@ -297,6 +298,10 @@ our %globals;
|
||||
#
|
||||
our %config;
|
||||
#
|
||||
# Linenumber in shorewall[6].conf where each option was specified
|
||||
#
|
||||
our %origin;
|
||||
#
|
||||
# Entries in shorewall.conf that have been renamed
|
||||
#
|
||||
our %renamed = ( AUTO_COMMENT => 'AUTOCOMMENT', BLACKLIST_LOGLEVEL => 'BLACKLIST_LOG_LEVEL' );
|
||||
@@ -891,7 +896,10 @@ sub initialize( $;$$) {
|
||||
ZONE_BITS => undef,
|
||||
);
|
||||
|
||||
|
||||
#
|
||||
# Line numbers in shorewall6.conf where options are specified
|
||||
#
|
||||
%origin = ();
|
||||
#
|
||||
# Valid log levels
|
||||
#
|
||||
@@ -1192,19 +1200,33 @@ sub currentlineinfo() {
|
||||
}
|
||||
}
|
||||
|
||||
sub shortlineinfo2() {
|
||||
if ( $currentfile ) {
|
||||
join( ':', $currentfilename, $currentlinenumber );
|
||||
} else {
|
||||
''
|
||||
}
|
||||
}
|
||||
|
||||
sub shortlineinfo( $ ) {
|
||||
if ( $config{TRACK_RULES} ) {
|
||||
if ( my $track = $config{TRACK_RULES} ) {
|
||||
if ( $currentfile ) {
|
||||
my $comment = '@@@ '. join( ':', $currentfilename, $currentlinenumber ) . ' @@@';
|
||||
$comment = '@@@ ' . join( ':' , basename($currentfilename), $currentlinenumber) . ' @@@' if length $comment > 255;
|
||||
$comment = '@@@ Filename Too Long @@@' if length $comment > 255;
|
||||
$comment;
|
||||
if ( $track eq 'Yes' ) {
|
||||
my $comment = '@@@ '. join( ':', $currentfilename, $currentlinenumber ) . ' @@@';
|
||||
$comment = '@@@ ' . join( ':' , basename($currentfilename), $currentlinenumber) . ' @@@' if length $comment > 255;
|
||||
$comment = '@@@ Filename Too Long @@@' if length $comment > 255;
|
||||
$comment;
|
||||
} else {
|
||||
join( ':', $currentfilename, $currentlinenumber );
|
||||
}
|
||||
} else {
|
||||
#
|
||||
# Alternate lineinfo may have been passed
|
||||
#
|
||||
$_[0] || ''
|
||||
}
|
||||
} else {
|
||||
'';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3221,9 +3243,9 @@ sub push_action_params( $$$$$$ ) {
|
||||
sub pop_action_params( $ ) {
|
||||
my $oldparms = shift;
|
||||
%actparms = %$oldparms;
|
||||
my $return = $parmsmodified ? $parmsmodified : ( $usedcaller || 0 );
|
||||
( $parmsmodified ) = delete $actparms{modified};
|
||||
( $usedcaller ) = delete $actparms{usedcaller};
|
||||
my $return = $parmsmodified | $usedcaller;
|
||||
( $parmsmodified ) = delete $actparms{modified} || 0;
|
||||
( $usedcaller ) = delete $actparms{usedcaller} || 0;
|
||||
$return;
|
||||
}
|
||||
|
||||
@@ -5037,6 +5059,8 @@ sub process_shorewall_conf( $$ ) {
|
||||
|
||||
warning_message "Option $var=$val is deprecated"
|
||||
if $deprecated{$var} && supplied $val && lc $config{$var} ne $deprecated{$var};
|
||||
|
||||
$origin{$var} = shortlineinfo2;
|
||||
} else {
|
||||
fatal_error "Unrecognized $product.conf entry";
|
||||
}
|
||||
@@ -5811,7 +5835,25 @@ sub get_configuration( $$$$ ) {
|
||||
default_yes_no 'MULTICAST' , '';
|
||||
default_yes_no 'MARK_IN_FORWARD_CHAIN' , '';
|
||||
default_yes_no 'CHAIN_SCRIPTS' , 'Yes';
|
||||
default_yes_no 'TRACK_RULES' , '';
|
||||
|
||||
if ( supplied ( $val = $config{TRACK_RULES} ) ) {
|
||||
if ( lc( $val ) eq 'file' ) {
|
||||
$config{TRACK_RULES} = 'File';
|
||||
} else {
|
||||
default_yes_no 'TRACK_RULES' , '';
|
||||
}
|
||||
} else {
|
||||
$config{TRACK_RULES} = '';
|
||||
}
|
||||
|
||||
%origin = () unless $config{TRACK_RULES} eq 'File';
|
||||
#
|
||||
# Ensure that all members of %origin have defined values
|
||||
#
|
||||
for ( keys %config ) {
|
||||
$origin{$_} ||= '';
|
||||
}
|
||||
|
||||
default_yes_no 'INLINE_MATCHES' , '';
|
||||
default_yes_no 'BASIC_FILTERS' , '';
|
||||
default_yes_no 'WORKAROUNDS' , 'Yes';
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/IPAddrs.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/IPAddrs.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2015 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.5 -- /usr/share/shorewall/Shorewall/Misc.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Misc.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
@@ -107,13 +107,15 @@ sub setup_ecn()
|
||||
fatal_error 'INTERFACE must be specified' if $interface eq '-';
|
||||
fatal_error "Unknown interface ($interface)" unless known_interface $interface;
|
||||
|
||||
$interfaces{$interface} = 1;
|
||||
my $lineinfo = shortlineinfo( '' );
|
||||
|
||||
$interfaces{$interface} ||= $lineinfo;
|
||||
|
||||
$hosts = ALLIP if $hosts eq '-';
|
||||
|
||||
for my $host( split_list $hosts, 'address' ) {
|
||||
validate_host( $host , 1 );
|
||||
push @hosts, [ $interface, $host ];
|
||||
push @hosts, [ $interface, $lineinfo, $host ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,12 +127,12 @@ sub setup_ecn()
|
||||
for my $interface ( @interfaces ) {
|
||||
my $chainref = ensure_chain 'mangle', ecn_chain( $interface );
|
||||
|
||||
add_ijump $mangle_table->{POSTROUTING} , j => $chainref, p => 'tcp', imatch_dest_dev( $interface ) if have_capability 'MANGLE_FORWARD';
|
||||
add_ijump $mangle_table->{OUTPUT}, j => $chainref, p => 'tcp', imatch_dest_dev( $interface );
|
||||
add_ijump_extended $mangle_table->{POSTROUTING} , j => $chainref, $interfaces{$interface}, p => 'tcp', imatch_dest_dev( $interface ) if have_capability 'MANGLE_FORWARD';
|
||||
add_ijump_extended $mangle_table->{OUTPUT}, j => $chainref, $interfaces{$interface}, p => 'tcp', imatch_dest_dev( $interface );
|
||||
}
|
||||
|
||||
for my $host ( @hosts ) {
|
||||
add_ijump( $mangle_table->{ecn_chain $host->[0]}, j => 'ECN', targetopts => '--ecn-tcp-remove', p => 'tcp', imatch_dest_net( $host->[1] ) );
|
||||
add_ijump_extended( $mangle_table->{ecn_chain $host->[0]}, j => 'ECN', $host=>[1], targetopts => '--ecn-tcp-remove', p => 'tcp', imatch_dest_net( $host->[2] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -655,7 +657,7 @@ sub add_common_rules ( $ ) {
|
||||
setup_mss;
|
||||
|
||||
if ( $config{FASTACCEPT} ) {
|
||||
add_ijump( $filter_table->{OUTPUT} , j => 'ACCEPT', state_imatch $faststate )
|
||||
add_ijump_extended( $filter_table->{OUTPUT} , j => 'ACCEPT', $origin{FASTACCEPT}, state_imatch $faststate )
|
||||
}
|
||||
|
||||
my $policy = $config{SFILTER_DISPOSITION};
|
||||
@@ -663,6 +665,7 @@ sub add_common_rules ( $ ) {
|
||||
$tag = $config{SFILTER_LOG_TAG};
|
||||
my $audit = $policy =~ s/^A_//;
|
||||
my @ipsec = have_ipsec ? ( policy => '--pol none --dir in' ) : ();
|
||||
my $origin = $origin{SFILTER_DISPOSITION};
|
||||
|
||||
if ( $level || $audit ) {
|
||||
#
|
||||
@@ -677,11 +680,12 @@ sub add_common_rules ( $ ) {
|
||||
$globals{LOGLIMIT},
|
||||
$tag,
|
||||
'add',
|
||||
'' ) if $level ne '';
|
||||
'',
|
||||
$origin{SFILTER_LOG_LEVEL} ) if $level ne '';
|
||||
|
||||
add_ijump( $chainref, j => 'AUDIT', targetopts => '--type ' . lc $policy ) if $audit;
|
||||
add_ijump_extended( $chainref, j => 'AUDIT', $origin, targetopts => '--type ' . lc $policy ) if $audit;
|
||||
|
||||
add_ijump $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy;
|
||||
add_ijump_extended( $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy, $origin );
|
||||
|
||||
$target = 'sfilter';
|
||||
} else {
|
||||
@@ -697,11 +701,20 @@ sub add_common_rules ( $ ) {
|
||||
$chainref = new_standard_chain 'sfilter1';
|
||||
|
||||
add_ijump ( $chainref, j => 'RETURN', policy => '--pol ipsec --dir out' );
|
||||
log_rule $level , $chainref , $policy , '' if $level ne '';
|
||||
|
||||
add_ijump( $chainref, j => 'AUDIT', targetopts => '--type ' . lc $policy ) if $audit;
|
||||
log_rule_limit( $level,
|
||||
$chainref,
|
||||
$chainref->{name},
|
||||
$policy,
|
||||
$globals{LOGLIMIT},
|
||||
$tag,
|
||||
'add',
|
||||
'' ,
|
||||
$origin ) if $level ne '';
|
||||
|
||||
add_ijump $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy;
|
||||
add_ijump_extended( $chainref, j => 'AUDIT', $origin{SFILTER_DISPOSITION}, targetopts => '--type ' . lc $policy ) if $audit;
|
||||
|
||||
add_ijump_extended( $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy, $origin );
|
||||
|
||||
$target1 = 'sfilter1';
|
||||
} else {
|
||||
@@ -721,13 +734,14 @@ sub add_common_rules ( $ ) {
|
||||
unless ( $interfaceref->{options}{ignore} & NO_SFILTER || $interfaceref->{options}{rpfilter} ) {
|
||||
|
||||
my @filters = @{$interfaceref->{filter}};
|
||||
my $origin = $interfaceref->{origin};
|
||||
|
||||
$chainref = $filter_table->{forward_option_chain $interface};
|
||||
|
||||
if ( @filters ) {
|
||||
add_ijump( $chainref , @ipsec ? 'j' : 'g' => $target1, imatch_source_net( $_ ), @ipsec ), $chainref->{filtered}++ for @filters;
|
||||
add_ijump_extended( $chainref , @ipsec ? 'j' : 'g' => $target1, $origin, imatch_source_net( $_ ), @ipsec ), $chainref->{filtered}++ for @filters;
|
||||
} elsif ( $interfaceref->{bridge} eq $interface ) {
|
||||
add_ijump( $chainref , @ipsec ? 'j' : 'g' => $target1, imatch_dest_dev( $interface ), @ipsec ), $chainref->{filtered}++
|
||||
add_ijump_extended( $chainref , @ipsec ? 'j' : 'g' => $target1, $origin, imatch_dest_dev( $interface ), @ipsec ), $chainref->{filtered}++
|
||||
unless( $config{ROUTE_FILTER} eq 'on' ||
|
||||
$interfaceref->{options}{routeback} ||
|
||||
$interfaceref->{options}{routefilter} ||
|
||||
@@ -737,13 +751,13 @@ sub add_common_rules ( $ ) {
|
||||
|
||||
if ( @filters ) {
|
||||
$chainref = $filter_table->{input_option_chain $interface};
|
||||
add_ijump( $chainref , g => $target, imatch_source_net( $_ ), @ipsec ), $chainref->{filtered}++ for @filters;
|
||||
add_ijump_extended( $chainref , g => $target, $origin, imatch_source_net( $_ ), @ipsec ), $chainref->{filtered}++ for @filters;
|
||||
}
|
||||
}
|
||||
|
||||
for ( option_chains( $interface ) ) {
|
||||
add_ijump( $filter_table->{$_}, j => $dynamicref, @state ) if $dynamicref;
|
||||
add_ijump( $filter_table->{$_}, j => 'ACCEPT', state_imatch $faststate )->{comment} = '' if $config{FASTACCEPT};
|
||||
add_ijump_extended( $filter_table->{$_}, j => $dynamicref, $origin{DYNAMIC_BLACKLIST}, @state ) if $dynamicref;
|
||||
add_ijump_extended( $filter_table->{$_}, j => 'ACCEPT', $origin{FASTACCEPT}, state_imatch $faststate )->{comment} = '' if $config{FASTACCEPT};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -764,6 +778,8 @@ sub add_common_rules ( $ ) {
|
||||
$level = $config{RPFILTER_LOG_LEVEL};
|
||||
$tag = $globals{RPFILTER_LOG_TAG};
|
||||
$audit = $policy =~ s/^A_//;
|
||||
my $origin
|
||||
= $origin{RPFILTER_DISPOSITION};
|
||||
|
||||
if ( $level || $audit ) {
|
||||
#
|
||||
@@ -778,11 +794,12 @@ sub add_common_rules ( $ ) {
|
||||
$globals{LOGLIMIT},
|
||||
$tag,
|
||||
'add',
|
||||
'' ) if $level ne '';
|
||||
'',
|
||||
$origin{RPFILTER_LOG_LEVEL} );
|
||||
|
||||
add_ijump( $chainref, j => 'AUDIT', targetopts => '--type ' . lc $policy ) if $audit;
|
||||
add_ijump_extended( $chainref, j => 'AUDIT', $origin, targetopts => '--type ' . lc $policy ) if $audit;
|
||||
|
||||
add_ijump $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy;
|
||||
add_ijump_extended( $chainref, g => $policy eq 'REJECT' ? 'reject' : $policy, $origin );
|
||||
|
||||
$target = 'rplog';
|
||||
} else {
|
||||
@@ -794,23 +811,25 @@ sub add_common_rules ( $ ) {
|
||||
if ( $family == F_IPV4 ) {
|
||||
for $interface ( @$list ) {
|
||||
if ( get_interface_option( $interface, 'dhcp' ) ) {
|
||||
add_ijump( $rpfilterref,
|
||||
j => 'RETURN',
|
||||
s => NILIPv4,
|
||||
p => UDP,
|
||||
dport => 67,
|
||||
sport => 68
|
||||
add_ijump_extended( $rpfilterref,
|
||||
j => 'RETURN',
|
||||
get_interface_origin( $interface ),
|
||||
s => NILIPv4,
|
||||
p => UDP,
|
||||
dport => 67,
|
||||
sport => 68
|
||||
);
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_ijump( $rpfilterref,
|
||||
j => $target,
|
||||
rpfilter => '--validmark --invert',
|
||||
state_imatch 'NEW,RELATED,INVALID',
|
||||
@ipsec
|
||||
add_ijump_extended( $rpfilterref,
|
||||
j => $target,
|
||||
$origin,
|
||||
rpfilter => '--validmark --invert',
|
||||
state_imatch 'NEW,RELATED,INVALID',
|
||||
@ipsec
|
||||
);
|
||||
}
|
||||
|
||||
@@ -830,6 +849,7 @@ sub add_common_rules ( $ ) {
|
||||
$chainref = new_standard_chain 'smurfs';
|
||||
|
||||
my $smurfdest = $config{SMURF_DISPOSITION};
|
||||
my $origin = $origin{SMURF_DISPOSITION};
|
||||
|
||||
if ( supplied $config{SMURF_LOG_LEVEL} ) {
|
||||
my $smurfref = new_chain( 'filter', 'smurflog' );
|
||||
@@ -840,9 +860,12 @@ sub add_common_rules ( $ ) {
|
||||
'DROP',
|
||||
$globals{LOGILIMIT},
|
||||
$globals{SMURF_LOG_TAG},
|
||||
'add' );
|
||||
add_ijump( $smurfref, j => 'AUDIT', targetopts => '--type drop' ) if $smurfdest eq 'A_DROP';
|
||||
add_ijump( $smurfref, j => 'DROP' );
|
||||
'add',
|
||||
$origin{SMURF_LOG_LEVEL} );
|
||||
|
||||
add_ijump_extended( $smurfref, j => 'AUDIT', $origin, targetopts => '--type drop' ) if $smurfdest eq 'A_DROP';
|
||||
|
||||
add_ijump_extended( $smurfref, j => 'DROP' , $origin );
|
||||
|
||||
$smurfdest = 'smurflog';
|
||||
} else {
|
||||
@@ -856,7 +879,7 @@ sub add_common_rules ( $ ) {
|
||||
add_ijump $chainref , j => 'RETURN', s => '::';
|
||||
}
|
||||
|
||||
add_ijump( $chainref, g => $smurfdest, addrtype => '--src-type BROADCAST' ) ;
|
||||
add_ijump_extended( $chainref, g => $smurfdest, $origin, addrtype => '--src-type BROADCAST' ) ;
|
||||
} else {
|
||||
if ( $family == F_IPV4 ) {
|
||||
add_commands $chainref, 'for address in $ALL_BCASTS; do';
|
||||
@@ -865,15 +888,15 @@ sub add_common_rules ( $ ) {
|
||||
}
|
||||
|
||||
incr_cmd_level $chainref;
|
||||
add_ijump( $chainref, g => $smurfdest, s => '$address' );
|
||||
add_ijump_extended( $chainref, g => $smurfdest, $origin, s => '$address' );
|
||||
decr_cmd_level $chainref;
|
||||
add_commands $chainref, 'done';
|
||||
}
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
add_ijump( $chainref, g => $smurfdest, s => '224.0.0.0/4' );
|
||||
add_ijump_extended( $chainref, g => $smurfdest, $origin, s => '224.0.0.0/4' );
|
||||
} else {
|
||||
add_ijump( $chainref, g => $smurfdest, s => IPv6_MULTICAST );
|
||||
add_ijump_extended( $chainref, g => $smurfdest, $origin, s => IPv6_MULTICAST );
|
||||
}
|
||||
|
||||
my @state = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,INVALID,UNTRACKED' : state_imatch 'NEW,INVALID';
|
||||
@@ -881,11 +904,13 @@ sub add_common_rules ( $ ) {
|
||||
for my $hostref ( @$list ) {
|
||||
$interface = $hostref->[0];
|
||||
my $ipsec = $hostref->[1];
|
||||
my $net = $hostref->[2];
|
||||
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
||||
my $target = source_exclusion( $hostref->[3], $chainref );
|
||||
my $origin = $hostref->[5];
|
||||
|
||||
for $chain ( option_chains $interface ) {
|
||||
add_ijump( $filter_table->{$chain} , j => $target, @state, imatch_source_net( $hostref->[2] ), @policy );
|
||||
add_ijump_extended( $filter_table->{$chain} , j => $target, $origin, @state, imatch_source_net( $net ), @policy );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -938,21 +963,27 @@ sub add_common_rules ( $ ) {
|
||||
my $ports = $family == F_IPV4 ? '67:68' : '546:547';
|
||||
|
||||
for $interface ( @$list ) {
|
||||
set_rule_option( add_ijump( $filter_table->{$_} , j => 'ACCEPT', p => "udp --dport $ports" ) ,
|
||||
my $origin = get_interface_origin($interface);
|
||||
set_rule_option( add_ijump_extended( $filter_table->{$_} ,
|
||||
j => 'ACCEPT',
|
||||
$origin,
|
||||
p => "udp --dport $ports" ) ,
|
||||
'dhcp',
|
||||
1 ) for input_option_chain( $interface ), output_option_chain( $interface );
|
||||
|
||||
add_ijump( $filter_table->{forward_option_chain $interface} ,
|
||||
j => 'ACCEPT',
|
||||
p => "udp --dport $ports" ,
|
||||
imatch_dest_dev( $interface ) )
|
||||
add_ijump_extended( $filter_table->{forward_option_chain $interface} ,
|
||||
j => 'ACCEPT',
|
||||
$origin,
|
||||
p => "udp --dport $ports" ,
|
||||
imatch_dest_dev( $interface ) )
|
||||
if get_interface_option( $interface, 'bridge' );
|
||||
|
||||
unless ( $family == F_IPV6 || get_interface_option( $interface, 'allip' ) ) {
|
||||
add_ijump( $filter_table->{input_chain( $interface ) } ,
|
||||
j => 'ACCEPT' ,
|
||||
p => "udp --dport $ports" ,
|
||||
s => NILIPv4 . '/' . VLSMv4 );
|
||||
add_ijump_extended( $filter_table->{input_chain( $interface ) } ,
|
||||
j => 'ACCEPT' ,
|
||||
$origin ,
|
||||
p => "udp --dport $ports" ,
|
||||
s => NILIPv4 . '/' . VLSMv4 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -964,6 +995,7 @@ sub add_common_rules ( $ ) {
|
||||
my $tag = $globals{TCP_FLAGS_LOG_TAG};
|
||||
my $disposition = $config{TCP_FLAGS_DISPOSITION};
|
||||
my $audit = $disposition =~ /^A_/;
|
||||
my $origin = $origin{TCP_FLAGS_DISPOSITION};
|
||||
|
||||
progress_message2 "$doing TCP Flags filtering...";
|
||||
|
||||
@@ -983,20 +1015,20 @@ sub add_common_rules ( $ ) {
|
||||
$globals{LOGLIMIT},
|
||||
$tag,
|
||||
'add',
|
||||
''
|
||||
);
|
||||
'' ,
|
||||
$origin{TCP_FLAGS_LOG_LEVEL} );
|
||||
|
||||
$globals{LOGPARMS} = $savelogparms;
|
||||
|
||||
if ( $audit ) {
|
||||
$disposition =~ s/^A_//;
|
||||
add_ijump( $logflagsref, j => 'AUDIT', targetopts => '--type ' . lc $disposition );
|
||||
add_ijump_extended( $logflagsref, j => 'AUDIT', $origin, targetopts => '--type ' . lc $disposition );
|
||||
}
|
||||
|
||||
if ( $disposition eq 'REJECT' ) {
|
||||
add_ijump $logflagsref , j => 'REJECT', targetopts => '--reject-with tcp-reset', p => 6;
|
||||
add_ijump_extended $logflagsref , j => 'REJECT', $origin, targetopts => '--reject-with tcp-reset', p => 6;
|
||||
} else {
|
||||
add_ijump $logflagsref , j => $disposition;
|
||||
add_ijump_extended $logflagsref , j => $disposition, $origin;
|
||||
}
|
||||
|
||||
$disposition = 'logflags';
|
||||
@@ -1018,9 +1050,10 @@ sub add_common_rules ( $ ) {
|
||||
my $target = source_exclusion( $hostref->[3], $chainref );
|
||||
my $ipsec = $hostref->[1];
|
||||
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
||||
my $origin = $hostref->[5];
|
||||
|
||||
for $chain ( option_chains $interface ) {
|
||||
add_ijump( $filter_table->{$chain} , j => $target, p => 'tcp', imatch_source_net( $hostref->[2] ), @policy );
|
||||
add_ijump_extended( $filter_table->{$chain} , j => $target, $origin, p => 'tcp', imatch_source_net( $hostref->[2] ), @policy );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1040,7 +1073,7 @@ sub add_common_rules ( $ ) {
|
||||
$announced = 1;
|
||||
|
||||
for $interface ( @$list ) {
|
||||
add_ijump $nat_table->{PREROUTING} , j => 'UPnP', imatch_source_dev ( $interface );
|
||||
add_ijump_extended $nat_table->{PREROUTING} , j => 'UPnP', get_interface_origin($interface), imatch_source_dev ( $interface );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1054,16 +1087,17 @@ sub add_common_rules ( $ ) {
|
||||
my $base = uc var_base get_physical $interface;
|
||||
my $optional = interface_is_optional( $interface );
|
||||
my $variable = get_interface_gateway( $interface, ! $optional );
|
||||
my $origin = get_interface_origin( $interface );
|
||||
|
||||
if ( $optional ) {
|
||||
add_commands( $chainref,
|
||||
qq(if [ -n "SW_\$${base}_IS_USABLE" -a -n "$variable" ]; then) );
|
||||
incr_cmd_level( $chainref );
|
||||
add_ijump( $chainref, j => 'ACCEPT', imatch_source_dev( $interface ), s => $variable, p => 'udp' );
|
||||
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
|
||||
decr_cmd_level( $chainref );
|
||||
add_commands( $chainref, 'fi' );
|
||||
} else {
|
||||
add_ijump( $chainref, j => 'ACCEPT', imatch_source_dev( $interface ), s => $variable, p => 'udp' );
|
||||
add_ijump_extended( $chainref, j => 'ACCEPT', $origin, imatch_source_dev( $interface ), s => $variable, p => 'udp' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1191,6 +1225,7 @@ sub setup_mac_lists( $ ) {
|
||||
my $ipsec = $hostref->[1];
|
||||
my @policy = $ipsec && have_ipsec ? ( policy => "--pol $ipsec --dir in" ) : ();
|
||||
my @source = imatch_source_net $hostref->[2];
|
||||
my $origin = $hostref->[5];
|
||||
|
||||
my @state = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,UNTRACKED' : state_imatch 'NEW';
|
||||
|
||||
@@ -1198,11 +1233,11 @@ sub setup_mac_lists( $ ) {
|
||||
my $chainref = source_exclusion( $hostref->[3], $filter_table->{mac_chain $interface} );
|
||||
|
||||
for my $chain ( option_chains $interface ) {
|
||||
add_ijump $filter_table->{$chain} , j => $chainref, @source, @state, @policy;
|
||||
add_ijump_extended $filter_table->{$chain} , j => $chainref, $origin, @source, @state, @policy;
|
||||
}
|
||||
} else {
|
||||
my $chainref = source_exclusion( $hostref->[3], $mangle_table->{mac_chain $interface} );
|
||||
add_ijump $mangle_table->{PREROUTING}, j => $chainref, imatch_source_dev( $interface ), @source, @state, @policy;
|
||||
add_ijump_extended $mangle_table->{PREROUTING}, j => $chainref, $origin, imatch_source_dev( $interface ), @source, @state, @policy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1258,7 +1293,7 @@ sub setup_mac_lists( $ ) {
|
||||
|
||||
run_user_exit2( 'maclog', $chainref );
|
||||
|
||||
log_irule_limit $level, $chainref , $chain , $disposition, [], $tag, 'add' if $level ne '';
|
||||
log_irule_limit $level, $chainref , $chain , $disposition, [], $tag, 'add', '' if $level ne '';
|
||||
add_ijump $chainref, j => $target;
|
||||
}
|
||||
}
|
||||
@@ -1293,8 +1328,8 @@ sub rules_target( $$ ) {
|
||||
#
|
||||
# Generate rules for one destination zone
|
||||
#
|
||||
sub generate_dest_rules( $$$;@ ) {
|
||||
my ( $chainref, $chain, $z2, @matches ) = @_;
|
||||
sub generate_dest_rules( $$$$;@ ) {
|
||||
my ( $chainref, $chain, $z2, $origin, @matches ) = @_;
|
||||
|
||||
my $z2ref = find_zone( $z2 );
|
||||
my $type2 = $z2ref->{type};
|
||||
@@ -1302,16 +1337,18 @@ sub generate_dest_rules( $$$;@ ) {
|
||||
if ( $type2 & VSERVER ) {
|
||||
for my $hostref ( @{$z2ref->{hosts}{ip}{'%vserver%'}} ) {
|
||||
my $exclusion = dest_exclusion( $hostref->{exclusions}, $chain);
|
||||
my $origin = $hostref->{origin};
|
||||
|
||||
for my $net ( @{$hostref->{hosts}} ) {
|
||||
add_ijump( $chainref,
|
||||
j => $exclusion ,
|
||||
imatch_dest_net ( $net ),
|
||||
@matches );
|
||||
add_ijump_extended( $chainref,
|
||||
j => $exclusion ,
|
||||
$origin,
|
||||
imatch_dest_net ( $net ),
|
||||
@matches );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
add_ijump( $chainref, j => $chain, @matches );
|
||||
add_ijump_extended( $chainref, j => $chain, $origin, @matches );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1329,11 +1366,13 @@ sub generate_source_rules( $$$;@ ) {
|
||||
for my $hostref ( @{defined_zone( $z1 )->{hosts}{ip}{'%vserver%'}} ) {
|
||||
my @ipsec_match = match_ipsec_in $z1 , $hostref;
|
||||
my $exclusion = source_exclusion( $hostref->{exclusions}, $chain);
|
||||
my $origin = $hostref->{origin};
|
||||
|
||||
for my $net ( @{$hostref->{hosts}} ) {
|
||||
generate_dest_rules( $outchainref,
|
||||
$exclusion,
|
||||
$z2,
|
||||
$origin,
|
||||
imatch_source_net( $net ),
|
||||
@matches ,
|
||||
@ipsec_match
|
||||
@@ -1402,7 +1441,7 @@ sub handle_loopback_traffic() {
|
||||
next if $z1 eq $z2 && ( $loopback || $unmanaged );
|
||||
|
||||
my $chain = rules_target( $z1, $z2 );
|
||||
generate_dest_rules( $outchainref, $chain, $z2, @rule ) if $chain;
|
||||
generate_dest_rules( $outchainref, $chain, $z2, '', @rule ) if $chain;
|
||||
}
|
||||
#
|
||||
# Handle conntrack
|
||||
@@ -1641,14 +1680,16 @@ sub handle_complex_zone( $$ ) {
|
||||
#
|
||||
for my $hostref ( @{$arrayref} ) {
|
||||
my @ipsec_match = match_ipsec_in $zone , $hostref;
|
||||
my $origin = $hostref->{origin};
|
||||
for my $net ( @{$hostref->{hosts}} ) {
|
||||
add_ijump(
|
||||
$sourcechainref,
|
||||
@{$zoneref->{parents}} ? 'j' : 'g' => source_exclusion( $hostref->{exclusions}, $frwd_ref ),
|
||||
@interfacematch ,
|
||||
imatch_source_net( $net ),
|
||||
@ipsec_match
|
||||
);
|
||||
add_ijump_extended(
|
||||
$sourcechainref,
|
||||
@{$zoneref->{parents}} ? 'j' : 'g' => source_exclusion( $hostref->{exclusions}, $frwd_ref ),
|
||||
$origin,
|
||||
@interfacematch ,
|
||||
imatch_source_net( $net ),
|
||||
@ipsec_match
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1703,8 +1744,8 @@ sub handle_nested_zone( $$ ) {
|
||||
#
|
||||
# Add output jump to the passed zone:interface:hostref:net
|
||||
#
|
||||
sub add_output_jumps( $$$$$$$ ) {
|
||||
my ( $zone, $interface, $hostref, $net, $exclusions, $isport, $bridge, ) = @_;
|
||||
sub add_output_jumps( $$$$$$$$ ) {
|
||||
my ( $zone, $interface, $hostref, $net, $exclusions, $isport, $bridge, $origin ) = @_;
|
||||
|
||||
our @vservers;
|
||||
our %output_jump_added;
|
||||
@@ -1733,15 +1774,16 @@ sub add_output_jumps( $$$$$$$ ) {
|
||||
#
|
||||
# It is a bridge port zone -- use the bridges output chain and match the physdev
|
||||
#
|
||||
add_ijump( $filter_table->{ output_chain $bridge },
|
||||
j => $outputref ,
|
||||
imatch_dest_dev( $interface, 1 ) )
|
||||
add_ijump_extended( $filter_table->{ output_chain $bridge },
|
||||
j => $outputref ,
|
||||
$origin ,
|
||||
imatch_dest_dev( $interface, 1 ) )
|
||||
unless $output_jump_added{$interface}++;
|
||||
} else {
|
||||
#
|
||||
# Not a bridge -- match the input interface
|
||||
#
|
||||
add_ijump $filter_table->{OUTPUT}, j => $outputref, imatch_dest_dev( $interface ) unless $output_jump_added{$interface}++;
|
||||
add_ijump_extended $filter_table->{OUTPUT}, j => $outputref, $origin, imatch_dest_dev( $interface ) unless $output_jump_added{$interface}++;
|
||||
}
|
||||
|
||||
$use_output = 1;
|
||||
@@ -1770,11 +1812,11 @@ sub add_output_jumps( $$$$$$$ ) {
|
||||
#
|
||||
# Add the jump
|
||||
#
|
||||
add_ijump $outputref , j => $nextchain, @interfacematch, @dest, @ipsec_out_match;
|
||||
add_ijump_extended $outputref , j => $nextchain, $origin, @interfacematch, @dest, @ipsec_out_match;
|
||||
#
|
||||
# Add jump for broadcast
|
||||
#
|
||||
add_ijump( $outputref , j => $nextchain, @interfacematch, d => '255.255.255.255' , @ipsec_out_match )
|
||||
add_ijump_extended( $outputref , j => $nextchain, get_interface_origin( $interface ), @interfacematch, d => '255.255.255.255' , @ipsec_out_match )
|
||||
if $family == F_IPV4 && $hostref->{options}{broadcast};
|
||||
#
|
||||
# Move the rules from the interface output chain if we didn't use it
|
||||
@@ -1785,8 +1827,8 @@ sub add_output_jumps( $$$$$$$ ) {
|
||||
#
|
||||
# Add prerouting jumps from the passed zone:interface:hostref:net
|
||||
#
|
||||
sub add_prerouting_jumps( $$$$$$$$ ) {
|
||||
my ( $zone, $interface, $hostref, $net, $exclusions, $nested, $parenthasnat, $parenthasnotrack ) = @_;
|
||||
sub add_prerouting_jumps( $$$$$$$$$ ) {
|
||||
my ( $zone, $interface, $hostref, $net, $exclusions, $nested, $parenthasnat, $parenthasnotrack , $origin ) = @_;
|
||||
|
||||
my $dnatref = $nat_table->{dnat_chain( $zone )};
|
||||
my $preroutingref = $nat_table->{PREROUTING};
|
||||
@@ -1801,11 +1843,12 @@ sub add_prerouting_jumps( $$$$$$$$ ) {
|
||||
# There are DNAT/REDIRECT rules with this zone as the source.
|
||||
# Add a jump from this source network to this zone's DNAT/REDIRECT chain
|
||||
#
|
||||
add_ijump( $preroutingref,
|
||||
j => source_exclusion( $exclusions, $dnatref),
|
||||
imatch_source_dev( $interface),
|
||||
@source,
|
||||
@ipsec_in_match );
|
||||
add_ijump_extended( $preroutingref,
|
||||
j => source_exclusion( $exclusions, $dnatref),
|
||||
$origin,
|
||||
imatch_source_dev( $interface),
|
||||
@source,
|
||||
@ipsec_in_match );
|
||||
|
||||
check_optimization( $dnatref ) if @source;
|
||||
}
|
||||
@@ -1823,7 +1866,7 @@ sub add_prerouting_jumps( $$$$$$$$ ) {
|
||||
#
|
||||
if ( $nested ) {
|
||||
if ( $parenthasnat ) {
|
||||
add_ijump $preroutingref, j => 'RETURN', imatch_source_dev( $interface), @source, @ipsec_in_match;
|
||||
add_ijump_extended $preroutingref, j => 'RETURN', $origin, imatch_source_dev( $interface), @source, @ipsec_in_match;
|
||||
}
|
||||
if ( $parenthasnotrack ) {
|
||||
my $rawref = $raw_table->{PREROUTING};
|
||||
@@ -1835,8 +1878,8 @@ sub add_prerouting_jumps( $$$$$$$$ ) {
|
||||
#
|
||||
# Add input jump from the passed zone:interface:hostref:net
|
||||
#
|
||||
sub add_input_jumps( $$$$$$$$ ) {
|
||||
my ( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge ) = @_;
|
||||
sub add_input_jumps( $$$$$$$$$ ) {
|
||||
my ( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge, $origin ) = @_;
|
||||
|
||||
our @vservers;
|
||||
our %input_jump_added;
|
||||
@@ -1865,15 +1908,16 @@ sub add_input_jumps( $$$$$$$$ ) {
|
||||
#
|
||||
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
||||
#
|
||||
add_ijump( $filter_table->{ input_chain $bridge },
|
||||
j => $inputchainref ,
|
||||
imatch_source_dev($interface, 1) )
|
||||
add_ijump_extended( $filter_table->{ input_chain $bridge },
|
||||
j => $inputchainref ,
|
||||
$origin ,
|
||||
imatch_source_dev($interface, 1) )
|
||||
unless $input_jump_added{$interface}++;
|
||||
} else {
|
||||
#
|
||||
# Not a bridge -- match the input interface
|
||||
#
|
||||
add_ijump $filter_table->{INPUT}, j => $inputchainref, imatch_source_dev($interface) unless $input_jump_added{$interface}++;
|
||||
add_ijump_extended $filter_table->{INPUT}, j => $inputchainref, $origin, imatch_source_dev($interface) unless $input_jump_added{$interface}++;
|
||||
}
|
||||
|
||||
$use_input = 1;
|
||||
@@ -1884,7 +1928,7 @@ sub add_input_jumps( $$$$$$$$ ) {
|
||||
#
|
||||
for my $vzone ( @vservers ) {
|
||||
my $target = rules_target( $zone, $vzone );
|
||||
generate_dest_rules( $inputchainref, $target, $vzone, @source, @ipsec_in_match ) if $target;
|
||||
generate_dest_rules( $inputchainref, $target, $vzone, $origin, @source, @ipsec_in_match ) if $target;
|
||||
}
|
||||
}
|
||||
} elsif ( $isport ) {
|
||||
@@ -1905,7 +1949,7 @@ sub add_input_jumps( $$$$$$$$ ) {
|
||||
#
|
||||
# Add the jump from the input chain to the rules chain
|
||||
#
|
||||
add_ijump $inputchainref, j => source_exclusion( $exclusions, $chain2 ), @interfacematch, @source, @ipsec_in_match;
|
||||
add_ijump_extended $inputchainref, j => source_exclusion( $exclusions, $chain2 ), $origin, @interfacematch, @source, @ipsec_in_match;
|
||||
move_rules( $interfacechainref , $chain2ref ) unless $use_input;
|
||||
}
|
||||
}
|
||||
@@ -1913,8 +1957,8 @@ sub add_input_jumps( $$$$$$$$ ) {
|
||||
#
|
||||
# This function is called when there is forwarding and this net isn't IPSEC protected. It adds the jump for this net to the zone forwarding chain.
|
||||
#
|
||||
sub add_forward_jump( $$$$$$$$ ) {
|
||||
my ( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge ) = @_;
|
||||
sub add_forward_jump( $$$$$$$$$ ) {
|
||||
my ( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge, $origin ) = @_;
|
||||
|
||||
our %forward_jump_added;
|
||||
|
||||
@@ -1928,37 +1972,39 @@ sub add_forward_jump( $$$$$$$$ ) {
|
||||
#
|
||||
# We must use the interface forwarding chain -- add the jump from the interface forward chain to the zone forward chain.
|
||||
#
|
||||
add_ijump $forwardref , j => $ref, @source, @ipsec_in_match;
|
||||
add_ijump_extended $forwardref , j => $ref, $origin, @source, @ipsec_in_match;
|
||||
|
||||
if ( $isport ) {
|
||||
#
|
||||
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
||||
#
|
||||
add_ijump( $filter_table->{ forward_chain $bridge } ,
|
||||
j => $forwardref ,
|
||||
imatch_source_dev( $interface , 1 ) )
|
||||
add_ijump_extended( $filter_table->{ forward_chain $bridge } ,
|
||||
j => $forwardref ,
|
||||
$origin ,
|
||||
imatch_source_dev( $interface , 1 ) )
|
||||
unless $forward_jump_added{$interface}++;
|
||||
} else {
|
||||
#
|
||||
# Not a bridge -- match the input interface
|
||||
#
|
||||
add_ijump $filter_table->{FORWARD} , j => $forwardref, imatch_source_dev( $interface ) unless $forward_jump_added{$interface}++;
|
||||
add_ijump_extended $filter_table->{FORWARD} , j => $forwardref, $origin, imatch_source_dev( $interface ) unless $forward_jump_added{$interface}++;
|
||||
}
|
||||
} else {
|
||||
if ( $isport ) {
|
||||
#
|
||||
# It is a bridge port zone -- use the bridges input chain and match the physdev
|
||||
#
|
||||
add_ijump( $filter_table->{ forward_chain $bridge } ,
|
||||
j => $ref ,
|
||||
imatch_source_dev( $interface, 1 ) ,
|
||||
@source,
|
||||
@ipsec_in_match );
|
||||
add_ijump_extended( $filter_table->{ forward_chain $bridge } ,
|
||||
j => $ref ,
|
||||
$origin ,
|
||||
imatch_source_dev( $interface, 1 ) ,
|
||||
@source,
|
||||
@ipsec_in_match );
|
||||
} else {
|
||||
#
|
||||
# Not a bridge -- match the input interface
|
||||
#
|
||||
add_ijump $filter_table->{FORWARD} , j => $ref, imatch_source_dev( $interface ) , @source, @ipsec_in_match;
|
||||
add_ijump_extended $filter_table->{FORWARD} , j => $ref, $origin, imatch_source_dev( $interface ) , @source, @ipsec_in_match;
|
||||
}
|
||||
|
||||
move_rules ( $forwardref , $frwd_ref );
|
||||
@@ -2099,6 +2145,7 @@ sub generate_matrix() {
|
||||
|
||||
for my $hostref ( @{$typeref->{$interface}} ) {
|
||||
my $exclusions = $hostref->{exclusions};
|
||||
my $origin = $hostref->{origin};
|
||||
|
||||
for my $net ( @{$hostref->{hosts}} ) {
|
||||
#
|
||||
@@ -2108,7 +2155,7 @@ sub generate_matrix() {
|
||||
#
|
||||
# Policy from the firewall to this zone is not 'CONTINUE' and this isn't a bport zone
|
||||
#
|
||||
add_output_jumps( $zone, $interface, $hostref, $net, $exclusions, $isport, $bridge );
|
||||
add_output_jumps( $zone, $interface, $hostref, $net, $exclusions, $isport, $bridge, $origin );
|
||||
}
|
||||
|
||||
clearrule;
|
||||
@@ -2117,15 +2164,15 @@ sub generate_matrix() {
|
||||
#
|
||||
# PREROUTING
|
||||
#
|
||||
add_prerouting_jumps( $zone, $interface, $hostref, $net, $exclusions, $nested, $parenthasnat, $parenthasnotrack );
|
||||
add_prerouting_jumps( $zone, $interface, $hostref, $net, $exclusions, $nested, $parenthasnat, $parenthasnotrack , $origin );
|
||||
#
|
||||
# INPUT
|
||||
#
|
||||
add_input_jumps( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge );
|
||||
add_input_jumps( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge , $origin );
|
||||
#
|
||||
# FORWARDING Jump for non-IPSEC host group
|
||||
#
|
||||
add_forward_jump( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge ) if $frwd_ref && $hostref->{ipsec} ne 'ipsec';
|
||||
add_forward_jump( $zone, $interface, $hostref, $net, $exclusions, $frwd_ref, $isport, $bridge, $origin ) if $frwd_ref && $hostref->{ipsec} ne 'ipsec';
|
||||
}
|
||||
} # Subnet Loop
|
||||
} # Hostref Loop
|
||||
@@ -2177,8 +2224,9 @@ sub generate_matrix() {
|
||||
if ( $zone ne $zone1 || $num_ifaces > 1 || $hostref->{options}{routeback} ) {
|
||||
my @ipsec_out_match = match_ipsec_out $zone1 , $hostref;
|
||||
my $dest_exclusion = dest_exclusion( $hostref->{exclusions}, $chain);
|
||||
my $origin = $hostref->{origin};
|
||||
for my $net ( @{$hostref->{hosts}} ) {
|
||||
add_ijump $frwd_ref, j => $dest_exclusion, imatch_dest_dev( $interface) , imatch_dest_net($net), @ipsec_out_match;
|
||||
add_ijump_extended $frwd_ref, j => $dest_exclusion, $origin, imatch_dest_dev( $interface) , imatch_dest_net($net), @ipsec_out_match;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2220,17 +2268,19 @@ sub generate_matrix() {
|
||||
nat=> [ qw/PREROUTING OUTPUT POSTROUTING/ ] ,
|
||||
filter=> [ qw/INPUT FORWARD OUTPUT/ ] );
|
||||
|
||||
my $origin = $origin{LOGALLNEW};
|
||||
|
||||
for my $table ( qw/mangle nat filter/ ) {
|
||||
for my $chain ( @{$builtins{$table}} ) {
|
||||
log_rule_limit
|
||||
$config{LOGALLNEW} ,
|
||||
$chain_table{$table}{$chain} ,
|
||||
$table ,
|
||||
$chain ,
|
||||
'' ,
|
||||
'' ,
|
||||
'insert' ,
|
||||
state_match('NEW');
|
||||
log_rule_limit( $config{LOGALLNEW} ,
|
||||
$chain_table{$table}{$chain} ,
|
||||
$table ,
|
||||
$chain ,
|
||||
'' ,
|
||||
'' ,
|
||||
'insert' ,
|
||||
state_match('NEW') ,
|
||||
$origin );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Nat.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Nat.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
@@ -69,7 +69,6 @@ sub process_one_masq1( $$$$$$$$$$$ )
|
||||
my $destnets = '';
|
||||
my $baserule = '';
|
||||
my $inlinematches = '';
|
||||
|
||||
#
|
||||
# Leading '+'
|
||||
#
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Proc.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Proc.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Providers.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Providers.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010.2011,2012 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
@@ -144,20 +144,21 @@ sub setup_route_marking() {
|
||||
my $interface = $providerref->{interface};
|
||||
my $physical = $providerref->{physical};
|
||||
my $mark = $providerref->{mark};
|
||||
my $origin = $providerref->{origin};
|
||||
|
||||
unless ( $marked_interfaces{$interface} ) {
|
||||
add_ijump $mangle_table->{PREROUTING} , j => $chainref, i => $physical, mark => "--mark 0/$mask";
|
||||
add_ijump $mangle_table->{PREROUTING} , j => $chainref1, i => "! $physical", mark => "--mark $mark/$mask";
|
||||
add_ijump $mangle_table->{OUTPUT} , j => $chainref2, mark => "--mark $mark/$mask";
|
||||
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref, $origin, i => $physical, mark => "--mark 0/$mask";
|
||||
add_ijump_extended $mangle_table->{PREROUTING} , j => $chainref1, $origin, i => "! $physical", mark => "--mark $mark/$mask";
|
||||
add_ijump_extended $mangle_table->{OUTPUT} , j => $chainref2, $origin, mark => "--mark $mark/$mask";
|
||||
$marked_interfaces{$interface} = 1;
|
||||
}
|
||||
|
||||
if ( $providerref->{shared} ) {
|
||||
add_commands( $chainref, qq(if [ -n "$providerref->{mac}" ]; then) ), incr_cmd_level( $chainref ) if $providerref->{optional};
|
||||
add_ijump $chainref, j => 'MARK', targetopts => "--set-mark $providerref->{mark}${exmask}", imatch_source_dev( $interface ), mac => "--mac-source $providerref->{mac}";
|
||||
add_ijump_extended $chainref, j => 'MARK', $origin, targetopts => "--set-mark $providerref->{mark}${exmask}", imatch_source_dev( $interface ), mac => "--mac-source $providerref->{mac}";
|
||||
decr_cmd_level( $chainref ), add_commands( $chainref, "fi\n" ) if $providerref->{optional};
|
||||
} else {
|
||||
add_ijump $chainref, j => 'MARK', targetopts => "--set-mark $providerref->{mark}${exmask}", imatch_source_dev( $interface );
|
||||
add_ijump_extended $chainref, j => 'MARK', $origin, targetopts => "--set-mark $providerref->{mark}${exmask}", imatch_source_dev( $interface );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +651,7 @@ sub process_a_provider( $ ) {
|
||||
|
||||
$balance = $default_balance unless $balance;
|
||||
|
||||
fatal_error "Interface $interface is already associated with non-shared provider $provider_interfaces{$interface}" if $provider_interfaces{$table};
|
||||
fatal_error "Interface $interface is already associated with non-shared provider $provider_interfaces{$interface}" if $provider_interfaces{$interface};
|
||||
|
||||
if ( $duplicate ne '-' ) {
|
||||
fatal_error "The DUPLICATE column must be empty when USE_DEFAULT_RT=Yes" if $config{USE_DEFAULT_RT};
|
||||
@@ -699,6 +700,7 @@ sub process_a_provider( $ ) {
|
||||
persistent_routes => [],
|
||||
routedests => {} ,
|
||||
persistent => $persistent,
|
||||
origin => shortlineinfo( '' ),
|
||||
};
|
||||
|
||||
$provider_interfaces{$interface} = $table unless $shared;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Proxyarp.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Proxyarp.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2011,2011 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Raw.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Raw.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2009-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
@@ -36,7 +36,7 @@ use strict;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw( setup_conntrack );
|
||||
our @EXPORT_OK = qw( handle_helper_rule );
|
||||
our $VERSION = '4.6_10';
|
||||
our $VERSION = 'MODULEVERSION';
|
||||
|
||||
our %valid_ctevent = ( new => 1,
|
||||
related => 1,
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Rules.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Rules.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
@@ -975,7 +975,8 @@ sub setup_syn_flood_chains() {
|
||||
'DROP',
|
||||
@{$globals{LOGILIMIT}} ? $globals{LOGILIMIT} : [ limit => "--limit 5/min --limit-burst 5" ] ,
|
||||
'' ,
|
||||
'add' )
|
||||
'add',
|
||||
'' )
|
||||
if $level ne '';
|
||||
add_ijump $synchainref, j => 'DROP';
|
||||
}
|
||||
@@ -1027,7 +1028,7 @@ sub finish_chain_section ($$$) {
|
||||
|
||||
for ( qw( ESTABLISHED RELATED INVALID UNTRACKED ) ) {
|
||||
if ( $state{$_} ) {
|
||||
my ( $char, $level, $tag, $target ) = @{$statetable{$_}};
|
||||
my ( $char, $level, $tag, $target , $origin, $level_origin ) = @{$statetable{$_}};
|
||||
my $twochains = substr( $chainref->{name}, 0, 1 ) eq $char;
|
||||
|
||||
if ( $twochains || $level || $target ne 'ACCEPT' ) {
|
||||
@@ -1047,17 +1048,18 @@ sub finish_chain_section ($$$) {
|
||||
$globals{LOGLIMIT},
|
||||
$tag ,
|
||||
'add' ,
|
||||
'');
|
||||
'',
|
||||
$level_origin );
|
||||
|
||||
$target = ensure_audit_chain( $target ) if ( $targets{$target} || 0 ) & AUDIT;
|
||||
|
||||
add_ijump( $chain2ref, g => $target ) if $target;
|
||||
add_ijump_extended( $chain2ref, g => $target , $origin ) if $target;
|
||||
|
||||
$target = $chain2ref->{name} unless $twochains;
|
||||
}
|
||||
|
||||
if ( $twochains ) {
|
||||
add_ijump $chainref, g => $target if $target;
|
||||
add_ijump_extended $chainref, g => $target , $origin if $target;
|
||||
delete $state{$_};
|
||||
last;
|
||||
}
|
||||
@@ -1072,7 +1074,7 @@ sub finish_chain_section ($$$) {
|
||||
delete $state{ESTABLISHED};
|
||||
}
|
||||
|
||||
add_ijump( $chainref, j => $target, state_imatch $_ );
|
||||
add_ijump_extended( $chainref, j => $target, $origin, state_imatch $_ );
|
||||
}
|
||||
|
||||
delete $state{$_};
|
||||
@@ -1547,11 +1549,11 @@ sub dropBcast( $$$$ ) {
|
||||
|
||||
if ( have_capability( 'ADDRTYPE' ) ) {
|
||||
if ( $level ne '' ) {
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', addrtype => '--dst-type BROADCAST' );
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', addrtype => '--dst-type BROADCAST' );
|
||||
if ( $family == F_IPV4 ) {
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => '224.0.0.0/4' );
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '224.0.0.0/4' );
|
||||
} else {
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => IPv6_MULTICAST );
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => IPv6_MULTICAST );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1564,17 +1566,17 @@ sub dropBcast( $$$$ ) {
|
||||
}
|
||||
|
||||
incr_cmd_level $chainref;
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => '$address' ) if $level ne '';
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '$address' ) if $level ne '';
|
||||
add_ijump $chainref, j => $target, d => '$address';
|
||||
decr_cmd_level $chainref;
|
||||
add_commands $chainref, 'done';
|
||||
}
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
log_irule_limit $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => '224.0.0.0/4' if $level ne '';
|
||||
log_irule_limit $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => '224.0.0.0/4' if $level ne '';
|
||||
add_ijump $chainref, j => $target, d => '224.0.0.0/4';
|
||||
} else {
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', d => IPv6_MULTICAST ) if $level ne '';
|
||||
log_irule_limit( $level, $chainref, 'dropBcast' , 'DROP', [], $tag, 'add', '', d => IPv6_MULTICAST ) if $level ne '';
|
||||
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
|
||||
}
|
||||
}
|
||||
@@ -1586,8 +1588,8 @@ sub allowBcast( $$$$ ) {
|
||||
|
||||
if ( $family == F_IPV4 && have_capability( 'ADDRTYPE' ) ) {
|
||||
if ( $level ne '' ) {
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', addrtype => '--dst-type BROADCAST' );
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', d => '224.0.0.0/4' );
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', addrtype => '--dst-type BROADCAST' );
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', ''. d => '224.0.0.0/4' );
|
||||
}
|
||||
|
||||
add_ijump $chainref, j => $target, addrtype => '--dst-type BROADCAST';
|
||||
@@ -1599,17 +1601,17 @@ sub allowBcast( $$$$ ) {
|
||||
}
|
||||
|
||||
incr_cmd_level $chainref;
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', d => '$address' ) if $level ne '';
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', d => '$address' ) if $level ne '';
|
||||
add_ijump $chainref, j => $target, d => '$address';
|
||||
decr_cmd_level $chainref;
|
||||
add_commands $chainref, 'done';
|
||||
}
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', d => '224.0.0.0/4' ) if $level ne '';
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', [], $tag, 'add', '', d => '224.0.0.0/4' ) if $level ne '';
|
||||
add_ijump $chainref, j => $target, d => '224.0.0.0/4';
|
||||
} else {
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', d => IPv6_MULTICAST ) if $level ne '';
|
||||
log_irule_limit( $level, $chainref, 'allowBcast' , 'ACCEPT', '', $tag, 'add', '', d => IPv6_MULTICAST ) if $level ne '';
|
||||
add_ijump $chainref, j => $target, d => IPv6_MULTICAST;
|
||||
}
|
||||
}
|
||||
@@ -1619,7 +1621,7 @@ sub dropNotSyn ( $$$$ ) {
|
||||
|
||||
my $target = require_audit( 'DROP', $audit );
|
||||
|
||||
log_irule_limit( $level, $chainref, 'dropNotSyn' , 'DROP', [], $tag, 'add', p => '6 ! --syn' ) if $level ne '';
|
||||
log_irule_limit( $level, $chainref, 'dropNotSyn' , 'DROP', [], $tag, 'add', '', p => '6 ! --syn' ) if $level ne '';
|
||||
add_ijump $chainref , j => $target, p => '6 ! --syn';
|
||||
}
|
||||
|
||||
@@ -1634,7 +1636,7 @@ sub rejNotSyn ( $$$$ ) {
|
||||
$target = require_audit( 'REJECT' , $audit );
|
||||
}
|
||||
|
||||
log_irule_limit( $level, $chainref, 'rejNotSyn' , 'REJECT', [], $tag, 'add', p => '6 ! --syn' ) if $level ne '';
|
||||
log_irule_limit( $level, $chainref, 'rejNotSyn' , 'REJECT', [], $tag, 'add', '', p => '6 ! --syn' ) if $level ne '';
|
||||
add_ijump $chainref , j => $target, p => '6 ! --syn';
|
||||
}
|
||||
|
||||
@@ -1650,8 +1652,8 @@ sub allowinUPnP ( $$$$ ) {
|
||||
my $target = require_audit( 'ACCEPT', $audit );
|
||||
|
||||
if ( $level ne '' ) {
|
||||
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', p => '17 --dport 1900' );
|
||||
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', p => '6 --dport 49152' );
|
||||
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', '', p => '17 --dport 1900' );
|
||||
log_irule_limit( $level, $chainref, 'allowinUPnP' , 'ACCEPT', [], $tag, 'add', '', p => '6 --dport 49152' );
|
||||
}
|
||||
|
||||
add_ijump $chainref, j => $target, p => '17 --dport 1900';
|
||||
@@ -1688,7 +1690,7 @@ sub Limit( $$$$ ) {
|
||||
|
||||
if ( $level ne '' ) {
|
||||
my $xchainref = new_chain 'filter' , "$chainref->{name}%";
|
||||
log_irule_limit( $level, $xchainref, $param[0], 'DROP', [], $tag, 'add' );
|
||||
log_irule_limit( $level, $xchainref, $param[0], 'DROP', [], $tag, 'add' , '' );
|
||||
add_ijump $xchainref, j => 'DROP';
|
||||
add_ijump $chainref, j => $xchainref, recent => "--name $set --update --seconds $param[2] --hitcount $count";
|
||||
} else {
|
||||
@@ -1712,10 +1714,14 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ );
|
||||
#
|
||||
# Populate an action invocation chain. As new action tuples are encountered,
|
||||
# the function will be called recursively by process_rule().
|
||||
#
|
||||
# Note that the first two parameters are passed by reference and may be
|
||||
# modified by this function.
|
||||
#
|
||||
sub process_action($$) {
|
||||
my ( $chainref, $caller ) = @_;
|
||||
my $wholeaction = $chainref->{action};
|
||||
sub process_action(\$\$$) {
|
||||
my ( $wholeactionref, $chainrefref, $caller ) = @_;
|
||||
my $wholeaction = ${$wholeactionref};
|
||||
my $chainref = ${$chainrefref};
|
||||
my ( $action, $level, $tag, undef, $param ) = split /:/, $wholeaction, ACTION_TUPLE_ELEMENTS;
|
||||
|
||||
if ( $targets{$action} & BUILTIN ) {
|
||||
@@ -1794,10 +1800,48 @@ sub process_action($$) {
|
||||
|
||||
#
|
||||
# Pop the action parameters
|
||||
# Caller should delete record of this chain if the action parameters
|
||||
# were modified (and this function returns true
|
||||
#
|
||||
pop_action_params( $oldparms );
|
||||
if ( ( my $result = pop_action_params( $oldparms ) ) & PARMSMODIFIED ) {
|
||||
#
|
||||
# The action modified its parameters -- delete it from %usedactions
|
||||
#
|
||||
delete $usedactions{$wholeaction};
|
||||
} elsif ( $result & USEDCALLER ) {
|
||||
#
|
||||
# The chain uses @CALLER but doesn't modify the action parameters.
|
||||
# We need to see if this caller has already invoked this action
|
||||
#
|
||||
my $renormalized_action = insert_caller( $wholeaction, $caller );
|
||||
my $chain1ref = $usedactions{$renormalized_action};
|
||||
|
||||
if ( $chain1ref ) {
|
||||
#
|
||||
# It has -- use the prior chain
|
||||
#
|
||||
${$chainrefref} = $chain1ref;
|
||||
#
|
||||
# We leave the new chain in place but delete it from %usedactions below
|
||||
# The optimizer will drop it from the final ruleset.
|
||||
#
|
||||
} else {
|
||||
#
|
||||
# This is the first time that the current chain has invoked this action
|
||||
#
|
||||
$usedactions{$renormalized_action} = $chainref;
|
||||
#
|
||||
# Update the action member
|
||||
#
|
||||
$chainref->{action} = $renormalized_action;
|
||||
}
|
||||
#
|
||||
# Delete the usedactions entry with the original normalized key
|
||||
#
|
||||
delete $usedactions{$wholeaction};
|
||||
#
|
||||
# New normalized target
|
||||
#
|
||||
${$wholeactionref} = $renormalized_action;
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
@@ -1930,11 +1974,14 @@ sub process_actions() {
|
||||
# Create a policy action if it doesn't already exist
|
||||
#
|
||||
sub use_policy_action( $$ ) {
|
||||
my $ref = use_action( $_[0] );
|
||||
my ( $normalized_target, $caller ) = @_;
|
||||
|
||||
my $ref = use_action( $normalized_target );
|
||||
|
||||
if ( $ref ) {
|
||||
delete $usedactions{$ref->{action}} if process_action( $ref, $_[1] ) & PARMSMODIFIED;
|
||||
process_action( $normalized_target, $ref, $caller );
|
||||
} else {
|
||||
$ref = $usedactions{$_[0]};
|
||||
$ref = $usedactions{$normalized_target};
|
||||
}
|
||||
|
||||
$ref;
|
||||
@@ -2684,7 +2731,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
#
|
||||
# Handle actions
|
||||
#
|
||||
my $delete_action = 0;
|
||||
my $actionchain; #Name of the action chain
|
||||
|
||||
if ( $actiontype & ACTION ) {
|
||||
#
|
||||
@@ -2700,52 +2747,29 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
#
|
||||
my $savestatematch = $statematch;
|
||||
$statematch = '';
|
||||
|
||||
if ( ( $delete_action = process_action( $ref, $chain ) ) & USEDCALLER ) {
|
||||
#
|
||||
# The chain uses @CALLER but doesn't modify the action parameters.
|
||||
# We need to see if this chain has already called this action
|
||||
#
|
||||
my $renormalized_target = insert_caller( $normalized_target, $chain );
|
||||
my $ref1 = $usedactions{$renormalized_target};
|
||||
|
||||
if ( $ref1 ) {
|
||||
#
|
||||
# It has -- use the prior chain
|
||||
#
|
||||
$ref = $ref1;
|
||||
#
|
||||
# We leave the new chain in place but delete it from %usedactions below
|
||||
#
|
||||
} else {
|
||||
#
|
||||
# This is the first time that the current chain has invoked this action
|
||||
#
|
||||
$usedactions{$renormalized_target} = $ref;
|
||||
#
|
||||
# Swap the action member
|
||||
#
|
||||
$ref->{action} = $renormalized_target;
|
||||
}
|
||||
#
|
||||
# Delete the usedactions entry with the original normalized key
|
||||
#
|
||||
delete $usedactions{$normalized_target};
|
||||
#
|
||||
# New normalized target
|
||||
#
|
||||
$normalized_target = $renormalized_target;
|
||||
}
|
||||
#
|
||||
# process_action may modify both $normalized_target and $ref!!!
|
||||
#
|
||||
process_action( $normalized_target, $ref, $chain );
|
||||
#
|
||||
# Capture the name of the action chain
|
||||
#
|
||||
$actionchain = $ref->{name};
|
||||
#
|
||||
# Processing the action may determine that the action or one of it's dependents does NAT or HELPER, so:
|
||||
#
|
||||
# - Refresh $actiontype
|
||||
# - Create the associated nat and/or table chain if appropriate.
|
||||
#
|
||||
ensure_chain( 'nat', $ref->{name} ) if ( $actiontype = $targets{$basictarget} ) & NATRULE;
|
||||
ensure_chain( 'raw', $ref->{name} ) if ( $actiontype & HELPER );
|
||||
ensure_chain( 'nat', $actionchain ) if ( $actiontype = $targets{$basictarget} ) & NATRULE;
|
||||
ensure_chain( 'raw', $actionchain ) if ( $actiontype & HELPER );
|
||||
|
||||
$statematch = $savestatematch;
|
||||
} else {
|
||||
#
|
||||
# We've seen this tuple before
|
||||
#
|
||||
$actionchain = $usedactions{$normalized_target}->{name};
|
||||
}
|
||||
|
||||
$action = $basictarget; # Remove params, if any, from $action.
|
||||
@@ -2865,7 +2889,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
$ports,
|
||||
$sports,
|
||||
$sourceref,
|
||||
( $actiontype & ACTION ) ? $usedactions{$normalized_target}->{name} : '',
|
||||
( $actiontype & ACTION ) ? $actionchain : '',
|
||||
$inchain ? $chain : '' ,
|
||||
$user ,
|
||||
$rule ,
|
||||
@@ -2887,7 +2911,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
$proto,
|
||||
$ports,
|
||||
$origdest,
|
||||
( $actiontype & ACTION ) ? $usedactions{$normalized_target}->{name} : '',
|
||||
( $actiontype & ACTION ) ? $actionchain : '',
|
||||
$action,
|
||||
$sourceref,
|
||||
$inaction ? $chain : '',
|
||||
@@ -2944,7 +2968,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
unless ( $actiontype & NATONLY ) {
|
||||
|
||||
if ( $actiontype & ACTION ) {
|
||||
$action = $usedactions{$normalized_target}{name};
|
||||
$action = $actionchain;
|
||||
$loglevel = '';
|
||||
}
|
||||
|
||||
@@ -2975,8 +2999,6 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$$ ) {
|
||||
unless unreachable_warning( $wildcard || $section == DEFAULTACTION_SECTION, $chainref );
|
||||
}
|
||||
|
||||
delete $usedactions{$normalized_target} if $delete_action & PARMSMODIFIED;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3433,9 +3455,9 @@ sub process_rules() {
|
||||
# Populate the state table
|
||||
#
|
||||
%statetable = ( ESTABLISHED => [ '^', '', '', 'ACCEPT' ] ,
|
||||
RELATED => [ '+', $config{RELATED_LOG_LEVEL}, $globals{RELATED_LOG_TAG}, $globals{RELATED_TARGET} ] ,
|
||||
INVALID => [ '_', $config{INVALID_LOG_LEVEL}, $globals{INVALID_LOG_TAG}, $globals{INVALID_TARGET} ] ,
|
||||
UNTRACKED => [ '&', $config{UNTRACKED_LOG_LEVEL}, $globals{UNTRACKED_LOG_TAG}, $globals{UNTRACKED_TARGET} ] ,
|
||||
RELATED => [ '+', $config{RELATED_LOG_LEVEL}, $globals{RELATED_LOG_TAG}, $globals{RELATED_TARGET} , $origin{RELATED_DISPOSITION} , $origin{RELATED_LOG_LEVEL} ] ,
|
||||
INVALID => [ '_', $config{INVALID_LOG_LEVEL}, $globals{INVALID_LOG_TAG}, $globals{INVALID_TARGET} , $origin{INVALID_DISPOSITION} , $origin{INVALID_LOG_LEVEL} ] ,
|
||||
UNTRACKED => [ '&', $config{UNTRACKED_LOG_LEVEL}, $globals{UNTRACKED_LOG_TAG}, $globals{UNTRACKED_TARGET} , $origin{UNTRACKED_DISPOSITION} , $origin{UNTRACKED_LOG_LEVEL} ] ,
|
||||
);
|
||||
%section_states = ( BLACKLIST_SECTION , $globals{BLACKLIST_STATES},
|
||||
ESTABLISHED_SECTION, 'ESTABLISHED',
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Tc.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Tc.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011,2012,2013 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Traffic Control is from tc4shorewall Version 0.5
|
||||
# (c) 2005 Arne Bernin <arne@ucbering.de>
|
||||
@@ -2954,7 +2954,9 @@ sub process_traffic_shaping() {
|
||||
|
||||
my ( $options, $redopts ) = ( '', $tcref->{redopts} );
|
||||
|
||||
while ( my ( $option, $type ) = each %validredoptions ) {
|
||||
for my $option ( sort keys %validredoptions ) {
|
||||
my $type = $validredoptions{$option};
|
||||
|
||||
if ( my $value = $redopts->{$option} ) {
|
||||
if ( $type == RED_NONE ) {
|
||||
$options = join( ' ', $options, $option ) if $value;
|
||||
@@ -2971,7 +2973,9 @@ sub process_traffic_shaping() {
|
||||
|
||||
my ( $options, $codelopts ) = ( '', $tcref->{codelopts} );
|
||||
|
||||
while ( my ( $option, $type ) = each %validcodeloptions ) {
|
||||
for my $option ( sort keys %validcodeloptions ) {
|
||||
my $type = $validcodeloptions{$option};
|
||||
|
||||
if ( my $value = $codelopts->{$option} ) {
|
||||
if ( $type == CODEL_NONE ) {
|
||||
$options = join( ' ', $options, $option );
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Tunnels.pm
|
||||
# Shorewall 5.0 -- /usr/share/shorewall/Shorewall/Tunnels.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2007-2016 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
|
@@ -91,6 +91,7 @@ our @EXPORT = ( qw( NOTHING
|
||||
find_interfaces_by_option
|
||||
find_interfaces_by_option1
|
||||
get_interface_option
|
||||
get_interface_origin
|
||||
interface_has_option
|
||||
set_interface_option
|
||||
set_interface_provider
|
||||
@@ -149,6 +150,7 @@ use constant { IN_OUT => 1,
|
||||
# }
|
||||
# hosts => [ <net1> , <net2> , ... ]
|
||||
# exclusions => [ <net1>, <net2>, ... ]
|
||||
# origin => <where defined>
|
||||
# }
|
||||
# <interface2> => ...
|
||||
# }
|
||||
@@ -196,6 +198,7 @@ our %reservedName = ( all => 1,
|
||||
# provider => <Provider Name, if interface is associated with a provider>
|
||||
# wildcard => undef|1 # Wildcard Name
|
||||
# zones => { zone1 => 1, ... }
|
||||
# origin => <where defined>
|
||||
# }
|
||||
# }
|
||||
#
|
||||
@@ -890,7 +893,9 @@ sub add_group_to_zone($$$$$$)
|
||||
push @{$interfaceref}, { options => $options,
|
||||
hosts => \@newnetworks,
|
||||
ipsec => $type & IPSEC ? 'ipsec' : 'none' ,
|
||||
exclusions => \@exclusions };
|
||||
exclusions => \@exclusions ,
|
||||
origin => shortlineinfo( '' ) ,
|
||||
};
|
||||
|
||||
if ( $type != IPSEC ) {
|
||||
my $optref = $interfaces{$interface}{options};
|
||||
@@ -1392,7 +1397,7 @@ sub process_interface( $$ ) {
|
||||
physical => $physical ,
|
||||
base => var_base( $physical ),
|
||||
zones => {},
|
||||
origin => shortlineinfo(''),
|
||||
origin => shortlineinfo( '' ),
|
||||
wildcard => $wildcard,
|
||||
};
|
||||
|
||||
@@ -1858,6 +1863,22 @@ sub interface_has_option( $$\$ ) {
|
||||
}
|
||||
|
||||
#
|
||||
# Return the origin for an interface
|
||||
#
|
||||
sub get_interface_origin( $ ) {
|
||||
my ( $interface ) = @_;
|
||||
|
||||
my $ref = $interfaces{$interface};
|
||||
|
||||
return $ref->{origin} if $ref;
|
||||
|
||||
assert( $ref = known_interface( $interface ) );
|
||||
|
||||
$ref->{origin};
|
||||
|
||||
}
|
||||
|
||||
##
|
||||
# Set an option for an interface
|
||||
#
|
||||
sub set_interface_option( $$$ ) {
|
||||
@@ -2182,11 +2203,12 @@ sub find_hosts_by_option( $ ) {
|
||||
for my $interface ( sort keys %$interfaceref ) {
|
||||
my $arrayref = $interfaceref->{$interface};
|
||||
for my $host ( @{$arrayref} ) {
|
||||
my $ipsec = $host->{ipsec};
|
||||
my $ipsec = $host->{ipsec};
|
||||
my $origin = $host->{origin};
|
||||
unless ( $done{$interface} ) {
|
||||
if ( my $value = $host->{options}{$option} ) {
|
||||
for my $net ( @{$host->{hosts}} ) {
|
||||
push @hosts, [ $interface, $ipsec , $net , $host->{exclusions}, $value ];
|
||||
push @hosts, [ $interface, $ipsec , $net , $host->{exclusions}, $value, $origin ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2213,7 +2235,7 @@ sub find_zone_hosts_by_option( $$ ) {
|
||||
for my $host ( @{$arrayref} ) {
|
||||
if ( my $value = $host->{options}{$option} ) {
|
||||
for my $net ( @{$host->{hosts}} ) {
|
||||
push @hosts, [ $interface, $host->{ipsec} , $net , $host->{exclusions}, $value ];
|
||||
push @hosts, [ $interface, $host->{ipsec} , $net , $host->{exclusions}, $value, $host->{origin} ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1629,7 +1629,7 @@ LOG:info:,bar net fw</programlisting>
|
||||
"/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset"
|
||||
where <emphasis role="bold">uname</emphasis> holds the output of
|
||||
'<command>uname -r</command>' and <emphasis
|
||||
role="bold">g_family</emphasis> holds '4'. </para>
|
||||
role="bold">g_family</emphasis> holds '4'.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -2620,7 +2620,8 @@ INLINE - - - ; -j REJECT
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">TRACK_RULES=</emphasis>{<emphasis
|
||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||
role="bold">Yes</emphasis>|<emphasis
|
||||
role="bold">No</emphasis>|File}</term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 4.5.20. If set to <emphasis
|
||||
@@ -2633,6 +2634,12 @@ INLINE - - - ; -j REJECT
|
||||
<para>Setting this option to <emphasis role="bold">Yes</emphasis>
|
||||
requires the <firstterm>Comments</firstterm> capability in iptables
|
||||
and kernel.</para>
|
||||
|
||||
<para>Beginning with Shorewall 5.0.5, the option may also be set to
|
||||
<emphasis role="bold">File</emphasis>. That setting causes similar
|
||||
comments to be added to the
|
||||
<filename>.iptables-restore-input</filename> file, which is normally
|
||||
created in <filename>/var/lib/shorewall</filename>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@@ -24,4 +24,3 @@ RELOADOPTIONS=""
|
||||
STOPOPTIONS=""
|
||||
|
||||
# EOF
|
||||
>>>>>>> 39caa74... Improved sysconfig files
|
||||
|
@@ -24,4 +24,3 @@ RELOADOPTIONS=""
|
||||
STOPOPTIONS=""
|
||||
|
||||
# EOF
|
||||
>>>>>>> 39caa74... Improved sysconfig files
|
||||
|
@@ -2295,7 +2295,8 @@ INLINE - - - ; -j REJECT
|
||||
|
||||
<varlistentry>
|
||||
<term><emphasis role="bold">TRACK_RULES=</emphasis>{<emphasis
|
||||
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>}</term>
|
||||
role="bold">Yes</emphasis>|<emphasis
|
||||
role="bold">No</emphasis>|File}</term>
|
||||
|
||||
<listitem>
|
||||
<para>Added in Shorewall 4.5.20. If set to <emphasis
|
||||
@@ -2306,8 +2307,14 @@ INLINE - - - ; -j REJECT
|
||||
added.</para>
|
||||
|
||||
<para>Setting this option to <emphasis role="bold">Yes</emphasis>
|
||||
requires the <firstterm>Comments</firstterm> capability in ip6tables
|
||||
requires the <firstterm>Comments</firstterm> capability in iptables
|
||||
and kernel.</para>
|
||||
|
||||
<para>Beginning with Shorewall 5.0.5, the option may also be set to
|
||||
<emphasis role="bold">File</emphasis>. That setting causes similar
|
||||
comments to be added to the
|
||||
<filename>.ip6tables-restore-input</filename> file, which is
|
||||
normally created in <filename>/var/lib/shorewall</filename>6.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@@ -24,4 +24,3 @@ RELOADOPTIONS=""
|
||||
STOPOPTIONS=""
|
||||
|
||||
# EOF
|
||||
>>>>>>> 39caa74... Improved sysconfig files
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<!--/$Id$-->
|
||||
|
||||
<articleinfo>
|
||||
<title>Shorewall 4.4/4.5/4.6 Documentation</title>
|
||||
<title>Shorewall 4.4/4.5/4.6/5.0 Documentation</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
@@ -18,7 +18,7 @@
|
||||
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
||||
|
||||
<copyright>
|
||||
<year>2001-2014</year>
|
||||
<year>2001-2016</year>
|
||||
|
||||
<holder>Thomas M. Eastep</holder>
|
||||
</copyright>
|
||||
@@ -327,7 +327,7 @@
|
||||
<entry><ulink url="PortKnocking.html">Port Knocking
|
||||
(deprecated)</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -337,7 +337,7 @@
|
||||
<entry><ulink url="Events.html">Port Knocking, Auto Blacklisting
|
||||
and Other Uses of the 'Recent Match'</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -345,7 +345,7 @@
|
||||
|
||||
<entry><ulink url="PPTP.htm">PPTP</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -354,7 +354,7 @@
|
||||
|
||||
<entry><ulink url="ProxyARP.htm">Proxy ARP</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -364,7 +364,7 @@
|
||||
<entry><ulink url="shorewall_quickstart_guide.htm">QuickStart
|
||||
Guides</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -373,7 +373,7 @@
|
||||
|
||||
<entry><ulink url="NewRelease.html">Release Model</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -382,7 +382,7 @@
|
||||
<entry><ulink
|
||||
url="shorewall_prerequisites.htm">Requirements</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -391,7 +391,7 @@
|
||||
<entry><ulink url="Shorewall_and_Routing.html">Routing and
|
||||
Shorewall</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -400,7 +400,7 @@
|
||||
<entry><ulink url="Multiple_Zones.html">Routing on One
|
||||
Interface</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -408,7 +408,7 @@
|
||||
|
||||
<entry><ulink url="samba.htm">Samba</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -417,7 +417,7 @@
|
||||
|
||||
<entry><ulink url="Events.html">Shorewall Events</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -427,7 +427,7 @@
|
||||
<entry><ulink url="Shorewall-init.html">Shorewall
|
||||
Init</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
@@ -437,7 +437,7 @@
|
||||
<entry><ulink url="Shorewall-Lite.html">Shorewall
|
||||
Lite</ulink></entry>
|
||||
|
||||
<entry></entry>
|
||||
<entry/>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
|
10
docs/FAQ.xml
10
docs/FAQ.xml
@@ -20,7 +20,7 @@
|
||||
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
||||
|
||||
<copyright>
|
||||
<year>2001-2014</year>
|
||||
<year>2001-2016</year>
|
||||
|
||||
<holder>Thomas M. Eastep</holder>
|
||||
</copyright>
|
||||
@@ -62,7 +62,9 @@
|
||||
Shorewall 4.4.0 or later, you must install the <emphasis
|
||||
role="bold">shorewall</emphasis> package. If you want to configure an
|
||||
IPv6 firewall, you must also install <emphasis
|
||||
role="bold">shorewall6</emphasis>.</para>
|
||||
role="bold">shorewall6</emphasis>. Beginning with Shorewall 4.5, you
|
||||
must first install the <emphasis role="bold">shorewall-core</emphasis>
|
||||
package.</para>
|
||||
|
||||
<section id="faq92a">
|
||||
<title>(FAQ 92a) Someone once told me to install shorewall-perl;
|
||||
@@ -123,7 +125,9 @@
|
||||
<firstterm>shorewall-shell</firstterm> package was discontinued. The
|
||||
<firstterm>shorewall-common</firstterm> and
|
||||
<firstterm>shorewall-perl</firstterm> packages were combined to form a
|
||||
single <firstterm>shorewall</firstterm> package.</para>
|
||||
single <firstterm>shorewall</firstterm> package. In Shorewall 4.5, the
|
||||
<firstterm>shorewall-core</firstterm> package was added and all of the
|
||||
other packages depend on shorewall-core.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@@ -35,6 +35,8 @@
|
||||
|
||||
<year>2013</year>
|
||||
|
||||
<year>2015</year>
|
||||
|
||||
<holder>Thomas M. Eastep</holder>
|
||||
|
||||
<holder/>
|
||||
|
Reference in New Issue
Block a user