]>
git.ipfire.org Git - people/pmueller/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", '', 350);
51 # Check for hardware support.
53 my $message_colour = $Header::colourred
;
55 $message = $Lang::tr
{'system has hwrng'};
56 $message_colour = $Header::colourgreen
;
57 } elsif (&has_rdrand
()) {
58 $message = $Lang::tr
{'system has rdrand'};
59 $message_colour = $Header::colourgreen
;
61 $message = $Lang::tr
{'no hardware random number generator'};
64 my $rngd_status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
65 if (&rngd_is_running
()) {
66 $rngd_status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
69 &Header
::openbox
('100%', 'center', $Lang::tr
{'hardware support'});
71 <p style="color: $message_colour; text-align: center;">$message</p>
73 <table width='80%' cellspacing='1' class='tbl'>
75 <th align='center'><b>$Lang::tr{'service'}</b></th>
76 <th align='center'><b>$Lang::tr{'status'}</b></th>
80 $Lang::tr{'random number generator daemon'}
88 &Header
::closebigbox
();
93 return (-c
"/dev/hwrng");
97 open(FILE
, "/proc/cpuinfo") or return 0;
101 my @result = grep(/rdrand/, @cpuinfo);
109 sub rngd_is_running
() {
110 return (-e
"/var/run/rngd.pid");