From 21f528419f945f0d2f867ffa55553b4d5da7f4b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Wed, 11 Feb 2009 22:06:13 +0100 Subject: Fix bug #13205: better random-seed entropy - For the random-seed file location to be more "FHS compliant" is better to put in /var/lib/misc/random-seed (Variable state information, that persists after reboot) than the /var/run/random-seed (Run-time variable data, that not necessarily persists after reboot) for example with /var/run mounted as TMPFS. - The random-seed file permision should be "0600" not "0644" - The size of random-seed acording to random(4) manpage should be the size specified in "/proc/sys/kernel/random/poolsize" in other case 512 bytes. --- rc.shutdown | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'rc.shutdown') diff --git a/rc.shutdown b/rc.shutdown index 74347c9..7f79c88 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -51,7 +51,16 @@ stat_busy "Sending SIGKILL To Processes" stat_done stat_busy "Saving Random Seed" -/bin/dd if=/dev/urandom of=/var/run/random-seed count=1 bs=512 2> /dev/null +RANDOM_SEED=/var/lib/misc/random-seed +: > $RANDOM_SEED +/bin/chmod 0600 $RANDOM_SEED +POOL_FILE=/proc/sys/kernel/random/poolsize +if [ -r $POOL_FILE ]; then + POOL_SIZE=$(/bin/cat $POOL_FILE) +else + POOL_SIZE=512 +fi +/bin/dd if=/dev/urandom of=$RANDOM_SEED count=1 bs=$POOL_SIZE &> /dev/null stat_done stat_busy "Saving System Clock" -- cgit v1.2.3