ESXi Certificate Management for VMware Cloud Foundation
VMware Cloud Foundation
If your organization has a policy to use certificates signed by an external certificate authority (CA), you must replace the default ESXi SSL certificates that are signed by the VMware Certificate Authority (VMCA).
SDDC Manager does not manage certificates for ESXi hosts. Instead, VMCA on vCenter Server provisions each new ESXi host with a signed certificate where VMCA is the root certificate authority by default. To comply with the policy of your organization, you manually replace the host’s certificate.
You can replace host certificates step-by-step by using product user interface or in an automated way, as code-based alternatives to certain UI-based procedures, by calling the cmdlets in the VMware.CloudFoundation.CertificateManagement module in PowerShell Gallery.
If you want to read the documentation, provide feedback, report an issue with automation, or contribute to the
VMware.CloudFoundation.CertificateManagement
module, go to the VMware.CloudFoundation.CertificateManagement open-source project in Github.Content Scope
The ESXi certificate management guidance in this section covers following scenarios:
- Replacing an ESXi host certificate signed by VMCA with a certificate signed by an external certificate authority in an already deployed SDDC workload domain.
- Replacing an ESXi host certificate signed by an external certificate authority with another certificate signed by an external certificate authority in an already deployed SDDC workload domain.
Prerequisites
To perform the configuration associated with ESXi certificate management, verify that your system fulfills the following prerequisites.
Category | Prerequisite |
---|---|
Environment | Verify that your VMware
Cloud Foundation instance is healthy and fully operational. |
Infrastructure-as-code | To use the infrastructure-as-code method for managing ESXi host certificates, verify that your system fulfills the prerequisites, described in the documentation of the VMware.CloudFoundation.CertificateManagement open-source project in Github. |
Change the Certificate Mode to Custom for the ESXi Hosts in a Workload Domain
You change certificate mode for the hosts in a workload domain in
VMware Cloud Foundation
to custom so that VMCA no longer automatically provisions the ESXi hosts with VMCA certificates.Prerequisites
- The workload domain vCenter Server must be in a scheduled maintenance window. You must restart vCenter Server service to finish the process.
UI Procedure
- Log in to the workload domain vCenter Server that manages the target hosts athttps://<vcenter-server_fqdn>/uiasadministrator@vsphere.local.
- Change the certificate mode for the managed ESXi hosts.
- In theHosts and Clustersinventory, select the vCenter Server instance.
- On theConfiguretab, underSettings, clickAdvanced Settingsand clickEdit Settings.
- In theNamefilter text box, entervpxd.certmgmt.mode.
- Change the value ofvpxd.certmgmt.modetocustom, and clickSave.
- Restart the vCenter Server instance for apply the changes.
- From the vSphere Client Menu, selectAdministration.
- In theDeploymentsection, selectSystem configuration.
- Select the vCenter Server instance from the list and clickReboot node.
- EnterChange ESXi certificate mode to custom CA mode.as a reason for the restart and clickReboot.
- Verify that the vCenter Server instance has successfully restarted and that you are able to log in to the vSphere Client.
- Acknowledge thevSphere vCenter Host Certificate Management Modealarm.
- In the vSphere Client, verify that for the workload domain vCenter Server the value of thevpxd.certmgmt.modeproperty iscustom.
PowerShell Procedure
- Start Windows PowerShell.
- Replace the values in the sample code and run the commands in the PowerShell console.$sddcManagerFqdn = "sfo-vcf01.sfo.rainpole.io" $sddcManagerUser = "administrator@vsphere.local" $sddcManagerPass = "VMw@re1!" $workloadDomain = "sfo-m01" $mode = "custom"
- Set the ESXi certificate mode tocustomby running the following command in the PowerShell console.Set-EsxiCertificateMode -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $workloadDomain -mode $mode
- Restart the vCenter Server instance manually to apply the changes as described in the UI-assisted procedure.
- Retrieve and verify the ESXi certificate mode has been set tocustomby entering the following command.Get-EsxiCertificateMode -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $workloadDomain
Generate a Certificate Signing Request for the ESXi Hosts in a Workload Domain
By using the ESXi Shell, you generate Certificate Signing Request (CSR) files for each ESXi host in the workload domain. You can send the CSR files to a third-party certificate authority and receive CA-signed certificates for the hosts.
The certificate chain of the third-party certificate authority must be present in the trust store of SDDC Manager and the workload domain vCenter Server.
UI Procedure
- Log in to the ESXi Shell by using the DCUI or an SSH client as a user with administrator privileges.
- In the/etc/vmware/ssldirectory, create a file by running the following command.vi ESXi.cfg
- Place the following content in theESXi.cfgfile[ req ] days =default_md = sha512 default_bits = 2048 distinguished_name = req_distinguished_name prompt = no [ req_distinguished_name ] commonName =certificate-expiration-period (730)countryName =esxi-fqdnstateOrProvinceName =your-countrylocalityName =your-state0.organizationName =your-localityorganizationalUnitName =your-organizationyour-unit
- Run the following command to generate a private key and a CSR file, replacing the values in the example command.openssl req -new -nodes -outesxi-fqdn.csr -keyoutesxi-fqdn.key -config ESXi.cfg
- Export thefile and optionallyesxi-hostname.csrfrom the ESXi host, for example, by using an SCP utility, such as WinSCP.esxi-hostname.key
- Repeat the steps for the remaining ESXi hosts in the workload domain.
PowerShell Procedure
- Start Windows PowerShell.
- Replace the values in the sample code and run the commands in the PowerShell console.$sddcManagerFqdn = "sfo-vcf01.sfo.rainpole.io" $sddcManagerUser = "administrator@vsphere.local" $sddcManagerPass = "VMw@re1!" $workloadDomain = "sfo-m01" $cluster = "sfo-m01-cl01" $country = "US" $locality = "San Francisco" $organization = "Rainpole" $organizationUnit = "IT" $stateOrProvince = "California" $outputDirectory = "F:\CSR\"
- Perform the configuration by entering the following command in the PowerShell console.Request-VCFCsr -esxi -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $workloadDomain -cluster $cluster -Country $country -Locality $locality -Organization $organization -OrganizationUnit $organizationUnit -StateOrProvince $stateOrProvince -outputDirectory $outputDirectory
- Repeat the steps for each cluster in the workload domain.
What to do next
Send the CSR files to the third-party certificate authority to receive the CA-signed host certificates.
Verify That the Certificate Authority Is Trusted by vCenter Server and SDDC Manager
For a trusted communication, the certificate authority that signed the certificates of the ESXi hosts must be in the trust store of by both the workload domain vCenter Server and SDDC Manager.
UI Procedure
- Verify that the certificate of the CA is in the trust store of SDDC Manager.
- Log in to SDDC Manager athttps://<sddc_manager_fqdn>with a user assigned theAdminrole.
- In the navigation pane, click.
- On theWorkload Domainspage, click the target workload domain.
- On the workload domain summary page, click theCertificatestab.
- Verify the certificate issuer for thevcenterresource type is the same as the issuer of the CA-signed host certificates.
- Verify that the certificate of the CA is in the trust store of the workload domain vCenter Server.
- Log in to vCenter Server athttps://<vcenter_server_fqdn>/uiasadministrator@vsphere.local.
- From the vSphere Client Menu, selectAdministration.
- UnderCertificates, selectCertificate Management.
- On the upper right hand corner, select the vCenter Server instance from the drop-down menu.
- Verify that theTrusted Root Certificatesstore contains the certificate of the certificate authority with the same issuer name as the host certificates.
- Verify that the subject and serial number are the same as in the issuer part of the signed host certificates.
PowerShell Procedure
- Start Windows PowerShell.
- Replace the values in the sample code and run the commands in the PowerShell console.$sddcManagerFqdn = "sfo-vcf01.sfo.rainpole.io" $sddcManagerUser = "administrator@vsphere.local" $sddcManagerPass = "VMw@re1!" $workloadDomain = "sfo-m01" $rootCertificate = "F:\Certificate\rainpoleRoot64.cer" $issuer = "rainpole"
- Verify if the CA's certificate is trusted by running the following command.Confirm-CAInvCenterServer -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $workloadDomain -issuer $issuer -signedCertificate $rootCertificate
- Verify that the command output returnstrue.
Replace the ESXi Host Certificates with CA-Signed Certificate in a Workload Domain
Replace each ESXi host certificate with a CA-signed certificate obtained from a certificate authority to meet the security requirements of your organization.
Perform the replacement of the host certificates in the workload domain in a scheduled maintenance window. This operation requires more time to complete than is usually allocated in a regular operational mode.
UI Procedures
- Log in to the workload domain vCenter Server that manages the target hosts athttps://<vcenter-server_fqdn>/uiasadministrator@vsphere.local.
- If you are using vSAN as principal storage, verify the vSAN health.
- In theHosts and Clustersinventory, select the cluster that contains the ESXi hosts and click theMonitortab.
- In the left pane, under, clickRetestand confirm the operation.
- Verify no red alerts appear in theOverviewpane.
- In the left pane, under, verify that all synchronization tasks are complete.
- Place the ESXi host in maintenance mode.
- In theHosts and Clustersinventory, expand the workload domain vCenter Server and navigate to the first ESXi host in the first cluster.
- Right click on the ESXi host and select.
- In theEnter maintenance modedialog box, from thevSAN data migrationdrop-down menu, selectFull data migration, and clickOK.
- Deactivate ESXi lockdown mode.
- Click theConfiguretab for the ESXI host.
- UnderSystem, selectSecurity Profile.
- In theLockdown Modepane, clickEdit.
- In theLockdown Modedialog box, on theLockdown Modepage, selectDisabled.
- ClickOK.
- Disconnect the ESXi host from vCenter Server.
- In theHosts and Clustersinventory, right-click the ESXi host and select .
- In confirmation dialog box, clickOK.
- Back up the current ESXi host certificate.
- Log in to the ESXi Shell by using the DCUI or an SSH client as a user withadministratorprivileges.
- In the/etc/vmware/ssldirectory, rename the existing certificates by running the following commands.cp rui.crtesxi-hostname-orig.rui.crt cp rui.keyesxi-hostname-orig.rui.key
- Export theandesxi-hostname-orig.rui.crtfiles from the ESXi host, for example, by using an SCP utility, such as WinSCP.esxi-hostname-orig.rui.key
- Replace the ESXi host certificate.
- Copy theandesxi-hostname.cercertificate files, received from the certificate authority, to theesxi-hostname.key/etc/vmware/ssldirectory on the hosts, for example, by using an SCP utility, such as WinSCP.
- In the ESXi Shell, in the/etc/vmware/sslfolder, rename bothandesxi-hostname.certoesxi-hostname.keyrui.crtandrui.key, respectively, by running the following commands.Confirm any file replacement.mv /etc/vmware/ssl/esxi-hostname.cer rui.crt mv /etc/vmware/ssl/esxi-hostname.key rui.key
- Restart the ESXi host by running the following command.reboot
- In the vSphere Client, in theHosts and Clustersinventory, right-click the ESXi host and select .
- Verify the ESXi host certificate has been replaced successfully after the restart.
- Click theConfiguretab for the ESXI host.
- UnderSystem, selectCertificate.
- Verify the issuer and valid dates of the certificate match to CA-signed certificate.
- Verify that theStatusisGood.
- If you are using vSAN as principal storage, verify the vSAN health.
- Verify ESXi host connectivity to SDDC Manager.
- Log in to SDDC Manager athttps://<sddc_manager_fqdn>with a user assigned theAdminrole.
- In the navigation pane, select.
- Verify theConfiguration Statusof the host isActive.
- Verify ESXi host connectivity to the NSX Manager instance for the workload domain.
- In the NSX Manager UI athttps://<nsx_manager_fqdn>, click theSystemtab.
- Navigate to the host transport node.VMware Cloud Foundation VersionStepsVMware Cloud Foundation 4.5
- In the navigation pane, select.
- Click theHost Transport Nodestab.
- FromManaged bydrop-down menu, select the workload domain vCenter Server and expand the list.
VMware Cloud Foundation 4.5.1 or later- In the navigation pane, select.
- Click theClusterstab.
- Verify thatNSX configurationisSuccessandNode StatusisUpfor the ESXi host.
- In the vSphere Client, reactivate the lockdown mode of the ESXi host.
- Exit the maintenance mode of the ESXi host.
- In the vSphere Client, expand the workload domain vCenter Server and navigate to the ESXi host.
- Right-click the ESXi host and select.
- Repeat the procedure for the remaining ESXi hosts in the cluster.
- Repeat the procedure for the hosts in the remaining clusters in the workload domain.
PowerShell Procedure
- Start Windows PowerShell.
- Replace the values in the sample code and run the commands in the PowerShell console.$sddcManagerFqdn = "sfo-vcf01.sfo.rainpole.io" $sddcManagerUser = "administrator@vsphere.local" $sddcManagerPass = "VMw@re1!" $cluster = "sfo-m01-cl01" $workloadDomain = "sfo-m01" $certificateDirectory = "F:\Certificate" $certificateFileExt = ".cer"
- If you are using vSAN as principal storage, to verify the vSAN health status, run the following command and verify that the output contains no red alerts.Get-vSANHealthSummary -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $workloadDomain -cluster $cluster
- TheInstall-VCFCertificatecommand that you run to replace the host certificates does not back up the original ESXi certificate and private key.
- Replace the ESXi host certificate by running the following command.Install-VCFCertificate -esxi -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -domain $workloadDomain -cluster $cluster -certificateDirectory $certificateDirectory -certificateFileExt $certificateFileExtThe command output showssuccessfully completed certificate replacement.
- If you are using vSAN as principal storage, verify the vSAN health status again.
- Repeat the procedure for the remaining clusters in the workload domain.
What to do next
Because the ESXi certificate mode is set to custom, before adding ESXi hosts to the workload domain, replace their certificates with CA-signed ones.
Restore the Certificate of an ESXi Host in a Workload Domain from a Backup
If you run into issues during ESXi certificate replacement, you can restore the original certificate setup of a host from the backup you took before the replacement operation.
Procedure
- Log in to the workload domain vCenter Server that manages the target host athttps://<vcenter-server_fqdn>/uiasadministrator@vsphere.local.
- Place the ESXi host in maintenance mode.
- In theHosts and Clustersinventory, expand the workload domain vCenter Server and navigate to the first ESXi host in the first cluster.
- Right click on the ESXi host and select.
- For a vSAN cluster, in theEnter maintenance modedialog box, from thevSAN data migrationdrop-down menu, selectFull data migration, and clickOK.
- Deactivate ESXi Lockdown mode.
- Click theConfiguretab for the ESXI host.
- UnderSystem, selectSecurity Profile.
- In theLockdown Modepane, clickEdit.
- In theLockdown Modedialog box, on theLockdown Modepage, selectDisabled.
- ClickOK.
- Deactivate ESXi lockdown mode by using the VMware Host Client.The ESXi host might be disconnected from the workload domain vCenter Server because of authentication issues caused by the unsuccessful certificate replacement on the host.
- Log in to the ESXi host athttps://as<esxi_host_fqdn>/uiroot.
- In the navigation pane, select.
- SelectLockdown Modeand clickEdit settings.
- SelectDisabledand clickChange.
- Disconnect the ESXi host from vCenter Server.
- In the vSphere Client, in theHosts and Clustersinventory, right-click the ESXi host and select .
- In confirmation dialog box, clickOK.
- Restore the original ESXi host certificate.
- Copy the original certificate filesandesxi-hostname-orig.rui.crtto theesxi-hostname-orig.rui.key/etc/vmware/ssldirectory on the host, for example, by using an SCP utility, such as WinSCP..
- Log in to the ESXi Shell, using either the DCUI or an SSH client, as a user withadministratorprivileges.
- In the/etc/vmware/ssldirectory, renameandesxi-hostname-orig.rui.crttoesxi-hostname-orig.rui.keyrui.crtandrui.key, respectively, by running the following commands.mv /etc/vmware/ssl/esxi-hostname-orig.rui.crt rui.crt mv /etc/vmware/ssl/esxi-hostname-orig.rui.key rui.key
- Restart the ESXi host by running the following command.reboot
- In the vSphere Client, in theHosts and Clustersinventory, right-click the ESXi host and select .
- Verify the ESXi host certificate has been replaced successfully after the restart.
- Click theConfiguretab for the ESXI host.
- UnderSystem, selectCertificate.
- Verify the issuer and valid dates of the certificate match to CA-signed certificate.
- Verify that theStatusisGood.
- If you are using vSAN as principal storage, verify the vSAN health.
- In theHosts and Clustersinventory, select the cluster that contains the ESXi hosts and click theMonitortab.
- In the left pane, under, clickRetestand confirm the operation.
- Verify no red alerts appear in theOverviewpane.
- In the left pane, under, verify that all synchronization tasks are complete.
- Verify ESXi host connectivity to SDDC Manager.
- Log in to SDDC Manager athttps://<sddc_manager_fqdn>with a user assigned theAdminrole.
- In the navigation pane, select.
- Verify theConfiguration Statusof the host isActive.
- Verify ESXi host connectivity to the NSX Manager instance for the workload domain.
- In the NSX Manager UI athttps://<nsx_manager_fqdn>, click theSystemtab.
- Navigate to the host transport node.VMware Cloud Foundation VersionStepsVMware Cloud Foundation 4.5
- In the navigation pane, select.
- Click theHost Transport Nodestab.
- FromManaged bydrop-down menu, select the workload domain vCenter Server and expand the list.
VMware Cloud Foundation 4.5.1 or later- In the navigation pane, select.
- Click theClusterstab.
- Verify thatNSX configurationisSuccessandNode StatusisUpfor the ESXi host.
- Exit the maintenance mode of the ESXi host.
- In the vSphere Client, expand the workload domain vCenter Server and navigate to the ESXi host.
- Right-click the ESXi host and select.