VMware NSX-T Datacenter
VMware NSX
###--###--###--####
"#curl -k -X GET -H "Content-Type: application/json" -H 'X-NSX-Username:admin' -H 'X-NSX-Groups:superuser' "http://127.0.0.1:7440/nsxapi/api/v1/trust-management/certificates/<cert-id>?action=get_private"
root@AGM:~# curl -k -X GET -H "Content-Type: application/json" -H 'X-NSX-Username:admin' -H 'X-NSX-Groups:superuser' "http://127.0.0.1:7440/nsxapi/api/v1/trust-management/certificates/#####--###--###--####?action=get_private"
{
"display_name": "TEST-CERT-FROM-ACTIVE",
"pem_encoded" : "-----BEGIN CERTIFICATE-----\n********\n-----END CERTIFICATE-----\n",
"private_key" : "-----BEGIN RSA PRIVATE KEY-----\n*****\n-----END RSA PRIVATE KEY-----\n",
"key_algo" : "RSA",
"_protection" : "NOT_PROTECTED"
}
note: After export the generated new certificate, delete the certificate from the Active GM
Note: In the certificate content do not remove the /n character, copy and paste the same content including /n, collected using the GET API call to import it correctly. Also "display_name":""
field can be added as needed, if its not there.
Using curl command follow the below steps.
1. Login to Standby GM via SSH using root user and create a new file in /tmp directory with name 'payload.json' which should contain below content.
{
"display_name": "TEST-CERT-FROM-ACTIVE",
"pem_encoded" : "-----BEGIN CERTIFICATE-----\n********\n-----END CERTIFICATE-----\n",
"private_key" : "-----BEGIN RSA PRIVATE KEY-----\n*****\n-----END RSA PRIVATE KEY-----\n",
"key_algo" : "RSA",
"_protection" : "NOT_PROTECTED"
}
2. Then run below POST API call to import the certificate.
Using curl:
curl -k -H "Content-Type: application/json" -u admin
-X POST "https://standbyGM-manager-ip/api/v1/trust-management/certificates?action=import"
--data /tmp/payload.json
Using postman client:
POST https://standbyGM-manager-ip/api/v1/trust-management/certificates?action=import
Put the 'payload.json' content in body field.
Standby GM:
After the certificate is imported on the standby GM, Replace the certificate using the replace certificate documentation.