Blame SOURCES/scap-security-guide-0.1.61-rear_not_applicable_aarch64-PR_8221.patch

5fd106
From 622558873703704bd97fde1874a9a782d4cb8b0e Mon Sep 17 00:00:00 2001
5fd106
From: Gabriel Becker <ggasparb@redhat.com>
5fd106
Date: Mon, 14 Feb 2022 17:51:50 +0100
5fd106
Subject: [PATCH] Introduce CPE for aarch64 and make package_rear_installed n/a
5fd106
 aarch64.
5fd106
5fd106
This rule is not applicable for RHEL9 only.
5fd106
---
5fd106
 .../package_rear_installed/rule.yml           |  4 +++
5fd106
 shared/applicability/arch.yml                 | 12 +++++++
5fd106
 ...proc_sys_kernel_osrelease_arch_aarch64.xml | 33 +++++++++++++++++++
5fd106
 ..._sys_kernel_osrelease_arch_not_aarch64.xml | 16 +++++++++
5fd106
 ssg/constants.py                              |  2 ++
5fd106
 5 files changed, 67 insertions(+)
5fd106
 create mode 100644 shared/checks/oval/proc_sys_kernel_osrelease_arch_aarch64.xml
5fd106
 create mode 100644 shared/checks/oval/proc_sys_kernel_osrelease_arch_not_aarch64.xml
5fd106
5fd106
diff --git a/linux_os/guide/system/software/system-tools/package_rear_installed/rule.yml b/linux_os/guide/system/software/system-tools/package_rear_installed/rule.yml
5fd106
index 6e3c11e5749..efb591654a9 100644
5fd106
--- a/linux_os/guide/system/software/system-tools/package_rear_installed/rule.yml
5fd106
+++ b/linux_os/guide/system/software/system-tools/package_rear_installed/rule.yml
5fd106
@@ -25,6 +25,10 @@ ocil: '{{{ ocil_package(package="rear") }}}'
5fd106
 # The package is not available for s309x on RHEL<8.5
5fd106
 # platform: not_s390x_arch
5fd106
 
5fd106
+{{%- if product == "rhel9" %}}
5fd106
+platform: not_aarch64_arch
5fd106
+{{%- endif %}}
5fd106
+
5fd106
 template:
5fd106
     name: package_installed
5fd106
     vars:
5fd106
diff --git a/shared/applicability/arch.yml b/shared/applicability/arch.yml
5fd106
index d2cbd102310..9ac05317a95 100644
5fd106
--- a/shared/applicability/arch.yml
5fd106
+++ b/shared/applicability/arch.yml
5fd106
@@ -12,3 +12,15 @@ cpes:
5fd106
       check_id: proc_sys_kernel_osrelease_arch_s390x
5fd106
       bash_conditional: 'grep -q s390x /proc/sys/kernel/osrelease'
5fd106
 
