Wietse Venema: > Marius Gologan: > > Can I add, in any way, the sender ip on the postfix/smtp log line? > > No. > > You can extract the SMTP client IP address from Postfix logging > with the same queue ID. This works best when you enable long queue > IDs that never repeat. > > # postconf -e "enable_long_queue_ids = yes" > # postfix reload > > You can also find the SMTP client IP address in the Received: message > header that was added by your Postfix SMTP server.
Another option: prepend a message header in the SMTP server, and log that message header in the SMTP client. /etc/postfix/main.cf: smtpd_client_restrictions = check_client_access pcre:/etc/postfix/prepend_client smtp_header_checks = pcre:/etc/postfix/smtp_header_checks /etc/postfix/prepend_client: /^([0-9.]+|[0-9a-f:]+)$/ prepend X-SMTP-Client-Addr: $1 /etc/postfix/smtp_header_checks: /^X-SMTP-Client-Addr: (\S+)/ warn client address $1 Instead of X-SMTP-Client-Addr use something that is unlikely to appear in other people's email. This requires Postfix 2.5 or later. Wietse