Skip to content

File ownership var log audit improvement - #15240

Open
teacup-on-rockingchair wants to merge 3 commits into
ComplianceAsCode:masterfrom
teacup-on-rockingchair:file_ownership_var_log_audit
Open

teacup-on-rockingchair wants to merge 3 commits into
ComplianceAsCode:masterfrom
teacup-on-rockingchair:file_ownership_var_log_audit

Conversation

@teacup-on-rockingchair

Copy link
Copy Markdown
Contributor

Description:

  • Fix file_ownership_var_log_audit rule check when custom log_group is set in /etc/audit/auditd.conf

Rationale:

  • file_ownership_var_log_audit: fix rule when custom log_group is set in /etc/audit/auditd.conf
    • if log_group is not set or set to root: check all files/dirs under /var/log/audit are user_id/group_id 0/0
    • if log_group is set, get GID of configured group and check all files/dirs under /var/log/audit are user_id/group_id 0/GID
  • extended tests for both cases: root/root and root/audit user/group and DIR/Filename tests

@teacup-on-rockingchair teacup-on-rockingchair added this to the 0.1.83 milestone Oct 23, 2026
@teacup-on-rockingchair teacup-on-rockingchair added Test Suite Update in Test Suite. OVAL OVAL update. Related to the systems assessments. labels Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
OVAL for rule 'xccdf_org.ssgproject.content_rule_file_ownership_var_log_audit' differs.
--- oval:ssg-file_ownership_var_log_audit:def:1
+++ oval:ssg-file_ownership_var_log_audit:def:1
@@ -1,5 +1,6 @@
 criteria OR
 criteria AND
+extend_definition oval:ssg-auditd_conf_log_group_not_root:def:1
 criterion oval:ssg-test_ownership_var_log_audit_files:tst:1
 criterion oval:ssg-test_ownership_var_log_audit_directories:tst:1
 criteria AND

@Mab879 Mab879 self-assigned this Oct 23, 2026

@Mab879 Mab879 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

On RHEL 9.6 I noticed this issue.

Setting console output to log level INFO
INFO - The base image option has not been specified, choosing libvirt-based test environment.
INFO - Logging into /home/mburket/Developer/github.com/ComplianceAsCode/content/tests/logs/rule-custom-2026-10-23-1440/test_suite.log
INFO - xccdf_org.ssgproject.content_rule_file_ownership_var_log_audit
INFO - Script wrong_value.fail.sh using profile (all) OK
INFO - Script correct_value.pass.sh using profile (all) OK
INFO - Script correct_value_log_group.pass.sh using profile (all) OK
INFO - Script wrong_value_dir.fail.sh using profile (all) OK
INFO - Script wrong_value_log_group.fail.sh using profile (all) OK
ERROR - Rule evaluation resulted in error, instead of expected fixed during remediation stage 
ERROR - The remediation failed for rule 'xccdf_org.ssgproject.content_rule_file_ownership_var_log_audit'.
INFO - Script wrong_value_log_group_dir.fail.sh using profile (all) OK
ERROR - Rule evaluation resulted in error, instead of expected fixed during remediation stage 
ERROR - The remediation failed for rule 'xccdf_org.ssgproject.content_rule_file_ownership_var_log_audit'.

@teacup-on-rockingchair

Copy link
Copy Markdown
Contributor Author

_file_ownership_var_log_audit

On RHEL 9.6 I noticed this issue.

Setting console output to log level INFO
INFO - The base image option has not been specified, choosing libvirt-based test environment.
INFO - Logging into /home/mburket/Developer/github.com/ComplianceAsCode/content/tests/logs/rule-custom-2026-10-23-1440/test_suite.log
INFO - xccdf_org.ssgproject.content_rule_file_ownership_var_log_audit
INFO - Script wrong_value.fail.sh using profile (all) OK
INFO - Script correct_value.pass.sh using profile (all) OK
INFO - Script correct_value_log_group.pass.sh using profile (all) OK
INFO - Script wrong_value_dir.fail.sh using profile (all) OK
INFO - Script wrong_value_log_group.fail.sh using profile (all) OK
ERROR - Rule evaluation resulted in error, instead of expected fixed during remediation stage 
ERROR - The remediation failed for rule 'xccdf_org.ssgproject.content_rule_file_ownership_var_log_audit'.
INFO - Script wrong_value_log_group_dir.fail.sh using profile (all) OK
ERROR - Rule evaluation resulted in error, instead of expected fixed during remediation stage 
ERROR - The remediation failed for rule 'xccdf_org.ssgproject.content_rule_file_ownership_var_log_audit'.

I've got this on rhel9:

./automatus.py rule --datastream ../build/ssg-rhel9-ds.xml --logdir /tmp/logs_podman_tests --debug  file_ownership_var_log_audit --profile default --container ssg_test_suite_rhel9:latest
Setting console output to log level INFO
INFO - The base image option has been specified, choosing Podman-based test environment.
INFO - Logging into /tmp/logs_podman_tests-6/test_suite.log
WARNING - Script 'correct_value.pass.sh' is not applicable on 'rhel9' target because the package(s) 'audit' it requires are unavailable there
WARNING - Script 'wrong_value.fail.sh' is not applicable on 'rhel9' target because the package(s) 'audit' it requires are unavailable there
INFO - xccdf_org.ssgproject.content_rule_file_ownership_var_log_audit
WARNING - Nothing has been tested!

Could it be that you tested before the c2c978c patch ?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OVAL OVAL update. Related to the systems assessments. Test Suite Update in Test Suite.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants