version 1.43.2.4, 2020/01/06 15:55:06
|
version 1.43.2.8, 2020/09/06 21:51:19
|
Line 227 else {
|
Line 227 else {
|
} |
} |
my $hostname = Sys::Hostname::FQDN::fqdn(); |
my $hostname = Sys::Hostname::FQDN::fqdn(); |
my $hostip = Socket::inet_ntoa(scalar(gethostbyname($hostname)) || 'localhost'); |
my $hostip = Socket::inet_ntoa(scalar(gethostbyname($hostname)) || 'localhost'); |
my @expected = ('RewriteCond %{REQUEST_URI} ^/adm/wrapper/ext/(?!https:\/\/)', |
my @expected = ('RewriteEngine on', |
|
'RewriteCond %{HTTPS} =on', |
|
'RewriteCond %{REQUEST_URI} ^/adm/wrapper/ext/(?!https:)', |
'RewriteCond %{QUERY_STRING} (^|&(|amp;))usehttp=1($|&)', |
'RewriteCond %{QUERY_STRING} (^|&(|amp;))usehttp=1($|&)', |
'RewriteRule ^/adm/wrapper/ext/(?!https:\/\/) http://%{HTTP_HOST}%{REQUEST_URI} [R,L,NE]', |
'RewriteRule ^/adm/wrapper/ext/(?!https:) http://%{HTTP_HOST}%{REQUEST_URI} [R,L,NE]', |
'RewriteCond %{REMOTE_ADDR} 127.0.0.1', |
'RewriteCond %{REMOTE_ADDR} 127.0.0.1', |
'RewriteRule (.*) - [L]'); |
'RewriteRule (.*) - [L]'); |
if (($hostip ne '') && ($hostip ne '127.0.0.1')) { |
if (($hostip ne '') && ($hostip ne '127.0.0.1')) { |
Line 243 else {
|
Line 245 else {
|
my @rewrites; |
my @rewrites; |
if (opendir(my $dir,$ssldir)) { |
if (opendir(my $dir,$ssldir)) { |
my @sslconf_files; |
my @sslconf_files; |
foreach my $file (!grep(/^\.$/,readdir($dir))) { |
foreach my $file (grep(!/^\./,readdir($dir))) { |
|
next if ($file =~ /\.rpmnew$/); |
if (open(my $fh,'<',"$ssldir/$file")) { |
if (open(my $fh,'<',"$ssldir/$file")) { |
while (<$fh>) { |
while (<$fh>) { |
if (/^\s*<VirtualHost\s+[^:]*\:443>\s*$/) { |
if (/^\s*<VirtualHost\s+[^:]*\:443>\s*$/) { |
Line 255 else {
|
Line 258 else {
|
} |
} |
} |
} |
if (@sslconf_files) { |
if (@sslconf_files) { |
my @rewrites; |
|
foreach my $file (@sslconf_files) { |
foreach my $file (@sslconf_files) { |
if (open(my $fh,'<',"$ssldir/$file")) { |
if (open(my $fh,'<',"$ssldir/$file")) { |
my ($rewrite,$num) = (0,0); |
my ($rewrite,$num) = (0,0); |
while (<$fh>) { |
while (<$fh>) { |
if ($rewrite) { |
if ($rewrite) { |
if (/\s*<\/IfModule>/) { |
if (/^\s*<\/IfModule>/) { |
$rewrite = 0; |
$rewrite = 0; |
$num ++; |
$num ++; |
} else { |
} else { |
chomp(); |
chomp(); |
s/^(\s+|\s+)$//g; |
s/^\s+|\s+$//g; |
push(@{$rewrites[$num]},$_); |
push(@{$rewrites[$num]},$_); |
} |
} |
} elsif (/^\s*<IfModule\s+mod_rewrite.c>/) { |
} elsif (/^\s*<IfModule\s+mod_rewrite.c>/) { |
Line 283 else {
|
Line 285 else {
|
foreach my $item (@rewrites) { |
foreach my $item (@rewrites) { |
if (ref($item) eq 'ARRAY') { |
if (ref($item) eq 'ARRAY') { |
my $found = 0; |
my $found = 0; |
foreach my $item (@rewrites) { |
foreach my $line (@{$item}) { |
foreach my $match (@expected) { |
foreach my $match (@expected) { |
if ($match eq $item) { |
if ($match eq $line) { |
$found ++; |
$found ++; |
last; |
last; |
} |
} |
} |
} |
} |
} |
if ($found >= @expected) { |
if ($found >= scalar(@expected)) { |
$gotrules = 1; |
$gotrules = 1; |
|
last; |
} |
} |
} |
} |
} |
} |