SSL Configuration

Overview #

For security reasons, it is recommended to run Edge over SSL (Secure Socket Layer). This will ensure that all communications between clients (browsers) and the Edge server are encrypted.

By default Edge is configured with SSL disabled, but it does ship with a self-signed server certificate and can easily be enabled. In production environments, this certificate should be replaced with one issued by a known Certificate Authority (CA) or one signed by a trusted root certificate within the organization.

Configure Edge for SSL #

The overall process involves:

  1. Obtain a signed certificate:
    1. Pick a Certificate Authority. This may be in-house if the organization has a Standard Operating Environment with their own root certificate installed on all systems. Otherwise this would be a commercial CA such as VeriSign, Thawte, or GoDaddy.
    2. Create a private key and Certificate Signing Request (CSR).
    3. Have the CA sign the request.
    4. Download the signed certificate from the CA. Depending on the CA, a variety of formats may be on offer. Choose an appropriate format for Tomcat – which the CA may explicitly list as an option, otherwise choose PKCS#7 format. Other formats may require additional conversion steps before Tomcat can make use of it.
  2. Alternatively, create a self-signed certificate. However, end-users will be presented with certificate errors and warnings as the certificate is not signed by a trusted authority.
  3. Create a Java KeyStore (JKS) from the private key, signed certificate, and any intermediate certificates from the CA.
  4. Install the keystore file on the Edge server.

Due to the large variety of certificate authorities and key/certificate formats, this documentation does not cover all possibilities. If following instructions found elsewhere, make sure to install the resulting keystore correctly for Edge (see the Enable SSL & Install the Keystore section).

Certificate & Keystore #

For SSL Tomcat requires a Java keystore containing the private key, signed certificate, and any intermediate certificates from the CA. To create and work with a keystore it is necessary to have Java installed and be able to run the keytool command.

New Certificates #

