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 Audit related rules in RHEL 10 #12359

Merged
merged 21 commits into from
Sep 10, 2024

Conversation

vojtapolasek
Copy link
Collaborator

@vojtapolasek vojtapolasek commented Sep 3, 2024

Description:

  • modify OVAL checks which decide if we use augenrules or auditctl to load rules. Point them to the new file audit-rules.service in case we are on rhel10 product
  • modify test scenarios of all templates where this scenario occurs
  • modify test scenarios of all rules which are in rhel10 product

Rationale:

In RHEL 10, there is a special Systemd service file which loads rules.
Previously, this was done through ExecStartPost directive in auditd.service.
In RHEL 10, there is a new file audit-rules.service which achieves the same but through ExecStart directive.

Review Hints:

  1. review CI results
  2. CI might not be able to test all rules so in case of failures, please retest locally through Automatus.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Sep 3, 2024
Copy link

openshift-ci bot commented Sep 3, 2024

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

Copy link

github-actions bot commented Sep 3, 2024

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

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

github-actions bot commented Sep 3, 2024

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:12359
This image was built from commit: daeb8e7

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:12359

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:12359 make deploy-local

@vojtapolasek vojtapolasek changed the title WIP: fix Audit related rules in RHEL 10 Fix Audit related rules in RHEL 10 Sep 4, 2024
@vojtapolasek vojtapolasek marked this pull request as ready for review September 4, 2024 09:33
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Sep 4, 2024
@vojtapolasek vojtapolasek added OVAL OVAL update. Related to the systems assessments. Update Rule Issues or pull requests related to Rules updates. RHEL10 Red Hat Enterprise Linux 10 product related. Update Template Issues or pull requests related to Templates updates. labels Sep 4, 2024
@vojtapolasek vojtapolasek added this to the 0.1.75 milestone Sep 4, 2024
Copy link
Member

@ggbecker ggbecker left a comment

Choose a reason for hiding this comment

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

There might be more places where a change is needed, for example:

and a few occurrences in this file:

appropriate <tt>ExecStartPost</tt> directive setting in the

@vojtapolasek
Copy link
Collaborator Author

vojtapolasek commented Sep 4, 2024

Hello @ggbecker and thank you for noticing this. I made some fixes. However, I am not able to fix the rule audit_rules_suid_auid_privilege_function. I am afraid this will take nontrivial effort. Basically, reloading of auditd service shows us that rules can't be reloaded after remediation. I am stil not entirely sure why, but I would like to tackle this remaining rule and possibly also audit_rules_suid_privilege_function in a separate PR.

Copy link

codeclimate bot commented Sep 4, 2024

Code Climate has analyzed commit daeb8e7 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 59.5% (0.0% change).

View more on Code Climate.

@ggbecker
Copy link
Member

audit_rules_suid_auid_privilege_function

audit_rules_suid_auid_privilege_function doesn't seem to be included in RHEL10 content, so there shouldn't be any major issue with it. Overall it looks good to me. Thanks

@ggbecker ggbecker merged commit d80b25c into ComplianceAsCode:master Sep 10, 2024
98 of 100 checks passed
@vojtapolasek
Copy link
Collaborator Author

@ggbecker actually I see the rule audit_rules_suid_auid_privilege_function in RHEL 10 CIS level 2 profile for both server and workstation.

@ggbecker
Copy link
Member

@ggbecker actually I see the rule audit_rules_suid_auid_privilege_function in RHEL 10 CIS level 2 profile for both server and workstation.

That's true. So please continue with the plan on following up on another pull request.

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. RHEL10 Red Hat Enterprise Linux 10 product related. Update Rule Issues or pull requests related to Rules updates. Update Template Issues or pull requests related to Templates updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants