Guest User

Untitled

a guest
Mar 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.62 KB | None | 0 0
  1. On a fresh system where LDAP Configuration doesn't exist
  2.  
  3. 1) Get request on account service when LDAP Configuration doesn't exist
  4. ========================================================================
  5. curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${BMC_IP}/redfish/v1/AccountService{
  6. "@odata.context": "/redfish/v1/$metadata#AccountService.AccountService",
  7. "@odata.id": "/redfish/v1/AccountService",
  8. "@odata.type": "#AccountService.v1_3_1.AccountService",
  9. "AccountLockoutDuration": 0,
  10. "AccountLockoutThreshold": 0,
  11. "Accounts": {
  12. "@odata.id": "/redfish/v1/AccountService/Accounts"
  13. },
  14. "Description": "Account Service",
  15. "Id": "AccountService",
  16. "MaxPasswordLength": 31,
  17. "MinPasswordLength": 8,
  18. "Name": "Account Service",
  19. "Roles": {
  20. "@odata.id": "/redfish/v1/AccountService/Roles"
  21. }
  22. }
  23.  
  24. 2) Patch request with only Service address
  25. ==========================================
  26. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"ServiceAddresses": ["ldap://2.2.2.2"]}}'
  27. {
  28. "Authentication@Message.ExtendedInfo": [
  29. {
  30. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  31. "Message": "The property Authentication is a required property and must be included in the request.",
  32. "MessageArgs": [
  33. "Authentication"
  34. ],
  35. "MessageId": "Base.1.4.0.PropertyMissing",
  36. "Resolution": "Ensure that the property is in the request body and has a valid value and resubmit the request if the operation failed.",
  37. "Severity": "Warning"
  38. }
  39. ]
  40.  
  41. 3) Let's include Authentication property now
  42. =============================================
  43. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"ServiceAddresses": ["ldap://9.3.185.173"],"Authentication": {"AuthenticationType":"gfsdgfsgfjsdgf","Username": "cn=Manager,dc=example","Password": ""}}}'
  44. {
  45. "LDAPService@Message.ExtendedInfo": [
  46. {
  47. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  48. "Message": "The property LDAPService is a required property and must be included in the request.",
  49. "MessageArgs": [
  50. "LDAPService"
  51. ],
  52. "MessageId": "Base.1.4.0.PropertyMissing",
  53. "Resolution": "Ensure that the property is in the request body and has a valid value and resubmit the request if the operation failed.",
  54. "Severity": "Warning"
  55. }
  56. ]
  57. }
  58.  
  59. 4) Now it is throwing service addreess is missing so include all properties
  60. =========================================================================
  61. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"AccountProvderType": "LDAPService","ServiceEnabled":true, "ServiceAddresses": ["ldap://9.3.185.173"],"Authentication": {"AuthenticationType":"UsernameAndPassword","Username": "cn=Manager,dc=example,dc=org","Password": ""}, "LDAPService": {"SearchSettings": {"BaseDistinguishedNames": ["dc=example,dc=org"]}}}}'
  62. {
  63. "LDAP": {
  64. "AccountProviderType": "LDAPService",
  65. "AccountProviderType@Redfish.AllowableValues": [
  66. "ActivceDirectoryService",
  67. "LDAPService"
  68. ],
  69. "Authentication": {
  70. "AuthenticationType": "UsernameAndPassword",
  71. "AuthenticationType@Redfish.AllowableValues": [
  72. "UsernameAndPassword"
  73. ],
  74. "Password": null,
  75. "Username": "cn=Manager,dc=example,dc=org"
  76. },
  77. "LDAPService": {
  78. "SearchSettings": {
  79. "BaseDistinguishedNames": [
  80. "dc=example,dc=org"
  81. ],
  82. "GroupsAttribute": "gid",
  83. "UsernameAttribute": "uid"
  84. }
  85. },
  86. "ServiceAddresses": [
  87. "ldap://9.3.185.173"
  88. ],
  89. "ServiceEnabled": true
  90. }
  91. }
  92.  
  93. So LDAP Config object gets created so now start patching individual properties
  94.  
  95. 5) Empty JSON
  96. ===============
  97. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"Authentication": {}}}'
  98. {
  99. "error": {
  100. "@Message.ExtendedInfo": [
  101. {
  102. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  103. "Message": "The request body submitted contained an empty JSON object and the service is unable to process it.",
  104. "MessageArgs": [],
  105. "MessageId": "Base.1.4.0.EmptyJSON",
  106. "Resolution": "Add properties in the JSON object and resubmit the request.",
  107. "Severity": "Warning"
  108. }
  109. ],
  110. "code": "Base.1.4.0.EmptyJSON",
  111. "message": "The request body submitted contained an empty JSON object and the service is unable to process it."
  112. }
  113. }
  114. cat patch.txt
  115. HTTP/1.1 400 Bad Request
  116. Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
  117. X-Frame-Options: DENY
  118. Pragma: no-cache
  119. Cache-Control: no-Store,no-Cache
  120. Content-Security-Policy: default-src 'self'; img-src 'self' data:
  121. X-XSS-Protection: 1; mode=block
  122. X-Content-Type-Options: nosniff
  123. X-UA-Compatible: IE=11
  124. Content-Type: application/json
  125. Server: iBMC
  126. Date: Tue, 19 Mar 2019 17:06:54 GMT
  127. Content-Length: 605
  128.  
  129. 6) Authentication type is not valid but other properties are valid
  130. ==================================================================
  131. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"ServiceAddresses": ["ldap://9.3.185.173"],"Authentication": {"AuthenticationType":"gfsdgfsgfjsdgf","Username": "cn=Manager,dc=example","Password": ""}}}'
  132. {
  133. "AuthenticationType@Message.ExtendedInfo": [
  134. {
  135. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  136. "Message": "The value gfsdgfsgfjsdgf for the property AuthenticationType is not in the list of acceptable values.",
  137. "MessageArgs": [
  138. "gfsdgfsgfjsdgf",
  139. "AuthenticationType"
  140. ],
  141. "MessageId": "Base.1.4.0.PropertyValueNotInList",
  142. "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed.",
  143. "Severity": "Warning"
  144. }
  145. ],
  146. "LDAP": {
  147. "AccountProviderType": "LDAPService",
  148. "AccountProviderType@Redfish.AllowableValues": [
  149. "ActivceDirectoryService",
  150. "LDAPService"
  151. ],
  152. "Authentication": {
  153. "AuthenticationType": "UsernameAndPassword",
  154. "AuthenticationType@Redfish.AllowableValues": [
  155. "UsernameAndPassword"
  156. ],
  157. "Password": null,
  158. "Username": "cn=Manager,dc=example"
  159. },
  160. "AuthenticationType": "UsernameAndPassword",
  161. "LDAPService": {
  162. "SearchSettings": {
  163. "BaseDistinguishedNames": [
  164. "dc=example,dc=org"
  165. ],
  166. "GroupsAttribute": "gid",
  167. "UsernameAttribute": "uid"
  168. }
  169. },
  170. "ServiceAddresses": [
  171. "ldap://9.3.185.173"
  172. ],
  173. "ServiceEnabled": true
  174. }
  175. }
  176.  
  177. cat patch.txt
  178. HTTP/1.1 200 OK
  179. Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
  180. X-Frame-Options: DENY
  181. Pragma: no-cache
  182. Cache-Control: no-Store,no-Cache
  183. Content-Security-Policy: default-src 'self'; img-src 'self' data:
  184. X-XSS-Protection: 1; mode=block
  185. X-Content-Type-Options: nosniff
  186. X-UA-Compatible: IE=11
  187. Content-Type: application/json
  188. Server: iBMC
  189. Date: Tue, 19 Mar 2019 17:07:20 GMT
  190. Content-Length: 1335
  191.  
  192.  
  193. 7) Update the service address
  194. ==============================
  195. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"ServiceAddresses": ["ldap://2.2.2.2"]}}'
  196. {
  197. "LDAP": {
  198. "AccountProviderType": "LDAPService",
  199. "AccountProviderType@Redfish.AllowableValues": [
  200. "ActivceDirectoryService",
  201. "LDAPService"
  202. ],
  203. "Authentication": {
  204. "AuthenticationType": "UsernameAndPassword",
  205. "AuthenticationType@Redfish.AllowableValues": [
  206. "UsernameAndPassword"
  207. ],
  208. "Password": null,
  209. "Username": "cn=Manager,dc=example"
  210. },
  211. "LDAPService": {
  212. "SearchSettings": {
  213. "BaseDistinguishedNames": [
  214. "dc=example,dc=org"
  215. ],
  216. "GroupsAttribute": "gid",
  217. "UsernameAttribute": "uid"
  218. }
  219. },
  220. "ServiceAddresses": [
  221. "ldap://2.2.2.2"
  222. ],
  223. "ServiceEnabled": true
  224. }
  225.  
  226. cat patch.txt
  227. HTTP/1.1 200 OK
  228. Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
  229. X-Frame-Options: DENY
  230. Pragma: no-cache
  231. Cache-Control: no-Store,no-Cache
  232. Content-Security-Policy: default-src 'self'; img-src 'self' data:
  233. X-XSS-Protection: 1; mode=block
  234. X-Content-Type-Options: nosniff
  235. X-UA-Compatible: IE=11
  236. Content-Type: application/json
  237. Server: iBMC
  238. Date: Tue, 19 Mar 2019 17:08:15 GMT
  239. Content-Length: 706
Add Comment
Please, Sign In to add comment