@@ -7,6 +7,7 @@ set -e -o pipefail
7
7
autotailor=" $top_srcdir /utils/autotailor"
8
8
tailoring=" $( mktemp) "
9
9
ds=" $srcdir /data_stream.xml"
10
+ json_tailoring=" $srcdir /custom.json"
10
11
stdout=" $( mktemp) "
11
12
original_profile=" P1"
12
13
result=" $( mktemp) "
@@ -93,11 +94,33 @@ assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www
93
94
assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="pass"]'
94
95
assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R4"]/result[text()="notselected"]'
95
96
96
- # refine value v1 to 30
97
+ # set value v1 to thirty
97
98
python3 $autotailor --id-namespace " com.example.www" --var-value V1=thirty $ds $original_profile > $tailoring
98
99
$OSCAP xccdf eval --profile P1_customized --progress --tailoring-file $tailoring --results $result $ds
99
100
assert_exists 1 ' /Benchmark/TestResult/set-value[@idref="xccdf_com.example.www_value_V1" and text()="thirty"]'
100
101
assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R1"]/result[text()="pass"]'
101
102
assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R2"]/result[text()="pass"]'
102
103
assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="notselected"]'
103
104
assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R4"]/result[text()="notselected"]'
105
+
106
+ # refine value v1 to 'thirty' (30) and v2 to 'other' (Other Value)
107
+ python3 $autotailor --id-namespace " com.example.www" --var-select V1=thirty --var-select V2=other $ds $original_profile > $tailoring
108
+ $OSCAP xccdf eval --profile P1_customized --progress --tailoring-file $tailoring --results $result $ds
109
+ assert_exists 1 ' /Benchmark/TestResult/set-value[@idref="xccdf_com.example.www_value_V1" and text()="30"]'
110
+ assert_exists 1 ' /Benchmark/TestResult/set-value[@idref="xccdf_com.example.www_value_V2" and text()="Other Value"]'
111
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R1"]/result[text()="pass"]'
112
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R2"]/result[text()="pass"]'
113
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="notselected"]'
114
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R4"]/result[text()="notselected"]'
115
+
116
+ # use JSON tailoring
117
+ python3 $autotailor $ds --id-namespace " com.example.www" --json-tailoring $json_tailoring > $tailoring
118
+ $OSCAP xccdf eval --profile JSON_P1 --progress --tailoring-file $tailoring --results $result $ds
119
+ assert_exists 1 ' /Benchmark/TestResult/set-value[@idref="xccdf_com.example.www_value_V1" and text()="New Value"]'
120
+ assert_exists 1 ' /Benchmark/TestResult/set-value[@idref="xccdf_com.example.www_value_V2" and text()="Some Value"]'
121
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R1"]/result[text()="notselected"]'
122
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R2"]/result[text()="pass"]'
123
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="notselected"]'
124
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3" and @severity="unknown"]'
125
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R4"]/result[text()="notselected"]'
126
+ assert_exists 1 ' /Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R4" and @role="unchecked"]'
0 commit comments