mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-26 10:52:57 +02:00
Merge remote-tracking branch 'ms/cleanup' into next
This commit is contained in:
@@ -214,7 +214,7 @@ END
|
||||
print "</table></div>\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'graph'}");
|
||||
&Header::opensection('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("services.cgi","processescpu","day");
|
||||
&Header::closebox();
|
||||
|
||||
|
||||
@@ -26,32 +26,24 @@ use strict;
|
||||
#use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
&Header::openpage($Lang::tr{'status information'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
&Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("system.cgi","cpu","day");
|
||||
&Header::closebox();
|
||||
# Processor Graph
|
||||
&Header::graph("$Lang::tr{'processors'}", "system.cgi", "cpu", "day");
|
||||
|
||||
# CPU Frequency
|
||||
if ( -e "$mainsettings{'RRDLOG'}/collectd/localhost/cpufreq/cpufreq-0.rrd"){
|
||||
&Header::openbox('100%', 'center', "$Lang::tr{'cpu frequency'} $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("system.cgi","cpufreq","day");
|
||||
&Header::closebox();
|
||||
&Header::graph("$Lang::tr{'cpu frequency'}", "system.cgi", "cpufreq", "day");
|
||||
}
|
||||
|
||||
&Header::openbox('100%', 'center', "$Lang::tr{'uptime load average'} $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("system.cgi","load","day");
|
||||
&Header::closebox();
|
||||
# Load Average
|
||||
&Header::graph("$Lang::tr{'load average'}", "system.cgi", "load", "day");
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
|
||||
@@ -98,73 +98,56 @@ if ($notice) {
|
||||
&Header::openbox('100%', 'center', $Lang::tr{'processor vulnerability mitigations'});
|
||||
|
||||
print <<END;
|
||||
<table class="tbl" width='100%'>
|
||||
<table class="tbl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">
|
||||
<strong>$Lang::tr{'vulnerability'}</strong>
|
||||
<th class="text-center">
|
||||
$Lang::tr{'vulnerability'}
|
||||
</th>
|
||||
<th align="center">
|
||||
<strong>$Lang::tr{'status'}</strong>
|
||||
|
||||
<th class="text-center">
|
||||
$Lang::tr{'status'}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
END
|
||||
|
||||
my $id = 0;
|
||||
for my $vuln (sort keys %VULNERABILITIES) {
|
||||
my ($status, $message) = &check_status($vuln);
|
||||
next if (!$status);
|
||||
|
||||
my $colour = "";
|
||||
my $bgcolour = "";
|
||||
my $status_message = "";
|
||||
my $status_message = $status;
|
||||
|
||||
# Not affected
|
||||
if ($status eq "Not affected") {
|
||||
if ($status eq "not-affected") {
|
||||
$status_message = $Lang::tr{'not affected'};
|
||||
$colour = "white";
|
||||
$bgcolour = ${Header::colourgreen};
|
||||
|
||||
# Vulnerable
|
||||
} elsif ($status eq "Vulnerable") {
|
||||
} elsif ($status eq "vulnerable") {
|
||||
$status_message = $Lang::tr{'vulnerable'};
|
||||
$colour = "white";
|
||||
$bgcolour = ${Header::colourred};
|
||||
|
||||
# Mitigated
|
||||
} elsif ($status eq "Mitigation") {
|
||||
} elsif ($status eq "mitigation") {
|
||||
$status_message = $Lang::tr{'mitigated'};
|
||||
$colour = "white";
|
||||
$bgcolour = ${Header::colourblue};
|
||||
|
||||
# Unknown report from kernel
|
||||
} else {
|
||||
$status_message = $status;
|
||||
$colour = "black";
|
||||
$bgcolour = ${Header::colouryellow};
|
||||
}
|
||||
|
||||
my $table_colour = ($id++ % 2) ? $color{'color22'} : $color{'color20'};
|
||||
|
||||
print <<END;
|
||||
<tr bgcolor="$table_colour">
|
||||
<td align="left">
|
||||
<strong>$VULNERABILITIES{$vuln}</strong>
|
||||
</td>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
$VULNERABILITIES{$vuln}
|
||||
</th>
|
||||
|
||||
<td bgcolor="$bgcolour" align="center">
|
||||
<font color="$colour">
|
||||
<td class="status is-$status">
|
||||
END
|
||||
if ($message) {
|
||||
print "<strong>$status_message</strong> - $message";
|
||||
print "$status_message - $message";
|
||||
} else {
|
||||
print "<strong>$status_message</strong>";
|
||||
print "$status_message";
|
||||
}
|
||||
|
||||
print <<END;
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
@@ -239,11 +222,13 @@ sub check_status($) {
|
||||
|
||||
# Fix status when something has been mitigated, but not fully, yet
|
||||
if ($status =~ /^(Mitigation): (.*vulnerable.*)$/) {
|
||||
return ("Vulnerable", $status);
|
||||
}
|
||||
return ("vulnerable", $status);
|
||||
|
||||
if ($status =~ /^(Vulnerable|Mitigation): (.*)$/) {
|
||||
return ($1, $2);
|
||||
} elsif ($status eq "Not affected") {
|
||||
return "not-affected";
|
||||
|
||||
} elsif ($status =~ /^(Vulnerable|Mitigation): (.*)$/) {
|
||||
return (lc $1, $2);
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
||||
Reference in New Issue
Block a user