Skip to content

CNF-22621: RAN Hardening (4.23) - Audit SELinux (M4)#675

Open
sebrandon1 wants to merge 1 commit intoopenshift-kni:mainfrom
sebrandon1:compliance/4.22/m4-audit-selinux
Open

CNF-22621: RAN Hardening (4.23) - Audit SELinux (M4)#675
sebrandon1 wants to merge 1 commit intoopenshift-kni:mainfrom
sebrandon1:compliance/4.22/m4-audit-selinux

Conversation

@sebrandon1
Copy link
Copy Markdown
Contributor

Summary

  • MEDIUM severity SELinux audit rules (6 rules) for chcon, restorecon, semanage, setfiles, setsebool, seunshare
  • Verified on OCP 4.22 (cnfdt16) — all 6 rules active via auditctl -l

Remediation Group

Jira

Test plan

  • Applied MachineConfig to OCP 4.22 cluster
  • Verified all 6 SELinux audit rules active via auditctl -l
  • MCP rollout completed without errors

@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

openshift-ci-robot commented Mar 24, 2026

@sebrandon1: This pull request references CNF-22621 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

  • MEDIUM severity SELinux audit rules (6 rules) for chcon, restorecon, semanage, setfiles, setsebool, seunshare
  • Verified on OCP 4.22 (cnfdt16) — all 6 rules active via auditctl -l

Remediation Group

Jira

Test plan

  • Applied MachineConfig to OCP 4.22 cluster
  • Verified all 6 SELinux audit rules active via auditctl -l
  • MCP rollout completed without errors

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested a review from cgoncalves March 24, 2026 20:35
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 24, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebrandon1
Once this PR has been reviewed and has the lgtm label, please assign irinamihai for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot requested a review from yanirq March 24, 2026 20:35
@sebrandon1 sebrandon1 force-pushed the compliance/4.22/m4-audit-selinux branch 2 times, most recently from 3aa2fb9 to da5bc6f Compare March 25, 2026 20:30
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

Two new OpenShift MachineConfig resources are added to configure SELinux audit logging on cluster nodes. The configurations write audit rules targeting SELinux-related commands (chcon, restorecon, semanage, setfiles, setsebool, seunshare) with privilege filtering, deployed separately for master and worker node roles.

Changes

Cohort / File(s) Summary
SELinux Audit Configuration
telco-ran/configuration/machineconfigs/audit/75-audit-selinux-master.yaml, telco-ran/configuration/machineconfigs/audit/75-audit-selinux-worker.yaml
New MachineConfig resources that deploy identical SELinux audit rules to master and worker nodes via Ignition v3.5.0, filtering on auid>=1000 (excluding auid=unset) with key=privileged tagging.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding SELinux audit rules (M4) for RAN hardening in version 4.23, matching the changeset's two new MachineConfig resources.
Description check ✅ Passed The description is directly related to the changeset, detailing the six SELinux audit rules being added, verification on OCP 4.22, and test plan completion.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sebrandon1 sebrandon1 force-pushed the compliance/4.22/m4-audit-selinux branch from da5bc6f to 0475bb6 Compare March 26, 2026 20:21
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
telco-ran/configuration/machineconfigs/audit/75-audit-selinux-master.yaml (1)

23-23: ⚠️ Potential issue | 🟡 Minor

Same stale versioned documentation reference as worker manifest.

This file has the same .../versions/4.21/... link in the embedded payload; please align it with the target hardening release context exactly as in the worker manifest update.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telco-ran/configuration/machineconfigs/audit/75-audit-selinux-master.yaml` at
line 23, The embedded documentation URL in the data:text/plain payload (the
source field) still points to
".../compliance-scripts/versions/4.21/groups/M4.html"; update that URL in the
source string to the correct target hardening release version (the same version
used in the worker manifest update) so the documentation link inside the source
payload matches the intended release.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@telco-ran/configuration/machineconfigs/audit/75-audit-selinux-worker.yaml`:
- Line 23: The embedded documentation URL in the YAML "source" field currently
points to "/versions/4.21/groups/M4.html"; update that URL to the appropriate
release (e.g., replace "4.21" with "4.22" or "4.23") or switch to a stable
non-versioned reference, ensuring the change is made inside the data:text/plain
payload string where the URL appears so the comment header now references the
correct release context.

---

Duplicate comments:
In `@telco-ran/configuration/machineconfigs/audit/75-audit-selinux-master.yaml`:
- Line 23: The embedded documentation URL in the data:text/plain payload (the
source field) still points to
".../compliance-scripts/versions/4.21/groups/M4.html"; update that URL in the
source string to the correct target hardening release version (the same version
used in the worker manifest update) so the documentation link inside the source
payload matches the intended release.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 508fdb56-d826-44fb-8715-b7895e1977b3

📥 Commits

Reviewing files that changed from the base of the PR and between d65ce23 and 0475bb6.

📒 Files selected for processing (2)
  • telco-ran/configuration/machineconfigs/audit/75-audit-selinux-master.yaml
  • telco-ran/configuration/machineconfigs/audit/75-audit-selinux-worker.yaml

# -a always,exit -F path=/usr/sbin/setfiles -F auid>=1000 -F auid!=unset -F key=privileged
# -a always,exit -F path=/usr/sbin/setsebool -F auid>=1000 -F auid!=unset -F key=privileged
# -a always,exit -F path=/usr/sbin/seunshare -F auid>=1000 -F auid!=unset -F key=privileged
source: data:text/plain,%23%20M4%3A%20Audit%20SELinux%20Commands%20%28E8%20Compliance%29%0A%23%20Documentation%3A%20https%3A%2F%2Fsebrandon1.github.io%2Fcompliance-scripts%2Fversions%2F4.21%2Fgroups%2FM4.html%0A%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fchcon%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dprivileged%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Frestorecon%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dprivileged%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fsemanage%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dprivileged%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fsetfiles%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dprivileged%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fsetsebool%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dprivileged%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fseunshare%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dprivileged%0A
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update the embedded documentation URL to the current release context.

The payload still points to .../versions/4.21/..., while this PR is for 4.22/4.23 hardening. Keeping an older versioned compliance link can create audit traceability confusion during evidence reviews. Please switch to the correct version (or a stable non-versioned reference).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telco-ran/configuration/machineconfigs/audit/75-audit-selinux-worker.yaml` at
line 23, The embedded documentation URL in the YAML "source" field currently
points to "/versions/4.21/groups/M4.html"; update that URL to the appropriate
release (e.g., replace "4.21" with "4.22" or "4.23") or switch to a stable
non-versioned reference, ensuring the change is made inside the data:text/plain
payload string where the URL appears so the comment header now references the
correct release context.

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.

2 participants