ibm-messaging / mq-mqi-nodejs

Calling IBM MQ from Node.js - a JavaScript MQI wrapper
Apache License 2.0
79 stars 42 forks source link

Not able to connect with UserId in MQCSP block #94

Closed ashfaq-shaik closed 4 years ago

ashfaq-shaik commented 4 years ago

Environment : Redhat Linux mq-mqi-nodejs Version : 0.9.14

I am trying to connect to a queue manager on a remote server. This QMGR has authentication enabled and i have credentials for it. Say UserID : quser . My Redhat OS user name is opsuser.

When I try to connect with below mqcsp block, I get a a 2035

On the server logs I can see that it is submitting my connection request as opsuser, is there some config that I am missing? Just to test I created a redhat user name quser and tried again, this time it went through.

How can i stop the process from connecting as my os/service user?

AMQ9557: Queue Manager User Id initialization failed for 'opsuser'.

Explanation:
The call to initialize the User ID 'opsuser' failed with CompCode 2 and Reason 2035. If an MQCSP block was used, the User ID in the MQCSP block was 'quser'

Action:
Correct the error and try again

Code

connect(){
        return new Promise((resolve, reject) => {
            console.log(`Booting MQ Writer : ${this.writerName}`)
            this.cno = new mq.MQCNO();
            this.cno.Options = this.MQC.MQCNO_NONE;

            let csp = new mq.MQCSP();
            csp.UserId = "quser";
            csp.Password = "passw0rd";
            this.cno.SecurityParms = csp;

            /** Connection Definition */
            this.connectionDefinition = new mq.MQCD();
            this.connectionDefinition.ConnectionName  = `${this.connectionParams.mqHost}(${this.connectionParams.mqPort})`;
            this.connectionDefinition.ChannelName     = this.connectionParams.channelName;

            this.cno.ClientConn = this.connectionDefinition;

            mq.Connx(this.connectionParams.queueManager, this.cno, (err, conn) => {
                if(err){
                    throw err;
                } else {
                    this.qMgrConn = conn;

                    if(this.connectionParams.tlsConfig) {
                        console.log(`Connected to ${this.connectionParams.queueManager} via TLS`);
                    } else {
                        console.log(`Connected to ${this.connectionParams.queueManager}`)
                    }

                    /** Definitions */
                    this.openDefinition             = new mq.MQOD();
                    this.openOptions                = this.MQC.MQOO_OUTPUT;
                    this.openDefinition.ObjectName  = this.connectionParams.queueName;
                    mq.Open(conn, this.openDefinition, this.openOptions, (err, qObj) => {
                        if(err) {
                            throw err
                        } else {
                            this.qConn = qObj;
                            console.log(`Connection opened to Queue : ${this.connectionParams.queueName}`);
                        }
                        resolve()
                    })
                }
            })
        });
    }
ibmmqmet commented 4 years ago

There does not seem to be anything obviously wrong with the application code.

So likely reasons are around the queue manager configuration. I'd suspect that that the in-effect AUTHINFO definition has either been set to ignore authentication credentials with CHKCLNT(NONE) or it has not set ADOPTCTX to true.

ibmmqmet commented 4 years ago

no recent update - closing