Generating TLS Self-Signed Certification Between NDB Server and NDB Switch for NXAPI in the App
This section describes how to generate TLS self-signed certification between NDB server and NDB Switch in the app deployment.You need to generate certificates and keys for each switch to enable TLS. TLS communication between NDBswitch and NDB server uses port 443 only.
Complete the following steps to generate TLS self-signed certification between NDB Server and NDB Switch for NXAPI:
Note |
You cannot configure a controller to communicate using port 80 after configuring TLS. |
Generating Self-signed Certificate and Key
Use this procedure to generate self-signed certificate and key.
Before you begin
nsure that you have domain name configured on the switch using ip domain-name command for each NDB switch that acts as the Fully Qualified Domain Name (FQDN) for the switch. For example:
conf t
ip domain-name cisco.com hostname N9k-117
end
The FQDN for the switch is configured to N9K-117.cisco.com.
Procedure
Step 1 |
Log in to one of the app containers as root user. For logging in to an ND/ APIC container, see Logging in to a Container on Cisco Nexus Dashboard or Logging in to a Container on Cisco APIC. |
||
Step 2 |
Generate the private key and self-signed certificate using the openssl req command. This command creates a certificate file (sw1-ca.pem) and a private key (sw1-ca.key).
|
||
Step 3 |
Copy the certificate file, sw1-ca.pem, and keyfile, sw1-ca.key, to the switch using the scp command. Example:
|
||
Step 4 |
Use the cat command to get the contents of sw1-ca.pem file; copy the contents of the same. Create a file with the same name on all other containers and paste the copied contents into it using vi editor and save the
changed file. Perform the same steps to copy the contents of |
||
Step 5 |
Configure the certificate file, sw1-ca.pem, and keyfile, sw1-ca.key in the switch using the nxapi command. Example:
|
||
Step 6 |
Enable self-signed certificates on the switch using the nxapi certificate command. Example:
|
||
Step 7 |
Log in to the containers of the app as root user. |
||
Step 8 |
Copy and convert the sw1-ca.key and sw1-ca.pem files to .PEM format using the copy command. Example:
|
||
Step 9 |
Concatenate the private key and the certificate file using cat command. Example:
|
||
Step 10 |
Convertthe .pem file to .p12 file format using the openssl command. Enter the export password when prompted to create a password protected .p12 certificate file. Example:
|
||
Step 11 |
Convert the sw1-ndb.p12 to a password protected Java KeyStore (tlsKeyStore) file using the keytool command. Use the Example:
|
||
Step 12 |
List and verify content in the java tlsKeyStore using the keytool command. Example:
|
Creating the TLS TrustStore File
TrustStore is created from the self-signed certificates that are generated for one or more switches. It holds certificates for one or more switches in the controller. This section describes how to create a Truststore using the self-signed certificate created in Generating Self-Signed Certificate and Key section. If you have multiple switches in the controller, each switch will have separate certificate file (for example, sw1-ndb-cert.pem, sw2-ndb-cert.pem).
Use this procedure to create a TLS TrustStore file.
Note |
Perform this procedure on all app containers. |
Procedure
Step 1 |
Log in to the app container as root user. For logging in to an ND/ APIC container, see Logging in to a Container on Cisco Nexus Dashboard or Logging in to a Container on Cisco APIC. |
Step 2 |
Convert the certificate file, such as, sw1-ndb-cert.pem to a Java TrustStore (tlsTrustStore) file using the keytool command. Enter a password when prompted to create a password protected Java TrustStore (tlsTrustStore) file. The password should be at least six characters. Use the jre/bin installed in the java directory. Example:
If a NDB controller manages multiple switches, repeat this step for all the switches to add all switch keys into the same TrustStore. For example:
|
Step 3 |
List and verify keys for multiple switches in the same tlsTrustStore using the keytool command. Example:
|
Starting Nexus Dashboard Data Broker with TLS
Use this procedure for starting Nexus Dashboard Data Broker with TLS.
Procedure
Step 1 |
Log in to the app container as root user. For logging in to an ND/ APIC container, see Logging in to a Container on Cisco Nexus Dashboard or Logging in to a Container on Cisco APIC. |
||
Step 2 |
Copy the tlsKeystore and tlsTruststore files that you created to the configuration folder of the data broker. Example:
|
||
Step 3 |
Restart the app from the app tile on the host. |
Configuring TLS KeyStore and TrustStore Passwords on Nexus Dashboard Data Broker
You need to configure TLS KeyStore and TrustStore passwords to enable Nexus Dashboard Data Broker to read password protectedTLS KeyStore and TrustStore files. To configure TLS KeyStore and TrustStore passwords on Nexus Dashboard Data Broker, complete these steps:
Note |
Perform this procedure on all the containers. |
Procedure
Step 1 |
Log in to the app container as root user. For logging in to an ND/ APIC container, see Logging in to a Container on Cisco Nexus Dashboard or Logging in to a Container on Cisco APIC. |
||
Step 2 |
Navigate to Example: |
||
Step 3 |
Configure the TLS KeyStore and TrustStore passwords using the ndb config-keystore-passwords command. Example:
When this command prompts for a password, enter admin.
After the TLS is enabled on Nexus Dashboard Data Broker , all the connections between Nexus Dashboard Data Broker server and Nexus Dashboard Data Broker switch are established using port 443. Ensure that you change the device connections in Nexus Dashboard Data Broker to use port 443. After successfully completing these steps, you can add nexus switch in the controller using port 443. Use FQDN of the switch to add the device to the Nexus Dashboard Data Broker controller. You can verify the Certificate information using the WebUI Sandbox of the switch. |