Example: Generating a server certificate with OpenSSL

The following example describes how to create a signed server certificate using the OpenSSL toolkit as a private certificate authority. This example also uses the keytool utility available with the Sun Microsystems™ standard Java Development Kit. You can use a server certificate to enable SSL encryption from the HPE Service Manager server.

Note The information contained in this example regarding OpenSSL technology is provided by HPE as a courtesy to our customers and partners. This documentation does not replace an OpenSSL reference, and HPE encourages you to conduct additional research regarding OpenSSL technology by consulting with sources outside of this document. HPE hereby disclaims all liability associated with the use and accuracy of this information. As OpenSSL technology evolves, HPE may or may not update this reference.

  1. Obtain and install a Java platform on the server you want to use as your private certificate authority. See the Sun Microsystems™ Java Technology site for the necessary software and documentation.
  2. Obtain and install OpenSSL on the server you want to use as your private certificate authority. See the OpenSSL Web site for the necessary software and documentation.

    Caution  HPE strongly recommends that you do not install your private certificate authority on the same server as your Service Manager production server.

  3. Create and configure an openssl.conf file in the bin folder of your OpenSSL installation.
  4. Open the operating system's command prompt on the private certificate authority server.
  5. Change directories to the OpenSSL bin folder.
  6. Type the following command to create the private key for your private certificate authority:
    openssl genrsa -des3 -out cakey.pem 2048
  7. When OpenSSL prompts you, type the password phrase you want to use to protect your certificate authority's private key file (cakey.pem). For example, CAKeyPassword.
    You must use the same password phrase each time you sign a certificate request with your private certificate authority. If you forget this password, you must repeat the steps to create another certificate authority private key.
  8. Type the following command to create a public certificate for your private certificate authority:
    openssl req -new -key cakey.pem -x509 -days 1095 -out mycacert.pem -config .\openssl.conf
  9. Change directories to the Java platform's bin folder.
  10. Type the following command to import your private certificate authority's certificate into the Java cacerts file that you will publish to the rest of your network.
    keytool -import -keystore ./cacerts -trustcacerts -file mycacert.pem -storepass changeit
  11. When keytool prompts you, type y to trust the private certificate authority's certificate.
  12. Install the updated Java cacerts file on the Service Manager server. Copy the cacerts file to the RUN folder of the Service Manager server. You can also copy the cacerts file to the JRE\lib\security folder of your Java Run Time Environment (RTE) or Java Development Kit (JDK).
  13. Install the updated Java cacerts file on the Service Manager web tier. Copy the cacerts file to the <web application server installation path>\WEB-INF folder of the Service Manager web tier.
  14. Install the updated Java cacerts file on the Service Manager Windows client. Copy the cacerts file to the <Windows client installation path>\plugins\com.hp.ov.sm.client.common_x.xx folder of the Service Manager Windows client.
  15. Change directories to the Java platform's bin folder.
  16. Type the following command to create a private key and keystore for your Service Manager server.
    keytool -genkey -alias myserver -keystore servercert.keystore
  17. When keytool prompts you, type the password phrase you want to use to protect your Service Manager server's keystore file. For example, SMServerKeyPassword.

    Note Do not use the same password as your private certificate authority key password.

  18. When keytool prompts you for your first and last name, type the fully qualified host name of your Service Manager server system.

    Note This is the same name your clients will use to connect to the Service Manager server.

  19. When keytool prompts you for the organization unit, organization, city or locality, state or province, and two-letter country code, type the identification information for your company.
  20. Verify the information you provided and type yes if it is correct.
  21. When keytool prompts you for the password phrase to use for your Service Manager server's private key, press ENTER to use the same password as you created for the keystore.

    Note The password for the private key must match the password for the keystore file.

  22. Type the following command to create a certificate request for your Service Manager server. For example, to create a certificate request for your HPE Service Manager server type:
    keytool -certreq -alias myserver -keystore servercert.keystore -file smserver_certrequest.crs
  23. When keytool prompts you, type the password for the HPE Service Manager server's keystore file (from step 17). For example, SMServerKeyPassword.
  24. Copy the Service Manager server's certificate request (For example, smserver_certrequest.crs) to the OpenSSL bin folder.
  25. Change directories to the OpenSSL bin folder.
  26. Type the following command to sign the Service Manager server's certificate request with your private certificate authority:
    openssl x509 -req -days 365 -in smserver_certrequest.crs -CA mycacert.pem -CAkey cakey.pem -CAcreateserial -out smserver_cert.pem
  27. When OpenSSL prompts you, type the password for your certificate authority's private key. For example, CAKeyPassword.

    OpenSSL stores the new signed certificate (smserver_cert.pem) in the newcerts directory.

    Tip To view the contents of the signed certificate, you can type following command:

    openssl x509 -in smserver_cert.pem -text -noout

  28. Copy the signed client certificate (smserver_cert.pem) to the OpenSSL server's Java platform bin folder.
  29. Open the operating system's command prompt.
  30. Change directories to the Java platform's bin folder.
  31. Type the following command to import the Service Manager server's signed certificate into the server keystore.
    keytool -import -trustcacerts -alias myserver -keystore ./servercert.keystore -file smserver_cert.pem
  32. When keytool prompts you to trust the private certificate authority's certificate, type y.
  33. When keytool prompts you, type the password to your server's keystore file. For example, SMServerKeyPassword.