Setting up SSL certificates and TrustStores

Coverity Documentation

Version
latest

This section describes how to set up SSL certificates and TrustStores to configure a cluster for secured communication.

Coverity Connect uses SSL to authenticate and encrypt communication between the Coordinator and Subscribers. Unlike in the HTTPS protocol, authentication is mutual, meaning that the Subscriber authenticates the Coordinator, and the Coordinator authenticates to the Subscriber. This authentication can use self-signed SSL certificates generated by each Coverity Connect instance, however you can also implement SSL certificates that are applicable to your system. This section only describes how to set up SSL with Coverity-generated certs.

To establish the trusted relationship between the Coordinator and the Subscribers, you must exchange the SSL certificates between them. The procedure in this section describes how to do so.

Figure 1. Coverity Connect certificate exchange between Coordinator and Subscribers

Initial installation setup

The first time you start Coverity Connect it automatically creates these files in <install_dir>/config:

  • keystore.jks--The Java KeyStore file is a repository of a private key and certificate. The certificate is essentially the "lock" that requires the key to establish SSL communication. To set up SSL between two hosts, the hosts must first exchange their certificates.

  • truststore.jks--The Java TrustStore file is used to store certificates of trusted hosts. Those trusted hosts can authenticate using their private key. For a Subscriber, the TrustStore will store one certificate: the Coordinator's. For a Coordinator, the TrustStore will store one certificate for each Subscriber. Deleting a TrustStore invalidates all trust relationships that it had recorded.

  • <truststore.jks--The certificate file is a copy of the certificate in the KeyStore. The file is created to make it easy to transport the certificate to other hosts in the cluster.

After these files are created on all of the instances in a cluster, you can exchange certificates between the Coordinator and Subscribers as described later in this section.

Post-upgrade manual setup

The trust relationships define which Coverity Connect instances can participate in the cluster. If you make a copy of an instance, using an Intermachine or Backup-and-restore upgrade, both the copy and the original will be able to participate in the cluster. Having that duplication can damage the cluster. You have to prevent that from happening by re-forming the trust relationships to exclude the original instance.

A Coverity Connect Intermachine upgrade copies non-database state to a new host. Therefore, after you perform an Intermachine upgrade on an instance, the old KeyStore, certificate, and TrustStore will exist on the old and new instance. This is undesirable and requires deleting and re-creating the KeyStore, certificate, and TrustStore on the new host. That change also necessitates updates to the TrustStores of other instances in the cluster. The same can be true when you perform a Backup-and-restore upgrade to a new location on the same host, except that the KeyStore, certificate, and TrustStore are mirrored in a new directory location on the same host.

Given the duplication of KeyStores, certificates, and TrustStores that result from Intermachine upgrades and Backup-and-restore upgrades to new directory locations, it's critical to delete and re-create KeyStores, certificates, and TrustStores as necessary after upgrading Coverity Connect.

You can force a Coverity Connect instance to re-generate its certificate by removing the current certificate file and keystore.jks from the config/ directory and then re-starting Coverity Connect. Also, when re-starting Coverity Connect, if truststore.jks is absent Coverity Connect will create a new, empty truststore.jks.

Once you have established the desired KeyStores, certificates, and TrustStores on the upgraded instances, you can proceed with exchanging certificates between the Coordinator and Subscribers as described in the following procedure.

Note: You can add the remoteconfig.localHostName property to cim.properties to define the hostname returned by the system when Coverity Connect generates certificates for remote configurations. Specifying this property in the configuration file overrides the hostname value that Coverity Connect automatically searches for when the certificate is generated. The automatic mechanism sometimes can not resolve hostnames, so setting this property allows you make the hostname explicit.

To exchange SSL certificates between a Coordinator and a Subscriber:

  1. On the Coordinator go to the <install_dir>/config directory and copy the certificate to the Subscriber. For example:

    scp Coord.cert subscriber1.domain.com:S1/cov-platform/cim/config
  2. On the Subscriber go to the <install_dir>/config directory and copy the certificate to the Coordinator. For example:

    scp S1.cert Coordinator.domain.com:/Coord/cov-platform/cim/config
  3. On the Coordinator, import the Subscriber's certificate into the Coordinator's truststore. For example:

    cov-import-cert S1.cert truststore.jks
  4. On the Subscriber, import the Coordinator's certificate into the Subscriber's truststore. For example:

    cov-import-cert Coord.cert truststore.jks
  5. Restart both the Coordinator and Subscriber instances of Coverity Connect.

  6. To ensure that the Coordinator and Subscriber are correctly communicating, examine the <install_dir>/logs/cim.log file on both the Coordinator and the Subscriber.

    If there are no exceptions in the log file, encrypted communication should be functioning as expected.

  7. Apply your updates by restarting all Coverity Connect instances on which you updated cim.properties.

    On Linux:

    > cd <install_dir>/bin
    > ./cov-stop-im
    > ./cov-start-im

    On Windows:

    • Go to <install_dir>\bin, and double-click cov-stop-im.

    • After Coverity Connect stops, restart it by double-clicking cov-start-im.

Repeat these steps for each new Subscriber on your system.