Skip to content

Add audit monitoring for SELinux policy changes in /var/lib/selinux#14367

Merged
jan-cerny merged 6 commits intoComplianceAsCode:masterfrom
Arden97:auditd_var_lib_selinux
Feb 12, 2026
Merged

Add audit monitoring for SELinux policy changes in /var/lib/selinux#14367
jan-cerny merged 6 commits intoComplianceAsCode:masterfrom
Arden97:auditd_var_lib_selinux

Conversation

@Arden97
Copy link
Contributor

@Arden97 Arden97 commented Feb 6, 2026

Description:

  • This PR expands CIS requirements to cover custom selinux policies
  • Created new rule audit_rules_mac_modification_var_lib_selinux to monitor /var/lib/selinux/ directory
  • Integrated the rule into CIS benchmarks for Fedora
  • Extended OVAL checks to properly support Fedora alongside RHEL 10 and OL 10
  • Added new setup_augenrules_environment() macro to configure test environments for augenrules
  • Updated all audit_rules_watch template tests to use the new environment setup macro

Rationale:

  • Fixes OPENSCAP-4183
  • The CIS policy does not mention the /var/lib/selinux
  • However, as was discussed in the linked issue, monitoring the active policy store is also important to ensure kernel policy integrity

Review Hints:

  • use automatus to verify, that new rule functions correctly on mentioned systems

@openshift-ci
Copy link

openshift-ci bot commented Feb 6, 2026

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 Feb 6, 2026
@Arden97 Arden97 added this to the 0.1.80 milestone Feb 6, 2026
@Arden97
Copy link
Contributor Author

Arden97 commented Feb 8, 2026

/packit retest-failed

@Arden97
Copy link
Contributor Author

Arden97 commented Feb 9, 2026

/packit build

@Arden97 Arden97 force-pushed the auditd_var_lib_selinux branch from 88f190a to 313aae3 Compare February 10, 2026 08:25
@Arden97 Arden97 added New Rule Issues or pull requests related to new Rules. CIS CIS Benchmark related. labels Feb 10, 2026
@Arden97 Arden97 marked this pull request as ready for review February 10, 2026 09:29
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Feb 10, 2026
@Arden97
Copy link
Contributor Author

Arden97 commented Feb 10, 2026

/packit retest-failed

@jan-cerny jan-cerny self-assigned this Feb 10, 2026
Comment on lines +25 to +35
cis@sle12: 4.1.6
cis@sle15: 4.1.6
cobit5: APO10.01,APO10.03,APO10.04,APO10.05,APO11.04,APO12.06,APO13.01,BAI03.05,BAI08.02,DSS01.03,DSS01.04,DSS02.02,DSS02.04,DSS02.07,DSS03.01,DSS03.05,DSS05.02,DSS05.03,DSS05.04,DSS05.05,DSS05.07,MEA01.01,MEA01.02,MEA01.03,MEA01.04,MEA01.05,MEA02.01
cui: 3.1.8
hipaa: 164.308(a)(1)(ii)(D),164.308(a)(3)(ii)(A),164.308(a)(5)(ii)(C),164.312(a)(2)(i),164.312(b),164.312(d),164.312(e)
isa-62443-2009: 4.2.3.10,4.3.2.6.7,4.3.3.3.9,4.3.3.5.8,4.3.3.6.6,4.3.4.4.7,4.3.4.5.6,4.3.4.5.7,4.3.4.5.8,4.4.2.1,4.4.2.2,4.4.2.4
isa-62443-2013: 'SR 1.13,SR 2.10,SR 2.11,SR 2.12,SR 2.6,SR 2.8,SR 2.9,SR 3.1,SR 3.5,SR 3.8,SR 4.1,SR 4.3,SR 5.1,SR 5.2,SR 5.3,SR 6.1,SR 6.2,SR 7.1,SR 7.6'
iso27001-2013: A.11.2.6,A.12.4.1,A.12.4.2,A.12.4.3,A.12.4.4,A.12.7.1,A.13.1.1,A.13.2.1,A.14.1.3,A.14.2.7,A.15.2.1,A.15.2.2,A.16.1.4,A.16.1.5,A.16.1.7,A.6.2.1,A.6.2.2
nist: AU-2(d),AU-12(c),CM-6(a)
nist-csf: DE.AE-3,DE.AE-5,DE.CM-1,DE.CM-3,DE.CM-7,ID.SC-4,PR.AC-3,PR.PT-1,PR.PT-4,RS.AN-1,RS.AN-4
pcidss: Req-10.5.5
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure about all these references? Have you verified they're correct? If not, you can remove them. They can be added later when a need arise.

- audit_rules_immutable
- audit_rules_mac_modification
- audit_rules_mac_modification_usr_share
- audit_rules_mac_modification_var_lib_selinux
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you add the new rule to HIPAA? Isn't it out of scope of for now?

Adding the rule to HIPAA means that you add the rule to SUSE product profiles. It also caused the need for adding CCEs for SUSE products. Both actions need to be consulted with SUSE maintainers.

Please consider reducing the scope of the PR, I think you can add the rule only to RHEL CIS profiles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d51d00e. I've limited the new rule only to Fedora product for now

# packages = audit

if [[ "$style" == "modern" ]] ; then
sed -i "/$filter_type=$(echo "$path" | sed 's/\//\\\//g')/d" /etc/audit/audit.rules
Copy link
Collaborator

Choose a reason for hiding this comment

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

This "sed inside sed" might be confusing for some people, I believe it would be more readable if the "escaped path" is extracted to a separate variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 805f03f

title: 'Record Events that Modify the System''s Mandatory Access Controls in /var/lib/selinux'

description: |-
{{{ describe_audit_rules_watch("/var/lib/selinux/", "MAC-policy") }}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the description should mention the large log volume that it might create.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in aa1a58a

@Arden97 Arden97 force-pushed the auditd_var_lib_selinux branch from 313aae3 to 65b278f Compare February 10, 2026 17:36
@openshift-ci
Copy link

openshift-ci bot commented Feb 11, 2026

@Arden97: 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 805f03f link true /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.

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 test scenarios pass for me. I think that it's fine to include this to our Fedora CIS profile because it can be used as a test profile for assessing the option of adding this rule in future RHEL benchmarks in future.

@jan-cerny jan-cerny merged commit 7232017 into ComplianceAsCode:master Feb 12, 2026
141 of 143 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CIS CIS Benchmark related. New Rule Issues or pull requests related to new Rules.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants