6 ms·
-- edit -- In case it's not clear I really, really agree with this article, I was having a rant about people I've worked with who make things needlessly complex
by Nursie 10y ago
-- edit -- In case it's not clear I really, really agree with this article, I was having a rant about people I've worked with who make things needlessly complex, not the link, which is great advice!
Just use /dev/urandom
I can't believe how many crappy engineers I've encountered who are resistant to this advice. The onpy coherent objection I've ever heard is that "It never blocs therefore it can provide random numbers with insufficient entropy", which has been adequately refuted many times now.
But still I encounter experienced, senior guys doing all sorts of Heath-Robinson crap with reading tons of entropy from TPM chips, feeding it to openssl or other systems as a seed and using those instead. It's completely unnecessary adds complexity (which in turn decreases security) and just...
What's really frustrating is people being convinced that random numbers are hard and therefore that they really need to do all this 'hard' stuff. I guess it flatters their egos.
- x1798DE 10y agoThe article specifically mentions that it is about how to use urandom, i.e. what are the language-specific wrappers in each language.
- Nursie 10y agoIndeed, it's a great article :) Didn't mean to come across as negative about it, though I can see how people might get that impression!
- richardwhiuk 10y agoIt's wrong to use during system startup as it may not have been seeded yet.
- Nursie 10y agoThat's true, but likely only true during the first ever boot due to entropy recycling.
- Dylan16807 10y agoOr the first boot after you clone the template VM, which could be any boot.
- matt_wulfeck 10y agoAs long as it's not the first system startup, on a headless machine with little in way of devices. Then you run the risk of generating a number without a seed. But the risk is low, since things like disk IO read times and other such will seed the generator unpredictable ways. Linux is smart enough to squirrel away some random on reboots so that it can properly seed the generator when it starts up again. On my system it looks like it's 512 bytes: $ wc -c /var/lib/urandom/random-seed 512 /var/lib/urandom/random-seed