]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/vulnerabilities.cgi
a8746c30c89908a5ca1a576d2f132064420ecc5a
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2019 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
32 my %VULNERABILITIES = (
33 "l1tf" => "$Lang::tr{'foreshadow'} (CVE-2018-3620)",
34 "mds" => "$Lang::tr{'fallout zombieload ridl'} (CVE-2018-12126, CVE-2018-12130, CVE-2018-12127, CVE-2019-11091)",
35 "meltdown" => "$Lang::tr{'meltdown'} (CVE-2017-5754)",
36 "spec_store_bypass" => "$Lang::tr{'spectre variant 4'} (CVE-2018-3639)",
37 "spectre_v1" => "$Lang::tr{'spectre variant 1'} (CVE-2017-5753)",
38 "spectre_v2" => "$Lang::tr{'spectre variant 2'} (CVE-2017-5715)",
41 my $errormessage = "";
44 my %mainsettings = ();
46 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
47 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
50 "ENABLE_SMT" => "auto",
52 &General
::readhash
("${General::swroot}/main/security", \
%settings);
54 &Header
::showhttpheaders
();
56 &Header
::getcgihash
(\
%settings);
58 if ($settings{'ACTION'} eq $Lang::tr
{'save'}) {
59 if ($settings{'ENABLE_SMT'} !~ /^(auto|on)$/) {
60 $errormessage = $Lang::tr
{'invalid input'};
63 unless ($errormessage) {
64 &General
::writehash
("${General::swroot}/main/security", \
%settings);
65 $notice = $Lang::tr
{'please reboot to apply your changes'};
70 $checked{'ENABLE_SMT'}{'auto'} = '';
71 $checked{'ENABLE_SMT'}{'on'} = '';
72 $checked{'ENABLE_SMT'}{$settings{'ENABLE_SMT'}} = "checked";
74 &Header
::openpage
($Lang::tr
{'processor vulnerability mitigations'}, 1, '');
76 &Header
::openbigbox
("100%", "left", "", $errormessage);
79 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
80 print "<font color='red'>$errormessage</font>";
85 &Header
::openbox
('100%', 'left', $Lang::tr
{'notice'});
86 print "<font color='red'>$notice</font>";
90 &Header
::openbox
('100%', 'center', $Lang::tr
{'processor vulnerability mitigations'});
93 <table class="tbl" width='100%'>
97 <strong>$Lang::tr{'vulnerability'}</strong>
100 <strong>$Lang::tr{'status'}</strong>
108 for my $vuln (sort keys %VULNERABILITIES) {
109 my ($status, $message) = &check_status
($vuln);
114 my $status_message = "";
117 if ($status eq "Not affected") {
118 $status_message = $Lang::tr
{'not affected'};
120 $bgcolour = ${Header
::colourgreen
};
123 } elsif ($status eq "Vulnerable") {
124 $status_message = $Lang::tr
{'vulnerable'};
126 $bgcolour = ${Header
::colourred
};
129 } elsif ($status eq "Mitigation") {
130 $status_message = $Lang::tr
{'mitigated'};
132 $bgcolour = ${Header
::colourblue
};
134 # Unknown report from kernel
136 $status_message = $status;
138 $bgcolour = ${Header
::colouryellow
};
141 my $table_colour = ($id++ % 2) ?
$color{'color22'} : $color{'color20'};
144 <tr bgcolor="$table_colour">
146 <strong>$VULNERABILITIES{$vuln}</strong>
149 <td bgcolor="$bgcolour" align="center">
150 <font color="$colour">
153 print "<strong>$status_message</strong> - $message";
155 print "<strong>$status_message</strong>";
172 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
174 &Header
::openbox
('100%', 'center', $Lang::tr
{'settings'});
176 my $smt_status = &smt_status
();
179 <table class="tbl" width="66%">
182 <th colspan="2" align="center">
183 <strong>$smt_status</strong>
188 <td width="50%" align="left">
189 $Lang::tr{'enable smt'}
192 <td width="50%" align="center">
194 <input type="radio" name="ENABLE_SMT"
195 value="auto" $checked{'ENABLE_SMT'}{'auto'}>
196 $Lang::tr{'automatic'}
199 <input type="radio" name="ENABLE_SMT"
200 value="on" $checked{'ENABLE_SMT'}{'on'}>
201 $Lang::tr{'force enable'} ($Lang::tr{'dangerous'})
207 <td colspan="2" align="right">
208 <input type="submit" name="ACTION" value="$Lang::tr{'save'}">
219 &Header
::closebigbox
();
221 &Header
::closepage
();
223 sub check_status
($) {
226 open(FILE
, "/sys/devices/system/cpu/vulnerabilities/$vuln") or return undef;
232 # Fix status when something has been mitigated, but not fully, yet
233 if ($status =~ /^(Mitigation): (.*vulnerable.*)$/) {
234 return ("Vulnerable", $status);
237 if ($status =~ /^(Vulnerable|Mitigation): (.*)$/) {
245 open(FILE
, "/sys/devices/system/cpu/smt/control");
251 if ($status eq "on") {
252 return $Lang::tr
{'smt enabled'};
253 } elsif (($status eq "off") || ($status eq "forceoff")) {
254 return $Lang::tr
{'smt disabled'};
255 } elsif ($status eq "notsupported") {
256 return $Lang::tr
{'smt not supported'};