我搜索过,但没找到答案,我也没主意了。我对 postfix 和 dovecot 了解不够,无法解析配置或理解导致此错误的原因。
warning: SASL: Connect to /var/spool/postfix/private/auth failed: No such file or directory
fatal: no SASL authentication mechanisms
我无法使用 SASL 将外部客户端(例如 Thunderbird)连接到 Postfix。我希望这是显而易见的,但我就是看不到。
/var/spool/postfix/private/auth
存在。它归 postfix 所有。Dovecot 设置为使用 postfix 作为用户Dovecot 正在运行并监听:
unix 2 [ ACC ] STREAM LISTENING 241906 12768/dovecot /var/spool/postfix/private/auth
postconf -n
输出:alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no broken_sasl_auth_clients = yes compatibility_level = 2 inet_interfaces = all inet_protocols = all local_recipient_maps = $virtual_mailbox_maps local_transport = virtual mailbox_size_limit = 0 milter_default_action = accept milter_protocol = 2 mydestination = $myhostname, my-server.my-server.com, my-server, localhost.localdomain, localhost myhostname = my-server mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname non_smtpd_milters = inet:localhost:12301 readme_directory = no recipient_delimiter = + relay_domains = $mydestination, proxy:pgsql:/etc/postfix/pgsql/relay_domains.cf relayhost = smtp_sasl_auth_enable = yes smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) smtpd_milters = inet:localhost:12301 smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_authenticated_header = yes smtpd_sasl_path = /var/spool/postfix/private/auth smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_tls_cert_file = /etc/letsencrypt/live/mail.my-server.com/fullchain.pem smtpd_tls_key_file = /etc/letsencrypt/live/mail.my-server.com/privkey.pem smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes virtual_alias_maps = proxy:pgsql:/etc/postfix/sql/psql_virtual_alias_maps.cf, proxy:pgsql:/etc/postfix/sql/psql_virtual_alias_domain_maps.cf, proxy:pgsql:/etc/postfix/sql/psql_virtual_alias_domain_catchall_maps.cf virtual_gid_maps = static:113 virtual_mailbox_base = /var/mail/vmail virtual_mailbox_domains = proxy:pgsql:/etc/postfix/sql/psql_virtual_domains_maps.cf virtual_mailbox_limit = 512000000 virtual_mailbox_maps = proxy:pgsql:/etc/postfix/sql/psql_virtual_mailbox_maps.cf, proxy:pgsql:/etc/postfix/sql/psql_virtual_alias_domain_mailbox_maps.cf virtual_minimum_uid = 113 virtual_transport = virtual virtual_uid_maps = static:113
dovecot -n
输出:# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.21 (92477967) # OS: Linux 4.15.0-66-generic x86_64 Ubuntu 18.04.3 LTS ext4 auth_mechanisms = plain login first_valid_uid = 113 log_path = /var/log/dovecot.log login_greeting = My Mail Server mail_location = maildir:/var/mail/vmail/%u/ mail_max_userip_connections = 50 mail_plugins = " zlib" mail_privileged_group = mail namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Spam { special_use = \Junk } mailbox Trash { special_use = \Trash } prefix = type = private } passdb { driver = pam } passdb { args = /etc/dovecot/dovecot-sql.conf driver = sql } plugin { zlib_save = gz zlib_save_level = 6 } protocols = imap pop3 service auth { group = postfix unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0666 user = postfix } unix_listener auth-userdb { group = postfix mode = 0666 user = postfix } user = postfix } service imap-login { inet_listener imaps { port = 993 ssl = yes } } service imap { executable = imap } ssl_cert = </etc/letsencrypt/live/mail.my-server.com/fullchain.pem ssl_client_ca_dir = /etc/ssl/certs ssl_key = # hidden, use -P to show it userdb { driver = passwd } userdb { args = /etc/dovecot/dovecot-sql.conf driver = sql } protocol imap { mail_plugins = " zlib imap_zlib" }
答案1
在某些发行版(如 Debian)中,postfix 默认在 chroot 中运行。Chroot 会更改明显的根目录,因此 postfix 不会像您一样看到您的文件系统。这就是为什么/var/spool/postfix/private/auth
即使文件存在并且归 postfix 所有,它也无法看到它的原因。
如果您想在没有 chroot 的情况下运行 postfix,请编辑您的/etc/postfix/master.cf
文件以将 chroot 列明确设置n
为每个相关项目(对我来说,这就是所有项目)。请注意,如果您使用隐式默认值,-
您可能仍会获得 chroot,这显然是由于某些发行版维护者更改了编译默认值。
在 /etc/postfix/主配置文件:
# =============================================================
# service type private unpriv chroot wakeup maxproc command
# (yes) (yes) (yes) (never) (100)
# =============================================================
smtp inet n - n - - smtpd
如果你更喜欢 chrooted 操作,请参阅为 chroot 准备 posfix 的文档:基本配置自述文件#chroot_setup