You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IaaS ADR on providing virtio-rng entropy source #234
As an SCS IaaS user, I want to rely on having enough entropy in the virtual machines that are started.
For this I configure virtio-rng guest driver in the VM and expect virtio-rng to be supported from the host (hypervisor).
Maybe we should make this a SHOULD, as we don't want to mandate KVM as hypervisor and possiby not all alternative hypervisors support virtio-rng?
We could als require (MUST) that entropy is injected via metadata always
IF we don't have virtio-rng, we MUST provide reasonable fallback. I would suggest in addition to the entropy injection via metadata that we require CPU hardware RNG capability then. (However, to consume the latter, the images would need to start havegd or rngd included and configured to start -- this would need investigation ...) Needs discussion ...
With the image metadata, enabling hw_rng:virtio, I believe that we have TWO potential good entropy sources in the VM.
(1) The virtio-rng driver in the guest can get entropy from the host. (Does this require rng-utils?)
How the host (hypervisor) generates entropy depends ... it may use the traditional IRQ jitter etc. or use the CPU RNG in addition. This option requires trusting the host and its operators.
(2) The RDRAND and RDSEED instructions are not privileged and work fine in VMs. To use it the guest must have rng-utils installed and started. (Should we consider having vendor_data doing this by default?). This requires trusting the CPU vendor. It is not available on very old x86 CPUs (pre-Ivy-Bridge, pre-Zen).
Option (1) is only available on hypervisors providing virtio-rng. This works nicely on kvm, and probably also xen, not so sure about others (hyper-v, esx, ...). So we would need to require (2) to be working there.
We get some initial entropy also injected via the metadata and cloud-init uses it to feed the initial entropy pool. We should require this as well, because some images may not have rng-utils enabled.
Option (1) is only available on hypervisors providing virtio-rng. This works nicely on kvm, and probably also xen, not so sure about others (hyper-v, esx, ...). So we would need to require (2) to be working there.
This ADR by @matfechner is in regards to the IaaS reference implementation (from my understanding and the title of the issue etc.), shouldn't we just focus on whats in the IaaS reference implementation then? (eg. kvm)
@fkr but the haveged is as method under item 1.2.1 for Hyper-V, Xen or VMware is also documented, as well. That is an accepted method that work since years in F5 applicances, etc.
I'm currently working with @cah-hbaum on the tests for this standard (see standards/#268). Hannes and I are having trouble reaching an agreement as to what has to actually be tested here:
From my very own perspective, only Section 1.3 of the standard is authoritative while the rest is merely background information (just as an indicator, the typical "must" and "should" are not to be found there); therefore I suggest that Section 1.3 be moved up a level (because I don't think it belongs under "Terminology").
Hannes, on the other hand, would argue that Section 1.3 is not sufficient, because it doesn't say anything about minimum kernel version, presence of haveged etc.
@fkr@garloff@matfechner Can you tell us what parts of the document are actually authoritative, and do you agree that the sections should be restructured? Would you say that factors such as kernel version, haveged etc. should be mandated? I would be happy to provide a PR for any changes, of course.
From my very own perspective, only Section 1.3 of the standard is authoritative while the rest is merely background information (just as an indicator, the typical "must" and "should" are not to be found there);
this is factually not correct, please read the standard, e.g. it says in section 1.2.3:
For example haveged should not be use anymore[..]
so that should also hopefully answer your question regarding haveged and also, by implication, the minimum kernel version.
I agree, it could maybe worded more clearly.
aside from that I'd urge everyone involved in this topic to read this very good, albeit old, article:
@artificial-intelligence You're right, I missed a "should". I understand the statement in question as follows:
If the running kernel is version 5.17 or higher, then haveged should not be used.
In other words, a potential test could emit a warning if haveged is present on a system with kernel version 5.17 or higher. (I suppose a warning is enough because we are dealing with a "should" and not a "must"?) But is this really a requirement for SCS? I find the standard a bit unclear in this regard, and the original statement by @garloff says nothing of this kind:
As an SCS IaaS user, [...] I configure virtio-rng guest driver in the VM and expect virtio-rng to be supported from the host (hypervisor).
So, in my humble opinion, clarifications would be very beneficial.
Besides, I'm puzzled by the list of articles that you mentioned in your comment. So far, the structure of the standard suggests that it is self-contained to a certain degree, so much so that it should be possible to be implemented without consulting further documents from the internet that aren't even mentioned in the standard. I think if the standard is unclear as to how it can be satisfied, then we definitely have to extend it.
We wanted to have a (quick?) call on this anyways (at least, we concluded this in last weeks IaaS call).
Would next tuesday (May 30th) at 11:30 CEST or 14:00 CEST work? @cah-hbaum@mbuechse@matfechner@artificial-intelligence - just signal via 👍 or 👎
Discussion 2023-06-07:
Three topics:
(1) Lowest common denominator - fortunately no longer an issue with modern hardware and linux kernels (5.18+, backported into vendor kernels, e.g. Ubu20.04's 5.4) IN GUEST
SCS requirement: Require x86-64 CPUs to support RDSEED/RDRANDOM (and not to be filtered out), likewise require equivalent stuff on ARM
Require operator managed images to be kept up to date (increasing chances those use RDSEED/RDRANDOM)
(1a) Requirement for SCS mandatory images: SCS should validate that all of them use RDSEED ...
(2) virtio-rng was the traditional way to get (reasonable?) entropy into VM
Should SCS require this to be there? (-> recommended)
Quality requirements for randomness/entropy?
(3) virtio-rng Advanced HW-RNG
Needs to be used by HOST with rngd, then exposed via virtio-rng to VM
(3a) This could become a flavor flag indicating that virtio-rng has especially high quality random numbers
=> This will become part of a future flavor standard, with requirements to the quality of the randomness
Activity
garloff commentedon Dec 8, 2022
Notes:
matfechner commentedon Feb 10, 2023
fkr commentedon Feb 14, 2023
@matfechner imho the document from SovereignCloudStack/standards#210 does not address the requirements from this issue, since the fallback case is not elaborated on.
garloff commentedon Feb 14, 2023
With the image metadata, enabling
hw_rng:virtio, I believe that we have TWO potential good entropy sources in the VM.(1) The virtio-rng driver in the guest can get entropy from the host. (Does this require rng-utils?)
How the host (hypervisor) generates entropy depends ... it may use the traditional IRQ jitter etc. or use the CPU RNG in addition. This option requires trusting the host and its operators.
(2) The RDRAND and RDSEED instructions are not privileged and work fine in VMs. To use it the guest must have rng-utils installed and started. (Should we consider having vendor_data doing this by default?). This requires trusting the CPU vendor. It is not available on very old x86 CPUs (pre-Ivy-Bridge, pre-Zen).
Option (1) is only available on hypervisors providing virtio-rng. This works nicely on kvm, and probably also xen, not so sure about others (hyper-v, esx, ...). So we would need to require (2) to be working there.
We get some initial entropy also injected via the metadata and cloud-init uses it to feed the initial entropy pool. We should require this as well, because some images may not have rng-utils enabled.
fkr commentedon Feb 24, 2023
This ADR by @matfechner is in regards to the IaaS reference implementation (from my understanding and the title of the issue etc.), shouldn't we just focus on whats in the IaaS reference implementation then? (eg. kvm)
matfechner commentedon Mar 7, 2023
@fkr but the haveged is as method under item 1.2.1 for Hyper-V, Xen or VMware is also documented, as well. That is an accepted method that work since years in F5 applicances, etc.
fkr commentedon Mar 14, 2023
SovereignCloudStack/docs#24
3 remaining items
mbuechse commentedon May 23, 2023
I'm currently working with @cah-hbaum on the tests for this standard (see standards/#268). Hannes and I are having trouble reaching an agreement as to what has to actually be tested here:
@fkr @garloff @matfechner Can you tell us what parts of the document are actually authoritative, and do you agree that the sections should be restructured? Would you say that factors such as kernel version, haveged etc. should be mandated? I would be happy to provide a PR for any changes, of course.
artificial-intelligence commentedon May 23, 2023
Hi,
this is factually not correct, please read the standard, e.g. it says in section 1.2.3:
so that should also hopefully answer your question regarding haveged and also, by implication, the minimum kernel version.
I agree, it could maybe worded more clearly.
aside from that I'd urge everyone involved in this topic to read this very good, albeit old, article:
https://www.2uo.de/myths-about-urandom/
Additional wisdom might be found in jason a. donenfelds commits to the linux kernel and these articles detailing the topic, e.g. https://lwn.net/Articles/887207/
you can find the overview for random numbers in the linux kernel here:
https://lwn.net/Kernel/Index/#Random_numbers
the most recent article would be https://lwn.net/Articles/884875/
mbuechse commentedon May 23, 2023
@artificial-intelligence You're right, I missed a "should". I understand the statement in question as follows:
If the running kernel is version 5.17 or higher, then haveged should not be used.
In other words, a potential test could emit a warning if haveged is present on a system with kernel version 5.17 or higher. (I suppose a warning is enough because we are dealing with a "should" and not a "must"?) But is this really a requirement for SCS? I find the standard a bit unclear in this regard, and the original statement by @garloff says nothing of this kind:
So, in my humble opinion, clarifications would be very beneficial.
Besides, I'm puzzled by the list of articles that you mentioned in your comment. So far, the structure of the standard suggests that it is self-contained to a certain degree, so much so that it should be possible to be implemented without consulting further documents from the internet that aren't even mentioned in the standard. I think if the standard is unclear as to how it can be satisfied, then we definitely have to extend it.
fkr commentedon May 24, 2023
We wanted to have a (quick?) call on this anyways (at least, we concluded this in last weeks IaaS call).
Would next tuesday (May 30th) at 11:30 CEST or 14:00 CEST work? @cah-hbaum @mbuechse @matfechner @artificial-intelligence - just signal via 👍 or 👎
matfechner commentedon May 24, 2023
@fkr +1 both appointments are fine for me
fkr commentedon May 25, 2023
Since @artificial-intelligence is not available during the times I proposed, a new proposal would be 1530 CEST on tuesday.
I'll send out an invite.
mbuechse commentedon May 31, 2023
Meeting minutes (courtesy of Felix): https://input.scs.community/BLi_LyZjScagyI0qw74tHw#
garloff commentedon Jun 7, 2023
Discussion 2023-06-07:
Three topics:
(1) Lowest common denominator - fortunately no longer an issue with modern hardware and linux kernels (5.18+, backported into vendor kernels, e.g. Ubu20.04's 5.4) IN GUEST
(1a) Requirement for SCS mandatory images: SCS should validate that all of them use RDSEED ...
(2) virtio-rng was the traditional way to get (reasonable?) entropy into VM
(3) virtio-rng Advanced HW-RNG
(3a) This could become a flavor flag indicating that virtio-rng has especially high quality random numbers
=> This will become part of a future flavor standard, with requirements to the quality of the randomness
mbuechse commentedon Jun 8, 2023
I updated the branch (see PR 297) accordingly (as far as I understood).