summaryrefslogtreecommitdiff
path: root/urandom.conf
blob: 1b4005777be8d024c672bc028eb21505d7700c9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# urandom - load seed-file into kernel pseudorandom number generator
#
# This task is run on startup, as early as possible.

description     "load seed-file into urandom"

# Initialize the PRNG as early as possible.
# Actually, nothing upstart can do is early enough,
# but this is better than nothing.
# Note that the root filesystem is probably still read-only at this point.
start on startup

# The "urandom" event means the PRNG has been initialized.
# You it may be possible to use /dev/random before this, at your own risk.
emits urandom

task
console output

script
  SAVEDFILE=/var/lib/urandom/random-seed        # probably belongs in a config file
  if test -r "$SAVEDFILE" ; then
    cat "$SAVEDFILE" > /dev/urandom
    initctl emit urandom
  fi
end script

# The seed file SHOULD NOT be reused.
# We rely on urandom-save and urandom-adios to rewrite the seed file.