Postfix

Postfix錯誤,SASL認證失敗;無法對伺服器進行身份驗證,沒有可用的機制

  • March 7, 2021

我想從我的家庭伺服器設置後綴中繼到我的網站託管 SMTP 伺服器。它是 Centos 7,使用動態 IP 和動態 DNS 設置。由於我的託管站點空間有限,我想託管我自己的郵箱,同時由於其靜態 IP 而仍然使用該站點的 SMTP。我根據本教程設置了我的後綴。

但是,當我測試向 Gmail 發送電子郵件時,我的電子郵件被延遲了。我哪裡設置錯了?我使用 Thunderbird 的電子郵件帳戶,它連接良好(STARTTLS,普通密碼)

warning: SASL authentication failure: No worthy mechs found
Mar 24 11:42:48 server.local postfix/error[4142]: D16F51084542: to=<******@gmail.com>, relay=none, delay=361, delays=361/0.02/0/0.02, dsn=4.7.0, status=deferred (delivery temporarily suspended: SASL authentication failed; cannot authenticate to server mail.myhosting.com[202.52.***.***]: no mechanism available)

這是我的 main.cf

smtpd_banner = $myhostname ESMTP $mail_name (CentOS)
biff = no
append_dot_mydomain = no
readme_directory = no
myhostname = mail-example.duckdns.org
mydomain = mail-example.duckdns.org
mynetworks = 127.0.0.0/8 192.168.101.0/24 192.168.98.0/24 [::1]/128 [fe80::]/64
#SASL
relayhost = [mail.myhosting.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_tls_security_level = encrypt
smtp_generic_maps = hash:/etc/postfix/map/generic_map, regexp:/etc/postfix/map/regex_map
smtpd_client_restrictions = permit_mynetworks, reject
smtpd_restriction_classes = mua_sender_restrictions, mua_client_restrictions, mua_helo_restrictions   
mua_client_restrictions = permit_sasl_authenticated, reject
mua_sender_restrictions = permit_sasl_authenticated, reject
mua_helo_restrictions = permit_mynetworks, reject_non_fqdn_hostname, reject_invalid_hostname, permit

/etc/postfix/sasl/sasl_passwd

[mail.myhosting.com]:587       contact@mysite.com:password

/etc/map/正則表達式映射

/.+@mail-example\.duckdns\.org/   contact@mysite.com

後置文件-df | grep sasl

broken_sasl_auth_clients = no
cyrus_sasl_config_path =
lmtp_sasl_auth_cache_name =
lmtp_sasl_auth_cache_time = 90d
lmtp_sasl_auth_enable = no
lmtp_sasl_auth_soft_bounce = yes
lmtp_sasl_mechanism_filter =
lmtp_sasl_password_maps =
lmtp_sasl_path =
lmtp_sasl_security_options = noplaintext, noanonymous
lmtp_sasl_tls_security_options = $lmtp_sasl_security_options
lmtp_sasl_tls_verified_security_options = $lmtp_sasl_tls_security_options
lmtp_sasl_type = cyrus
proxy_write_maps = $smtp_sasl_auth_cache_name $lmtp_sasl_auth_cache_name
send_cyrus_sasl_authzid = no
smtp_sasl_auth_cache_name =
smtp_sasl_auth_cache_time = 90d
smtp_sasl_auth_enable = no
smtp_sasl_auth_soft_bounce = yes
smtp_sasl_mechanism_filter =
smtp_sasl_password_maps =
smtp_sasl_path =
smtp_sasl_security_options = noplaintext, noanonymous
smtp_sasl_tls_security_options = $smtp_sasl_security_options
smtp_sasl_tls_verified_security_options = $smtp_sasl_tls_security_options
smtp_sasl_type = cyrus
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated,
smtpd_sasl_auth_enable = no
smtpd_sasl_authenticated_header = no
smtpd_sasl_exceptions_networks =
smtpd_sasl_local_domain =
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
smtpd_sasl_type = cyrus

如果你還不能解決這個錯誤,我的設置與你的 99% 相似,除了它使用 Ubuntu,我已經按照它進行了所有配置,但只是指向 GMAIL SMTP 端點。

看看這個執行緒-> https://www.howtoforge.com/community/threads/solved-problem-with-outgoing-mail-from-server.53920/

它原來是我的 Debian 設置中缺少的庫。

apt install libsasl2-modules

我敢打賭,對於 CentOS 或基於 Fedora 的系統,必須有其等效的 viayumdnftools 希望對您有所幫助!

安裝軟體包cyrus-sasl-plain以提供 SASL PLAIN 身份驗證方法。

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