Add AlmaLinux to CPE dictionary

This commit is contained in:
Andrew Lukoshko 2024-09-26 11:44:52 +00:00
parent dd399dd0ae
commit 213de85705
3 changed files with 138 additions and 97 deletions

View File

@ -0,0 +1,137 @@
From 8052b221a046c479c2cbb44c297191eb0d701e89 Mon Sep 17 00:00:00 2001
From: Andrew Lukoshko <alukoshko@almalinux.org>
Date: Thu, 26 Sep 2024 11:42:20 +0000
Subject: [PATCH] Add AlmaLinux to CPE dictionary
---
cpe/openscap-cpe-dict.xml | 14 +++++--
cpe/openscap-cpe-oval.xml | 78 +++++++++++++++++++++++++++++++--------
2 files changed, 73 insertions(+), 19 deletions(-)
diff --git a/cpe/openscap-cpe-dict.xml b/cpe/openscap-cpe-dict.xml
index 6c93b79..93a90c8 100644
--- a/cpe/openscap-cpe-dict.xml
+++ b/cpe/openscap-cpe-dict.xml
@@ -1,7 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<cpe-list xmlns="http://cpe.mitre.org/dictionary/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <cpe-item name="cpe:/o:linux:linux_kernel:-">
- <title xml:lang="en-us">Linux</title>
- <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.linux:def:1</check>
+ <cpe-item name="cpe:/o:almalinux:almalinux:8">
+ <title xml:lang="en-us">AlmaLinux 8</title>
+ <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.almalinux:def:8</check>
+ </cpe-item>
+ <cpe-item name="cpe:/o:almalinux:almalinux:9">
+ <title xml:lang="en-us">AlmaLinux 9</title>
+ <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.almalinux:def:9</check>
+ </cpe-item>
+ <cpe-item name="cpe:/o:almalinux:almalinux:10">
+ <title xml:lang="en-us">AlmaLinux 10</title>
+ <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.almalinux:def:10</check>
</cpe-item>
</cpe-list>
diff --git a/cpe/openscap-cpe-oval.xml b/cpe/openscap-cpe-oval.xml
index 99bed4a..3935c38 100644
--- a/cpe/openscap-cpe-oval.xml
+++ b/cpe/openscap-cpe-oval.xml
@@ -12,34 +12,80 @@
<oval:timestamp>2012-11-22T15:00:00+01:00</oval:timestamp>
</generator>
<definitions>
- <definition class="inventory" id="oval:org.open-scap.cpe.linux:def:1" version="1">
+ <definition class="inventory" id="oval:org.open-scap.cpe.almalinux:def:8" version="1">
<metadata>
- <title>Red Hat Enterprise Linux</title>
+ <title>AlmaLinux 8</title>
<affected family="unix">
- <platform>Linux</platform>
+ <platform>AlmaLinux 8</platform>
</affected>
- <reference ref_id="cpe:/o:linux:linux_kernel:-" source="CPE"/>
- <description>The operating system installed is Linux</description>
+ <reference ref_id="cpe:/o:almalinux:almalinux:8" source="CPE"/>
+ <description>The operating system installed on the system is AlmaLinux 8</description>
</metadata>
<criteria>
- <criterion comment="Linux is installed" test_ref="oval:org.open-scap.cpe.linux:tst:1"/>
+ <criterion comment="AlmaLinux 8 is installed" test_ref="oval:org.open-scap.cpe.almalinux:tst:8"/>
+ </criteria>
+ </definition>
+ <definition class="inventory" id="oval:org.open-scap.cpe.almalinux:def:9" version="1">
+ <metadata>
+ <title>AlmaLinux 9</title>
+ <affected family="unix">
+ <platform>AlmaLinux 9</platform>
+ </affected>
+ <reference ref_id="cpe:/o:almalinux:almalinux:9" source="CPE"/>
+ <description>The operating system installed on the system is AlmaLinux 9</description>
+ </metadata>
+ <criteria>
+ <criterion comment="AlmaLinux 9 is installed" test_ref="oval:org.open-scap.cpe.almalinux:tst:9"/>
+ </criteria>
+ </definition>
+ <definition class="inventory" id="oval:org.open-scap.cpe.almalinux:def:10" version="1">
+ <metadata>
+ <title>AlmaLinux 10</title>
+ <affected family="unix">
+ <platform>AlmaLinux 10</platform>
+ </affected>
+ <reference ref_id="cpe:/o:almalinux:almalinux:10" source="CPE"/>
+ <description>The operating system installed on the system is AlmaLinux 10</description>
+ </metadata>
+ <criteria>
+ <criterion comment="AlmaLinux 10 is installed" test_ref="oval:org.open-scap.cpe.almalinux:tst:10"/>
</criteria>
</definition>
</definitions>
<tests>
- <family_test check_existence="at_least_one_exists" id="oval:org.open-scap.cpe.linux:tst:1" version="1" check="only one"
- comment="Installed operating system is part of the Unix family."
- xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
- <object object_ref="oval:org.open-scap.cpe.unix:obj:1" />
- <state state_ref="oval:org.open-scap.cpe.unix:ste:1" />
- </family_test>
+ <rpminfo_test check_existence="at_least_one_exists" id="oval:org.open-scap.cpe.almalinux:tst:8" version="1" check="at least one" comment="almalinux-release is version 8"
+ xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <object object_ref="oval:org.open-scap.cpe.almalinux-release:obj:1"/>
+ <state state_ref="oval:org.open-scap.cpe.almalinux:ste:8"/>
+ </rpminfo_test>
+ <rpminfo_test check_existence="at_least_one_exists" id="oval:org.open-scap.cpe.almalinux:tst:9" version="1" check="at least one" comment="almalinux-release is version 9"
+ xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <object object_ref="oval:org.open-scap.cpe.almalinux-release:obj:1"/>
+ <state state_ref="oval:org.open-scap.cpe.almalinux:ste:9"/>
+ </rpminfo_test>
+ <rpminfo_test check_existence="at_least_one_exists" id="oval:org.open-scap.cpe.almalinux:tst:10" version="1" check="at least one" comment="almalinux-release is version 10"
+ xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <object object_ref="oval:org.open-scap.cpe.almalinux-release:obj:1"/>
+ <state state_ref="oval:org.open-scap.cpe.almalinux:ste:10"/>
+ </rpminfo_test>
</tests>
<objects>
- <family_object id="oval:org.open-scap.cpe.unix:obj:1" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent"/>
+ <rpminfo_object id="oval:org.open-scap.cpe.almalinux-release:obj:1" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <name>almalinux-release</name>
+ </rpminfo_object>
</objects>
<states>
- <family_state id="oval:org.open-scap.cpe.unix:ste:1" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
- <family>unix</family>
- </family_state>
+ <rpminfo_state id="oval:org.open-scap.cpe.almalinux:ste:8" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <name operation="pattern match">^almalinux-release</name>
+ <version operation="pattern match">^8</version>
+ </rpminfo_state>
+ <rpminfo_state id="oval:org.open-scap.cpe.almalinux:ste:9" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <name operation="pattern match">^almalinux-release</name>
+ <version operation="pattern match">^9</version>
+ </rpminfo_state>
+ <rpminfo_state id="oval:org.open-scap.cpe.almalinux:ste:10" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <name operation="pattern match">^almalinux.*-release</name>
+ <version operation="pattern match">^10</version>
+ </rpminfo_state>
</states>
</oval_definitions>
--
2.43.5

