Skip to content

Provision certificates to IBM WebSphere Liberty with Common KeyStore

IBM WebSphere Liberty and Open Liberty read their TLS certificate from a keystore file that the server's server.xml file references. Certificate Manager - SaaS doesn't have a separate machine type for Liberty. Instead, a Common KeyStore machine writes the certificate into that keystore file over SSH or Windows Remote Management (WinRM), and Liberty then loads the new certificate.

This page describes a setup that works with the Common KeyStore connector as it is today:

  1. Give Liberty a dedicated keystore file that holds only the certificate that Certificate Manager - SaaS manages.
  2. Have Certificate Manager - SaaS write the certificate into that file as a PKCS#12 archive or a Java KeyStore (JKS) file.
  3. Make sure Liberty loads the new certificate, either by watching the keystore file for changes or by letting Certificate Manager - SaaS restart Liberty's systemd service.

Note

This page covers WebSphere Liberty and Open Liberty only. It doesn't cover WebSphere Application Server traditional, which manages certificates through its own administrative tools rather than through files that server.xml references.

Before you begin

  • A Common KeyStore machine for the Liberty host, whose status is Verified. To create one, see Create a Common KeyStore machine.
  • Access to edit the Liberty server's server.xml file.
  • An account for the machine that can write the keystore file and that Liberty can read the file as. Over SSH, Certificate Manager - SaaS sets the permissions of each file it writes to 0640, so the file can be read by its owner and by the owner's group only. Either sign in as the account that runs Liberty, or as an account in the same group as that account.
  • To let Certificate Manager - SaaS restart Liberty after it provisions a certificate: a Linux host where Liberty runs as a systemd service, and an account that can run sudo systemctl restart for that service. With private key authentication, sudo must not require a password.

Step 1: Give Liberty a dedicated keystore

Configure Liberty to read its server certificate from a keystore file that holds nothing else. Don't point Certificate Manager - SaaS at a keystore that also holds other certificates, trusted CA certificates, or Liberty's automatically generated default certificate. Depending on the format, Certificate Manager - SaaS replaces the whole file or adds an entry to it, as described in Step 2.

Liberty also uses the keystore as its truststore unless the SSL configuration names a separate one. Set trustStoreRef to a separate truststore, so that provisioning the keystore doesn't remove the certificates Liberty trusts.

The following server.xml example defines a dedicated keystore, a separate truststore, and an SSL configuration that uses both. Replace the paths and passwords with your own.

<keyStore id="managedKeyStore"
          location="/opt/liberty/keystores/server-cert.p12"
          type="PKCS12"
          password="your-store-password"
          updateTrigger="polled"
          pollingRate="5s" />

<keyStore id="managedTrustStore"
          location="/opt/liberty/keystores/trust.p12"
          type="PKCS12"
          password="your-truststore-password" />

<ssl id="defaultSSLConfig"
     keyStoreRef="managedKeyStore"
     trustStoreRef="managedTrustStore" />

For a JKS keystore, set type="JKS" and add serverKeyAlias to the ssl element, with the alias you enter in Certificate Manager - SaaS in Step 2.

Important

The password in server.xml must open the keystore that Certificate Manager - SaaS writes. Certificate Manager - SaaS protects the keystore with the Store Password you enter in Step 2, so enter the same password in both places. If server.xml holds the password in encoded form, for example {xor} or {aes}, enter the plain-text password in Certificate Manager - SaaS.

For the full list of keyStore attributes, see the Open Liberty keyStore reference.

Step 2: Provision the certificate to the keystore

Provision the certificate to the Common KeyStore machine as described in Provision certificates to a Common KeyStore, with these settings:

  1. For KeyStore Type, choose PKCS#12 or JKS to match the type in server.xml.
  2. For PKCS#12:

    • In KeyStore Path (including filename), enter the location of the keystore from server.xml, as an absolute path.
    • In Store Password, enter the keystore password from server.xml.

    Important

    Certificate Manager - SaaS rewrites the whole PKCS#12 archive every time it provisions to it, and the new archive holds only the certificate it provisioned, with its chain and private key. Any other entry in the archive is lost. Use PKCS#12 only for a keystore that holds a single entry.

  3. For JKS:

    • In KeyStore Path (including filename), enter the location of the keystore from server.xml, as an absolute path.
    • To keep any other entries in the file, enable Append to JKS. The file must then already exist.
    • In Alias, enter the alias that serverKeyAlias names in server.xml. Use lowercase letters, because Certificate Manager - SaaS saves the alias in lowercase.
    • In Store Password, enter the keystore password from server.xml.
  4. In Service Name, enter the name of Liberty's systemd service if you chose that activation method in Step 3. Otherwise, leave it empty.

Before Certificate Manager - SaaS overwrites an existing keystore file, it saves a copy beside it as <path>.VaaS.bak.

Step 3: Make Liberty load the new certificate

By default, Liberty doesn't reload a keystore when the file changes on disk. The default updateTrigger value, mbean, reloads the keystore only when a management call tells Liberty to, and Certificate Manager - SaaS doesn't make that call. Choose one of these methods, or Liberty keeps serving the old certificate until it next restarts:

  • Watch the keystore file (no restart): in the keyStore element in server.xml, set updateTrigger="polled", as in the example in Step 1. Liberty checks the file at the interval that pollingRate sets, and loads the new certificate without a restart. This method works however Liberty is started, including with the server start command and on Windows.
  • Restart Liberty's systemd service: run Liberty as a systemd service, and enter the service's name in Service Name in Step 2. After it writes the keystore, Certificate Manager - SaaS runs sudo systemctl restart for that service, which briefly takes Liberty offline.

Discover Liberty certificates

Discovery on a Common KeyStore machine reads keystore files at the path you set. It doesn't read server.xml, so it doesn't know which keystore Liberty uses. To discover the certificate in Liberty's keystore, enter the keystore's path in the machine's File or Directory Path, and add the store password to Keystore Passwords. For more information, see What discovery finds.

Limitations

  • PKCS#12 archives with more than one entry: provisioning replaces the whole archive with a single entry, and discovery doesn't create an installation for an archive that holds more than one entry.
  • Liberty started without systemd: if Liberty runs with the server start command, or as a Windows service, Certificate Manager - SaaS can't restart it. Set updateTrigger="polled" so that Liberty loads the new certificate without a restart.
  • Discovery is path-based: discovery finds Liberty's certificate only when you point it at the keystore file or its folder. It doesn't find keystores from Liberty's configuration.
  • SSH host key isn't verified: over SSH, Certificate Manager - SaaS doesn't verify the Liberty host's SSH host key. The connection is still encrypted.