我收到了来自 GoDaddy 的证书,我正尝试使用 Jetty 启用 SSL,但在连接到时收到错误 107 SSL 协议错误https://server.com:8443
我使用以下命令生成了密钥库:
keytool -keystore keystore -import -alias gd_bundle -trustcacerts -file gd_bundle.crt
keytool -keystore keystore -import -alias server.com -trustcacerts -file server.com.crt
并将其放入/opt/jetty/etc/
并使用了以下配置jetty.xml
:
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Arg>
<New class="org.eclipse.jetty.http.ssl.SslContextFactory">
<Set name="keyStore"><SystemProperty name="jetty.home" default="."/>/etc/keystore</Set>
<Set name="keyStorePassword">**password1**</Set>
<Set name="keyManagerPassword">**password1**</Set>
<Set name="trustStore"><SystemProperty name="jetty.home" default="."/>/etc/keystore</Set>
<Set name="trustStorePassword">**password1**</Set>
</New>
</Arg>
<Set name="port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
我是否遗漏了码头配置中的某些内容?
答案1
我认为,当您将 .crt 文件加载回密钥库文件时,密钥库别名需要相同。我所做的基本上与您使用 digicert 证书所做的相同,以下是我用来生成 .csr 并合并结果的过程。此外,我发现 .p7b 版本的证书比单个 .crt 文件更容易处理。这也可能对您有所帮助。
生成密钥对和密钥库文件
% keytool -genkey -alias server -keyalg RSA -keystore star_mydom_com.jks \
-dname "CN=*.mydom.com, O=<org>, L=<city>, ST=<state>, C=<country>"
生成.csr 文件
% keytool -certreq -alias server -file star_mydom_com.csr -keystore star_mydom_com.jks
将 .p7b 文件导入到密钥库文件
% keytool -import -trustcacerts -alias server -file star_mydom_com.p7b \
-keystore star_mydom_com.jks
混淆密码
% JETTY_VER=8.1.10.v20130312
% JETTY_HOME=$HOME/jetty_ssl/jetty-hightide-$JETTY_VER
% java -cp $JETTY_HOME/lib/jetty-util-${JETTY_VER}.jar \
org.eclipse.jetty.util.security.Password jettyuser 'supersecretpassword'
supersecretpassword
OBF:1vny1yte1x8g1wml1yf21ym71sar1uuq1ym51t331ym91uvg1saj1ym71yf41wnl1x8e1yt81vn4
MD5:bbb2c5e63d2ef893106fdd0d797aa97a
CRYPT:je0/SbkypAbJA
将密码添加到 etc/jetty-ssl.xml
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- digicert -->
<New id="sslContextFactory" class="org.eclipse.jetty.http.ssl.SslContextFactory">
<Set name="KeyStore"><Property name="jetty.home" default="." />/etc/star_mydom_com.jks</Set>
<Set name="KeyStorePassword">OBF:1vny1yte1x8g1wml1yf21ym71sar1uuq1ym51t331ym91uvg1saj1ym71yf41wnl1x8e1yt81vn4</Set>
<Set name="KeyManagerPassword">OBF:1vny1yte1x8g1wml1yf21ym71sar1uuq1ym51t331ym91uvg1saj1ym71yf41wnl1x8e1yt81vn4</Set>
<Set name="TrustStore"><Property name="jetty.home" default="." />/etc/star_mydom_com.jks</Set>
<Set name="TrustStorePassword">OBF:1vny1yte1x8g1wml1yf21ym71sar1uuq1ym51t331ym91uvg1saj1ym71yf41wnl1x8e1yt81vn4</Set>
</New>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Arg><Ref id="sslContextFactory" /></Arg>
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="AcceptQueueSize">100</Set>
<!--you can disable cipher suites in the following section. -->
<Set name="IncludeCipherSuites">
<Array type="java.lang.String">
<Item>TLS_DHE_RSA_WITH_AES_128_CBC_SHA</Item>
<Item>SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA</Item>
<Item>TLS_RSA_WITH_AES_128_CBC_SHA</Item>
<Item>SSL_RSA_WITH_3DES_EDE_CBC_SHA</Item>
<Item>TLS_DHE_DSS_WITH_AES_128_CBC_SHA</Item>
<Item>SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA</Item>
</Array>
</Set>
</New>
</Arg>
</Call>
</Configure>