Blame SOURCES/scap-security-guide-0.1.67-firewalld_sshd_port_enabled_tests-PR_10162.patch

825e43
From a8cea205d5f9f975ca03ef39e79d18698236cfe2 Mon Sep 17 00:00:00 2001
825e43
From: Watson Sato <wsato@redhat.com>
825e43
Date: Mon, 13 Feb 2023 17:49:14 +0100
825e43
Subject: [PATCH 3/5] Change custom zones check in firewalld_sshd_port_enabled
825e43
825e43
Patch-name: scap-security-guide-0.1.67-firewalld_sshd_port_enabled_tests-PR_10162.patch
825e43
Patch-status: Change custom zones check in firewalld_sshd_port_enabled
825e43
---
825e43
 .../oval/shared.xml                           | 68 +++++++++++++++----
825e43
 1 file changed, 54 insertions(+), 14 deletions(-)
825e43
825e43
diff --git a/linux_os/guide/services/ssh/ssh_server/firewalld_sshd_port_enabled/oval/shared.xml b/linux_os/guide/services/ssh/ssh_server/firewalld_sshd_port_enabled/oval/shared.xml
825e43
index 4adef2e53f..d7c96665b4 100644
825e43
--- a/linux_os/guide/services/ssh/ssh_server/firewalld_sshd_port_enabled/oval/shared.xml
825e43
+++ b/linux_os/guide/services/ssh/ssh_server/firewalld_sshd_port_enabled/oval/shared.xml
825e43
@@ -133,9 +133,10 @@
825e43
          OVAL resources in order to detect and assess only active zone, which are zones with at
825e43
          least one NIC assigned to it. Since it was possible to easily have the list of active
825e43
          zones, it was cumbersome to use that list in other OVAL objects without introduce a high
825e43
-         level of complexity to make sure environments with multiple NICs and multiple zones are
825e43
-         in use. So, in favor of simplicity and readbility it was decided to work with a static
825e43
-         list. It means that, in the future, it is possible this list needs to be updated. -->
825e43
+         level of complexity to ensure proper assessment in environments where multiple NICs and
825e43
+         multiple zones are in use. So, in favor of simplicity and readbility it was decided to
825e43
+         work with a static list. It means that, in the future, it is possible this list needs to
825e43
+         be updated. -->
825e43
     
825e43
         datatype="string"
825e43
         comment="Regex containing the list of zones files delivered in the firewalld package">
825e43
@@ -145,23 +146,62 @@
825e43
     
825e43
          in the /etc/firewalld/zones dir in order to override the default zone settings. The same
825e43
          directory is applicable for new zones created by the administrator. Therefore, all files
825e43
-         in this directory should also allow SSH. -->
825e43
-    
825e43
+         in this directory should also allow SSH.
825e43
+         This test was updated in a reaction to https://github.com/OpenSCAP/openscap/issues/1923,
825e43
+         which changed the behaviour of xmlfilecontent probe in OpenSCAP 1.3.7. Currently, a
825e43
+         variable test is the simplest way to check if all custom zones are allowing ssh, but have
825e43
+         an impact in transparency since the objects are not shown in reports. The transparency
825e43
+         impact can be workarounded by using other OVAL objects, but this would impact in
825e43
+         readability and would increase complexity. This solution is in favor of simplicity. -->
825e43
+    
825e43
         check="all" check_existence="at_least_one_exists" version="1"
825e43
         comment="SSH service is defined in all zones created or modified by the administrator">
825e43
-      <ind:object object_ref="object_firewalld_sshd_port_enabled_zone_files_etc"/>
825e43
-      <ind:state state_ref="state_firewalld_sshd_port_enabled_zone_files_etc"/>
825e43
-    </ind:xmlfilecontent_test>
825e43
+        
825e43
+            object_ref="object_firewalld_sshd_port_enabled_custom_zone_files_with_ssh_count"/>
825e43
+        <ind:state state_ref="state_firewalld_sshd_port_enabled_custom_zone_files_count"/>
825e43
+    </ind:variable_test>
825e43
+
825e43
+    
825e43
+        version="1">
825e43
+      <ind:var_ref>var_firewalld_sshd_port_enabled_custom_zone_files_with_ssh_count</ind:var_ref>
825e43
+    </ind:variable_object>
825e43
+
825e43
+    
825e43
+        datatype="int" version="1"
825e43
+        comment="Variable including number of custom zone files allowing ssh">
825e43
+        <count>
825e43
+            
825e43
+                object_ref="object_firewalld_sshd_port_enabled_zone_files_etc"/>
825e43
+        </count>
825e43
+    </local_variable>
825e43
 
825e43
     <ind:xmlfilecontent_object id="object_firewalld_sshd_port_enabled_zone_files_etc" version="1">
825e43
-      <ind:path>/etc/firewalld/zones</ind:path>
825e43
-      <ind:filename operation="pattern match">^.*\.xml$</ind:filename>
825e43
-      <ind:xpath>/zone/service[@name='ssh']</ind:xpath>
825e43
+        <ind:path>/etc/firewalld/zones</ind:path>
825e43
+        <ind:filename operation="pattern match">^.*\.xml$</ind:filename>
825e43
+        <ind:xpath>/zone/service[@name='ssh']</ind:xpath>
825e43
     </ind:xmlfilecontent_object>
825e43
 
825e43
-    <ind:xmlfilecontent_state id="state_firewalld_sshd_port_enabled_zone_files_etc" version="1">
825e43
-      <ind:xpath>/zone/service[@name='ssh']</ind:xpath>
825e43
-    </ind:xmlfilecontent_state>
825e43
+    
825e43
+        version="1">
825e43
+        
825e43
+            var_ref="var_firewalld_sshd_port_enabled_custom_zone_files_count"/>
825e43
+    </ind:variable_state>
825e43
+
825e43
+    
825e43
+        datatype="int" version="1"
825e43
+        comment="Variable including number of custom zone files present in /etc/firewalld/zones">
825e43
+        <count>
825e43
+            
825e43
+                object_ref="object_firewalld_sshd_port_enabled_custom_zone_files"/>
825e43
+        </count>
825e43
+    </local_variable>
825e43
+
825e43
+    <unix:file_object id="object_firewalld_sshd_port_enabled_custom_zone_files" version="1">
825e43
+        
825e43
+            recurse_file_system="local"/>
825e43
+        <unix:path>/etc/firewalld/zones</unix:path>
825e43
+        <unix:filename operation="pattern match">^.*\.xml$</unix:filename>
825e43
+    </unix:file_object>
825e43
 
825e43
     
825e43
     
825e43
-- 
825e43
2.39.1
825e43