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

Merge maint-1.3 to main #2176

Merged
merged 29 commits into from
Nov 13, 2024
Merged

Merge maint-1.3 to main #2176

merged 29 commits into from
Nov 13, 2024

Conversation

jan-cerny
Copy link
Member

This will bring useful changes from the maint-1.3 maintenance branch to the main branch. This includes oscap-bootc and changes supporting oscap-bootc.

evgenyz and others added 28 commits March 18, 2024 21:23
Accidentally, the GitHub CI started to build Perl bindings on Windows
because the dependencies become available. However, the build fails
because our code isn't ready to be built on Windows.  This change will
ensure the Perl bindings are kept disabled on Windows.

See: https://github.com/OpenSCAP/openscap/actions/runs/8879756994/job/24378248762?pr=2104
If the document doesn't contain the xlink namespace, we need
to define it before we create the `xlink:href` attribute.

This situation happens if the `data-stream-collection` root
element of the input SCAP source data stream doesn't have
the xlink namespace defined.

Resolves: RHEL-34104
We don't need fresh fedoras or ubuntus. We keep that version only for
older RHELs and Ubuntu LTSes.
The assumption that /var/lib/rpm is always a symlink to
/usr/lib/sysimage/rpm was wrong. In bootc images, it isn't
the case. As a result, all rules were evaluated as notapplicable
when scanning a bootc image or container.

We will fix it the following way: We will first try if the "new"
location /usr/lib/sysimage/rpm exists, and use it only if it exists.  If
it doesn't exist, we will fall back to the "old" location /var/lib/rpm.

Fixes: https://issues.redhat.com/browse/RHEL-55251
Fixes: OpenSCAP#2151
Improve RPM database path in RPM probes
This commit introduces a new environment variable
`OSCAP_PREFERRED_ENGINE`. This variable allows users to set a preffered
check engine for XCCDF rules. If a rule has multiple checks, the checks
for the preffered check engine will be used. Allowed values: `SCE`,
`OVAL`. If this variable is set to `SCE` and a rule has both SCE and
OVAL checks the SCE check will be used. If this variable is set to
`OVAL` and a rule has both SCE and OVAL checks the OVAL check will be
used. If this environment variable isn't set, the standard XCCDF
mechanism will be used for check selection.

This will allow us to explicitely prefer SCE checks when executing
`oscap` in Containerfile in the `podman build` process when building
hardened bootc images.

Also a small test is added to test this feature.
This will allow us in future to extend the code to support remediations
for systems where a different package manager than "dnf" is used.
The `oscap-bootc` tool is a convenience script that makes building
hardened bootable container images easier.  This tool is designed to be
used during the build of the bootable container image.  Include
`oscap-bootc` in your `Containerfile` that will be used to build your
bootable container image.
Addressing:
*** ERROR: ambiguous python shebang in /usr/bin/oscap-bootc: #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
Starting with this commit, the OSCAP_BOOTC_BUILD environment variable
will be passed down to the bash remediation. If this environment
variable is set in the caller environment, the Bash remediations will be
able to access it and read its value. This will be useful because the
bash remediations will be able to contain a condition depending on this
variable. Using this feature we can influence the behavior of our Bash
remediations in the process of building bootable container images. The
`oscap-bootc` utility will export the `OSCAP_BOOTC_BUILD` environment
variable and the Bash remeditions will check this variable and for
example they will not start systemd services.

This commit also adds a small test.
Pass OSCAP_BOOTC_BUILD to remediations
Some SCE checks which are used instead of OVAL checks
when building a bootable container require additional
packages. This commit introduces `install_sce_dependencies`
function in `oscap-bootc` script which will handle their
installation.
Extend oscap-bootc to install SCE dependencies
@matusmarhefka matusmarhefka self-assigned this Nov 12, 2024
@matusmarhefka matusmarhefka added this to the 1.4.1 milestone Nov 13, 2024
@matusmarhefka matusmarhefka merged commit b8d36be into OpenSCAP:main Nov 13, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants