]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/entropy.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2005-2010 IPFire Team #
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";
31 require "${General::swroot}/graphs.pl";
33 my @querry = split(/\?/,$ENV{'QUERY_STRING'});
34 $querry[0] = '' unless defined $querry[0];
35 $querry[1] = 'hour' unless defined $querry[1];
37 if ( $querry[0] ne~ "") {
38 print "Content-type: image/png\n\n";
40 &Graphs
::updateentropygraph
($querry[1]);
43 &Header
::showhttpheaders
();
44 &Header
::openpage
($Lang::tr
{'entropy'}, 1, '');
45 &Header
::openbigbox
('100%', 'left');
47 &Header
::openbox
('100%', 'center', $Lang::tr
{'entropy'});
48 &Graphs
::makegraphbox
("entropy.cgi", "day");
51 # Check for hardware support.
53 my $message_colour = $Header::colourred
;
55 $message = $Lang::tr
{'system has rdrand'};
56 $message_colour = $Header::colourgreen
;
59 my $rngd_status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
60 if (&rngd_is_running
()) {
61 $rngd_status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
64 &Header
::openbox
('100%', 'center', $Lang::tr
{'hardware support'});
67 <p style="color: $message_colour; text-align: center;">$message</p>
72 <table width='80%' cellspacing='1' class='tbl'>
74 <th align='center'><b>$Lang::tr{'service'}</b></th>
75 <th align='center'><b>$Lang::tr{'status'}</b></th>
79 $Lang::tr{'random number generator daemon'}
87 &Header
::closebigbox
();
92 open(FILE
, "/proc/cpuinfo") or return 0;
96 my @result = grep(/rdrand/, @cpuinfo);
104 sub rngd_is_running
() {
105 return (-e
"/var/run/rngd.pid");