IBM MQ SSL 错误 - pymqi.MQMIError:MQI 错误。比较:2,原因 2393:失败:MQRC_SSL_INITIALIZATION_ERROR

问题描述 投票:0回答:1

我正在尝试使用 SSL 连接到本地队列。我收到

pymqi.MQMIError: MQI Error. Comp: 2, Reason 2393: FAILED: MQRC_SSL_INITIALIZATION_ERROR
错误。

AMQERR01.LOG
AMQ9660E: SSL key repository: password stash file absent or unusable.
但目录下有对应的
.sth
文件。

需要帮助来解决错误。

下面是代码

queue_manager = 'QM1'
channel = b'DEV.APP.SVRCONN'
host = '127.0.0.1'
port = '1414'
queue_name = 'DEV.QUEUE.1'
conn_info = f'{host}({port})'
conn_info = conn_info.encode('utf-8')
ssl_cipher_spec = 'TLS_RSA_WITH_AES_256_CBC_SHA256'.encode('utf-8')
key_repo_location = b'/var/mqm/qmgrs/QM1/ssl/key_1'
key_repo_location_env = '/var/mqm/qmgrs/QM1/ssl/key_1'
certificate_label = b'cert_1'
user = 'app'
password = 'qwerty'
message = 'Hello from Python!'
os.environ['MQSSLKEYR'] = key_repo_location_env
cd = pymqi.CD()
cd.ChannelName = channel
cd.ConnectionName = conn_info
cd.ChannelType = pymqi.CMQC.MQCHT_CLNTCONN
cd.TransportType = pymqi.CMQC.MQXPT_TCP
cd.SSLCipherSpec = ssl_cipher_spec
cd.CertificateLabel = certificate_label
sco = pymqi.SCO()
sco.KeyRepository = key_repo_location
sco.CertificateLabel = certificate_label
qmgr = pymqi.QueueManager(None)
qmgr.connect_with_options(queue_manager, cd, sco)
put_queue = pymqi.Queue(qmgr, queue_name)
put_queue.put(message)
python ibm-mq pymqi
1个回答
0
投票

我认为这里的关键是您运行应用程序的 ID。

从表面上看,你正在尝试的应该有效,尽管这是非常不寻常的。

看起来您正在队列管理器的机器上运行 python 应用程序,尽管处于客户端模式。您可以将队列管理器的密钥存储/存储重新用作应用程序的密钥存储/存储,或者将其放在与队列管理器的密钥存储/存储相同的位置。我猜您还没有替换或修改队列管理器的密钥存储。

因此,虽然不推荐,但只要您的存储正确,它应该可以工作。

您的代码看起来与

pymqi
文档中的 TLS 示例类似。

这让我认为您的错误是由于运行程序的用户 ID 没有读取密钥库文件的权限造成的。基本上是 OS POSIX 权限限制。

回复:此解释说明为什么您可能会看到该错误。

© www.soinside.com 2019 - 2024. All rights reserved.