Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • db2jcc4.jar level/version is DB2 10.5FP1.
  • Websphere Liberty started without the CWWKG0032W warning when I used the generic JDBC driver properties properties instead of DB2® JCC properties properties.db2.jcc
like image 503
shimac-jp Avatar asked Sep 27 '22 11:09

shimac-jp


1 Answers

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:

  • value="3" name="CLEAR_TEXT_PASSWORD_SECURITY"
  • value="4" name="USER_ONLY_SECURITY"
  • value="7" name="ENCRYPTED_PASSWORD_SECURITY"
  • value="9" name="ENCRYPTED_USER_AND_PASSWORD_SECURITY"
  • value="11" name="KERBEROS_SECURITY"
  • value="12" name="ENCRYPTED_USER_AND_DATA_SECURITY"
  • value="13" name="ENCRYPTED_USER_PASSWORD_AND_DATA_SECURITY"
  • value="15" name="PLUGIN_SECURITY"
  • value="16" name="ENCRYPTED_USER_ONLY_SECURITY"

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).

like image 134
Andy Guibert Avatar answered Oct 11 '22 14:10

Andy Guibert