Skip to content

Commit

Permalink
Merge pull request #2081 from evgenyz/fix-blueprint-template
Browse files Browse the repository at this point in the history
Fix Blueprint template to be self-contained
  • Loading branch information
jan-cerny authored Feb 21, 2024
2 parents c9a1049 + 0933cfe commit 7b45a7e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/XCCDF_POLICY/xccdf_policy_remediate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,10 +1143,15 @@ static int _write_script_header_to_fd(struct xccdf_policy *policy, struct xccdf_
} else if (oscap_streq(sys, "urn:redhat:osbuild:blueprint")) {
char *blueprint_fix_header = oscap_sprintf(
"%s"
"name = \"%s\"\n"
"name = \"hardened_%s\"\n"
"description = \"%s\"\n"
"version = \"%s\"\n",
fix_header, profile_id, profile_title, benchmark_version_info);
"version = \"%s\"\n\n"
"[customizations.openscap]\n"
"profile_id = \"%s\"\n"
"# If your hardening data stream is not part of the 'scap-security-guide' package\n"
"# provide the absolute path to it (from the root of the image filesystem).\n"
"# datastream = \"/usr/share/xml/scap/ssg/content/ssg-xxxxx-ds.xml\"\n\n",
fix_header, profile_id, profile_title, benchmark_version_info, profile_id);
free(fix_header);
free(profile_title);
return _write_text_to_fd_and_free(output_fd, blueprint_fix_header);
Expand Down
9 changes: 8 additions & 1 deletion tests/API/XCCDF/unittests/test_remediation_blueprint.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@
#
###############################################################################

name = "xccdf_moc.elpmaxe.www_profile_common"
name = "hardened_xccdf_moc.elpmaxe.www_profile_common"
description = "Profile title on one line"
version = "1.0"

[customizations.openscap]
profile_id = "xccdf_moc.elpmaxe.www_profile_common"
# If your hardening data stream is not part of the 'scap-security-guide' package
# provide the absolute path to it (from the root of the image filesystem).
# datastream = "/usr/share/xml/scap/ssg/content/ssg-xxxxx-ds.xml"

distro = rhel-80

[[packages]]
Expand Down

0 comments on commit 7b45a7e

Please sign in to comment.