Skip to content

XCCDF -> Inspec is not processing text with \) correctly #78

Open
@rlakey

Description

@rlakey

When running saf generate xccdf_benchmark2inspec_stub from saf cli we are seeing some issues with some content that contains parenthesis that are inside the %q() syntax.

For example given this original check text:

At the command prompt, run the following command:

# /opt/vmware/sbin/vami-lighttpd -p -f /opt/vmware/etc/lighttpd/lighttpd.conf 2>/dev/null|awk '/server\.modules/,/\)/'|grep mod_accesslog

Expected result:

"mod_accesslog",

If the output does not match the expected result, this is a finding.

Note: The command must be run from a bash shell and not from a shell generated by the "appliance shell". Use the "chsh" command to change the shell for the account to "/bin/bash". Refer to KB Article 2100508 for more details:

https://kb.vmware.com/s/article/2100508

The conversion is adding an additional \ before the ) in the command which is causing the quoting to break and produce invalid content like in this screenshot.

image

If i remove the added \ it is fine or if i change the delimeter from () to {} or [] it works but that still leaves the undesirable added \ which changes the command in the text and causes it to break if people try to copy it out of the InSpec text and run it.

I attached the source XCCDF for this to reproduce it if you take the U_VMware_vSphere_8_vCenter_Appliance_VAMI_STIG_Readiness_Guide_V1R2-xccdf.xml file from the zip.

U_VMware_vSphere_8_STIG_Readiness_Guide_v1r2.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions