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

vlock_installed: apply only to platform machine #10307

Merged

Conversation

candrews
Copy link
Contributor

@candrews candrews commented Mar 8, 2023

Description:

vlock_installed: apply only to platform machine

Rationale:

The 'Check that vlock is installed to allow session locking' rule should not apply to containers.

Review Hints:

With this change applied, oscap-podman ubuntu:20.04 xccdf eval --report report.html --profile xccdf_org.ssgproject.content_profile_stig /usr/share/xml/scap/ssg/content/ssg-ubuntu2004-ds.xml should yield a report indicating that the "Check that vlock is installed to allow session locking" rule is "Not Applicable"

The 'Check that vlock is installed to allow session locking' rule should not apply to containers.

Signed-off-by: Craig Andrews <candrews@integralblue.com>
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Mar 8, 2023
@openshift-ci
Copy link

openshift-ci bot commented Mar 8, 2023

Hi @candrews. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions 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/test-infra repository.

@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label Mar 8, 2023
@github-actions
Copy link

github-actions bot commented Mar 8, 2023

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

ol8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@github-actions
Copy link

github-actions bot commented Mar 8, 2023

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
bash remediation for rule 'xccdf_org.ssgproject.content_rule_vlock_installed' differs.
--- xccdf_org.ssgproject.content_rule_vlock_installed
+++ xccdf_org.ssgproject.content_rule_vlock_installed
@@ -1,4 +1,10 @@
+# Remediation is applicable only in certain platforms
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
 
 if ! rpm -q --quiet "kbd" ; then
 yum install -y "kbd"
 fi
+
+else
+ >&2 echo 'Remediation is not applicable, nothing was done'
+fi

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_vlock_installed' differs.
--- xccdf_org.ssgproject.content_rule_vlock_installed
+++ xccdf_org.ssgproject.content_rule_vlock_installed
@@ -2,6 +2,7 @@
 package:
 name: kbd
 state: present
+ when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
 tags:
 - DISA-STIG-OL08-00-020043
 - enable_strategy

Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_vlock_installed'
--- xccdf_org.ssgproject.content_rule_vlock_installed
+++ xccdf_org.ssgproject.content_rule_vlock_installed
@@ -1 +1 @@
-
+cpe:/a:machine

@jan-cerny jan-cerny self-assigned this Mar 10, 2023
@jan-cerny jan-cerny added this to the 0.1.67 milestone Mar 10, 2023
@codeclimate
Copy link

codeclimate bot commented Mar 10, 2023

Code Climate has analyzed commit 6f25143 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 51.7% (0.0% change).

View more on Code Climate.

Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Automatus's bot CI job fail is expected because the rule vlock_installed ins't a part of RHEL 8 and RHEL 9 benchmarks (prodtype: ol8,sle12,sle15,ubuntu2004).

@jan-cerny jan-cerny merged commit d037ac2 into ComplianceAsCode:master Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants