QQ唯一客服请加:519907267 ✈️飞机+44 7936293139 whatsapp:+44 7394140879
好消息:即日起,使用推荐链接推荐您的朋友购买我站证书送您惊喜好礼!
Jetty 服务器 SSL 证书安装部署
2021/04/23 16:22

Jetty 服务器 SSL 证书安装部署

操作场景

本文档指导您如何在 Jetty 服务器中安装 SSL 证书。

说明:

  • 本文档以证书名称 www.huweissl.com 为例。

  • Jetty 版本以 jetty-distribution-9.4.28.v20200408 为例。

  • 当前服务器的操作系统为 CentOS 7,由于操作系统的版本不同,详细操作步骤略有区别。

  • 安装 SSL 证书前,请您在 Jetty 服务器上开启 “443” 端口,避免证书安装后无法启用 HTTPS

前提条件

  • 已准备文件远程拷贝软件,例如 WinSCP(建议从官方网站获取最新版本)。

  • 已准备远程登录工具,例如 PuTTY 或者 Xshell(建议从官方网站获取最新版本)。

  • 已在当前服务器中安装配置 Jetty 服务。

  • 安装 SSL 证书前需准备的数据如下:

名称

说明

服务器的 IP 地址

服务器的 IP 地址,用于 PC 连接到服务器。

用户名

登录服务器的用户名。

密码

登录服务器的密码。

  •  


  • 操作步骤
  1. 已在 护卫SSL 会员中心中下载并解压缩 www.huweissl.com 证书文件包到本地目录。
    解压缩后,可获得相关类型的证书文件。其中包含 Jetty 文件夹和 CSR 文件:

    • 文件夹名称Jetty

    • 文件夹内容

      • www.huweissl.com.jks 密钥库

      • keystorePass.txt 密码文件(若已设置私钥密码,则无 keystorePass.txt 密码文件)

    • CSR 文件内容 www.huweissl.com.csr 文件

      说明:CSR 文件是申请证书时由您上传或系统在线生成的,提供给 CA 机构。安装时可忽略该文件。

    •  

  1. 远程登录 Jetty 服务器。例如,使用 “PuTTY” 工具 登录。

  2. 进入部署证书步骤,在 /usr/local/jetty/jetty-distribution-9.4.28.v20200408/etc 目录下执行命令 mkdir cert 创建 cert 文件夹。

  3. 使用 “WinSCP” (即本地与远程计算机间的复制文件工具)登录 Jetty 服务器,将已获取到的 www.huweissl.com.jks 密钥库文件从本地目录拷贝至 cert 文件夹。

  4. 编辑 /usr/local/jetty/jetty-distribution-9.4.28.v20200408/etc 目录下的 jetty-ssl-context.xml文件,如下所示:

    说明:

  5.          KeyStorePath:默认值 default 请填写证书存放的路径。

    • KeyStorePassword:默认值 default 请填写密钥库密码,指定 keystore 的密码。申请证书时若设置了私钥密码,请填写私钥密码;若申请证书时未设置私钥密码,请填写 Tomcat 文件夹中 keystorePass.txt 文件的密码。

    • KeyManagerPassword:请填写 Tomcat 文件夹中 keystorePass.txt 文件的密码。

    • TrustStorePath:默认值 default 请填写证书存放的路径。

<?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd"><!-- ============================================================= --><!-- SSL ContextFactory configuration                              --><!-- ============================================================= --><!--

To configure Includes / Excludes for Cipher Suites or Protocols see tweak-ssl.xml example at

 https://www.eclipse.org/jetty/documentation/current/configuring-ssl.html#configuring-sslcontextfactory-cipherSuites

