为什么 postfix 会使用错误的 IP 地址发送邮件?

为什么 postfix 会使用错误的 IP 地址发送邮件?

我的虚拟服务器上有一个多域设置:

master.cf:

127.0.0.1:smtp inet  n     -       n       -       -       smtpd
      -o syslog_name=postfix-localhost
      -o smtp_helo_name=localhost
      -o smtp_bind_address=127.0.0.1
      -o myhostname=localhost
      -o smtpd_client_connection_count_limit=100
      -o smtpd_tls_key_file=/etc/letsencrypt/live/the-grue.de-0001/privkey.pem
      -o smtpd_tls_cert_file=/etc/letsencrypt/live/the-grue.de-0001/fullchain.pem

95.129.55.226:smtp inet  n     -       n       -       -       smtpd
      -o syslog_name=postfix-mail.the-grue.de
      -o smtp_helo_name=mail.the-grue.de
      -o smtp_bind_address=95.129.55.226
      -o myhostname=mail.the-grue.de
      -o smtpd_client_connection_count_limit=100
      -o smtpd_tls_key_file=/etc/letsencrypt/live/the-grue.de-0001/privkey.pem
      -o smtpd_tls_cert_file=/etc/letsencrypt/live/the-grue.de-0001/fullchain.pem

95.129.55.232:smtp inet  n     -       n       -       -       smtpd
      -o syslog_name=postfix-mail.maennerchor-kirchseeon.de
      -o smtp_helo_name=mail.maennerchor-kirchseeon.de
      -o smtp_bind_address=95.129.55.232
      -o myhostname=mail.maennerchor-kirchseeon.de
      -o smtpd_client_connection_count_limit=100
      -o smtpd_tls_key_file=/etc/letsencrypt/live/maennerchor-kirchseeon.de-0001/privkey.pem
      -o smtpd_tls_cert_file=/etc/letsencrypt/live/maennerchor-kirchseeon.de-0001/fullchain.pem

95.129.55.223:smtp inet  n     -       n       -       -       smtpd
      -o syslog_name=postfix-mail.goldschmiede-grunwald.de
      -o smtp_helo_name=mail.goldschmiede-grunwald.de
      -o smtp_bind_address=95.129.55.223
      -o myhostname=mail.goldschmiede-grunwald.de
      -o smtpd_client_connection_count_limit=100
      -o smtpd_tls_key_file=/etc/letsencrypt/live/goldschmiede-grunwald.de/privkey.pem
      -o smtpd_tls_cert_file=/etc/letsencrypt/live/goldschmiede-grunwald.de/fullchain.pem

the-grue-out  unix -       -       n       -       -       smtp
   -o smtp_bind_address=95.129.55.226
   -o smtp_helo_name=mail.the-grue.de
   -o syslog_name=postfix-mail.the-grue.de

maennerchor-kirchseeon-out  unix -       -       n       -       -       smtp
   -o smtp_bind_address=95.129.55.232
   -o smtp_helo_name=mail.maennerchor-kirchseeon.de
   -o syslog_name=postfix-mail.maennerchor-kirchseeon.de

goldschmiede-grunwald-out  unix -       -       n       -       -       smtp
   -o smtp_bind_address=95.129.55.223
   -o smtp_helo_name=mail.goldschmiede-grunwald.de
   -o syslog_name=postfix-mail.goldschmiede-grunwald.de

总体来说,这种方法效果很好。但我定义了一些虚拟别名:

虚拟别名:

[email protected]               [email protected], [email protected]

如果有人向 发送电子邮件[email protected],有时它来自 95.129.55.232,但有时它来自 95.129.55.226。在后一种情况下,它当然被视为垃圾邮件。

编辑:我在 main.cf 中有这个:

sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport

这就是的内容/etc/postfix/sender_transport

# Use source IP - 95.129.55.226
@the-grue.de                the-grue-out:

# Use source IP -  95.129.55.232
@maennerchor-kirchseeon.de  maennerchor-kirchseeon-out:

# Use source IP -  95.129.55.223
@goldschmiede-grunwald.de goldschmiede-grunwald-out:

postmap /etc/postfix/sender_transport编辑完之后就跑了。

我配置错了什么?我发现了很多类似的问题,考虑域名或单域设置,但对于我的用例,我没有发现任何东西。

相关内容