Linux

中繼到本地 smtp 伺服器時,Postfix 不發送身份驗證

  • January 14, 2015

我一直在嘗試讓我的 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= 
<driver8lpqh2mrx@host.info>, 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:<DoNotReply@evconnect.com> 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:<12345@host.info>
<-  250 sender <12345@host> OK
-> RCPT TO:<host@me.com>
<-  250 recipient <host@me.com> OK
-> DATA
<-  354 go ahead, make my day
-> Date: Wed, 14 Jan 2015 17:01:28 +0000
-> To: host@me.com
-> From: 12345@host.info
-> 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
->
-> .

在與 Nick 聊天后,問題是 Haraka 只對來自 localhost 的請求宣傳身份驗證。我將 main.cf 中的傳輸文件/relayhost 更改為將我的域引用到 localhost。現在一切正常。

引用自:https://serverfault.com/questions/659482