| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <ds:data-stream-collection xmlns:ds="http://scap.nist.gov/schema/scap/source/1.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cat="urn:oasis:names:tc:entity:xmlns:xml:catalog" id="scap_org.open-scap_collection_from_xccdf_test_ansible_vars.xccdf.xml" schematron-version="1.2"><ds:data-stream id="scap_org.open-scap_datastream_from_xccdf_test_ansible_vars.xccdf.xml" scap-version="1.2" use-case="OTHER"><ds:checklists><ds:component-ref id="scap_org.open-scap_cref_test_ansible_vars.xccdf.xml" xlink:href="#scap_org.open-scap_comp_test_ansible_vars.xccdf.xml"><cat:catalog><cat:uri name="test_ansible_vars.oval.xml" uri="#scap_org.open-scap_cref_test_ansible_vars.oval.xml"/></cat:catalog></ds:component-ref></ds:checklists><ds:checks><ds:component-ref id="scap_org.open-scap_cref_test_ansible_vars.oval.xml" xlink:href="#scap_org.open-scap_comp_test_ansible_vars.oval.xml"/></ds:checks></ds:data-stream><ds:component id="scap_org.open-scap_comp_test_ansible_vars.oval.xml" timestamp="2017-06-09T07:07:38"><oval_definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:ind-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:win-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#windows" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#windows windows-definitions-schema.xsd"> |
| 3 | <generator> |
| 4 | <oval:schema_version>5.11</oval:schema_version> |
| 5 | <oval:timestamp>2009-01-12T10:41:00-05:00</oval:timestamp> |
| 6 | </generator> |
| 7 | |
| 8 | <definitions> |
| 9 | <definition class="compliance" id="oval:default1:def:1" version="1"> |
| 10 | <metadata> |
| 11 | <title>PASS</title> |
| 12 | <description>pass</description> |
| 13 | </metadata> |
| 14 | <criteria> |
| 15 | <criterion comment="PASS test" test_ref="oval:x:tst:1"/> |
| 16 | </criteria> |
| 17 | </definition> |
| 18 | <definition class="compliance" id="oval:test-fail:def:2" version="1"> |
| 19 | <metadata> |
| 20 | <title>FAIL</title> |
| 21 | <description>conditional fail</description> |
| 22 | </metadata> |
| 23 | <criteria> |
| 24 | <criterion comment="FAIL test" test_ref="oval:x:tst:2"/> |
| 25 | </criteria> |
| 26 | </definition> |
| 27 | </definitions> |
| 28 | |
| 29 | <tests> |
| 30 | <variable_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" id="oval:x:tst:1" check="all" comment="always pass" version="1"> |
| 31 | <object object_ref="oval:x:obj:1"/> |
| 32 | </variable_test> |
| 33 | |
| 34 | <variable_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" id="oval:x:tst:2" check="all" comment="always fail" version="1"> |
| 35 | <object object_ref="oval:x:obj:1"/> |
| 36 | <state state_ref="oval:x:ste:1"/> |
| 37 | </variable_test> |
| 38 | </tests> |
| 39 | |
| 40 | <objects> |
| 41 | <variable_object xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" id="oval:x:obj:1" version="1" comment="x"> |
| 42 | <var_ref>oval:x:var:1</var_ref> |
| 43 | </variable_object> |
| 44 | </objects> |
| 45 | |
| 46 | <states> |
| 47 | <variable_state xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" id="oval:x:ste:1" version="1"> |
| 48 | <value datatype="int" operation="equals" var_ref="oval:ssg:var:1"/> |
| 49 | </variable_state> |
| 50 | </states> |
| 51 | |
| 52 | <variables> |
| 53 | <constant_variable id="oval:x:var:1" version="1" comment="x" datatype="int"> |
| 54 | <value>100</value> |
| 55 | </constant_variable> |
| 56 | <external_variable comment="default1" datatype="int" id="oval:ssg:var:1" version="1"/> |
| 57 | </variables> |
| 58 | |
| 59 | </oval_definitions></ds:component><ds:component id="scap_org.open-scap_comp_test_ansible_vars.xccdf.xml" timestamp="2017-06-09T09:15:45"><Benchmark xmlns="http://checklists.nist.gov/xccdf/1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="xccdf_com.example.www_benchmark_dummy" xsi:schemaLocation="http://checklists.nist.gov/xccdf/1.1 xccdf-1.1.4.xsd" resolved="false" xml:lang="en-US"> |
| 60 | <status>accepted</status> |
| 61 | <version>1.0</version> |
| 62 | |
| 63 | <Profile id="xccdf_com.example.www_profile_test_ansible_vars"> |
| 64 | <title>xccdf_test_profile</title> |
| 65 | <description>This profile is for testing.</description> |
| 66 | <select idref="xccdf_com.example.www_rule_default1" selected="true"/> |
| 67 | <select idref="xccdf_com.example.www_rule_default2" selected="true"/> |
| 68 | <refine-value idref="xccdf_com.example.www_value_val1" selector="bar_2"/> |
| 69 | <refine-value idref="xccdf_com.example.www_value_val2" selector="bar_1"/> |
| 70 | </Profile> |
| 71 | |
| 72 | <Value id="xccdf_com.example.www_value_val1" type="number" interactive="0"> |
| 73 | <title>test value</title> |
| 74 | <description>foo</description> |
| 75 | <value selector="bar_1">50</value> |
| 76 | <value selector="bar_2">100</value> |
| 77 | </Value> |
| 78 | <Value id="xccdf_com.example.www_value_val2" type="number" interactive="0"> |
| 79 | <title>test value</title> |
| 80 | <description>foo</description> |
| 81 | <value selector="bar_1">50</value> |
| 82 | <value selector="bar_2">100</value> |
| 83 | </Value> |
| 84 | |
| 85 | <Rule selected="true" id="xccdf_com.example.www_rule_default1"> |
| 86 | <title>Rule default1 to test ansible variable www_value_val1</title> |
| 87 | <fix id="www_rule_default1" system="urn:xccdf:fix:script:ansible" complexity="low" disruption="low" strategy="restrict">- name: XCCDF Value www_value_val1 # promote to variable |
| 88 | set_fact: |
| 89 | www_value_val1: <sub idref="xccdf_com.example.www_value_val1" use="legacy"/> |
| 90 | tags: |
| 91 | - always |
| 92 | |
| 93 | - name: default1 |
| 94 | lineinfile: |
| 95 | dest: /foo/bar |
| 96 | regexp: "^bar *[0-9]*" |
| 97 | state: present |
| 98 | line: "bar {{ www_value_val1 }}" |
| 99 | tags: |
| 100 | - foo |
| 101 | - bar |
| 102 | |
| 103 | - name: XCCDF Value www_value_val3 # promote to variable |
| 104 | set_fact: |
| 105 | www_value_val3: "dummy value" |
| 106 | tags: |
| 107 | - always |
| 108 | </fix> |
| 109 | <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5"> |
| 110 | <check-export export-name="oval:ssg:var:1" value-id="xccdf_com.example.www_value_val1"/> |
| 111 | <check-content-ref href="test_ansible_vars.oval.xml" name="oval:default1:def:1"/> |
| 112 | </check> |
| 113 | </Rule> |
| 114 | |
| 115 | <Rule selected="true" id="xccdf_com.example.www_rule_default2"> |
| 116 | <title>Rule default2 to test ansible variable www_value_val2</title> |
| 117 | <fix id="www_rule_default2" system="urn:xccdf:fix:script:ansible" complexity="low" disruption="low" strategy="restrict">- name: XCCDF Value www_value_val2 # promote to variable |
| 118 | set_fact: |
| 119 | www_value_val2: <sub idref="xccdf_com.example.www_value_val2" use="legacy"/> |
| 120 | tags: |
| 121 | - always |
| 122 | |
| 123 | - name: default2 |
| 124 | lineinfile: |
| 125 | dest: /foo/baz |
| 126 | regexp: "^baz *[0-9]*" |
| 127 | state: present |
| 128 | line: "baz {{ www_value_val2 }}" |
| 129 | tags: |
| 130 | - foo |
| 131 | - baz |
| 132 | </fix> |
| 133 | <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5"> |
| 134 | <check-export export-name="oval:ssg:var:1" value-id="xccdf_com.example.www_value_val2"/> |
| 135 | <check-content-ref href="test_ansible_vars.oval.xml" name="oval:default1:def:1"/> |
| 136 | </check> |
| 137 | </Rule> |
| 138 | |
| 139 | </Benchmark></ds:component></ds:data-stream-collection> |