Centos

CentOS 6.5 Webmail 伺服器:警告:SASL:連接到私有/身份驗證失敗:沒有這樣的文件或目錄

  • July 7, 2014

我正在嘗試使用 Postfix、Docecot 和 Roundcube 在 CentOS 上執行網路郵件伺服器。每當我嘗試向我的伺服器發送郵件或發送測試電子郵件時,它都會失敗。我可以登錄,所以看起來 Dovecot 還可以。

這是我的伺服器日誌:

Jul  2 14:01:42 phantastyc postfix/smtpd[20154]: warning: SASL: Connect to private/auth failed: No such file or directory
Jul  2 14:01:42 phantastyc postfix/smtpd[20154]: fatal: no SASL authentication mechanisms
Jul  2 14:01:43 phantastyc postfix/master[18459]: warning: process /usr/libexec/postfix/smtpd pid 20154 exit status 1
Jul  2 14:01:43 phantastyc postfix/master[18459]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

當我向我的伺服器發送測試電子郵件時:

Jul  2 14:01:42 phantastyc postfix/smtpd[20154]: connect from mail-ve0-f178.google.com[209.85.128.178]

然後它顯示與上面相同的錯誤。

當我用 Roundcube 撰寫郵件時,它只是掛起,Sending message...過了一會兒說SMTP Error (-1): Connection to server failed,日誌說同樣的消息。

這是我的postconf -n輸出:

alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
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.6.6/README_FILES
relay_domains = *
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_sasl_type = dovecot
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
smtpd_sasl_type = dovecot
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/vmail_aliases
virtual_gid_maps = static:2222
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = hash:/etc/postfix/vmail_domains
virtual_mailbox_maps = hash:/etc/postfix/vmail_mailbox
virtual_minimum_uid = 2222
virtual_transport = virtual
virtual_uid_maps = static:2222

這是doveconf -n輸出:

# 2.0.9: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-042stab088.4 i686 CentOS release 6.5 (Final) reiserfs
auth_mechanisms = plain login
default_login_user = vmail
disable_plaintext_auth = no
first_valid_gid = 2222
first_valid_uid = 2222
listen = *
mail_access_groups = vmail
mail_location = maildir:/var/vmail/%d/%n
passdb {
 args = scheme=SHA1 /etc/dovecot/passwd
 driver = passwd-file
}
protocols = imap lmtp
service auth {
 unix_listener auth-client {
   group = vmail
   mode = 0660
   user = vmail
 }
 unix_listener auth-master {
   group = vmail
   mode = 0660
   user = vmail
 }
 user = root
}
service imap-login {
 process_min_avail = 1
 user = vmail
}
ssl = no
userdb {
 args = uid=2222 gid=2222 home=/var/vmail/%d/%n allow_all_users=yes
 driver = static
}

當我這樣做時:

[root@phantastyc ~]# ls -l /var/spool/postfix/private/auth
ls: cannot access /var/spool/postfix/private/auth: No such file or directory

編輯 1

它有點工作,除了現在有一個新的錯誤消息:

Jul  3 03:03:14 phantastyc postfix/trivial-rewrite[23348]: fatal: open database /etc/postfix/vmail_domains.db: No such file or directory
Jul  3 03:03:15 phantastyc postfix/master[18459]: warning: process /usr/libexec/postfix/trivial-rewrite pid 23348 exit status 1
Jul  3 03:03:15 phantastyc postfix/master[18459]: warning: /usr/libexec/postfix/trivial-rewrite: bad command startup -- throttling

此外,Google(我從中發送測試電子郵件的伺服器)返回延遲錯誤,說明與伺服器的連接已斷開,並且會繼續重試。

編輯 2

使用 解決上述問題後postmap,我遇到了另一個問題。

這是一些日誌記錄:

