Managing Certificates

This chapter includes the following sections:

Managing the Server Certificate

You can generate a certificate signing request (CSR) to obtain a new certificate, and you can upload the new certificate to the Cisco IMC to replace the current server certificate. The server certificate may be signed either by a public Certificate Authority (CA), such as Verisign, or by your own certificate authority. The generated certificate key length is 2048 bits.


Note


Before performing any of the following tasks in this chapter, ensure that the Cisco IMC time is set to the current time.


Procedure
    Step 1   Generate the CSR from the Cisco IMC.
    Step 2   Submit the CSR file to a certificate authority that will issue and sign your certificate. If your organization generates its own self-signed certificates, you can use the CSR file to generate a self-signed certificate.
    Step 3   Upload the new certificate to the Cisco IMC.
    Note   

    The uploaded certificate must be created from a CSR generated by the Cisco IMC. Do not upload a certificate that was not created by this method.


    Generating a Certificate Signing Request

    You can either generate a self-signed certificate manually using the generate-csr command, or automatically when you change the hostname. For information on changing the hostname and auto generation of the self-signed certificate, see the Configuring Common Properties section.

    To manually generate a certificate signing request, follow these steps:

    Before You Begin
    • You must log in as a user with admin privileges to configure certificates.

    • Ensure that the Cisco IMC time is set to the current time.

    Procedure
       Command or ActionPurpose
      Step 1Server# scope certificate  

      Enters the certificate command mode.

       
      Step 2Server /certificate # generate-csr  

      Launches a dialog for the generation of a certificate signing request (CSR).

       

      You will be prompted to enter the following information for the certificate signing request:

      Name Description

      Common Name field

      The fully qualified name of the Cisco IMC.

      By default the CN of the servers appears in CXXX-YYYYYY format, where XXX is the model number and YYYYYY is the serial number of the server.

      When you upgrade to latest version, CN is retained as is.

      Organization Name field

      The organization requesting the certificate.

      Organization Unit field

      The organizational unit.

      Locality field

      The city or town in which the company requesting the certificate is headquartered.

      State Name field

      The state or province in which the company requesting the certificate is headquartered.

      Country Code drop-down list

      The country in which the company resides.

      Email field

      The email contact at the company.

      After you have entered the requested information, the system will generate and display a certificate signing request in the console output. A CSR file will not be created, but you can copy the CSR information from the console output and paste the information into a text file.

      This example generates a certificate signing request:

      Server# scope certificate
      Server /certificate # generate-csr
      Common Name (CN): test.example.com 
      Organization Name (O): Example, Inc.
      Organization Unit (OU): Test Department
      Locality (L): San Jose
      StateName (S): CA
      Country Code (CC): US
      Email: user@example.com
      Continue to generate CSR?[y|N]y
      
       
      -----BEGIN CERTIFICATE REQUEST-----
      MIIB/zCCAWgCAQAwgZkxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEVMBMGA1UE
      BxMMU2FuIEpvc2UsIENBMRUwEwYDVQQKEwxFeGFtcGxlIEluYy4xEzARBgNVBAsT
      ClRlc3QgR3JvdXAxGTAXBgNVBAMTEHRlc3QuZXhhbXBsZS5jb20xHzAdBgkqhkiG
      9w0BCQEWEHVzZXJAZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
      AoGBAMZw4nTepNIDhVzb0j7Z2Je4xAG56zmSHRMQeOGHemdh66u2/XAoLx7YCcYU
      ZgAMivyCsKgb/6CjQtsofvzxmC/eAehuK3/SINv7wd6Vv2pBt6ZpXgD4VBNKONDl
      GMbkPayVlQjbG4MD2dx2+H8EH3LMtdZrgKvPxPTE+bF5wZVNAgMBAAGgJTAjBgkq
      hkiG9w0BCQcxFhMUQSBjaGFsbGVuZ2UgcGFzc3dvcmQwDQYJKoZIhvcNAQEFBQAD
      gYEAG61CaJoJaVMhzCl903O6Mg51zq1zXcz75+VFj2I6rH9asckCld3mkOVx5gJU
      Ptt5CVQpNgNLdvbDPSsXretysOhqHmp9+CLv8FDuy1CDYfuaLtvlWvfhevskV0j6
      mK3Ku+YiORnv6DhxrOoqau8r/hyI/L43l7IPN1HhOi3oha4=
      -----END CERTIFICATE REQUEST-----
       
      Copy everything from "-----BEGIN ..."  to "END CERTIFICATE REQUEST-----", 
      paste to a file, send to your chosen CA for signing, 
      and finally upload the signed certificate via upload command.
                    ---OR---
      Continue to self sign CSR and overwrite the current certificate?
      All HTTPS and SSH sessions will be disconnected. [y|N]N
              
      
      What to Do Next

      Perform one of the following tasks:

      • If you do not want to obtain a certificate from a public certificate authority, and if your organization does not operate its own certificate authority, you can allow Cisco IMC to internally generate a self-signed certificate from the CSR and upload it immediately to the server. Type y after the final prompt in the example to perform this action.

      • If your organization operates its own certificate server for generating self-signed certificates, copy the command output from "-----BEGIN ..." to "END CERTIFICATE REQUEST-----" and paste to a file named csr.txt. Input the CSR file to your certificate server to generate a self-signed certificate.

      • If you will obtain a certificate from a public certificate authority, copy the command output from "-----BEGIN ..." to "END CERTIFICATE REQUEST-----" and paste to a file named csr.txt. Submit the CSR file to the certificate authority to obtain a signed certificate.

      • Ensure that the certificate is of type Server.

      If you did not use the first option, in which Cisco IMC internally generates and uploads a self-signed certificate, you must upload the new certificate using the upload command in certificate command mode.

      Creating an Untrusted CA-Signed Certificate

      As an alternative to using a public Certificate Authority (CA) to generate and sign a server certificate, you can operate your own CA and sign your own certificates. This section shows commands for creating a CA and generating a server certificate using the OpenSSL certificate server running on Linux. For detailed information about OpenSSL, see http:/​/​www.openssl.org.

      Note


      These commands are to be entered on a Linux server with the OpenSSL package, not in the Cisco IMC.


      Before You Begin
      • Obtain and install a certificate server software package on a server within your organization.

      • Ensure that the Cisco IMC time is set to the current time.

      Procedure
         Command or ActionPurpose
        Step 1 openssl genrsa -out CA_keyfilename keysize


        Example:
        # openssl genrsa -out ca.key 2048
         
        This command generates an RSA private key that will be used by the CA.
        Note    To allow the CA to access the key without user input, do not use the -des3 option for this command.

        The specified file name contains an RSA key of the specified key size.

         
        Step 2 openssl req -new -x509 -days numdays -key CA_keyfilename -out CA_certfilename


        Example:
        # openssl req -new -x509 -days 365 -key ca.key -out ca.crt
         

        This command generates a new self-signed certificate for the CA using the specified key. The certificate is valid for the specified period. The command prompts the user for additional certificate information.

        The certificate server is an active CA.

         
        Step 3 echo "nsCertType = server" > openssl.conf


        Example:
        # echo "nsCertType = server" > openssl.conf
         

        This command adds a line to the OpenSSL configuration file to designate the certificate as a server-only certificate. This designation is a defense against a man-in-the-middle attack, in which an authorized client attempts to impersonate the server.

        The OpenSSL configuration file openssl.conf contains the statement "nsCertType = server".

         
        Step 4 openssl x509 -req -days numdays -in CSR_filename -CA CA_certfilename -set_serial 04 -CAkey CA_keyfilename -out server_certfilename -extfile openssl.conf


        Example:
        # openssl x509 -req -days 365 -in csr.txt -CA ca.crt -set_serial 04
        -CAkey ca.key -out myserver05.crt -extfile openssl.conf
         

        This command directs the CA to use your CSR file to generate a server certificate.

        Your server certificate is contained in the output file.

         
        Step 5 openssl x509 -noout -text -purpose -in <cert file>


        Example:
        openssl x509 -noout -text -purpose -in <cert file>
         
        Verifies if the generated certificate is of type Server.
        Note   

        If the values of the fields Server SSL and Netscape SSL server are not yes, ensure that openssl.conf is configured to generate certificates of type server.

         
        Step 6If the generated certificate does not have the correct validity dates, ensure the Cisco IMC time is set to the current time, and regenerate the certificate by repeating steps 1 through 5.   (Optional) Certificate with the correct validity dates is created.  

        This example shows how to create a CA and to generate a server certificate signed by the new CA. These commands are entered on a Linux server running OpenSSL.

        # /usr/bin/openssl genrsa -out ca.key 2048
        Generating RSA private key, 2048 bit long modulus
        .............++++++
        .....++++++
        e is 65537 (0x10001)
        # /usr/bin/openssl req -new -x509 -days 365 -key ca.key -out ca.crt
        You are about to be asked to enter information that will be incorporated
        into your certificate request.
        What you are about to enter is what is called a Distinguished Name or a DN.
        There are quite a few fields but you can leave some blank
        For some fields there will be a default value,
        If you enter '.', the field will be left blank.
        -----
        Country Name (2 letter code) [GB]:US
        State or Province Name (full name) [Berkshire]:California
        Locality Name (eg, city) [Newbury]:San Jose
        Organization Name (eg, company) [My Company Ltd]:Example Incorporated
        Organizational Unit Name (eg, section) []:Unit A
        Common Name (eg, your name or your server's hostname) []:example.com
        Email Address []:admin@example.com
        # echo "nsCertType = server" > openssl.conf
        # /usr/bin/openssl x509 -req -days 365 -in csr.txt -CA ca.crt -set_serial 01 -CAkey ca.key -out server.crt -extfile openssl.conf
        Signature ok
        subject=/C=US/ST=California/L=San Jose/O=Example Inc./OU=Unit A/CN=example.com/emailAddress=john@example.com
        Getting CA Private Key
        #
        
        What to Do Next

        Upload the new certificate to the Cisco IMC.

        Uploading a Server Certificate

        Before You Begin
        • You must log in as a user with admin privileges to upload a certificate.

        • The certificate to be uploaded must be available as readable text. During the upload procedure, you will copy the certificate text and paste it into the CLI.

        • Ensure that the generated certificate is of type Server.


        Note


        You must first generate a CSR using the Cisco IMC certificate management CSR generation procedure, and you must use that CSR to obtain the certificate for uploading. Do not upload a certificate that was not obtained by this method.



        Note


        All current HTTPS and SSH sessions are disconnected when the new server certificate is uploaded.


        Procedure
           Command or ActionPurpose
          Step 1Server# scope certificate  

          Enters the certificate command mode.

           
          Step 2Server /certificate # upload  

          Launches a dialog for entering and uploading the new server certificate.

           

          Copy the certificate text, paste it into the console when prompted, and type CTRL+D to upload the certificate.

          This example uploads a new certificate to the server:

          Server# scope certificate
          Server /certificate # upload
          Please paste your certificate here, when finished, press CTRL+D.
          -----BEGIN CERTIFICATE-----
          MIIB/zCCAWgCAQAwgZkxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEVMBMGA1UE
          BxMMU2FuIEpvc2UsIENBMRUwEwYDVQQKEwxFeGFtcGxlIEluYy4xEzARBgNVBAsT
          ClRlc3QgR3JvdXAxGTAXBgNVBAMTEHRlc3QuZXhhbXBsZS5jb20xHzAdBgkqhkiG
          9w0BCQEWEHVzZXJAZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
          AoGBAMZw4nTepNIDhVzb0j7Z2Je4xAG56zmSHRMQeOGHemdh66u2/XAoLx7YCcYU
          ZgAMivyCsKgb/6CjQtsofvzxmC/eAehuK3/SINv7wd6Vv2pBt6ZpXgD4VBNKONDl
          GMbkPayVlQjbG4MD2dx2+H8EH3LMtdZrgKvPxPTE+bF5wZVNAgMBAAGgJTAjBgkq
          hkiG9w0BCQcxFhMUQSBjaGFsbGVuZ2UgcGFzc3dvcmQwDQYJKoZIhvcNAQEFBQAD
          gYEAG61CaJoJaVMhzCl903O6Mg51zq1zXcz75+VFj2I6rH9asckCld3mkOVx5gJU
          Ptt5CVQpNgNLdvbDPSsXretysOhqHmp9+CLv8FDuy1CDYfuaLtvlWvfhevskV0j6
          mK3Ku+YiORnv6DhxrOoqau8r/hyI/L43l7IPN1HhOi3oha4=
          -----END CERTIFICATE-----
          <CTRL+D>