中继到本地 smtp 服务器时 Postfix 不发送身份验证

中继到本地 smtp 服务器时 Postfix 不发送身份验证

我一直在尝试让我的 postfix 服务器将所有消息转发到本地 SMTP 服务器。据我所知,我已经正确设置了所有设置,但我得到了一个550 Authentication error。当我使用诸如发送邮件之类的方式发送消息时,我的本地 SMTP 服务器工作正常,但当我使用 postfix 转发消息时却不行。(我更改了我的凭据/中继主机名)

这是我的main.cf文件

# See /usr/share/postfix/main.cf.dist for a commented, more complete version
debug_peer_list = 127.0.0.1
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
myhostname = evconnect.info
alias_maps = hash:/etc/aliases
virtual_alias_maps = hash:/etc/postfix/virtual
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
mynetworks = 0.0.0.0/0 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
local_recipient_maps =
relay_domains=*
recipient_delimiter = +
inet_interfaces = all
transport_maps = hash:/etc/postfix/transport

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/saslpasswd
smtp_always_send_ehlo = yes
relayhost = [localhost]:587

inet_protocols = all

这是我的/etc/postfix/saslpasswd文件预哈希。

[localhost]:587      user:password
localhost            user:password

这是尝试向我的中继主机发送消息时的邮件日志

Jan 14 16:20:51 ip-10-251-110-190 postfix/smtp[5056]: 9A01B24436: to= 
<[email protected]>, relay=host.info[xx.xxx.xxx.xxx]:587, delay=0.69, 
delays=0.2/0.01/0.48/0, dsn=5.0.0, status=bounced (host host.info[xx.xxx.xxx.xxx] said: 550  
Authentication required (in reply to MAIL FROM command))

来自 raalyhost (Haraka smtp 服务器) 的日志:

[NOTICE] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] connect ip=54.184.245.135 port=44974 
local_ip=:: local_port=587
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running lookup_rdns hooks
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running connect hooks
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running connect hook in dnsbl plugin
[DEBUG] [-] [dnsbl] looking up: 135.245.184.54.zen.spamhaus.org.
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] hook=connect plugin=dnsbl function=connect_first params="" retval=CONT msg=""
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running connect hook in max_unrecognized_commands plugin
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] hook=connect plugin=max_unrecognized_commands function=hook_connect params="" retval=CONT msg=""
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 220 ip-10-251-110-190 ESMTP Haraka 2.5.0 ready
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] C: EHLO evconnect.info state=1
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running ehlo hooks
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running capabilities hooks
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 250-ip-10-251-110-190 Hello ec2-54-184-245-135.us-west-2.compute.amazonaws.com [54.184.245.135], Haraka is at your service.
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 250-PIPELINING
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 250-8BITMIME
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 250 SIZE 500000
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] C: MAIL FROM:<> SIZE=5035 state=1
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 550 Authentication required
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] C: RCPT TO:<[email protected]> state=1
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 503 Use MAIL before RCPT
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] C: DATA state=1
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 503 MAIL required first
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] C: RSET state=1
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running rset hooks
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 250 OK
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] C: QUIT state=1
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running quit hooks
[PROTOCOL] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] S: 221 ip-10-251-110-190 closing connection.          Have a jolly good day.
[DEBUG] [A0BFEE28-79CE-4719-B23A-05B9990AA397] [core] running disconnect hooks

使用 swaks 发送电子邮件时记录(有效)

=== Trying localhost:587...
=== Connected to localhost.
<-  220 ip-10-251-110-190 ESMTP Haraka 2.5.0 ready
 -> EHLO host.com
<-  250-ip-10-251-110-190 Hello Unknown [127.0.0.1], Haraka is at your service.
<-  250-PIPELINING
<-  250-8BITMIME
<-  250-SIZE 500000
<-  250 AUTH LOGIN CRAM-MD5
-> AUTH CRAM-MD5
<-  334 PGVhMTUwLjE0YWU5NjQ4YjE4QGlwLTEwLTI1MS0xMTAtMTkwPg==
-> ZXZjYWRtaW4gNDU3NDMxOTE0MDk3ODA0ZDk2YzUzZmI0NTg1MmEzNjc=
<-  235 Authentication successful
-> MAIL FROM:<[email protected]>
<-  250 sender <12345@host> OK
 -> RCPT TO:<[email protected]>
<-  250 recipient <[email protected]> OK
 -> DATA
<-  354 go ahead, make my day
 -> Date: Wed, 14 Jan 2015 17:01:28 +0000
 -> To: [email protected]
 -> From: [email protected]
 -> Subject: test Wed, 14 Jan 2015 17:01:28 +0000
 -> X-Mailer: swaks v20111230.0 jetmore.org/john/code/swaks/
 ->
 -> This is a test mailing
 ->
 -> .

答案1

与 Nick 聊天后,问题在于 Haraka 仅向来自 localhost 的请求宣传身份验证。我将 main.cf 中的传输文件/中继主机更改为将我的域引用到 localhost。现在一切正常。

相关内容