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

Modified 'ensure_rsyslog_log_file_conf' OVAL to allow user/groupnames #11226

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

mpurg
Copy link
Contributor

@mpurg mpurg commented Oct 26, 2023

Description:

The proposed modification checks if the provided owner and groupowner values are numbers (== UID/GID), and if not, it first extracts UID/GID information from /etc/passwd and /etc/group (or /usr/lib/ in case of CoreOS) based on the provided username/groupname values.

Rationale:

Currently, only UID/GIDs were supported in the template, which fails with Ubuntu 22.04 server.
This is because the server and desktop installations have different UIDs for syslog user (104/107), but have the same identifier in CaC.

Currently, only UID/GIDs were supported in the template, which fails with
Ubuntu 22.04 server.
This is because the server and desktop installations have
different UIDs for syslog user (104/107), but have the same identifier
in CaC.

The proposed modification checks if the provided `owner` and `groupowner` values
are numbers (== UID/GID), and if not, it first extracts UID/GID information from /etc/passwd and
/etc/group (or /usr/lib/ in case of CoreOS) based on the provided username/groupname values.
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Oct 26, 2023
@openshift-ci
Copy link

openshift-ci bot commented Oct 26, 2023

Hi @mpurg. 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.

@github-actions
Copy link

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

rhel8 (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

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_rsyslog_files_groupownership' differs.
--- xccdf_org.ssgproject.content_rule_rsyslog_files_groupownership
+++ xccdf_org.ssgproject.content_rule_rsyslog_files_groupownership
@@ -94,7 +94,7 @@
 	then
 		continue
 	fi
-	$FILE_CMD "0" "$LOG_FILE_PATH"
+	$FILE_CMD "root" "$LOG_FILE_PATH"
 done
 
 else

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_rsyslog_files_groupownership' differs.
--- xccdf_org.ssgproject.content_rule_rsyslog_files_groupownership
+++ xccdf_org.ssgproject.content_rule_rsyslog_files_groupownership
@@ -183,7 +183,7 @@
 - name: Ensure Log Files Are Owned By Appropriate Group -Setup log files attribute
   ansible.builtin.file:
     path: '{{ item }}'
-    group: '0'
+    group: root
     state: file
   loop: '{{ log_files | list | flatten | unique }}'
   failed_when: false

bash remediation for rule 'xccdf_org.ssgproject.content_rule_rsyslog_files_ownership' differs.
--- xccdf_org.ssgproject.content_rule_rsyslog_files_ownership
+++ xccdf_org.ssgproject.content_rule_rsyslog_files_ownership
@@ -94,7 +94,7 @@
 	then
 		continue
 	fi
-	$FILE_CMD "0" "$LOG_FILE_PATH"
+	$FILE_CMD "root" "$LOG_FILE_PATH"
 done
 
 else

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_rsyslog_files_ownership' differs.
--- xccdf_org.ssgproject.content_rule_rsyslog_files_ownership
+++ xccdf_org.ssgproject.content_rule_rsyslog_files_ownership
@@ -183,7 +183,7 @@
 - name: Ensure Log Files Are Owned By Appropriate User -Setup log files attribute
   ansible.builtin.file:
     path: '{{ item }}'
-    owner: '0'
+    owner: root
     state: file
   loop: '{{ log_files | list | flatten | unique }}'
   failed_when: false

@codeclimate
Copy link

codeclimate bot commented Oct 26, 2023

Code Climate has analyzed commit 184d5f0 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 58.4%.

View more on Code Climate.

@dodys dodys requested a review from a team October 26, 2023 15:10
@dodys dodys added Ubuntu Ubuntu product related. ok-to-test Used by openshift-ci bot. and removed needs-ok-to-test Used by openshift-ci bot. labels Oct 26, 2023
Copy link
Contributor

@dodys dodys left a comment

Choose a reason for hiding this comment

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

great work!

@dodys dodys merged commit db8e2e3 into ComplianceAsCode:master Oct 26, 2023
37 of 38 checks passed
@Mab879 Mab879 added this to the 0.1.71 milestone Oct 26, 2023
@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Used by openshift-ci bot. Ubuntu Ubuntu product related. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UID Owner mismatch for logfiles
3 participants