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

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