Suggested fix for 'rngd' service status

Message ID 20180911182824.28272-1-matthias.fischer@ipfire.org
State Superseded
Headers
Series Suggested fix for 'rngd' service status |

Commit Message

Matthias Fischer Sept. 12, 2018, 4:28 a.m. UTC
  Hi,

Since https://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff;h=fd0a0384f07b399e9cb4cf46b4c5722b809ffe6a
'rngd' is running again with much higher values. STATUS / ENTROPY shows RUNNING. Thanks! ;-)

But '/var/run/rngd.pid' is created with wrong rights (0600). Therefore, STATUS / SERVICES tells me
'rngd' is stopped.

The suggested fix checks whether '/var/run/rngd.pid' exists and sets rights accordingly.

Best,
Matthias

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
---
 src/initscripts/system/rngd | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Peter Müller Sept. 12, 2018, 5:55 a.m. UTC | #1
Hello,

I support this patch. Quite a while ago, there was a similar
one on this list but was not merged eventually.

Michael stated it should be fixed in the upstream channel (which
is basically right) - however, looking at our recent trouble
with this software, I doubt it makes much sense to delay this
until it reached the origin repository.

Best regards,
Peter Müller

> Hi,
> 
> Since https://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff;h=fd0a0384f07b399e9cb4cf46b4c5722b809ffe6a
> 'rngd' is running again with much higher values. STATUS / ENTROPY shows RUNNING. Thanks! ;-)
> 
> But '/var/run/rngd.pid' is created with wrong rights (0600). Therefore, STATUS / SERVICES tells me
> 'rngd' is stopped.
> 
> The suggested fix checks whether '/var/run/rngd.pid' exists and sets rights accordingly.
> 
> Best,
> Matthias
> 
> Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
> ---
>  src/initscripts/system/rngd | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/initscripts/system/rngd b/src/initscripts/system/rngd
> index 91b70a7b4..8fe5c9363 100644
> --- a/src/initscripts/system/rngd
> +++ b/src/initscripts/system/rngd
> @@ -15,6 +15,9 @@ case "${1}" in
>  	start)
>  		boot_mesg "Starting Random Number Generator Daemon..."
>  		loadproc /usr/sbin/rngd --quiet
> +		if [ -f "/var/run/rngd.pid" ]; then
> +			chmod 644 /var/run/rngd.pid
> +		fi
>  		;;
>  
>  	stop)
>
  
Arne Fitzenreiter Sept. 12, 2018, 6:29 p.m. UTC | #2
This initskript needs a rewrite. It's on my todo list...

With the new kernel /dev/hwrng always exists even if there is no
hardware present, so there are more things to do.

Normal rngd will startet by udev if it found hardware but
it was not startet if only rdrand was there.

So the script need to fix the pid's,
check if rngd is already running and
should only start it if rdrand was present and not already running...

Arne


On 2018-09-11 21:55, Peter Müller wrote:
> Hello,
> 
> I support this patch. Quite a while ago, there was a similar
> one on this list but was not merged eventually.
> 
> Michael stated it should be fixed in the upstream channel (which
> is basically right) - however, looking at our recent trouble
> with this software, I doubt it makes much sense to delay this
> until it reached the origin repository.
> 
> Best regards,
> Peter Müller
> 
>> Hi,
>> 
>> Since 
>> https://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff;h=fd0a0384f07b399e9cb4cf46b4c5722b809ffe6a
>> 'rngd' is running again with much higher values. STATUS / ENTROPY 
>> shows RUNNING. Thanks! ;-)
>> 
>> But '/var/run/rngd.pid' is created with wrong rights (0600). 
>> Therefore, STATUS / SERVICES tells me
>> 'rngd' is stopped.
>> 
>> The suggested fix checks whether '/var/run/rngd.pid' exists and sets 
>> rights accordingly.
>> 
>> Best,
>> Matthias
>> 
>> Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
>> ---
>>  src/initscripts/system/rngd | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/src/initscripts/system/rngd b/src/initscripts/system/rngd
>> index 91b70a7b4..8fe5c9363 100644
>> --- a/src/initscripts/system/rngd
>> +++ b/src/initscripts/system/rngd
>> @@ -15,6 +15,9 @@ case "${1}" in
>>  	start)
>>  		boot_mesg "Starting Random Number Generator Daemon..."
>>  		loadproc /usr/sbin/rngd --quiet
>> +		if [ -f "/var/run/rngd.pid" ]; then
>> +			chmod 644 /var/run/rngd.pid
>> +		fi
>>  		;;
>> 
>>  	stop)
>>
  

Patch

diff --git a/src/initscripts/system/rngd b/src/initscripts/system/rngd
index 91b70a7b4..8fe5c9363 100644
--- a/src/initscripts/system/rngd
+++ b/src/initscripts/system/rngd
@@ -15,6 +15,9 @@  case "${1}" in
 	start)
 		boot_mesg "Starting Random Number Generator Daemon..."
 		loadproc /usr/sbin/rngd --quiet
+		if [ -f "/var/run/rngd.pid" ]; then
+			chmod 644 /var/run/rngd.pid
+		fi
 		;;
 
 	stop)