mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
Reseed the random device as early as possible to prevent hangs,
and provide some form of entropy in case there is no seed file to prevent a reboot from hanging unnecessarily.
This commit is contained in:
parent
a6278a2a42
commit
318cc4ad59
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=67113
39
etc/rc
39
etc/rc
@ -69,6 +69,31 @@ elif [ -r /etc/rc.conf ]; then
|
|||||||
. /etc/rc.conf
|
. /etc/rc.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Recover some entropy so the rebooting /dev/random can reseed
|
||||||
|
#
|
||||||
|
case ${entropy_file} in
|
||||||
|
[Nn][Oo] | '')
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -w /dev/random ]; then
|
||||||
|
if [ -f ${entropy_file} -a -r ${entropy_file} ]; then
|
||||||
|
echo "Reading entropy file"
|
||||||
|
cat ${entropy_file} > /dev/random 2> /dev/random
|
||||||
|
rm -f ${entropy_file}
|
||||||
|
else
|
||||||
|
echo "No entropy file, trying other sources"
|
||||||
|
# XXX temporary until we can get the entropy
|
||||||
|
# harvesting rate up
|
||||||
|
# Entropy below is not great, but better than nothing.
|
||||||
|
(ps -gauxwww; iostat; vmstat; dmesg) > /dev/random 2> /dev/random
|
||||||
|
( for i in /etc /var/run ; do
|
||||||
|
cd $i ; ls -al ; cat *
|
||||||
|
done ) > /dev/random 2> /dev/random
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Configure ccd devices.
|
# Configure ccd devices.
|
||||||
#
|
#
|
||||||
if [ -r /etc/ccd.conf ]; then
|
if [ -r /etc/ccd.conf ]; then
|
||||||
@ -158,20 +183,6 @@ if [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then
|
|||||||
sh ${diskless_mount}
|
sh ${diskless_mount}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Recover some entropy so the rebooting /dev/random can reseed
|
|
||||||
#
|
|
||||||
case ${entropy_file} in
|
|
||||||
[Nn][Oo] | '')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -f ${entropy_file} -a -r ${entropy_file} -a -w /dev/random ]; then
|
|
||||||
echo "Reading entropy file"
|
|
||||||
cat ${entropy_file} > /dev/random
|
|
||||||
rm -f ${entropy_file}
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
adjkerntz -i
|
adjkerntz -i
|
||||||
|
|
||||||
purgedir() {
|
purgedir() {
|
||||||
|
Loading…
Reference in New Issue
Block a user