After bug report from John V. Belmonte

Updated init and quit scripts to reflect kernel 2.4/2.6 reality
     (Scripts taken from drivers/char/random.c)
     as per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=247779
This commit is contained in:
Michael Kerrisk 2004-12-16 14:24:00 +00:00
parent d4e39a3e0a
commit 8deb0f0d5b
1 changed files with 24 additions and 13 deletions

View File

@ -7,6 +7,8 @@
.\" .\"
.\" Some changes by tytso and aeb. .\" Some changes by tytso and aeb.
.\" .\"
.\" 2004-12-16, John V. Belmonte/mtk, Updated init and quit scripts
.\"
.TH RANDOM 4 2003-10-25 "Linux" "Linux Programmer's Manual" .TH RANDOM 4 2003-10-25 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
random, urandom \- kernel random number source devices random, urandom \- kernel random number source devices
@ -59,25 +61,34 @@ To do this, add the following lines to an appropriate script
which is run during the Linux system start-up sequence: which is run during the Linux system start-up sequence:
.nf .nf
echo "Initializing kernel random number generator..." echo "Initializing random number generator..."
# Initialize kernel random number generator with random seed random_seed=/var/run/random-seed
# from last shut-down (or start-up) to this start-up. Load and # Carry a random seed from start-up to start-up
# then save 512 bytes, which is the size of the entropy pool. # Load and then save the whole entropy pool
if [ -f /var/random-seed ]; then if [ -f $random_seed ]; then
cat /var/random-seed >/dev/urandom cat $random_seed >/dev/urandom
fi else
dd if=/dev/urandom of=/var/random-seed count=1 touch $random_seed
fi
chmod 600 $random_seed
poolfile=/proc/sys/kernel/random/poolsize
[ -r $poolfile ] && bytes=`cat $poolfile` || bytes=512
dd if=/dev/urandom of=$random_seed count=1 bs=$bytes
.fi .fi
Also, add the following lines in an appropriate script which is Also, add the following lines in an appropriate script which is
run during the Linux system shutdown: run during the Linux system shutdown:
.nf .nf
# Carry a random seed from shut-down to start-up for the random # Carry a random seed from shut-down to start-up
# number generator. Save 512 bytes, which is the size of the # Save the whole entropy pool
# random number generator's entropy pool. echo "Saving random seed..."
echo "Saving random seed..." random_seed=/var/run/random-seed
dd if=/dev/urandom of=/var/random-seed count=1 touch $random_seed
chmod 600 $random_seed
poolfile=/proc/sys/kernel/random/poolsize
[ -r $poolfile ] && bytes=`cat $poolfile` || bytes=512
dd if=/dev/urandom of=$random_seed count=1 bs=$bytes
.fi .fi
.SH "PROC INTERFACE" .SH "PROC INTERFACE"
The files in the directory The files in the directory