Postfix、canonical_classes 和 cron 邮件

Postfix、canonical_classes 和 cron 邮件

我在 Postfix 中遇到过一种情况,似乎我的配置被忽略了。我有一个家庭网络,其中的机器名为 hostname.fakedomain,还有一个 colo 邮件主机,其真实域名为 example.com。在我的家庭机器上,Postfix 配置为重写信封地址以使用真实域名 example.com,但保留原有的标头。我保留此设置是因为我希望将邮件递送到我的 colo 邮件服务器,但我喜欢保留标头,这样我就可以一目了然地看到我家庭网络上的哪台机器发送了哪封邮件。

相关细节:

  • Arch Linux
  • Postfix 2.7.2
  • 在/etc/postfix/规范:

    @hostname.fakedomain [email protected]

  • “postconf -n”(部分输出):

    别名数据库 = $别名地图
    alias_maps = hash:/etc/postfix/aliases
    canonical_classes = 信封发件人,信封收件人
    canonical_maps = 哈希:/etc/postfix/canonical
    我的目的地 =
    myhostname = 主机名.fakedomain
    中继域 =
    中继主机 = example.com

通常情况下,这很正常:我桌面上的本地邮件会发送到我邮件服务器上的邮局管理员帐户,但不会重写邮件头。但是,如果提供给 sendmail 二进制文件的邮件缺少 From: 邮件头,则邮件头会重写为。由于 canonical_classes 不包含“header_sender”,因此这似乎不应该发生。我以为 Postfix 会添加。此外,我知道这是由于规范映射,因为如果我将那里的地址更改为“From: root <[email protected]>From: [email protected][电子邮件保护]",标题也会改变。

一种可能的解决方法是通过 /bin/mail 管道传输每个 cron 条目的输出,但我更喜欢 Postfix 配置修复,以便它适用于任何缺少 From: 标题的邮件,而不仅仅是 cron 邮件。

这实际上是 Postfix 中的一个错误,还是我误解了 canonical_classes 在这种情况下应该如何工作?

答案1

可以检查这两个:remote_header_rewrite_domainlocal_header_rewrite_clients

后者默认为“permit_inet_interfaces”,在该其他参数的描述中,可能会给您答案?

always_add_missing_headers (default: no):
   Always add (Resent-) From:, To:, Date: or Message-ID: headers when not
   present.  Postfix 2.6 and later add these headers only when clients
   match the local_header_rewrite_clients parameter setting.  Earlier
   Postfix versions always add these headers; this may break DKIM
   signatures that cover non-existent headers.**

即使默认值为否,也可能是 local_header_rewrite_clients 参数不为空导致了这种情况。

不过,我可能还会添加以下内容(来自手册页):

The canonical(5) mapping is not to be confused with virtual alias
support or with local aliasing. To change the destination but not the
headers, use the virtual(5) or aliases(5) map instead.**

当你在做什么的时候应该工作,也许使用虚拟/别名会更好?

哦,刚刚还发现有sender_canonical_classes收件人典型类别参数。可能需要检查这些。

相关内容