Skip to content

Commit

Permalink
Recognize all 64bit architectures in audit rules
Browse files Browse the repository at this point in the history
  • Loading branch information
mildas committed Nov 25, 2022
1 parent 925c672 commit 15abac6
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
#
- name: Set architecture for audit tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

# set list of syscalls based on rhel version
{{% set audit_syscalls = ["init_module", "delete_module", "finit_module"] %}}

- name: Perform remediation of Audit rules for kernel module loading for x86 platform
- name: Perform remediation of Audit rules for kernel module loading for 32bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b32",
Expand All @@ -38,7 +44,7 @@
syscall_grouping=audit_syscalls,
)|indent(4) }}}

- name: Perform remediation of Audit rules for kernel module loading for x86_64 platform
- name: Perform remediation of Audit rules for kernel module loading for 64bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@

- name: Set architecture for audit finit_module tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

- name: Perform remediation of Audit rules for finit_module for x86 platform
- name: Perform remediation of Audit rules for finit_module for 32bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b32",
Expand All @@ -29,7 +35,7 @@
syscall_grouping=[],
)|indent(4) }}}

- name: Perform remediation of Audit rules for finit_module for x86_64 platform
- name: Perform remediation of Audit rules for finit_module for 64bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@

- name: Set architecture for audit delete_module tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

- name: Perform remediation of Audit rules for delete_module for x86 platform
- name: Perform remediation of Audit rules for delete_module for 32bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b32",
Expand All @@ -35,7 +41,7 @@
syscall_grouping=[],
)|indent(4) }}}

- name: Perform remediation of Audit rules for delete_module for x86_64 platform
- name: Perform remediation of Audit rules for delete_module for 64bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@

- name: Set architecture for audit finit_module tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

- name: Perform remediation of Audit rules for finit_module for x86 platform
block:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@

- name: Set architecture for audit init_module tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

- name: Perform remediation of Audit rules for init_module for x86 platform
- name: Perform remediation of Audit rules for init_module for 32bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b32",
Expand All @@ -35,7 +41,7 @@
syscall_grouping=["init_module","finit_module"],
)|indent(4) }}}

- name: Perform remediation of Audit rules for init_module for x86_64 platform
- name: Perform remediation of Audit rules for init_module for 64bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
#
- name: Set architecture for audit tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

- name: Remediate audit rules for network configuration for x86
- name: Remediate audit rules for network configuration for 32bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b32",
Expand All @@ -30,7 +36,7 @@
syscall_grouping=["sethostname", "setdomainname"],
)|indent(4) }}}

- name: Remediate audit rules for network configuration for x86_64
- name: Remediate audit rules for network configuration for 64bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@

- name: Set architecture for audit tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

- name: Perform remediation of Audit rules for adjtimex for x86 platform
- name: Perform remediation of Audit rules for adjtimex for 32bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b32",
Expand All @@ -27,7 +33,7 @@
syscall_grouping=["adjtimex", "settimeofday", "stime"],
)|indent(4) }}}

- name: Perform remediation of Audit rules for adjtimex for x86_64 platform
- name: Perform remediation of Audit rules for adjtimex for 64bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
#
- name: Set architecture for audit tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

- name: Perform remediation of Audit rules for clock_settime for x86 platform
- name: Perform remediation of Audit rules for clock_settime for 32bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b32",
Expand All @@ -29,7 +35,7 @@
syscall_grouping=[],
)|indent(4) }}}

- name: Perform remediation of Audit rules for clock_settime for x86_64 platform
- name: Perform remediation of Audit rules for clock_settime for 64bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@

- name: Set architecture for audit tasks
set_fact:
audit_arch: "b{{ ansible_architecture | regex_replace('.*(\\d\\d$)','\\1') }}"
audit_arch: "b64"
when:
- ansible_architecture == "aarch64" or
ansible_architecture == "ppc64" or
ansible_architecture == "ppc64le" or
ansible_architecture == "s390x" or
ansible_architecture == "x86_64"

- name: Perform remediation of Audit rules for settimeofday for x86 platform
- name: Perform remediation of Audit rules for settimeofday for 32bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b32",
Expand All @@ -27,7 +33,7 @@
syscall_grouping=["adjtimex", "settimeofday", "stime"],
)|indent(4) }}}

- name: Perform remediation of Audit rules for settimeofday for x86_64 platform
- name: Perform remediation of Audit rules for settimeofday for 64bit platform
block:
{{{ ansible_audit_augenrules_add_syscall_rule(
action_arch_filters="-a always,exit -F arch=b64",
Expand Down

0 comments on commit 15abac6

Please sign in to comment.