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

Add remediation and OVAL for UBTU-20-010297 #11098

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# platform = multi_platform_sle,multi_platform_ubuntu
# reboot = false
# strategy = restrict
# complexity = low
# disruption = low

{{{ ansible_audit_augenrules_add_watch_rule(path='/usr/bin/kmod', permissions='x', key='modules') }}}
{{{ ansible_audit_auditctl_add_watch_rule(path='/usr/bin/kmod', permissions='x', key='modules') }}}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# platform = multi_platform_sle
# platform = multi_platform_sle,multi_platform_ubuntu

# Perform the remediation for both possible tools: 'auditctl' and 'augenrules'
{{{ bash_fix_audit_watch_rule("auditctl", "/usr/bin/kmod", "x", "modules") }}}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<def-group>
<definition class="compliance" id="audit_rules_privileged_commands_kmod" version="1">
{{{ oval_metadata("Ensure audit rule for all uses of the kmod command is enabled.") }}}

<criteria operator="OR">

<!-- Test the augenrules case -->
<criteria operator="AND">
<extend_definition comment="audit augenrules" definition_ref="audit_rules_augenrules" />
<criterion comment="audit augenrules kmod" test_ref="test_kmod_augenrules" />
</criteria>

<!-- Test the auditctl case -->
<criteria operator="AND">
<extend_definition comment="audit auditctl" definition_ref="audit_rules_auditctl" />
<criterion comment="audit auditctl kmod" test_ref="test_kmod_auditctl" />
</criteria>
</criteria>
</definition>

<ind:textfilecontent54_test check="all" check_existence="only_one_exists" comment="audit augenrules kmod" id="test_kmod_augenrules" version="1">
<ind:object object_ref="object_kmod_augenrules" />
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_kmod_augenrules" version="1">
<ind:filepath operation="pattern match">^/etc/audit/rules\.d/.*\.rules$</ind:filepath>
<ind:pattern operation="pattern match">^[\s]*-w[\s]+/usr/bin/kmod[\s]+-p[\s]+x[\s]+-k[\s]+modules[\s]*$</ind:pattern>
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>

<ind:textfilecontent54_test check="all" check_existence="only_one_exists" comment="audit auditctl kmod" id="test_kmod_auditctl" version="1">
<ind:object object_ref="object_kmod_auditctl" />
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_kmod_auditctl" version="1">
<ind:filepath>/etc/audit/audit.rules</ind:filepath>
<ind:pattern operation="pattern match">^[\s]*-w[\s]+/usr/bin/kmod[\s]+-p[\s]+x[\s]+-k[\s]+modules[\s]*$</ind:pattern>
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>

</def-group>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{%- if product in ["ol7", "rhel7", "rhel8", "rhel9"] %}}
{{%- set kmod_audit="-a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=" ~ uid_min ~ " -F auid!=unset -F key=privileged" %}}
{{%- elif product in ["ubuntu2004", "ubuntu2204"] %}}
{{%- set kmod_audit="-w /bin/kmod -p x -k modules" %}}
{{%- else %}}
{{%- set kmod_audit="-w /usr/bin/kmod -p x -k modules" %}}
{{%- endif %}}
Expand Down Expand Up @@ -66,4 +64,3 @@ template:
name: audit_rules_privileged_commands
vars:
path: /usr/bin/kmod
path@ubuntu2004: /bin/kmod