|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +cat <<EOF |
| 4 | +<?xml version="1.0"?> |
| 5 | +<oval_definitions xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:unix="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" 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"> |
| 6 | + <generator> |
| 7 | + <oval:schema_version>5.11</oval:schema_version> |
| 8 | + <oval:timestamp>0001-01-01T00:00:00+00:00</oval:timestamp> |
| 9 | + </generator> |
| 10 | +
|
| 11 | + <definitions> |
| 12 | + <definition class="compliance" version="1" id="oval:x:def:1"> |
| 13 | + <metadata> |
| 14 | + <title>x</title> |
| 15 | + <description>x</description> |
| 16 | + <affected family="unix"> |
| 17 | + <platform>x</platform> |
| 18 | + </affected> |
| 19 | + </metadata> |
| 20 | + <criteria> |
| 21 | + <criterion test_ref="oval:x:tst:1" comment="correct symlink"/> |
| 22 | + <criterion test_ref="oval:x:tst:2" comment="points to a broken symlink, target deleted"/> |
| 23 | + <criterion test_ref="oval:x:tst:3" comment="points to nonexisting file, not a symlink"/> |
| 24 | + <criterion test_ref="oval:x:tst:4" comment="is a regular file, not a symlink"/> |
| 25 | + <criterion test_ref="oval:x:tst:5" comment="circular symlink"/> |
| 26 | + <criterion test_ref="oval:x:tst:6" comment="two chained symlinks pointing to an existing file"/> |
| 27 | + <criterion test_ref="oval:x:tst:7" comment="symlink to an existing file, but the file name is well-known and should produce error if ran outside the container"/> |
| 28 | + <criterion test_ref="oval:x:tst:8" comment="valid symlink with relative path"/> |
| 29 | + <criterion test_ref="oval:x:tst:9" comment="broken symlink with relative path"/> |
| 30 | + <criterion test_ref="oval:x:tst:10" comment="valid symlink with lots of .. in the path, tests if we can't get out of the container"/> |
| 31 | + <criterion test_ref="oval:x:tst:11" comment="symlink with . in the path"/> |
| 32 | + <criterion test_ref="oval:x:tst:12" comment="tests for a symlink which exists only outside the container"/> |
| 33 | + </criteria> |
| 34 | + </definition> |
| 35 | + </definitions> |
| 36 | +
|
| 37 | + <tests> |
| 38 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:1" version="1"> |
| 39 | + <unix:object object_ref="oval:1:obj:1"/> |
| 40 | + <unix:state state_ref="oval:1:ste:1"/> |
| 41 | + </unix:symlink_test> |
| 42 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:2" version="1"> |
| 43 | + <unix:object object_ref="oval:1:obj:2"/> |
| 44 | + </unix:symlink_test> |
| 45 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:3" version="1"> |
| 46 | + <unix:object object_ref="oval:1:obj:3"/> |
| 47 | + </unix:symlink_test> |
| 48 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:4" version="1"> |
| 49 | + <unix:object object_ref="oval:1:obj:4"/> |
| 50 | + </unix:symlink_test> |
| 51 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:5" version="1"> |
| 52 | + <unix:object object_ref="oval:1:obj:5"/> |
| 53 | + </unix:symlink_test> |
| 54 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:6" version="1"> |
| 55 | + <unix:object object_ref="oval:1:obj:6"/> |
| 56 | + <unix:state state_ref="oval:1:ste:6"/> |
| 57 | + </unix:symlink_test> |
| 58 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:7" version="1"> |
| 59 | + <unix:object object_ref="oval:1:obj:7"/> |
| 60 | + <unix:state state_ref="oval:1:ste:7"/> |
| 61 | + </unix:symlink_test> |
| 62 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:8" version="1"> |
| 63 | + <unix:object object_ref="oval:1:obj:8"/> |
| 64 | + </unix:symlink_test> |
| 65 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:9" version="1"> |
| 66 | + <unix:object object_ref="oval:1:obj:9"/> |
| 67 | + </unix:symlink_test> |
| 68 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:10" version="1"> |
| 69 | + <unix:object object_ref="oval:1:obj:10"/> |
| 70 | + <unix:state state_ref="oval:1:ste:10"/> |
| 71 | + </unix:symlink_test> |
| 72 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:11" version="1"> |
| 73 | + <unix:object object_ref="oval:1:obj:11"/> |
| 74 | + <unix:state state_ref="oval:1:ste:11"/> |
| 75 | + </unix:symlink_test> |
| 76 | + <unix:symlink_test check="all" check_existence="all_exist" comment="x" id="oval:x:tst:12" version="1"> |
| 77 | + <unix:object object_ref="oval:1:obj:12"/> |
| 78 | + </unix:symlink_test> |
| 79 | + </tests> |
| 80 | +
|
| 81 | + <objects> |
| 82 | + <unix:symlink_object id="oval:1:obj:1" version="1"> |
| 83 | + <unix:filepath>$1/normal_symlink</unix:filepath> |
| 84 | + </unix:symlink_object> |
| 85 | + <unix:symlink_object id="oval:1:obj:2" version="1"> |
| 86 | + <unix:filepath>$1/broken_symlink</unix:filepath> |
| 87 | + </unix:symlink_object> |
| 88 | + <unix:symlink_object id="oval:1:obj:3" version="1"> |
| 89 | + <unix:filepath>/etc/does_not_exist</unix:filepath> |
| 90 | + </unix:symlink_object> |
| 91 | + <unix:symlink_object id="oval:1:obj:4" version="1"> |
| 92 | + <unix:filepath>$1/some_file</unix:filepath> |
| 93 | + </unix:symlink_object> |
| 94 | + <unix:symlink_object id="oval:1:obj:5" version="1"> |
| 95 | + <unix:filepath>$1/circular_symlink</unix:filepath> |
| 96 | + </unix:symlink_object> |
| 97 | + <unix:symlink_object id="oval:1:obj:6" version="1"> |
| 98 | + <unix:filepath>$1/chained_symlink</unix:filepath> |
| 99 | + </unix:symlink_object> |
| 100 | + <unix:symlink_object id="oval:1:obj:7" version="1"> |
| 101 | + <unix:filepath>/etc/passwd</unix:filepath> |
| 102 | + </unix:symlink_object> |
| 103 | + <unix:symlink_object id="oval:1:obj:8" version="1"> |
| 104 | + <unix:filepath>/normal_symlink_relative</unix:filepath> |
| 105 | + </unix:symlink_object> |
| 106 | + <unix:symlink_object id="oval:1:obj:9" version="1"> |
| 107 | + <unix:filepath>/broken_symlink_relative</unix:filepath> |
| 108 | + </unix:symlink_object> |
| 109 | + <unix:symlink_object id="oval:1:obj:10" version="1"> |
| 110 | + <unix:filepath>/path_traversal_symlink</unix:filepath> |
| 111 | + </unix:symlink_object> |
| 112 | + <unix:symlink_object id="oval:1:obj:11" version="1"> |
| 113 | + <unix:filepath>/symlink_with_dot_in_path</unix:filepath> |
| 114 | + </unix:symlink_object> |
| 115 | + <unix:symlink_object id="oval:1:obj:12" version="1"> |
| 116 | + <unix:filepath>/tmp/symlinktest</unix:filepath> |
| 117 | + </unix:symlink_object> |
| 118 | + </objects> |
| 119 | +
|
| 120 | + <states> |
| 121 | + <unix:symlink_state id="oval:1:ste:1" version="1"> |
| 122 | + <unix:filepath>$1/normal_symlink</unix:filepath> |
| 123 | + <unix:canonical_path>$1/some_file</unix:canonical_path> |
| 124 | + </unix:symlink_state> |
| 125 | + <unix:symlink_state id="oval:1:ste:6" version="1"> |
| 126 | + <unix:filepath>$1/chained_symlink</unix:filepath> |
| 127 | + <unix:canonical_path>$1/other_file</unix:canonical_path> |
| 128 | + </unix:symlink_state> |
| 129 | + <unix:symlink_state id="oval:1:ste:7" version="1"> |
| 130 | + <unix:filepath>$1/etc/passwd</unix:filepath> |
| 131 | + <unix:canonical_path>$1/etc/shadow</unix:canonical_path> |
| 132 | + </unix:symlink_state> |
| 133 | + <unix:symlink_state id="oval:1:ste:10" version="1"> |
| 134 | + <unix:filepath>$1/path_traversal_symlink</unix:filepath> |
| 135 | + <unix:canonical_path>$1/file_in_root</unix:canonical_path> |
| 136 | + </unix:symlink_state> |
| 137 | + <unix:symlink_state id="oval:1:ste:11" version="1"> |
| 138 | + <unix:filepath>$1/symlink_with_dot_in_path</unix:filepath> |
| 139 | + <unix:canonical_path>$1/some_file</unix:canonical_path> |
| 140 | + </unix:symlink_state> |
| 141 | + </states> |
| 142 | +
|
| 143 | +</oval_definitions> |
| 144 | +EOF |
0 commit comments