WLP中的出站SSL连接

时间:2014-11-06 22:36:10

标签: java ssl websphere websphere-liberty

我有一个支持Spring安全性的Web应用程序,它使用部署在WLP上的SSL连接到LDAP。我在jvm.options文件

中指定了trustStore和密码,如下所示
-Djavax.net.ssl.trustStore=path/to/keystore
-Djavax.net.ssl.trustStorePassword=password

我的server.xml如下所示

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
  <!-- Enable features -->
  <featureManager>
    <feature>jsp-2.2</feature>
    <feature>ssl-1.0</feature>
    <feature>localConnector-1.0</feature>
  </featureManager>

  <httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="9443" />
  <keyStore id="defaultKeyStore" location="/path/to/identity.jks" password="password" provider="SUN" />
  <webContainer deferServletLoad="false" />
  <application id="appId" location="/path/to/app.war" name="app" type="war" />
</server>

但是我得到以下异常

Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

我尝试使用独立的java程序使用相同的信任库,但它确实有效。任何帮助表示赞赏。

注意:如果我在identity.jks中包含受信任的CA,则可以使用

由于 穆拉利

1 个答案:

答案 0 :(得分:1)

您的identity.jks无法识别,因为它与Http-Endpoint无关。应该不需要使用JSSE系统属性,因为也可以在那里定义信任库。你没有提到你的wlp版本。对于8.5,请参见此处http://www-01.ibm.com/support/knowledgecenter/SSD28V_8.5.5/com.ibm.websphere.wlp.core.doc/ae/rwlp_ssl.html

WebSphere Application Server Developer Tools 提供用于编辑server.xml的用户界面)

您的server.xml应如下所示:

<?xml version="1.0" encoding="UTF-8" ?>
<server description="new server">
  <!-- Enable features -->
  <featureManager>
    <feature>jsp-2.2</feature>
    <feature>ssl-1.0</feature>
    <feature>localConnector-1.0</feature>
  </featureManager>

  <keyStore id="keyStore" location="/path/to/identity.jks" password="keyStorePassword" type="jks" />
  <keyStore id="trustStore" location="/path/to/truststore.jks" password="trustStorePassword" type="jks" />

  <sslDefault sslRef="defaultSSLConfig" />

  <ssl id="defaultSSLConfig" keyStoreRef="keyStore" serverKeyAlias="serverKeyAlias" trustStoreRef="trustStore" />

  <httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="9443">
    <sslOptions sslRef="defaultSSLConfig"></sslOptions>
  </httpEndpoint>
  <webContainer deferServletLoad="false" />
  <application id="appId" location="/path/to/app.war" name="app" type="war" />
</server>