Remediation scripts are a mix of Bash and Ansible code
The Bash remediation script, generated from SSG Datastream, contains both Ansible and Bash code.
That means the script cannot be run!
I use this command:
oscap xccdf generate fix --profile xccdf_org.ssgproject.content_profile_common ../scap-security-guide-0.1.34/ssg-fedora-ds.xml > fix.sh
See the attached file fix.sh.zip
I used OpenSCAP build from current upstream head, and SSG 0.1.34 from tarball downloaded from GitHub. The issue is reproducible with openscap-1.2.14-1.fc24.x86_64 as well.
bash fix.sh
Remediating rule 1/74: 'xccdf_org.ssgproject.content_rule_ensure_gpgcheck_globally_activated'
fix.sh: line 24: -: command not found
fix.sh: line 25: stat:: command not found
fix.sh: line 26: path:: command not found
fix.sh: line 27: register:: command not found
fix.sh: line 28: check_mode:: command not found
......
.....
If --template is specified, the issue doesn't happen. But if no --template is provided, it simply takes the last <xccdf:fix>, no matter what language is it. That's wrong. It should take bash as default.
@jan-cerny See PR https://github.com/OpenSCAP/openscap/pull/777
@kjankov @jan-cerny offered a fix in #776 , it looks like your fix is a duplicate.
Fixed in https://github.com/OpenSCAP/openscap/commit/a6c35af3f8cbb19f799323a912d816d6e13b6a31