| 1 | #!/usr/bin/envscip-shell filesystem . . `/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=$(basenamescip-shell system . . basename. $0 .sh) |
| 9 | result=$(mktempscip-shell system . . mktemp. ${name}.out.XXXXXX) |
| 10 | echoscip-shell system . . echo. "result file: $result" |
| 11 | stderr=$(mktempscip-shell system . . mktemp. ${name}.err.XXXXXX) |
| 12 | echoscip-shell system . . echo. "stderr file: $stderr" |
| 13 | |
| 14 | echoscip-shell system . . echo. "Collecting:" |
| 15 | $OSCAP oval collect --syschar $result $srcdir/$name.oval.xml 2> $stderr |
| 16 | [scip-shell system . . `[`. ! -s $stderr ] |
| 17 | |
| 18 | rmscip-shell system . . rm. $stderr |
| 19 | [scip-shell system . . `[`. -s $result ] |
| 20 | |
| 21 | assert_exists 1 '/oval_system_characteristicsscip-shell filesystem . . `/oval_system_characteristics`.' |
| 22 | assert_exists 1 '/oval_system_characteristics/generatorscip-shell filesystem . . `/oval_system_characteristics/generator`.' |
| 23 | assert_exists 1 '/oval_system_characteristics/system_infoscip-shell filesystem . . `/oval_system_characteristics/system_info`.' |
| 24 | assert_exists 1 '/oval_system_characteristics/collected_objectsscip-shell filesystem . . `/oval_system_characteristics/collected_objects`.' |
| 25 | assert_exists 1 '/oval_system_characteristics/collected_objects/objectscip-shell filesystem . . `/oval_system_characteristics/collected_objects/object`.' |
| 26 | assert_exists 1 '/oval_system_characteristics/collected_objects/object[@flag="complete"]scip-shell filesystem . . `/oval_system_characteristics/collected_objects/object[@flag="complete"]`.' |
| 27 | assert_exists 1 '/oval_system_characteristics/collected_objects/object[@version="1"]scip-shell filesystem . . `/oval_system_characteristics/collected_objects/object[@version="1"]`.' |
| 28 | assert_exists 1 '/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1"]scip-shell filesystem . . `/oval_system_characteristics/collected_objects/object[@id="oval:x:obj:1"]`.' |
| 29 | assert_exists 1 '/oval_system_characteristics/collected_objects/object/referencescip-shell filesystem . . `/oval_system_characteristics/collected_objects/object/reference`.' |
| 30 | assert_exists 1 '/oval_system_characteristics/collected_objects/object/reference/@item_refscip-shell filesystem . . `/oval_system_characteristics/collected_objects/object/reference/@item_ref`.' |
| 31 | assert_exists 1 '/oval_system_characteristics/system_datascip-shell filesystem . . `/oval_system_characteristics/system_data`.' |
| 32 | assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_itemscip-shell filesystem . . `/oval_system_characteristics/system_data/unix-sys:process58_item`.' |
| 33 | assert_exists 2 '/oval_system_characteristics/system_data/unix-sys:process58_item/@*scip-shell filesystem . . `/oval_system_characteristics/system_data/unix-sys:process58_item/@*`.' |
| 34 | assert_exists 1 '/oval_system_characteristics/system_data/unix-sys:process58_item/@idscip-shell filesystem . . `/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"]scip-shell filesystem . . `/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_linescip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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_timescip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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:pidscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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"]scip-shell filesystem . . `/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"]scip-shell filesystem . . `/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:ppidscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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"]scip-shell filesystem . . `/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:priorityscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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"]scip-shell filesystem . . `/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_classscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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_timescip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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:ttyscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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_idscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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"]scip-shell filesystem . . `/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"]scip-shell filesystem . . `/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_shieldscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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"]scip-shell filesystem . . `/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:loginuidscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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"]scip-shell filesystem . . `/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_labelscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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_idscip-shell filesystem . . `/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/@*scip-shell filesystem . . `/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"]scip-shell filesystem . . `/oval_system_characteristics/system_data/unix-sys:process58_item/unix-sys:session_id[@datatype="int"]`.' |
| 88 | |
| 89 | rmscip-shell system . . rm. $result |