Postfix sendmail 设置原始收件人

Postfix sendmail 设置原始收件人

我有一个 postfix + dovecot,其中 spamassassin 在 postfix 端进行一些内容过滤。问题是,在最近的更新中,原来可用的 sendmail 二进制文件被替换为 sendmail.postfix 二进制文件。这似乎对收件人信息的处理方式不同。

以下是有关配置的一些信息:

主配置文件

<external ip>:submission         inet  n      -      -      -      -   smtpd
    -o content_filter=spamassassin
    -o cleanup_service_name=pre-cleanup
127.0.0.1:smtp                   inet  n      -      -      -      -   smtpd
[...]
spamassassin    unix        -       n       n       -       -       pipe
    flags=Rq user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

稍微匿名的日志输出显示了实际的问题:

Feb  7 02:47:04 comu postfix/smtpd[25393]: connect from unknown[<my ip>]
Feb  7 02:47:04 comu postfix/cleanup[25398]: C0A192C5816B: message-id=<[email protected]>
Feb  7 02:47:04 comu postfix/qmgr[25384]: C0A192C5816B: from=<postmaster@domain>, size=259, nrcpt=1 (queue active)
Feb  7 02:47:04 comu dovecot: lmtp(25400): Connect from local
Feb  7 02:47:04 comu dovecot: auth: mysql: Connected to 127.0.0.1 (postfix)
Feb  7 02:47:04 comu dovecot: lmtp(25400): Disconnect from local: Client quit
Feb  7 02:47:04 comu postfix/lmtp[25399]: C0A192C5816B: to=<postmaster@domain>, orig_to=<admin@domain>, relay=smtp.domain[private/dovecot-lmtp], delay=0.04, delays=0.01/0.01/0/0.02, dsn=2.1.5, status=deliverable (250 2.1.5 OK)
Feb  7 02:47:04 comu postfix/qmgr[25384]: C0A192C5816B: removed
Feb  7 02:47:07 comu postfix/smtpd[25393]: C6E932C5816B: client=unknown[<my ip>]
Feb  7 02:47:07 comu postfix/cleanup[25403]: C6E932C5816B: message-id=<[email protected]>
Feb  7 02:47:07 comu postfix/qmgr[25384]: C6E932C5816B: from=<[email protected]>, size=697, nrcpt=1 (queue active)
Feb  7 02:47:07 comu postfix/smtpd[25393]: disconnect from unknown[<my ip>]
Feb  7 02:47:08 comu postfix/pipe[25404]: C6E932C5816B: to=<admin@domain>, relay=spamassassin, delay=3.5, delays=3.2/0.02/0/0.34, dsn=2.0.0, status=sent (delivered via spamassassin service)
Feb  7 02:47:08 comu postfix/pickup[25383]: 3F49C2C58395: uid=505 from=<[email protected]>
Feb  7 02:47:08 comu postfix/qmgr[25384]: C6E932C5816B: removed
Feb  7 02:47:08 comu postfix/cleanup[25403]: 3F49C2C58395: message-id=<[email protected]>
Feb  7 02:47:08 comu postfix/qmgr[25384]: 3F49C2C58395: from=<[email protected]>, size=1340, nrcpt=1 (queue active)
Feb  7 02:47:08 comu dovecot: lmtp(25400): Connect from local
Feb  7 02:47:08 comu postfix/lmtp[25399]: 3F49C2C58395: to=<admin@domain>, relay=smtp.domain[private/dovecot-lmtp], delay=0.08, delays=0.06/0/0/0.01, dsn=5.1.1, status=bounced (host smtp.domain[private/dovecot-lmtp] said: 550 5.1.1 <admin@domain> User doesn't exist: admin@domain (in reply to RCPT TO command))
Feb  7 02:47:08 comu dovecot: lmtp(25400): Disconnect from local: Client quit
Feb  7 02:47:08 comu postfix/cleanup[25398]: 45B2F2C5816C: message-id=<[email protected]>
Feb  7 02:47:08 comu postfix/qmgr[25384]: 45B2F2C5816C: from=<>, size=3192, nrcpt=1 (queue active)
Feb  7 02:47:08 comu postfix/bounce[25408]: 3F49C2C58395: sender non-delivery notification: 45B2F2C5816C
Feb  7 02:47:08 comu postfix/qmgr[25384]: 3F49C2C58395: removed
Feb  7 02:47:08 comu postfix/smtp[25390]: 45B2F2C5816C: to=<[email protected]>, relay=none, delay=0.13, delays=0.01/0/0.12/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=silverline.local type=AAAA: Host not found)
Feb  7 02:47:08 comu postfix/qmgr[25384]: 45B2F2C5816C: removed

首次收到电子邮件时,原始收件人(postmaster@domain)将解析为实际收件人(admin@domain),并使用 dovecot 检查该用户是否存在。这很好,并返回成功。然后,电子邮件通过内容过滤器发送,该过滤器通过本地端口使用 postfix 重新排队电子邮件。但现在不是使用实际收件人,而是再次使用原始收件人,而这当然在 dovecot 数据库中找不到。

原始 sendmail 二进制文件可能来自 sendmail 项目,因此未发生此错误。我尝试在 master.cf 中使用管道的各种标志,但均未得到任何积极结果。非常感谢您的帮助。

答案1

我认为问题在于,cleanup在过滤器注入邮件后,正常守护进程不会运行。预清理通常不会进行地址重写和虚拟别名。

检查您是否有-o cleanup_service_name=pre-cleanup一个 SMTP 侦听器从内容过滤器(通常为 10026:)接收过滤的消息,如果是,请将其删除。

相关内容