使用Jetty 8启用SSL

我收到GoDaddy的证书,我正在尝试使用Jetty启用SSL,但在连接到https://server.com:8443时收到错误107 SSL协议错误

我使用以下命令生成了密钥库:

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>

我错过了码头的配置吗?

我认为当您将.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>
相关文章
相关标签/搜索