Skip to content

Entropy testing - #307

Merged
mbuechse merged 14 commits into
mainfrom
issue/268
Jun 28, 2023
Merged

mbuechse merged 14 commits into
mainfrom
issue/268

Conversation

@cah-hbaum

Copy link
Copy Markdown
Contributor

This PR introduces a test for checking Entropy, with regards to the provided Standard.

Things that are tested are as follows:

  • available entropy and number of FIPS 140-2 failures
  • HWRNG attributes in flavors (optional)
  • HWRNG attributes in images (optional)
  • HWRNG services in VMs (optional)

@cah-hbaum

Copy link
Copy Markdown
Contributor Author

IMO the following things should be included, even if they're not in the Standard or aren't a necessity:

  • test all images officially supported by SCS as standard (see Image Metadata Standard)
    • that means, create a VM and run the entropy and FIPS failure testing
    • could be an optional parameter on test initiation, so the user decides
  • test the HW device in the VM (this isn't required/mentioned in the standard, but should be done I think)

@cah-hbaum

Copy link
Copy Markdown
Contributor Author

Talked with @mbuechse about this, I will include the parts mentioned in the previous comment for now in a separate commit. If someone has objections for this, we can revert the commit.

@cah-hbaum cah-hbaum self-assigned this Jun 14, 2023
@cah-hbaum cah-hbaum added Container Issues or pull requests relevant for Team 2: Container Infra and Tooling SCS-VP10 Related to tender lot SCS-VP10 IaaS Issues or pull requests relevant for Team1: IaaS SCS is standardized SCS is standardized and removed Container Issues or pull requests relevant for Team 2: Container Infra and Tooling labels Jun 14, 2023
@mbuechse

Copy link
Copy Markdown
Contributor

I don't think there will be objections to these things as long as they are guarded by command-line options. The discussion will then be about which options we shall use for certification (cf. scs-compatible.yaml). BTW, you can already add the script to the scs-compatible-test.yaml in the testing directory. This can be used for testing the whole certification package (compatible IaaS), and if it works, then we already have a blueprint ready for the actual yaml.

cah-hbaum and others added 6 commits June 20, 2023 09:11
* add script to check available entropy on VMs and OpenStack
* additional requirements

Signed-off-by: Hannes Baum <[email protected]>
* improvements to appease Flake8
* sort script imports
* add command-line options

Signed-off-by: Matthias Büchse <[email protected]>
* adapt to the new standard introduced in #297
* added specific exceptions
* small inline documentation
* added return codes and explanation
* better explained log messages

Signed-off-by: Hannes Baum <[email protected]>
* possibility to check multiple images
* lists from image metadata standard
* more exception checks
* improved return codes
* improved usage output

Signed-off-by: Hannes Baum <[email protected]>
* handling for multiple package managers

Signed-off-by: Hannes Baum <[email protected]>
mbuechse and others added 5 commits June 20, 2023 11:05
- removed coupling with image standard (images have to be named in the yaml file)
- simplified return codes and logging
- simplified openstack API calls (e.g., use built-in feature to delete floating IPs)
- pick suitable flavor for checking virtio-rng, otherwise check is pointless
- made code more concise, added comments at a few surprising spots

Signed-off-by: Matthias Büchse <[email protected]>
* handling for multiple package managers

Signed-off-by: Hannes Baum <[email protected]>
Signed-off-by: Matthias Büchse <[email protected]>
@mbuechse

Copy link
Copy Markdown
Contributor

To all the reviewers, this is what the output looks like (DEBUG channel only shown due to -d argument)

$ python3 Tests/iaas/entropy/entropy-check.py -c openstack -d -i "Debian 11 (bullseye), Ubuntu 22.04 LTS x64"
DEBUG: Connecting to cloud 'openstack'
DEBUG: Selected images: Debian 11 (bullseye), Ubuntu 22.04 LTS x64
DEBUG: Checking images and flavors for recommended attributes
INFO: Image 'Debian 11 (bullseye)' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'Debian 10 (buster)' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'CentOS 7' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'Debian 9 (stretch)' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'AlmaLinux 8' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'Fedora 34 x86_64' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'Fedora 33 x86_64' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'CentOS 8' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'Fedora Atomic 29 x86_64' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'Ubuntu 16.04 LTS x64' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'Fedora CoreOS 32' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'CirrOS 0.5.1' missing recommended attributes: hw_rng_model=virtio
INFO: Image 'Fedora Atomic 27 x86_64' missing recommended attributes: hw_rng_model=virtio
INFO: Flavor 'XXS' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'XS' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'S' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'S.mem+' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'M' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'M.mem+' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'L' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'L.mem+' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'XL' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
INFO: Flavor 'XL.mem+' missing recommended attributes: hw_rng:allowed=True; additionally, missing optional attributes: hw_rng:rate_bytes, hw_rng:rate_period
DEBUG: Checking dynamic instance properties
DEBUG: Unable to pick flavor with hw_rng:allowed=True for image 'Debian 11 (bullseye)'
DEBUG: Creating instance of image 'Debian 11 (bullseye)' using flavor 'XXS'
DEBUG: Server 'scs-0101-server' ('99fdec2f-aaad-4b8f-9e52-d01dc5bb3102') has been created
INFO: VM 'Debian 11 (bullseye)' doesn't provide the recommended service rngd
DEBUG: Not looking for virtio-rng because required attributes are missing
DEBUG: Deleting server 'scs-0101-server'
DEBUG: Unable to pick flavor with hw_rng:allowed=True for image 'Ubuntu 22.04 LTS x64'
DEBUG: Creating instance of image 'Ubuntu 22.04 LTS x64' using flavor 'XXS'
DEBUG: Server 'scs-0101-server' ('3e75f0b5-8d7e-454e-b075-f4ca945914a1') has been created
INFO: VM 'Ubuntu 22.04 LTS x64' doesn't provide the recommended service rngd
DEBUG: Not looking for virtio-rng because required attributes are missing
DEBUG: Deleting server 'scs-0101-server'
DEBUG: Total critical / error / info: 0 / 0 / 25

@mbuechse

Copy link
Copy Markdown
Contributor

... and here is (part of) the output for CentOS 8, which has a package management problem mentioned in the code as well. Most importantly, we get an ERROR because the amount of entropy isn't fixed at 256, which means that the kernel is too old.

DEBUG: Unable to pick flavor with hw_rng:allowed=True for image 'CentOS 8'
DEBUG: Creating instance of image 'CentOS 8' using flavor 'XXS'
DEBUG: Server 'scs-0101-server' ('4d0c2549-4534-4294-b99e-be2121ecca2b') has been created
DEBUG: Not looking for virtio-rng because required attributes are missing
ERROR: VM 'CentOS 8' didn't have a fixed amount of entropy available. Expected 256, got 3783.
DEBUG: Error running 'aptitude': bash: apt-get: command not found
DEBUG: Error running 'dnf': Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
DEBUG: Error running 'yum': Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
DEBUG: Error running 'pacman': sudo: pacman: command not found
DEBUG: No package manager worked; proceeding anyway as rng-utils might be present nonetheless.
DEBUG: Deleting server 'scs-0101-server'
DEBUG: Total critical / error / info: 0 / 1 / 23

Comment thread Tests/iaas/entropy/entropy-check.py Resolved
Comment thread Tests/iaas/entropy/entropy-check.py Resolved
Comment thread Tests/iaas/entropy/entropy-check.py Resolved
Comment thread Tests/iaas/entropy/entropy-check.py Resolved
Comment thread Tests/iaas/entropy/entropy-check.py Resolved
Comment thread Tests/iaas/entropy/entropy-check.py Resolved
Comment thread Tests/iaas/entropy/entropy-check.py Resolved
Comment thread Tests/iaas/entropy/entropy-check.py Resolved
Comment thread Tests/iaas/entropy/entropy-check.py Resolved
@mbuechse
mbuechse merged commit 59dc21e into main Jun 28, 2023
@mbuechse
mbuechse deleted the issue/268 branch June 28, 2023 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IaaS Issues or pull requests relevant for Team1: IaaS SCS is standardized SCS is standardized SCS-VP10 Related to tender lot SCS-VP10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants