问题:我正在尝试通过同一服务器通过域 email.domain1.us 和 email.domain2.net 来实现发送和接收电子邮件,并具有经过身份验证的用户并且也能够接收电子邮件。
我有 domain1.us 和 domain2.net,两者都托管在具有独立公共 IP 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 DNS 记录。
我正在运行 Ubuntu 16.04.5 LTS,我安装了 postfix 并成功设置 email.domain1.us 以根据我的虚拟哈希文件接收和分发电子邮件,并仅使用标准端口 465 上的 SSL 通过安全连接从经过身份验证的用户发送电子邮件. SPF、DMARC、DKIM 设置并记录所有良好和 PASS 身份验证(根据 GOOGLE 当我将测试发送到我的 GMAIL 帐户时)
我正在运行 Ubuntu 16.04.5 LTS
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/postfix-2/main.cf cp /etc/postfix/master.cf etc/postfix-2/master.cf
并编辑参数以使其独立并且存在多实例的必要行
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
然后对辅助 Postfix 实例的 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 的辅助 Postfix Instance 创建了虚拟哈希文件并启用了该实例
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
到目前为止,我自己查找论坛和问题,但这就是我卡住的地方,我已经广泛研究了如何测试辅助实例,但我找不到如何,当我看不到端口 10025 和 10465尝试netstat -ltn
,当然,当我尝试在smtper.net/之类的地方测试 mail.domain2.net 的 SMTP 时,我收到以下错误:
SMTP send error
Failure sending mail.
No connection could be made because the target machine actively refused it. [::ffff:104.168.34.235]:25
即使在所有这些更改和辅助 Postfix Image 设置之后,一切都适用于 email.domain1.us,但无法让它适用于 email.domain2.net。