问题原文
原帖链接 · Flup · CC BY-SA 4.0
At the moment, postfix logs inbound connections like this:
May 4 11:15:01 hostname postfix/smtpd[161025]: connect from unknown[192.0.2.1]
This isn't enough information for hosting providers to respond to abuse reports where they use CGNAT. They need the source port to identify the offending customer.
Is there any way to make postfix log the source port? Something like this would be ideal:
May 4 11:15:01 hostname postfix/smtpd[161025]: connect from unknown[192.0.2.1:12345]
已采纳解答
原帖链接 · anx · CC BY-SA 4.0
Yes, just set smtpd_client_port_logging to yes.
smtpd_client_port_logging (default: no)
Enable logging of the remote SMTP client port in addition to the hostname and IP address. The logging format is "host[address]:port".
This feature is available in Postfix 2.5 and later.
Note that the format does not quite match your example, it will place the port after the brackets: unknown[192.0.2.1]:12345
Beware of log aggregation and analysis tools that might need their regex patterns adjusted to correctly parse the changed format - notably utilities like fail2ban might no longer detect the relevant log lines.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
