Jack BeNimble
Jack BeNimble

Reputation: 36653

How to change the default admin password in ActiveMQ Artemis

I've checked the docs, but so far haven't found how to change the default admin password in ActiveMQ Artemis 2.27.1 created when using the artemis create command.

Here are the contents of the etc/login.config:

activemq {
   org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule required
       debug=false
       reload=true
       org.apache.activemq.jaas.properties.user="artemis-users.properties"
       org.apache.activemq.jaas.properties.role="artemis-roles.properties";
}; 

These are the contents of artemis-users.properties:

admin = ENC(1024:EE12ADBFA02C8DB4AF73E22F44C9BD2C12861A2CD01186CA07A874FAA824A757:BA04C1C3F55B0F68EFB2804BB001EAC2C5105EC1662DCBF96E158F9DA3E0C1BB9D8ECA2FF77BBD391938BCB1E69D865322981AB134BF81B1378AFBBE9C040350)

#admin = ENC(1024:389da8e6db1d6dc50b300ec99ea5604a)

I tried masking the the password as described here, (this is the commented admin), but got invalid credentials when I tried to login after restarting the server.

I generated it like this:

./artemis mask <plaintextPassword>

Upvotes: 0

Views: 4511

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 34998

By default credentials are stored in the etc/artemis-users.properties. Each line represents a user and its password in the format:

<user> = <password>

Passwords are hashed by default and stored using the ENC() syntax, but you can use plain text password if you want. Also, by default any changes to artemis-users.properties and artemis-roles.properties are reloaded automatically (since reload=true in login.config) so there's no need to restart the broker.

More details are available in the documentation for the PropertiesLoginModule.

If you want to update the file manually with a hashed password you need to use the following command in the bin directory:

$ ./artemis mask --hash <password>

This is documented in the "Masking Passwords" chapter.

Additionally, if you have at least one valid, working user account with the manage permission or if you have anonymous login enabled then you can use the user commands to list, add, remove, and reset users. As before, more details can be found in the documentation.

Upvotes: 2

Related Questions