You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2017/10/17 09:03:05 UTC

[1/2] activemq-artemis git commit: This closes #1591

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 93a99cc09 -> b7322b56d


This closes #1591


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b7322b56
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b7322b56
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b7322b56

Branch: refs/heads/master
Commit: b7322b56d35651c6e8d0388bc8ccabf009c48f81
Parents: 93a99cc 12ad012
Author: Martyn Taylor <mt...@redhat.com>
Authored: Tue Oct 17 10:02:46 2017 +0100
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Tue Oct 17 10:02:46 2017 +0100

----------------------------------------------------------------------
 .../server/management/ManagementConnector.java  |  3 --
 examples/features/standard/jmx/pom.xml          |  3 --
 .../artemis/jms/example/JMXExample.java         |  2 +-
 .../resources/activemq/server0/management.xml   | 20 ++++----
 .../features/standard/message-counters/pom.xml  |  2 -
 .../jms/example/MessageCounterExample.java      |  7 ++-
 .../resources/activemq/server0/management.xml   | 49 ++++++++++++++++++++
 7 files changed, 65 insertions(+), 21 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: ARTEMIS-1463 - add role based authentication to the JMX objects

Posted by ma...@apache.org.
ARTEMIS-1463 - add role based authentication to the JMX objects

some example fixes

https://issues.apache.org/jira/browse/ARTEMIS-1463


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/12ad0120
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/12ad0120
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/12ad0120

Branch: refs/heads/master
Commit: 12ad0120ad3c059b00f89d386f02ee0e262d10dc
Parents: 93a99cc
Author: Andy Taylor <an...@gmail.com>
Authored: Tue Oct 17 09:42:05 2017 +0100
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Tue Oct 17 10:02:46 2017 +0100

----------------------------------------------------------------------
 .../server/management/ManagementConnector.java  |  3 --
 examples/features/standard/jmx/pom.xml          |  3 --
 .../artemis/jms/example/JMXExample.java         |  2 +-
 .../resources/activemq/server0/management.xml   | 20 ++++----
 .../features/standard/message-counters/pom.xml  |  2 -
 .../jms/example/MessageCounterExample.java      |  7 ++-
 .../resources/activemq/server0/management.xml   | 49 ++++++++++++++++++++
 7 files changed, 65 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ad0120/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java
