Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt sysctl template for bootable containers #12552

Merged
merged 6 commits into from
Nov 6, 2024

Conversation

jan-cerny
Copy link
Collaborator

Add an SCE check to the sysctl template special for bootable containers. We don't want to use OVAL check in this template because the OVAL check checks runtime status using OpenSCAP sysctl probe. The probe doesn't return meaningful results during podman build process and also it doesn't make sense to check runtime during the build. We need to check only the static configuration. Moreover, we update the Bash remediation to not set the runtime status during podman build process.

@jan-cerny jan-cerny added the Image Mode Bootable containers and Image Mode RHEL label Oct 30, 2024
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Oct 30, 2024
Copy link

openshift-ci bot commented Oct 30, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@jan-cerny
Copy link
Collaborator Author

/packit build

@jan-cerny jan-cerny force-pushed the sysctl_bootc branch 2 times, most recently from 8d62301 to 5237ec2 Compare November 5, 2024 09:46
@jan-cerny jan-cerny marked this pull request as ready for review November 5, 2024 13:24
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Nov 5, 2024
@Mab879 Mab879 self-assigned this Nov 5, 2024
@Mab879 Mab879 added this to the 0.1.75 milestone Nov 5, 2024
Add an SCE check to the sysctl template special for bootable containers.
We don't want to use  OVAL check in this template because the OVAL
check checks runtime status using OpenSCAP sysctl probe. The probe
doesn't return meaningful results during podman build process and also
it doesn't make sense to check runtime during the build. We need to
check only the static configuration. Moreover, we update the Bash
remediation to not set the runtime status during podman build process.

We need to update the test `test_xccdf_values_in_ds.sh`. Bash variables
whose names start with `$XCCDF_VALUE_` are valid in SCE content. The
`$XCCDF_VALUE_` variables are exported by `oscap` so that the SCE check
can use XCCDF Values in its code.
The flags "S" and "R" are set in FLAGS variable always. Since
they're set always, we don't have to set them at all. We
can remove the conditions that check for these flags and always
use the code inside the conditions.
In fact, the `FLAGS` variable only holds information about if
the rule is related to IPv6 or not. So we can rename it to
a better name `IPV6` and make it a boolean variable.
@jan-cerny
Copy link
Collaborator Author

I have rebased this PR on the top of the latest upstream master branch. Then, I have add support for multiple values in sysctlvar parameter.

All occurrences of the sysctl settings must have the correct value.
It isn't enough to have one correct entry to pass. If there are
multiple entries and one of them has incorrect value we need to
fail.
@Mab879 Mab879 modified the milestones: 0.1.75, 0.1.76 Nov 6, 2024
Copy link

codeclimate bot commented Nov 6, 2024

Code Climate has analyzed commit 257d257 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 60.9% (0.0% change).

View more on Code Climate.

@Mab879 Mab879 assigned matusmarhefka and unassigned Mab879 Nov 6, 2024
@matusmarhefka matusmarhefka merged commit b5456a8 into ComplianceAsCode:master Nov 6, 2024
104 of 105 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Image Mode Bootable containers and Image Mode RHEL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants