From 574e5c8c7bb2cb4b9a99b98b5c3c512d092365fe Mon Sep 17 00:00:00 2001 From: gtully Date: Fri, 22 Sep 2017 21:31:22 +0100 Subject: [PATCH] ARTEMIS-1435 - provide default jolokia-access.xml security policy in etc to lock down cors to http.host --- .../activemq/artemis/cli/commands/Create.java | 2 ++ .../cli/commands/bin/artemis-service.xml | 1 + .../artemis/cli/commands/etc/artemis.profile | 2 +- .../cli/commands/etc/artemis.profile.cmd | 2 +- .../cli/commands/etc/jolokia-access.xml | 33 +++++++++++++++++++ .../cli/test/StreamClassPathTest.java | 1 + docs/user-manual/en/management-console.md | 6 ++++ 7 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/jolokia-access.xml diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index aabb3fefcd..bd0b4cd2e2 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -104,6 +104,7 @@ public class Create extends InputAbstract { public static final String ETC_GLOBAL_MAX_SPECIFIED_TXT = "etc/global-max-specified.txt"; public static final String ETC_GLOBAL_MAX_DEFAULT_TXT = "etc/global-max-default.txt"; + public static final String ETC_JOLOKIA_ACCESS_XML = "etc/jolokia-access.xml"; @Arguments(description = "The instance directory to hold the broker's configuration and data. Path must be writable.", required = true) private File directory; @@ -687,6 +688,7 @@ public class Create extends InputAbstract { // we want this variable to remain unchanged so that it will use the value set in the profile filters.remove("${artemis.instance}"); write(ETC_BOOTSTRAP_XML, filters, false); + write(ETC_JOLOKIA_ACCESS_XML, filters, false); context.out.println(""); context.out.println("You can now start the broker by executing: "); diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml index aab7f6c291..cb983641cb 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml @@ -62,6 +62,7 @@ -Dhawtio.offline="true" -Dhawtio.role=${role} -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal + -Djolokia.policyLocation=%ARTEMIS_INSTANCE_URI%/etc/jolokia-access.xml + + + + + + + *://${http.host}* + + + + + + \ No newline at end of file diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java index c7fe76bba6..c802fb2503 100644 --- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java +++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java @@ -58,6 +58,7 @@ public class StreamClassPathTest { openStream(Create.ETC_COMMENTED_PING_TXT); openStream(Create.ETC_GLOBAL_MAX_SPECIFIED_TXT); openStream(Create.ETC_GLOBAL_MAX_DEFAULT_TXT); + openStream(Create.ETC_JOLOKIA_ACCESS_XML); } diff --git a/docs/user-manual/en/management-console.md b/docs/user-manual/en/management-console.md index d7956c80a6..80d22bbe4d 100644 --- a/docs/user-manual/en/management-console.md +++ b/docs/user-manual/en/management-console.md @@ -13,6 +13,12 @@ A login screen will be presented, if your broker is secure, you will need to use ![ActiveMQ Artemis Console Login](images/console-login.png) +## Security + +That Jolokia JMX-HTTP bridge is secured via a policy file in the broker configuration directory: 'etc/jolokia-access.xml'. +The contents of that file should be modified as described in the [Jolokia Security Guide](https://jolokia.org/reference/html/security.html). +By default the console is locked down +to 'localhost', pay particular attention to the 'CORS' restrictions when exposing the console web endpoint over the network. ## Console