Bitesize Blogging: MQ V8 - Samples can use user ID and password
Morag Hughson 110000EQPN Comments (2) Visits (2076)
Another in the series of bite size blog posts about features in MQ V8. Check out the whole series here.
One of the main security highlights of MQ V8 is a feature called Connection Authentication which allows applications to provide a user ID and password and have the queue manager validate it is correct before allowing the application to successfully connect. You can read more about this feature in a number of resources:-
To allow some of our samples to be used with this new feature we have also made the following updates.
The sample C program that demonstrates how to specify client connection information on MQCONNX, amqscnxc, has been updated to take an extra flag in its input parameters to allow you to specify a user ID. When the user ID is provided it then prompts you for a password when the application runs. This gives it the following usage string now:-
amqscnxc [-x ConnName [-c SvrconnChlName]] [-u User] [QMgrName]
So you can use this with client channel details like so:-
> amqscnxc -x mach
Or fall back to the MQSERVER environment variable or a CCDT like so:-
amqscnxc -u hughson QM1
A number of other samples were also updated which follow a slightly different pattern.
This set of samples all took their parameters as positional parameters and so adding a new parameter would mean that all the other parameters have to be provided as well. So instead these samples pay attention to an environment variable named MQSAMP_USER_ID. If this is set to something that value will be used as the user ID and futhermore the sample will prompt you to supply a password to go with it:-
A couple of the JMS samples have also been updated to have a user ID as a parameter. These are JmsProducer and JmsConsumer. These have had -u and -w flags added to them so you can use them like this:-
Where mqinst is the location of your MQ installation.
java JmsProducer -m QM1 -d Q1 -u hughson -w passw0rd Enter some text to be sent in a message <ENTER to finish>:My Message Text Sent message: JMSMessage class: jms_text JMSType: null JMSDeliveryMode: 2 JMSDeliveryDelay: 0 JMSDeliveryTime: 1404319379404 JMSExpiration: 0 JMSPriority: 4 JMSMessageID: ID:4