Debian Codegraph @

tests/probes/systemdunitdependency/test_probes_systemdunitdependency.xml.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 VALID=$1
4
5 cat <<EOF
6 <?xml version="1.0"?>
7 <oval_definitions xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ind-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:unix-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" xmlns:lin-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix unix-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#linux linux-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd">
8
9 <generator>
10 <oval:product_name>systemdunitdependency</oval:product_name>
11 <oval:product_version>1.0</oval:product_version>
12 <oval:schema_version>5.11</oval:schema_version>
13 <oval:timestamp>2014-06-18T00:00:00-00:00</oval:timestamp>
14 </generator>
15
16 <definitions>
17
18 <definition class="compliance" version="1" id="oval:0:def:1"> <!-- comment="${VALID}" -->
19 <metadata><title></title><description></description></metadata>
20 <criteria operator="AND">
21 <criterion test_ref="oval:0:tst:1"/>
22 </criteria>
23 </definition>
24
25 <definition class="compliance" version="1" id="oval:0:def:2"> <!-- comment="${VALID}" -->
26 <metadata><title></title><description></description></metadata>
27 <criteria>
28 <criterion test_ref="oval:0:tst:2" comment="is local-fs.target a dependency of sysinit.target?"/>
29 </criteria>
30 </definition>
31
32 <definition class="compliance" version="1" id="oval:0:def:3"> <!-- comment="${VALID}" -->
33 <metadata><title></title><description></description></metadata>
34 <criteria>
35 <criterion test_ref="oval:0:tst:3" comment="does at least one dependency of rescue.target conflict with shutdown.target?"/>
36 </criteria>
37 </definition>
38
39 </definitions>
40
41 <tests>
42
43 <systemdunitdependency_test check_existence="at_least_one_exists" version="1" id="oval:0:tst:1" check="all" comment="${VALID}" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
44 <object object_ref="oval:0:obj:1"/>
45 </systemdunitdependency_test>
46
47 <systemdunitdependency_test id="oval:0:tst:2" check_existence="at_least_one_exists" check="all" comment="${VALID}" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
48 <object object_ref="oval:0:obj:2"/>
49 <state state_ref="oval:0:ste:1"/>
50 </systemdunitdependency_test>
51
52 <systemdunitproperty_test id="oval:0:tst:3" check_existence="at_least_one_exists" check="all" comment="${VALID}" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
53 <object object_ref="oval:0:obj:3"/>
54 <state state_ref="oval:0:ste:3"/>
55 </systemdunitproperty_test>
56
57 </tests>
58
59 <objects>
60
61 <systemdunitdependency_object version="1" id="oval:0:obj:1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
62 <unit>-.mount</unit>
63 </systemdunitdependency_object>
64
65 <systemdunitdependency_object id="oval:0:obj:2" comment="list of dependencies of sysinit.target" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
66 <unit>sysinit.target</unit>
67 </systemdunitdependency_object>
68
69 <systemdunitproperty_object id="oval:0:obj:3" comment="for each item from local variable below get the Conflicts property" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
70 <unit var_ref="oval:0:var:2" var_check="at least one"/>
71 <property>Conflicts</property>
72 <!-- Exclude those objects not containing 'shutdown.target' within their Conflicts property value -->
73 <filter action="include" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5">oval:0:ste:3</filter>
74 </systemdunitproperty_object>
75
76 <systemdunitdependency_object id="oval:0:obj:4" comment="list of dependencies for rescue.target" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
77 <unit>rescue.target</unit>
78 </systemdunitdependency_object>
79
80 </objects>
81
82 <states>
83
84 <systemdunitdependency_state id="oval:0:ste:1" comment="local-fs.target listed at least once in the dependencies" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
85 <dependency entity_check="at least one">local-fs.target</dependency>
86 </systemdunitdependency_state>
87
88 <systemdunitproperty_state id="oval:0:ste:2" comment="ActiveState property equal to 'active'" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
89 <value>active</value>
90 </systemdunitproperty_state>
91
92 <systemdunitproperty_state id="oval:0:ste:3" comment="match only if Conflicts contains 'shutdown.target' string" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux">
93 <value operation="pattern match">shutdown\.target.*</value>
94 </systemdunitproperty_state>
95
96 </states>
97
98 <variables>
99
100 <local_variable id="oval:0:var:2" datatype="string" comment="list of rescue.target dependencies as local variable" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5">
101 <object_component object_ref="oval:0:obj:4" item_field="dependency"/>
102 </local_variable>
103
104 </variables>
105
106 </oval_definitions>
107 EOF