mq-container icon indicating copy to clipboard operation
mq-container copied to clipboard

MQRC_NOT_AUTHORIZED [2035] when connect from node to docker ibm mq

Open chidung091 opened this issue 1 year ago • 3 comments

I used to be able to start the container like: docker run --env LICENSE=accept --env MQ_QMGR_NAME=QM1 --volume qm1data:/mnt/mqm --publish 1414:1414 --publish 9443:9443 --detach --env MQ_APP_PASSWORD=passw0rd --env MQ_ADMIN_PASSWORD=passw0rd --name QM1 ibm-mqadvanced-server-dev:9.3.5.0-arm64 i setup MQ_APP_PASSWORD and MQ_ADMIN_PASSWORD since i understand need to setup password to connect: I setup my node with some parameter: let qMgr = "QM1"; let qName = "DEV.QUEUE.1"; const csp = new mq.MQCSP(); csp.UserId = "app"; csp.Password = "passw0rd"; cno.SecurityParms = csp; const cd = new mq.MQCD(); cd.ConnectionName = "localhost(1414)"; cd.ChannelName = "DEV.APP.SVRCONN"; But when running it said that: error MQ call failed in CONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_NOT_AUTHORIZED [2035] Hopefully can found solution for this!

chidung091 avatar May 19 '24 08:05 chidung091

Looking into this.

vgavinash avatar May 20 '24 08:05 vgavinash

@chidung091 There is no problem in the way you have set the environment variable or the password. But I doubt if there is problem in the way you are invoking it, i.e.,

let qMgr = "QM1"; let qName = "DEV.QUEUE.1"; const csp = new mq.MQCSP(); csp.UserId = "app"; csp.Password = "passw0rd"; cno.SecurityParms = csp; const cd = new mq.MQCD(); cd.ConnectionName = "localhost(1414)"; cd.ChannelName = "DEV.APP.SVRCONN";

Specifically the way you are setting the UserId. So I would suggest you to try this.

  1. Create the docker container once again. Later exec into the docker using docker exec -it <image_name> /bin/bash
  2. Navigate to /opt/mqm/samp/bin/ folder
  3. Set, export MQSAMP_USER_ID=app & export MQSERVER="DEV.APP.SVRCONN/TCP/localhost(1414)"
  4. Run, ./amqsputc DEV.QUEUE.1. It works
  5. Later please replicate the same settings in your node

Let me know the result.

Thanks, Avinash

vgavinash avatar May 22 '24 08:05 vgavinash

For MQCSP, I found a stackoverflow query which may relate to your issue (there is no problem from mq-container's side). The link is https://stackoverflow.com/questions/54489703/how-to-use-the-userid-in-mqcsp-for-ibm-mq-connection-authentication-in-c-client. I hope it helps.

vgavinash avatar May 23 '24 08:05 vgavinash

@chidung091 any chance you gave it a try?

vgavinash avatar Jul 16 '24 06:07 vgavinash

@vgavinash see your helping but since not having time yet so i try connect directly to our company dev ibm mq and connecting successful, will try your guide soon to see what happen with local setup

chidung091 avatar Jul 16 '24 06:07 chidung091

Good to know :) its working.

vgavinash avatar Jul 19 '24 06:07 vgavinash

If the prob is resolved, request you to close this git issue.

vgavinash avatar Aug 08 '24 06:08 vgavinash

Hi @vgavinash - A follow up question here.

image: ibm-mqadvanced-server-dev:9.4.0.0-arm64 MacOS

I am also getting unauthorized responses when attempting to connect to the queue manager as well with the same error as above:

CONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_Q_MGR_NAME_ERROR [2058]

The notes here in the default configuration claim that if an app password is not provided, then it will not be required when amqsputc against the dev queue - but this looks not be be true as it prompts for a password.

bash-5.1$ cd /opt/mqm/samp/bin/
bash-5.1$ export MQSAMP_USER_ID=app
bash-5.1$ export MQSERVER="DEV.APP.SVRCONN/TCP/localhost(1414)"
bash-5.1$ ./amqsputc DEV.QUEUE.1
Sample AMQSPUT0 start
Enter password: ****
target queue is DEV.QUEUE.1

Any thoughts why a password here is still required? And also why I fail while connecting the the queue?

zbenamram avatar Sep 07 '24 00:09 zbenamram

@zbenamram that line needs to be corrected. Kindly note that the passwords are no more optional for DEV.APP.SVRCONN. Please retry by setting MQ_APP_PASSWORD environment variable and it must work.

Cc: @arthurbarr

vgavinash avatar Sep 09 '24 06:09 vgavinash

However also please note that CONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_Q_MGR_NAME_ERROR [2058] mentioned in your comment is a different error and nothing related to channel authentication/password.

vgavinash avatar Sep 09 '24 06:09 vgavinash