尝试远程连接到我的 postfix 服务器时出现“503 5.5.1 错误:未启用身份验证”

尝试远程连接到我的 postfix 服务器时出现“503 5.5.1 错误:未启用身份验证”

我有以下内容:

postfix-2.10.1-6.el7.x86_64
cyrus-sasl-lib-2.1.26-17.el7.x86_64
cyrus-sasl-plain-2.1.26-17.el7.x86_64
cyrus-sasl-2.1.26-17.el7.x86_64

我的 postconf -n 是:

   alias_database = hash:/etc/aliases
   alias_maps = hash:/etc/aliases
   command_directory = /usr/sbin
   config_directory = /etc/postfix
   daemon_directory = /usr/libexec/postfix
   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
  html_directory = no
  inet_interfaces = all
  inet_protocols = all
  mail_owner = postfix
  mailq_path = /usr/bin/mailq.postfix
  manpage_directory = /usr/share/man
  mydestination = $myhostname, localhost.$mydomain, localhost
  newaliases_path = /usr/bin/newaliases.postfix
  queue_directory = /var/spool/postfix
  readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
  relayhost = smtp.dynect.net:25
  sample_directory = /usr/share/doc/postfix-2.10.1/samples
  sendmail_path = /usr/sbin/sendmail.postfix
  setgid_group = postdrop
  smtp_sasl_auth_enable = yes
  smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
  unknown_local_recipient_reject_code = 550

我的 /etc/sysconfig/saslauthd 有:

SOCKETDIR=/run/saslauthd
MECH=pam
FLAGS=

我的 /etc/sasl2/smtpd.conf 有:

pwcheck_method: saslauthd
mech_list: plain login    

当我尝试从远程服务器登录时出现以下错误:

telnet 10.65.60.23 25
Trying 10.65.60.23...
Connected to 10.65.60.23.
Escape character is '^]'.
220 jira.radwarecloud.com ESMTP Postfix
EHLO local.domain.name
250-jira.radwarecloud.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth login
503 5.5.1 Error: authentication not enabled

我这里漏掉了什么???谢谢!埃拉德。

答案1

在以下情况下启用 SASL接收电子邮件smtpd,你需要把这个参数

smtpd_sasl_auth_enable = yes

在以下情况下启用 SASL发送电子邮件smtp,你需要把这个参数

smtp_sasl_auth_enable = yes

postconf上面的输出中,你只输入了smtp_sasl_auth_enablenot smtpd_sasl_auth_enable。这就是 postfix 报错的原因

错误:未启用身份验证

答案2

AUTH 不是基本 SMTP 的一部分,而是 ESMTP 的一部分。因此,为了使用 AUTH,您需要使用 EHLO 而不是 HELO 启动 SMTP 会话。

答案3

如何调试是否真的是 SELinux 问题阻止了这些 SMTP 连接?您可以使用 getsebool 命令检查 httpd 守护程序是否被允许通过网络建立 SMTP 连接来发送电子邮件。

getsebool httpd_can_sendmail

getsebool httpd_can_network_connect

此命令将返回一个布尔值,表示开启或关闭。如果已禁用,则您将看到类似这样的输出;getsebool:SELinux 已禁用 我们可以使用以下命令将其打开:

sudo setsebool -P httpd_can_sendmail 1

sudo setsebool -P httpd_can_network_connect 1

如果您在共享托管服务提供商上运行代码并尝试连接到某些第三方 SMTP 提供商(如 smtp.pepipost.com 或 smtp.sendgrid.com)并收到类似这样的错误。​

答案4

chown -R saslauth:saslauth /var/run/saslauthd/

相关内容