
今天早上,為了修正安全憑證中名稱不符的問題,我按照以下建議的步驟進行操作如何修復郵件伺服器SSL?,但現在,當嘗試從用戶端(在本例中用戶端是 Windows Mail)發送電子郵件時,我收到以下錯誤。
被拒絕的電子郵件地址是 '[電子郵件受保護]'。主題“這是一個測試。 ',帳戶:'mail.domain.com',伺服器:'mail.domain.com',協定:SMTP,伺服器回應:'554 5.7.1:中繼存取被拒絕',連接埠:25,安全性(SSL) :否,伺服器錯誤:554,錯誤號碼:0x800CCC79
編輯:我仍然可以從此帳戶檢索電子郵件,並將電子郵件發送到同一網域的其他帳戶。我只是無法向我們網域之外的收件者發送電子郵件。
我嘗試完全停用 TLS,但沒有成功,我仍然遇到相同的錯誤。
當我檢查文件時mail.log
,我看到以下內容。
Jul 18 08:24:41 company imapd: LOGIN, [email protected], ip=[::ffff:111.111.11.11], protocol=IMAP
Jul 18 08:24:42 company imapd: DISCONNECTED, [email protected], ip=[::ffff:111.111.11.11], headers=0, body=0, rcvd=83, sent=409, time=1
Jul 18 08:25:19 company postfix/smtpd[29282]: connect from company.university.edu[111.111.11.11]
Jul 18 08:25:19 company postfix/smtpd[29282]: NOQUEUE: reject: RCPT from company.university.edu[111.111.11.11]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<UserPC>
Jul 18 08:25:19 company postfix/smtpd[29282]: disconnect from company.university.edu[111.111.11.11]
Jul 18 08:25:22 company imapd: DISCONNECTED, [email protected], ip=[::ffff:111.111.11.11], headers=13, body=142579, rcvd=3289, sent=215892, time=79
文件main.cf
看起來像這樣:
#
# Postfix MTA Manager Main Configuration File;
#
# Please do NOT edit this file manually;
#
#
# Postfix directory settings; These are critical for normal Postfix MTA functionallity;
#
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
program_directory = /usr/lib/postfix
#
# Some common configuration parameters;
#
inet_interfaces = all
mynetworks = 127.0.0.0/8
mynetworks_style = host
myhostname = mail.domain.com
mydomain = domain.com
myorigin = $mydomain
smtpd_banner = $myhostname ESMTP 2.4.7.1 (Debian/GNU)
setgid_group = postdrop
#
# Receiving messages parameters;
#
mydestination = localhost, company
append_dot_mydomain = no
append_at_myorigin = yes
transport_maps = mysql:/etc/postfix/transport.cf
#
# Delivering local messages parameters;
#
mail_spool_directory = /var/spool/mail
mailbox_size_limit = 0
mailbox_command = procmail -a "$EXTENSION"
biff = no
alias_database = hash:/etc/aliases
local_recipient_maps =
#
# Delivering virtual messages parameters;
#
virtual_mailbox_maps=mysql:/etc/postfix/mysql_virt.cf
virtual_uid_maps=mysql:/etc/postfix/uids.cf
virtual_gid_maps=mysql:/etc/postfix/gids.cf
virtual_mailbox_base=/usr/local/virtual
virtual_maps=mysql:/etc/postfix/virtual.cf
virtual_mailbox_domains=mysql:/etc/postfix/virtual_domains.cf
#
# SASL paramters;
#
smtp_use_tls = yes
smtpd_use_tls = yes
smtpd_tls_auth_only = yes
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtp_tls_CAfile = /etc/postfix/ssl/smptd.pem
smtp_tls_cert_file = /etc/postfix/ssl/smptd.crt
smtp_tls_key_file = /etc/postfix/ssl/smptd.key
smtpd_tls_CAfile = /etc/postfix/ssl/smptd.pem
smtpd_tls_cert_file = /etc/postfix/ssl/smptd.crt
smtpd_tls_key_file = /etc/postfix/ssl/smptd.key
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =
broken_sasl_auth_clients = yes
smtpd_sender_restrictions =
permit_sasl_authenticated
permit_mynetworks
smtpd_recipient_restrictions =
permit_sasl_authenticated
check_recipient_access hash:/etc/postfix/filtered_domains
permit_mynetworks
reject_unauth_destination
附帶說明一下,我的雇主希望能夠從本地網路內部和外部的客戶(Thunderbird 和 Outlook)發送電子郵件。
答案1
TLS 僅在 smtp 會話上啟用加密,並不會直接影響是否允許 Postfix 中繼訊息。
smtpd_recipient_restrictions
由於規則不匹配,出現中繼被拒絕訊息。必須滿足這些條件之一才能允許訊息通過:
smtpd_recipient_restrictions =
permit_sasl_authenticated
check_recipient_access hash:/etc/postfix/filtered_domains
permit_mynetworks
reject_unauth_destination
解釋這些規則:
permit_sasl_authenticated
允許透過 SASL 進行身份驗證的寄件者。這對於對通常被封鎖的網路外部的使用者進行身份驗證是必要的。
check_recipient_access
/etc/postfix/filtered_domains
這將導致 postfix根據收件者地址查找規則。 (從檔案名稱來看,它可能只是阻止了特定的網域...檢查一下 gmail.com 是否在其中列出?)
permit_mynetworks
這將允許主機使用與 中指定的 IP 範圍相符的 IP 位址$mynetworks
。在您發佈的 main.cf 中,$mynetworks
被設定為127.0.0.1
,因此它只會中繼伺服器本身產生的電子郵件。
根據該配置,您的郵件用戶端將需要使用 SMTP 驗證,然後才允許中繼郵件。我不確定 SASL 使用什麼資料庫。這是在 中指定的/usr/lib/sasl2/smtpd.conf
。據推測,它也使用與您的虛擬郵箱相同的資料庫,因此您應該能夠在郵件用戶端中啟用 SMTP 身份驗證並完成所有設定。
答案2
smtpd_use_tls = no
您已停用 TLS,因此您現在需要透過將其新增至 來授權您的本機網路mynetworks
。例如,
mynetworks = 192.168.1.0/24 127.0.0.0/8
這將修復僅從本地網路發送的問題。若要從本機網路外部傳送電子郵件,您需要啟用 TLS 驗證。
答案3
我想你想念 mydestination 中的domain.com,因為預設的relay_domains=$mydestination
,所以你可以附加你的設定行:
mydestinations = $mydomain, $myhostname, localhost, localhost.localdomain
或者:
relay_domains = $mydomain
service postfix restart
每次編輯 postfix conf 檔案時,不要忘記重新啟動 postfix 伺服器 ( )。
答案4
我在 Outlook 中遇到了同樣的問題(使用 dovecote 和 postfix 後端),我花了兩天時間尋找解決方案並調整我的設定檔。我所需要做的就是在 Outlook 郵件設定的“傳送”標籤中檢查“伺服器需要身份驗證”,我的郵件現在已傳送到 Gmail。請參閱此處有關如何查找設定的詳細說明http://support.bluetie.com/node/440。