View File

@ -1,96 +0,0 @@
diff -aruN openscap-1.3.6/cpe/openscap-cpe-oval.xml openscap-1.3.6.alma/cpe/openscap-cpe-oval.xml
--- openscap-1.3.6/cpe/openscap-cpe-oval.xml 2021-04-12 08:34:00.000000000 +0300
+++ openscap-1.3.6.alma/cpe/openscap-cpe-oval.xml 2022-05-19 12:24:07.000000000 +0300
@@ -133,6 +133,32 @@
<criterion comment="Oracle Linux 8 is installed" test_ref="oval:org.open-scap.cpe.ol:tst:8"/>
</criteria>
</definition>
+ <definition class="inventory" id="oval:org.open-scap.cpe.almalinux:def:8" version="1">
+ <metadata>
+ <title>AlmaLinux 8</title>
+ <affected family="unix">
+ <platform>AlmaLinux 8</platform>
+ </affected>
+ <reference ref_id="cpe:/o:almalinux:almalinux:8" source="CPE"/>
+ <description>The operating system installed on the system is AlmaLinux 8</description>
+ </metadata>
+ <criteria>
+ <criterion comment="AlmaLinux 8 is installed" test_ref="oval:org.open-scap.cpe.almalinux:tst:8"/>
+ </criteria>
+ </definition>
+ <definition class="inventory" id="oval:org.open-scap.cpe.almalinux:def:9" version="1">
+ <metadata>
+ <title>AlmaLinux 9</title>
+ <affected family="unix">
+ <platform>AlmaLinux 9</platform>
+ </affected>
+ <reference ref_id="cpe:/o:almalinux:almalinux:9" source="CPE"/>
+ <description>The operating system installed on the system is AlmaLinux 9</description>
+ </metadata>
+ <criteria>
+ <criterion comment="AlmaLinux 9 is installed" test_ref="oval:org.open-scap.cpe.almalinux:tst:9"/>
+ </criteria>
+ </definition>
<definition class="inventory" id="oval:org.open-scap.cpe.rhel:def:1005" version="1">
<metadata>
<title>Community Enterprise Operating System 5</title>
@@ -868,6 +894,16 @@
<object object_ref="oval:org.open-scap.cpe.oraclelinux-release:obj:1"/>
<state state_ref="oval:org.open-scap.cpe.ol:ste:8"/>
</rpminfo_test>
+ <rpminfo_test check_existence="at_least_one_exists" id="oval:org.open-scap.cpe.almalinux:tst:8" version="1" check="at least one" comment="almalinux-release is version 8"
+ xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <object object_ref="oval:org.open-scap.cpe.almalinux-release:obj:1"/>
+ <state state_ref="oval:org.open-scap.cpe.almalinux:ste:8"/>
+ </rpminfo_test>
+ <rpminfo_test check_existence="at_least_one_exists" id="oval:org.open-scap.cpe.almalinux:tst:9" version="1" check="at least one" comment="almalinux-release is version 9"
+ xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <object object_ref="oval:org.open-scap.cpe.almalinux-release:obj:1"/>
+ <state state_ref="oval:org.open-scap.cpe.almalinux:ste:9"/>
+ </rpminfo_test>
<rpmverifyfile_test check_existence="at_least_one_exists" id="oval:org.open-scap.cpe.rhel:tst:1005" version="1" check="at least one" comment="centos-release is version 5"
xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
<object object_ref="oval:org.open-scap.cpe.redhat-release:obj:3"/>
@@ -1223,6 +1259,9 @@
<rpminfo_object id="oval:org.open-scap.cpe.oraclelinux-release:obj:1" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
<name>oraclelinux-release</name>
</rpminfo_object>
+ <rpminfo_object id="oval:org.open-scap.cpe.almalinux-release:obj:1" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <name>almalinux-release</name>
+ </rpminfo_object>
<registry_object id="oval:org.open-scap.cpe.windows:obj:1" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#windows" >
<hive>HKEY_LOCAL_MACHINE</hive>
<key>SOFTWARE\Microsoft\Windows NT\CurrentVersion</key>
@@ -1307,6 +1346,14 @@
<name operation="pattern match">^oraclelinux-release</name>
<version operation="pattern match">^8</version>
</rpminfo_state>
+ <rpminfo_state id="oval:org.open-scap.cpe.almalinux:ste:8" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <name operation="pattern match">^almalinux-release</name>
+ <version operation="pattern match">^8</version>
+ </rpminfo_state>
+ <rpminfo_state id="oval:org.open-scap.cpe.almalinux:ste:9" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
+ <name operation="pattern match">^almalinux-release</name>
+ <version operation="pattern match">^9</version>
+ </rpminfo_state>
<rpminfo_state id="oval:org.open-scap.cpe.fedora:ste:16" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
<version operation="pattern match">^16$</version>
</rpminfo_state>
diff -aruN openscap-1.3.6/cpe/openscap-cpe-dict.xml openscap-1.3.6.alma/cpe/openscap-cpe-dict.xml
--- openscap-1.3.6/cpe/openscap-cpe-dict.xml 2021-04-12 08:34:00.000000000 +0300
+++ openscap-1.3.6.alma/cpe/openscap-cpe-dict.xml 2022-05-19 12:24:45.000000000 +0300
@@ -37,6 +37,14 @@
<title xml:lang="en-us">Community Enterprise Operating System 8</title>
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.centos:def:8</check>
</cpe-item>
+ <cpe-item name="cpe:/o:almalinux:almalinux:8">
+ <title xml:lang="en-us">AlmaLinux 8</title>
+ <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.almalinux:def:8</check>
+ </cpe-item>
+ <cpe-item name="cpe:/o:almalinux:almalinux:9">
+ <title xml:lang="en-us">AlmaLinux 9</title>
+ <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.almalinux:def:9</check>
+ </cpe-item>
<cpe-item name="cpe:/o:fedoraproject:fedora:32">
<title xml:lang="en-us">Fedora 32</title>
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="openscap-cpe-oval.xml">oval:org.open-scap.cpe.fedora:def:32</check>

View File

@ -56,7 +56,7 @@ Requires: xmlsec1
Requires: xmlsec1-openssl
# AlmaLinux patches
Patch1000: openscap-1.3.5-almalinux.patch
Patch1000: 0001-Add-AlmaLinux-to-CPE-dictionary.patch
%description %{common_description}