[v2] show RNGD status at WebUI service page, too

Message ID 20171203182746.47ff6a10.peter.mueller@link38.eu
State Dropped
Headers
Series [v2] show RNGD status at WebUI service page, too |

Commit Message

Peter Müller Dec. 4, 2017, 4:27 a.m. UTC
  Also show the status of the hardware random number generator ("RNGD")
at the services.cgi page in the WebUI. Before, this was only shown
at the entropy.cgi page, which was a bit inconsistent.

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
---
 html/cgi-bin/services.cgi   | 4 +++-
 src/initscripts/system/rngd | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
  

Comments

Michael Tremer March 28, 2018, 12:54 a.m. UTC | #1
On Sun, 2017-12-03 at 18:27 +0100, Peter Müller wrote:
> Also show the status of the hardware random number generator ("RNGD")
> at the services.cgi page in the WebUI. Before, this was only shown
> at the entropy.cgi page, which was a bit inconsistent.
> 
> Signed-off-by: Peter Müller <peter.mueller@link38.eu>
> ---
>  html/cgi-bin/services.cgi   | 4 +++-
>  src/initscripts/system/rngd | 6 ++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi
> index 64fdbba05..eaaa5298a 100644
> --- a/html/cgi-bin/services.cgi
> +++ b/html/cgi-bin/services.cgi
> @@ -56,6 +56,7 @@ my %servicenames =(
>  	$Lang::tr{'secure shell server'} => 'sshd',
>  	$Lang::tr{'vpn'} => 'charon',
>  	$Lang::tr{'web proxy'} => 'squid',
> +	$Lang::tr{'random number generator daemon'} => 'rngd',
>  	'OpenVPN' => 'openvpn'
>  );
>  
> @@ -74,7 +75,8 @@ my %link =(
>  	"$Lang::tr{'intrusion detection system'} (GREEN)" => "<a
> href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (GREEN)</a>",
>  	"$Lang::tr{'intrusion detection system'} (RED)" => "<a
> href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (RED)</a>",
>  	"$Lang::tr{'intrusion detection system'} (ORANGE)" => "<a
> href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (ORANGE)</a>",
> -	"$Lang::tr{'intrusion detection system'} (BLUE)" => "<a
> href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (BLUE)</a>"
> +	"$Lang::tr{'intrusion detection system'} (BLUE)" => "<a
> href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (BLUE)</a>",
> +	"$Lang::tr{'random number generator daemon'}" => "<a
> href=\'entropy.cgi\'>$Lang::tr{'random number generator daemon'}</a>"
>  );
>  
>  my $lines=0; # Used to count the outputlines to make different bgcolor
> diff --git a/src/initscripts/system/rngd b/src/initscripts/system/rngd
> index df4aa7da2..9abcf6a79 100644
> --- a/src/initscripts/system/rngd
> +++ b/src/initscripts/system/rngd
> @@ -30,10 +30,16 @@ case "${1}" in
>  		boot_mesg "Starting Random Number Generator Daemon..."
>  
>  		if pidofproc /usr/sbin/rngd &>/dev/null; then
> +			# Make sure PID file is readable.
> +			test -f /run/rngd.pid && chmod 755 /run/rngd.pid
> +
>  			# Is already running.
>  			echo_ok
>  		else
>  			loadproc /usr/sbin/rngd --no-tpm=1
> +
> +			# Make sure PID file is readable.
> +			test -f /run/rngd.pid && chmod 755 /run/rngd.pid
>  		fi
>  		;;
>  

I suppose you are trying to make the PID file readable by the web UI? Can we not
patch this in rngd and send the patch upstream?

PID files should be 644.

-Michael
  

Patch

diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi
index 64fdbba05..eaaa5298a 100644
--- a/html/cgi-bin/services.cgi
+++ b/html/cgi-bin/services.cgi
@@ -56,6 +56,7 @@  my %servicenames =(
 	$Lang::tr{'secure shell server'} => 'sshd',
 	$Lang::tr{'vpn'} => 'charon',
 	$Lang::tr{'web proxy'} => 'squid',
+	$Lang::tr{'random number generator daemon'} => 'rngd',
 	'OpenVPN' => 'openvpn'
 );
 
@@ -74,7 +75,8 @@  my %link =(
 	"$Lang::tr{'intrusion detection system'} (GREEN)" => "<a href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (GREEN)</a>",
 	"$Lang::tr{'intrusion detection system'} (RED)" => "<a href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (RED)</a>",
 	"$Lang::tr{'intrusion detection system'} (ORANGE)" => "<a href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (ORANGE)</a>",
-	"$Lang::tr{'intrusion detection system'} (BLUE)" => "<a href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (BLUE)</a>"
+	"$Lang::tr{'intrusion detection system'} (BLUE)" => "<a href=\'ids.cgi\'>$Lang::tr{'intrusion detection system'} (BLUE)</a>",
+	"$Lang::tr{'random number generator daemon'}" => "<a href=\'entropy.cgi\'>$Lang::tr{'random number generator daemon'}</a>"
 );
 
 my $lines=0; # Used to count the outputlines to make different bgcolor
diff --git a/src/initscripts/system/rngd b/src/initscripts/system/rngd
index df4aa7da2..9abcf6a79 100644
--- a/src/initscripts/system/rngd
+++ b/src/initscripts/system/rngd
@@ -30,10 +30,16 @@  case "${1}" in
 		boot_mesg "Starting Random Number Generator Daemon..."
 
 		if pidofproc /usr/sbin/rngd &>/dev/null; then
+			# Make sure PID file is readable.
+			test -f /run/rngd.pid && chmod 755 /run/rngd.pid
+
 			# Is already running.
 			echo_ok
 		else
 			loadproc /usr/sbin/rngd --no-tpm=1
+
+			# Make sure PID file is readable.
+			test -f /run/rngd.pid && chmod 755 /run/rngd.pid
 		fi
 		;;