Debian Codegraph @

tests/probes/runlevel/test_probes_runlevel_A.xml.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 PATH=$PATH:.
4
5 . ${srcdir}/runlevel_helper.sh
6
7 cat <<EOF
8 <?xml version="1.0"?>
9 <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">
10
11 <generator>
12 <oval:product_name>runlevel</oval:product_name>
13 <oval:product_version>1.0</oval:product_version>
14 <oval:schema_version>5.4</oval:schema_version>
15 <oval:timestamp>2008-03-31T00:00:00-00:00</oval:timestamp>
16 </generator>
17
18 <definitions>
19 EOF
20
21 SERVICES_LIST=`get_services_list`
22 echo SERVICES_LIST=$SERVICES_LIST >&2
23 for S in $SERVICES_LIST; do
24 echo looking at service $S >&2
25 for L in `get_service_runlevels $S`; do
26 LEVEL=`echo $L | awk -F: '{print $1}'`
27 STATE=`echo $L | awk -F: '{print $2}'`
28
29 cat<<EOF
30 <definition class="compliance" version="1" id="oval:${S}-${LEVEL}-${STATE}-T:def:1" > <!-- comment="true" -->
31 <metadata>
32 <title></title>
33 <description></description>
34 </metadata>
35 <criteria>
36 <criteria operator="AND">
37 <criterion test_ref="oval:${S}-${LEVEL}-${STATE}-T:tst:1"/>
38 </criteria>
39 </criteria>
40 </definition>
41
42 <definition class="compliance" version="1" id="oval:${S}-${LEVEL}-${STATE}-F:def:1" > <!-- comment="false" -->
43 <metadata>
44 <title></title>
45 <description></description>
46 </metadata>
47 <criteria>
48 <criteria operator="AND">
49 <criterion test_ref="oval:${S}-${LEVEL}-${STATE}-F:tst:1"/>
50 </criteria>
51 </criteria>
52 </definition>
53
54 EOF
55 done
56 done
57 cat<<EOF
58
59 </definitions>
60 <tests>
61
62 EOF
63
64 for S in $SERVICES_LIST; do
65 for L in `get_service_runlevels $S`; do
66 LEVEL=`echo $L | awk -F: '{print $1}'`
67 STATE=`echo $L | awk -F: '{print $2}'`
68 echo " <runlevel_test check_existence=\"all_exist\" comment=\"true\" version=\"1\" id=\"oval:${S}-${LEVEL}-${STATE}-T:tst:1\" check=\"all\" xmlns=\"http://oval.mitre.org/XMLSchema/oval-definitions-5#unix\">"
69 echo " <object object_ref=\"oval:${S}-${LEVEL}-${STATE}:obj:1\"/>"
70
71 if [ $STATE"X" = "onX" ]; then
72 echo " <state state_ref=\"oval:0:ste:1\"/>"
73 else
74 echo " <state state_ref=\"oval:0:ste:2\"/>"
75 fi
76
77 echo " </runlevel_test>"
78
79 echo " <runlevel_test check_existence=\"all_exist\" comment=\"false\" version=\"1\" id=\"oval:${S}-${LEVEL}-${STATE}-F:tst:1\" check=\"all\" xmlns=\"http://oval.mitre.org/XMLSchema/oval-definitions-5#unix\">"
80 echo " <object object_ref=\"oval:${S}-${LEVEL}-${STATE}:obj:1\"/>"
81
82 if [ $STATE"X" = "onX" ]; then
83 echo " <state state_ref=\"oval:0:ste:2\"/>"
84 else
85 echo " <state state_ref=\"oval:0:ste:1\"/>"
86 fi
87
88 echo " </runlevel_test>"
89 done
90 done
91
92 cat <<EOF
93 </tests>
94
95 <objects>
96 EOF
97
98 for S in $SERVICES_LIST; do
99 for L in `get_service_runlevels $S`; do
100 LEVEL=`echo $L | awk -F: '{print $1}'`
101 STATE=`echo $L | awk -F: '{print $2}'`
102 echo " <runlevel_object version=\"1\" id=\"oval:${S}-${LEVEL}-${STATE}:obj:1\" xmlns=\"http://oval.mitre.org/XMLSchema/oval-definitions-5#unix\">"
103 echo " <service_name>${S}</service_name>"
104 echo " <runlevel>${LEVEL}</runlevel>"
105 echo " </runlevel_object>"
106 done
107 done
108
109 cat <<EOF
110 </objects>
111
112 <states>
113
114 <!-- TRUE STATE -->
115 <runlevel_state version="1" id="oval:0:ste:1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix">
116 <start datatype="boolean">true</start>
117 </runlevel_state>
118
119 <!-- FALSE STATE -->
120 <runlevel_state version="1" id="oval:0:ste:2" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix">
121 <start datatype="boolean">false</start>
122 </runlevel_state>
123
124 </states>
125
126 </oval_definitions>
127 EOF