1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00
freebsd/etc/rc.d/postrandom
David E. O'Brien 8801556beb Simply things so that "#REQUIRE: FILESYSTEMS" means the file
systems are fully "ready to go".

'FILESYSTEMS' states: "This is a dummy dependency, for services which
require file systems to be mounted before starting."  However, we have
'var' which is was run after 'FILESYSTEMS' and can mount /var if it
already isn't mounted.  Furthermore, several scripts cannot use /var
until 'cleanvar' has done its thing.  Thus "FILESYSTEMS" hasn't really
meant all critical file systems are fully usable.
2012-09-11 05:04:59 +00:00

42 lines
760 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: postrandom
# REQUIRE: initrandom random FILESYSTEMS
# 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.
# According to Bruce Schneier, this is strongly recommended in order
# to avoid using same ${entropy_file} across reboots.
# Reference: Chapter 10.6, Practical Cryptography, ISBN: 0-471-22357-3
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"