| 1 |
--- |
| 2 |
- name: fail with invalid section name |
| 3 |
win_security_policy: |
| 4 |
section: This is not a valid section |
| 5 |
key: KeyName |
| 6 |
value: 0 |
| 7 |
register: fail_invalid_section |
| 8 |
failed_when: fail_invalid_section.msg != "The section 'This is not a valid section' does not exist in SecEdit.exe output ini" |
| 9 |
|
| 10 |
- name: fail with invalid key name |
| 11 |
win_security_policy: |
| 12 |
section: System Access |
| 13 |
key: InvalidKey |
| 14 |
value: 0 |
| 15 |
register: fail_invalid_key |
| 16 |
failed_when: fail_invalid_key.msg != "The key 'InvalidKey' in section 'System Access' is not a valid key, cannot set this value" |
| 17 |
|
| 18 |
- name: change existing key check |
| 19 |
win_security_policy: |
| 20 |
section: Event Audit |
| 21 |
key: AuditSystemEvents |
| 22 |
value: 1 |
| 23 |
register: change_existing_check |
| 24 |
check_mode: yes |
| 25 |
|
| 26 |
- name: get actual change existing key check |
| 27 |
test_win_security_policy: |
| 28 |
section: Event Audit |
| 29 |
key: AuditSystemEvents |
| 30 |
register: change_existing_actual_check |
| 31 |
|
| 32 |
- name: assert change existing key check |
| 33 |
assert: |
| 34 |
that: |
| 35 |
- change_existing_check is changed |
| 36 |
- change_existing_actual_check.value == 0 |
| 37 |
|
| 38 |
- name: change existing key |
| 39 |
win_security_policy: |
| 40 |
section: Event Audit |
| 41 |
key: AuditSystemEvents |
| 42 |
value: 1 |
| 43 |
register: change_existing |
| 44 |
|
| 45 |
- name: get actual change existing key |
| 46 |
test_win_security_policy: |
| 47 |
section: Event Audit |
| 48 |
key: AuditSystemEvents |
| 49 |
register: change_existing_actual |
| 50 |
|
| 51 |
- name: assert change existing key |
| 52 |
assert: |
| 53 |
that: |
| 54 |
- change_existing is changed |
| 55 |
- change_existing_actual.value == 1 |
| 56 |
|
| 57 |
- name: change existing key again |
| 58 |
win_security_policy: |
| 59 |
section: Event Audit |
| 60 |
key: AuditSystemEvents |
| 61 |
value: 1 |
| 62 |
register: change_existing_again |
| 63 |
|
| 64 |
- name: assert change existing key again |
| 65 |
assert: |
| 66 |
that: |
| 67 |
- change_existing_again is not changed |
| 68 |
- change_existing_again.value == 1 |
| 69 |
|
| 70 |
- name: change existing key with string type |
| 71 |
win_security_policy: |
| 72 |
section: Event Audit |
| 73 |
key: AuditSystemEvents |
| 74 |
value: "1" |
| 75 |
register: change_existing_key_with_type |
| 76 |
|
| 77 |
- name: assert change existing key with string type |
| 78 |
assert: |
| 79 |
that: |
| 80 |
- change_existing_key_with_type is not changed |
| 81 |
- change_existing_key_with_type.value == "1" |
| 82 |
|
| 83 |
- name: change existing string key check |
| 84 |
win_security_policy: |
| 85 |
section: System Access |
| 86 |
key: NewGuestName |
| 87 |
value: New Guest |
| 88 |
register: change_existing_string_check |
| 89 |
check_mode: yes |
| 90 |
|
| 91 |
- name: get actual change existing string key check |
| 92 |
test_win_security_policy: |
| 93 |
section: System Access |
| 94 |
key: NewGuestName |
| 95 |
register: change_existing_string_actual_check |
| 96 |
|
| 97 |
- name: assert change existing string key check |
| 98 |
assert: |
| 99 |
that: |
| 100 |
- change_existing_string_check is changed |
| 101 |
- change_existing_string_actual_check.value == "Guest" |
| 102 |
|
| 103 |
- name: change existing string key |
| 104 |
win_security_policy: |
| 105 |
section: System Access |
| 106 |
key: NewGuestName |
| 107 |
value: New Guest |
| 108 |
register: change_existing_string |
| 109 |
|
| 110 |
- name: get actual change existing string key |
| 111 |
test_win_security_policy: |
| 112 |
section: System Access |
| 113 |
key: NewGuestName |
| 114 |
register: change_existing_string_actual |
| 115 |
|
| 116 |
- name: assert change existing string key |
| 117 |
assert: |
| 118 |
that: |
| 119 |
- change_existing_string is changed |
| 120 |
- change_existing_string_actual.value == "New Guest" |
| 121 |
|
| 122 |
- name: change existing string key again |
| 123 |
win_security_policy: |
| 124 |
section: System Access |
| 125 |
key: NewGuestName |
| 126 |
value: New Guest |
| 127 |
register: change_existing_string_again |
| 128 |
|
| 129 |
- name: assert change existing string key again |
| 130 |
assert: |
| 131 |
that: |
| 132 |
- change_existing_string_again is not changed |
| 133 |
- change_existing_string_again.value == "New Guest" |
| 134 |
|
| 135 |
- name: add policy setting |
| 136 |
win_security_policy: |
| 137 |
section: Privilege Rights |
| 138 |
# following key is empty by default |
| 139 |
key: SeCreateTokenPrivilege |
| 140 |
# add Guests |
| 141 |
value: '*S-1-5-32-546' |
| 142 |
|
| 143 |
- name: get actual policy setting |
| 144 |
test_win_security_policy: |
| 145 |
section: Privilege Rights |
| 146 |
key: SeCreateTokenPrivilege |
| 147 |
register: add_policy_setting_actual |
| 148 |
|
| 149 |
- name: assert add policy setting |
| 150 |
assert: |
| 151 |
that: |
| 152 |
- add_policy_setting_actual.value == '*S-1-5-32-546' |
| 153 |
|
| 154 |
- name: remove policy setting |
| 155 |
win_security_policy: |
| 156 |
section: Privilege Rights |
| 157 |
key: SeCreateTokenPrivilege |
| 158 |
value: '' |
| 159 |
diff: yes |
| 160 |
register: remove_policy_setting |
| 161 |
|
| 162 |
- name: get actual policy setting |
| 163 |
test_win_security_policy: |
| 164 |
section: Privilege Rights |
| 165 |
key: SeCreateTokenPrivilege |
| 166 |
register: remove_policy_setting_actual |
| 167 |
|
| 168 |
- name: assert remove policy setting |
| 169 |
assert: |
| 170 |
that: |
| 171 |
- remove_policy_setting is changed |
| 172 |
- remove_policy_setting.diff.prepared == "[Privilege Rights]\n-SeCreateTokenPrivilege = *S-1-5-32-546\n+SeCreateTokenPrivilege = " |
| 173 |
- remove_policy_setting_actual.value is none |
| 174 |
|
| 175 |
- name: remove policy setting again |
| 176 |
win_security_policy: |
| 177 |
section: Privilege Rights |
| 178 |
key: SeCreateTokenPrivilege |
| 179 |
value: '' |
| 180 |
register: remove_policy_setting_again |
| 181 |
|
| 182 |
- name: assert remove policy setting again |
| 183 |
assert: |
| 184 |
that: |
| 185 |
- remove_policy_setting_again is not changed |
| 186 |
- remove_policy_setting_again.value == '' |