by ThA0x2 · 6y ago · 0 comments
shuf -n 4 /usr/share/dict/words
shuf --random-source=/dev/urandom -n 4 /usr/share/dict/words
[1] https://www.gnu.org/software/coreutils/manual/html_node/Rand...
[2] https://github.com/coreutils/coreutils/blob/v8.5/gl/lib/rand...
[3] https://github.com/coreutils/coreutils/blob/v8.32/gl/lib/ran...
Edit: As ThA0x2 points out in a reply, the latest version of shuf uses /dev/urandom to generate a default nonce, which vastly improves upon older versions. As long as your version of coreutils is at least 8.6 or later and your OS has /dev/urandom, the default should be fine. If you don't have /dev/urandom, even the latest version of shuf (version 8.32, as of June 15, 2020) will still default to an insecure nonce.
In any case, I expect it's much harder than a random "free password gen!" website saving results on the sly (... which is meant to be mild criticism of your framing, but not your recommendation :-p).
I definitely wouldn't try this on a freshly booted Raspberry Pi, for example.
https://github.com/coreutils/coreutils/blob/v8.31/gl/lib/ran...
It's going to be as practical to attack as anything that uses /dev/urandom.
That said, I suspect most people are indeed on a platform with a sufficiently recent version of shuf.
(And a sufficiently old version may lack the random-source option.)
https://github.com/coreutils/coreutils/blob/v8.31/gl/lib/ran...
Your "--random-source=/dev/urandom" line is superfluous. My original line is as secure as yours.
The master branch of coreutils is using getrandom(2). It will continue to draw entropy from the urandom source by default.
The main objection I have to sites like this is that they encourage people to use a random untrusted site to generate a password for, say, their bank account.
no thanks.