You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2023/10/06 02:06:26 UTC

[james-project] 03/23: JAMES-3942 Audit trail upon SMTP authentication failure

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

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit fe33da08c11218de2f7d3eb5b84367497a16f640
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Mon Sep 25 15:46:25 2023 +0700

    JAMES-3942 Audit trail upon SMTP authentication failure
---
 .../apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
index b1b2a7e688..237d32fac4 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
@@ -58,6 +58,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 
 
@@ -404,6 +405,15 @@ public class AuthCmdHandler
 
         res = AUTH_FAILED;
         AUTHENTICATION_DEDICATED_LOGGER.info("AUTH method {} failed from {}@{}", authType, username, session.getRemoteAddress().getAddress().getHostAddress());
+
+        AuditTrail.entry()
+            .username(username.asString())
+            .remoteIP(session.getRemoteAddress().getAddress().getHostAddress())
+            .protocol("SMTP")
+            .action("AUTH")
+            .parameters(ImmutableMap.of("authType", authType))
+            .log("SMTP Authentication failed.");
+
         return res;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org