[PATCH 1/2] added new transform to reformat our XCCDF into STIG-like structure

Jeffrey Blank blank at eclipse.ncsc.mil
Fri Jul 6 22:20:55 UTC 2012


This is incomplete.  For now, it merely adds a CCI to those items
which do not yet have one.

In the future, this transform will strip out all Rules which are not part of the
STIG profile, and also restructure the entire document as a list
of Groups, each of which contains one Rule.

Signed-off-by: Jeffrey Blank <blank at eclipse.ncsc.mil>
---
 rhel6/src/transforms/xccdf2stigformat.xslt |   35 ++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 rhel6/src/transforms/xccdf2stigformat.xslt

diff --git a/rhel6/src/transforms/xccdf2stigformat.xslt b/rhel6/src/transforms/xccdf2stigformat.xslt
new file mode 100644
index 0000000..4f472c2
--- /dev/null
+++ b/rhel6/src/transforms/xccdf2stigformat.xslt
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xccdf="http://checklists.nist.gov/xccdf/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xccdf">
+
+<!-- This transform transforms that project's main XCCDF content 
+     into the format expected in a DISA STIG. -->
+
+
+<xsl:include href="constants.xslt"/>
+
+
+  <xsl:template match="xccdf:Rule">
+    <xsl:copy>
+	  <!-- deal with oscap element ordering pickiness -->
+      <xsl:apply-templates select="@*|node()[not(self::xccdf:rationale|self::xccdf:ident|self::xccdf:check|self::xccdf:fix)]"/>
+	    <!-- insert CCI 336 if no other CCI is referenced --> 
+        <xsl:if test="not(xccdf:reference[@href=$disa-cciuri])">
+          <xsl:element name="reference" namespace="http://checklists.nist.gov/xccdf/1.1">
+          <xsl:attribute name="href"><xsl:value-of select="$disa-cciuri"/></xsl:attribute>
+          <xsl:text>366</xsl:text>
+          </xsl:element>
+        </xsl:if>
+
+      <xsl:apply-templates select="node()[self::xccdf:rationale|self::xccdf:ident|self::xccdf:check|self::xccdf:fix]"/>
+    </xsl:copy>
+  </xsl:template>
+
+
+  <!-- copy everything else through to final output -->
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()" />
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>
-- 
1.7.1



More information about the scap-security-guide mailing list