The recommended approach is to use keytool to create the private key, CSR, and keystore. The CA with then sign and provide a signed certificate along with their own certificate chain which can be imported into the keystore. Most CAs have this process well documented for popular web server platforms. Just follow the instructions for Tomcat such as these from VeriSign – and remember to refer back to this documentation on installing the keystore:

  1. Creating a CSR and submitting for signing (using keytool and creating a keystore in the process).
  2. Importing the signed certificate into a JKS keystore (in PKCS#7 / .p7b format)
  3. Then follow the instructions below on Enable SSL & Installing the Keystore

Existing Keys & Certificates #

A limitation of keytool is that existing private keys cannot be imported. So for situations with an existing private key, regardless of the certificate format, it will be necessary to use openssl to do conversion.

For existing private key with signed certificate and intermediate certificates in X.509 format follow these steps:

  1. Convert the private key (private.key), signed certificate (server_signed.crt), and intermediate certificates (ca.crt) into PKCS#12 format:
    openssl pkcs12 -export -in server_signed.crt -inkey private.key -CAfile ca.crt -caname root -chain -out combined.p12 -name your-alias

    You will be prompted to set a password. This must be set – do not leave blank. If you do not have any intermediate certificates then leave out the -CAfile, -caname, and -chain options.

  2. Create a JKS from the combined.p12 file generated above:
    keytool -importkeystore -srckeystore combined.p12 -srcstoretype PKCS12 -alias your-alias -destkeystore your-keystore.jks

    You will be prompted for the password set above and a new password, you must use the same password. your-alias must match the alias set in step (1).

  3. Take the resulting JKS file (your-keystore.jks) and follow the instructions below to Enable SSL & Installing the Keystore.

For existing private key with signed certificate and intermediate certificates in PKCS#7 (.p7b) format follow these steps:

  1. Convert the PKCS7 file (certs.p7b) to PEM encoded certificates:
    openssl pkcs7 -in certs.p7b -inform DER -print_certs -out certs.crt
  2. Convert the private key (private.key) and certificates (certs.crt from above):
    openssl pkcs12 -export -in certs.crt -inkey private.key -out combined.p12 -name your-alias

    You will be prompted to set a password, this must be set – do not leave blank.

  3. Create a JKS from the combined.p12 file generated above:
    keytool -importkeystore -srckeystore combined.p12 -srcstoretype PCKS12 -alias your-alias -destkeystore your-keystore.jks

    You will be prompted for the password set above and a new password, you must use the same password. your-alias must match the alias set in step (1).

  4. Take the resulting JKS file (your-keystore.jks) and follow the instructions below to Enable SSL & Installing the Keystore.

Enable SSL & Install the Keystore #

Once a valid keystore has been created it can be installed on the Edge server:

  1. Copy the keystore to the [INSTALL_HOME]/conf/ssl/ directory. By default files in this directory are automatically included in full archives.
  2. Edit setenv-custom.sh|.bat and:
    1. update KEYSTORE_FILE and KEYSTORE_PASS as required. Please note the keystore file path is relative to [INSTALL_HOME]/
    2. Optional: rather than change KEYSTORE_PASS; you can edit custom.properties and set truststore.pass=<pass>.  After edgeSuite starts; this property will be encrypted.
    3. update KEYSTORE_TYPE if using something other than Java KeyStore (JKS) format.
    4. set HTTP_SSL to true.
    5. (optional) set HTTP_PORT to the desired port.
  3. Restart the Edge server.

Replace Certificates #

Once a certificate expires, you will need to generate a new certificate and replace the old one in the keystore. The following steps assume that you are updating the keystore located in [INSTALL_HOME]/conf/ssl/:

  1. In the terminal, navigate to your [JAVA_HOME]/bin/ directory containing the keytool.
  2. If you are unsure which certificate you need to replace, you can view the contents of the keystore with:keytool -list -v -keystore [INSTALL_HOME]/conf/ssl/keystore.jks
  3. Delete the old certificate:keytool -delete -alias <old cert alias> -keystore [INSTALL_HOME]/conf/ssl/keystore.jks
  4. Import the new certificate:keytool -import -v -noprompt -trustcacerts -alias <new cert alias> -file <path to new cert>/newcert.cer -keystore [INSTALL_HOME]/conf/ssl/keystore.jks
  5. After importing the new certificate, you will need to restart the server in order for it to take effect.

Configure Client Certificate Authentication #

For client certificate validation the Truststore will need to be configured.  The following steps assume that you have a truststore file with a proper chaining certificates imported.

  1. Edit tomcat/conf/server.xml; and ensure the following lines are configured (they must be moved inside of the <Connector>… block just after the line ‘clientAuth=“${clientauth}””

                   clientAuth="${clientauth}"
                   truststoreFile="${truststore.file}"
                   truststorePass="${truststore.pass}"
                   truststoreType="${truststore.type}"
  2. Configure the clientAuth=true in [INSTALL_HOME]/conf/environment.(sh|bat) files.
  3. Configure the truststore.file=<truststoreFile> in [INSTALL_HOME]/conf/custom.properties; or optionally it can be configured in [INSTALL_HOME]/conf/environment.(sh|bat) files.
  4. Configure the truststore.pass=<truststorePass> in [INSTALL_HOME]/conf/custom.properties; or optionally it can be configured in [INSTALL_HOME]/conf/environment.(sh|bat) files.
  5. Configure the truststore.type=<truststoreType> in [INSTALL_HOME]/conf/custom.properties; or optionally it can be configured in [INSTALL_HOME]/conf/environment.(sh|bat) files.

Using custom.properties to configure the truststore.pass has the advantage of encrypting the password that is configured; while the configuration made in either environment.(sh|bat) files will not be encrypted and assumes the environment is secure.  The truststore.pass will only be read and encrypted if client certificate authentication is enabled and the server.xml includes the block above.

Redirect HTTP traffic

There are two recommended approaches for redirecting standard HTTP traffic to HTTPS:

  1. Use an external tool to redirect the traffic such as a load balancer or a full featured HTTP server like Apache. For many this will be the preferred option since no configuration changes to Edge are necessary.
  2. Modify tomcat/conf/server.xml and tomcat/conf/web.xml to define an extra non-SSL connector that will redirect to the HTTPS port. This approach is well documented by the Tomcat user community.