Postfix中继主机连接失败:接收到初始服务器问候时超时

我有一个Elastix服务器框,我想发送语音邮件的电子邮件通知。 我想通过我们的公司电子邮件(由共享networking主机提供商Bluehost托pipe)发送给他们。 我遵循了关于如何使用Postfix作为中继服务器的说明。 电子邮件不会出去。 我在日志中得到以下内容(稍微模糊):

Sep 27 16:31:51 TD1000 postfix/smtp[9757]: 1B2C357117: to=<[email protected]>, relay=boxNNN.bluehost.com[abcd]:465, delay=5241, delays=5076/0.03/165/0, dsn=4.4.2, status=deferred (lost connection with boxNNN.bluehost.com[abcd] while receiving the initial server greeting) 

不同的地方表明这可能是一个黑名单问题。 但是,这似乎是我的个人电脑上运行的前景也是一个问题。 我想要做的是让后缀像Outlook一样,并使用SSL通过Bluehost发送。 (我的outlook设置:boxNNN.bluehost.com:465,SSL,需要validation)

当我debugging级别时,我得到以下消息:

 dns_query: boxNNN.bluehost.com (MX): Host found but no data record of requested type 

但是,由于最终的消息是没有回应,并find了服务器的IP地址,我不知道DNS问题是问题。

postconf -n显示:

 alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix debug_peer_level = 5 debug_peer_list = boxNNN.bluehost.com html_directory = no inet_interfaces = all mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost mydomain = cenginc-office.local myhostname = td1000.my-office.local mynetworks = /etc/postfix/network_table newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.5.6/README_FILES relayhost = boxNNN.bluehost.com:465 sample_directory = /usr/share/doc/postfix-2.5.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtp_connect_timeout = 300 smtp_enforce_tls = yes smtp_helo_name = my-phone-system smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = smtp_sasl_type = cyrus smtpd_sasl_auth_enable = yes smtpd_sasl_path = smtpd unknown_local_recipient_reject_code = 550 virtual_alias_maps = hash:/etc/postfix/virtual virtual_mailbox_base = /var/mail/vhosts virtual_mailbox_domains = virtual_transport = lmtp:unix:/var/lib/imap/socket/lmtp 

(根据Elastix UI,我们使用的是Postifix 2.3.3,所以我不确定为什么样本是2.5.6)

当我telnet到蓝盒子和端口,连接保持短时间打开,然后closures,我想因为我不是作为SSL进来。

我用这个网站(其中)的configuration,但我没有看到我失踪。 https://www.zulius.com/how-to/set-up-postfix-with-a-remote-smtp-relay-host/

任何想法,我做错了什么? 我的理论是postfix没有做一些bluehost在初始连接时期望的事情,但我不知道是什么。 谢谢你的帮助。

我们在这里有两个事实

  • 您通过端口465连接到bluehost
  • Postfix报告了一个错误信息: 与boxNNN.bluehost.com [abcd]丢失连接,同时收到初始服务器问候语

一个可能的解释是在Postfix 2.11或更旧的SMTP客户端不支持SSL

说明

在SMTP中,有两种encryptionscheme :STARTTLS和SMTPS。 不同之处在于(1)SMTPS需要从第一个字节开始进行SSLencryption,(2)STARTTLS首先需要纯文本模式,并且可选地客户端和服务器在STARTTLS命令之后执行SSL协商。

Postfix SMTP服务器(smtpd) 支持这两种协议 。 问题是SMTP客户端(postfix 3.0之前) – 发送电子邮件到远程服务器 – 不支持SMTPS连接。 它只支持纯文本模式或STARTTLS模式。

这里发生的是:Postfix SMTP客户端使用纯文本模式连接到Bluehost,因为后缀想要build立STARTTLS。 但是Bluehost期望第一个字节是SSL协商而不是纯文本。 这种不匹配使Bluehost服务器默默丢弃数据并断开后缀。 Postfix不知道这里发生了什么,所以它在maillog中抛出错误

 Sep 27 16:31:51 TD1000 postfix/smtp[9757]: 1B2C357117: to=<[email protected]>, relay=boxNNN.bluehost.com[abcd]:465, delay=5241, delays=5076/0.03/165/0, dsn=4.4.2, status=deferred (lost connection with boxNNN.bluehost.com[abcd] while receiving the initial server greeting) 

