Overview

Chapter 6. Securing ActiveMQ

ActiveMQ security is presented as a flexible, customizable model for protecting broker access and destinations in a way that can fit existing enterprise security practices. The chapter begins by clarifying the core distinction between authentication, which verifies identity, and authorization, which determines what an authenticated user or application is allowed to do. From there, it shows how the broker can be secured using plug-ins, with credentials, group membership, and destination permissions all driving access control.

The discussion first explores authentication through two built-in approaches: a simple plug-in that stores usernames, passwords, and groups directly in configuration, and a JAAS-based option that supports pluggable login modules and better integration with external security systems. It then moves into authorization, showing how ActiveMQ can restrict read, write, and admin operations on topics and queues using destination rules and wildcards. The chapter also extends this idea to message-level control by demonstrating a custom policy that decides whether a consumer may receive specific messages based on connection details such as the remote host.

Beyond the standard mechanisms, the chapter highlights the extensibility of ActiveMQ’s broker filter and plug-in architecture by building a custom security plug-in that allows connections only from approved IP addresses. It finishes by using SSL certificates for both authentication and authorization, mapping certificates to users and groups so that broker access and destination permissions can be enforced with stronger transport-level identity. Overall, the chapter emphasizes that ActiveMQ can support everything from straightforward password-based protection to tightly controlled, certificate-backed security policies.

Listing 6.1. Configuring the simple authentication plug-in
Listing 6.2. Configuring destination-level authorization
Listing 6.3. Implementation of MessageAuthorizationPolicy interface
Listing 6.4. IPAuthenticationBroker class—custom broker implementation
Listing 6.5. IPAuthenticationPlugin class—custom plug-in implementation
Listing 6.6. Configuring the custom plug-in

FAQ

What is the difference between authentication and authorization in ActiveMQ?Authentication verifies the identity of a user or entity requesting access, while authorization determines what that authenticated user is allowed to do, such as publish, consume, create, or delete destinations.
What security plug-ins does ActiveMQ provide out of the box for authentication?ActiveMQ provides a simple authentication plug-in and a JAAS authentication plug-in. The simple plug-in stores credentials in XML or properties files, while JAAS supports pluggable authentication through standard Java login modules.
How does the simple authentication plug-in work in ActiveMQ?The simple authentication plug-in lets you define usernames, passwords, and groups directly in the broker’s XML configuration. Clients must connect with valid credentials, and the group information can later be used for authorization.
Why might the simple authentication plug-in be considered less secure?Because passwords are stored and transferred as clear text. It can still be useful for basic protection, but it is better suited to simpler environments or combined with SSL transport to protect credentials in transit.
How is JAAS authentication configured in ActiveMQ?You create a JAAS login.config file that defines a login module, such as PropertiesLoginModule, and then enable the JAAS authentication plug-in in the broker XML using the JAAS domain name. ActiveMQ then uses the JAAS configuration to authenticate users.
What is destination-level authorization in ActiveMQ?Destination-level authorization controls access to JMS destinations based on user or group permissions. It can grant read, write, and admin rights for specific queues or topics, including wildcard-based destination patterns such as STOCKS.>.
How does ActiveMQ use groups in authorization?Users are assigned to groups, and authorization entries grant permissions to those groups. For example, admins may have full access, publishers may be allowed to write to stock topics, and guests may only be allowed to consume from specific topics.
What is message-level authorization in ActiveMQ?Message-level authorization checks whether a consumer can access a particular message, not just a destination. It uses a custom MessageAuthorizationPolicy implementation and can make decisions based on message data or connection information such as remote address.
How can you create a custom security plug-in in ActiveMQ?You can extend BrokerFilter to intercept broker operations and implement your own security logic. In the chapter’s example, a custom plug-in checks the client’s IP address and only allows connections from approved hosts.
How does certificate-based security work in ActiveMQ?Certificate-based security uses SSL certificates for authentication and authorization. The broker is configured with a truststore, client certificate authentication is required via SSL, and a JAAS certificate login module maps certificates to users and groups for access control.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • ActiveMQ in Action ActiveMQ in Action ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • ActiveMQ in Action ActiveMQ in Action ebook for free