我正在尝试使用 Postfix+Dovecot+mySQL 设置一个支持多域的邮件服务器。我遵循本指南。
我似乎已经设置好了一切,并且服务器正在发送 dovecot SSL 证书(在我的客户端中抛出一个证书异常对话框)但是邮件没有发送或接收。
/var/log/mail_err 返回此后缀错误:
连接到私人/身份验证失败:连接被拒绝
/var/log/mail.log 返回了更多详细信息:
Sep 25 19:33:58 localhost postfix/postscreen[11483]: CONNECT from [MYIPADDRESS]:58837 to [MYSERVERIPADDRESS]:25
Sep 25 19:33:58 localhost postfix/postscreen[11483]: PASS OLD [MYIPADDRESS]:58837
Sep 25 19:34:01 localhost postfix/smtpd[11486]: connect from MYHOSTMASK[MYIPADDRESS]
Sep 25 19:34:01 localhost postfix/smtpd[11486]: warning: SASL: Connect to private/auth failed: Connection refused
Sep 25 19:34:01 localhost postfix/smtpd[11486]: fatal: no SASL authentication mechanisms
Sep 25 19:34:02 localhost postfix/master[4556]: warning: process /usr/lib/postfix/smtpd pid 11486 exit status 1
Sep 25 19:34:02 localhost postfix/master[4556]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Sep 25 19:34:02 localhost postfix/postscreen[11483]: CONNECT from [MYIPADDRESS]:58839 to [MYSERVERIPADDRESS]:25
Sep 25 19:34:02 localhost postfix/postscreen[11483]: PASS OLD [MYIPADDRESS]:58839
Sep 25 19:35:02 localhost postfix/smtpd[11780]: connect from MYHOSTMASK[MYIPADDRESS]
Sep 25 19:35:49 localhost dovecot: auth-worker: mysql(127.0.0.1): Connected to database mailserver
Sep 25 19:35:49 localhost dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=MYIPADDRESS, lip=MYSERVERIPADDRESS, mpid=11804, TLS
Sep 25 19:38:07 localhost postfix/anvil[11379]: statistics: max connection rate 1/60s for (submission:MYIPADDRESS) at Sep 25 19:28:57
Sep 25 19:38:07 localhost postfix/anvil[11379]: statistics: max connection count 1 for (submission:MYIPADDRESS) at Sep 25 19:28:57
Sep 25 19:38:07 localhost postfix/anvil[11379]: statistics: max cache size 2 at Sep 25 19:28:57
Sep 25 19:39:02 localhost postfix/smtpd[11780]: lost connection after UNKNOWN from MYHOSTMASK[MYIPADDRESS]
Sep 25 19:39:02 localhost postfix/smtpd[11780]: disconnect from MYHOSTMASK[MYIPADDRESS]
Sep 25 19:39:02 localhost postfix/smtpd[11945]: connect from MYHOSTMASK[MYIPADDRESS]
Sep 25 19:39:03 localhost postfix/smtpd[11945]: warning: SASL: Connect to private/auth failed: Connection refused
Sep 25 19:39:03 localhost postfix/smtpd[11945]: fatal: no SASL authentication mechanisms
Sep 25 19:39:04 localhost postfix/master[4556]: warning: process /usr/lib/postfix/smtpd pid 11945 exit status 1
再次,我无法接收或发送邮件。看起来 Postfix 确实崩溃了,过早退出了。我没有主意了,我真的不想把所有东西都删掉,重新开始设置。有什么想法吗?这是在 Ubuntu 12.04 上运行的 VPS
编辑
postconf -n 输出:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = localhost
myhostname = lightningcoders.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/dovecot.pem
smtpd_tls_key_file = /etc/ssl/private/dovecot.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
Postfix 主配置:
root@orion:~# cat /etc/postfix/master.cf | grep ^smtp
smtp inet n - - - - smtpd
smtp inet n - - - 1 postscreen
smtpd pass - - - - - smtpd
smtp unix - - - - - smtp
编辑2:
root@orion:/home/jknipp# ls -ld /var/spool/postfix/private/auth
srw-rw-rw- 1 postfix postfix 0 Sep 25 02:38 /var/spool/postfix/private/auth
至于 dovecot 配置:
2.0.19: /etc/dovecot/dovecot.conf
# OS: Linux 3.9.3-x86_64-linode33 x86_64 Ubuntu 12.04.3 LTS ext3
auth_mechanisms = plain login
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocols = imap pop3 lmtp
ssl = required
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
driver = static
}
我的同事设置了一些非常严格的初始防火墙规则,即只打开需要的端口。目前这些端口是开放的:22、10000、25、587、993、143、110、465、21、80、443、6667。我需要打开特定端口吗?
答案1
根据您的编辑,我看不出您已经配置了 Dovecot 的身份验证套接字侦听器。它位于您链接的指南中 Dovecot 部分的第 34 和 35 号。
如果您使用 conf.d 目录结构(如指南中所建议的),请确保conf.d/10-master.conf
包含所有相关部分以及它们应该在的位置。
修复或添加这些内容后,重新启动 Dovecot 并doveconf -n
应在某处包含以下内容:
...
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
...
您不需要在防火墙上打开任何特殊端口,因为 Postfix 和 Dovecot 在同一台机器上,并且 Postfix 通过上述指令配置的套接字监听器与 Dovecot 通信。