...
Variable | Default | Description |
---|---|---|
x.y.z | 5.5.0 | Current stable ActiveMQ version |
ACTIVEMQ_HOME | /usr/local/apache-activemq-x.y.z | Installation directory |
INSTANCE_NAME | broker | Name of broker - should maybe correlate with host name? |
Installing ActiveMQ
- Download the latest stable ActiveMQ release (
apache-activemq-x.y.z.tar.gz
). - Move to the installation root
cd /usr/local
. - Unpack the release
tar xzvf /path/to/apache-activemq-x.y.z.tar.gz
- Create ActiveMQ user account
useradd activemq
- Set up key store in
/usr/local/apache-activemq-x.y.z/conf/broker.ks
- Create trust store and import trusted certificates into
/usr/local/apache-activemq-x.y.z/conf/broker.ts
- Edit the configuration files
vim /usr/local/apache-activemq-x.y.z/conf/{activemq,jetty}.xml
Set up key store in - Give the
activemq
user ownership of the installation directorychown -R activemq:activemq /usr/local/apache-activemq-x.y.z/conf/broker.ks
Create trust store and import trusted certificates in (or at least thedata
-directory which houses the log file) - Make sure the keystore is only readable by the activemq user (
chmod 600 /usr/local/apache-activemq-x.y.z/conf/broker.ts
Setup service scriptks
) - Setup service script
- Make sure the relevant ports are open in the firewall (8161 if the administration interface should be accessible, 61617 for SSL if this guide is followed and optionally 61616 for TCP)
Importing certificates into java trust store
Anchor | ||||
---|---|---|---|---|
|
If (re-)starting from scratch remove the trust store file beforehand as duplicate aliases are not allowed.
No Format |
---|
#!/bin/bash
TRUST_STORE=broker.ts
CERTIFICATES=*.crt # This could be a list instead e.g. "clientA.crt other_file.crt"
for cert in ${CERTIFICATES};
do
# imports each certificate under an alias that matches its file name
keytool -alias "${cert}" -importcert -noprompt -keystore "${TRUST_STORE}" -storepass 123456 -file "${cert}"
done
|
Configuring ActiveMQ
Anchor | ||||
---|---|---|---|---|
|
Allowing SSL access to the ActiveMQ broker is done by adding a suitable transport connector to the activemq.xml
configuration file (NOTE: elements must occur in alphabetical order):
Code Block | ||||
---|---|---|---|---|
| ||||
<transportConnectors>
<transportConnector uri="ssl://0.0.0.0:61617?wantClientAuth=true&needClientAuth=true"/>
</transportConnectors>
|
If connections are allowed only over SSL the tcp
transportConnector should be removed.
Specifying the location of the key and trust stores used by the server is done in the sslContext section of the same configuration file (again placed in alphabetical order, which will usually mean just before transportConnectors
):
Code Block | ||||
---|---|---|---|---|
| ||||
<sslContext>
<sslContext keyStore="file://${activemq.base}/conf/broker.ks"
keyStorePassword="123456"
trustStore="file://${activemq.base}/conf/broker.ts"
trustStorePassword="123456"/>
</sslContext>
|
To join multiple brokers into a network of brokers create suitable networkConnector
-elements in the configuration file:
Code Block | ||||
---|---|---|---|---|
| ||||
<networkConnectors>
<networkConnector name="other-broker-name" uri="static:(ssl://other-host-name:61617)"/>
</networkConnectors>
|
Service/Init Script
Anchor | ||||
---|---|---|---|---|
|
...