version 1.392, 2021/11/24 04:25:01
|
version 1.393, 2021/11/28 18:43:37
|
Line 7791 sub print_wafproxy {
|
Line 7791 sub print_wafproxy {
|
'<tr'.$css_class.' id="wafproxyrow_'.$dom.'"'.$wafstyle.'>'. |
'<tr'.$css_class.' id="wafproxyrow_'.$dom.'"'.$wafstyle.'>'. |
'<td class="LC_left_item">'.&mt('Domain: [_1]','<b>'.$dom.'</b>').'<br /><br />'. |
'<td class="LC_left_item">'.&mt('Domain: [_1]','<b>'.$dom.'</b>').'<br /><br />'. |
'<div id="wafproxyranges_'.$dom.'">'.&mt('Format for comma separated IP ranges').':<br />'. |
'<div id="wafproxyranges_'.$dom.'">'.&mt('Format for comma separated IP ranges').':<br />'. |
&mt('A.B.C.D/N or A.B.C.D-E.F.G.H').'</div></td>'. |
&mt('A.B.C.D/N or A.B.C.D-E.F.G.H').'<br />'. |
|
&mt('Range(s) stored in CIDR notation').'</div></td>'. |
'<td class="LC_left_item"><table>'. |
'<td class="LC_left_item"><table>'. |
'<tr>'. |
'<tr>'. |
'<td valign="top">'.$lt{'remoteip'}.': '. |
'<td valign="top">'.$lt{'remoteip'}.': '. |
Line 20509 sub modify_wafproxy {
|
Line 20510 sub modify_wafproxy {
|
$possible =~ s/[\r\n]+/\s/g; |
$possible =~ s/[\r\n]+/\s/g; |
$possible =~ s/\s*-\s*/-/g; |
$possible =~ s/\s*-\s*/-/g; |
$possible =~ s/\s+/,/g; |
$possible =~ s/\s+/,/g; |
|
$possible =~ s/,+/,/g; |
} |
} |
$count = 0; |
$count = 0; |
if ($possible ne '') { |
if ($possible ne '') { |
foreach my $poss (split(/\,/,$possible)) { |
foreach my $poss (split(/\,/,$possible)) { |
$count ++; |
$count ++; |
if (&validate_ip_pattern($poss)) { |
$poss = &validate_ip_pattern($poss); |
|
if ($poss ne '') { |
push(@ok,$poss); |
push(@ok,$poss); |
} |
} |
} |
} |
if (@ok) { |
|
$wafproxy{$item} = join(',',@ok); |
|
} |
|
my $diff = $count - scalar(@ok); |
my $diff = $count - scalar(@ok); |
if ($diff) { |
if ($diff) { |
push(@warnings,'<li>'. |
push(@warnings,'<li>'. |
Line 20528 sub modify_wafproxy {
|
Line 20528 sub modify_wafproxy {
|
$diff,$warn{$item}). |
$diff,$warn{$item}). |
'</li>'); |
'</li>'); |
} |
} |
|
if (@ok) { |
|
my @cidr_list; |
|
foreach my $item (@ok) { |
|
@cidr_list = &Net::CIDR::cidradd($item,@cidr_list); |
|
} |
|
$wafproxy{$item} = join(',',@cidr_list); |
|
} |
} |
} |
} |
} |
if ($wafproxy{$item} ne $currvalue{$item}) { |
if ($wafproxy{$item} ne $currvalue{$item}) { |
Line 20719 sub validate_ip_pattern {
|
Line 20726 sub validate_ip_pattern {
|
if ($pattern =~ /^([^-]+)\-([^-]+)$/) { |
if ($pattern =~ /^([^-]+)\-([^-]+)$/) { |
my ($start,$end) = ($1,$2); |
my ($start,$end) = ($1,$2); |
if ((&Net::CIDR::cidrvalidate($start)) && (&Net::CIDR::cidrvalidate($end))) { |
if ((&Net::CIDR::cidrvalidate($start)) && (&Net::CIDR::cidrvalidate($end))) { |
return 1; |
if (($start !~ m{/}) && ($end !~ m{/})) { |
|
return $start.'-'.$end; |
|
} |
|
} |
|
} elsif ($pattern ne '') { |
|
$pattern = &Net::CIDR::cidrvalidate($pattern); |
|
if ($pattern ne '') { |
|
return $pattern; |
} |
} |
} elsif (&Net::CIDR::cidrvalidate($pattern)) { |
|
return 1; |
|
} |
} |
return |
return; |
} |
} |
|
|
sub modify_usersessions { |
sub modify_usersessions { |