|
|
f8d3e0 |
From 5f0a9033b466d929613a2a55a1524ec75c09b5b0 Mon Sep 17 00:00:00 2001
|
|
|
f8d3e0 |
From: Evgeny Kolesnikov <ekolesni@redhat.com>
|
|
|
f8d3e0 |
Date: Thu, 6 May 2021 08:14:12 +0200
|
|
|
f8d3e0 |
Subject: [PATCH] Introduce OSBuild Blueprint fix type
|
|
|
f8d3e0 |
|
|
|
f8d3e0 |
---
|
|
|
f8d3e0 |
utils/oscap-xccdf.c | 7 +++++--
|
|
|
f8d3e0 |
utils/oscap.8 | 2 +-
|
|
|
f8d3e0 |
xsl/xccdf-share.xsl | 1 +
|
|
|
f8d3e0 |
3 files changed, 7 insertions(+), 3 deletions(-)
|
|
|
f8d3e0 |
|
|
|
f8d3e0 |
diff --git a/utils/oscap-xccdf.c b/utils/oscap-xccdf.c
|
|
|
f8d3e0 |
index 95c1c7658d..801e54fa35 100644
|
|
|
f8d3e0 |
--- a/utils/oscap-xccdf.c
|
|
|
f8d3e0 |
+++ b/utils/oscap-xccdf.c
|
|
|
f8d3e0 |
@@ -275,7 +275,8 @@ static struct oscap_module XCCDF_GEN_FIX = {
|
|
|
f8d3e0 |
.usage = "[options] xccdf-file.xml",
|
|
|
f8d3e0 |
.help = GEN_OPTS
|
|
|
f8d3e0 |
"\nFix Options:\n"
|
|
|
f8d3e0 |
- " --fix-type <type> - Fix type. Should be one of: bash, ansible, puppet, anaconda (default: bash).\n"
|
|
|
f8d3e0 |
+ " --fix-type <type> - Fix type. Should be one of: bash, ansible, puppet, anaconda, ignition, kubernetes,\n"
|
|
|
f8d3e0 |
+ " blueprint (default: bash).\n"
|
|
|
f8d3e0 |
" --output <file> - Write the script into file.\n"
|
|
|
f8d3e0 |
" --result-id <id> - Fixes will be generated for failed rule-results of the specified TestResult.\n"
|
|
|
f8d3e0 |
" --template <id|filename> - Fix template. (default: bash)\n"
|
|
|
f8d3e0 |
@@ -887,10 +888,12 @@ int app_generate_fix(const struct oscap_action *action)
|
|
|
f8d3e0 |
template = "urn:xccdf:fix:script:ignition";
|
|
|
f8d3e0 |
} else if (strcmp(action->fix_type, "kubernetes") == 0) {
|
|
|
f8d3e0 |
template = "urn:xccdf:fix:script:kubernetes";
|
|
|
f8d3e0 |
+ } else if (strcmp(action->fix_type, "blueprint") == 0) {
|
|
|
f8d3e0 |
+ template = "urn:redhat:osbuild:blueprint";
|
|
|
f8d3e0 |
} else {
|
|
|
f8d3e0 |
fprintf(stderr,
|
|
|
f8d3e0 |
"Unknown fix type '%s'.\n"
|
|
|
f8d3e0 |
- "Please provide one of: bash, ansible, puppet, anaconda, ignition, kubernetes.\n"
|
|
|
f8d3e0 |
+ "Please provide one of: bash, ansible, puppet, anaconda, ignition, kubernetes, blueprint.\n"
|
|
|
f8d3e0 |
"Or provide a custom template using '--template' instead.\n",
|
|
|
f8d3e0 |
action->fix_type);
|
|
|
f8d3e0 |
return OSCAP_ERROR;
|
|
|
f8d3e0 |
diff --git a/utils/oscap.8 b/utils/oscap.8
|
|
|
f8d3e0 |
index 240b829d7b..6cae0ffe8a 100644
|
|
|
f8d3e0 |
--- a/utils/oscap.8
|
|
|
f8d3e0 |
+++ b/utils/oscap.8
|
|
|
f8d3e0 |
@@ -395,7 +395,7 @@ Result-oriented fixes are generated using result-id provided to select only the
|
|
|
f8d3e0 |
Profile-oriented fixes are generated using all rules within the provided profile. If no result-id/profile are provided, (default) profile will be used to generate fixes.
|
|
|
f8d3e0 |
.TP
|
|
|
f8d3e0 |
\fB\-\-fix-type TYPE\fR
|
|
|
f8d3e0 |
-Specify fix type. There are multiple programming languages in which the fix script can be generated. TYPE should be one of: bash, ansible, puppet, anaconda, ignition, kubernetes. Default is bash. This option is mutually exclusive with --template, because fix type already determines the template URN.
|
|
|
f8d3e0 |
+Specify fix type. There are multiple programming languages in which the fix script can be generated. TYPE should be one of: bash, ansible, puppet, anaconda, ignition, kubernetes, blueprint. Default is bash. This option is mutually exclusive with --template, because fix type already determines the template URN.
|
|
|
f8d3e0 |
.TP
|
|
|
f8d3e0 |
\fB\-\-output FILE\fR
|
|
|
f8d3e0 |
Write the report to this file instead of standard output.
|
|
|
f8d3e0 |
diff --git a/xsl/xccdf-share.xsl b/xsl/xccdf-share.xsl
|
|
|
f8d3e0 |
index 9f8e587676..d7a9f3b7e2 100644
|
|
|
f8d3e0 |
--- a/xsl/xccdf-share.xsl
|
|
|
f8d3e0 |
+++ b/xsl/xccdf-share.xsl
|
|
|
f8d3e0 |
@@ -295,6 +295,7 @@ Authors:
|
|
|
f8d3e0 |
<xsl:when test="$fix/@system = 'urn:xccdf:fix:script:puppet'">Puppet snippet</xsl:when>
|
|
|
f8d3e0 |
<xsl:when test="$fix/@system = 'urn:redhat:anaconda:pre'">Anaconda snippet</xsl:when>
|
|
|
f8d3e0 |
<xsl:when test="$fix/@system = 'urn:xccdf:fix:script:kubernetes'">Kubernetes snippet</xsl:when>
|
|
|
f8d3e0 |
+ <xsl:when test="$fix/@system = 'urn:redhat:osbuild:blueprint'">OSBuild Blueprint snippet</xsl:when>
|
|
|
f8d3e0 |
<xsl:otherwise>script</xsl:otherwise>
|
|
|
f8d3e0 |
</xsl:choose>
|
|
|
f8d3e0 |
</xsl:variable>
|