From a7afa08e7c860308f28de6e5f96cb87c94be84ca Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Wed, 12 Oct 2016 16:26:04 +0100 Subject: [PATCH] chasquid: Keep an AUTH event log This patch adds an AUTH event log, to help troubleshoot issues with authentication. --- chasquid.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chasquid.go b/chasquid.go index 13c4c7a..239f9bc 100644 --- a/chasquid.go +++ b/chasquid.go @@ -55,6 +55,11 @@ var ( tlsCount = expvar.NewMap("chasquid/smtpIn/tlsCount") ) +// Global event logs. +var ( + authLog = trace.NewEventLog("Authentication", "Incoming SMTP") +) + func main() { flag.Parse() @@ -1013,9 +1018,13 @@ func (c *Conn) AUTH(params string) (code int, msg string) { c.authUser = user c.authDomain = domain c.completedAuth = true + authLog.Debugf("%s successful for %s@%s", + c.netconn.RemoteAddr().String(), user, domain) return 235, "" } + authLog.Debugf("%s failed for %s@%s", + c.netconn.RemoteAddr().String(), user, domain) return 535, "Incorrect user or password" }