Skip to content

Write tests to check standards for entropy in VMs #268

Closed

Description

@anjastrunk

Standard for entropy in VMs can be found as draft.

Is seems like we have to create cloud resources to test entropy compliance. If so, we should provide/reuse a framework to create/delete cloud resources, that can be reused in other tests. Furthermore, it must be ensured resources are cleaned up under all circumstances (including temporarily unavailable API etc.).

Activity

  1. changed the title [-]Write test to check standards for entropy in VMs[/-] [+]Write tests to check standards for entropy in VMs[/+] on Apr 25, 2023
  2. cah-hbaum commented on Apr 27, 2023

    @cah-hbaum
    Contributor

    Draft can be found here or in this file
    Addition to this can be found here

  3. cah-hbaum commented on May 9, 2023

    @cah-hbaum
    Contributor

    We had some talks in the Standardization Group about this.
    The Standard was updated last week to reflect the changes undertaken in Linux Kernel 5.17 / 5.18.

    In general, the Standard is mostly sufficient for now, since all important parts are covered, but the whole problem described there is a bit outdated, if only newer kernel versions are used. But for (backwards) compatibility reasons, we should still keep it.
    IMO some parts should also be changed a bit, e.g. the way how 'available' entropy is shown, since the available entropy isn't necessarily important, but instead the time in which it regenerates. Some more possible changes will be enumerated in the next comment.

    A related, maybe more important issue would be some kind of investigation into the quality of these generated randomness in the new kernel, which, if not sufficient, could make hardware sources a necessity. If a document like this is created and if it should find its way into a standard, should be discussed in the meeting.

    Compliance testing could be done the following way:

    1. connect to an OpenStack instance
    2. create a VM with an image and a flavor (we could check all image + flavor combinations here)
    3. connect to the VM
    4. check the kernel version of the VM
      1. Kernel < 5.18
        1. Check if havaged is installed
        2. Check if rng-tools / rng-utils is installed
        3. Jump to step 5)
      2. Kernel >= 5.18
        Everything should be fine
      3. If we want to be really meticulous, it would be best to start 2 processes, wherein 1 of them depletes entropy and the other one watches the available entropy
    5. check available hardware entropy devices (based on the kernel optional or required)
      1. check the hardware devices
        cat /sys/devices/virtual/misc/hw_random/rng_available
      2. check the OpenStack flavor attributes for
        hw_rng:allowed = True
        and optionally
        hw_rng:rate_bytes = <Allowed amount of read bytes> hw_rng:rate_period
      3. check the OpenStack image attributes for
        hw_rng_model: virtio
    6. disconnect from the VM and remove everything built up from the environment
  4. cah-hbaum commented on May 9, 2023

    @cah-hbaum
    Contributor

    Some changes that should be included in the Standard:

    • if "enough" entropy is available probably shouldn't be measured on the current available entropy, because depending on the kernel, it could be depleted fast and not be replenished for a long time (also, the number is hardcoded in newer kernels and therefore has no comparibility with newer kernels)
    • add a few more information about entropy, how it is implemented in the Linux kernel and where the difference was between /dev/random and /dev/urandom and why this doesn't matter anymore
    • especially, explain that the new kernel generates randomness via CPU jitters (basically hardware), which also works in VMs, since they have access to their respective CPU cores
  5. added
    IaaS
    SCS is standardized
    SCS-VP10
    on May 22, 2023
  6. added this to the R5 (v6.0.0) milestone on May 22, 2023
  7. added
    Sprint Bratislava
    Sprint Copenhagen
    on May 22, 2023
  8. 13 remaining items

  9. self-assigned this
    on Jun 28, 2023
  10. added a commit that references this issue on Jun 28, 2023
  11. moved this from Doing to Done in Sovereign Cloud Stackon Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

IaaSSCS is standardizedSCS-VP10Sprint BratislavaSprint CopenhagenSprint Edmonton

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions