Debian Codegraph @

tests/probes/process58/selinux_domain_label.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 set -e -o pipefail
4
5 . $builddir/tests/test_common.sh
6 probecheck "process58" || exit 255
7
8 name=$(basename $0 .sh)
9 result=$(mktemp ${name}.out.XXXXXX)
10 echo "result file: $result"
11 stderr=$(mktemp ${name}.err.XXXXXX)
12 echo "stderr file: $stderr"
13
14 echo "Collecting:"
15 $OSCAP oval collect --syschar $result $srcdir/$name.oval.xml 2> $stderr
16 [ ! -s $stderr ]
17
18 rm $stderr
19 [ -s $result ]
20
21 assert_exists 1 '/oval_system_characteristics'
22 assert_exists 1 '/oval_system_characteristics/generator'
23 assert_exists 1 '/oval_system_characteristics/system_info'
24 assert_exists 1 '/oval_system_characteristics/collected_objects'
25 assert_exists 1 '/oval_system_characteristics/collected_objects/object'
26 assert_exists 1 '/oval_system_characteristics/collected_objects/object[@flag="complete"]'
27 assert_exists 1 '/oval_system_characteristics/collected_objects/object[@version="1"]'
28 assert_exists 1 '/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1"]'
29 assert_exists 1 '/oval_system_characteristics/collected_objects/object/reference'
30 assert_exists 1 '/oval_system_characteristics/collected_objects/object/reference/@item_ref'
31 assert_exists 1 '/oval_system_characteristics/system_data'
32 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item'
33 assert_exists 2 '/oval_system_characteristics/system_data/unix-sys:process58_item/@*'
34 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/@id'
35 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item[@status="exists"]'
36
37 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:command_line'
38 assert_exists 0 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:command_line/@*'
39
40 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:exec_time'
41 assert_exists 0 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:exec_time/@*'
42
43 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:pid'
44 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:pid/@*'
45 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:pid[@datatype="int"]'
46 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:pid[text()="1"]'
47
48 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:ppid'
49 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:ppid/@*'
50 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:ppid[@datatype="int"]'
51
52 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:priority'
53 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:priority/@*'
54 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:priority[@datatype="int"]'
55
56 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:scheduling_class'
57 assert_exists 0 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:scheduling_class/@*'
58
59 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:start_time'
60 assert_exists 0 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:start_time/@*'
61
62 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:tty'
63 assert_exists 0 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:tty/@*'
64
65 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:user_id'
66 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:user_id/@*'
67 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:user_id[@datatype="int"]'
68 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:user_id[text()="0"]'
69
70 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:exec_shield'
71 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:exec_shield/@*'
72 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:exec_shield[@datatype="boolean"]'
73
74 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:loginuid'
75 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:loginuid/@*'
76 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:loginuid[@datatype="int"]'
77
78 if require selinuxenabled && selinuxenabled; then
79 # How do we query if selinux exists in a portable way?
80 # We rather fail if someone has selinux but not selinux-devel.
81 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:selinux_domain_label'
82 assert_exists 0 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:selinux_domain_label/@*'
83 fi
84
85 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:session_id'
86 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:session_id/@*'
87 assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:session_id[@datatype="int"]'
88
89 rm $result