我使用 postfix 2.7.1 和 dovecot 1.2.15 设置了我的邮件服务器,一切似乎都运行正常,但现在我发现使用 @gmx.net 地址的人无法向我发送电子邮件,而是收到错误消息
Connected to <MYIPADDRESS> but sender was rejected.
Remote host said: 530 5.7.0 Must issue a STARTTLS command first
/var/log/mail.log显示:
postfix/smtpd[22743]: connected to mailout-de.gmx.net[213.165.64.23]
postfix/smtpd[22743]: disconnect from mailout-de.gmx.net[213.165.64.23]
更详细的日志告诉我:
postfix/smtpd[22743]: match_hostname: mailout-de.gmx.net ~? 127.0.0.0/8
postfix/smtpd[22743]: match_hostaddr: 213.165.64.23 ~? 127.0.0.0/8
postfix/smtpd[22743]: match_hostname: mailout-de.gmx.net ~? [::ffff:127.0.0.0]/104
postfix/smtpd[22743]: match_hostaddr: 213.165.64.23 ~? [::ffff:127.0.0.0]/104
postfix/smtpd[22743]: match_hostname: mailout-de.gmx.net ~? [::1]/128
postfix/smtpd[22743]: match_hostaddr: 213.165.64.23 ~? [::1]/128
postfix/smtpd[22743]: match_list_match: mailout-de.gmx.net: no match
postfix/smtpd[22743]: match_list_match: 213.165.64.23: no match
postfix/smtpd[22743]: auto_clnt_open: connected to private/anvil
postfix/smtpd[22743]: send attr request = connect
postfix/smtpd[22743]: send attr ident = smtp:213.165.64.23
postfix/smtpd[22743]: private/anvil: wanted attribute: status
postfix/smtpd[22743]: input attribute name: status
postfix/smtpd[22743]: input attribute value: 0
postfix/smtpd[22743]: private/anvil: wanted attribute: count
postfix/smtpd[22743]: input attribute name: count
postfix/smtpd[22743]: input attribute value: 1
postfix/smtpd[22743]: private/anvil: wanted attribute: rate
postfix/smtpd[22743]: input attribute name: rate
postfix/smtpd[22743]: input attribute value: 1
postfix/smtpd[22743]: private/anvil: wanted attribute: (list terminator)
postfix/smtpd[22743]: input attribute name: (end)
postfix/smtpd[22743]: > mailout-de.gmx.net[213.165.64.23]: 220 <MYDOMAIN> ESMTP Postfix (Debian/GNU)
postfix/smtpd[22743]: watchdog_pat: 0x7f1549946d00
postfix/smtpd[22743]: < mailout-de.gmx.net[213.165.64.23]: HELO mailout-de.gmx.net
postfix/smtpd[22743]: > mailout-de.gmx.net[213.165.64.23]: 250 <MYDOMAIN>
postfix/smtpd[22743]: watchdog_pat: 0x7f1549946d00
postfix/smtpd[22743]: < mailout-de.gmx.net[213.165.64.23]: MAIL FROM:<[email protected]>
postfix/smtpd[22743]: > mailout-de.gmx.net[213.165.64.23]: 530 5.7.0 Must issue a STARTTLS command first
postfix/smtpd[22743]: watchdog_pat: 0x7f1549946d00
postfix/smtpd[22743]: < mailout-de.gmx.net[213.165.64.23]: QUIT
postfix/smtpd[22743]: > mailout-de.gmx.net[213.165.64.23]: 221 2.0.0 Bye
postfix/smtpd[22743]: match_hostname: mailout-de.gmx.net ~? 127.0.0.0/8
postfix/smtpd[22743]: match_hostaddr: 213.165.64.23 ~? 127.0.0.0/8
postfix/smtpd[22743]: match_hostname: mailout-de.gmx.net ~? [::ffff:127.0.0.0]/104
postfix/smtpd[22743]: match_hostaddr: 213.165.64.23 ~? [::ffff:127.0.0.0]/104
postfix/smtpd[22743]: match_hostname: mailout-de.gmx.net ~? [::1]/128
postfix/smtpd[22743]: match_hostaddr: 213.165.64.23 ~? [::1]/128
postfix/smtpd[22743]: match_list_match: mailout-de.gmx.net: no match
postfix/smtpd[22743]: match_list_match: 213.165.64.23: no match
postfix/smtpd[22743]: send attr request = disconnect
postfix/smtpd[22743]: send attr ident = smtp:213.165.64.23
postfix/smtpd[22743]: private/anvil: wanted attribute: status
postfix/smtpd[22743]: input attribute name: status
postfix/smtpd[22743]: input attribute value: 0
postfix/smtpd[22743]: private/anvil: wanted attribute: (list terminator)
postfix/smtpd[22743]: input attribute name: (end)
postfix/smtpd[22743]: disconnect from mailout-de.gmx.net[213.165.64.23]
所以 gmx 只是不发出 STARTTLS 命令,对吗?但为什么呢?我不明白为什么其他邮件服务器可以连接到我的邮件服务器,但 gmx 却不能,以及为什么 gmx 可以连接到任何其他邮件服务器,但不能连接到我的邮件服务器。
我的 /etc/postfix/main.cf 如下所示: smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no append_dot_mydomain = no readme_directory = no
smtpd_tls_cert_file = /etc/ssl/certs/my_mail_cert.pem
smtpd_tls_key_file = /etc/ssl/private/my_mail_cert.pem
smtpd_tls_CAfile = /etc/ssl/certs/my_mail_ca_cert.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_loglevel = 1
debug_peer_list = mailout-de.gmx.net #log problematic host
smtpd_tls_security_level = may
smtpd_tls_auth_only = yes
myhostname = <MYHOSTNAME>
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost.org, , localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = <MYDOMAIN>
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_tls_security_level = encrypt
答案1
在配置文件的底部,您有smtpd_tls_security_level = encrypt
,这要求所有入站 SMTP 客户端使用 TLS。如果入站客户端不支持 TLS,则连接将失败。(从错误消息来看,gmx.net 似乎很可能就是这种情况。)
如果您设置了smtpd_tls_security_level = may
,那么您应该能够从不支持 TLS 的服务器获取电子邮件。(这似乎在您的文件中设置得更高,但随后被加密设置覆盖。)