IBM MQ 在使用 SSL 证书时需要用户名和密码(错误 2035)

IBM MQ expects username and password when using SSL certificates (Error 2035)

我一直坚持在 IBM Websphere MQ (9.2) 中使用 SSL。 我正在为 MQ 构建一个客户端库,为了更熟悉服务器端的 MQ,我安装了 IBM MQ Developer edition 和 运行 提供的脚本来创建 'default' MQ 服务器实例。

  1. DEV.APP.SVRCONN 服务器连接创建了客户端连接
  2. 使用 IBM 密钥管理工具创建了一个个人证书,并将其命名为ibmwebspheremq
  3. 队列管理器 (QM1) 上启用了 SSL 并将其标记为 ibmwebspheremq
  4. 更新了 DEV.APP.SVRCONN 通道的 SSL 配置并将 cipherspec 属性 设置为 TLS 1.2, 256-bit Secure Hash Algorithm, 128-bit AES encryption (TLS_RSA_WITH_AES_128_CBC_SHA256) 并要求使用 SSL。

测试了我的设置:

amqssslc -l ibmwebspheremq -k C:\ProgramData\IBM\MQ\qmgrs\QM1\ssl\key  -c DEV.APP.SVRCONN -x 127.0.0.1 -s TLS_RSA_WITH_AES_128_CBC_SHA256 -m QM1

这给了我:

Sample AMQSSSLC start
Connecting to queue manager QM1
Using the server connection channel DEV.APP.SVRCONN
on connection name 127.0.0.1.
Using SSL CipherSpec TLS_RSA_WITH_AES_128_CBC_SHA256
Using SSL key repository stem C:\ProgramData\IBM\MQ\qmgrs\QM1\ssl\key
Certificate Label: ibmwebspheremq
No OCSP configuration specified.
MQCONNX ended with reason code 2035

错误详情(来自日志):

The active values of the channel were 'MCAUSER(app) CLNTUSER(Wilko)
SSLPEER(SERIALNUMBER=61:9B:A4:3E,CN=DESKTOP-ROH98N2,C=NL)
SSLCERTI(CN=DESKTOP-ROH98N2,C=NL) ADDRESS(DESKTOP-ROH98N2)'. The
MATCH(RUNCHECK) mode of the DISPLAY CHLAUTH MQSC command can be used to
identify the relevant CHLAUTH record.
ACTION:
Ensure that the application provides a valid user ID and password, or change
the queue manager connection authority (CONNAUTH) configuration to OPTIONAL to
allow client applications to connect which have not supplied a user ID and
password. 
----- cmqxrmsa.c : 2086 -------------------------------------------------------
22/11/2021 15:51:37 - Process(15880.45) User(MUSR_MQADMIN) Program(amqrmppa.exe)
                      Host(DESKTOP-ROH98N2) Installation(Installation1)
                      VRMF(9.2.3.0) QMgr(QM1)
                      Time(2021-11-22T14:51:37.594Z)
                      CommentInsert1(DEV.APP.SVRCONN)
                      CommentInsert2(15880(1112))
                      CommentInsert3(127.0.0.1)
                     
AMQ9999E: Channel 'DEV.APP.SVRCONN' to host '127.0.0.1' ended abnormally.

EXPLANATION:
The channel program running under process ID 15880(1112) for channel
'DEV.APP.SVRCONN' ended abnormally. The host name is '127.0.0.1'; in some cases
the host name cannot be determined and so is shown as '????'.
ACTION:
Look at previous error messages for the channel program in the error logs to
determine the cause of the failure. Note that this message can be excluded
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage"
attributes under the "QMErrorLog" stanza in qm.ini. Further information can be
found in the System Administration Guide. 
----- amqrmrsa.c : 630 --------------------------------------------------------

我有点卡住了,我在日志中也看到了转储的PEER相关信息,但我没有唱SSLPEER设置(我只是想让每个人都使用相同的证书连接)。

编辑 2:

来自 RUNMQSC QM1 和命令 DISPLAY QMGR CONNAUTH 的输出:

     1 : DISPLAY QMGR CONNAUTH
AMQ8408I: Display Queue Manager details.
   QMNAME(QM1)                             CONNAUTH(DEV.AUTHINFO)

RUNMQSC QM1 和命令 DISPLAY AUTHINFO(name-from-previous-command) 的输出:

     3 : DISPLAY AUTHINFO(DEV.AUTHINFO)
AMQ8566I: Display authentication information details.
   AUTHINFO(DEV.AUTHINFO)                  AUTHTYPE(IDPWOS)
   ADOPTCTX(YES)                           DESCR( )
   CHCKCLNT(REQDADM)                       CHCKLOCL(OPTIONAL)
   FAILDLAY(1)                             AUTHENMD(OS)
   ALTDATE(2021-11-18)                     ALTTIME(15.09.20)

来自DISPLAY CHLAUTH(*)的输出:

     4 : DISPLAY CHLAUTH(*)
AMQ8878I: Display channel authentication record details.
   CHLAUTH(DEV.ADMIN.SVRCONN)              TYPE(USERMAP)
   CLNTUSER(admin)                         USERSRC(CHANNEL)
AMQ8878I: Display channel authentication record details.
   CHLAUTH(DEV.ADMIN.SVRCONN)              TYPE(BLOCKUSER)
   USERLIST(nobody)
AMQ8878I: Display channel authentication record details.
   CHLAUTH(DEV.APP.SVRCONN)                TYPE(ADDRESSMAP)
   ADDRESS(*)                              USERSRC(CHANNEL)
   CHCKCLNT(REQUIRED)
AMQ8878I: Display channel authentication record details.
   CHLAUTH(SYSTEM.ADMIN.SVRCONN)           TYPE(ADDRESSMAP)
   ADDRESS(*)                              USERSRC(CHANNEL)
AMQ8878I: Display channel authentication record details.
   CHLAUTH(SYSTEM.*)                       TYPE(ADDRESSMAP)
   ADDRESS(*)                              USERSRC(NOACCESS)

我原以为在使用证书时不必提供用户名和密码。我在这里错过了什么?

您的队列管理器被配置为为任何试图 运行 具有特权的已解析 MCAUSER 的客户端连接强制设置密码。这就是你 AUTHINFO(DEV.AUTHINFO) 上的 CHCKCLNT(REQDADM) 所做的。

此外,您针对 DEV.APP.SVRCONN 频道的 CHLAUTH 规则已进一步升级,以强制使用该频道的 ALL 连接使用密码。

如果您的意图是让提供证书的渠道不受此授权的约束,那么您应该添加更进一步、更具体的 CHLAUTH 规则,大致如下:-

SET CHLAUTH(DEV.APP.SVRCONN) TYPE(SSLPEERMAP) +
    SSLPEER('SERIALNUMBER=61:9B:A4:3E,CN=DESKTOP-ROH98N2,C=NL') +
    SSLCERTI('CN=DESKTOP-ROH98N2,C=NL') CHCKCLNT(ASQMGR) USERSRC(CHANNEL)

请记住,如果此连接使用的是特权用户 ID,它仍然需要提供系统范围设置 CHCKCLNT(REQDADM) 中的密码。

记住,如果您不确定匹配的是哪个 CHLAUTH 规则,您在错误消息中看到的所有这些细节都可以用于形成一个 DISPLAY CHLAUTH 命令来准确发现哪个规则你匹配了。在 I’m being blocked by CHLAUTH – how can I work out why?

中阅读更多相关信息