2012-08-22 18:43:21 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: postrandom
|
2012-09-11 05:04:59 +00:00
|
|
|
# REQUIRE: initrandom random FILESYSTEMS
|
2012-08-22 18:43:21 +00:00
|
|
|
# BEFORE: LOGIN
|
|
|
|
# KEYWORD: nojail
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="postrandom"
|
|
|
|
start_cmd="${name}_start"
|
|
|
|
stop_cmd=":"
|
|
|
|
|
|
|
|
# This will remove old ${entropy_file} and generate a new one.
|
2012-08-22 22:34:55 +00:00
|
|
|
# According to Bruce Schneier, this is strongly recommended in order
|
2012-08-22 18:43:21 +00:00
|
|
|
# to avoid using same ${entropy_file} across reboots.
|
2012-08-22 22:34:55 +00:00
|
|
|
# Reference: Chapter 10.6, Practical Cryptography, ISBN: 0-471-22357-3
|
2012-08-22 18:43:21 +00:00
|
|
|
|
|
|
|
postrandom_start()
|
|
|
|
{
|
|
|
|
/etc/rc.d/random fastsaveseed
|
|
|
|
|
|
|
|
case ${entropy_dir} in
|
|
|
|
[Nn][Oo])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
entropy_dir=${entropy_dir:-/var/db/entropy}
|
|
|
|
if [ -d "${entropy_dir}" ]; then
|
|
|
|
if [ -w /dev/random ]; then
|
|
|
|
rm -f ${entropy_dir}/*
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config random
|
|
|
|
run_rc_command "$1"
|