SSLRandomSeed
SSLRandomSeedcontext source
[bytes
] Apache v2 only
This configures one or more sources for seeding the PRNG in OpenSSL
at startup time (context
is
'startup'
) and/or just before a new SSL connection
is established (context
is
'connect'
). This directive can only be used in the
global server context because the PRNG is a global facility.
Specifying the builtin
value for
source
indicates the built-in seeding
source. The source used for seeding the PRNG consists of the current
time, the current process id, and (when applicable) a randomly chosen
1KB extract of the interprocess scoreboard structure of Apache.
However, this is not a strong source, and at startup time (where the
scoreboard is not available) it produces only a few bytes of entropy.
So if you are seeding at startup, you should use an additional seeding source of the form:
file:/path
/to
/source
This variant uses an external file
/path/to/source as the source for seeding the
PRNG. When bytes is specified, only the first bytes number of bytes
of the file form the entropy (and bytes
is
given to /path/to/source as the first argument).
When bytes
is not specified, the whole
file forms the entropy (and 0
is given to
/path/to/source as the first argument). Use this
especially at startup time, for instance with /dev/random
and/or /dev/urandom devices (which
usually exist on modern Unix derivatives like FreeBSD and Linux).
Although /dev/random provides better quality data, it may not have the number of bytes available that you have requested. On some systems the read waits until the requested number of bytes becomes available — which could be annoying; on others you get however many bytes it actually has available — which may not be enough.
Using /dev/urandom may be better, because it never blocks and reliably gives the amount of requested data. The drawback is just that the quality of the data may not be the best.
On some platforms like FreeBSD one can control how the entropy is generated. See man rndcontrol(8). Alternatively, you can use tools like EGD (Entropy Gathering Daemon) and run its client program with the exec:/path/to/program/ variant (see later) or use egd:/path/to/egd-socket (see later).
You can also use an external executable as the source for seeding:
exec:/path
/to
/program
This variant uses an external executable /path/to/program
as the source for seeding the PRNG. When
bytes
is specified, only the first
bytes
number of bytes of
stdout
form the entropy. When
bytes
is not specified, all the data on
stdout
forms the entropy. Use this only at startup
time when you need a very strong seeding with the help of an external
program. But using this in the connection context slows the server
down dramatically.
The final variant for source
uses the Unix
domain socket of the external Entropy Gathering Daemon (EGD):
egd:/path
/to
/egd-socket
(Unix only)
This variant uses the Unix domain socket of the EGD (see http://www.lothar.com/tech/crypto/) to seed the PRNG. Use this if no random device exists on your platform.