亚洲精品无码鲁网中文电影,无码专区日韩亚洲精品,丁香花视频资源在线观看,亚洲综合av永久无码精品一区二区

您好,歡迎進入銳速云官網(wǎng)!

售后熱線:4006-5050-10 QQ客服:2852917158 登錄 注冊

在Jetty服務(wù)器上安裝SSL證書
編輯作者:   發(fā)布時間:2019-12-26

阿里云SSL證書服務(wù)支持下載證書安裝到Jetty服務(wù)器,從而使Jetty服務(wù)器支持HTTPS安全訪問。本文介紹了證書安裝的具體操作。

  1. Jetty服務(wù)器版本確認(rèn)。建議使用Jetty 9.2.22及以上版本。

  2. 從阿里云下載tomcat格式的證書。非系統(tǒng)生成的CSR需要生成pfx證書密匙對文件,轉(zhuǎn)換命令如下。

    openssl pkcs12 -export -out 214362464370691.pfx -inkey 214362464370691.key -in 214362464370691.pem
  3. 轉(zhuǎn)換pfx的證書密匙對文件為jks格式,轉(zhuǎn)換命令如下:

    說明 Windows環(huán)境注意在%JAVA_HOME%/jdk/bin目錄中執(zhí)行。
    keytool -importkeystore -srckeystore 密匙對文件.pfx -destkeystore 證書名稱.jks -srcstoretype PKCS12 -deststoretype JKS

    回車后輸入兩次要設(shè)置的jks格式證書密碼,然后輸入一次pfx證書密碼。三次密碼必須輸入pfx-password.txt記錄的密碼。jks密碼與pfx證書密碼相同,否則可能會導(dǎo)致Jetty服務(wù)器啟動失敗。

  4. 1.png

  5. 配置Jetty的SSL。

    1. 確保Jetty的http頁面可正常訪問。

  6. 2.png

    1. 拷貝證書。進入Jetty服務(wù)器目錄下的etc,新建存放jks格式證書的目錄,并復(fù)制jks格式證書至當(dāng)前目錄。

      # pwd/opt/jetty9222/etc# mkdir cert# cd cert/# cp ../../../keys/jetty.jks .# lsjetty.jks

    3.png

    1. 編輯Jetty服務(wù)器目錄中的etc中的jetty-ssl.xml文件,設(shè)置證書相關(guān)參數(shù)(密碼設(shè)置均為pfx-password.txt所記錄的密碼)。4.png

      <?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"><!-- ============================================================= --><!-- Configure a TLS (SSL) Context Factory                         --><!-- This configuration must be used in conjunction with jetty.xml --><!-- and either jetty-https.xml or jetty-spdy.xml (but not both)   --><!-- ============================================================= --><Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
        <Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="etc/cert/jetty.jks"/></Set>
        <Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="214362464370691"/></Set><?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"><!-- ============================================================= --><!-- Configure a TLS (SSL) Context Factory                         --><!-- This configuration must be used in conjunction with jetty.xml --><!-- and either jetty-https.xml or jetty-spdy.xml (but not both)   --><!-- ============================================================= --><Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
        <Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="etc/cert/jetty.jks"/></Set>
        <Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="214362464370691"/></Set>
        <Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="214362464370691"/></Set>
        <Set name="TrustStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.truststore" default="etc/cert/jetty.jks"/></Set>
        <Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="214362464370691"/></Set>
        <Set name="EndpointIdentificationAlgorithm"></Set>
        <Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set>
        <Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></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>
        <!-- =========================================================== -->
        <!-- Create a TLS specific HttpConfiguration based on the        -->
        <!-- common HttpConfiguration defined in jetty.xml               -->
        <!-- Add a SecureRequestCustomizer to extract certificate and    -->
        <!-- session information                                         -->
        <!-- =========================================================== -->
        <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>
    2. 編輯Jetty服務(wù)器目錄中的etc中的jetty-https.xml文件,配置https所使用的443端口。

      5.png

      <?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"><!-- ============================================================= --><!-- Configure a HTTPS connector.                                  --><!-- This configuration must be used in conjunction with jetty.xml --><!-- and jetty-ssl.xml.                                            --><!-- ============================================================= --><Configure id="Server" class="org.eclipse.jetty.server.Server">
        <!-- =========================================================== -->
        <!-- Add a HTTPS Connector.                                      -->
        <!-- Configure an o.e.j.server.ServerConnector with connection   -->
        <!-- factories for TLS (aka SSL) and HTTP to provide HTTPS.      -->
        <!-- All accepted TLS connections are wired to a HTTP connection.-->
        <!--                                                             -->
        <!-- Consult the javadoc of o.e.j.server.ServerConnector,        -->
        <!-- o.e.j.server.SslConnectionFactory and                       -->
        <!-- o.e.j.server.HttpConnectionFactory for all configuration    -->
        <!-- that may be set here.                                       -->
        <!-- =========================================================== -->
        <Call id="httpsConnector" name="addConnector">
          <Arg>
            <New class="org.eclipse.jetty.server.ServerConnector">
              <Arg name="server"><Ref refid="Server" /></Arg>
              <Arg name="acceptors" type="int"><Property name="ssl.acceptors" default="-1"/></Arg>
              <Arg name="selectors" type="int"><Property name="ssl.selectors" default="-1"/></Arg>
              <Arg name="factories">
                <Array type="org.eclipse.jetty.server.ConnectionFactory">
                  <Item>
                    <New class="org.eclipse.jetty.server.SslConnectionFactory">
                      <Arg name="next">http/1.1</Arg>
                      <Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
                    </New>
                  </Item>
                  <Item>
                    <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                      <Arg name="config"><Ref refid="sslHttpConfig"/></Arg>
                    </New>
                  </Item>
                </Array>
              </Arg>
              <Set name="host"><Property name="jetty.host" /></Set>
              <Set name="port"><Property name="https.port" default="443" /></Set>
              <Set name="idleTimeout"><Property name="https.timeout" default="30000"/></Set>
              <Set name="soLingerTime"><Property name="https.soLingerTime" default="-1"/></Set>
              <Set name="acceptorPriorityDelta"><Property name="ssl.acceptorPriorityDelta" default="0"/></Set>
              <Set name="selectorPriorityDelta"><Property name="ssl.selectorPriorityDelta" default="0"/></Set>
              <Set name="acceptQueueSize"><Property name="https.acceptQueueSize" default="0"/></Set>
            </New>
          </Arg>
        </Call></Configure>
    3. 編輯Jetty服務(wù)器目錄中的start.ini文件,按需求更改端口號,并設(shè)置啟動加載jetty-https.xmljetty-ssl.xml。

      jetty.port=80jetty.dump.stop=
      etc/jetty-ssl.xmletc/jetty-https.xml
    4. 重啟Jetty,驗證https訪問是否正常。驗證


版權(quán)所有:Copyright @ 2016-2022 深圳市銳速云計算有限公司 增值電信業(yè)務(wù)經(jīng)營許可證
粵B1-20171508
備案系統(tǒng) 粵ICP備16119720號 粵公網(wǎng)安備 44030902000612號