index d867bd8..36113c6 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java
@@ -44,9 +44,6 @@ public class ManagementConnector implements ActiveMQComponent {
 
    @Override
    public void start() throws Exception {
-      ArtemisMBeanServerGuard guard = new ArtemisMBeanServerGuard();
-      guard.init();
-
       rmiRegistryFactory = new RmiRegistryFactory();
       rmiRegistryFactory.setPort(configuration.getConnectorPort());
       rmiRegistryFactory.init();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ad0120/examples/features/standard/jmx/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/jmx/pom.xml b/examples/features/standard/jmx/pom.xml
index dae00fd..f78c1f3 100644
--- a/examples/features/standard/jmx/pom.xml
+++ b/examples/features/standard/jmx/pom.xml
@@ -61,9 +61,6 @@ under the License.
                   </goals>
                   <configuration>
                      <ignore>${noServer}</ignore>
-                     <!-- options used for JMX on the example -->
-                     <javaOptions>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
-                     </javaOptions>
                   </configuration>
                </execution>
                <execution>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ad0120/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java b/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
index e8beee9..b59f419 100644
--- a/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
+++ b/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
@@ -80,7 +80,7 @@ public class JMXExample {
 
          // Step 10. Create JMX Connector to connect to the server's MBeanServer
          HashMap env = new HashMap();
-         String[] creds = {"admin", "password"};
+         String[] creds = {"guest", "guest"};
          env.put(JMXConnector.CREDENTIALS, creds);
 
          JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMXExample.JMX_URL), env);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ad0120/examples/features/standard/jmx/src/main/resources/activemq/server0/management.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/jmx/src/main/resources/activemq/server0/management.xml b/examples/features/standard/jmx/src/main/resources/activemq/server0/management.xml
index cbcd3d8..182bb1f 100644
--- a/examples/features/standard/jmx/src/main/resources/activemq/server0/management.xml
+++ b/examples/features/standard/jmx/src/main/resources/activemq/server0/management.xml
@@ -22,19 +22,19 @@
          <entry domain="hawtio"/>
       </whitelist>
       <default-access>
-         <access method="list*" roles="view,update,amq"/>
-         <access method="get*" roles="view,update,amq"/>
-         <access method="is*" roles="view,update,amq"/>
-         <access method="set*" roles="update,amq"/>
-         <access method="*" roles="amq"/>
+         <access method="list*" roles="view,update,amq,guest"/>
+         <access method="get*" roles="view,update,amq,guest"/>
+         <access method="is*" roles="view,update,amq,guest"/>
+         <access method="set*" roles="update,amq,guest"/>
+         <access method="*" roles="amq,guest"/>
       </default-access>
       <role-access>
          <match domain="org.apache.activemq.apache">
-            <access method="list*" roles="view,update,amq"/>
-            <access method="get*" roles="view,update,amq"/>
-            <access method="is*" roles="view,update,amq"/>
-            <access method="set*" roles="update,amq"/>
-            <access method="*" roles="amq"/>
+            <access method="list*" roles="view,update,amq,guest"/>
+            <access method="get*" roles="view,update,amq,guest"/>
+            <access method="is*" roles="view,update,amq,guest"/>
+            <access method="set*" roles="update,amq,guest"/>
+            <access method="*" roles="amq,guest"/>
          </match>
          <!--example of how to configure a specific object-->
          <!--<match domain="org.apache.activemq.apache" key="subcomponent=queues">

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ad0120/examples/features/standard/message-counters/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/message-counters/pom.xml b/examples/features/standard/message-counters/pom.xml
index b6d0559..8f745a3 100644
--- a/examples/features/standard/message-counters/pom.xml
+++ b/examples/features/standard/message-counters/pom.xml
@@ -61,8 +61,6 @@ under the License.
                   </goals>
                   <configuration>
                      <ignore>${noServer}</ignore>
-                     <javaOptions>-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
-                     </javaOptions>
                   </configuration>
                </execution>
                <execution>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ad0120/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java b/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
index f3b2dbe..16947d1 100644
--- a/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
+++ b/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
@@ -44,7 +44,7 @@ import org.apache.activemq.artemis.api.core.management.QueueControl;
  */
 public class MessageCounterExample {
 
-   private static final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:3001/jmxrmi";
+   private static final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi";
 
    public static void main(final String[] args) throws Exception {
       QueueConnection connection = null;
@@ -75,7 +75,10 @@ public class MessageCounterExample {
 
          // Step 7. Use JMX to retrieve the message counters using the JMSQueueControl
          ObjectName on = ObjectNameBuilder.DEFAULT.getQueueObjectName(SimpleString.toSimpleString(queue.getQueueName()), SimpleString.toSimpleString(queue.getQueueName()), RoutingType.ANYCAST);
-         JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, Object>());
+         HashMap env = new HashMap();
+         String[] creds = {"guest", "guest"};
+         env.put(JMXConnector.CREDENTIALS, creds);
+         JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), env);
          MBeanServerConnection mbsc = connector.getMBeanServerConnection();
          QueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, on, QueueControl.class, false);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/12ad0120/examples/features/standard/message-counters/src/main/resources/activemq/server0/management.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/message-counters/src/main/resources/activemq/server0/management.xml b/examples/features/standard/message-counters/src/main/resources/activemq/server0/management.xml
new file mode 100644
index 0000000..0eca170
--- /dev/null
+++ b/examples/features/standard/message-counters/src/main/resources/activemq/server0/management.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements. See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License. You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<management-context xmlns="http://activemq.org/schema">
+   <connector connector-port="1099" connector-host="127.0.0.1"/>
+   <authorisation>
+      <whitelist>
+         <entry domain="hawtio"/>
+      </whitelist>
+      <default-access>
+         <access method="list*" roles="view,update,amq,guest"/>
+         <access method="get*" roles="view,update,amq,guest"/>
+         <access method="is*" roles="view,update,amq,guest"/>
+         <access method="set*" roles="update,amq,guest"/>
+         <access method="*" roles="amq, guest"/>
+      </default-access>
+      <role-access>
+         <match domain="org.apache.activemq.apache">
+            <access method="list*" roles="view,update,amq,guest"/>
+            <access method="get*" roles="view,update,amq,guest"/>
+            <access method="is*" roles="view,update,amq,guest"/>
+            <access method="set*" roles="update,amq,guest"/>
+            <access method="*" roles="amq,guest"/>
+         </match>
+         <!--example of how to configure a specific object-->
+         <!--<match domain="org.apache.activemq.apache" key="subcomponent=queues">
+            <access method="list*" roles="view,update,amq"/>
+            <access method="get*" roles="view,update,amq"/>
+            <access method="is*" roles="view,update,amq"/>
+            <access method="set*" roles="update,amq"/>
+            <access method="*" roles="amq"/>
+         </match>-->
+      </role-access>
+   </authorisation>
+</management-context>
\ No newline at end of file