mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
chasquid: Keep an AUTH event log
This patch adds an AUTH event log, to help troubleshoot issues with authentication.
This commit is contained in:
@@ -55,6 +55,11 @@ var (
|
|||||||
tlsCount = expvar.NewMap("chasquid/smtpIn/tlsCount")
|
tlsCount = expvar.NewMap("chasquid/smtpIn/tlsCount")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Global event logs.
|
||||||
|
var (
|
||||||
|
authLog = trace.NewEventLog("Authentication", "Incoming SMTP")
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@@ -1013,9 +1018,13 @@ func (c *Conn) AUTH(params string) (code int, msg string) {
|
|||||||
c.authUser = user
|
c.authUser = user
|
||||||
c.authDomain = domain
|
c.authDomain = domain
|
||||||
c.completedAuth = true
|
c.completedAuth = true
|
||||||
|
authLog.Debugf("%s successful for %s@%s",
|
||||||
|
c.netconn.RemoteAddr().String(), user, domain)
|
||||||
return 235, ""
|
return 235, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
authLog.Debugf("%s failed for %s@%s",
|
||||||
|
c.netconn.RemoteAddr().String(), user, domain)
|
||||||
return 535, "Incorrect user or password"
|
return 535, "Incorrect user or password"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user