安装 ArcGIS Enterprise 之 使用 openssl 生成 SSL(.pfx 格式) 自签名证书

ArcGIS Enterprise 组件 Web Adaptor 是一个请求转发器,它作为 ArcGIS Enterprise 的出口,从 80 和 443 端口接收用户请求,然后转发给 Portal 或 ArcGIS Server (这取决于 Web Adaptor 配置时是为 Portal 配置的还是为 Server 配置的,ArcGIS Enterprise 部署中需要安装两个 Web Adaptor,一个配置给 Portal,一个配置给 ArcGIS Server),从而为最终用户屏蔽 Portal 的 7080、7443 及 Server 的 6080、6443 等非默认端口。使用 80 和 443 端口作为出口是 ArcGIS Enterprise 的硬性要求(企图通过非 80 和 443 端口使用 ArcGIS Enterprise 的小伙伴请放弃挣扎)。

Web Adaptor 需要与 Web 服务器 (常用的如 IIS 或 Tomcat)配合使用,其本质为 部署在 Web 服务器下的一个应用。由于 ArcGIS Enterprise 组件 Portal 要求必须使用 https(企图回避 https 的小伙伴请再次放弃挣扎),因此与 Web Adaptor 配合使用的 Web 服务器必须配置为使用 https。为 Web 服务器开启 https 时需要使用 SSL 证书。可以向权威机构购买 SSL 证书,使用这样的 SSL 证书无需对浏览器进行额外的操作。在测试环境或内部环境中,我们通常选择自己制作 SSL 证书——自签名证书,免于花钱,只不过制作出来的 SSL 证书不会默认地被浏览器信任,需要手动添加信任(每个客户端浏览器首次访问该网站时手动安装证书)。

一个常用的制作 SSL 证书的方法是使用 openssl 生成自签名证书。

  • openssl生成 .pfx 证书
  1. 修改 openssl.cfg 文件,指定域名
DNS.1=*.esrigz.com
  1. 生成密钥 key 文件
openssl genrsa -des3 -out D:\apps\OpenSSL\results\esrigz.key 2048

此步骤会要求创建密码。

  1. 利用密钥生成创建证书签名请求
openssl req -new -key D:\apps\OpenSSL\results\esrigz.key -out D:\apps\OpenSSL\results\esrigz.csr -subj /CN=*.esrigz.com -config openssl.cfg -extensions v3_req

此步骤会要求输入密码,输入步骤2中的密码。

  1. 为证书签名(自签名)
openssl req -x509 -sha256 -days 3650 -key D:\apps\OpenSSL\results\esrigz.key -in D:\apps\OpenSSL\results\esrigz.csr -out D:\apps\OpenSSL\results\esrigz.crt -config openssl.cfg -extensions v3_req

此步骤会要求输入密码,输入步骤2中的密码。

  1. 将证书转换为 .pfx 格式
openssl pkcs12 -export -out D:\apps\OpenSSL\results\esrigz.p12 -inkey D:\apps\OpenSSL\results\esrigz.key -in D:\apps\OpenSSL\results\esrigz.crt

此步骤会要求输入密码,输入步骤2中的密码;然后要求创建密码,创建证书导出的密码。

  • tomcat 应用 .pfx 证书
    修改 tomcat 配置文件 conf/server.xml
  1. 将 Http Connector 配置中将端口修改为 80,重定向端口修改为 443;

  2. 在 Https Connector 配置中将端口修改为 443,增加 keystoreType, keystoreFile, keystorePass 字段。其中:
    keystoreType 填写证书类型 keystoreType=“PKCS12”
    keystoreFile 指向证书制作步骤1中生成的key文件,如果将.key 文件放置在 tomcat 的 bin 目录下,则可以如示例中填写 keystoreFile=“bin/esrigz.p12”
    keystorePass 填写证书制作步骤2中的密码 keystorePass=“passw0rd”

    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="443" />
    <!-- A "Connector" using the shared thread pool -->
    <!--
    <Connector executor="tomcatThreadPool"
               port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the APR/native
         documentation -->
    
    <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" keystoreType="PKCS12"
               keystoreFile="bin/esrigz.p12" keystorePass="passw0rd"/>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值