This is an automated email from the ASF dual-hosted git repository.

jlmonteiro pushed a commit to branch fix/docker-entrypoint-groups-properties
in repository https://gitbox.apache.org/repos/asf/activemq.git

commit dccd0d4fefade3a21adf91f4e6899dd7f1305c04
Author: Jean-Louis Monteiro <[email protected]>
AuthorDate: Fri Mar 13 15:30:43 2026 +0100

    fix(#1776): honor ACTIVEMQ_WEB_USER variable
---
 assembly/src/docker/entrypoint.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/assembly/src/docker/entrypoint.sh 
b/assembly/src/docker/entrypoint.sh
index e7110e5c59..143abbee89 100755
--- a/assembly/src/docker/entrypoint.sh
+++ b/assembly/src/docker/entrypoint.sh
@@ -71,10 +71,18 @@ fi
 
 # WebConsole security
 if [ -n "${ACTIVEMQ_WEB_USER}" ]; then
-  echo "Enabling ActiveMQ WebConsole security"
-  sed -i s/admin=/${ACTIVEMQ_WEB_USER}=/g 
${ACTIVEMQ_HOME}/conf/users.properties
-  if [ -n "${ACTIVEMQ_WEB_PASSWORD}" ]; then
-    sed -i s/=admin/=${ACTIVEMQ_WEB_PASSWORD}/g 
${ACTIVEMQ_HOME}/conf/users.properties
+  if [ -f "${ACTIVEMQ_HOME}/conf/webconsole.security.enabled" ]; then
+    echo "ActiveMQ WebConsole Security already enabled"
+  else
+    echo "Enabling ActiveMQ WebConsole security"
+    sed -i "s/admin=/${ACTIVEMQ_WEB_USER}=/g" 
${ACTIVEMQ_HOME}/conf/users.properties
+    if [ -n "${ACTIVEMQ_WEB_PASSWORD}" ]; then
+      sed -i "s/=admin/=${ACTIVEMQ_WEB_PASSWORD}/g" 
${ACTIVEMQ_HOME}/conf/users.properties
+    fi
+    # Update groups.properties so the new user is a member of the admins group
+    # (required by jetty.xml adminSecurityConstraint which expects the 
'admins' role)
+    sed -i "s/admins=admin/admins=${ACTIVEMQ_WEB_USER}/" 
${ACTIVEMQ_HOME}/conf/groups.properties
+    touch "${ACTIVEMQ_HOME}/conf/webconsole.security.enabled"
   fi
 fi
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to