Postfix TLS文档提供了一个在这里使用stunnel的解决方法。 所以MrPhilTX的解决scheme对于Postfix <3.0是正确的。

在postfix 3.0中,Wietse Venema决定为postfix SMTP客户端提供额外的SMTPSfunction。 有了这个function,这里不需要stunnel解决scheme。 这里有两个变化:

a)启用SMTPS到所有传出的SMTP连接

通常情况下,在这种情况下,后缀有像OP的问题SMTPS只有relayhost 。 所以

 # Client-side SMTPS requires "encrypt" or stronger. smtp_tls_security_level = encrypt smtp_tls_wrappermode = yes # The [] suppress MX lookups. relayhost = [mail.example.com]:465 

b)启用SMTPS到多个主机

对于其他情况,您需要自定义传输和transport_maps来select性打开SMTPS

 # /etc/postfix/main.cf: transport_maps = hash:/etc/postfix/transport # /etc/postfix/transport: example.com relay-smtps:example.com:465 #/etc/postfix/master.cf: relay-smtps unix - - n - - smtp # Client-side SMTPS requires "encrypt" or stronger. -o smtp_tls_security_level=encrypt -o smtp_tls_wrappermode=yes 

我不确定这是否应该放在这里,但是这里是我如何运作的。

所以,kworr和befreeandgood把我放在正确的轨道上。 smtp_sasl_ *不会对SSL做任何事情,只是进行身份validation。

我遵循以下链接的说明的组合:这一个让我closureshttp://www.eglug.org/book/export/html/1923,但省略了一些事情来设置。 这一个http://tech.surveypoint.com/blog/relay-mail-with-postfix-and-stunnel/增加&#x4E86;inet_interfaces = loopback_only

这些选项让我遇到了邮件服务器拒绝各种标题名称的问题,比如“from”和“reply-to”。 我通过googlesearchfind了一些说明,但是我不允许发布这些链接,因为我已经超过了我的链接配额。

 alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix debug_peer_level = 2 html_directory = no inet_interfaces = loopback-only mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost mydomain = my-office.local myhostname = td1000.my-office.local mynetworks = /etc/postfix/network_table newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.5.6/README_FILES relayhost = 127.0.0.1:5001 sample_directory = /usr/share/doc/postfix-2.5.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtp_connect_timeout = 60 smtp_generic_maps = hash:/etc/postfix/generic smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = smtp_sasl_type = cyrus smtp_use_tls = yes smtpd_sasl_auth_enable = yes smtpd_sasl_path = smtpd smtpd_tls_auth_only = no smtpd_tls_loglevel = 2 smtpd_tls_received_header = no unknown_local_recipient_reject_code = 550 virtual_alias_maps = hash:/etc/postfix/virtual virtual_mailbox_base = /var/mail/vhosts virtual_mailbox_domains = virtual_transport = lmtp:unix:/var/lib/imap/socket/lmtp 

所以smtp_generic_maps被用来重命名实际存在的某个地址的各种地址。 我必须做两个不同的名字,通过查看/ var / log / maillog文件find。

所以,连接到Bluehost的总结:

  • 启用smtp_sasl身份validation
  • 使用stunnel创build一个SSL隧道
  • 使用smtp_generic_maps映射星号正在使用的不存在的用户名。
  • 与mydomain徘徊,这可能会让你围绕通用地图的要求。 我也看到有人引用$myorigin作为潜在的工作。

当目标域没有MXlogging时,SMTP服务器应该尝试将邮件传递到任何域Alogging。 例如,这将是example.net任何地址。

如果与encryption端口的连接失败,则需要查阅postfix手册,了解有关smtp_tls_security_level参数的信息。 你可以find一个冗长的解释,但我认为在大多数情况下,你只需要添加到您的configuration:

 smtp_tls_security_level=may