-
Notifications
You must be signed in to change notification settings - Fork 710
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 auditd rule to watch apparmor instead of selinux on Ubuntu #12790
Fix auditd rule to watch apparmor instead of selinux on Ubuntu #12790
Conversation
Hi @mpurg. Thanks for your PR. I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
This datastream diff is auto generated by the check Click here to see the full diffNew content has different text for rule 'xccdf_org.ssgproject.content_rule_audit_rules_mac_modification'.
--- xccdf_org.ssgproject.content_rule_audit_rules_mac_modification
+++ xccdf_org.ssgproject.content_rule_audit_rules_mac_modification
@@ -7,10 +7,13 @@
augenrules program to read audit rules during daemon startup (the
default), add the following line to a file with suffix .rules in the
directory /etc/audit/rules.d:
+
-w /etc/selinux/ -p wa -k MAC-policy
+
If the auditd daemon is configured to use the auditctl
utility to read audit rules during daemon startup, add the following line to
/etc/audit/audit.rules file:
+
-w /etc/selinux/ -p wa -k MAC-policy
[reference]:
@@ -371,7 +374,7 @@
10.3
[rationale]:
-The system's mandatory access policy (SELinux) should not be
+The system's mandatory access policy (SELinux or Apparmor) should not be
arbitrarily changed by anything other than administrator action. All changes to
MAC policy should be audited.
|
/ok-to-test |
@mpurg thank you for the PR. I reviewed it and I understand its purpose. However, I wonder if this is an optimal way. |
@vojtapolasek thanks for reviewing. I agree that your solution is cleaner. To clarify, the reason I adapted the existing rule was to avoid introducing a breaking change downstream when using customized tailoring files. I.e. if a user disabled this rule using a tailoring file, and the rule was now renamed, the rule would no longer be disabled with the same tailoring file. Additionally, I assumed it was ok to modify the existing rule since the rule id contains |
Hello @mpurg I understand you. However, I think it is not a problem. |
You're right that it does not make sense on Ubuntu, but the rule exists in the Ubuntu CIS profile nevertheless:
Since the rule exists in the profile and contains a reference to the Ubuntu CIS control 4.1.3.14, I believe that the users will by default assume that the rule correctly implements the CIS control, and will not tailor the rule out. Does that make sense? |
@mpurg I am sorry, but I fail to understand the problem.
And then you wrote:
I assume that the rule would be removed from affected Ubuntu profiles and replaced with the new one. Could you please describe the situation in which it would cause problem? |
Apologies for the confusion, I should have added in my last comment, that the users will not tailor the rule out "because it is SELinux" as you suggested. They will likely assume that the rule is correctly implementing the apparmor check as stated in 4.1.3.14 and might tailor it out for another reason. This is the scenario I'm concerned about:
All that said, since we will soon release the Ubuntu 24.04 benchmark and update the 22.04 benchmark, I think it might be much cleaner to just make new rules as you suggested. Sorry for the back and forth :) |
I understand. I will test and merge the modification. But I suggest we create new rules for both selinux and apparmor. I will create new rules for rhel10 and I suggest you also create new rules which you will use in upcoming updates. |
@mpurg please rebase because there were some fixes for CI failures in recent PRs. |
I created new rule for rhel10 which is more specific and less bloated in #12826 |
7e3e742
to
7e7ed60
Compare
@vojtapolasek I rebased and moved the apparmor logic out of the shared Bash and OVAL files and into Ubuntu-specific files, to avoid bloating the shared file unnecessarily. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LTM, thank you. The solution you propose keeps the rule less bloated.
I waive the failing tests because audit is not available in those containers.
Code Climate has analyzed commit 7e7ed60 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.8% (0.0% change). View more on Code Climate. |
/packit retest-failed |
8ea9336
into
ComplianceAsCode:master
Description:
audit_rules_mac_modifications
to watch apparmor dirs/etc/apparmor
and/etc/apparmor.d
instead of/etc/selinux
on Ubuntu