Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use seedrng for seeding the random number generator #507

Closed
wants to merge 1 commit into from

Conversation

zx2c4
Copy link
Contributor

@zx2c4 zx2c4 commented Mar 25, 2022

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 OpenRC and
tweaked as needed: https://git.zx2c4.com/seedrng/about/

This commit imports it into OpenRC and wires up /etc/init.d/urandom to
call it. It shouldn't be called by other things on the system, so it
lives in rc_sbindir.

Closes #506.


I don't actually have an OpenRC system handy to test this on, so testers would be welcome here.

CC @thesamesam @williamh @vapier

@zx2c4
Copy link
Contributor Author

zx2c4 commented Mar 25, 2022

@thesamesam @williamh @vapier Any of you should feel free to take over this pull request entirely and add whatever tweaks you think are required.

@zx2c4 zx2c4 force-pushed the seedrng branch 8 times, most recently from 312c22e to 134a834 Compare March 25, 2022 05:45
@ncopa
Copy link
Contributor

ncopa commented Mar 25, 2022

I don't actually have an OpenRC system handy to test this on, so testers would be welcome here.

I applied to my workstation and it didn't end up in disaster so far. And output of /dev/urandom still looks random 😃

I am adding this patch to Alpine Linux edge for wider testing. Are there any specific things we should look for?

algitbot pushed a commit to alpinelinux/aports that referenced this pull request Mar 25, 2022
@zx2c4
Copy link
Contributor Author

zx2c4 commented Mar 25, 2022

I applied to my workstation and it didn't end up in disaster so far.

@ncopa Would you mind uploading your elog from a few boots, including the first one that uses this? Would be curious to see it progressing.

You also might want to wait until @williamh has had a pass at it. And actually I've already made some changes since your backport.

@zx2c4 zx2c4 force-pushed the seedrng branch 2 times, most recently from 21af539 to 0e4c2a3 Compare March 25, 2022 15:35
@thesamesam
Copy link
Contributor

I'm happy, it WFM, and I don't see a problem with letting it sit in ~arch in Gentoo at least for a bit, just like Alpine is doing in edge.

@zx2c4
Copy link
Contributor Author

zx2c4 commented Mar 25, 2022

Cool, sounds like a plan then. 👍

@zx2c4
Copy link
Contributor Author

zx2c4 commented Mar 25, 2022

Note that were it not for having to keep those Makefiles around, I would have just split up the urandom init.d/conf.d file into one for Linux and one for BSD, since that seems more possible with Meson, instead of this awkward thing I'm doing now where they're kept together. As a note for the future when the Makefiles go away, we might want to do this.

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 OpenRC and
tweaked as needed: https://git.zx2c4.com/seedrng/about/

This commit imports it into OpenRC and wires up /etc/init.d/urandom to
call it. It shouldn't be called by other things on the system, so it
lives in rc_sbindir.

Closes OpenRC#506.

Signed-off-by: Jason A. Donenfeld <[email protected]>
@zx2c4
Copy link
Contributor Author

zx2c4 commented Mar 26, 2022

@williamh wants to rewrite this or something, so closing this and letting him handle it.

@zx2c4 zx2c4 closed this Mar 26, 2022
@zx2c4 zx2c4 deleted the seedrng branch March 26, 2022 03:07
@zx2c4 zx2c4 restored the seedrng branch March 26, 2022 03:07
@zx2c4 zx2c4 deleted the seedrng branch March 26, 2022 03:07
@zx2c4 zx2c4 restored the seedrng branch March 26, 2022 05:57
@zx2c4
Copy link
Contributor Author

zx2c4 commented Mar 26, 2022

Reopening on the off chance that you want to merge this, as-is, and then apply your own stuff on top of it.

@zx2c4 zx2c4 reopened this Mar 26, 2022
@williamh williamh closed this in 076c255 Mar 27, 2022
@zx2c4 zx2c4 deleted the seedrng branch March 27, 2022 03:43
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Mar 27, 2022
… one

The seedrng patch was committed from an intermediate version in the PR,
not the final. So, this commit updates it to the one that was actually
committed.

Upstream PR: OpenRC/openrc#507
Upstream Patch: OpenRC/openrc@076c255
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Mar 28, 2022
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Mar 28, 2022
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Mar 28, 2022
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entropy seed regresses in quality and does not actually init RNG
4 participants