From: Michael Tremer Date: Thu, 13 Mar 2014 14:27:14 +0000 (+0100) Subject: Add link to entropy page and show if there is hardware support available. X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=commitdiff_plain;h=84004f0538945215dda2b52fe2f664274dc884ce Add link to entropy page and show if there is hardware support available. --- diff --git a/config/menu/20-status.menu b/config/menu/20-status.menu index c0b780a06..8899310aa 100644 --- a/config/menu/20-status.menu +++ b/config/menu/20-status.menu @@ -46,6 +46,12 @@ 'title' => "$Lang::tr{'hardware graphs'}", 'enabled' => 1, }; + $substatus->{'61.entropy'} = { + 'caption' => "$Lang::tr{'entropy'}", + 'uri' => '/cgi-bin/entropy.cgi', + 'title' => "$Lang::tr{'entropy graphs'}", + 'enabled' => 1, + }; $substatus->{'71.connections'} = { 'caption' => $Lang::tr{'connections'}, 'uri' => '/cgi-bin/connections.cgi', diff --git a/html/cgi-bin/entropy.cgi b/html/cgi-bin/entropy.cgi index 9362e78be..bd3de82f8 100755 --- a/html/cgi-bin/entropy.cgi +++ b/html/cgi-bin/entropy.cgi @@ -48,6 +48,42 @@ if ( $querry[0] ne~ "") { &Graphs::makegraphbox("entropy.cgi", "day", '', 350); &Header::closebox(); + # Check for hardware support. + my $message; + my $message_colour = $Header::colourred; + if (&has_hwrng()) { + $message = $Lang::tr{'system has hwrng'}; + $message_colour = $Header::colourgreen; + } elsif (&has_rdrand()) { + $message = $Lang::tr{'system has rdrand'}; + $message_colour = $Header::colourgreen; + } else { + $message = $Lang::tr{'no hardware random number generator'}; + } + + &Header::openbox('100%', 'center', $Lang::tr{'hardware support'}); + print <$message

+EOF + &Header::closebox(); + &Header::closebigbox(); &Header::closepage(); } + +sub has_hwrng() { + return (-c "/dev/hwrng"); +} + +sub has_rdrand() { + open(FILE, "/proc/cpuinfo") or return 0; + my @cpuinfo = ; + close(FILE); + + my @result = grep(/rdrand/, @cpuinfo); + if (@result) { + return 1; + } + + return 0; +} diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index e951b68b5..cf1430403 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -813,6 +813,7 @@ 'enter ack class' => 'Legen Sie hier die ACK-Klasse fest
und klicken Sie danach auf Speichern.', 'enter data' => 'Geben Sie die Daten ein
und klicken Sie danach auf Speichern.', 'entropy' => 'Entropie', +'entropy graphs' => 'Entropiegraphen', 'err bk 1' => 'Fehler beim Erzeugen des Archivs', 'err bk 10 password' => 'Fehler beim Datensicherungs-Passwort', 'err bk 2 key' => 'Fehler beim Erzeugen der Schlüsseldatei', @@ -1131,6 +1132,7 @@ 'harddisk temperature' => 'Festplattentemperatur', 'harddisk temperature graphs' => 'HDD-Diagramme', 'hardware graphs' => 'Hardware-Diagramme', +'hardware support' => 'Hardware-Unterstützung', 'hdd temperature in' => 'Festplattentemperatur in', 'help' => 'Hilfe', 'high' => 'Hoch', @@ -1506,6 +1508,7 @@ 'no eciadsl synch.bin file' => 'Keine ECI ADSL Datei synch.bin vorhanden. Bitte hochladen.', 'no filter pass' => 'Legen Sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.', 'no fritzdsl driver' => 'Kein Fritz!DSL-Treiber vorhanden. Bitte hochladen.', +'no hardware random number generator' => 'Dieses System hat keine Entropiequelle.', 'no information available' => 'Keine Informationen verfügbar.', 'no log selected' => 'kein Log ausgewählt', 'no modem selected' => 'Kein Modem ausgewählt', @@ -1976,6 +1979,8 @@ 'swap usage per' => 'Nutzung von Auslagerungsspeicher (Swap) pro', 'system' => 'System', 'system graphs' => 'System-Diagramme', +'system has hwrng' => 'Dieses System hat einen Hardware-Zufallszahlengenerator.', +'system has rdrand' => 'Dieses System unterstützt Intel(R) RDRAND.', 'system information' => 'Systeminformationen', 'system log viewer' => 'Betrachter der System-Logdateien', 'system logs' => 'System-Logdateien', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index d8cfdc771..02b1a4383 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -839,6 +839,7 @@ 'enter ack class' => 'Enter the ACK- Class
and then press Save.', 'enter data' => 'Enter your settings
and then press Save.', 'entropy' => 'Entropy', +'entropy graphs' => 'Entropy Graphs', 'err bk 1' => 'Error creating archive', 'err bk 10 password' => 'Error with backup password', 'err bk 2 key' => 'Error creating key file', @@ -1159,6 +1160,7 @@ 'harddisk temperature' => 'Harddisk Temperature', 'harddisk temperature graphs' => 'HDD Graphs', 'hardware graphs' => 'Hardware Graphs', +'hardware support' => 'Hardware Support', 'hdd temperature in' => 'Harddisk temperature in', 'help' => 'Help', 'high' => 'High', @@ -1535,6 +1537,7 @@ 'no eciadsl synch.bin file' => 'No ECI ADSL synch.bin file. Please upload.', 'no filter pass' => 'Enter the standard class for non-filtered packets.', 'no fritzdsl driver' => 'No Fritz!DSL driver. Please upload.', +'no hardware random number generator' => 'This system has no source for entropy.', 'no information available' => 'No information available.', 'no log selected' => 'No log selected', 'no modem selected' => 'No modem selected', @@ -2011,6 +2014,8 @@ 'swap usage per' => 'Swap usage per', 'system' => 'System', 'system graphs' => 'System Graphs', +'system has hwrng' => 'This system has got a hardware random number generator.', +'system has rdrand' => 'This system has got support for Intel(R) RDRAND.', 'system information' => 'System Information', 'system log viewer' => 'System Log Viewer', 'system logs' => 'System Logs',