Skip to content

Prevent file_ownership/groupownership_home_directories from chowning / - #14962

Merged
Mab879 merged 1 commit into
ComplianceAsCode:masterfrom
ggbecker:prod-issue
Aug 7, 2026
Merged

Prevent file_ownership/groupownership_home_directories from chowning /#14962
Mab879 merged 1 commit into
ComplianceAsCode:masterfrom
ggbecker:prod-issue

Conversation

@ggbecker

@ggbecker ggbecker commented Aug 4, 2026

Copy link
Copy Markdown
Member

Description:

  • Prevent file_ownership_home_directories and file_groupownership_home_directories from chowning /
    • A user whose /etc/passwd home-directory field is "/" (e.g. a systemd DynamicUser service account like chrony-wait, which uses "/" as a placeholder home and a nologin shell) falls inside the interactive UID range, causing these rules' remediation to chown/chgrp the root filesystem to that account. The OVAL check already excludes nologin/false-shell accounts and never flags this, so the corruption only shows up via other rules (e.g. rpm_verify_ownership) after an ansible-based remediation run. Add the same "home dir != /" guard already present in the sibling accounts_users_home_files_ownership/accounts_users_home_files_groupownership rules to both rules, for example.

Rationale:

Review Hints

Since we are talking about a very specific architecture here, the best way to test this pull request is to run contest on EL 10 on either emulated ppc64le or online available systems and run the BSI profile verification with the ansible remediation aka /hardening/host-os/ansible/bsi

In my tests, the waiver started waiving a pass test as observed by the comment below.

@ggbecker ggbecker added this to the 0.1.82 milestone Aug 4, 2026
@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown

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

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

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_file_groupownership_home_directories' differs.
--- xccdf_org.ssgproject.content_rule_file_groupownership_home_directories
+++ xccdf_org.ssgproject.content_rule_file_groupownership_home_directories
@@ -1,2 +1,2 @@
 
-awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6) }' /etc/passwd
+awk -F':' '{ if ($3 >= 1000 && $3 != 65534 && $6 != "/") system("chgrp -f " $4" "$6) }' /etc/passwd

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_file_groupownership_home_directories' differs.
--- xccdf_org.ssgproject.content_rule_file_groupownership_home_directories
+++ xccdf_org.ssgproject.content_rule_file_groupownership_home_directories
@@ -30,6 +30,7 @@
   when:
   - item.value[1]|int >= 1000
   - item.value[1]|int != 65534
+  - item.value[4] != "/"
   tags:
   - file_groupownership_home_directories
   - low_complexity

bash remediation for rule 'xccdf_org.ssgproject.content_rule_file_ownership_home_directories' differs.
--- xccdf_org.ssgproject.content_rule_file_ownership_home_directories
+++ xccdf_org.ssgproject.content_rule_file_ownership_home_directories
@@ -1,2 +1,2 @@
 
-awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6) }' /etc/passwd
+awk -F':' '{ if ($3 >= 1000 && $3 != 65534 && $6 != "/") system("chown -f " $3" "$6) }' /etc/passwd

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_file_ownership_home_directories' differs.
--- xccdf_org.ssgproject.content_rule_file_ownership_home_directories
+++ xccdf_org.ssgproject.content_rule_file_ownership_home_directories
@@ -30,6 +30,7 @@
   when:
   - item.value[1]|int >= 1000
   - item.value[1]|int != 65534
+  - item.value[4] != "/"
   tags:
   - file_ownership_home_directories
   - low_complexity

@ggbecker
ggbecker force-pushed the prod-issue branch 2 times, most recently from 9ad4adb to 4536024 Compare August 4, 2026 19:18
@ggbecker ggbecker changed the title Fix regex in rpm_verify_ownership ansible remediation Prevent file_ownership/groupownership_home_directories from chowning / Aug 4, 2026
@ComplianceAsCode ComplianceAsCode deleted a comment from github-actions Bot Aug 4, 2026
@Mab879 Mab879 self-assigned this Aug 4, 2026
@ggbecker
ggbecker marked this pull request as ready for review August 4, 2026 22:49
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Aug 4, 2026
@ggbecker

ggbecker commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Test results: 10.2@ppc64le pass /hardening/host-os/ansible/bsi rpm_verify_ownership waived pass

A user whose /etc/passwd home-directory field is "/" (e.g. a systemd
DynamicUser service account like chrony-wait, which uses "/" as a
placeholder home and a nologin shell) falls inside the interactive
UID range, causing these rules' remediation to chown/chgrp the root
filesystem to that account. The OVAL check already excludes
nologin/false-shell accounts and never flags this, so the corruption
only shows up via other rules (e.g. rpm_verify_ownership) after an
ansible-based remediation run.

Add the same "home dir != /" guard already present in the sibling
accounts_users_home_files_ownership/accounts_users_home_files_groupownership
rules to both file_ownership_home_directories and
file_groupownership_home_directories.
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown

@ggbecker: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-openshift-node-compliance b7897d1 link false /test e2e-aws-openshift-node-compliance

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

@Mab879
Mab879 merged commit d6396a9 into ComplianceAsCode:master Aug 7, 2026
70 of 73 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.

Rule rpm_verify_ownership fails in BSI profile on ppc64le architecture

2 participants