Cloud Lab-13: How to Install Certificate in ESXi Server from Microsoft CA- ”Signed Certificate”

LAB-13 TASKS

In this Lab we will perform following tasks

  1. Configure CA (Singed certificate) prerequisite.
  2. Create certificate request
  3. Getting the singed certificate from CA.
    • For Commercial CAs (it’s optional in our case)
    • For Microsoft CA
  4. Install and configure certificate signed certificate on ESXi Host
  5. Verify ESXi Signed SSL Certificate.
    • Use case 1: if you are checking from domain (vmlab.com) joined system
    • Use case 2: if you are checking from non-domain (vmlab.com) joined system

1-Configure CA (Singed certificate) prerequisite.

There are several different work flows required for a successful implementation of SSL Certificate on ESXi Hosts. This information has been taken from VMWare KB article (2015387):

  • Creating the certificate request
  • Getting the singed certificate from CA
  • Installation and configure signed certificate on the ESXi host

Note: Wildcard certificates are not supported at the time of this post.

These steps must be followed to ensure successful implementation of a custom certificate for an ESXi 5.x host. Before attempting these steps ensure that:

  • You have a vSphere 5.x environment.
  • Configuring OpenSSL (in Windows) for installation and configuration of CA signed certificates in the vSphere environment (See KB 2015387), in my case I am Linux Utility of open SSL.
  • You have an SSH client (such as Putty) installed
  • You have a SFTP/SCP client (such as WinSCP) installed

2-Create Certificate request

Open the SSH session. Before proceeding further, verify SSL is installed properly, in Linux use below cmd. 

cloudlab13-installsingedcertificateinesxi-1

 To Generate CSR. (This will create the certificate request rui.csr.)

cloudlab13-installsingedcertificateinesxi-2

Note: make sure “common name” is exact the same name (FQDN) as you entered in DNS.

Convert the Key to be in RSA format by running the following command:

cloudlab13-installsingedcertificateinesxi-2.1

Verify the converted RSA key.

cloudlab13-installsingedcertificateinesxi-3

When “rui.csr” is created, proceed to Getting the certificate

3-Getting the singed certificate from CA

After the certificate request is created, the certificate must be given to the certificate authority for generation of the actual certificate. The authority will present a certificate back, as well as a copy of their root certificate, if necessary. For the certificate chain to be trusted, the root certificate must be installed on the server.

For Commercial CAs (it’s optional in our case):

Take the certificate request (rui.csr, as generated above) and send it to the authority in question.

The authority will send back the generated certificate.

Install the root certificate onto the vCenter server before proceeding to the Installation of the certificate section of this document.

For Microsoft CA:

Log in to the Microsoft CA certificate authority web interface. By default, it is http://<servername>/CertSrv/

Click Request a certificate.

cloudlab13-installsingedcertificateinesxi-4

Click advanced certificate request.

cloudlab13-installsingedcertificateinesxi-5

Click “Submit a certificate request by using a base-64-encoded CMC or PKCS #10” file, or submit a renewal request by using a base-64-encoded PKCS #7 file.

cloudlab13-installsingedcertificateinesxi-6

Open the certificate request (rui.csr) in a plain text editor.

Copy from —–BEGIN CERTIFICATE REQUEST—– to —–END CERTIFICATE REQUEST—– into the Saved Request box. Make sure no blank space exists in the start and end.

cloudlab13-installsingedcertificateinesxi-7

Click “VMWare Template” (which we created in CA Server installation section ). Click “Submit” to submit the request.

cloudlab13-installsingedcertificateinesxi-8

Click “Base 64 encoded” on the Certificate issued screen.

cloudlab13-installsingedcertificateinesxi-9

Click “Download Certificate”.

*NOTE: Save the certificate on the desktop or any other drive of the server as “rui.crt”*

Here is the final look.

cloudlab13-installsingedcertificateinesxi-10

When complete, proceed to Installing and configuring the certificate on the ESXi host to complete the configuration of the custom certificate.

4-Install and Configure signed certificate on ESXi Host

After the certificate is created

