Skip to content

CMP-4323: Exclude runtime lock files from file_permissions_cni_conf#14755

Open
Vincent056 wants to merge 1 commit into
ComplianceAsCode:masterfrom
Vincent056:CMP-4323-cni-conf-exclude-lock
Open

CMP-4323: Exclude runtime lock files from file_permissions_cni_conf#14755
Vincent056 wants to merge 1 commit into
ComplianceAsCode:masterfrom
Vincent056:CMP-4323-cni-conf-exclude-lock

Conversation

@Vincent056
Copy link
Copy Markdown
Contributor

Description:

The file_permissions_cni_conf rules (and the _not_s390x / _s390x variants) matched every file under /etc/cni/net.d/ using the regex ^/etc/cni/net.d/.*$ and required mode 0600. The directory can also contain cni.lock — a zero-byte flock sentinel created by CRI-O/podman with mode 0644. The actual CNI configuration files (e.g. 100-crio-bridge.conflist, 200-loopback.conflist) are already 0600 and compliant, but cni.lock caused the rule to report FAIL.

This narrows the regex to only match CNI configuration files (.conf, .conflist, .json) so the runtime lock file is no longer checked:

filepath: ^/etc/cni/net.d/.*$   ->   ^/etc/cni/net.d/.*\.(conf|conflist|json)$

Rationale:

cni.lock is a runtime lock file, not a network configuration file, and its 0644 mode is set by the container runtime — it is not something the cluster admin can or should remediate. Checking it produces a false FAIL on otherwise-compliant clusters. Restricting the check to actual CNI config-file extensions keeps the rule meaningful (the real configuration files are still verified) while ignoring the lock sentinel.

Reported via Red Hat Jira CMP-4323.

Review Hints:

  • The EXCLUDED_FILES mechanism in the file_permissions template only applies to the directory-matching (is_directory) branch, not the filepath_is_regex branch this rule uses, so narrowing the regex is the appropriate fix here.
  • Verified by building the ocp4 product: the generated OVAL now emits <unix:filepath operation="pattern match">^/etc/cni/net.d/.*\.(conf|conflist|json)$</unix:filepath>. With check_existence="none_exist", cni.lock is no longer collected while the .conflist files continue to be checked.
  • The sibling file_owner_cni_conf / file_groupowner_cni_conf rules use the same regex but are not affected (the lock file is root:root), so they are intentionally left out of this change.

The file_permissions_cni_conf rules matched every file under
/etc/cni/net.d/ with the regex ^/etc/cni/net.d/.*$ and required mode
0600. The directory can also contain cni.lock, a zero-byte flock
sentinel created by CRI-O/podman with mode 0644. The actual CNI
configuration files (e.g. 100-crio-bridge.conflist,
200-loopback.conflist) are already 0600 and compliant, but cni.lock
caused the rule to FAIL.

Narrow the regex to only match CNI configuration files
(.conf, .conflist, .json) so the runtime lock file is no longer
checked. This avoids false FAILs while still verifying the permissions
of the actual network configuration files.

CMP-4323
@Vincent056 Vincent056 changed the title OCP4: Exclude runtime lock files from file_permissions_cni_conf CMP-4323: Exclude runtime lock files from file_permissions_cni_conf Jun 2, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 2, 2026

@Vincent056: 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-platform-compliance 9dc5d3a link true /test e2e-aws-openshift-platform-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.

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.

1 participant