It is frequently neglected. It is almost always overlooked. It is the ugly duckling of distributed application design. Yes, I am talking about Information Security.
Security should be a compulsory requirement of any application.
IBM MQ has extensive security options for either protecting your MQ infrastructure and securing the information that flows trough MQ in the form of messages.
Security in IBM MQ is a somewhat complex feature, so this will be the first of a series of three articles about MQ’s security features.
Security features were greatly improved in IBM MQ 8.0. The most changed features (user authentication and channel security) will be addressed in future posts.
In the first part of this sub-series of articles about securing your communications with SSL.
Communication between queue managers and between clients and queue manager can and should be encrypted using SSL. This assures that messages being transmitted over the network, if intercepted, cannot be read by unwanted third-parties (or, at least, be very difficult to read).
To have your queue manager communicate using SSL, the following is needed:
- SSL certificates for both ends of a sender/receiver channel pair.
- SSL options set for the channels (both sender and receiver)
As for the SSL certificates, you can use self-signed certificates or CA-signed certificates. Keep in mind that public CA-signed certificates are quite expensive. Self-signed ones are more than enough and offer the same level of confidentiality as CA-signed ones.
For now, I’ll stick with self-signed certificates.
In the following examples, I’ll be connecting two queue managers, MQ01 and MQ02 using an encrypted channel.
To create a self-signed certificate in MQ, just issue the commands:
First, create a keystore:
cd /var/mqm/qmgrs/MQ01/ssl
runmqakm ‑keydb ‑db key.kdb ‑create ‑genpw ‑stash
The options used are:
- -keydb: specify keys database commands
- -db: key database to create
- -genpw: generate password for the key database
- -stash: generate stash file (file with encrypted password) for the key database
Create a self-signed certificate:
runmqakm ‑cert ‑create ‑db key.kdb ‑label ibmwebspheremqmq01 ‑dn “CN=MQ01,OU=Testing,O=MyOrg,L=Lisbon,C=PT”
‑size 2048 ‑default_cert ‑expire 10950 ‑stashed
Then, extract the public key of the certificate:
runmqakm ‑cert ‑extract ‑db key.kdb ‑label ibmwebspheremqmq01 ‑file ibmwebspheremqmq01.pem ‑stashed
Copy the file ibmwebspheremqmq01.pem to the other queue manager’s server.
Do the same for the other queue manager.
Then add the public key from the remote queue manager to the local queue manager’s keystore:
runmqakm ‑cert ‑add ‑db key.kdb ‑stashed ‑file ibmwebspheremqmq02.pem ‑label ibmwebspheremqmq02
Do the same for the other queue manager.
Next, configure sender and receiver channels.
For the sake of this example, I will define a sender and a receiver in each queue manager, name TO.MQ01 and TO.MQ02, which will enable communication between both queue managers in both ways. Remember that the receiver has to have the same name as the remote sender. Note that one-way communications requires only a sender channel in the local queue manager and a receiver channel in the remote queue manager.
runmqsc MQ01
DEFINE QLOCAL(MQ02) USAGE(XMITQ) TRIGGER TRIGDATA(TO.MQ02) TRIGTYPE(FIRST) INITQ(SYSTEM.CHANNEL.INITQ)
DEFINE CHANNEL(TO.MQ02) CHLTYPE(SDR) SSLCIPH(TLS_RSA_WITH_AES_256_GCM_SHA384) XMITQ(MQ02) CONNAME(‘ubuntuvm2(1414)’)
On the remote queue manager, create the corresponding receiver channel:
runmqsc MQ02
DEFINE CHANNEL(TO.MQ02) CHLTYPE(RCVR) SSLCIPH(TLS_RSA_WITH_AES_256_GCM_SHA384) SSLCAUTH(REQUIRED)
To turn on SSL on the channel, you only have to specify the cipher, using the SSLCIPH parameter. The SSLCAUTH parameter, when set, enables two-way client certificate authentication, that is, the sender’s certificate is used to encrypt communications and the receiver’s certificate is used to validate that the remote MQ is using a certificate know to the sender side.
If everything is correctly configured, you can now start the sender and display its status:
runmqsc MQ01
START CHANNEL(TO.MQ02)
DISPLAY CHSTATUS(TO.MQ02) ALL
4 : DISPLAY CHSTATUS(TO.MQ02) ALL
AMQ8417I: Display Channel Status details.
CHANNEL(TO.MQ02) CHLTYPE(SDR)
BATCHES(0) BATCHSZ(50)
BUFSRCVD(1) BUFSSENT(1)
BYTSRCVD(268) BYTSSENT(268)
CHSTADA(2019–12-05) CHSTATI(11.37.28)
COMPHDR(NONE,NONE) COMPMSG(NONE,NONE)
COMPRATE(0,0) COMPTIME(0,0)
CONNAME(192.168.133.21(1414)) CURLUWID(65C6D65D014F1F12)
CURMSGS(0) CURRENT
CURSEQNO(0) EXITTIME(0,0)
HBINT(300) INDOUBT(NO)
JOBNAME(0000161600000001) LOCLADDR(192.168.133.20(49270))
LONGRTS(999999999) LSTLUWID(0000000000000000)
LSTMSGDA( ) LSTMSGTI( )
LSTSEQNO(0) MCASTAT(RUNNING)
MONCHL(OFF) MSGS(0)
NETTIME(0,0) NPMSPEED(FAST)
RQMNAME(MQ02) SHORTRTS(8)
SECPROT(TLSV12)
SSLCERTI(CN=MQ02,OU=Testing,O=MyOrg,L=Lisbon,C=PT)
SSLCIPH(TLS_RSA_WITH_AES_256_GCM_SHA384)
SSLKEYDA( ) SSLKEYTI( )
SSLPEER(SERIALNUMBER=3C:D4:52:01:E8:A2:BE:E6,CN=MQ02,OU=Testing,O=MyOrg,L=Lisbon,C=PT)
SSLRKEYS(0) STATUS(RUNNING)
STOPREQ(NO) SUBSTATE(MQGET)
XBATCHSZ(0,0) XMITQ(MQ02)
XQTIME(0,0) RVERSION(09010300)
RPRODUCT(MQMM)