diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-03-25 21:37:44 -0600 |
---|---|---|
committer | Michael Aldridge <aldridge.mac@gmail.com> | 2022-03-25 23:24:11 -0500 |
commit | 87044318e9acb741e1b74767f30cc4ae802ed398 (patch) | |
tree | 2f7f25ce34df3ad1ecc6763bedd1a7eb8e654a16 /3 | |
parent | 5b18be19e3faa8eb396c0608906fbf0d755a4491 (diff) | |
download | runit-void-87044318e9acb741e1b74767f30cc4ae802ed398.tar.gz runit-void-87044318e9acb741e1b74767f30cc4ae802ed398.tar.xz runit-void-87044318e9acb741e1b74767f30cc4ae802ed398.zip |
Use seedrng for seeding the random number generator
The RNG can't actually be seeded from a shell script, due to the reliance on ioctls. For this reason, the seedrng project provides a basic script meant to be copy and pasted into projects like void-runit and tweaked as needed: <https://git.zx2c4.com/seedrng/about/>. This commit imports it into void-runit and wires up the init scripts to call it. This also is a significant improvement over the current init script, which fails to remove seed files that have already been used, or to ratchet them forward.
Diffstat (limited to '3')
-rwxr-xr-x | 3 | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/3 b/3 index 4a4781e..726d26a 100755 --- a/3 +++ b/3 @@ -15,8 +15,7 @@ sv exit /var/service/* [ -x /etc/rc.shutdown ] && /etc/rc.shutdown if [ -z "$VIRTUALIZATION" ]; then - msg "Saving random seed..." - ( umask 077; bytes=$(cat /proc/sys/kernel/random/poolsize) || bytes=512; dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes >/dev/null 2>&1 ) + seedrng fi if [ -z "$VIRTUALIZATION" -a -n "$HARDWARECLOCK" ]; then |