diff options
| author | Armin Kuster <akuster808@gmail.com> | 2023-06-13 15:10:36 -0400 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2023-06-20 11:07:20 -0400 |
| commit | c4c7592dcbea0b1803b8b0b272e9b1c1c07992e4 (patch) | |
| tree | d2c98701c1db0c1f817b04febc052e55316dfdef | |
| parent | 49de76c98020d69642774f58cf7dcb8e76692a96 (diff) | |
| download | meta-security-c4c7592dcbea0b1803b8b0b272e9b1c1c07992e4.tar.gz | |
scap-security-guide: add OE support
Signed-off-by: Armin Kuster <akuster808@gmail.com>
| -rw-r--r-- | recipes-compliance/scap-security-guide/files/0001-scap-security-guide-add-openembedded.patch | 231 | ||||
| -rw-r--r-- | recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb | 13 |
2 files changed, 235 insertions, 9 deletions
diff --git a/recipes-compliance/scap-security-guide/files/0001-scap-security-guide-add-openembedded.patch b/recipes-compliance/scap-security-guide/files/0001-scap-security-guide-add-openembedded.patch new file mode 100644 index 0000000..f003f72 --- /dev/null +++ b/recipes-compliance/scap-security-guide/files/0001-scap-security-guide-add-openembedded.patch | |||
| @@ -0,0 +1,231 @@ | |||
| 1 | From f6287d146762b8360bd7099f4724a58eedba7d2a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Armin Kuster <akuster808@gmail.com> | ||
| 3 | Date: Wed, 14 Jun 2023 07:46:55 -0400 | ||
| 4 | Subject: [PATCH] scap-security-guide: add openembedded | ||
| 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 | CMakeLists.txt | 5 +++ | ||
| 13 | build_product | 1 + | ||
| 14 | products/openembedded/CMakeLists.txt | 6 ++++ | ||
| 15 | products/openembedded/product.yml | 19 +++++++++++ | ||
| 16 | .../openembedded/profiles/standard.profile | 12 +++++++ | ||
| 17 | .../openembedded/transforms/constants.xslt | 10 ++++++ | ||
| 18 | .../oval/installed_OS_is_openembedded.xml | 33 +++++++++++++++++++ | ||
| 19 | .../oval/sysctl_kernel_ipv6_disable.xml | 1 + | ||
| 20 | ssg/constants.py | 5 ++- | ||
| 21 | 9 files changed, 91 insertions(+), 1 deletion(-) | ||
| 22 | create mode 100644 products/openembedded/CMakeLists.txt | ||
| 23 | create mode 100644 products/openembedded/product.yml | ||
| 24 | create mode 100644 products/openembedded/profiles/standard.profile | ||
| 25 | create mode 100644 products/openembedded/transforms/constants.xslt | ||
| 26 | create mode 100644 shared/checks/oval/installed_OS_is_openembedded.xml | ||
| 27 | |||
| 28 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 29 | index 85ec289644..09ac96784e 100644 | ||
| 30 | --- a/CMakeLists.txt | ||
| 31 | +++ b/CMakeLists.txt | ||
| 32 | @@ -95,6 +95,7 @@ option(SSG_PRODUCT_UBUNTU1804 "If enabled, the Ubuntu 18.04 SCAP content will be | ||
| 33 | option(SSG_PRODUCT_UBUNTU2004 "If enabled, the Ubuntu 20.04 SCAP content will be built" ${SSG_PRODUCT_DEFAULT}) | ||
| 34 | option(SSG_PRODUCT_UBUNTU2204 "If enabled, the Ubuntu 22.04 SCAP content will be built" ${SSG_PRODUCT_DEFAULT}) | ||
| 35 | option(SSG_PRODUCT_UOS20 "If enabled, the Uos 20 SCAP content will be built" ${SSG_PRODUCT_DEFAULT}) | ||
| 36 | +option(SSG_PRODUCT_OE "If enabled, the OpenEmbedded SCAP content will be built" ${SSG_PRODUCT_DEFAULT}) | ||
| 37 | |||
| 38 | |||
| 39 | option(SSG_CENTOS_DERIVATIVES_ENABLED "If enabled, CentOS derivative content will be built from the RHEL content" TRUE) | ||
| 40 | @@ -289,6 +290,7 @@ message(STATUS "Ubuntu 18.04: ${SSG_PRODUCT_UBUNTU1804}") | ||
| 41 | message(STATUS "Ubuntu 20.04: ${SSG_PRODUCT_UBUNTU2004}") | ||
| 42 | message(STATUS "Ubuntu 22.04: ${SSG_PRODUCT_UBUNTU2204}") | ||
| 43 | message(STATUS "Uos 20: ${SSG_PRODUCT_UOS20}") | ||
| 44 | +message(STATUS "OpenEmbedded nodistro: ${SSG_PRODUCT_OE}") | ||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | @@ -410,6 +412,9 @@ endif() | ||
| 49 | if (SSG_PRODUCT_UOS20) | ||
| 50 | add_subdirectory("products/uos20" "uos20") | ||
| 51 | endif() | ||
| 52 | +if (SSG_PRODUCT_OE) | ||
| 53 | + add_subdirectory("products/openembedded" "openembedded") | ||
| 54 | +endif() | ||
| 55 | |||
| 56 | # ZIP only contains source datastreams and kickstarts, people who | ||
| 57 | # want sources to build from should get the tarball instead. | ||
| 58 | diff --git a/build_product b/build_product | ||
| 59 | index fc793cbe70..197d925b7e 100755 | ||
| 60 | --- a/build_product | ||
| 61 | +++ b/build_product | ||
| 62 | @@ -333,6 +333,7 @@ all_cmake_products=( | ||
| 63 | UBUNTU2204 | ||
| 64 | UOS20 | ||
| 65 | MACOS1015 | ||
| 66 | + OPENEMBEDDED | ||
| 67 | ) | ||
| 68 | |||
| 69 | DEFAULT_OVAL_MAJOR_VERSION=5 | ||
| 70 | diff --git a/products/openembedded/CMakeLists.txt b/products/openembedded/CMakeLists.txt | ||
| 71 | new file mode 100644 | ||
| 72 | index 0000000000..1981adf53e | ||
| 73 | --- /dev/null | ||
| 74 | +++ b/products/openembedded/CMakeLists.txt | ||
| 75 | @@ -0,0 +1,6 @@ | ||
| 76 | +# Sometimes our users will try to do: "cd openembedded; cmake ." That needs to error in a nice way. | ||
| 77 | +if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") | ||
| 78 | + message(FATAL_ERROR "cmake has to be used on the root CMakeLists.txt, see the Building ComplianceAsCode section in the Developer Guide!") | ||
| 79 | +endif() | ||
| 80 | + | ||
| 81 | +ssg_build_product("openembedded") | ||
| 82 | diff --git a/products/openembedded/product.yml b/products/openembedded/product.yml | ||
| 83 | new file mode 100644 | ||
| 84 | index 0000000000..9f2f12d737 | ||
| 85 | --- /dev/null | ||
| 86 | +++ b/products/openembedded/product.yml | ||
| 87 | @@ -0,0 +1,19 @@ | ||
| 88 | +product: openembedded | ||
| 89 | +full_name: OpemEmbedded | ||
| 90 | +type: platform | ||
| 91 | + | ||
| 92 | +benchmark_id: OPENEMBEDDED | ||
| 93 | +benchmark_root: "../../linux_os/guide" | ||
| 94 | + | ||
| 95 | +profiles_root: "./profiles" | ||
| 96 | + | ||
| 97 | +pkg_manager: "dnf" | ||
| 98 | + | ||
| 99 | +init_system: "systemd" | ||
| 100 | + | ||
| 101 | +cpes_root: "../../shared/applicability" | ||
| 102 | +cpes: | ||
| 103 | + - openembedded: | ||
| 104 | + name: "cpe:/o:openembedded" | ||
| 105 | + title: "OpenEmbedded nodistro" | ||
| 106 | + check_id: installed_OS_is_openembedded | ||
| 107 | diff --git a/products/openembedded/profiles/standard.profile b/products/openembedded/profiles/standard.profile | ||
| 108 | new file mode 100644 | ||
| 109 | index 0000000000..44339d716c | ||
| 110 | --- /dev/null | ||
| 111 | +++ b/products/openembedded/profiles/standard.profile | ||
| 112 | @@ -0,0 +1,12 @@ | ||
| 113 | +documentation_complete: true | ||
| 114 | + | ||
| 115 | +title: 'Sample Security Profile for OpenEmbedded Distros' | ||
| 116 | + | ||
| 117 | +description: |- | ||
| 118 | + This profile is an sample for use in documentation and example content. | ||
| 119 | + The selected rules are standard and should pass quickly on most systems. | ||
| 120 | + | ||
| 121 | +selections: | ||
| 122 | + - file_owner_etc_passwd | ||
| 123 | + - file_groupowner_etc_passwd | ||
| 124 | + - file_permissions_etc_passwd | ||
| 125 | diff --git a/products/openembedded/transforms/constants.xslt b/products/openembedded/transforms/constants.xslt | ||
| 126 | new file mode 100644 | ||
| 127 | index 0000000000..85e812a7c1 | ||
| 128 | --- /dev/null | ||
| 129 | +++ b/products/openembedded/transforms/constants.xslt | ||
| 130 | @@ -0,0 +1,10 @@ | ||
| 131 | +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
| 132 | + | ||
| 133 | +<xsl:include href="../../../shared/transforms/shared_constants.xslt"/> | ||
| 134 | + | ||
| 135 | +<xsl:variable name="product_long_name">OpenEmbedded nodistro</xsl:variable> | ||
| 136 | +<xsl:variable name="product_short_name">OE nodistro</xsl:variable> | ||
| 137 | +<xsl:variable name="product_stig_id_name">empty</xsl:variable> | ||
| 138 | +<xsl:variable name="prod_type">openembedded</xsl:variable> | ||
| 139 | + | ||
| 140 | +</xsl:stylesheet> | ||
| 141 | diff --git a/shared/checks/oval/installed_OS_is_openembedded.xml b/shared/checks/oval/installed_OS_is_openembedded.xml | ||
| 142 | new file mode 100644 | ||
| 143 | index 0000000000..17c2873686 | ||
| 144 | --- /dev/null | ||
| 145 | +++ b/shared/checks/oval/installed_OS_is_openembedded.xml | ||
| 146 | @@ -0,0 +1,33 @@ | ||
| 147 | +<def-group> | ||
| 148 | + <definition class="inventory" id="installed_OS_is_openembedded" version="1"> | ||
| 149 | + <metadata> | ||
| 150 | + <title>OpenEmbedded</title> | ||
| 151 | + <affected family="unix"> | ||
| 152 | + <platform>multi_platform_all</platform> | ||
| 153 | + </affected> | ||
| 154 | + <description>The operating system installed is an OpenEmbedded System</description> | ||
| 155 | + </metadata> | ||
| 156 | + <criteria comment="System is OpenEmbedded" operator="AND"> | ||
| 157 | + <extend_definition comment="Installed OS is part of the Unix family" definition_ref="installed_OS_is_part_of_Unix_family" /> | ||
| 158 | + <criterion comment="OpenEmbedded distro" test_ref="test_os_release" /> | ||
| 159 | + <criterion comment="OpenEmbedded is installed" test_ref="test_openembedded" /> | ||
| 160 | + </criteria> | ||
| 161 | + </definition> | ||
| 162 | + | ||
| 163 | + <unix:file_test check="all" check_existence="all_exist" comment="/etc/os-release exists" id="test_os_release" version="1"> | ||
| 164 | + <unix:object object_ref="obj_os_release" /> | ||
| 165 | + </unix:file_test> | ||
| 166 | + <unix:file_object comment="check /etc/os-release file" id="obj_os_release" version="1"> | ||
| 167 | + <unix:filepath>/etc/os-release</unix:filepath> | ||
| 168 | + </unix:file_object> | ||
| 169 | + | ||
| 170 | + <ind:textfilecontent54_test check="all" check_existence="at_least_one_exists" comment="Check OpenEmbedded" id="test_openembedded" version="1"> | ||
| 171 | + <ind:object object_ref="obj_openembedded" /> | ||
| 172 | + </ind:textfilecontent54_test> | ||
| 173 | + <ind:textfilecontent54_object id="obj_openembedded" version="1" comment="Check OpenEmbedded"> | ||
| 174 | + <ind:filepath>/etc/os-release</ind:filepath> | ||
| 175 | + <ind:pattern operation="pattern match">^ID=nodistro$</ind:pattern> | ||
| 176 | + <ind:instance datatype="int">1</ind:instance> | ||
| 177 | + </ind:textfilecontent54_object> | ||
| 178 | + | ||
| 179 | +</def-group> | ||
| 180 | diff --git a/shared/checks/oval/sysctl_kernel_ipv6_disable.xml b/shared/checks/oval/sysctl_kernel_ipv6_disable.xml | ||
| 181 | index affb9770cb..4f22df262c 100644 | ||
| 182 | --- a/shared/checks/oval/sysctl_kernel_ipv6_disable.xml | ||
| 183 | +++ b/shared/checks/oval/sysctl_kernel_ipv6_disable.xml | ||
| 184 | @@ -8,6 +8,7 @@ | ||
| 185 | <platform>multi_platform_debian</platform> | ||
| 186 | <platform>multi_platform_example</platform> | ||
| 187 | <platform>multi_platform_fedora</platform> | ||
| 188 | + <platform>multi_platform_openembedded</platform> | ||
| 189 | <platform>multi_platform_opensuse</platform> | ||
| 190 | <platform>multi_platform_ol</platform> | ||
| 191 | <platform>multi_platform_rhcos</platform> | ||
| 192 | diff --git a/ssg/constants.py b/ssg/constants.py | ||
| 193 | index f66ba008fa..630fbdfcb9 100644 | ||
| 194 | --- a/ssg/constants.py | ||
| 195 | +++ b/ssg/constants.py | ||
| 196 | @@ -219,6 +219,7 @@ FULL_NAME_TO_PRODUCT_MAPPING = { | ||
| 197 | "Ubuntu 20.04": "ubuntu2004", | ||
| 198 | "Ubuntu 22.04": "ubuntu2204", | ||
| 199 | "UnionTech OS Server 20": "uos20", | ||
| 200 | + "OpenEmbedded": "openembedded", | ||
| 201 | "Not Applicable" : "example" | ||
| 202 | } | ||
| 203 | |||
| 204 | @@ -267,7 +268,7 @@ REFERENCES = dict( | ||
| 205 | |||
| 206 | MULTI_PLATFORM_LIST = ["rhel", "fedora", "rhv", "debian", "ubuntu", | ||
| 207 | "opensuse", "sle", "ol", "ocp", "rhcos", | ||
| 208 | - "example", "eks", "alinux", "uos", "anolis"] | ||
| 209 | + "example", "eks", "alinux", "uos", "anolis", "openembedded"] | ||
| 210 | |||
| 211 | MULTI_PLATFORM_MAPPING = { | ||
| 212 | "multi_platform_alinux": ["alinux2", "alinux3"], | ||
| 213 | @@ -285,6 +286,7 @@ MULTI_PLATFORM_MAPPING = { | ||
| 214 | "multi_platform_sle": ["sle12", "sle15"], | ||
| 215 | "multi_platform_ubuntu": ["ubuntu1604", "ubuntu1804", "ubuntu2004", "ubuntu2204"], | ||
| 216 | "multi_platform_uos": ["uos20"], | ||
| 217 | + "multi_platform_openembedded": ["openembedded"], | ||
| 218 | } | ||
| 219 | |||
| 220 | RHEL_CENTOS_CPE_MAPPING = { | ||
| 221 | @@ -454,6 +456,7 @@ MAKEFILE_ID_TO_PRODUCT_MAP = { | ||
| 222 | 'ocp': 'Red Hat OpenShift Container Platform', | ||
| 223 | 'rhcos': 'Red Hat Enterprise Linux CoreOS', | ||
| 224 | 'eks': 'Amazon Elastic Kubernetes Service', | ||
| 225 | + 'openembedded': 'OpenEmbedded', | ||
| 226 | } | ||
| 227 | |||
| 228 | # References that can not be used with product-qualifiers | ||
| 229 | -- | ||
| 230 | 2.34.1 | ||
| 231 | |||
diff --git a/recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb b/recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb index 53ee03e..420a6d8 100644 --- a/recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb +++ b/recipes-compliance/scap-security-guide/scap-security-guide_0.1.67.bb | |||
| @@ -7,25 +7,20 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=9bfa86579213cb4c6adaffface6b2820" | |||
| 7 | LICENSE = "BSD-3-Clause" | 7 | LICENSE = "BSD-3-Clause" |
| 8 | 8 | ||
| 9 | SRCREV = "dad85502ce8da722a6afc391346c41cee61e90a9" | 9 | SRCREV = "dad85502ce8da722a6afc391346c41cee61e90a9" |
| 10 | SRC_URI = "git://github.com/ComplianceAsCode/content.git;branch=master;protocol=https" | 10 | SRC_URI = "git://github.com/ComplianceAsCode/content.git;branch=master;protocol=https \ |
| 11 | file://0001-scap-security-guide-add-openembedded.patch " | ||
| 11 | 12 | ||
| 12 | 13 | ||
| 13 | DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-native expat-native coreutils-native" | 14 | DEPENDS = "openscap-native python3-pyyaml-native python3-jinja2-native libxml2-native expat-native coreutils-native" |
| 14 | 15 | ||
| 15 | S = "${WORKDIR}/git" | 16 | S = "${WORKDIR}/git" |
| 17 | B = "${S}/build" | ||
| 16 | 18 | ||
| 17 | inherit cmake pkgconfig python3native python3targetconfig | 19 | inherit cmake pkgconfig python3native python3targetconfig |
| 18 | 20 | ||
| 19 | STAGING_OSCAP_BUILDDIR = "${TMPDIR}/work-shared/openscap/oscap-build-artifacts" | ||
| 20 | export OSCAP_CPE_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/cpe" | ||
| 21 | export OSCAP_SCHEMA_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/schemas" | ||
| 22 | export OSCAP_XSLT_PATH="${STAGING_OSCAP_BUILDDIR}${datadir_native}/openscap/xsl" | ||
| 23 | |||
| 24 | OECMAKE_GENERATOR = "Unix Makefiles" | 21 | OECMAKE_GENERATOR = "Unix Makefiles" |
| 25 | 22 | ||
| 26 | EXTRA_OECMAKE += "-DENABLE_PYTHON_COVERAGE=OFF -DSSG_PRODUCT_DEFAULT=OFF -DSSG_PRODUCT_EXAMPLE=ON" | 23 | EXTRA_OECMAKE += "-DENABLE_PYTHON_COVERAGE=OFF -DSSG_PRODUCT_DEFAULT=OFF -DSSG_PRODUCT_OE=ON" |
| 27 | |||
| 28 | B = "${S}/build" | ||
| 29 | 24 | ||
| 30 | do_configure[depends] += "openscap-native:do_install" | 25 | do_configure[depends] += "openscap-native:do_install" |
| 31 | 26 | ||
