问题:我试图通过email.domain1.us和email.domain2.net通过同一个服务器与经过身份验证的用户一起发送和接收电子邮件,并且能够接收电子邮件。
我有domain1.us和domain2.net,它们都托管在同一服务器上,具有独立的Public 100.100.100.1和200.200.200.2、IP 100.100.100.1解析domain1.us和IP 200.200.200.2通过DNS记录解析domain2.net。对于电子邮件子域,除了先前声明的内容外,IP 100.100.100.1还通过A DNS记录解析email.domain1.us和IP 200.200.200.2 email.domain2.net,并具有MX记录。
我正在运行Ubuntu16.04.5LTS,我安装了postfix并成功地设置了email.domain1.us,以便根据我的虚拟哈希文件接收和分发电子邮件,并且仅通过标准端口465上的SSL通过安全连接发送电子邮件。SPF,DMARC,DKIM设置,并记录所有良好的和通过认证(根据谷歌时,我发送测试到我的GMAIL帐户)
我正在运行Ubuntu16.04.5LTS
netstat -ltn显示
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN
tcp 0 0 100.100.100.1:587 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:465 0.0.0.0:* LISTEN
tcp 0 0 100.100.100.1:465 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 100.100.100.1:25 0.0.0.0:* LISTEN然后,我使用postmulti,非常直接地设置了一个次要后缀实例:
postmulti -e init
postmulti -I postfix-2 -e create更改或确保以下内容位于我的主后缀main.cf文件上
nano /etc/postfix/main.cf
inet_interfaces = localhost, 100.100.100.1 # This was changed from inet_interfaces = all
myhostname = mail.domain1.us # just making sure to have different names on each
multi_instance_wrapper = ${command_directory}/postmulti -p -- # These were added
multi_instance_enable = yes # by the postmulti command init
multi_instance_directories = /etc/postfix-2 # This one was added by postmulti enable command然后,我备份了次要后缀实例的main.cf和master.cf,并复制了主后缀实例:
cp /etc/postfix/main.cf etc/后缀-2/main.cf cp /etc/postfix/master.cf .cp etc/后缀-2/master.cf.cp
并对参数进行编辑,使其具有独立性,并为多实例提供了必要的行。
nano etc/postfix-2/main.cf
inet_interfaces = localhost, 200.200.200.2 # This was changed from inet_interfaces = all
myhostname = mail.domain2.net # Just making sure to have different names on each
virtual_alias_maps = hash:/etc/postfix-2/virtual # Want to have different users/inboxes
inet_protocols = ipv4 # Some of these were added
master_service_disable = inet # by the enable and/or init commad
authorized_submit_users = # others were added by me after
queue_directory = /var/spool/postfix-2 # reading how to do it better
data_directory = /var/lib/postfix-2
multi_instance_name = postfix-2
multi_instance_enable = yes然后,对次要后缀实例的master.cf进行以下更改,以使端口分离
nano /etc/postfix-2/master.cf
# smtp inet n - y - - smtpd -o smtpd_sasl_auth_enable=yes # Commented this line out
10025 inet n - n - - smtpd -o smtpd_sasl_auth_enable=yes # Added this line
.
.
.
#smtps inet n - y - - smtpd # Commented this line out
10465 inet n - y - - smtpd # Added this line最后,为备用后缀实例创建虚拟散列文件,使用postmap并启用实例
postmulti -i postfix-2 -e enable重新启动后缀
service postfix restart和检查实例的状态。
postmulti -i postfix-2 -p status
postfix-2/postfix-script: the Postfix mail system is running: PID: 28004在我自己查找论坛和问题时,我已经做到了这一点,但这是我陷入困境的地方,我已经广泛地研究了如何测试次要实例,并且我无法找到如何测试的方法,当我尝试netstat -ltn时没有看到端口10025和10465,当然,当我尝试测试SMTP以获得mail.domain2.net (比如smtper.net/ )时,我得到了以下错误:
SMTP send error
Failure sending mail.
No connection could be made because the target machine actively refused it. [::ffff:104.168.34.235]:25对于email.domain1.us,即使经过所有这些更改和二级Postfix设置之后,所有东西都能很好地工作,但是无法使它在email.domain2.net中工作。
发布于 2021-03-12 00:36:38
在设置多个后缀实例时,我遇到了同样的问题。默认情况下,辅助实例已禁用TCP。要启用它,请编辑/etc/postfix-2/main.cf:
master_service_disable =
inet_interfaces = loopback-only显式地将master_service_disable设置为空以启用TCP。将inet_interfaces设置为您希望侦听的if (或者loopback-only (如果您愿意)。
发布于 2021-08-28 11:51:35
由于某些原因,systemctl restart postfix没有在我的机器上重新启动次要实例(在Proxmox6.4上的LXC容器中的Ubuntu20.04),因此它没有进行任何配置更改,包括在master.cf中设置新的侦听地址。
重新启动清除了此问题,随后的systemctl restart postfix操作将重新启动主实例和辅助实例。
https://serverfault.com/questions/1024807
复制相似问题