diff options
author | Thomas Bächler <thomas@archlinux.org> | 2009-02-11 22:06:13 +0100 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2009-02-11 22:06:13 +0100 |
commit | 21f528419f945f0d2f867ffa55553b4d5da7f4b8 (patch) | |
tree | c030e11f2da31bdb5e4780a3c96503eaa84de848 /rc.shutdown | |
parent | e932c3406acf105c99e159ca0610768fbfb49b1a (diff) |
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.
Diffstat (limited to 'rc.shutdown')
-rwxr-xr-x | rc.shutdown | 11 |
1 files changed, 10 insertions, 1 deletions
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" |