如何使Jetty 9在訪問密鑰庫時忽略keypass?如何使Jetty 9在訪問密鑰存儲時忽略keypass?
這裏是我做過什麼:
- 我產生了我的域名證書在startssl.com
- 我產生鏈式證書(礦山+ sub.class1.server.ca.pem + ca.pem)這樣
openssl pkcs12 -export -inkey ssl.key -in /home/ubuntu/bundle.crt -out /home/ubuntu/bundle.pkcs12
- 它們導入新的密鑰庫是這樣的:
keytool -importkeystore -srckeystore /home/ubuntu/bundle.pkcs12 -srcstoretype PKCS12 -destkeystore /opt/jetty/etc/keystore
- 出於某種原因,別名爲「1」,所以我改名爲「碼頭」像這樣
keytool -changealias -alias "1" -destalias "jetty" -keystore /opt/jetty/etc/keystore -storepass storepwd
- 請注意,我用
storepwd
這是碼頭髮行版默認密碼
我jetty-ssl.xml
包含此
<Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath"><Property name="jetty.home" default="." />/<Property name="jetty.keystore" default="etc/keystore"/></Set>
<Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"/></Set>
<Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="OBF:1u2u1wml1z7s1z7a1wnl1u2g"/></Set>
<Set name="TrustStorePath"><Property name="jetty.home" default="." />/<Property name="jetty.truststore" default="etc/keystore"/></Set>
<Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"/></Set>
<Set name="EndpointIdentificationAlgorithm"></Set>
<Set name="ExcludeCipherSuites">
<Array type="String">
<Item>SSL_RSA_WITH_DES_CBC_SHA</Item>
<Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>
<Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>
<Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item>
<Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
<Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
<Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>
</Array>
</Set>
<New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Arg><Ref refid="httpConfig"/></Arg>
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
</Call>
</New>
</Configure>
現在,當我啓動這一切的美麗碼頭崩潰,下面的錯誤
2013-07-11 21:34:01.984:WARN:oejuc.AbstractLifeCycle:main: FAILED [email protected](/opt/jetty/etc/keystore,/opt/jetty/etc/keystore): java.security.UnrecoverableKeyException: Cannot recover key
java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(KeyProtector.java:328)
at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:138)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:55)
at java.security.KeyStore.getKey(KeyStore.java:792)
at sun.security.ssl.SunX509KeyManagerImpl.<init>(SunX509KeyManagerImpl.java:131)
at sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(KeyManagerFactoryImpl.java:68)
at javax.net.ssl.KeyManagerFactory.init(KeyManagerFactory.java:259)
哪個顯然密碼不匹配,因爲它期望/從Jetty附帶的默認密鑰庫中傳遞keypass3210。
這裏是我的certicifates(S):http://pastebin.com/raw.php?i=p8LhT50P 這是一個從keytool -list -keystore /opt/jetty/etc/keystore -storepass storepwd -storetype JKS -v
輸出它在哪裏設置?我該如何解決這個錯誤?
謝謝!
出色答卷。 – Mafro34
是否可以忽略keymanagerPassword?我沒有設置密鑰密碼,並導致控制檯要求我爲org.eclipse.jetty.ssl.keypassword,如果在NPE中留下空白結果: – vaibhav
I「+1 KeyManagerPassword =密碼密碼」。 –