1#!/bin/sh 2# 3# $FreeBSD$ 4# 5 6# PROVIDE: postrandom 7# REQUIRE: initrandom random FILESYSTEMS 8# BEFORE: LOGIN 9# KEYWORD: nojail 10 11. /etc/rc.subr 12 13name="postrandom" 14start_cmd="${name}_start" 15stop_cmd=":" 16 17# This will remove old ${entropy_file} and generate a new one. 18# According to Bruce Schneier, this is strongly recommended in order 19# to avoid using same ${entropy_file} across reboots. 20# Reference: Chapter 10.6, Practical Cryptography, ISBN: 0-471-22357-3 21 22postrandom_start() 23{ 24 /etc/rc.d/random fastsaveseed 25 26 case ${entropy_dir} in 27 [Nn][Oo]) 28 ;; 29 *) 30 entropy_dir=${entropy_dir:-/var/db/entropy} 31 if [ -d "${entropy_dir}" ]; then 32 if [ -w /dev/random ]; then 33 rm -f ${entropy_dir}/* 34 fi 35 fi 36 ;; 37 esac 38} 39 40load_rc_config random 41run_rc_command "$1" 42