Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 1 | From 23a224203a73688567f500380644e5cf30c8ed99 Mon Sep 17 00:00:00 2001 |
| 2 | From: Armin Kuster <akuster808@gmail.com> |
| 3 | Date: Thu, 22 Jun 2023 06:19:26 -0400 |
| 4 | Subject: [PATCH] scap-security-guide: add Poky support |
| 5 | |
| 6 | Signed-off-by: Armin Kuster <akuster808@gmail.com> |
| 7 | |
| 8 | Upstream-Status: Pending |
| 9 | Signed-off-by: Armin Kuster <akuster808@gmail.com> |
| 10 | |
| 11 | --- |
| 12 | products/openembedded/product.yml | 7 +++- |
| 13 | .../openembedded/transforms/constants.xslt | 4 +-- |
| 14 | shared/checks/oval/installed_OS_is_poky.xml | 33 +++++++++++++++++++ |
| 15 | 3 files changed, 41 insertions(+), 3 deletions(-) |
| 16 | create mode 100644 shared/checks/oval/installed_OS_is_poky.xml |
| 17 | |
| 18 | diff --git a/products/openembedded/product.yml b/products/openembedded/product.yml |
| 19 | index 9f2f12d737..a495e197c0 100644 |
| 20 | --- a/products/openembedded/product.yml |
| 21 | +++ b/products/openembedded/product.yml |
| 22 | @@ -14,6 +14,11 @@ init_system: "systemd" |
| 23 | cpes_root: "../../shared/applicability" |
| 24 | cpes: |
| 25 | - openembedded: |
| 26 | - name: "cpe:/o:openembedded" |
| 27 | + name: "cpe:/o:openembedded:nodistro:" |
| 28 | title: "OpenEmbedded nodistro" |
| 29 | check_id: installed_OS_is_openembedded |
| 30 | + |
| 31 | + - poky: |
| 32 | + name: "cpe:/o:openembedded:poky:" |
| 33 | + title: "OpenEmbedded Poky reference distribution" |
| 34 | + check_id: installed_OS_is_poky |
| 35 | diff --git a/products/openembedded/transforms/constants.xslt b/products/openembedded/transforms/constants.xslt |
| 36 | index 85e812a7c1..8901def2f9 100644 |
| 37 | --- a/products/openembedded/transforms/constants.xslt |
| 38 | +++ b/products/openembedded/transforms/constants.xslt |
| 39 | @@ -2,8 +2,8 @@ |
| 40 | |
| 41 | <xsl:include href="../../../shared/transforms/shared_constants.xslt"/> |
| 42 | |
| 43 | -<xsl:variable name="product_long_name">OpenEmbedded nodistro</xsl:variable> |
| 44 | -<xsl:variable name="product_short_name">OE nodistro</xsl:variable> |
| 45 | +<xsl:variable name="product_long_name">OpenEmbedded based distribution</xsl:variable> |
| 46 | +<xsl:variable name="product_short_name">OE distros</xsl:variable> |
| 47 | <xsl:variable name="product_stig_id_name">empty</xsl:variable> |
| 48 | <xsl:variable name="prod_type">openembedded</xsl:variable> |
| 49 | |
| 50 | diff --git a/shared/checks/oval/installed_OS_is_poky.xml b/shared/checks/oval/installed_OS_is_poky.xml |
| 51 | new file mode 100644 |
| 52 | index 0000000000..9c41acd786 |
| 53 | --- /dev/null |
| 54 | +++ b/shared/checks/oval/installed_OS_is_poky.xml |
| 55 | @@ -0,0 +1,33 @@ |
| 56 | +<def-group> |
| 57 | + <definition class="inventory" id="installed_OS_is_poky" version="1"> |
| 58 | + <metadata> |
| 59 | + <title>Poky</title> |
| 60 | + <affected family="unix"> |
| 61 | + <platform>multi_platform_all</platform> |
| 62 | + </affected> |
| 63 | + <description>The operating system installed is a Poky referenece based System</description> |
| 64 | + </metadata> |
| 65 | + <criteria comment="System is Poky reference distribution" operator="AND"> |
| 66 | + <extend_definition comment="Installed OS is part of the Unix family" definition_ref="installed_OS_is_part_of_Unix_family" /> |
| 67 | + <criterion comment="Poky based distro" test_ref="test_os_release_poky" /> |
| 68 | + <criterion comment="Poky referenece distribution is installed" test_ref="test_poky" /> |
| 69 | + </criteria> |
| 70 | + </definition> |
| 71 | + |
| 72 | + <unix:file_test check="all" check_existence="all_exist" comment="/etc/os-release exists" id="test_os_release_poky" version="1"> |
| 73 | + <unix:object object_ref="obj_os_release_poky" /> |
| 74 | + </unix:file_test> |
| 75 | + <unix:file_object comment="check /etc/os-release file" id="obj_os_release_poky" version="1"> |
| 76 | + <unix:filepath>/etc/os-release</unix:filepath> |
| 77 | + </unix:file_object> |
| 78 | + |
| 79 | + <ind:textfilecontent54_test check="all" check_existence="at_least_one_exists" comment="Check OpenEmbedded" id="test_poky" version="1"> |
| 80 | + <ind:object object_ref="obj_poky" /> |
| 81 | + </ind:textfilecontent54_test> |
| 82 | + <ind:textfilecontent54_object id="obj_poky" version="1" comment="Check Poky"> |
| 83 | + <ind:filepath>/etc/os-release</ind:filepath> |
| 84 | + <ind:pattern operation="pattern match">^ID=poky$</ind:pattern> |
| 85 | + <ind:instance datatype="int">1</ind:instance> |
| 86 | + </ind:textfilecontent54_object> |
| 87 | + |
| 88 | +</def-group> |
| 89 | -- |
| 90 | 2.34.1 |
| 91 | |