diff options
author | jwd <jwd@FreeBSD.org> | 2000-10-16 04:44:35 +0000 |
---|---|---|
committer | jwd <jwd@FreeBSD.org> | 2000-10-16 04:44:35 +0000 |
commit | 5f8354442683aaa2bf2f18d8704e282672ac89f6 (patch) | |
tree | a04f1165d23dcc65f9e0bfec62bdc9df84616da3 /etc/rc.shutdown | |
parent | f6a9ec137a5281f3e8f389681fd50de7dbe5e0c1 (diff) | |
download | FreeBSD-src-5f8354442683aaa2bf2f18d8704e282672ac89f6.zip FreeBSD-src-5f8354442683aaa2bf2f18d8704e282672ac89f6.tar.gz |
Having played with this commit request for a few hours, I've
convinced myself that it's better then what we have, but still
not perfect.
/etc/rc : Attempt to seed /dev/random with multiple backoffs.
/etc/rc.shutdown : Attempt to write the entropy_file.
In debugging the above changes, I've run into some
inconsistancies... rc.shutdown is run via 'init 6', but
does not appear to be run via '/sbin/reboot'. Thus, this
set of changes improves life depending on the mechanism
used to shut the system down.
Submitted by: Doug Barton <DougB@gorean.org>
Approved by: markm
Diffstat (limited to 'etc/rc.shutdown')
-rw-r--r-- | etc/rc.shutdown | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/etc/rc.shutdown b/etc/rc.shutdown index f0bc93c..6719414 100644 --- a/etc/rc.shutdown +++ b/etc/rc.shutdown @@ -62,9 +62,25 @@ case ${entropy_file} in rm -f ${entropy_file} oumask=`umask` umask 077 - touch ${entropy_file} && \ - dd if=/dev/random of=${entropy_file} \ + if touch ${entropy_file} ; then + entropy_file_confirmed="${entropy_file}" + else + # Try this as a reasonable alternative for read-only + # roots, diskless workstations, etc. + rm -f /var/db/entropy + if touch /var/db/entropy ; then + entropy_file_confirmed=/var/db/entropy + fi + fi + case ${entropy_file_confirmed} in + '') + echo "ERROR: entropy file write failed" + ;; + *) + dd if=/dev/random of=${entropy_file_confirmed} \ bs=4096 count=1 2> /dev/null + ;; + esac umask ${oumask} ;; esac |