文章
· 三月 31, 2023 阅读大约需 4 分钟

Web Gateway系列(5)配置Web Gateway使用SSL/TLS连接到IRIS

《WebGateway系列(4): 配置HTTPS访问IRIS的Web服务》中介绍了在Web服务器中配置SSL/TLS以实现从客户端浏览器到Web服务器之间的安全连接,从Web服务器到IRIS之间是否也可以通过配置SSL/TLS建立起安全连接呢?尤其是在Web服务器与IRIS没有安装在同一台Server上的情况下,这段连接的安全性也是需要考虑的。答案是肯定的,接下来我们就来介绍下配置Web Gateway使用SSL/TLS连接到IRIS的基本步骤。

1.首先,我们先准备一下所需要的证书。通讯的双方为Web Gateway 和 IRIS Super Server, 双方都需要准备好各自的证书和key。IRIS自带的Public Key Infrastructure(PKI)功能内置了OpenSSL,可以用来生成服务器端及客户端的证书和key。在使用此功能时,IRIS可以同时作为CA Server和CA Client,作为CA Server时可以生成自签名的证书,可以批准CA Client的证书申请并将证书下发给CA Client。

1)配置本地证书颁发机构服务器,生成sever端的证书和key。

 

 

2)配置本地证书颁发机构客户端,如下

 

3)将证书签名请求提交到证书颁发机构服务器

 

4)进程未决证书签名请求

 

发放证书。

 

至此,Client以及Server端证书和key都已准备完成。

5) 从证书发放机构服务器获取证书。

以下证书和key将用于Web Gateway,

/intersystems/irishealth/mgr/cac.cer

/intersystems/irishealth/mgr/cac.key

以下证书和key将用于IRIS Super Server

/intersystems/irishealth/dev/CAcerts/cas.cer

/intersystems/irishealth/dev/CAcerts/cas.key

当然也可以去申请商用的证书,也可以不使用PKI直接使用OpenSSL自己去生成。

2. 配置SSL/TLS, 名为%SuperServer

 

3. Enable Superserver SSL/TLS Support,

 

4. 在Web Server中配置Web Gateway。

本示例中所使用的Web Server为Apache2.4.6,操作系统为Redhat7.9。注意以下Web Gateway管理页面打开端口为默认的80。另外,上面生成好的证书拷贝至了/tmp/下。

 

对应的CSP.ini中内容如下,

[IRISHEALTH]

Ip_Address=localhost

TCP_Port=1972

Username=CSPSystem

Password=]]]c3lz

Minimum_Server_Connections=3

Maximum_Session_Connections=6

Connection_Security_Level=10

Product=2

SSLCC_Protocol=8@

SSLCC_Key_Type=2

SSLCC_Cipher_Suites=ALL:!aNULL:!eNULL:!EXP:!SSLv2

Env_Parameters=EV6

SSLCC_Certificate_File=/tmp/cac.cer

SSLCC_Certificate_Key_File=/tmp/cac.key

SSLCC_CA_Certificate_File=/tmp/cas.cer

SSLCC_Private_Key_Password=]]]MTIz

SSLCC_Verify_Peer=1
XML
XML

 

5. Web Gateway中Test Connection, 报错Server Unavailable。

CSP.log报错如下,

>>> Time: Wed Mar 29 12:00:36 2023; RT Build: 2101.1776 (linux/apapi:srv=2.4.6/apr=1.4.8/apu=1.5.2/mpm=prefork); Log-Level: -1; Gateway-PID: 4315; Gateway-TID: 139634317305600; Connection-No: 0; Server: IRISHEALTH; InterSystems IRIS-PID: 0; Request-ID: 249b
IRISCONNECT : Error Connecting to InterSystems IRIS : Unable to read SSL configuration

Cannot read SSL certificate file: /tmp/cac.cer

>>> Time: Wed Mar 29 12:00:36 2023; RT Build: 2101.1776 (linux/apapi:srv=2.4.6/apr=1.4.8/apu=1.5.2/mpm=prefork); Log-Level: 0; Gateway-PID: 4315; Gateway-TID: 139634317305600
Information: Terminate Connection

Connection closed by Gateway: Connection-No=0:0; Server=IRISHEALTH; InterSystems IRIS PID=0; Context=205;
>>> Time: Wed Mar 29 12:00:36 2023; RT Build: 2101.1776 (linux/apapi:srv=2.4.6/apr=1.4.8/apu=1.5.2/mpm=prefork); Log-Level: 0; Gateway-PID: 4315; Gateway-TID: 139634317305600; Connection-No: ; Request-ID: 249b; Session-ID: uoyakptQAD; Remote-Addr: ; Page: GET /csp/bin/RunTime/Module.cxw
Diagnostic

Failed to connect to 'IRISHEALTH' - Reason: -201 (SSL Configuration error) (No Retry)
ObjectScript
ObjectScript

 

解决办法,

将证书和key文件放置在Web Gateway安装路径下之后问题解决。

SSLCC_Certificate_File=/opt/webgateway/cac.cer

SSLCC_Certificate_Key_File=/opt/webgateway/cac.key

SSLCC_CA_Certificate_File=/opt/webgateway/cas.cer

[root@BJSRHELSUP webgateway]# ll

total 16
drwxr-xr-x. 2 root root 23 Sep 17 2021 apache

drwxr-xr-x. 2 root root 4096 Sep 17 2021 bin

-rwxr-xr-x 1 root root 1233 Mar 29 14:48 cac.cer

-rwxr-xr-x 1 root root 1834 Mar 29 14:49 cac.key

-rwxr-xr-x 1 root root 1164 Mar 29 14:49 cas.cer

drwxrwxr-x. 2 apache root 56 Aug 30 2022 conf

drwxrwxr-x. 2 apache root 57 Nov 4 2021 logs

drwx------. 2 apache root 6 Mar 29 14:41 temp

drwxr-xr-x. 2 root root 20 Sep 17 2021 util
ObjectScript
ObjectScript

6. Web Gateway中再次Test Connection,成功。

 

参考文档,

InterSystems Public Key Infrastructure

Configuring the Web Gateway to Connect to InterSystems IRIS Using TLS

讨论 (0)1
登录或注册以继续