]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - etc/rc.d/postrandom
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / etc / rc.d / postrandom
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
13 name="postrandom"
14 start_cmd="${name}_start"
15 stop_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
22 postrandom_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
40 load_rc_config random
41 run_rc_command "$1"