Bug 31521 - /etc/rc.d/init/random generator's state gets deleted on startup
/etc/rc.d/init/random generator's state gets deleted on startup
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
David Lawrence
: Security
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-12 12:08 EST by Martin Purschke
Modified: 2014-03-16 22:19 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-03-12 12:08:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martin Purschke 2001-03-12 12:08:36 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.16 i686)


In /etc/rc.d/init/random we preserve the status of the builtin random
generator on shutdown:

random_seed=/var/run/random-seed
...
  stop)
	# Carry a random seed from shut-down to start-up
	# Save 512 bytes, which is the size of the entropy pool
	touch $random_seed
	chmod 600 $random_seed
	action "Saving random seed" dd if=/dev/urandom of=$random_seed count=1
bs=512 2>/dev/null

but on the subsequent startup, we delete the /var/run/random-seed file in
rc.sysinit:

# Clean up /var
# I'd use find, but /usr may not be mounted.
for afile in /var/lock/* /var/run/*; do
   if [ -d "$afile" ]; then
      [ "`basename $afile`" != "news" -a "`basename $afile`" != "sudo" ] &&
rm -f $afile/*
   else
      rm -f $afile
   fi
done

We could add to rc.sysinit to leave that file alone, but it would be
cleaner to save the random state in a different directory that doesn't get
cleaned out.


Reproducible: Always
Steps to Reproduce:
1. just look at it - in the random start) section we always just create the
file from scratch, because it has been deleted just before.
2.
3.
	

This bug might open a potential security hole with generated keys using
that random generator. It severely cuts down on the phase space for the
seed value, and makes things like ssh keys easier to break. In the best of
circumstances, the 512 bytes are filled with random bits at power up, but
if the BIOS runs a memory test at power-on, it might be much more
predictable, depending on the hardware and setup. 

It's in 6.x, and 7.x distributions alike.
Comment 1 Bill Nottingham 2001-03-12 12:17:59 EST
Will be fixed in 5.76-1; I changed it to write it to /var/lib.

Note You need to log in before you can comment on or make changes to this bug.