Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ set(SSG_BUILD_SCRIPTS "${CMAKE_SOURCE_DIR}/build-scripts")
set(SSG_JINJA2_CACHE_DIR "${CMAKE_BINARY_DIR}/jinja2_cache" CACHE PATH "Where the jinja2 cached bytecode should be stored. This speeds up builds at the expense of disk space. You can use one location for multiple SSG builds for performance improvements.")
set(SSG_SHARED "${CMAKE_SOURCE_DIR}/shared")
set(SSG_SHARED_REFS "${SSG_SHARED}/references")
set(SSG_SHARED_TRANSFORMS "${SSG_SHARED}/transforms")
set(SSG_UTILS_SCRIPTS "${CMAKE_SOURCE_DIR}/utils")

# Content Generation Opetions
Expand Down
9 changes: 3 additions & 6 deletions cmake/SSGCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ macro(ssg_build_html_cce_table PRODUCT)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/tables/table-${PRODUCT}-cces.html"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/tables"
COMMAND "${XSLTPROC_EXECUTABLE}" --output "${CMAKE_BINARY_DIR}/tables/table-${PRODUCT}-cces.html" "${CMAKE_CURRENT_SOURCE_DIR}/transforms/xccdf2table-cce.xslt" "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-ds.xml"
COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/utils/gen_cce_table.py" --build-dir "${CMAKE_BINARY_DIR}" "${PRODUCT}" "${CMAKE_BINARY_DIR}/tables/table-${PRODUCT}-cces.html"
DEPENDS generate-ssg-${PRODUCT}-ds.xml "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-ds.xml"
COMMENT "[${PRODUCT}-tables] generating HTML CCE identifiers table"
)
Expand Down Expand Up @@ -1160,9 +1160,8 @@ macro(ssg_build_html_stig_tables PRODUCT)
)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/unlinked-stig-xccdf.xml"
COMMAND "${XSLTPROC_EXECUTABLE}" -stringparam overlay "${CMAKE_BINARY_DIR}/${PRODUCT}/overlays/stig_overlay.xml" --stringparam ocil-document "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-ocil.xml" --output "${CMAKE_CURRENT_BINARY_DIR}/unlinked-stig-xccdf.xml" "${CMAKE_CURRENT_SOURCE_DIR}/transforms/xccdf-apply-overlay-stig.xslt" "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-xccdf.xml"
COMMAND "PYTHONPATH=$ENV{PYTHONPATH}" "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/utils/create_unlinked_stig_xccdf.py" --product-yaml "${CMAKE_CURRENT_BINARY_DIR}/product.yml" --overlay "${CMAKE_CURRENT_BINARY_DIR}/overlays/stig_overlay.xml" --ocil "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-ocil.xml" --xccdf "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-xccdf.xml" --output "${CMAKE_CURRENT_BINARY_DIR}/unlinked-stig-xccdf.xml"
DEPENDS generate-ssg-${PRODUCT}-xccdf.xml "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-xccdf.xml"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/transforms/xccdf-apply-overlay-stig.xslt"
DEPENDS "${CMAKE_BINARY_DIR}/${PRODUCT}/overlays/stig_overlay.xml"
DEPENDS "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-ocil.xml"
COMMENT "[${PRODUCT}-tables] generating unlinked STIG XCCDF XML file"
Expand Down Expand Up @@ -1227,9 +1226,7 @@ macro(ssg_build_html_stig_tables_per_profile PRODUCT STIG_PROFILE)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/tables/table-${PRODUCT}-${STIG_PROFILE}-testinfo.html"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/tables"
COMMAND "${XSLTPROC_EXECUTABLE}" -stringparam profile "${STIG_PROFILE}" -stringparam testinfo "y" -stringparam ocil-document "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-ocil.xml" --output "${CMAKE_BINARY_DIR}/tables/table-${PRODUCT}-${STIG_PROFILE}-testinfo.html" "${CMAKE_CURRENT_SOURCE_DIR}/transforms/xccdf2table-profileccirefs.xslt" "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-xccdf.xml"
DEPENDS "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-ocil.xml"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/transforms/xccdf2table-profileccirefs.xslt"
COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/utils/gen_testinfo_table.py" --build-dir "${CMAKE_BINARY_DIR}" --product "${PRODUCT}" --profile "${STIG_PROFILE}" --output "${CMAKE_BINARY_DIR}/tables/table-${PRODUCT}-${STIG_PROFILE}-testinfo.html"
DEPENDS generate-ssg-${PRODUCT}-xccdf.xml "${CMAKE_BINARY_DIR}/ssg-${PRODUCT}-xccdf.xml"
COMMENT "[${PRODUCT}-tables] generating HTML STIG test info document for ${STIG_PROFILE}"
)
Expand Down
1 change: 0 additions & 1 deletion docs/flowcharts/flowchart_products.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ flowchart TD
65[profile_name.profile] --> |refers to| 66([rules])
65[profile_name.profile] --> |may override| 67[variables]
65[profile_name.profile] --> |may use| 68[controls]
61[product_name] --> |contains| 69[transforms]
61[product_name] --> |may have| 70[kickstart]
61[product_name] --> |may have| 71[checks]
71[checks] --> |instructed using| 72([OVAL + XCCDF])
Expand Down
5 changes: 0 additions & 5 deletions docs/flowcharts/flowchart_shared.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ flowchart TD
39[template_name] --> |may have| 43(processing scripts)
43(processing scripts) --> |written at| 44[template.py]
39[template_name] --> |may have| 45[tests]
30[shared] --> |contains| 46[transforms]
46[transforms] --> |instructed using| 47([XSLT])
47([XSLT]) --> |written at| 48[name.xslt]
46[transforms] --> |contains| 49(scripts)
49(scripts) --> |uses| 50(python or bash)
30[shared] --> |contains| 51[references]
51[references] --> |contains| 52(Available CCEs)
51[references] --> |contains| 53(Misc References)
Expand Down
93 changes: 5 additions & 88 deletions docs/manual/developer/03_creating_content.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,8 @@ For example:
├── kickstart
├── overlays
├── profiles
└── transforms