5fd106
+  - not_aarch64_arch:
5fd106
+      name: "cpe:/a:not_aarch64_arch"
5fd106
+      title: "System architecture is not AARCH64"
5fd106
+      check_id: proc_sys_kernel_osrelease_arch_not_aarch64
5fd106
+      bash_conditional: "! grep -q aarch64 /proc/sys/kernel/osrelease"
5fd106
+
5fd106
+  - aarch64_arch:
5fd106
+      name: "cpe:/a:aarch64_arch"
5fd106
+      title: "System architecture is AARCH64"
5fd106
+      check_id: proc_sys_kernel_osrelease_arch_aarch64
5fd106
+      bash_conditional: 'grep -q aarch64 /proc/sys/kernel/osrelease'
5fd106
+
5fd106
diff --git a/shared/checks/oval/proc_sys_kernel_osrelease_arch_aarch64.xml b/shared/checks/oval/proc_sys_kernel_osrelease_arch_aarch64.xml
5fd106
new file mode 100644
5fd106
index 00000000000..3d54f81e6d4
5fd106
--- /dev/null
5fd106
+++ b/shared/checks/oval/proc_sys_kernel_osrelease_arch_aarch64.xml
5fd106
@@ -0,0 +1,33 @@
5fd106
+<def-group>
5fd106
+  
5fd106
+  version="1">
5fd106
+    <metadata>
5fd106
+      <title>Test that the architecture is aarch64</title>
5fd106
+      <affected family="unix">
5fd106
+        <platform>multi_platform_all</platform>
5fd106
+      </affected>
5fd106
+      <description>Check that architecture of kernel in /proc/sys/kernel/osrelease is aarch64</description>
5fd106
+    </metadata>
5fd106
+    <criteria>
5fd106
+      
5fd106
+      test_ref="test_proc_sys_kernel_osrelease_arch_aarch64" />
5fd106
+    </criteria>
5fd106
+  </definition>
5fd106
+  
5fd106
+      comment="proc_sys_kernel is for aarch64 architecture"
5fd106
+      id="test_proc_sys_kernel_osrelease_arch_aarch64"
5fd106
+  version="1">
5fd106
+    <ind:object object_ref="object_proc_sys_kernel_osrelease_arch_aarch64" />
5fd106
+    <ind:state state_ref="state_proc_sys_kernel_osrelease_arch_aarch64" />
5fd106
+  </ind:textfilecontent54_test>
5fd106
+
5fd106
+  <ind:textfilecontent54_object id="object_proc_sys_kernel_osrelease_arch_aarch64" version="1">
5fd106
+    <ind:filepath>/proc/sys/kernel/osrelease</ind:filepath>
5fd106
+    <ind:pattern operation="pattern match">^.*\.(.*)$</ind:pattern>
5fd106
+    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
5fd106
+  </ind:textfilecontent54_object>
5fd106
+
5fd106
+  <ind:textfilecontent54_state id="state_proc_sys_kernel_osrelease_arch_aarch64" version="1">
5fd106
+    <ind:subexpression datatype="string" operation="pattern match">^aarch64$</ind:subexpression>
5fd106
+  </ind:textfilecontent54_state>
5fd106
+</def-group>
5fd106
diff --git a/shared/checks/oval/proc_sys_kernel_osrelease_arch_not_aarch64.xml b/shared/checks/oval/proc_sys_kernel_osrelease_arch_not_aarch64.xml
5fd106
new file mode 100644
5fd106
index 00000000000..3fce66ee00a
5fd106
--- /dev/null
5fd106
+++ b/shared/checks/oval/proc_sys_kernel_osrelease_arch_not_aarch64.xml
5fd106
@@ -0,0 +1,16 @@
5fd106
+<def-group>
5fd106
+  
5fd106
+  version="1">
5fd106
+    <metadata>
5fd106
+      <title>Test for different architecture than aarch64</title>
5fd106
+      <affected family="unix">
5fd106
+        <platform>multi_platform_all</platform>
5fd106
+      </affected>
5fd106
+      <description>Check that architecture of kernel in /proc/sys/kernel/osrelease is not aarch64</description>
5fd106
+    </metadata>
5fd106
+    <criteria>
5fd106
+      
5fd106
+      definition_ref="proc_sys_kernel_osrelease_arch_aarch64" negate="true"/>
5fd106
+    </criteria>
5fd106
+  </definition>
5fd106
+</def-group>
5fd106
diff --git a/ssg/constants.py b/ssg/constants.py
5fd106
index 64d7d36c989..92cc2f8de34 100644
5fd106
--- a/ssg/constants.py
5fd106
+++ b/ssg/constants.py
5fd106
@@ -424,6 +424,8 @@
5fd106
   "non-uefi": None,
5fd106
   "not_s390x_arch": None,
5fd106
   "s390x_arch": None,
5fd106
+  "not_aarch64_arch": None,
5fd106
+  "aarch64_arch": None,
5fd106
   "ovirt": None,
5fd106
   "no_ovirt": None,
5fd106
 }