]>
Commit | Line | Data |
---|---|---|
15b023b9 MT |
1 | #!/usr/bin/perl |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2005-2010 IPFire Team # | |
6 | # # | |
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. # | |
11 | # # | |
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. # | |
16 | # # | |
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/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | use strict; | |
23 | ||
24 | # enable only the following on debugging purpose | |
25 | #use warnings; | |
26 | #use CGI::Carp 'fatalsToBrowser'; | |
27 | ||
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"; | |
32 | ||
4190b2a6 LAH |
33 | &Header::showhttpheaders(); |
34 | &Header::openpage($Lang::tr{'entropy'}, 1, ''); | |
35 | &Header::openbigbox('100%', 'left'); | |
15b023b9 | 36 | |
4190b2a6 LAH |
37 | &Header::openbox('100%', 'center', $Lang::tr{'entropy'}); |
38 | &Graphs::makegraphbox("entropy.cgi", "entropy", "day"); | |
39 | &Header::closebox(); | |
15b023b9 | 40 | |
4190b2a6 LAH |
41 | # Check for hardware support. |
42 | my $message; | |
43 | my $message_colour = $Header::colourred; | |
44 | if (&has_rdrand()) { | |
45 | $message = $Lang::tr{'system has rdrand'}; | |
46 | $message_colour = $Header::colourgreen; | |
47 | } | |
84004f05 | 48 | |
4190b2a6 LAH |
49 | my $rngd_status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>"; |
50 | if (&rngd_is_running()) { | |
51 | $rngd_status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>"; | |
52 | } | |
742c334a | 53 | |
4190b2a6 LAH |
54 | &Header::openbox('100%', 'center', $Lang::tr{'hardware support'}); |
55 | if ($message) { | |
56 | print <<EOF; | |
57 | <p style="color: $message_colour; text-align: center;">$message</p> | |
9b656e7f | 58 | EOF |
4190b2a6 | 59 | } |
742c334a | 60 | |
4190b2a6 LAH |
61 | print <<EOF; |
62 | <table width='80%' cellspacing='1' class='tbl'> | |
63 | <tr> | |
64 | <th align='center'><b>$Lang::tr{'service'}</b></th> | |
65 | <th align='center'><b>$Lang::tr{'status'}</b></th> | |
66 | </tr> | |
67 | <tr> | |
68 | <td align='center'> | |
69 | $Lang::tr{'random number generator daemon'} | |
70 | </td> | |
71 | $rngd_status | |
72 | </tr> | |
73 | </table> | |
84004f05 | 74 | EOF |
4190b2a6 | 75 | &Header::closebox(); |
84004f05 | 76 | |
4190b2a6 LAH |
77 | &Header::closebigbox(); |
78 | &Header::closepage(); | |
84004f05 | 79 | |
84004f05 MT |
80 | sub has_rdrand() { |
81 | open(FILE, "/proc/cpuinfo") or return 0; | |
82 | my @cpuinfo = <FILE>; | |
83 | close(FILE); | |
84 | ||
85 | my @result = grep(/rdrand/, @cpuinfo); | |
86 | if (@result) { | |
87 | return 1; | |
88 | } | |
89 | ||
90 | return 0; | |
91 | } | |
742c334a MT |
92 | |
93 | sub rngd_is_running() { | |
94 | return (-e "/var/run/rngd.pid"); | |
95 | } |