4 directories
3 directories

#### Product Level Directory Descriptions

Expand All @@ -281,10 +280,6 @@ For example:
<td><p><code>profiles</code></p></td>
<td><p><code>Required</code> Contains profiles that are created and tailored to meet government or commercial compliance standards.</p></td>
</tr>
<tr class="odd">
<td><p><code>transforms</code></p></td>
<td><p><code>Required</code> Contains XSLT files and scripts that are used to transform the content into the expected compliance document such as XCCDF, OVAL, data stream, etc.</p></td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -313,8 +308,7 @@ export NEW_PRODUCT=$NAME$VERSION
export CAPITAL_NAME="CUSTOM"
mkdir $NEW_PRODUCT \
$NEW_PRODUCT/overlays \
$NEW_PRODUCT/profiles \
$NEW_PRODUCT/transforms
$NEW_PRODUCT/profiles
</pre>
2. Add the product to [CMakeLists.txt](https://github.com/ComplianceAsCode/content/blob/master/CMakeLists.txt) by adding the following lines:
<pre>
Expand Down Expand Up @@ -418,7 +412,7 @@ ssg_build_product("$NEW_PRODUCT")
EOF
```

7. Create a new file in the product directory called `product.yml` (note: you may want to change the `pkg_manager` attribute):
6. Create a new file in the product directory called `product.yml` (note: you may want to change the `pkg_manager` attribute):
```
cat << EOF > $NEW_PRODUCT/product.yml
product: $NEW_PRODUCT
Expand Down Expand Up @@ -448,7 +442,7 @@ reference_uris:
EOF
```

8. Create a draft profile under `profiles` directory called `standard.profile`:
7. Create a draft profile under `profiles` directory called `standard.profile`:
```
cat << EOF > $NEW_PRODUCT/profiles/standard.profile
documentation_complete: true
Expand All @@ -465,84 +459,7 @@ selections:
EOF
```

9. Create a new file under `transforms` directory called `constants.xslt` (you may want to review the links below):
```
cat << EOF > $NEW_PRODUCT/transforms/constants.xslt
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:include href="../../../shared/transforms/shared_constants.xslt"/>

<xsl:variable name="product_long_name">$FULL_NAME</xsl:variable>
<xsl:variable name="product_short_name">$FULL_SHORT_NAME</xsl:variable>
<xsl:variable name="product_stig_id_name">${CAPITAL_NAME}_STIG</xsl:variable>
<xsl:variable name="prod_type">$NEW_PRODUCT</xsl:variable>

<!-- Define URI of official Center for Internet Security Benchmark for $FULL_NAME -->
<xsl:variable name="cisuri">https://benchmarks.cisecurity.org/tools2/linux/CIS_${CAMEL_CASE_NAME}_Benchmark_v1.0.pdf</xsl:variable>

<!-- Define URI for custom policy reference which can be used for linking to corporate policy -->
<!--xsl:variable name="custom-ref-uri">https://www.example.org</xsl:variable-->

</xsl:stylesheet>
EOF
```

11. Create a new file under `transforms` directory called `table-style.xslt`:
```
cat << EOF > $NEW_PRODUCT/transforms/table-style.xslt
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:import href="../../../shared/transforms/shared_table-style.xslt"/>

</xsl:stylesheet>
EOF
```

12. Create a new file under `transforms` directory called `xccdf-apply-overlay-stig.xslt`:
```
cat << EOF > $NEW_PRODUCT/transforms/xccdf-apply-overlay-stig.xslt
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://checklists.nist.gov/xccdf/1.1" xmlns:xccdf="http://checklists.nist.gov/xccdf/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xccdf">

<xsl:include href="../../../shared/transforms/shared_xccdf-apply-overlay-stig.xslt"/>
<xsl:include href="constants.xslt"/>
<xsl:variable name="overlays" select="document($overlay)/xccdf:overlays" />

</xsl:stylesheet>
EOF
```

13. Create a new file under `transforms` directory called `xccdf2table-cce.xslt`:
```
cat << EOF > $NEW_PRODUCT/transforms/xccdf2table-cce.xslt
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cce="http://cce.mitre.org" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cdf="http://checklists.nist.gov/xccdf/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml">

<xsl:import href="../../../shared/transforms/shared_xccdf2table-cce.xslt"/>

<xsl:include href="constants.xslt"/>
<xsl:include href="table-style.xslt"/>

</xsl:stylesheet>
EOF
```

14. Create a new file under `transforms` directory called `xccdf2table-profileccirefs.xslt`:
```
cat << EOF > $NEW_PRODUCT/transforms/xccdf2table-profileccirefs.xslt
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cdf="http://checklists.nist.gov/xccdf/1.1" xmlns:cci="https://www.cyber.mil/stigs/cci" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ovalns="http://oval.mitre.org/XMLSchema/oval-definitions-5">

<xsl:import href="../../../shared/transforms/shared_xccdf2table-profileccirefs.xslt"/>

<xsl:include href="constants.xslt"/>
<xsl:include href="table-style.xslt"/>

</xsl:stylesheet>
EOF
```

15. Create a new file under `shared/checks/oval` directory called `installed_OS_is_custom6.xml`:
8. Create a new file under `shared/checks/oval` directory called `installed_OS_is_custom6.xml`:
```
cat << EOF > shared/checks/oval/installed_OS_is_$NEW_PRODUCT.xml
<def-group>
Expand Down
10 changes: 3 additions & 7 deletions docs/manual/developer/06_contributing_with_content.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,9 @@ A rule may contain those reference-type attributes:
for an example of reference-type attributes as there are others that
are not referenced above.

Some of existing rule definitions contain attributes that use macros.
There are two implementations of macros:

- [Jinja macros](http://jinja.pocoo.org/docs/2.10/), that are defined
in `*.jinja` files in `shared/macros` directory.

- Legacy XSLT macros, which are defined in `shared/transforms/*.xslt`.
Some of existing rule definitions contain attributes that use
[Jinja macros](http://jinja.pocoo.org/docs/2.10/), that are defined
in `*.jinja` files in `shared/macros` directory.

For example, the `ocil` attribute of `service_ntpd_enabled` uses the
`ocil_service_enabled` jinja macro. Due to the need of supporting
Expand Down
12 changes: 0 additions & 12 deletions products/al2023/transforms/constants.xslt

This file was deleted.

5 changes: 0 additions & 5 deletions products/al2023/transforms/table-style.xslt

This file was deleted.

9 changes: 0 additions & 9 deletions products/al2023/transforms/xccdf2table-cce.xslt

This file was deleted.

10 changes: 0 additions & 10 deletions products/alinux2/transforms/constants.xslt

This file was deleted.

9 changes: 0 additions & 9 deletions products/alinux2/transforms/shorthand2xccdf.xslt

This file was deleted.

11 changes: 0 additions & 11 deletions products/alinux2/transforms/table-srgmap.xslt

This file was deleted.

5 changes: 0 additions & 5 deletions products/alinux2/transforms/table-style.xslt

This file was deleted.

8 changes: 0 additions & 8 deletions products/alinux2/transforms/xccdf-apply-overlay-stig.xslt

This file was deleted.

9 changes: 0 additions & 9 deletions products/alinux2/transforms/xccdf2table-cce.xslt

This file was deleted.

9 changes: 0 additions & 9 deletions products/alinux2/transforms/xccdf2table-profileccirefs.xslt

This file was deleted.

10 changes: 0 additions & 10 deletions products/alinux3/transforms/constants.xslt

This file was deleted.

9 changes: 0 additions & 9 deletions products/alinux3/transforms/shorthand2xccdf.xslt

This file was deleted.

11 changes: 0 additions & 11 deletions products/alinux3/transforms/table-srgmap.xslt

This file was deleted.

5 changes: 0 additions & 5 deletions products/alinux3/transforms/table-style.xslt

This file was deleted.

8 changes: 0 additions & 8 deletions products/alinux3/transforms/xccdf-apply-overlay-stig.xslt

This file was deleted.

9 changes: 0 additions & 9 deletions products/alinux3/transforms/xccdf2table-cce.xslt

This file was deleted.

9 changes: 0 additions & 9 deletions products/alinux3/transforms/xccdf2table-profileccirefs.xslt

This file was deleted.

12 changes: 0 additions & 12 deletions products/almalinux9/transforms/constants.xslt

This file was deleted.

5 changes: 0 additions & 5 deletions products/almalinux9/transforms/table-style.xslt

This file was deleted.

Loading
Loading