Blame SOURCES/oscap-anaconda-addon-1.2-new_package_groups-PR_128.patch

811584
From 1de759e8bcf1caddddfdda59496473ed9b525365 Mon Sep 17 00:00:00 2001
811584
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
811584
Date: Wed, 4 Nov 2020 17:48:35 +0100
811584
Subject: [PATCH] Expanded group data to detect more package collisions.
811584
811584
This should cover RHEL8 OSPP and CIS profiles.
811584
---
811584
 org_fedora_oscap/rule_handling.py | 16 +++++++++++++++-
811584
 1 file changed, 15 insertions(+), 1 deletion(-)
811584
811584
diff --git a/org_fedora_oscap/rule_handling.py b/org_fedora_oscap/rule_handling.py
811584
index 6a3a04e..80d86c7 100644
811584
--- a/org_fedora_oscap/rule_handling.py
811584
+++ b/org_fedora_oscap/rule_handling.py
811584
@@ -40,12 +40,26 @@
811584
 __all__ = ["RuleData"]
811584
 
811584
 
811584
+# Mapping of packages to package environments and/or groups that depends on them
811584
+# See also https://access.redhat.com/solutions/1201413 how to get group IDs.
811584
+# on RHEL8, use e.g. grep -R "<id>" /var/cache/dnf/*
811584
 ESSENTIAL_PACKAGES = {
811584
     "xorg-x11-server-common": {
811584
         "env": ["graphical-server-environment", "workstation-product-environment"],
811584
+        "groups": ["workstation-product-environment"],
811584
     },
811584
     "nfs-utils": {
811584
         "env": ["graphical-server-environment", "workstation-product-environment"],
811584
+        "groups": ["workstation-product-environment"],
811584
+    },
811584
+    "tftp": {
811584
+        "groups": ["network-server"],
811584
+    },
811584
+    "abrt": {
811584
+        "groups": ["debugging"],
811584
+    },
811584
+    "gssproxy": {
811584
+        "groups": ["file-server"],
811584
     },
811584
 }
811584
 
811584
@@ -642,7 +656,7 @@ def _package_is_essential(self, package_name, ksdata_packages):
811584
         if package_name in ksdata_packages.packageList:
811584
             return True
811584
         selected_install_env = ksdata_packages.environment
811584
-        if selected_install_env in ESSENTIAL_PACKAGES[package_name].get("env"):
811584
+        if selected_install_env in ESSENTIAL_PACKAGES[package_name].get("env", []):
811584
             return True
811584
         selected_install_groups_names = {g.name for g in ksdata_packages.groupList}
811584
         for g in ESSENTIAL_PACKAGES[package_name].get("groups", []):