test_security_ipa_task_validation.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. # Testcase to verify ipa installation in manager node
  16. - name: OMNIA_1.2_SEC2_TC_013
  17. hosts: manager
  18. vars_files:
  19. - test_vars/test_security_ipa_vars.yml
  20. tasks:
  21. - name: Gather IPA version
  22. command: ipa --version
  23. register: ipa_version_op
  24. tags: SECURITY_TC_001
  25. - name: Validate the ipa version
  26. assert:
  27. that:
  28. - "'VERSION' in ipa_version_op.stdout"
  29. fail_msg: "{{ ipa_install_verification_fail_msg }}"
  30. success_msg: "{{ ipa_install_verification_success_msg }}"
  31. tags: SECURITY_TC_001
  32. # OMNIA_1.2_SEC2_TC_014
  33. # Testcase to verify user creation in Free IPA
  34. - name: OMNIA_1.2_SEC2_TC_014
  35. hosts: manager
  36. vars_files:
  37. - test_vars/test_security_ipa_vars.yml
  38. tasks:
  39. - name: Generate random user
  40. command: echo "{{ user_var + random_number }}"
  41. register: user_name
  42. tags: SECURITY_TC_002
  43. - name: Create a random user for testing in free IPA
  44. command: ipa user-add {{ user_name.stdout }} --first='userFirst' --last='userLast' --random
  45. register: create_user_op
  46. tags: SECURITY_TC_002
  47. - name: Get the list of users created in free IPA
  48. command: ipa user-find
  49. register: user_find_op
  50. tags: SECURITY_TC_002
  51. - name: Verify the presence of created user in free IPA
  52. assert:
  53. that:
  54. - "'{{ user_name.stdout }}' in user_find_op.stdout"
  55. fail_msg: "{{ user_creation_fail_msg }}"
  56. success_msg: "{{ user_creation_success_msg }}"
  57. tags: SECURITY_TC_002
  58. # Test case to verify group creation in Free IPA
  59. - name: OMNIA_1.2_SEC2_TC_015
  60. hosts: manager
  61. vars_files:
  62. - test_vars/test_security_ipa_vars.yml
  63. tasks:
  64. - name: Generate random group
  65. command: echo "{{ group_var + random_number }}"
  66. register: group_name
  67. tags: SECURITY_TC_003
  68. - name: Create a random group for testing in free IPA
  69. command: ipa group-add {{ group_name.stdout }}
  70. register: create_group_op
  71. tags: SECURITY_TC_003
  72. - name: Get the list of groups created in free IPA
  73. command: ipa group-find
  74. register: group_find_op
  75. tags: SECURITY_TC_003
  76. - name: Verify the presence of created group in free IPA
  77. assert:
  78. that:
  79. - "'{{ group_name.stdout }}' in group_find_op.stdout"
  80. fail_msg: "{{ group_creation_fail_msg }}"
  81. success_msg: "{{ group_creation_success_msg }}"
  82. tags: SECURITY_TC_003
  83. # Testcase to verify whether user is added to group
  84. - name: OMNIA_1.2_SEC2_TC_016
  85. hosts: manager
  86. vars_files:
  87. - test_vars/test_security_ipa_vars.yml
  88. tasks:
  89. - name: Generate random user
  90. command: echo "{{ user_var + random_number }}"
  91. register: user_name
  92. tags: SECURITY_TC_004
  93. - name: Create user to add into group in free IPA
  94. command: ipa user-add {{ user_name.stdout }} --first='user' --last='Random' --random
  95. register: create_user_op
  96. tags: SECURITY_TC_004
  97. - name: Get the list of users created in free IPA
  98. command: ipa user-find
  99. register: user_find_op
  100. tags: SECURITY_TC_004
  101. - name: Verify the presence of created user in free IPA
  102. assert:
  103. that:
  104. - "'{{ user_name.stdout }}' in user_find_op.stdout"
  105. fail_msg: "{{ user_creation_fail_msg }}"
  106. success_msg: "{{ user_creation_success_msg }}"
  107. tags: SECURITY_TC_004
  108. - name: Generate random group
  109. command: echo "{{ group_var + random_number }}"
  110. register: group_name
  111. tags: SECURITY_TC_004
  112. - name: Create a group to add users in free IPA
  113. command: ipa group-add {{ group_name.stdout }}
  114. register: create_group_op
  115. tags: SECURITY_TC_004
  116. - name: Get the list of groups created in free IPA
  117. command: ipa group-find
  118. register: group_find_op
  119. tags: SECURITY_TC_004
  120. - name: Verify the presence of created group in free IPA
  121. assert:
  122. that:
  123. - "'{{ group_name.stdout }}' in group_find_op.stdout"
  124. fail_msg: "{{ group_creation_fail_msg }}"
  125. success_msg: "{{ group_creation_success_msg }}"
  126. tags: SECURITY_TC_004
  127. - name: Add created user to created group in free IPA
  128. command: ipa group-add-member {{ group_name.stdout }} --users={{ user_name.stdout}}
  129. register: group_add_member_op
  130. tags: SECURITY_TC_004
  131. - name: Get details of group in which user is added in free IPA
  132. command: ipa group-show {{ group_name.stdout }}
  133. register: group_show_op
  134. tags: SECURITY_TC_004
  135. - name: Verify user presence in the group from free IPA
  136. assert:
  137. that:
  138. - "'{{ user_name.stdout }}' in group_show_op.stdout"
  139. fail_msg: "{{ add_user_to_group_fail_msg }}"
  140. success_msg: "{{ add_user_to_group_success_msg }}"
  141. tags: SECURITY_TC_004
  142. # Testcase to verify user deletion in Free IPA
  143. - name: OMNIA_1.2_SEC2_TC_017
  144. hosts: manager
  145. vars_files:
  146. - test_vars/test_security_ipa_vars.yml
  147. tasks:
  148. - name: Generate random user
  149. command: echo "{{ user_var + random_number }}"
  150. register: user_name
  151. tags: SECURITY_TC_005
  152. - name: Create a user to perform deletion
  153. command: ipa user-add {{ user_name.stdout }} --first='userFirst' --last='userLast' --random
  154. register: create_user_op
  155. tags: SECURITY_TC_005
  156. - name: Get the list of users created in free IPA
  157. command: ipa user-find
  158. register: user_find_op
  159. tags: SECURITY_TC_005
  160. - name: Verify the presence of created user in free IPA
  161. assert:
  162. that:
  163. - "'{{ user_name.stdout }}' in user_find_op.stdout"
  164. fail_msg: "{{ user_creation_fail_msg }}"
  165. success_msg: "{{ user_creation_success_msg }}"
  166. tags: SECURITY_TC_005
  167. - name: Delete created user in free IPA
  168. command: ipa user-del {{ user_name.stdout }}
  169. register: user_del_op
  170. tags: SECURITY_TC_005
  171. - name: Select all the remaining users from free IPA
  172. command: ipa user-find
  173. register: user_find_op_after_del
  174. tags: SECURITY_TC_005
  175. - name: Verify the absence of deleted user in free IPA
  176. assert:
  177. that:
  178. - "'{{ user_name.stdout }}' not in user_find_op_after_del.stdout"
  179. fail_msg: "{{ user_deletion_fail_msg }}"
  180. success_msg: "{{ user_deletion_success_msg }}"
  181. tags: SECURITY_TC_005
  182. # Testcase to verify group deletion in Free IPA
  183. - name: OMNIA_1.2_SEC2_TC_018
  184. hosts: manager
  185. vars_files:
  186. - test_vars/test_security_ipa_vars.yml
  187. tasks:
  188. - name: Generate random group
  189. command: echo "{{ group_var + random_number }}"
  190. register: group_name
  191. tags: SECURITY_TC_006
  192. - name: Create a group to perform deletion in free IPA
  193. command: ipa group-add {{ group_name.stdout }}
  194. register: create_group_op
  195. tags: SECURITY_TC_006
  196. - name: Get the list of groups created in free IPA
  197. command: ipa group-find
  198. register: group_find_op
  199. tags: SECURITY_TC_006
  200. - name: Verify the presence of created group in free IPA
  201. assert:
  202. that:
  203. - "'{{ group_name.stdout }}' in group_find_op.stdout"
  204. fail_msg: "{{ group_creation_fail_msg }}"
  205. success_msg: "{{ group_creation_success_msg }}"
  206. tags: SECURITY_TC_006
  207. - name: Delete created group in free IPA
  208. command: ipa group-del {{ group_name.stdout }}
  209. register: group_del_op
  210. tags: SECURITY_TC_006
  211. - name: Select all the remaining users from free IPA
  212. command: ipa group-find
  213. register: group_find_op_after_del
  214. tags: SECURITY_TC_006
  215. - name: Verify the absence of deleted user in IPA
  216. assert:
  217. that:
  218. - "'{{ group_name.stdout }}' not in group_find_op_after_del.stdout"
  219. fail_msg: "{{ group_deletion_fail_msg }}"
  220. success_msg: "{{ group_deletion_success_msg }}"
  221. tags: SECURITY_TC_006
  222. # Testcase to verify role creation in Free IPA
  223. - name: OMNIA_1.2_SEC2_TC_019
  224. hosts: manager
  225. vars_files:
  226. - test_vars/test_security_ipa_vars.yml
  227. tasks:
  228. - name: Generate random role
  229. command: echo "{{ role_var + random_number }}"
  230. register: role_name
  231. tags: SECURITY_TC_007
  232. - name: Create a random role for testing in free IPA
  233. command: ipa role-add {{ role_name.stdout }} --des='User Defined Role'
  234. register: create_role_op
  235. tags: SECURITY_TC_007
  236. - name: Get the list of roles created in free IPA
  237. command: ipa role-find
  238. register: role_find_op
  239. tags: SECURITY_TC_007
  240. - name: Verify the presence of created role in free IPA
  241. assert:
  242. that:
  243. - "'{{ role_name.stdout }}' in role_find_op.stdout"
  244. fail_msg: "{{ role_creation_fail_msg }}"
  245. success_msg: "{{ role_creation_success_msg }}"
  246. tags: SECURITY_TC_007