Interaction with OpsCode Chef HTTP REST API from vCenter Orchestrator v5.1 Update 1
I need to be able to use the HTTP REST API to initiate commands against the Chef server during provisioning and decommissioning of virtual machines.
This requires the ability to use the SHA1 algorithm and also the Base64 algorithm within vCenter Orchestrator v5.1 Update 1 to create the hashes header.
Method:HTTP_METHOD
Hashed Path:HASHED_PATH
X-Ops-Content-Hash:HASHED_BODY
X-Ops-Timestamp:TIME
X-Ops-UserId:USERID
where:
- HTTP_METHOD is the method used in the API request (GET, POST, and so on)
- HASHED_PATH is the path of the request (/name_of_endpoint for the open source server and /organizations/organization_name/name_of_endpoint for Hosted Chef or Private Chef). The HASHED_PATH must be hashed using SHA1 and encoded using Base64 and must not have repeated forward slashes (/) or end in a forward slash (unless the path is /).
- The private key must be an RSA key in the SSL .pem file format. This signature is then broken into character strings (of not more than 60 characters per line) and placed in the header.
The server de-crypts this header and ensures its content matches the content of the non-encrypted headers that were in the request. The time stamp of the message is checked to ensure the request was received within a reasonable amount of time. One approach generating the signed headers is to use mixlib-authentication, which is a class-based header signing authentication object similar to the one used by the chef-client.
Any help with this would be greatly appreciated.