Add hummingbird remediations type#14625
Add hummingbird remediations type#14625jan-cerny wants to merge 13 commits intoComplianceAsCode:masterfrom
Conversation
This new remediation type will be used to generate scripts that will perform hardening during the build of Project Hummingbird container images. The `hummingbird` type remediation scripts will be Bash scripts specifically written for the container image build environment. They won't be used in other situations. They will work with the `$NEWROOT` environment variable defined in the `Containerfile`.
Generate remediation scripts for all profiles in the `hummingbird` product and store them in the `/build/hummingbird_scripts` directory. These scripts will be integrated to the build process of container images in Project Hummingbird.
Improve format of the generated hummingbird remediation script. The main improvement is that it won't print an error message if the rule doesn't have any remediation, because in hummingbird remediation it's expected that most rules don't have any remediation, for example all package rules.
Add the NEWROOT variable as an argument fo the generated remediation script. The script is expected to be used in Containerfile and should modify the filesystem specified by the NEWROOT variable, typically `/new-root-fs`.
A Humminbird remediation for rule `no_host_based_files` has been added. This demonstrates how the Humminbird should look like and shows how it differs from a generic Bash remediation.
This fixes variable substitution code in Bash remediations.
0abe5b0 to
102504d
Compare
matusmarhefka
left a comment
There was a problem hiding this comment.
Just some nitpicks, otherwise LGTM.
|
I have risen an exception and shown a real list of languages |
Mab879
left a comment
There was a problem hiding this comment.
content/build-scripts/generate_profile_remediations.py
Lines 127 to 128 in 6c90337
Should this values[selector] and the tests introduced in this PR be updated to follow?
If an XCCDF Value doesn't have any value but has a selector, we should use the actual selector name. It seems the variable name holding the selector name was accidentally quoted so instead of the actual selector name we got "selector" literally.
|
I have fixed the empty value handling in |
|
@jan-cerny: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description:
New remediation type
hummingbirdhas been added. The hummingbird remediations are bash scripts specifically designed to be run only during building container images in the Hummingbird project.An example remediation for rule
no_host_based_fileshas been added. This example demonstrates how the Humminbird should look like and shows how it differs from a generic Bash remediation.Also, unit tests for
generate_profile_remediations.pyhave been added to this PR.Rationale:
Even though the remediations are Bash code, it isn't preferred to use existing Bash remediations. The reasons are:
Review Hints: