rgupta_

Untitled

Mar 27th, 2019
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.67 KB | None | 0 0
  1. On a fresh system where LDAP Configuration doesn't exist
  2. 1) Ran the redfish validator : PASS
  3.  
  4. 2) Get request on account service when there is no LDAP/AD Configuration
  5. ========================================================================
  6. curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${BMC_IP}/redfish/v1/AccountService/
  7. {
  8. "@odata.context": "/redfish/v1/$metadata#AccountService.AccountService",
  9. "@odata.id": "/redfish/v1/AccountService",
  10. "@odata.type": "#AccountService.v1_3_1.AccountService",
  11. "AccountLockoutDuration": 0,
  12. "AccountLockoutThreshold": 0,
  13. "Accounts": {
  14. "@odata.id": "/redfish/v1/AccountService/Accounts"
  15. },
  16. "ActiveDirectory": {
  17. "AccountProviderType": "ActiveDirectoryService",
  18. "ActiveDirectoryService"
  19. ],
  20. "Authentication": {
  21. "AuthenticationType": "UsernameAndPassword",
  22. "UsernameAndPassword"
  23. ],
  24. "Password": null,
  25. "Username": ""
  26. },
  27. "LDAPService": {
  28. "SearchSettings": {
  29. "BaseDistinguishedNames": [
  30. ""
  31. ],
  32. "GroupsAttribute": "",
  33. "UsernameAttribute": ""
  34. }
  35. },
  36. "ServiceAddresses": [
  37. ""
  38. ],
  39. "ServiceEnabled": false
  40. },
  41. "Description": "Account Service",
  42. "Id": "AccountService",
  43. "LDAP": {
  44. "AccountProviderType": "LDAPService",
  45. "LDAPService"
  46. ],
  47. "Authentication": {
  48. "AuthenticationType": "UsernameAndPassword",
  49. "UsernameAndPassword"
  50. ],
  51. "Password": null,
  52. "Username": ""
  53. },
  54. "LDAPService": {
  55. "SearchSettings": {
  56. "BaseDistinguishedNames": [
  57. ""
  58. ],
  59. "GroupsAttribute": "",
  60. "UsernameAttribute": ""
  61. }
  62. },
  63. "ServiceAddresses": [
  64. ""
  65. ],
  66. "ServiceEnabled": false
  67. },
  68. "MaxPasswordLength": 20,
  69. "MinPasswordLength": 8,
  70. "Name": "Account Service",
  71. "Roles": {
  72. "@odata.id": "/redfish/v1/AccountService/Roles"
  73. },
  74. "ServiceEnabled": true
  75.  
  76. 3) Empty JSON
  77. =============
  78. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"Authentication": {}}}'
  79. {
  80. "error": {
  81. "@Message.ExtendedInfo": [
  82. {
  83. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  84. "Message": "The request body submitted contained an empty JSON object and the service is unable to process it.",
  85. "MessageArgs": [],
  86. "MessageId": "Base.1.4.0.EmptyJSON",
  87. "Resolution": "Add properties in the JSON object and resubmit the request.",
  88. "Severity": "Warning"
  89. }
  90. ],
  91. "code": "Base.1.4.0.EmptyJSON",
  92. "message": "The request body submitted contained an empty JSON object and the service is unable to process it."
  93. }
  94. }
  95.  
  96. 4) Update AccountProvider Type
  97. =============================
  98. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"AccountProviderType": "LDAPService"}}'
  99. {
  100. {
  101. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  102. "Message": "The property AccountProviderType is a read only property and cannot be assigned a value.",
  103. "MessageArgs": [
  104. "AccountProviderType"
  105. ],
  106. "MessageId": "Base.1.4.0.PropertyNotWritable",
  107. "Resolution": "Remove the property from the request body and resubmit the request if the operation failed.",
  108. "Severity": "Warning"
  109. }
  110. ]
  111. }
  112. 5) Update invalid authentication type
  113. ====================================
  114. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"Authentication": {"AuthenticationType": "abcdef"}}}'
  115. {
  116. {
  117. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  118. "Message": "The value abcdef for the property AuthenticationType is not in the list of acceptable values.",
  119. "MessageArgs": [
  120. "abcdef",
  121. "AuthenticationType"
  122. ],
  123. "MessageId": "Base.1.4.0.PropertyValueNotInList",
  124. "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed.",
  125. "Severity": "Warning"
  126. }
  127. ]
  128. }
  129.  
  130.  
  131. 6) Update the service address with empty list
  132. ==============================================
  133.  
  134. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"ServiceAddresses": []}}'
  135. {
  136. "error": {
  137. "@Message.ExtendedInfo": [
  138. {
  139. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  140. "Message": "The request failed due to an internal service error. The service is still operational.",
  141. "MessageArgs": [],
  142. "MessageId": "Base.1.4.0.InternalError",
  143. "Resolution": "Resubmit the request. If the problem persists, consider resetting the service.",
  144. "Severity": "Critical"
  145. }
  146. ],
  147. "code": "Base.1.4.0.InternalError",
  148. "message": "The request failed due to an internal service error. The service is still operational."
  149. }
  150.  
  151. 9) Let's PATCH the LDAP Property.
  152. ===============================
  153. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"ServiceEnabled":false, "ServiceAddresses": ["ldap://9.126.172.69/"],"Authentication": {"AuthenticationType":"UsernameAndPassword","Username": "uid=sivasjxp,dc=ldap,dc=com","Password": "india@123"}, "LDAPService": {"SearchSettings": {"BaseDistinguishedNames": ["dc=ldap,dc=com"]}}}}'
  154. {
  155. "LDAP": {
  156. "AccountProviderType": "LDAPService",
  157. "LDAPService"
  158. ],
  159. "Authentication": {
  160. "AuthenticationType": "UsernameAndPassword",
  161. "UsernameAndPassword"
  162. ],
  163. "Password": "",
  164. "Username": "uid=sivasjxp,dc=ldap,dc=com"
  165. },
  166. "LDAPService": {
  167. "SearchSettings": {
  168. "BaseDistinguishedNames": [
  169. "dc=ldap,dc=com"
  170. ],
  171. "GroupsAttribute": "gidNumber",
  172. "UsernameAttribute": "cn"
  173. }
  174. },
  175. "ServiceAddresses": [
  176. "ldap://9.126.172.69/"
  177. ],
  178. "ServiceEnabled": false
  179. }
  180. }
  181. 10) Do the GET request after Patching the LDAP Configuration.
  182. =============================================================
  183. curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${BMC_IP}/redfish/v1/AccountService/
  184. {
  185. "@odata.context": "/redfish/v1/$metadata#AccountService.AccountService",
  186. "@odata.id": "/redfish/v1/AccountService",
  187. "@odata.type": "#AccountService.v1_3_1.AccountService",
  188. "AccountLockoutDuration": 0,
  189. "AccountLockoutThreshold": 0,
  190. "Accounts": {
  191. "@odata.id": "/redfish/v1/AccountService/Accounts"
  192. },
  193. "ActiveDirectory": {
  194. "AccountProviderType": "ActiveDirectoryService",
  195. "ActiveDirectoryService"
  196. ],
  197. "Authentication": {
  198. "AuthenticationType": "UsernameAndPassword",
  199. "UsernameAndPassword"
  200. ],
  201. "Password": null,
  202. "Username": ""
  203. },
  204. "LDAPService": {
  205. "SearchSettings": {
  206. "BaseDistinguishedNames": [
  207. ""
  208. ],
  209. "GroupsAttribute": "",
  210. "UsernameAttribute": ""
  211. }
  212. },
  213. "ServiceAddresses": [
  214. ""
  215. ],
  216. "ServiceEnabled": false
  217. },
  218. "Description": "Account Service",
  219. "Id": "AccountService",
  220. "LDAP": {
  221. "AccountProviderType": "LDAPService",
  222. "LDAPService"
  223. ],
  224. "Authentication": {
  225. "AuthenticationType": "UsernameAndPassword",
  226. "UsernameAndPassword"
  227. ],
  228. "Password": null,
  229. "Username": "uid=sivasjxp,dc=ldap,dc=com"
  230. },
  231. "LDAPService": {
  232. "SearchSettings": {
  233. "BaseDistinguishedNames": [
  234. "dc=ldap,dc=com"
  235. ],
  236. "GroupsAttribute": "gidNumber",
  237. "UsernameAttribute": "cn"
  238. }
  239. },
  240. "ServiceAddresses": [
  241. "ldap://9.126.172.69/"
  242. ],
  243. "ServiceEnabled": false
  244. },
  245. "MaxPasswordLength": 20,
  246. "MinPasswordLength": 8,
  247. "Name": "Account Service",
  248. "Roles": {
  249. "@odata.id": "/redfish/v1/AccountService/Roles"
  250. },
  251. "ServiceEnabled": true
  252.  
  253. 11) Login with LDAP Credentials
  254. ==================================
  255. curl --insecure -X POST -D headers.txt https://${BMC_IP}/redfish/v1/SessionService/Sessions -d '{"UserName":"sivasjxp", "Password":"india@123"}'
  256. {
  257. "@odata.context": "/redfish/v1/$metadata#Session.Session",
  258. "@odata.id": "/redfish/v1/SessionService/Sessions/ZuZgsHAJLP",
  259. "@odata.type": "#Session.v1_0_2.Session",
  260. "Description": "Manager User Session",
  261. "Id": "ZuZgsHAJLP",
  262. "Name": "User Session",
  263. "UserName": "sivasjxp"
  264. }
  265. 12) Let's patch the AD configuration
  266. =====================================
  267. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"ActiveDirectory":{"ServiceEnabled":false, "ServiceAddresses": ["ldap://9.194.251.141/"],"Authentication": {"AuthenticationType":"UsernameAndPassword","Username": "cn=dvtuser,cn=Users,dc=Corp,dc=ibm,dc=com","Password": "india@123"}, "LDAPService": {"SearchSettings": {"BaseDistinguishedNames": ["dc=Corp,dc=ibm,dc=com"]}}}}'
  268. {
  269. "ActiveDirectory": {
  270. "AccountProviderType": "ActiveDirectoryService",
  271. "ActiveDirectoryService"
  272. ],
  273. "Authentication": {
  274. "AuthenticationType": "UsernameAndPassword",
  275. "UsernameAndPassword"
  276. ],
  277. "Password": "",
  278. "Username": "cn=dvtuser,cn=Users,dc=Corp,dc=ibm,dc=com"
  279. },
  280. "LDAPService": {
  281. "SearchSettings": {
  282. "BaseDistinguishedNames": [
  283. "dc=Corp,dc=ibm,dc=com"
  284. ],
  285. "GroupsAttribute": "",
  286. "UsernameAttribute": ""
  287. }
  288. },
  289. "ServiceAddresses": [
  290. "ldap://9.194.251.141/"
  291. ],
  292. "ServiceEnabled": false
  293. }
  294. 13) Still Ldap is Enabled, so let's enable the AD
  295. ==================================================
  296. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"ActiveDirectory":{"erviceEnabled":true}}'
  297. {
  298. "ActiveDirectory": {
  299. "AccountProviderType": "ActiveDirectoryService",
  300. "ActiveDirectoryService"
  301. ],
  302. "Authentication": {
  303. "AuthenticationType": "UsernameAndPassword",
  304. "UsernameAndPassword"
  305. ],
  306. "Password": null,
  307. "Username": "cn=dvtuser,cn=Users,dc=Corp,dc=ibm,dc=com"
  308. },
  309. "LDAPService": {
  310. "SearchSettings": {
  311. "BaseDistinguishedNames": [
  312. "dc=Corp,dc=ibm,dc=com"
  313. ],
  314. "GroupsAttribute": "primaryGroupID",
  315. "UsernameAttribute": "sAMAccountName"
  316. }
  317. },
  318. "ServiceAddresses": [
  319. "ldap://9.194.251.141/"
  320. ],
  321. "ServiceEnabled": false
  322. },
  323. "error": {
  324. "@Message.ExtendedInfo": [
  325. {
  326. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  327. "Message": "The request failed due to an internal service error. The service is still operational.",
  328. "MessageArgs": [],
  329. "MessageId": "Base.1.4.0.InternalError",
  330. "Resolution": "Resubmit the request. If the problem persists, consider resetting the service.",
  331. "Severity": "Critical"
  332. }
  333. ],
  334. "code": "Base.1.4.0.InternalError",
  335. "message": "The request failed due to an internal service error. The service is still operational."
  336. }
  337. }
  338. 14) Disable the LDAP first
  339. ==========================
  340. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"LDAP":{"ServiceEnabled":false}}'
  341. {
  342. "LDAP": {
  343. "AccountProviderType": "LDAPService",
  344. "LDAPService"
  345. ],
  346. "Authentication": {
  347. "AuthenticationType": "UsernameAndPassword",
  348. "UsernameAndPassword"
  349. ],
  350. "Password": null,
  351. "Username": "uid=sivasjxp,dc=ldap,dc=com"
  352. },
  353. "LDAPService": {
  354. "SearchSettings": {
  355. "BaseDistinguishedNames": [
  356. "dc=ldap,dc=com"
  357. ],
  358. "GroupsAttribute": "gidNumber",
  359. "UsernameAttribute": "cn"
  360. }
  361. },
  362. "ServiceAddresses": [
  363. "ldap://9.126.172.69/"
  364. ],
  365. "ServiceEnabled": false
  366. }
  367. }
  368. 15) Enable the AD now
  369. =====================
  370. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{ActiveDirectory":{"ServiceEnabled":true}}'
  371. {
  372. "ActiveDirectory": {
  373. "AccountProviderType": "ActiveDirectoryService",
  374. "ActiveDirectoryService"
  375. ],
  376. "Authentication": {
  377. "AuthenticationType": "UsernameAndPassword",
  378. "UsernameAndPassword"
  379. ],
  380. "Password": null,
  381. "Username": "cn=dvtuser,cn=Users,dc=Corp,dc=ibm,dc=com"
  382. },
  383. "LDAPService": {
  384. "SearchSettings": {
  385. "BaseDistinguishedNames": [
  386. "dc=Corp,dc=ibm,dc=com"
  387. ],
  388. "GroupsAttribute": "primaryGroupID",
  389. "UsernameAttribute": "sAMAccountName"
  390. }
  391. },
  392. "ServiceAddresses": [
  393. "ldap://9.194.251.141/"
  394. ],
  395. "ServiceEnabled": true
  396. }
  397. }
  398. 16) Login with LDAP credentails
  399. ================================
  400. curl --insecure -X POST -D headers.txt https://${BMC_IP}/redfish/v1/SessionService/Sessions -d '{"UserName":"sivasjxp", "Password":"india@123"}'
  401. {
  402. "error": {
  403. "@Message.ExtendedInfo": [
  404. {
  405. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  406. "Message": "While accessing the resource at /redfish/v1/SessionService/Sessions, the service received an authorization error Invalid username or password.",
  407. "MessageArgs": [
  408. "/redfish/v1/SessionService/Sessions",
  409. "Invalid username or password"
  410. ],
  411. "MessageId": "Base.1.4.0.ResourceAtUriUnauthorized",
  412. "Resolution": "Ensure that the appropriate access is provided for the service in order for it to access the URI.",
  413. "Severity": "Critical"
  414. }
  415. ],
  416. "code": "Base.1.4.0.ResourceAtUriUnauthorized",
  417. "message": "While accessing the resource at /redfish/v1/SessionService/Sessions, the service received an authorization error Invalid username or password."
  418. }
  419. }
  420. 17) login with AD credentials
  421. =============================
  422. curl --insecure -X POST -D headers.txt https://${BMC_IP}/redfish/v1/SessionService/Sessions -d '{"UserName":"dvtuser", "Password":"india@123"}'
  423. {
  424. "@odata.context": "/redfish/v1/$metadata#Session.Session",
  425. "@odata.id": "/redfish/v1/SessionService/Sessions/Cjr9YSMrxc",
  426. "@odata.type": "#Session.v1_0_2.Session",
  427. "Description": "Manager User Session",
  428. "Id": "Cjr9YSMrxc",
  429. "Name": "User Session",
  430. "UserName": "dvtuser"
  431. }
  432. 18) Add the Remote Role mapping for the AD
  433. ==========================================
  434. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"ActiveDirectory":{"RemoteRoleMapping": [{"RemoteGroup": "Admingroup15","LocalRole": "User"},{"RemoteGroup": "Admingroup13","LocalRole": "Administrator"},{"RemoteGroup": "Admingroup14","LocalRole": "Operator"}]}}'
  435. {
  436. "@Message.ExtendedInfo": [
  437. {
  438. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  439. "Message": "Successfully Completed Request",
  440. "MessageArgs": [],
  441. "MessageId": "Base.1.4.0.Success",
  442. "Resolution": "None",
  443. "Severity": "OK"
  444. }
  445. ],
  446. "ActiveDirectory": {
  447. "AccountProviderType": "ActiveDirectoryService",
  448. "Authentication": {
  449. "AuthenticationType": "UsernameAndPassword",
  450. "Password": null,
  451. "Username": "cn=dvtuser,cn=Users,dc=Corp,dc=ibm,dc=com"
  452. },
  453. "LDAPService": {
  454. "SearchSettings": {
  455. "BaseDistinguishedNames": [
  456. "dc=Corp,dc=ibm,dc=com"
  457. ],
  458. "GroupsAttribute": "",
  459. "UsernameAttribute": ""
  460. }
  461. },
  462. "RemoteRoleMapping": [
  463. {
  464. "LocalRole": "User",
  465. "RemoteGroup": "Admingroup15"
  466. },
  467. {
  468. "LocalRole": "Administrator",
  469. "RemoteGroup": "Admingroup13"
  470. },
  471. {
  472. "LocalRole": "Operator",
  473. "RemoteGroup": "Admingroup14"
  474. }
  475. ],
  476. "ServiceAddresses": [
  477. "ldap://9.194.251.141/"
  478. ],
  479. "ServiceEnabled": false
  480. }
  481. 19) Delete the second remote role mapping.
  482. ==========================================
  483. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"ActiveDirectory":{"RemoteRoleMapping": [{},null,{}]}}'
  484. {
  485. "@Message.ExtendedInfo": [
  486. {
  487. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  488. "Message": "Successfully Completed Request",
  489. "MessageArgs": [],
  490. "MessageId": "Base.1.4.0.Success",
  491. "Resolution": "None",
  492. "Severity": "OK"
  493. }
  494. ],
  495. "ActiveDirectory": {
  496. "AccountProviderType": "ActiveDirectoryService",
  497. "Authentication": {
  498. "AuthenticationType": "UsernameAndPassword",
  499. "Password": null,
  500. "Username": "cn=dvtuser,cn=Users,dc=Corp,dc=ibm,dc=com"
  501. },
  502. "LDAPService": {
  503. "SearchSettings": {
  504. "BaseDistinguishedNames": [
  505. "dc=Corp,dc=ibm,dc=com"
  506. ],
  507. "GroupsAttribute": "",
  508. "UsernameAttribute": ""
  509. }
  510. },
  511. "RemoteRoleMapping": [
  512. {
  513. "LocalRole": "Administrator",
  514. "RemoteGroup": "Admingroup13"
  515. },
  516. null,
  517. {
  518. "LocalRole": "Operator",
  519. "RemoteGroup": "Admingroup14"
  520. }
  521. ],
  522. "ServiceAddresses": [
  523. "ldap://9.194.251.141/"
  524. ],
  525. "ServiceEnabled": false
  526. }
  527. 20) change the Remote group of first remote role mapping
  528. ========================================================
  529. curl -k -H "X-Auth-Token: $bmc_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService/ -D patch.txt -d '{"ActiveDirectory":{"RemoteRoleMapping": [{"RemoteGroup": "Admingroup25"},{}]}}'
  530. {
  531. "@Message.ExtendedInfo": [
  532. {
  533. "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
  534. "Message": "Successfully Completed Request",
  535. "MessageArgs": [],
  536. "MessageId": "Base.1.4.0.Success",
  537. "Resolution": "None",
  538. "Severity": "OK"
  539. }
  540. ],
  541. "ActiveDirectory": {
  542. "AccountProviderType": "ActiveDirectoryService",
  543. "Authentication": {
  544. "AuthenticationType": "UsernameAndPassword",
  545. "Password": null,
  546. "Username": "cn=dvtuser,cn=Users,dc=Corp,dc=ibm,dc=com"
  547. },
  548. "LDAPService": {
  549. "SearchSettings": {
  550. "BaseDistinguishedNames": [
  551. "dc=Corp,dc=ibm,dc=com"
  552. ],
  553. "GroupsAttribute": "",
  554. "UsernameAttribute": ""
  555. }
  556. },
  557. "RemoteRoleMapping": [
  558. {
  559. "LocalRole": "Administrator",
  560. "RemoteGroup": "Admingroup25"
  561. },
  562. {
  563. "LocalRole": "Operator",
  564. "RemoteGroup": "Admingroup14"
  565. }
  566. ],
  567. "ServiceAddresses": [
  568. "ldap://9.194.251.141/"
  569. ],
  570. "ServiceEnabled": false
  571. }
  572. }
Add Comment
Please, Sign In to add comment