如何在Postfix中设置smtpd的用户名和密码?

我已经通过将此configuration添加到main.cf ,将Postfix设置为SMTP服务器:

 myhostname = foo.com mydomain = foo.com myorigin = $mydomain smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes broken_sasl_auth_clients = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_local_domain = $myhostname smtpd_helo_required = yes smtpd_helo_restrictions = reject_invalid_helo_hostname smtpd_recipient_restrictions = reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd 

sasl_passwd文件如下所示:

 foo.com user:pass 

我从该文件生成了一个sasl_passwd.db 。 不幸的是,当用用户名和密码连接到我的服务器时,我一直在获取authentication失败。 我究竟做错了什么?

您正在混合使用smtpd_saslsmtp_sasl ,第一个是在您的服务器上进行身份validation用户提交邮件以进行传递,后者用于postfix不直接传递而通过中继传递,而postfix本身进行身份validation

不幸的是,当用用户名和密码连接到我的服务器时,我一直在获取authentication失败。

你说, 连接到服务器,所以我想你想使用SASL的smtp d 。 用于用户authentication的postfix中的SASL通常使用dovecot或cyrus完成。

从哪里开始面对你正在接近的任务的两个提示:

  • 后缀文档: SASL_README
  • dovecot文档: Postfix和Dovecot SASL