summaryrefslogtreecommitdiffstats
path: root/meta-security-compliance/recipes-openscap/oe-scap/files/oval-to-xccdf.xslt
diff options
context:
space:
mode:
Diffstat (limited to 'meta-security-compliance/recipes-openscap/oe-scap/files/oval-to-xccdf.xslt')
-rw-r--r--meta-security-compliance/recipes-openscap/oe-scap/files/oval-to-xccdf.xslt72
1 files changed, 72 insertions, 0 deletions
diff --git a/meta-security-compliance/recipes-openscap/oe-scap/files/oval-to-xccdf.xslt b/meta-security-compliance/recipes-openscap/oe-scap/files/oval-to-xccdf.xslt
new file mode 100644
index 0000000..2243ac4
--- /dev/null
+++ b/meta-security-compliance/recipes-openscap/oe-scap/files/oval-to-xccdf.xslt
@@ -0,0 +1,72 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright 2012 Red Hat Inc., Durham, North Carolina. All Rights Reserved.
3
4This transformation is free software; you can redistribute it and/or modify
5it under the terms of the GNU Lesser General Public License as published by
6the Free Software Foundation; either version 2.1 of the License.
7
8This transformation is distributed in the hope that it will be useful, but
9WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11for more details.
12
13You should have received a copy of the GNU Lesser General Public License along
14with this library; if not, write to the Free Software Foundation, Inc., 59
15Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17Authors:
18 Šimon Lukašík <slukasik@redhat.com>
19-->
20<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
21 xmlns:xccdf="http://checklists.nist.gov/xccdf/1.1"
22 xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5"
23 xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5">
24 <xsl:output method="xml" encoding="UTF-8"/>
25
26 <xsl:template match="/">
27 <xccdf:Benchmark id="generated-xccdf" resolved="1">
28 <xccdf:status>incomplete</xccdf:status>
29 <xccdf:title>
30 <xsl:text>Automatically generated XCCDF from OVAL file: </xsl:text>
31 <xsl:value-of select="$ovalfile"/>
32 </xccdf:title>
33 <xccdf:description>This file has been generated automatically from oval definitions file.</xccdf:description>
34 <xccdf:version>
35 <xsl:attribute name="time">
36 <xsl:value-of select="normalize-space(oval-def:oval_definitions/oval-def:generator/oval:timestamp[1]/text())"/>
37 </xsl:attribute>
38 <xsl:text>None, generated from OVAL file.</xsl:text>
39 </xccdf:version>
40 <xsl:apply-templates select="oval-def:oval_definitions/oval-def:definitions/oval-def:definition"/>
41 </xccdf:Benchmark>
42 </xsl:template>
43
44 <xsl:template match="oval-def:definition">
45 <xccdf:Rule selected="true">
46 <xsl:attribute name="id">
47 <xsl:value-of select="translate(@id,':','-')"/>
48 </xsl:attribute>
49 <xccdf:title>
50 <xsl:copy-of select="oval-def:metadata/oval-def:title/text()"/>
51 </xccdf:title>
52 <xsl:apply-templates select="oval-def:metadata/oval-def:advisory/oval-def:cve"/>
53 <xccdf:check system="http://oval.mitre.org/XMLSchema/oval-definitions-5">
54 <xccdf:check-content-ref href="file">
55 <xsl:attribute name="name">
56 <xsl:value-of select="@id"/>
57 </xsl:attribute>
58 <xsl:attribute name="href">
59 <xsl:value-of select="$ovalfile"/>
60 </xsl:attribute>
61 </xccdf:check-content-ref>
62 </xccdf:check>
63 </xccdf:Rule>
64 </xsl:template>
65
66 <xsl:template match="oval-def:cve">
67 <xccdf:ident system="http://cve.mitre.org">
68 <xsl:copy-of select="text()"/>
69 </xccdf:ident>
70 </xsl:template>
71</xsl:stylesheet>
72