activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-1492 obfuscate passwords in acceptorControl
Date Fri, 03 Nov 2017 00:46:33 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 5a89fcd09 -> 520fe1c5b


ARTEMIS-1492 obfuscate passwords in acceptorControl


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

Branch: refs/heads/master
Commit: 096d98407fe2da985ae372cb157dcd0ec5bcc215
Parents: 5a89fcd
Author: Justin Bertram <jbertram@apache.org>
Authored: Wed Nov 1 11:54:01 2017 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Nov 2 20:46:26 2017 -0400

----------------------------------------------------------------------
 .../artemis/core/management/impl/AcceptorControlImpl.java   | 9 ++++++++-
 .../tests/integration/management/AcceptorControlTest.java   | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096d9840/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java
index ce511ef..57a6116 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.management.impl;
 
 import javax.management.MBeanAttributeInfo;
 import javax.management.MBeanOperationInfo;
+import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
@@ -73,7 +74,13 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont
    public Map<String, Object> getParameters() {
       clearIO();
       try {
-         return configuration.getParams();
+         Map<String, Object> clone = new HashMap(configuration.getParams());
+         for (Map.Entry<String, Object> entry : clone.entrySet()) {
+            if (entry.getKey().toLowerCase().contains("password")) {
+               entry.setValue("****");
+            }
+         }
+         return clone;
       } finally {
          blockOnIO();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096d9840/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
index dc1c4ea..c6ba3dc 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java
@@ -29,6 +29,7 @@ import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory;
+import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.management.Notification;
 import org.apache.activemq.artemis.tests.integration.SimpleNotificationService;
@@ -50,6 +51,7 @@ public class AcceptorControlTest extends ManagementTestBase {
    @Test
    public void testAttributes() throws Exception {
       TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(),
new HashMap<String, Object>(), RandomUtil.randomString());
+      acceptorConfig.getParams().put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "password");
 
       Configuration config = createBasicConfig().addAcceptorConfiguration(acceptorConfig);
       ActiveMQServer service = createServer(false, config);
@@ -60,6 +62,8 @@ public class AcceptorControlTest extends ManagementTestBase {
 
       Assert.assertEquals(acceptorConfig.getName(), acceptorControl.getName());
       Assert.assertEquals(acceptorConfig.getFactoryClassName(), acceptorControl.getFactoryClassName());
+      Assert.assertNotEquals(acceptorConfig.getParams().get(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME),
acceptorControl.getParameters().get(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME));
+      Assert.assertEquals("****", acceptorControl.getParameters().get(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME));
    }
 
    @Test


Mime
View raw message