2014-11-06 46 views
0

我有一個啓用了spring security的Web應用程序,它使用通過WLP部署的SSL連接到LDAP。我在jvm.options文件中指定的信任庫,然後如下密碼WLP中的出站SSL連接

-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程序,它的工作原理。任何幫助表示讚賞。

注:如果我有可信CA在identity.jks它的工作原理

感謝 穆拉利

+0

請運行用「-Djavax.net.debug = all」來獲得完整的SSL調試日誌,並在這裏粘貼問題。 – 2014-11-06 23:02:32

+0

您爲什麼不能使用identity.jks來存儲可信任的CA的任何原因? – Gas 2014-11-07 00:22:49

+0

我希望它與衆不同,因爲服務器證書是從外部獲取的,CA證書是所有環境的標準。但看起來我必須選擇一個密鑰存儲選項。 – Murali 2014-11-07 03:05:14

回答

1

你identity.jks不能被識別,因爲它不與HTTP端點的關聯。應該不需要使用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的開發工具Eclipse的提供編輯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>