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

Fix file_permissions_etc_audit_rulesd in Image Mode #12855

Conversation

jan-cerny
Copy link
Collaborator

The rule file_permissions_etc_audit_rulesd fails in a scan executed after VM deployment of a CentOS Stream 9 bootable container image hardened with the STIG profile. The rule requires that all files in the /etc/audit/rules.d/*.rules directory need to have mode 0600. However, the scan report shows 2 files with mode 0640. This rule passed during the build of the bootable container image. Therefore, the offending files were created after the rule is evaluated. These files are created by a remediation of a different rule
audit_rules_kernel_module_loading_delete. We can fix the problem by setting the expected mode at the time of creating these files. The file mode set by bash_fix_audit_syscall_rule was inconsistent: on line 1768 we set it to 0600, but in this case we just removed permissions of the others. With this fix the file mode value in the macro will be consistently set to 0600.

The rule file_permissions_etc_audit_rulesd fails in a scan executed
after VM deployment of a CentOS Stream 9 bootable container image
hardened with the STIG profile. The rule requires that all files in the
`/etc/audit/rules.d/*.rules` directory need to have mode 0600.  However,
the scan report shows 2 files with mode 0640. This rule passed during
the build of the bootable container image. Therefore, the offending
files were created after the rule is evaluated.  These files are created
by a remediation of a different rule
`audit_rules_kernel_module_loading_delete`.  We can fix the problem by
setting the expected mode at the time of creating these files.  The file
mode set by `bash_fix_audit_syscall_rule` was inconsistent: on line 1768
we set it to 0600, but in this case we just removed permissions of the
others. With this fix the file mode value in the macro will be
consistently set to 0600.
@jan-cerny jan-cerny added Bash Bash remediation update. Image Mode Bootable containers and Image Mode RHEL labels Jan 20, 2025
@jan-cerny jan-cerny added this to the 0.1.76 milestone Jan 20, 2025
Copy link

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

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

codeclimate bot commented Jan 20, 2025

Code Climate has analyzed commit 5e183ab 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 61.9% (0.0% change).

View more on Code Climate.

@matusmarhefka matusmarhefka self-assigned this Jan 20, 2025
@matusmarhefka matusmarhefka merged commit b813196 into ComplianceAsCode:master Jan 20, 2025
108 of 109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bash Bash remediation update. Image Mode Bootable containers and Image Mode RHEL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants