forked from OpenSCAP/openscap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OpenSCAP#1441 from evgenyz/test_offline_remediations
Add test that ensures there is no remediation attempt in the "offline" mode
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
. $builddir/tests/test_common.sh | ||
|
||
set -e -o pipefail | ||
|
||
name=$(basename $0 .sh) | ||
result=$(mktemp -t ${name}.res.XXXXXX) | ||
stderr=$(mktemp -t ${name}.err.XXXXXX) | ||
stdout=$(mktemp -t ${name}.out.XXXXXX) | ||
root=$(mktemp -d -t ${name}.root.XXXXXX) | ||
|
||
set_chroot_offline_test_mode "$root" | ||
|
||
$OSCAP xccdf eval --remediate --results $result $srcdir/${name}.xccdf.xml 2> $stderr 1> $stdout || echo "Scanner returned non-zero code (OK)" | ||
rm $result | ||
|
||
grep "remediation in offline mode: not implemented" $stderr > /dev/null | ||
|
||
rm -rf $stderr $stdout $root | ||
|
||
unset_chroot_offline_test_mode |
15 changes: 15 additions & 0 deletions
15
tests/API/XCCDF/unittests/test_remediation_offline.xccdf.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Benchmark xmlns="http://checklists.nist.gov/xccdf/1.2" id="xccdf_moc.elpmaxe.www_benchmark_test"> | ||
<status>accepted</status> | ||
<version>1.0</version> | ||
<Rule selected="true" id="xccdf_moc.elpmaxe.www_rule_1"> | ||
<title>Ensure that file exists and it is not executable</title> | ||
<fix system="urn:xccdf:fix:script:sh"> | ||
touch test_file | ||
chmod a-x test_file | ||
</fix> | ||
<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5"> | ||
<check-content-ref href="test_remediation_simple.oval.xml" name="oval:moc.elpmaxe.www:def:1"/> | ||
</check> | ||
</Rule> | ||
</Benchmark> |