Log in to vCenter Server (https://vc-rg.vmlab.com:9443/vsphere-client)

cloudlab13-installsingedcertificateinesxi-11

Put host into Maintenance Mode

cloudlab13-installsingedcertificateinesxi-12

Verify ESXi is in maintenance mode.

cloudlab13-installsingedcertificateinesxi-13

Navigate to the console of the server to enable SSH on the ESXi 5.x host.

Press “F2” to log in to the Direct Console User Interface (DCUI).

cloudlab13-installsingedcertificateinesxi-14

Click Troubleshooting options > Enable “SSH” (Skip this if SSH is already enabled)

cloudlab11-esxiinstallation33

cloudlab11-esxiinstallation34

Log in (SSH) to the host (launch the putty).

cloudlab13-installsingedcertificateinesxi-15

Navigate to “/etc/vmware/ssl” directory, Copy ssl files to a backup location. In my lab, I created a backup folder in the same place and move the existing certificate files into the back folder as shown.

cloudlab13-installsingedcertificateinesxi-16

Log in to the host with WinSCP.

cloudlab13-installsingedcertificateinesxi-17
Navigate to the “/etc/vmware/ssl” directory.

cloudlab13-installsingedcertificateinesxi-18

Delete the existing “rui.crt” and “rui.key” from the directory (/etc/vmware/ssl)

NOTE: (skip this step because we already took the backup).

Drag the “rui.cer” and “.key” file from desktop to esxi host (/etc/vmware/ssl), it will prompt you click copy

cloudlab13-installsingedcertificateinesxi-19

Type less “rui.crt” to validate that there are no special characters ( ^M) appearing in the certificate file.

cloudlab13-installsingedcertificateinesxi-20

*NOTE: There should not be any erroneous ^M characters at the end of each line.*

Switch back to the “DCUI” of the host and select “Troubleshooting Options” -> “Restart Management Agents”

cloudlab13-installsingedcertificateinesxi-21

When prompted press “F11” to restart the agents. Wait until they are restarted.

cloudlab13-installsingedcertificateinesxi-22

Press “ESC” several times until you logout of the DCUI.

Exit the host from “Maintenance Mode”.

cloudlab13-installsingedcertificateinesxi-23

When complete, the host is made available and successfully rejoins the cluster.

*NOTE: If you have fresh environment and your host did not join the vCenter then skip maintenance mode step and install certificate directly to the host*

5-Verify ESXi Singed SSL Certificate.

To verify, open the ESXI web page https://esxi-1-rg.vmlab.com. You should see SSL Certificate warning message before singed certificate installation.

cloudlab13-installsingedcertificateinesxi-24

After SSL installation.

Use case 1: if you are checking from domain (vmlab.com) joined system.

*In this use case. Every system in on the same domain where the CA Server exists.it is the feature of Enterprise Root CA. every host automatically get the root CA when he joined the domain*

 There is no SSL certificate anymore. Great work 🙂

cloudlab13-installsingedcertificateinesxi-25

Check the Certificate.

Click on Lock Sign and view the certificate info. For detail click on view certificates

cloudlab13-installsingedcertificateinesxi-26

Check the Issuer certificate authority and issued info with validity period of this certificate.

cloudlab13-installsingedcertificateinesxi-27

Check and verify the Certificate chain

cloudlab13-installsingedcertificateinesxi-28

Use case 2: if you are checking from non-domain (vmlab.com) joined system.

*In this use case your system is not on CA domain (vmlab.com) then you have to manually trust the CA root certificate in order to trust his underlying issued certificates structure*

Click on Certificate error-> View Certificates

cloudlab13-installsingedcertificateinesxi-29

See even the correct Certificate we got the error message.

cloudlab13-installsingedcertificateinesxi-30

Download the Root CA

Go to CA server. Open (http://ip-of-the-host/certsrv)

Click on Download a “CA Certificate, certificate chain, or CRL”

cloudlab13-installsingedcertificateinesxi-31

Select “Base 64”. Click “download CA certificate” to download root CA.

cloudlab13-installsingedcertificateinesxi-32

Place the certificate (Root CA) on the machine which was not on domain and you want to “import root CA”.

cloudlab13-installsingedcertificateinesxi-33

Right click on certificate -> install certificate -> click “Next”

Select “Place all certificate in the following store”, click browse and “select trusted root certificate.”

Click “Next” -> “Finish”

cloudlab13-installsingedcertificateinesxi-34

Then wait for few sec. you will prompt the security warning – click “yes”

cloudlab13-installsingedcertificateinesxi-35

cloudlab13-installsingedcertificateinesxi-36

Open the ESXi URL (https://esxi-1-rg.vmlab.com) again or just refresh it.

You will notice the lock sign. No more certificate warnings 🙂

cloudlab13-installsingedcertificateinesxi-37

REPEAT THE SAME STEPS FOR OTHER (RESOURCE GROUP AND MANAGEMENT) ESXI SERVERS TO INSTALL SINGED CERTIFICATE 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s