Skip to content

Commit

Permalink
Fix UBTU-20-010179 to use proper parameters and key
Browse files Browse the repository at this point in the history
This commit will fix the init_module and finit_module for UBTU-20-010179 which will apply proper parameters and keys.
  • Loading branch information
dexterle committed Sep 12, 2023
1 parent c382b19 commit 92e7882
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# platform = multi_platform_rhel,multi_platform_ol,multi_platform_rhv,multi_platform_sle
# platform = multi_platform_rhel,multi_platform_ol,multi_platform_rhv,multi_platform_sle,multi_platform_ubuntu
# reboot = false
# complexity = low
# disruption = low
# strategy = configure

{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
{{% set auid_filters = "-F auid>=" ~ auid ~ " -F auid!=unset" %}}
{{% else %}}
{{% set auid_filters = "" %}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ for ARCH in "${RULE_ARCHS[@]}"
do
ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH"
OTHER_FILTERS=""
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
AUID_FILTERS="-F auid>={{{ auid }}} -F auid!=unset"
{{% else %}}
AUID_FILTERS=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_32bit_ardm_finit_module_augenrules" version="1">
<ind:filepath operation="pattern match">^/etc/audit/rules\.d/.*\.rules$</ind:filepath>
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b32[\s]+)(?:.*(-S[\s]+finit_module[\s]+|([\s]+|[,])finit_module([\s]+|[,]))).*(?:-F\s+auid>={{{ uid_min }}}[\s]+)(?:-F\s+auid!=(unset|4294967295))\s+(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
{{% else %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b32[\s]+)(?:.*(-S[\s]+finit_module[\s]+|([\s]+|[,])finit_module([\s]+|[,]))).*(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
Expand All @@ -49,7 +49,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_64bit_ardm_finit_module_augenrules" version="1">
<ind:filepath operation="pattern match">^/etc/audit/rules\.d/.*\.rules$</ind:filepath>
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b64[\s]+)(?:.*(-S[\s]+finit_module[\s]+|([\s]+|[,])finit_module([\s]+|[,]))).*(?:-F\s+auid>={{{ uid_min }}}[\s]+)(?:-F\s+auid!=(unset|4294967295))\s+(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
{{% else %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b64[\s]+)(?:.*(-S[\s]+finit_module[\s]+|([\s]+|[,])finit_module([\s]+|[,]))).*(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
Expand All @@ -62,7 +62,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_32bit_ardm_finit_module_auditctl" version="1">
<ind:filepath>/etc/audit/audit.rules</ind:filepath>
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b32[\s]+)(?:.*(-S[\s]+finit_module[\s]+|([\s]+|[,])finit_module([\s]+|[,]))).*(?:-F\s+auid>={{{ uid_min }}}[\s]+)(?:-F\s+auid!=(unset|4294967295))\s+(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
{{% else %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b32[\s]+)(?:.*(-S[\s]+finit_module[\s]+|([\s]+|[,])finit_module([\s]+|[,]))).*(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
Expand All @@ -75,7 +75,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_64bit_ardm_finit_module_auditctl" version="1">
<ind:filepath>/etc/audit/audit.rules</ind:filepath>
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b64[\s]+)(?:.*(-S[\s]+finit_module[\s]+|([\s]+|[,])finit_module([\s]+|[,]))).*(?:-F\s+auid>={{{ uid_min }}}[\s]+)(?:-F\s+auid!=(unset|4294967295))\s+(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
{{% else %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b64[\s]+)(?:.*(-S[\s]+finit_module[\s]+|([\s]+|[,])finit_module([\s]+|[,]))).*(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ description: |-
to read audit rules during daemon startup (the default), add the following lines to a file
with suffix <tt>.rules</tt> in the directory <tt>/etc/audit/rules.d</tt> to capture kernel module
loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system:
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<pre>-a always,exit -F arch=<i>ARCH</i> -S finit_module -F auid>={{{ uid_min }}} -F auid!=unset -F key=modules</pre>
{{% else %}}
<pre>-a always,exit -F arch=<i>ARCH</i> -S finit_module -F key=modules</pre>
{{% endif %}} If the <tt>auditd</tt> daemon is configured to use the <tt>auditctl</tt> utility to read audit
rules during daemon startup, add the following lines to <tt>/etc/audit/audit.rules</tt> file
in order to capture kernel module loading and unloading events, setting ARCH to either b32 or
b64 as appropriate for your system:
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<pre>-a always,exit -F arch=<i>ARCH</i> -S finit_module -F auid>={{{ uid_min }}} -F auid!=unset -F key=modules</pre>
{{% else %}}
<pre>-a always,exit -F arch=<i>ARCH</i> -S finit_module -F key=modules</pre>
Expand Down Expand Up @@ -65,7 +65,7 @@ references:
stigid@rhel8: RHEL-08-030360
stigid@sle12: SLES-12-020740
stigid@sle15: SLES-15-030530
stigid@ubuntu2004: UBTU-20-010180
stigid@ubuntu2004: UBTU-20-010179

{{{ complete_ocil_entry_audit_syscall(syscall="finit_module") }}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# platform = multi_platform_rhel,multi_platform_rhv,multi_platform_sle,multi_platform_ol
# platform = multi_platform_rhel,multi_platform_rhv,multi_platform_sle,multi_platform_ol,multi_platform_ubuntu
# reboot = false
# complexity = low
# disruption = low
# strategy = configure

{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
{{% set auid_filters = "-F auid>=" ~ auid ~ " -F auid!=unset" %}}
{{% else %}}
{{% set auid_filters = "" %}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ for ARCH in "${RULE_ARCHS[@]}"
do
ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH"
OTHER_FILTERS=""
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
AUID_FILTERS="-F auid>={{{ auid }}} -F auid!=unset"
{{% else %}}
AUID_FILTERS=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_32bit_ardm_init_module_augenrules" version="1">
<ind:filepath operation="pattern match">^/etc/audit/rules\.d/.*\.rules$</ind:filepath>
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b32[\s]+)(?:.*(-S[\s]+init_module[\s]+|([\s]+|[,])init_module([\s]+|[,]))).*(?:-F\s+auid>={{{ uid_min }}}[\s]+)(?:-F\s+auid!=(unset|4294967295))\s+(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
{{% else %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b32[\s]+)(?:.*(-S[\s]+init_module[\s]+|([\s]+|[,])init_module([\s]+|[,]))).*(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
Expand All @@ -49,7 +49,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_64bit_ardm_init_module_augenrules" version="1">
<ind:filepath operation="pattern match">^/etc/audit/rules\.d/.*\.rules$</ind:filepath>
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b64[\s]+)(?:.*(-S[\s]+init_module[\s]+|([\s]+|[,])init_module([\s]+|[,]))).*(?:-F\s+auid>={{{ uid_min }}}[\s]+)(?:-F\s+auid!=(unset|4294967295))\s+(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
{{% else %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b64[\s]+)(?:.*(-S[\s]+init_module[\s]+|([\s]+|[,])init_module([\s]+|[,]))).*(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
Expand All @@ -62,7 +62,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_32bit_ardm_init_module_auditctl" version="1">
<ind:filepath>/etc/audit/audit.rules</ind:filepath>
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b32[\s]+)(?:.*(-S[\s]+init_module[\s]+|([\s]+|[,])init_module([\s]+|[,]))).*(?:-F\s+auid>={{{ uid_min }}}[\s]+)(?:-F\s+auid!=(unset|4294967295))\s+(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
{{% else %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b32[\s]+)(?:.*(-S[\s]+init_module[\s]+|([\s]+|[,])init_module([\s]+|[,]))).*(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
Expand All @@ -75,7 +75,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="object_64bit_ardm_init_module_auditctl" version="1">
<ind:filepath>/etc/audit/audit.rules</ind:filepath>
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b64[\s]+)(?:.*(-S[\s]+init_module[\s]+|([\s]+|[,])init_module([\s]+|[,]))).*(?:-F\s+auid>={{{ uid_min }}}[\s]+)(?:-F\s+auid!=(unset|4294967295))\s+(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
{{% else %}}
<ind:pattern operation="pattern match">^[\s]*-a[\s]+always,exit[\s]+(?:.*-F[\s]+arch=b64[\s]+)(?:.*(-S[\s]+init_module[\s]+|([\s]+|[,])init_module([\s]+|[,]))).*(-k[\s]+|-F[\s]+key=)[\S]+[\s]*$</ind:pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: 'Ensure auditd Collects Information on Kernel Module Loading - init_modul
description: |-
To capture kernel module loading events, use following line, setting ARCH to
either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit:
{{% if "ol" in product or 'rhel' in product %}}
{{% if "ol" in product or 'rhel' in product or 'ubuntu' in product %}}
<pre>-a always,exit -F arch=<i>ARCH</i> -S init_module -F auid>={{{ uid_min }}} -F auid!=unset -F key=modules</pre>
{{% else %}}
<pre>-a always,exit -F arch=<i>ARCH</i> -S init_module -F key=modules</pre>
Expand Down

0 comments on commit 92e7882

Please sign in to comment.