activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [3/5] activemq-artemis git commit: ARTEMIS-1896 centralize authn failure logging
Date Mon, 04 Jun 2018 16:03:13 GMT
ARTEMIS-1896 centralize authn failure logging

Authentication failures are currently only logged for CORE clients.
This change puts the logging in a central location which all protocols
use for authentication so that authentication failures are logged for
all protocols.


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

Branch: refs/heads/master
Commit: ef6e3948fd416996059fdd83568388c2eb44ab53
Parents: a797985
Author: Justin Bertram <jbertram@apache.org>
Authored: Thu May 31 10:20:09 2018 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Jun 4 12:01:02 2018 -0400

----------------------------------------------------------------------
 .../core/protocol/core/impl/ActiveMQPacketHandler.java        | 1 -
 .../artemis/core/security/impl/SecurityStoreImpl.java         | 7 ++++++-
 .../activemq/artemis/core/server/ActiveMQServerLogger.java    | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ef6e3948/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java
index ebd1843..e12ca0c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java
@@ -175,7 +175,6 @@ public class ActiveMQPacketHandler implements ChannelHandler {
 
          response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
       } catch (ActiveMQClusterSecurityException | ActiveMQSecurityException e) {
-         ActiveMQServerLogger.LOGGER.securityProblemWhileCreatingSession(e.getMessage());
          response = new ActiveMQExceptionMessage(e);
       } catch (ActiveMQException e) {
          if (e.getType() == ActiveMQExceptionType.INCOMPATIBLE_CLIENT_SERVER_VERSIONS) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ef6e3948/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
index 4ef5d5f..3b94b13 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
@@ -30,6 +30,7 @@ import org.apache.activemq.artemis.core.security.Role;
 import org.apache.activemq.artemis.core.security.SecurityAuth;
 import org.apache.activemq.artemis.core.security.SecurityStore;
 import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
+import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.management.Notification;
 import org.apache.activemq.artemis.core.server.management.NotificationService;
 import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
@@ -149,7 +150,11 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC
                certSubjectDN = certs[0].getSubjectDN().getName();
             }
 
-            throw ActiveMQMessageBundle.BUNDLE.unableToValidateUser(connection.getRemoteAddress(),
user, certSubjectDN);
+            Exception e = ActiveMQMessageBundle.BUNDLE.unableToValidateUser(connection.getRemoteAddress(),
user, certSubjectDN);
+
+            ActiveMQServerLogger.LOGGER.securityProblemWhileAuthenticating(e.getMessage());
+
+            throw e;
          }
 
          return validatedUser;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ef6e3948/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index 1011196..50e89a2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -1361,8 +1361,8 @@ public interface ActiveMQServerLogger extends BasicLogger {
    void negativeGlobalAddressSize(long size);
 
    @LogMessage(level = Logger.Level.WARN)
-   @Message(id = 222216, value = "Security problem while creating session: {0}", format =
Message.Format.MESSAGE_FORMAT)
-   void securityProblemWhileCreatingSession(String message);
+   @Message(id = 222216, value = "Security problem while authenticating: {0}", format = Message.Format.MESSAGE_FORMAT)
+   void securityProblemWhileAuthenticating(String message);
 
    @LogMessage(level = Logger.Level.WARN)
    @Message(id = 222217, value = "Cannot find connector-ref {0}. The cluster-connection {1}
will not be deployed.", format = Message.Format.MESSAGE_FORMAT)


Mime
View raw message