Email

PostFix 和 Dovecot - 致命:沒有 SASL 身份驗證

  • January 24, 2013

在遵循 debuntu.org ( http://www.debuntu.org/how-to-virtual-emails-accounts-with-postfix-and-dovecot/ ) 提供的非常有幫助的指南之後,我立即開始遇到問題SASL 身份驗證。促使我查看 mail.log 以查看以下消息的是 Thunderbird 上的一條錯誤消息,指出“Thunderbird 未能找到您的電子郵件帳戶的設置”。mail.log中重複的錯誤如下:

Jan  6 14:16:45 Jesse-Server postfix/smtpd[22109]: connect from unknown[192.168.2.1]
Jan  6 14:16:45 Jesse-Server postfix/smtpd[22109]: warning: SASL: Connect to private/auth failed: No such file or directory
Jan  6 14:16:45 Jesse-Server postfix/smtpd[22109]: fatal: no SASL authentication mechanisms
Jan  6 14:16:46 Jesse-Server postfix/master[8209]: warning: process /usr/lib/postfix/smtpd pid 22109 exit status 1
Jan  6 14:16:46 Jesse-Server postfix/master[8209]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Jan  6 14:17:46 Jesse-Server postfix/smtpd[22134]: connect from localhost[127.0.0.1]
Jan  6 14:17:46 Jesse-Server postfix/smtpd[22134]: warning: SASL: Connect to private/auth failed: No such file or directory
Jan  6 14:17:46 Jesse-Server postfix/smtpd[22134]: fatal: no SASL authentication mechanisms
Jan  6 14:17:47 Jesse-Server postfix/master[8209]: warning: process /usr/lib/postfix/smtpd pid 22134 exit status 1
Jan  6 14:17:47 Jesse-Server postfix/master[8209]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Jan  6 14:18:26 Jesse-Server postfix/anvil[22112]: statistics: max connection rate 1/60s for (smtp:192.168.2.1) at Jan  6 14:16:45
Jan  6 14:18:26 Jesse-Server postfix/anvil[22112]: statistics: max connection count 1 for (smtp:192.168.2.1) at Jan  6 14:16:45
Jan  6 14:18:26 Jesse-Server postfix/anvil[22112]: statistics: max cache size 1 at Jan  6 14:16:45

這促使我尋找private/auth,但正如您在下面看到的那樣,不存在這樣的文件……

root@Jesse-Server:/home/clucky# ls -l /var/spool/postfix/private/auth
ls: cannot access /var/spool/postfix/private/auth: No such file or directory

我想知道的是我的私人/身份驗證文件夾在哪裡?我可能使用了錯誤版本的 dovecot 嗎?在不相關的註釋中,當我在終端中鍵入service dovecot restart時,它會顯示以下內容:

stop: Unknown instance:
dovecot start/running, process 9394

這是後綴標記main.cf的配置:

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
#vhost with mysql params
#virtual_alias_domains needs to be unset
virtual_alias_domains =
virtual_mailbox_domains = mysql:/etc/postfix/virtual/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/virtual/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/virtual/mysql-virtual-alias-maps.cf, mysql:/etc/postfix/virtual/mysql-virtual-email2email.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
myhostname = worldofclucky.net
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = worldofclucky.net, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination

這是dovecot.conf

protocols = imaps
mail_location = maildir:/var/vmail/%d/%n/Maildir
## uncomment this if you already have email from
## courier for instance.
#namespace private {
#  separator = .
#  prefix = INBOX.
#  inbox = yes
#}
## change section "protocol lda" to:
protocol lda {
 # Address to use when sending rejection mails.
 postmaster_address = postmaster@worldofclucky.net
 log_path = /var/vmail/dovecot-deliver.log
 # Hostname to use in various parts of sent mails, eg. in Message-Id.
 # Default is the system's real hostname.
 #hostname =
 # Support for dynamically loadable plugins. mail_plugins is a space separated
 # list of plugins to load.
 #mail_plugins =
 #mail_plugin_dir = /usr/lib/dovecot/modules/lda
 # Binary to use for sending mails.
 #sendmail_path = /usr/lib/sendmail
 # UNIX socket path to master authentication server to find users.
 auth_socket_path = /var/run/dovecot/auth-master
 # Enabling Sieve plugin for server-side mail filtering
 # handy for storing spam in their folders
 mail_plugins = cmusieve
 global_script_path = /var/vmail/globalsieverc
}
## in section auth default
## change :
mechanisms = plain login
## comment out "passdb pam"
## and make sure the following is in
## to look for users in the DB
 passdb sql {
   # Path for SQL configuration file, see /etc/dovecot/dovecot-sql.conf for example
   args = /etc/dovecot/dovecot-sql.conf
 }
## and add this so dovecot does not deal with uid/gid
## we use uid and gid 5000 for everybody
 userdb static {
   args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
 }
## next make sure the section "socket listen" looks like this
## so dovecot and postfix work happily together
 socket listen {
    master {
      path = /var/run/dovecot/auth-master
      mode = 0600
      user = vmail # User running Dovecot LDA
      #group = mail # Or alternatively mode 0660 + LDA user in this group
    }
    client {
     # The client socket is generally safe to export to everyone. Typical use
     # is to export it to your SMTP server so it can do SMTP AUTH lookups
     # using it.
     path = /var/spool/postfix/private/auth
     #path = /var/run/dovecot/auth-client
     mode = 0660
     user = postfix
     group = postfix
    }
  }

任何幫助將不勝感激,如果您需要更多錯誤/配置,請隨時提出。提前謝謝你!

作業系統:Linux Ubuntu 12.04

/var/spool/postfix/private/auth 應該是由 dovecot 創建的。

您重新啟動 dovecot 時的日誌應該會提供更多資訊。

在我的頭頂上,它應該記錄到 /var/log/mail.* 並且可能是 /var/log/daemon.log

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