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.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
8.7. Tutorial: Enable LDAP Authorization in the Broker
Overview 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
This section explains how to enable LDAP authorization in the broker, so that the broker obtains its authorization data from the directory server.
Compatibility with Apache Karaf principals 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
In order to avoid unnecessary duplication of user data, this LDAP authorization example reuses the user and role data already created for the Apache Karaf JAAS authentication plug-in (as described in Section 8.3, “Add User Entries to the Directory Server”). This affects the broker's LDAP authorization plug-in configuration, as follows:
- When you create authorization entries in the LDAP server (as described in Section 8.6, “Tutorial: Add Authorization Entries”), you must specify the full DN of the roles that are being authorized. This enables you to specify roles from any location in the LDAP tree (previously, the LDAP authorization plug-in could only read roles from a fixed location under the
ou=ActiveMQ,ou=system
node). - To enable the use of full DNs when specifying roles, you must set the
legacyGroupMapping
property tofalse
in the LDAP authorization plug-in (the default istrue
). - Because the Apache Karaf roles are of a different type from the roles natively supported by the LDAP authorization plug-in, you must also specify the type of the Karaf roles, by setting the
groupClass
property.
Enable LDAP authorization in the broker 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Perform the following steps to enable LDAP authorization:
- Shut down the JBoss A-MQ container, if it is currently running. In the console window, enter the following command:
JBossA-MQ:karaf@root> shutdown -f
JBossA-MQ:karaf@root> shutdown -f
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the LDAP authorization plug-in to the broker configuration. Open the broker configuration file,
InstallDir/etc/activemq.xml
, with a text editor and add theauthorizationPlugin
element, as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Ensure that the X.500 directory server is running. If necessary, manually restart the X.500 directory server—see Section 8.2, “Set-up a Directory Server and Browser”. If the server is not running, all broker connections will fail.
- Restart the JBoss A-MQ container. Open a new command prompt and start the broker by entering the following command:
amq
amq
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Install the Apache ActiveMQ kit 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
For testing purposes, it is useful to install the Apache ActiveMQ example producer and consumer clients. These example clients are not provided directly in the JBoss A-MQ package. But you can obtain the sample clients by installing the Apache ActiveMQ kit,
apache-activemq-5.8.0.redhat-60024-bin.zip
, provided in the extras/
directory of the JBoss A-MQ installation.
Install the Apache ActiveMQ kit as follows:
- Find the Apache ActiveMQ kit at the following location:
InstallDir/extras/apache-activemq-5.8.0.redhat-60024-bin.zip
InstallDir/extras/apache-activemq-5.8.0.redhat-60024-bin.zip
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Using a suitable archive utility on your platform, unzip the
apache-activemq-5.8.0.redhat-60024-bin.zip
file and extract it to a convenient location,ActiveMQInstallDir
.
Test the new configuration 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
To test the new configuration, run the example consumer and producer clients as follows:
- Run the consumer client with the
jdoe
user credentials. Open a new command prompt, change directory toActiveMQInstallDir/example
, and enter the following Ant command:ant consumer -Durl=tcp://localhost:61616 -Dmax=100 -Duser=jdoe -Dpassword=secret
ant consumer -Durl=tcp://localhost:61616 -Dmax=100 -Duser=jdoe -Dpassword=secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Run the producer client with the
jdoe
user credentials. Open a new command prompt, change directory toActiveMQInstallDir/example
, and enter the following Ant command:ant producer -Durl=tcp://localhost:61616 -Dmax=100 -Duser=jdoe -Dpassword=secret
ant producer -Durl=tcp://localhost:61616 -Dmax=100 -Duser=jdoe -Dpassword=secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Run a negative test, to demonstrate that unauthorized users are blocked from accessing the broker queues.Run the consumer client with the
janedoe
user credentials. Open a new command prompt, change directory toActiveMQInstallDir/example
, and enter the following Ant command:ant consumer -Durl=tcp://localhost:61616 -Dmax=100 -Duser=janedoe -Dpassword=secret
ant consumer -Durl=tcp://localhost:61616 -Dmax=100 -Duser=janedoe -Dpassword=secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This time, the consumer client fails, becausejanedoe
does not belong to theadmin
group.