Jul  4 21:51:20 phantastyc postfix/smtpd[13016]: connect from mail-vc0-f171.google.com[209.85.220.171]
Jul  4 21:51:21 phantastyc postfix/trivial-rewrite[13019]: warning: do not list domain phantastyc.tk in BOTH mydestination and virtual_mailbox_domains
Jul  4 21:51:21 phantastyc postfix/smtpd[13016]: NOQUEUE: reject: RCPT from mail-vc0-f171.google.com[209.85.220.171]: 550 5.1.1 <admin@phantastyc.tk>: Recipient address rejected: User unknown in local recipient table; from=<bnguyen170@gmail.com> to=<admin@phantastyc.tk> proto=ESMTP helo=<mail-vc0-f171.google.com>
Jul  4 21:51:21 phantastyc postfix/smtpd[13016]: disconnect from mail-vc0-f171.google.com[209.85.220.171]

不在本地表中?

這裡是/etc/postfix/vmail_domains

admin@phantastyc.tk     phantastyc.tk/admin
bnguyen@phantastyc.tk       phantastyc.tk/bnguyen

admin@oa2019.tk         oa2019.tk/admin
bnguyen@oa2019.tk       oa2019.tk/bnguyen

我還搞砸了什麼?

編輯 3

由於日誌說我不能同時擁有域名,因此mydestinationvirtual_mailbox_domains將其從mydestination欄位中刪除,現在外發郵件很好。收到的郵件仍然有點不穩定。

Jul  4 22:10:41 phantastyc postfix/smtpd[13160]: connect from mail-vc0-f173.google.com[209.85.220.173]
Jul  4 22:10:41 phantastyc postfix/smtpd[13160]: 514F213E0E3A: client=mail-vc0-f173.google.com[209.85.220.173]
Jul  4 22:10:41 phantastyc postfix/cleanup[13164]: 514F213E0E3A: message-id=<CADZik+X9uC8QGJZtNoWKk_Aw0bdCP49DUVgdWkhVBCZVOuz3cg@mail.gmail.com>
Jul  4 22:10:41 phantastyc postfix/qmgr[13153]: 514F213E0E3A: from=<bnguyen170@gmail.com>, size=1930, nrcpt=1 (queue active)
Jul  4 22:10:41 phantastyc postfix/virtual[13165]: 514F213E0E3A: to=<admin@phantastyc.tk>, relay=virtual, delay=0.4, delays=0.32/0.01/0/0.06, dsn=4.2.0, status=deferred (delivery failed to mailbox /var/vmail/phantastyc.tk/admin: cannot open file: Is a directory)
Jul  4 22:10:41 phantastyc postfix/smtpd[13160]: disconnect from mail-vc0-f173.google.com[209.85.220.173]
Jul  4 22:11:08 phantastyc postfix/smtpd[13160]: connect from localhost.localdomain[127.0.0.1]
Jul  4 22:11:08 phantastyc postfix/smtpd[13160]: 4292A13E0E3B: client=localhost.localdomain[127.0.0.1], sasl_method=LOGIN, sasl_username=admin@phantastyc.tk

這把我嚇壞了:

(delivery failed to mailbox /var/vmail/phantastyc.tk/admin: cannot open file: Is a directory)

那是怎麼回事?

這裡是ls /var/vmail/phantastyc.tk/admin

cur
dovecot.index.log
dovecot.mailbox.log
dovecot.uidlist
dovecot.uidvalidity
dovecot.uidvalidity.53b3965c
new
subscriptions
tmp

這裡是/etc/postfix/vmail_domains

admin@phantastyc.tk     phantastyc.tk/admin
bnguyen@phantastyc.tk       phantastyc.tk/bnguyen

admin@oa2019.tk         oa2019.tk/admin
bnguyen@oa2019.tk       oa2019.tk/bnguyen

編輯 4

對不起,我沖在自己前面。我應該先這樣做。一個簡單的搜尋發現郵箱目錄上缺少一個尾部斜杠。我的郵件伺服器現在工作正常。

看起來 dovecot 配置和後綴配置不匹配。

在 dovecot 配置中(尤其是在service auth部分中,您只需定義兩個套接字 auth-clientauth-master。添加一個unix_listener包含內容的部分

unix_listener /var/spool/postfix/private/auth {
 mode = 0660
 # Assuming the default Postfix user and group
 user = postfix
 group = postfix        
}

有關更多文件,請參閱此頁面

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