当 SASL 身份验证失败时,在邮件日志中记录用户名

Kla*_*kov 5 postfix saslauthd

我有一个带有 postfix 和cyrus-sasl. 当身份验证失败时,它会在maillog下面一行中报告。

postfix/smtpd[27669]: warning: unknown[185.xxx.xxx.xxx]: SASL LOGIN authentication failed: authentication failure
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点,以便它也能在日志文件中报告失败的用户名(如SASL LOGIN authentication failed: authentication failure for bob)?

Ing*_*r J 4

尝试在 smtpd.conf 中将日志记录级别设置为 log_level:4 (可能是 /usr/lib/sasl2/smtpd.conf )

*log_level controls the level of verbosity of messages sent to the syslogd service.
0 no messages
1 unusual errors
2 all authentication errors
3 log non-fatal warnings
4 more verbose than 3
5 more verbose than 4
6 traces of internal protocols
7 traces of internal protocols, including pass-words*
Run Code Online (Sandbox Code Playgroud)

在 /etc/postfix/master.cf 中,在类似的过程之后添加 -v

smtp      inet  n       -       n       -       -       smtpd -v
Run Code Online (Sandbox Code Playgroud)

您还可以通过在 master.cf 中设置以下内容来调试特定客户端 IP 地址

debug_peer_list = 192.168.0.1
Run Code Online (Sandbox Code Playgroud)