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:25 UTC

[james-project] 02/23: JAMES-3942 Audit trail upon SMTP authentication success

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 2e361838a2fef80a795b07340c55c2210125186c
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Mon Sep 25 15:34:05 2023 +0700

    JAMES-3942 Audit trail upon SMTP authentication success
---
 .../apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java   | 9 +++++++++
 1 file changed, 9 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 b3f1915a32..b1b2a7e688 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
@@ -51,6 +51,7 @@ import org.apache.james.protocols.smtp.hook.HookResult;
 import org.apache.james.protocols.smtp.hook.HookResultHook;
 import org.apache.james.protocols.smtp.hook.HookReturnCode;
 import org.apache.james.protocols.smtp.hook.MailParametersHook;
+import org.apache.james.util.AuditTrail;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -387,6 +388,14 @@ public class AuthCmdHandler
                     } else if (SMTPRetCode.AUTH_OK.equals(res.getRetCode())) {
                         // TODO: Make this string a more useful debug message
                         AUTHENTICATION_DEDICATED_LOGGER.debug("AUTH method {} succeeded", authType);
+
+                        AuditTrail.entry()
+                            .username(username.asString())
+                            .remoteIP(session.getRemoteAddress().getAddress().getHostAddress())
+                            .protocol("SMTP")
+                            .action("AUTH")
+                            .parameters(ImmutableMap.of("authType", authType))
+                            .log("SMTP Authentication succeeded.");
                     }
                     return res;
                 }


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