Postfix 错误,SASL 身份验证失败;无法向服务器进行身份验证,没有可用的机制

Postfix 错误,SASL 身份验证失败;无法向服务器进行身份验证,没有可用的机制

我想从我的家庭服务器设置 postfix 中继到我的网站托管 SMTP 服务器。它是 Centos 7,使用动态 IP 和动态 DNS 设置。由于我的托管网站空间有限,我想托管自己的邮箱,同时仍使用该网站的 SMTP,因为它的 IP 是静态的。我按照以下设置了我的 postfix本教程

但是当我测试向 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       [email protected]:password

/etc/map/regex-map

/.+@mail-example\.duckdns\.org/   [email protected]

postconf -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

答案1

如果您还无法解决此错误,我的设置与您的 99% 相似,只是它使用 Ubuntu,并且我已按照它进行了所有配置,但只是指向 GMAIL SMTP 端点。

请查看这个帖子 -->https://www.howtoforge.com/community/threads/solved-problem-with-outgoing-mail-from-server.53920/

结果是,我的 Debian 设置中缺少一个库。

apt 安装 libsasl2 模块

我敢打赌,对于 CentOS 或基于 Fedora 的系统,一定有其等效的通过yumdnf工具希望它会有所帮助!

答案2

安装该包cyrus-sasl-plain以提供 SASL PLAIN 身份验证方法。

相关内容