mirage / mirage-qubes

Mirage support for writing QubesOS AppVM unikernels
BSD 2-Clause "Simplified" License
63 stars 11 forks source link

Use /qubes-random-seed #34

Open talex5 opened 5 years ago

talex5 commented 5 years ago

QubesDB provides us with some extra entropy in /qubes-random-seed. If we configure a Qubes unikernel with a random number generator, it should probably mix this in somehow.

cfcs commented 5 years ago

That sounds very sensible!

Do you have any suggestions regarding where it might make sense to patch this in?

hannesm commented 5 years ago

imho this should go into mirage-entropy (likely a mirage-entropy qubes variant should be created that mixes the random-seed (is this constant, or does it change over the lifetime?)) -- mirage-entropy is nowadays used by all (mirage-random-stdlib/nocrypto) RNG with MirageOS (there's only ever one which is seeded and used by the unikernel)

cfcs commented 5 years ago

The entry is there to seed the CSPRNG of VMs at early boot before they have been able to collect their own entropy. The equivalent in Linux is /var/lib/systemd/random-seed (maintained by the systemd-random-seed service). In OpenBSD they have /etc/random.seed. In FreeBSD there's /boot/entropy and maybe /entropy.

hannesm commented 5 years ago

I asked @marmarek about /qubes-random-seed semantics, and it is written once by the host system, i.e. no need to (a) write something from the guest side to that key and (b) read the value periodically.