3 # random Script to snapshot random state and reload it at boot time.
5 # chkconfig: 12345 20 80
7 # description: Saves and restores system entropy pool for higher quality \
8 # random number generation.
12 # Source function library.
13 . /etc/rc.d/init.d/functions
15 random_seed=/var/run/random-seed
17 # See how we were called.
20 show "Initializing random number generator"
22 # Carry a random seed from start-up to start-up
23 # Load and then save 512 bytes, which is the size of the entropy pool
24 if [ -f $random_seed ]; then
25 cat $random_seed >/dev/urandom
29 chmod 600 $random_seed
30 dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
31 touch /var/lock/subsys/random
36 # Carry a random seed from shut-down to start-up
37 # Save 512 bytes, which is the size of the entropy pool
38 show "Saving random seed"
41 chmod 600 $random_seed
42 dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
44 rm -f /var/lock/subsys/random
49 # this is way overkill, but at least we have some status output...
50 if [ -c /dev/random ] ; then
51 nls "The random data source exists"
53 nls "The random data source is missing"
57 # do not do anything; this is unreasonable
61 # do not advertise unreasonable commands that there is no reason
62 # to use with this device
63 msg_usage "$0 {start|stop|status}"