Lab:Use OpenSSL to generate the Certificate Signing Request (CSR) for VMware NSX (with multiple SANs): Difference between revisions

From Iwan
Jump to: navigation, search
m (Cleaning up wiki tables)
No edit summary
Line 32: Line 32:


</div>
</div>
⚠️ You can not use the NSX Manager to generate a new CSR that are usable for the signing and replacement of CA signed certificates. The NSX Manager does not provides the private key with the CSR. This private key is required later in this [https://www.notion.so/Lab-Replacing-the-self-signed-SSL-certificates-with-CA-signed-certificates-f39072b7eab145e2bb4a388deec7af1a?pvs=21 step]. For this reason you need to use another tool to generate the CSR. I am using OpenSSL in this article.
⚠️ You can not use the NSX Manager to generate a new CSR that are usable for the signing and replacement of CA signed certificates. The NSX Manager does not provides the private key with the CSR. This private key is required later in this [https://www.iwanhoogendoorn.nl/index.php/Lab:_Replacing_the_self-signed_SSL_certificates_with_CA-signed_certificates step]. For this reason you need to use another tool to generate the CSR. I am using OpenSSL in this article.


<span id="0d32cd91-e27e-4ec3-9a2c-6a046241bf44"></span>
<span id="0d32cd91-e27e-4ec3-9a2c-6a046241bf44"></span>
Line 141: Line 141:
! Algorithm
! Algorithm
|-
|-
| [https://www.notion.so/Pod-120-NSXT-LM-1-14c859ba2e9a4bfbb917dfca042ed04e?pvs=21 Pod-120-NSXT-LM-1]
| Pod-120-NSXT-LM-1
| pod-120-nsxt-lm-1.sddc.lab
| pod-120-nsxt-lm-1.sddc.lab
| NSX Academy
| NSX Academy
Line 152: Line 152:
| RSA
| RSA
|-
|-
| [https://www.notion.so/Pod-120-NSXT-LM-2-f146268ed481445ea54d17fc11fe5398?pvs=21 Pod-120-NSXT-LM-2]
| Pod-120-NSXT-LM-2
| pod-120-nsxt-lm-2.sddc.lab
| pod-120-nsxt-lm-2.sddc.lab
| NSX Academy
| NSX Academy
Line 163: Line 163:
| RSA
| RSA
|-
|-
| [https://www.notion.so/Pod-120-NSXT-LM-3-a44a75b272cd4278964e7a8fbdf573bb?pvs=21 Pod-120-NSXT-LM-3]
| Pod-120-NSXT-LM-3
| pod-120-nsxt-lm-3.sddc.lab
| pod-120-nsxt-lm-3.sddc.lab
| NSX Academy
| NSX Academy
Line 174: Line 174:
| RSA
| RSA
|-
|-
| [https://www.notion.so/Pod-120-NSXT-LM-38e23eb3332d46a991ed3cf92b473340?pvs=21 Pod-120-NSXT-LM]
| Pod-120-NSXT-LM
| pod-120-nsxt-lm.sddc.lab
| pod-120-nsxt-lm.sddc.lab
| NSX Academy
| NSX Academy
Line 185: Line 185:
| RSA
| RSA
|-
|-
| [https://www.notion.so/Pod-120-NSXT-LM-wildcard-bcfe426da3ed485d85cdb78e33a8493a?pvs=21 Pod-120-NSXT-LM (wildcard)]
| Pod-120-NSXT-LM (wildcard)
| pod-120-nsxt-lm.sddc.lab
| pod-120-nsxt-lm.sddc.lab
| NSX Academy
| NSX Academy
Line 204: Line 204:
| RSA
| RSA
|}
|}


</div>
</div>
Line 316: Line 313:
-----END PRIVATE KEY-----</pre></div></div>
-----END PRIVATE KEY-----</pre></div></div>


<div id="1972278d-4e61-4f9f-bb74-60739bd21488" class="figure callout" style="white-space:pre-wrap;display:flex">
'''Continue with >>''' [[Lab: Signing the NSX CSR with a Microsoft (root) CA Server]]


<div style="font-size:1.5em">
[[Category:NSX]]
 
[[Category:Networking]]
<span class="icon">⚡</span>
[[Category:VMware]]
 
[[Category:NSX Academy]]
</div>
<div style="width:100%">
 
[https://www.notion.so/Lab-Signing-the-NSX-CSR-with-a-Microsoft-root-CA-Server-a815c16eaaed47e9be4ccc4d4b5a655d?pvs=21 Continue with Signing the NSX CSR with a Microsoft (root) CA Server]
 
</div>
 
</div>
 
</div>
<span class="sans" style="font-size:14px;padding-top:2em"></span>

Revision as of 13:12, 21 January 2024

In this lab I am working with the following software and versions:

Software Version Filename
VMware NSX 4.0.0.1 nsx-unified-appliance-4.0.0.1.0.20159694.ova
Windows Server 2019 en_windows_server_2019_updated_feb_2020_x64_dvd_de383770.iso
OpenSSL 1.1.1q Win64OpenSSL_Light-1_1_1q.exe
Visual C++ Redistributable Packages 2017 14.16.27033 VC_redist.x64.exe
  1. Create a “wildcard” CSR that can be used to sign and that can be used for all NSX Manager Nodes including the NSX Manager VIP address.

Untitled.png

⚠️ You can not use the NSX Manager to generate a new CSR that are usable for the signing and replacement of CA signed certificates. The NSX Manager does not provides the private key with the CSR. This private key is required later in this step. For this reason you need to use another tool to generate the CSR. I am using OpenSSL in this article.

The Steps

  • STEP 1: Install OpenSSL and Visual C++ Redistributable Packages
  • STEP 2: Create a the certificate config file
  • STEP 3: Use OpenSSL to generate the .csr and .key file


STEP 1: Install OpenSSL and Visual C++ Redistributable Packages

Visual C++ Redistributable Packages

Agree on the license terms and conditions and click “Install”.

Untitled%201.png

Review the progress.

Untitled%202.png

Click on “

Untitled%203.png

Open SSL

Select “I accept the agreement” and click “Next”.

Untitled%204.png

Click “Next”.

Untitled%205.png

Click “Next”.

Untitled%206.png

Select “The OpenSSL binaries (/bin) directory” and click “Next”.

Untitled%207.png

Click “Install”.

Untitled%208.png

Click “Finish”.

Untitled%209.png

The OpenSSL executable file is stored in this directory:

C:\Program Files\OpenSSL-Win64\bin

STEP 2: Create the certificate config file

I am using the information in the table below of the Pod-120-NSXT-LM (wildcard) as input for the config file.

NSX Manager Node C(ommon N(Name) O(rganization) O(rg) (Unit) C(ountry) ST(ate) L(ocality) (SAN) DNS Names Key Size Algorithm
Pod-120-NSXT-LM-1 pod-120-nsxt-lm-1.sddc.lab NSX Academy Education NL ZH Rotterdam pod-120-nsxt-lm-1.sddc.lab 2048 RSA
Pod-120-NSXT-LM-2 pod-120-nsxt-lm-2.sddc.lab NSX Academy Education NL ZH Rotterdam pod-120-nsxt-lm-2.sddc.lab 2048 RSA
Pod-120-NSXT-LM-3 pod-120-nsxt-lm-3.sddc.lab NSX Academy Education NL ZH Rotterdam pod-120-nsxt-lm-3.sddc.lab 2048 RSA
Pod-120-NSXT-LM pod-120-nsxt-lm.sddc.lab NSX Academy Education NL ZH Rotterdam pod-120-nsxt-lm.sddc.lab 2048 RSA
Pod-120-NSXT-LM (wildcard) pod-120-nsxt-lm.sddc.lab NSX Academy Education NL ZH Rotterdam pod-120-nsxt-lm.sddc.lab

pod-120-nsxt-lm-1.sddc.lab
pod-120-nsxt-lm-2.sddc.lab
pod-120-nsxt-lm-3.sddc.lab
pod-120-nsxt-lm
pod-120-nsxt-lm-1
pod-120-nsxt-lm-2
pod-120-nsxt-lm-3

2048 RSA

Create a new file named nsx.cfg with the following content.

[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
encrypt_key = no
prompt = no
string_mask = nombstr
req_extensions = v3_req
[ v3_req ]
basicConstraints = CA:TRUE
keyUsage = digitalSignature, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth, clientAuth
subjectAltName = DNS:pod-120-nsxt-lm, DNS:pod-120-nsxt-lm.sddc.local, DNS:pod-120-nsxt-lm-1, DNS:pod-120-nsxt-lm-1.sddc.local, DNS:pod-120-nsxt-lm-2, DNS:pod-120-nsxt-lm-2.sddc.local, DNS:pod-120-nsxt-lm-3, DNS:pod-120-nsxt-lm-3.sddc.local
[ req_distinguished_name ]
countryName = NL
stateOrProvinceName = ZH
localityName = Rotterdam
0.organizationName = NSX Academy
organizationalUnitName = Education
commonName = pod-120-nsxt-lm.sddc.local

Save the file in a separate /certs folder (to keep things clean).

Untitled%2010.png

STEP 3: Use OpenSSL to generate the .csr and .key file

Use the following command to generate the .csr and .key file.

C:\Program Files\OpenSSL-Win64\bin>openssl req -out ./certs/nsxcert.csr -newkey rsa:2048 -nodes -keyout ./certs/nsxcert.key -config ./certs/nsx.cfg
Generating a RSA private key
..............+++++
...............+++++
writing new private key to './certs/nsxcert.key'
-----

C:\Program Files\OpenSSL-Win64\bin>

Verify if the .csr and .key file are available.

Untitled%2011.png

The CSR output:
-----BEGIN CERTIFICATE REQUEST-----
MIID4zCCAssCAQAwfTELMAkGA1UEBhMCTkwxCzAJBgNVBAgTAlpIMRIwEAYDVQQH
EwlSb3R0ZXJkYW0xFDASBgNVBAoTC05TWCBBY2FkZW15MRI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