Chapter 6: Chapter 6. Securing ActiveMQ
This introduction explains authentication and authorization in ActiveMQ’s adaptable security model.
After this chapter you will be able to
- Authentication and system access. Explain what authentication checks and why successful authentication does not necessarily permit every operation on system resources.
- Authorization and access rights. Describe how authorization determines permitted actions on secured resources and how access control lists express those privileges.
- Security Plug-in Architecture. Explain how ActiveMQ implements security concepts and where plug-ins are configured.
- Authentication Plug-in Options. Distinguish the simple authentication plug-in from the JAAS authentication plug-in.
- Simple authentication configuration. Describe how the simple authentication plug-in defines users and their groups in the broker configuration.
- Publisher credential use. Trace how the stock publisher is changed to connect to a broker protected by the simple authentication plug-in.
- Cleartext security tradeoffs. Explain the security limitations of the simple authentication plug-in and the roles of SSL and the JAAS alternative.
- JAAS pluggable authentication. Explain how JAAS lets ActiveMQ use a consistent authentication API with different credential-verification techniques, and why this supports existing organizational security policies.
- Login module domain configuration. Describe how login.config identifies the properties-based login module and connects its domain configuration to the user and group files.
- User and group properties. Describe how the example represents user credentials and group membership in the two properties files.
- JAAS plug-in activation and test. Describe how the broker configuration selects the JAAS domain, how ActiveMQ locates login.config, and how the example verifies access.
- Authorization Beyond Authentication. Explain why authorization adds finer-grained control beyond authentication, using the stock-price publishing example.
- Destination Operation Permissions. Distinguish the read, write, and admin operations that can be authorized on a JMS destination.
- Authorization Entry Configuration. Explain how the example configures destination authorization using JAAS and a map of entries, including wildcard destinations and group values.
- Additive Authorization Example. Explain the example's additive authorization model and the resulting access for administrators, consumers, publishers, and guests.
- Message authorization policy decisions. Explain how a message authorization policy decides whether a consumer may read a message, using the local-host example.
- Policy installation and configuration. Describe how to install the example policy and configure the broker to instantiate it.
- BrokerFilter operation interception. Explain how BrokerFilter enables custom functionality for broker-level operations, with an example of an operation it can intercept.
- Custom security solution choices. Distinguish a JAAS login module from a custom security plug-in as options for requirements not met by built-in features.
- IP address connection filtering. Explain how IPAuthenticationBroker checks and handles a client's connection attempt.
- Plug-in installation and configuration. Describe the role of IPAuthenticationPlugin in installing and configuring the custom broker filter.
- Custom plug-in broker configuration. Describe where the IPAuthenticationPlugin is declared in ActiveMQ XML and which clients it permits to connect.
- IP Authentication Plug-in Test. Describe how to test the configured IP authentication plug-in and distinguish the expected results for localhost and other hosts.
- Existing Security Plug-in Credentials. Describe the roles of the earlier security plug-ins and contrast their credentials with the SSL certificates some organizations prefer.
- Producer and consumer certificates. Describe the two certificates prepared for the example and why their information should be noted.
- Broker truststore preparation. Describe how to prepare the broker truststore from the producer and consumer certificates and where to place it.
- Client certificate verification. Explain how the broker configuration uses a truststore to control which SSL clients may connect.
- Certificate-based destination authorization. Trace how a certificate is mapped to a user and group before destination access is authorized.
- Client Certificate Access. Explain how the test checks broker access with different client certificates.
- Consumer Authorization Test. Describe how the example tests authorization for consumers on stock-related topics.
What it builds on
- Secure Sockets Layer Protocol (SSL) (chapter 4) · SSL transport as a way to secure network connections.
- Use case one: the stock portfolio example (chapter 3) · The stock portfolio example supplies the publisher used to test broker access.
Section by section
Introduction
This introduction explains authentication and authorization in ActiveMQ’s adaptable security model.
- Authentication and system access: Explain what authentication checks and why successful authentication does not necessarily permit every operation on system resources.
Why it matters: Recognizing this distinction helps you avoid treating a successful login as permission to do everything. - Authorization and access rights: Describe how authorization determines permitted actions on secured resources and how access control lists express those privileges.
Why it matters: Authorization controls what an authenticated user can actually do with a secured resource.
Key terms: authentication, authorization, access control lists, ACLs
6.1 Authentication
This section introduces ActiveMQ’s plug-in-based security configuration and contrasts its two authentication plug-ins.
- Security Plug-in Architecture: Explain how ActiveMQ implements security concepts and where plug-ins are configured.
Why it matters: The plug-in architecture is the basis for configuring and customizing ActiveMQ security. - Authentication Plug-in Options: Distinguish the simple authentication plug-in from the JAAS authentication plug-in.
Why it matters: The two plug-ins offer different approaches to authenticating ActiveMQ users.
Key terms: plug-ins, <plugin> element, ActiveMQ XML configuration file, simple authentication plug-in, JAAS authentication plug-in, credentials, JAAS API
6.1.1 Configuring the simple authentication plug-in
This section explains how to configure and use ActiveMQ’s simple authentication plug-in and describes its security limitations.
- Simple authentication configuration: Describe how the simple authentication plug-in defines users and their groups in the broker configuration.
Why it matters: This configuration determines which credentials clients can use and supplies group information for authorization. - Publisher credential use: Trace how the stock publisher is changed to connect to a broker protected by the simple authentication plug-in.
Why it matters: Broker-side authentication also requires clients to provide credentials when they connect. - Cleartext security tradeoffs: Explain the security limitations of the simple authentication plug-in and the roles of SSL and the JAAS alternative.
Why it matters: Choosing authentication requires balancing basic client access control against password exposure and integration needs.
Key terms: simple authentication plug-in, username, password, groups, authorization, stock publisher, createConnection(), clear text, SSL transport, JAAS plug-in
6.1.2 Configuring the JAAS plug-in
This section introduces JAAS pluggable authentication and configures ActiveMQ’s properties-based login module to secure a broker.
- JAAS pluggable authentication: Explain how JAAS lets ActiveMQ use a consistent authentication API with different credential-verification techniques, and why this supports existing organizational security policies.
Why it matters: This explains why authentication can change without changing the API ActiveMQ uses. - Login module domain configuration: Describe how login.config identifies the properties-based login module and connects its domain configuration to the user and group files.
Why it matters: The domain configuration tells JAAS which module to use and where its account data lives. - User and group properties: Describe how the example represents user credentials and group membership in the two properties files.
Why it matters: The login module needs both credentials and group membership in the formats it expects. - JAAS plug-in activation and test: Describe how the broker configuration selects the JAAS domain, how ActiveMQ locates login.config, and how the example verifies access.
Why it matters: This connects the JAAS files to the broker and provides a practical way to check the setup.
Key terms: JAAS, pluggable authentication, LoginModule, simple authentication plug-in, login.config, activemq-domain, PropertiesLoginModule, required, org.apache.activemq.jaas.properties.user, org.apache.activemq.jaas.properties.group
6.2 Authorization
This section introduces authorization as finer-grained control over what authenticated ActiveMQ clients can do.
- Authorization Beyond Authentication: Explain why authorization adds finer-grained control beyond authentication, using the stock-price publishing example.
Why it matters: Authorization helps prevent a client from performing a task just because it can authenticate.
Key terms: authentication, authorization, destination, STOCKS.*
6.2.1 Destination-level authorization
This section explains how to configure and test operation-specific authorization for ActiveMQ destinations.
- Destination Operation Permissions: Distinguish the read, write, and admin operations that can be authorized on a JMS destination.
Why it matters: These operations let you grant different kinds of access to the same destination. - Authorization Entry Configuration: Explain how the example configures destination authorization using JAAS and a map of entries, including wildcard destinations and group values.
Why it matters: Authorization entries connect destination patterns and operations to the users or groups allowed to perform them. - Additive Authorization Example: Explain the example's additive authorization model and the resulting access for administrators, consumers, publishers, and guests.
Why it matters: The additive model shows how to grant narrowly scoped access beyond an administrator baseline. - Authorization Test Setup: Describe how the example supplies the JAAS configuration and client credentials, and what happens when a guest consumes from two stock topics.
Why it matters: The test demonstrates how broker-side authorization affects a client using guest credentials.
Key terms: read, write, admin, JMS destinations, JAAS authorization plug-in, authorization entries, topic, queue, wildcards, groups
6.2.2 Message-level authorization
This section implements, configures, and tests a message-level authorization policy that permits consumption only from the broker’s local host.
- Message authorization policy decisions: Explain how a message authorization policy decides whether a consumer may read a message, using the local-host example.
Why it matters: This policy lets the broker make consumption decisions for individual messages rather than only when a connection is created. - Policy installation and configuration: Describe how to install the example policy and configure the broker to instantiate it.
Why it matters: The broker must be able to load and instantiate the policy before it can enforce the rule. - Local and remote verification: Describe how the example verifies that the local-host policy works.
Why it matters: Comparing local and remote consumers demonstrates that the configured policy enforces the intended restriction. - Per-message performance cost: Explain why a message authorization policy should avoid slow operations.
Why it matters: Even a small per-message cost can affect the broker’s message flow.
Key terms: message-level authorization, MessageAuthorizationPolicy, isAllowedToConsume(), connection context, Connection.getRemoteAddress(), JAR, lib directory, Spring beans–style XML, AuthorizationPolicy, stock portfolio example
6.3 Building a custom security plug-in
This section introduces BrokerFilter-based extensions and options for meeting custom ActiveMQ security requirements.
- BrokerFilter operation interception: Explain how BrokerFilter enables custom functionality for broker-level operations, with an example of an operation it can intercept.
Why it matters: This is the extension point used to add behavior to broker operations. - Custom security solution choices: Distinguish a JAAS login module from a custom security plug-in as options for requirements not met by built-in features.
Why it matters: These choices help you decide how to extend security beyond the built-in features.
Key terms: BrokerFilter, broker-level operations, plug-in API, JAAS login module, custom security plug-in
6.3.1 Implementing the plug-in
This section implements an IP-based connection filter and a broker plug-in that configures and installs it.
- IP address connection filtering: Explain how IPAuthenticationBroker checks and handles a client's connection attempt.
Why it matters: This is the actual access check performed by the custom security plug-in. - Broker filter interceptor chain: Explain why the IPAuthenticationBroker constructor calls the BrokerFilter constructor.
Why it matters: The filter needs to participate correctly in the broker's interceptor chain. - Plug-in installation and configuration: Describe the role of IPAuthenticationPlugin in installing and configuring the custom broker filter.
Why it matters: The filter's logic must be installed and exposed for configuration before the broker can use it.
Key terms: IPAuthenticationBroker, BrokerFilter, addConnection(), regular expression, constructor, chain of interceptors, BrokerPlugin, IPAuthenticationPlugin, installPlugin(), getter
6.3.2 Configuring the plug-in
This section describes declaring the custom IP authentication plug-in in the broker’s XML configuration and its localhost-only connection restriction.
- Custom plug-in broker configuration: Describe where the IPAuthenticationPlugin is declared in ActiveMQ XML and which clients it permits to connect.
Why it matters: This configuration applies the custom connection restriction to the broker.
Key terms: IPAuthenticationPlugin, plugins element, broker, 127.0.0.1, localhost
6.3.3 Testing the plug-in
This section tests the custom IP authentication plug-in and highlights the flexibility of the BrokerFilter plug-in pattern.
- IP Authentication Plug-in Test: Describe how to test the configured IP authentication plug-in and distinguish the expected results for localhost and other hosts.
Why it matters: This test checks that the custom plug-in accepts and rejects connections as intended. - BrokerFilter Plug-in Flexibility: Explain what the security example illustrates about the flexibility of the BrokerFilter plug-in pattern.
Why it matters: The same extension pattern can be useful beyond this particular security example.
Key terms: IPAuthenticationPlugin, IPAuthentication-Broker, localhost, examples JAR, BrokerFilter, plug-in mechanism, custom security requirements
6.4 Certificate-based security
This section contrasts the credentials used by earlier ActiveMQ security plug-ins with organizations’ preference for SSL certificates and introduces a certificate-based example.
- Existing Security Plug-in Credentials: Describe the roles of the earlier security plug-ins and contrast their credentials with the SSL certificates some organizations prefer.
Why it matters: This distinction sets the context for certificate-based broker security.
Key terms: authentication, authorization, client credentials, SSL certificates
6.4.1 Preparing certificates
The section introduces the producer and consumer certificates used in the security example and notes how to handle their information and storage.
- Producer and consumer certificates: Describe the two certificates prepared for the example and why their information should be noted.
Why it matters: These certificates provide the identities whose information the example will use for broker access decisions. - Secure certificate storage: State the production precaution for storing certificates.
Why it matters: Where certificates are kept contributes to the security of the production system.
Key terms: producer, consumer, certificate, keystore, certificates, secure locations
6.4.2 Creating a truststore
This section describes preparing a broker truststore with the producer and consumer certificates and placing it where the broker configuration can reference it.
- Broker truststore preparation: Describe how to prepare the broker truststore from the producer and consumer certificates and where to place it.
Why it matters: The broker needs a truststore containing the client certificates in a location its configuration can reference.
Key terms: broker truststore, keystore, producer certificate, consumer certificate, JMS client certificates
6.4.3 Configuring the broker
This section explains how the broker configuration uses a truststore and certificate-based authentication plug-in to control client access.
- Client certificate verification: Explain how the broker configuration uses a truststore to control which SSL clients may connect.
Why it matters: These settings determine which certificate-bearing clients can connect to the broker. - Certificate plug-in resource access: Describe the stated role of jaasCertificateAuthenticationPlugin in the broker configuration.
Why it matters: Allowing a client to connect and authorizing access to broker resources are distinct roles in this configuration.
Key terms: trustStore, trustStorePassword, sslContext, needClientAuth, SSL transport URI, jaasCertificateAuthenticationPlugin, broker resources
6.4.4 Authorization explained
This section explains how certificate login configuration, user and group mappings, and the authorization plug-in govern access to broker destinations.
- Certificate login configuration: Describe how the certificate authentication plug-in is configured to use the certificate login module.
Why it matters: This configuration connects certificate-based security to the appropriate login module. - Certificate-based destination authorization: Trace how a certificate is mapped to a user and group before destination access is authorized.
Why it matters: This mapping connects a certificate identity to authorization for broker destinations.
Key terms: jaasCertificateAuthenticationPlugin, activemq-certificate, login.config, TextFileCertificateLoginModule, PropertiesLoginModule, user.properties, groups.properties, authorizationPlugin, sslconsumer, sslpublisher
6.4.5 Testing it out
Tests certificate-based broker access and authorization using publisher and consumer clients.
- Client Certificate Access: Explain how the test checks broker access with different client certificates.
Why it matters: This test shows whether the broker accepts the intended client certificate and rejects an untrusted one. - Consumer Authorization Test: Describe how the example tests authorization for consumers on stock-related topics.
Why it matters: A trusted client must still be restricted to the actions its authorization permits.
Key terms: certificate, broker’s truststore, publisher, authorization settings, consumers, stock-related topics
6.5 Summary
Where this is used later
- Configuring JMS destinations (chapter 7) · The concept of broker authentication for clients.
- Embedding ActiveMQ using the BrokerService (chapter 7) · The simple authentication plug-in configuration used as the example
- Extending functionality with interceptor plug-ins (chapter 11) · The simple authentication plug-in is an example of a broker plug-in.
- Internal broker event logging (chapter 14) · Configuring broker plug-ins
Concepts explained in this chapter
- message-level authorizationAuthorization that determines whether a consumer may access an individual message rather than granting access only when a broker connection is created.
- simple authentication plug-inAn ActiveMQ broker plug-in that authenticates clients using configured credentials.
- ActiveMQ JAAS pluginAn ActiveMQ broker plug-in that integrates JAAS login modules for authentication.
- authorizationAuthorization is the process of determining which actions an authenticated identity is permitted to perform.
- JAAS login moduleA JAAS login module is a component that implements authentication logic within the Java Authentication and Authorization Service framework.
- BrokerFilterBrokerFilter is an ActiveMQ class that intercepts broker operations and delegates them through a chain of broker filters.
- authenticationAuthentication is the process of verifying the identity of a user or system requesting access.
- securitySecurity is the protection of a system and its data against unauthorized access, alteration, or disruption.
- trust storeA truststore is a repository of certificates that an application trusts when establishing secure communications.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