--><Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory$Server"><Set name="Provider"><Property name="jetty.sslContext.provider"/></Set><Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.sslContext.keyStorePath" deprecated="jetty.keystore" default="etc/cert/www.huweissl.com.jks"/></Set><Set name="KeyStorePassword"><Property name="jetty.sslContext.keyStorePassword" deprecated="jetty.keystore.password" default="4d5jtdq238j1l"/></Set><Set name="KeyStoreType"><Property name="jetty.sslContext.keyStoreType" default="JKS"/></Set><Set name="KeyStoreProvider"><Property name="jetty.sslContext.keyStoreProvider"/></Set><Set name="KeyManagerPassword"><Property name="jetty.sslContext.keyManagerPassword" deprecated="jetty.keymanager.password" default="4d5jtdq238j1l"/></Set><Set name="TrustStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.sslContext.trustStorePath" deprecated="jetty.truststore" default="etc/cert/www.huweissl.com.jks"/></Set><Set name="TrustStorePassword"><Property name="jetty.sslContext.trustStorePassword" deprecated="jetty.truststore.password"/></Set><Set name="TrustStoreType"><Property name="jetty.sslContext.trustStoreType"/></Set><Set name="TrustStoreProvider"><Property name="jetty.sslContext.trustStoreProvider"/></Set><Set name="EndpointIdentificationAlgorithm"><Property name="jetty.sslContext.endpointIdentificationAlgorithm"/></Set><Set name="NeedClientAuth"><Property name="jetty.sslContext.needClientAuth" deprecated="jetty.ssl.needClientAuth" default="false"/></Set><Set name="WantClientAuth"><Property name="jetty.sslContext.wantClientAuth" deprecated="jetty.ssl.wantClientAuth" default="false"/></Set><Set name="useCipherSuitesOrder"><Property name="jetty.sslContext.useCipherSuitesOrder" default="true"/></Set><Set name="sslSessionCacheSize"><Property name="jetty.sslContext.sslSessionCacheSize" default="-1"/></Set><Set name="sslSessionTimeout"><Property name="jetty.sslContext.sslSessionTimeout" default="-1"/></Set><Set name="RenegotiationAllowed"><Property name="jetty.sslContext.renegotiationAllowed" default="true"/></Set><Set name="RenegotiationLimit"><Property name="jetty.sslContext.renegotiationLimit" default="5"/></Set><Set name="SniRequired"><Property name="jetty.sslContext.sniRequired" default="false"/></Set><!-- Example of how to configure a PKIX Certificate Path revocation Checker

<Call id="pkixPreferCrls" class="java.security.cert.PKIXRevocationChecker$Option" name="valueOf"><Arg>PREFER_CRLS</Arg></Call>

<Call id="pkixSoftFail" class="java.security.cert.PKIXRevocationChecker$Option" name="valueOf"><Arg>SOFT_FAIL</Arg></Call>

<Call id="pkixNoFallback" class="java.security.cert.PKIXRevocationChecker$Option" name="valueOf"><Arg>NO_FALLBACK</Arg></Call>

<Call class="java.security.cert.CertPathBuilder" name="getInstance">

<Arg>PKIX</Arg>

<Call id="pkixRevocationChecker" name="getRevocationChecker">

  <Call name="setOptions">

    <Arg>

      <Call class="java.util.EnumSet" name="of">

        <Arg><Ref refid="pkixPreferCrls"/></Arg>

        <Arg><Ref refid="pkixSoftFail"/></Arg>

        <Arg><Ref refid="pkixNoFallback"/></Arg>

      </Call>

    </Arg>

  </Call>

</Call>

</Call>

<Set name="PkixCertPathChecker"><Ref refid="pkixRevocationChecker"/></Set>

--></Configure>

  1. 编辑 /usr/local/jetty/jetty-distribution-9.4.28.v20200408/etc 目录下的 jetty-ssl.xml 文件,修改端口为443。如下所示:

  2.  

<Call  name="addConnector"><Arg>

  <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">

    <Arg name="server"><Ref refid="Server" /></Arg>

    <Arg name=

Copyright © 厦门湃瑞珅网络科技有限公司  版权所有  闽ICP备2021010547号-1 ghs.png 公安备案: 35020602001916号