Linux

後綴:“中繼訪問被拒絕”

  • July 10, 2021

我一直在嘗試使用 dovecot、postfix、opendkim 和 spamassassin 建立一個郵件伺服器。經過一番麻煩,我設法讓收到的郵件正常工作(我用電子郵件註冊了這個帳戶!)。但是,外發郵件不起作用——我通過從這封新電子郵件發送到我的舊 Protonmail 帳戶進行了測試,結果出現了錯誤。同樣,它適用於收到的郵件——從舊郵件發送到我的新郵件。Neomutt 使用 msmtp 作為其郵件發送命令對發送進行了測試。

我有一個relayhost去我域的埠 587 的。這是因為我的 ISP 很胖並且出於某種原因阻塞了埠 25。無論如何,這是我在發送電子郵件時收到的日誌消息:

postfix/submission/smtpd[57255]: NOQUEUE: reject: RCPT from unknown[192.168.86.1]: 454 4.7.1 <my@oldema.il>: Relay access denied; from=<swurl@newdoma.in> to=<my@oldema.il> proto=ESMTP helo=<mail.doma.in>
postfix/smtp[57263]: E45589003B2: to=<my@oldema.il>, relay=MY.IP[MY.IP]:587, delay=0.2, delays=0.14/0.02/0.02/0.02, dsn=4.7.1, status=deferred (host MY.IP[MY.IP] said: 454 4.7.1 <my@oldema.il>: Relay access denied (in reply to RCPT TO command))
postfix/submission/smtpd[57255]: disconnect from unknown[192.168.86.1] ehlo=2 starttls=1 mail=1 rcpt=0/1 data=0/1 rset=1 quit=1 commands=6/8

postconf -n:

alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/bin
compatibility_level = 3.6
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
home_mailbox = Mail/Inbox/
html_directory = no
inet_protocols = ipv4
mail_owner = postfix
mailbox_command = /usr/lib/dovecot/deliver
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
milter_default_action = accept
milter_protocol = 6
mydestination = $myhostname, $mydomain, localhost, localhost.localdomain, 127.0.0.1, MY.IP
mydomain = doma.in
myhostname = mail.doma.in
mynetworks = , 127.0.0.0/8 [::1]/128 MY.IP/32 MY.PRIVATE.IP MY.IP
newaliases_path = /usr/bin/newaliases
non_smtpd_milters = inet:127.0.0.1:12301
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix
relay_domains = $mydestination
relayhost = [MY.IP]:587
sample_directory = /etc/postfix
sendmail_path = /usr/bin/sendmail
setgid_group = postdrop
shlib_directory = /usr/lib/postfix
smtp_tls_CAfile = /etc/letsencrypt/live/doma.in/cert.pem
smtp_tls_loglevel = 3
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtp_tls_security_level = may
smtpd_milters = inet:127.0.0.1:12301
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options =
smtpd_sasl_tls_security_options =
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/doma.in/fullchain.pem
smtpd_tls_exclude_ciphers = aNULL, LOW, EXP, MEDIUM, ADH, AECDH, MD5, DSS, ECDSA, CAMELLIA128, 3DES, CAMELLIA256, RSA+AES, eNULL
smtpd_tls_key_file = /etc/letsencrypt/live/doma.in/privkey.pem
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_security_level = may
tls_preempt_cipherlist = yes
unknown_local_recipient_reject_code = 550

它正在偵聽埠 587:

# lsof -i -P -n|grep 587
...
master    57239      root   94u  IPv4 970320      0t0  TCP *:587 (LISTEN)
smtpd     57364   postfix    6u  IPv4 970320      0t0  TCP *:587 (LISTEN)
smtpd     57367   postfix    6u  IPv4 970320      0t0  TCP *:587 (LISTEN)
smtpd     57371   postfix    6u  IPv4 970320      0t0  TCP *:587 (LISTEN)
smtpd     57374   postfix    6u  IPv4 970320      0t0  TCP *:587 (LISTEN)

為什麼我會收到此錯誤?我已經經歷了其他幾個被問到的問題,特別是:

但是,這些都沒有幫助

我終於通過添加192.168.86.0/24來解決這個問題mynetworks。我還有另一個問題,但我會為此提出一個新問題。

引用自:https://unix.stackexchange.com/questions/657733