我使用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
在configuration文件的底部,您有smtpd_tls_security_level = encrypt ,这要求所有入站SMTP客户端使用TLS。 如果入站客户端不支持TLS,则连接将失败。 (这看起来可能是gmx.net的情况,给出了错误信息。)
如果您设置了smtpd_tls_security_level = may ,那么您应该能够从不支持TLS的服务器获取电子邮件。 (这似乎在文件中设置得更高,但稍后会被encryption设置覆盖。)