VMware Solutions Discussions

Upgrade certificate to CA

FilipS
3,547 Views

I'm trying to upgrade the self signed certificate of ONTAP Tools for vSphere version 10.4 to one signed by our internal MS CA.
When doing so, I receive the error The payload for POST request is invalid.
I already found KB: Unable to upgrade from certificate to CA in ONTAP Tools for VMware vSphere v10.3 - NetApp Knowledge Base

This however does not help.

 

1 ACCEPTED SOLUTION

ChanceBingen
2,406 Views

Hi, @FilipS 

I just got back into town after a bit of travel. Eyeballing your API calls, and comparing to my lab, it looks like you need to add the -H "x-auth: [JWT token]" with your JWT token from the output of your authentication. Like this:

 

curl -X POST "https://x.x.x.x:8443/virtualization/api/v1/commons/certificates" -H  "accept: application/json" -H  "x-auth: JWT_Token" -H  "Content-Type: application/json" -d "{\"cert\":\"string\"}"
 

View solution in original post

7 REPLIES 7

FilipS
3,544 Views

Here is a screenshot.

Untitled.png

ChanceBingen
3,492 Views

Interesting. I wonder if there is some kind of bug with the way the GUI takes the certificate contents and malforms the REST API.

 

Can you try using the REST API instead of the GUI?
https://<OTV.IP>:8443/#/Commons/virtualization__commonsAddCertificate

ChanceBingen
3,485 Views

If you do use the REST APIs, you will need to authenticate and get a token here:

https://<IP>:8443/#/Auth/virtualization__validateAdminLogin

FilipS
3,480 Views

Hmmm. I'm getting the following response:

{  "error": {    "code": "error_converting_input_to_certificate_request",    "message": "Error converting input to Certificate request",    "target": "Certificates"
  }
}

 

ChanceBingen
3,475 Views

I see, can you post the curl -X POST command generated by swagger? Alter the username/password/certificate for security.

FilipS
3,474 Views

Here you go.

 

Authentication:
curl -X POST "https://x.x.x.x:8443/virtualization/api/v1/auth/login" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"username\":\"Administrator\",\"password\":\"mypassword\"}"

 

Add certificate:

curl -X POST "https://x.x.x.x:8443/virtualization/api/v1/commons/certificates" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"cert\": \"mycert...\"}"

ChanceBingen
2,407 Views

Hi, @FilipS 

I just got back into town after a bit of travel. Eyeballing your API calls, and comparing to my lab, it looks like you need to add the -H "x-auth: [JWT token]" with your JWT token from the output of your authentication. Like this:

 

curl -X POST "https://x.x.x.x:8443/virtualization/api/v1/commons/certificates" -H  "accept: application/json" -H  "x-auth: JWT_Token" -H  "Content-Type: application/json" -d "{\"cert\":\"string\"}"
 
Public