Red Hat AMQ 6
As of February 2025, Red Hat is no longer supporting Red Hat AMQ 6. If you are using AMQ 6, please upgrade: Migrating to AMQ 7.4.5. Tutorial II: SSL/TLS Security
Overview Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
This tutorial shows you how to enable an SSL/TLS endpoint on the broker and how to configure the example JMS consumer and producer clients so that they can connect to the secure endpoint.
Tutorial steps Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To configure SSL/TLS security for a broker deployed in the OSGi container, perform the following steps:
Install sample keystore files Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The broker requires the following keystore files:
- Key store containing broker's own certificate and private key—used to identify the broker during an SSL handshake.
- Trust store containing CA certificate—used to verify that a received client certificate is correctly signed (strictly speaking, the trust store file is only needed by the broker, if the
transport.needClientAuth
options is set totrue
on the broker URI).
For this tutorial, you can use the demonstration certificates provided with the Apache ActiveMQ distribution, in
ActiveMQInstallDir
.
Copy the
broker.ks
and broker.ts
files from the Apache ActiveMQ distribution's conf
directory, ActiveMQInstallDir/conf
, to the InstallDir/etc
directory of JBoss A-MQ.
Warning
The demonstration broker key store and broker trust sture are provided for testing purposes only. Do not deploy these certificates in a production system. To set up a genuinely secure SSL/TLS system, you must generate custom certificates, as described in Appendix A, Managing Certificates.
Configure the broker Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Use your favorite text editor to edit the file,
InstallDir/etc/activemq.xml
, adding the highlighted XML fragments:
Note the following key aspects of the broker configuration:
- The Openwire network connector is configured to use SSL,
ssl://localhost:61617?...
. - The enabled protocols are specified explicitly, using the
transport.enabledProtocols
option. This setting effectively disables the SSLv3 protocol, which must not be used because of the POODLE security vulnerability. - The key store and trust store file locations and passwords are specified by the broker's
sslContext
element.
Warning
If you are planning to enable SSL/TLS security, you must ensure that you explicitly disable SSLv3 protocol, in order to safeguard against the Poodle vulnerability (CVE-2014-3566). For more details, see Disabling SSLv3 in JBoss Fuse 6.x and JBoss A-MQ 6.x.
Start the JBoss A-MQ container Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Change directory to
InstallDir/bin
and enter the following command:
./amq
./amq
Configure the consumer and the producer clients Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To test the broker configured in the OSGi container, you are going to use the example consumer tool and producer tool supplied with the Apache ActiveMQ installation.
Configure the consumer and the producer clients to pick up the client trust store. Edit the Ant build file,
ActiveMQInstallDir/example/build.xml
, and add the javax.net.ssl.trustStore
and javax.net.ssl.trustStorePassword
JSSE system properties to the consumer target and the producer target as shown in the following example:
In the context of the Ant build tool, this is equivalent to adding the system properties to the command line.
Run the consumer with the SSL protocol Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To connect the consumer tool to the
ssl://localhost:61617
endpoint (Openwire over SSL), change directory to ActiveMQInstallDir/example
and enter the following command:
ant consumer -Duser=admin -Dpassword=admin -Durl=ssl://localhost:61617 -Dmax=100
ant consumer -Duser=admin -Dpassword=admin -Durl=ssl://localhost:61617 -Dmax=100
You should see some output like the following:
Run the producer with the SSL protocol Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To connect the producer tool to the
ssl://localhost:61617
endpoint, open a new command prompt, change directory to example
and enter the following command:
ant producer -Duser=admin -Dpassword=admin -Durl=ssl://localhost:61617 -Dmax=100
ant producer -Duser=admin -Dpassword=admin -Durl=ssl://localhost:61617 -Dmax=100
In the window where the consumer tool is running, you should see some output like the following:
[java] [Thread-2] Received: 'Message: 0 sent at: Tue Mar 19 10:07:25 CET 2013 ...' (length 1000) [java] [Thread-2] Received: 'Message: 1 sent at: Tue Mar 19 10:07:25 CET 2013 ...' (length 1000) [java] [Thread-2] Received: 'Message: 2 sent at: Tue Mar 19 10:07:26 CET 2013 ...' (length 1000) [java] [Thread-2] Received: 'Message: 3 sent at: Tue Mar 19 10:07:26 CET 2013 ...' (length 1000) [java] [Thread-2] Received: 'Message: 4 sent at: Tue Mar 19 10:07:26 CET 2013 ...' (length 1000)
[java] [Thread-2] Received: 'Message: 0 sent at: Tue Mar 19 10:07:25 CET 2013 ...' (length 1000)
[java] [Thread-2] Received: 'Message: 1 sent at: Tue Mar 19 10:07:25 CET 2013 ...' (length 1000)
[java] [Thread-2] Received: 'Message: 2 sent at: Tue Mar 19 10:07:26 CET 2013 ...' (length 1000)
[java] [Thread-2] Received: 'Message: 3 sent at: Tue Mar 19 10:07:26 CET 2013 ...' (length 1000)
[java] [Thread-2] Received: 'Message: 4 sent at: Tue Mar 19 10:07:26 CET 2013 ...' (length 1000)