DMN="$(/usr/lib/vmware-vmafd/bin/vmafd-cli get-domain-name --server-name localhost)"; DMN_DN="dc=$(echo "$DMN" | sed -e 's/\./\,dc=/g')"; ldapsearch -H ldap://localhost -D "cn=administrator,cn=users,$DMN_DN" -W -b "cn=tenantcredential-1,cn=$DMN,cn=Tenants,cn=IdentityManager,cn=Services,$DMN_DN" userCertificate -o ldif-wrap=no | sed -s -n '11p' | sed 's/userCertificate:: //' | awk '{print "-----BEGIN CERTIFICATE-----\n"$0"\n-----END CERTIFICATE-----"}'|openssl x509 -noout -text -in /dev/stdin
Follow the below steps to replace other Certificates after replacing the STS Certificate.
Note: Take a snapshot or a backup of the vCenter before proceeding.
To regenerate the vSphere 6.x certificates using a new self-signed VMware Certificate Authority certificate:
/usr/lib/vmware-vmca/bin/certificate-manager
C:\Program Files\VMware\vCenter Server\vmcad\certificate-manager
[email protected]
password when prompted.Please configure certool.cfg file with proper values before proceeding to next step.
Press Enter key to skip optional parameters or use Default value.
Enter proper value for 'Country' [Default value : US] :
(Note: Value for Country should be only 2 letters)Enter proper value for 'Name' [Default value : CA] :
(Note: As stated below, this value will be the PNID)Enter proper value for 'Organization' [Default value : VMware] :
Enter proper value for 'OrgUnit' [Default value : VMware Engineering] :
Enter proper value for 'State' [Default value : California] :
Enter proper value for 'Locality' [Default value : Palo Alto] :
Enter proper value for 'IPAddress' [optional] :
Enter proper value for 'Email' [Default value : [email protected]] :
Enter proper value for 'Hostname' [Enter valid Fully Qualified Domain Name(FQDN), For Example : example.example.com] :
Enter proper value for VMCA 'Name':
(Note: This information will be requested from vCenter Server 6.0 U3, 6.5 and later builds, you may use the FQDN/PNID of vCenter Server for this field. It will be used as a Common Name for the VMCA Root Certificate)You are going to regenerate Root Certificate and all other certificates using VMCA
Continue operation : Option[Y/N] ? : Y
/usr/lib/vmware-vmafd/bin/vmafd-cli get-pnid --server-name localhost
localhost
' (this is a not recommended configuration): localhost
' when prompted to add alternate SAN (Subject Alternative Name) names to the certificate. C:\Program Files\VMware\vCenter Server\vmafdd\" vmafd-cli.exe get-pnid --server-name localhost
The script is able to replace the following Certificates on vCenter Server:
VMCA Root