Enabling SSL communication in Liberty

To enable SSL communication in Liberty, there is a minimal set of SSL configuration options. It assumes most of the SSL options require some keystore configuration information.

About this task

SSL client authentication occurs during the connection handshake by using SSL certificates. The SSL handshake is a series of messages that are exchanged over the SSL protocol to negotiate for connection-specific protection. During the handshake, the secure server requests that the client send back a certificate or certificate chain for the authentication. To enable SSL in Liberty, you add the ssl-1.0 Liberty feature to the configuration root document file, server.xml, along with code of the keystore information for authentication.

By default, the path and file name for the configuration root document file is path_to_liberty/wlp/usr/servers/server_name/server.xml. path_to_liberty is the location that you installed Liberty on your operating system, and server_name is the name of your server. However, you can change the path. See Customizing the Liberty environment.

Procedure

  1. Enable the ssl-1.0 Liberty feature in the server.xml file.
    <featureManager>
        <feature>ssl-1.0</feature>
    </featureManager>
    Note: If application security is required and security information is redirected to a secure port, you must add the appSecurity-2.0 Liberty feature to the server.xml file.

    When the ssl-1.0 feature is enabled, the Liberty server creates an SSLContext from the default SSL configuration and makes that SSLContext the server default by calling the SSLContext.setDefault() java API. This makes the default SSLContext of the Liberty server the process default SSLContext. If anything makes the java API call SSLContext.getDefault(), then the method returns Liberty SSLContext. The same applies to the SSLSocketFactory.getDefault() java API in that the default socket factory from the default SSLContext is returned.

  2. [17.0.0.3 and later]SSL communication can alternately be enabled by adding the transportSecurity-1.0 Liberty feature in the server.xml file.
    <featureManager>
        <feature>transportSecurity-1.0</feature>
    </featureManager>

    The transportSecurity-1.0 feature supersedes the ssl-1.0 feature and adds functionality that is not included with the ssl-1.0 feature. You can specify an SSL configuration to be used as the outbound default as well as setup filters on an SSL configuration so that the SSL configuration can be used for an outbound SSL call based on a destination host and port. For more information about outbound SSL options, see Configuring SSL Settings for outbound communications and Outbound filters for SSL configurations.

    When the transportSecurity-1.0 feature is enabled, the Liberty server sets a custom SSL Socket factory that uses the java security property ssl.SocketFactory.provider. This security property is set automatically when the transportSecurity-1.0 feature is enabled. When you are using the transportSecurity-1.0 feature, the process default SSLContext is the default SSLContext of the Java Secure Socket Extension (JSSE). A call to SSLContext.getDefault() returns the default context SSLContext of the JSSE. A call to SSLSocketFactory.getDefault() returns an SSLSocketFactory that is based on the Liberty server custom socket factory provider that uses the Liberty SSLContext.

    The outboundSSLRef attribute and the outboundConnection element are used for outbound SSL connections only if the transportSecurity-1.0 feature is specified. If the ssl-1.0 feature is specified and the transportSecurity-1.0 is not specified, then the outboundSSLRef attribute and the outboundConnection element are ignored.

    Note: Due to the nature of the JDK, if you are changing from the ssl-1.0 feature to the transportSecurity-1.0 feature or from the transportSecurity-1.0 feature to the ssl-1.0 feature, the Liberty server must be restarted to use the feature to its complete functionality.
  3. Add the keystore service object entry to the server.xml file. The keyStore element is called defaultKeyStore and contains the keystore password. The password can be entered in clear text or encoded. The securityUtility encode option can be used to encode the password.
    <keyStore id="defaultKeyStore" password="yourPassword" />
    An example of a SAF key ring in the minimal configuration:
    <keyStore id="defaultKeyStore" location="safkeyring:///WASKeyring" 
              type="JCERACFKS" password="password" fileBased="false" 
              readOnly="true" />

    RACF® key ring needs to be set up before you configure them for use by the Liberty server. The server does not create certificates and add them to RACF.

    The single keystore entry for a minimal SSL configuration can be extended to include the location and type as well.
    <keyStore id="defaultKeyStore" location="myKeyStore.p12" password="yourPassword" type="PKCS12"/>

    This configuration is the minimum that is needed to create an SSL configuration. In this configuration, the server creates the keystore and certificate if it does not exist during SSL initialization. The password that is provided must be at least 6 characters long. The keystore is assumed to be a JKS keystore that is called key.jks in the server home/resources/security directory. If the file does not exist the server creates it for you. If the server creates the keystore file, it also creates the certificate inside of it. The certificate is a self-signed certificate with a validity period of 365 days, the CN value of the certificate's subjectDN is the host name of the machine where the server is running, and has a signature algorithm of SHA256withRSA.

    Note: When the use of a collective controller is not practical, perhaps there is only one or two Liberty servers, a self-signed certificate can be used to restrict the number of clients that can connect to the Liberty member server. It is suggested that an IHS server is used in front of the Liberty servers, where an appropriate CA signed certificate can be used, along with CN whitelisting to control which clients can connect to HIS. A trusted channel between IHS and the Liberty Member server can be maintained by using the self signed certificate.

Icon that indicates the type of topic Task topic

File name: twlp_sec_ssl.html