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.Este conteúdo não está disponível no idioma selecionado.
10.2. Configure and Run Active-MQ using Encrypted Passwords
Configure Password Encryption Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
ActiveMQ allows you to encrypt passwords and store them in configuration files. To encrypt the password, perform the following steps:
- Run encrypt command.
bin/activemq encrypt --password encrypt123 --input password1
$ bin/activemq encrypt --password encrypt123 --input password1 INFO: Using default configuration ... Encrypted text: jkS8uzTLGwAoBzxEadnG6j7vkY1GD4Zt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Wherepassword
is a secret used by the encryptor andinput
is the password you want to encrypt.NoteSpecial characters, such as $/^&, are not supported. Use only alphanumeric characters for passwords. - Add the password to the configuration file. By default, the credentials are added to the
$ACTIVEMQ_HOME/conf/credentials-enc.properties
.The contents of thecredentials-enc.properties
use theENC()
function to wrap encrypted passwords. - Instruct the property loader to encrypt variables while loading properties to the memory.NoteThe property loader used for encryption is
$ACTIVEMQ_HOME/examples/conf/activemq-security.xml
.The contents of theactivemq-security.xml
shows the configuration that ActiveMQ uses to load encrypted passwords. TheACTIVEMQ_ENCRYPTION_PASSWORD
environment variable is used to load the encryptor password. The property loads then de-crypts the password from thecredential-enc.properties
file.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the property to the
activemq-security.xml
as shown here:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Run Active-MQ using Encrypted Passwords Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
To run the Active-MQ broker with encrypted password configuration, follow the following steps:
- Set environment variable for encryption
export ACTIVEMQ_ENCRYPTION_PASSWORD=encrypt123
$ export ACTIVEMQ_ENCRYPTION_PASSWORD=encrypt123
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the AMQ broker
bin/activemq start xbean:examples/conf/activemq-security.xml
$ bin/activemq start xbean:examples/conf/activemq-security.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Reset the environment variable for encryption
unset ACTIVEMQ_ENCRYPTION_PASSWORD
$ unset ACTIVEMQ_ENCRYPTION_PASSWORD
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Resetting the environment is important to avoid saving passwords on your system.
Configuring the network connector Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Given two brokers, Broker A and Broker B, where Broker A is configured to perform authentication, you can configure Broker B to log on to Broker A by setting the
userName
attribute and the password
attribute in the networkConnector
element, as follows:
If Broker A is configured to connect to Broker B, Broker A's
networkConnector
element must also be configured with username/password credentials, even if Broker B is not configured to perform authentication. This is because Broker A's authentication plug-in checks for Broker A's username.