![Dovecot 没有监听任何端口](https://linux22.com/image/706475/Dovecot%20%E6%B2%A1%E6%9C%89%E7%9B%91%E5%90%AC%E4%BB%BB%E4%BD%95%E7%AB%AF%E5%8F%A3.png)
我正在尝试设置邮件服务器,但 Dovecot 没有监听任何端口。我尝试过排除故障,但不幸的是遇到了瓶颈。任何帮助/建议都将不胜感激,谢谢。
/etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
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
readme_directory = no
# 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:${data_directory}/smtpd_scache
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination
鸽舍-n
# 2.2.13: /etc/dovecot/dovecot.conf
# OS: Linux 3.16.0-4-amd64 x86_64 Debian 8.8 ext4
auth_mechanisms = plain login
mail_location = maildir:/var/mail/vhosts/%d/%n
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 Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocols = imap lmtp
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
service imap-login {
inet_listener imap {
port = 0
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
ssl = no
userdb {
args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
driver = static
}
服务鸽舍状态
● dovecot.service - Dovecot IMAP/POP3 email server
Loaded: loaded (/lib/systemd/system/dovecot.service; enabled)
Active: active (running) since Fri 2017-06-23 21:33:08 CEST; 13min ago
Main PID: 7688 (dovecot)
CGroup: /system.slice/dovecot.service
├─7688 /usr/sbin/dovecot -F
├─7690 dovecot/anvil
├─7691 dovecot/log
└─7693 dovecot/config
Jun 23 21:33:08 spmac1 systemd[1]: Starting Dovecot IMAP/POP3 email server...
Jun 23 21:33:08 spmac1 systemd[1]: Started Dovecot IMAP/POP3 email server.
Jun 23 21:33:08 spmac1 dovecot[7688]: master: Dovecot v2.2.13 starting up for imap, lmtp (core dumps disabled)
网络状态监测
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 7557/master
tcp 0 0 0.0.0.0:55171 0.0.0.0:* LISTEN 463/rpc.statd
tcp 0 0 0.0.0.0:xxxx 0.0.0.0:* LISTEN 1274/sshd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 964/mysqld
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 7557/master
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 454/rpcbind
tcp6 0 0 :::25 :::* LISTEN 7557/master
tcp6 0 0 :::52219 :::* LISTEN 463/rpc.statd
tcp6 0 0 :::50122 :::* LISTEN 1274/sshd
tcp6 0 0 :::587 :::* LISTEN 7557/master
tcp6 0 0 :::111 :::* LISTEN 454/rpcbind
tcp6 0 0 :::80 :::* LISTEN 643/apache2
udp 0 0 0.0.0.0:629 0.0.0.0:* 454/rpcbind
udp 0 0 127.0.0.1:639 0.0.0.0:* 463/rpc.statd
udp 0 0 0.0.0.0:52688 0.0.0.0:* 463/rpc.statd
udp 0 0 0.0.0.0:8217 0.0.0.0:* 391/dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 391/dhclient
udp 0 0 0.0.0.0:111 0.0.0.0:* 454/rpcbind
udp6 0 0 :::629 :::* 454/rpcbind
udp6 0 0 :::25374 :::* 391/dhclient
udp6 0 0 :::34693 :::* 463/rpc.statd
udp6 0 0 :::111 :::* 454/rpcbind
尾部 /var/log/mail.log
Jun 23 21:20:03 spmac1 dovecot: lmtp(3589): Connect from local
Jun 23 21:20:03 spmac1 dovecot: lmtp(3589): Disconnect from local: Successful quit
Jun 23 21:20:03 spmac1 postfix/qmgr[1264]: 8518441BFC: removed
Jun 23 21:32:43 spmac1 postfix/master[1259]: terminating on signal 15
Jun 23 21:32:43 spmac1 postfix/master[7557]: daemon started -- version 2.11.3, configuration /etc/postfix
Jun 23 21:33:08 spmac1 dovecot: master: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
Jun 23 21:33:08 spmac1 dovecot: anvil: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
Jun 23 21:33:08 spmac1 dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
Jun 23 21:33:08 spmac1 dovecot: master: Dovecot v2.2.13 starting up for imap, lmtp (core dumps disabled)
从 netstat 的输出中可以看到,Dovecot 根本找不到;端口 993 和 143 都没有打开。我也尝试过远程登录这些端口,可以确认它们确实已关闭。
答案1
对于可能遇到类似问题的其他人来说,此特定配置中的关闭端口问题是由于以下原因造成的:
service imap-login {
inet_listener imap {
port = 0
}
必须指定端口号(IMAP 为 143)。或者,应注释掉“port = 0”行,这将允许 dovecot 回退并使用默认端口值。
此配置的另一个问题是,ssl 被设置为“no”,而它应该被设置为“required”,因为 postfix 配置中使用了骗人的证书。因此,这些证书也应该在 dovecot 配置中使用。
ssl = required
ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key