Ubuntu

帶有 Docker 的後綴:連接到 SMTP 時出錯 - 454 4.7.1:中繼訪問被拒絕

  • November 17, 2020

所以我有以下設置

安裝了後綴的 Ubuntu 16.04 伺服器,執行 BigBlueButton

在那,我有一個帶有 Greenlight 的 docker 容器,它基本上是 BigBlueButton 的前端

這個 Docker 容器的 IP 為 172.18.0.3(我在 postfix 配置文件中添加到我的網路中)

當我跑

docker run --rm --env-file .env bigbluebutton/greenlight:v2 bundle exec rake conf:check

檢查配置和郵件是否正常工作,我得到以下輸出:

Checking environment: Passed
Checking Connection: Passed
Checking Secret: Passed
Checking SMTP connection: Failed
Error connecting to SMTP - 454 4.7.1 <dl@niteo.agency>: Relay access denied

.env 文件中的我的 Greenlight(Docker) SMTP 配置:

SMTP_SERVER=mydomain.example.com
SMTP_PORT=25
SMTP_DOMAIN=mydomain.example.com
#SMTP_USERNAME=
#SMTP_PASSWORD=
#SMTP_AUTH=
SMTP_STARTTLS_AUTO=true

# Specify the email address that all mail is sent from
SMTP_SENDER=no-reply@mydomain.example.com

# Specify the recipient for test emails (needed for providers like Microsoft, who are very
# strict about RFC 2606)
SMTP_TEST_RECIPIENT=my@testemail.com

我的後綴 main.cf 文件:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/mydomain.example.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mydomain.example.com/privkey.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

mydomain = mydomain.example.com
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mydomain.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mydomain.example.com, localhost.example.com, localhost, localhost.localdomain, $mydomain, $myhostname
relayhost =
mynetworks = localhost, 127.0.0.1, 172.18.0.2, 172.18.0.3
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_mailbox_domains=mydomain.example.com
relay_domains = $mydestination
html_directory = /usr/share/doc/postfix/html

我已經嘗試對 mynetworks 設置進行各種更改,包括將其設置為 0.0.0.0,據我所知,這應該允許任何人發送郵件 - 但它仍然不起作用。

編輯:

這是我的後綴日誌:

connect from unknown[172.17.0.2]
Nov 17 13:42:58 webinar postfix/smtpd[5604]: NOQUEUE: reject: RCPT from unknown[172.17.0.2]: 454 4.7.1 <my@testemail.com>: Relay access denied; from=$ from=<no-reply@mydomain.example.com> to=<my@testemail.com> proto=ESMTP helo=<mydomain.example.com>

Nov 17 13:42:58 webinar postfix/smtpd[5604]: disconnect from unknown[172.17.0.2] ehlo=2 starttls=1 mail=1 rcpt=0/1 quit=1 commands=5/6

您確定您的 IP 地址正確嗎?根據您的 postfix 日誌,發件人是 172.17.0.2,而不是 172.18.0.3。

您可以添加 172.17.0.2 並重mynetworks試嗎?

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