ssljdbcdb2websphere-libertycustom-properties

How do I set the JDBC driver's securityMechanism property with TLS_CLIENT_CERTIFICATE_SECURITY option on Liberty?


I tried to set the JDBC driver's securityMechanism property with the TLS_CLIENT_CERTIFICATE_SECURITY option on Websphere Liberty® referring to the following IBM® Knowledge Center, but got a CWWKG0032W warning message when I started Websphere Liberty (beta for July 2015).

Can you show me how to set the JDBC driver's securityMechanism property with the TLS_CLIENT_CERTIFICATE_SECURITY option on Websphere Liberty?

IBM Data Server Driver for JDBC and SQLJ support for certificate authentication

The IBM® Data Server Driver for JDBC and SQLJ provides support for client support for certificate authentication for connections to DB2® for z/OS® Version 10 or later data servers.

console.log when the Websphere Liberty Server started

CWWKG0032W: Unexpected value specified for property
            [securityMechanism], value = [18]. >Expected value(s) are:
            [3][4][7][9][11][12][13][15][16].

securityMechanism="18" is TLS_CLIENT_CERTIFICATE_SECURITY, I confirmed the value by the following:

\>javac -classpath .;db2jcc4.jar; JDBCCheck
\>java -classpath .;db2jcc4.jar; JDBCCheck
  TLS_CLIENT_CERTIFICATE_SECURITY: 18

JDBCCheck class:

class JDBCCheck{
  public static void main(String args[]){
    com.ibm.db2.jcc.DB2SimpleDataSource dataSource =
                                   new com.ibm.db2.jcc.DB2SimpleDataSource();
    System.out.println( "TLS_CLIENT_CERTIFICATE_SECURITY: "
                        + dataSource.TLS_CLIENT_CERTIFICATE_SECURITY);
  }
}

server.xml:

<library id="db2-library">
  <fileset dir="lib" id="db2-fileset" includes="db2jcc4.jar db2jcc_license_cu.jar"/>
</library>

<dataSource id="db2" jndiName="jdbc/sampledb">
  <jdbcDriver libraryRef="db2-library"/>
  <properties.db2.jcc databaseName="SAMPLEDB" password="password" portNumber="10443"
              serverName="XX.XX.XX.XX" user="db2inst1" sslConnection="true"
              sslTrustStoreLocation="ssld/defaultTrustStore"
              sslTrustStorePassword="trustpassword" securityMechanism="18"/>
</dataSource>

Update 01:


Solution

  • Based on this topic in IBM® Knowledge Center: Java EE Full Platform 7.0 section: transaction > dataSource > properties.db2.jcc

    Currently WebSphere Liberty only supports the following values for securityMechanism:

    If you would like to have TLS_CLIENT_CERTIFICATE_SECURITY added as a securityMechanism in Liberty, I would recommend opening an RFE so that Liberty development is aware of the demand for supporting this.

    Update:
    To work around this, you can still specify securityMechanism="18", but just do so in a generic <properties> element as opposed to the db2 specific <properties.db2.jcc> element (which it looks like you have figured out already).