过去几周,我一直在使用 postfix、dovecot 和 mysql 配置我的邮件服务器。我有一个虚拟域和几个虚拟邮箱。使用 squirrelmail,我可以登录我的帐户并发送电子邮件(例如,我可以正常发送到 googlemail),但我无法接收任何电子邮件——无论是来自外部世界还是来自我自己的网络。
我能够使用 localhost、我的私有 IP 和端口 25 上的公共 IP 进行 telnet 连接,没有任何问题(我已经从服务器本身和网络上的另一台计算机尝试过)。
当我从我的 googlemail 帐户向我的邮件服务器发送电子邮件时,我的日志中出现以下内容:
邮件日志
4 月 14 日 07:36:06 server1 postfix/qmgr[1721]: BE01B520538: from=, >size=733, nrcpt=1 (队列活动)
4 月 14 日 07:36:06 server1 postfix/pipe[3371]: 78BC0520510: to=, >relay=dovecot, delay=45421, delays=45421/0/0/0.13, dsn=4.3.0, status=deferred (临时 >失败。命令输出: 无法打开日志文件 /var/log/mail-dovecot.log: 权限被拒绝)
4 月 14 日 07:36:06 server1 postfix/pipe[3391]: 8261B520534: to=, >relay=dovecot, delay=38036, delays=38036/0.06/0/0.12, dsn=4.3.0, status=deferred >(暂时失败。命令输出:无法打开日志文件 /var/log/mail-dovecot.log: >权限被拒绝)
4 月 14 日 07:36:06 server1 postfix/pipe[3378]: 63927520532: to=, >relay=dovecot, delay=38105, delays=38105/0.02/0/0.17, dsn=4.3.0, status=deferred >(暂时失败。命令输出:无法打开日志文件 /var/log/mail-dovecot.log: >权限被拒绝)
4 月 14 日 07:36:06 server1 postfix/pipe[3375]: 07F65520522: to=, >relay=dovecot, delay=39467, delays=39467/0.01/0/0.17, dsn=4.3.0, status=deferred >(暂时失败。命令输出:无法打开日志文件 /var/log/mail-dovecot.log: >权限被拒绝)
4 月 14 日 07:36:06 server1 postfix/pipe[3381]: EEDE9520527: to=, >relay=dovecot, delay=38361, delays=38360/0.04/0/0.15, dsn=4.3.0, status=deferred >(暂时失败。命令输出:无法打开日志文件 /var/log/mail-dovecot.log: >权限被拒绝)
4 月 14 日 07:36:06 server1 postfix/pipe[3379]: 67DFF520517: to=, >relay=dovecot, delay=40475, delays=40475/0.03/0/0.16, dsn=4.3.0, status=deferred >(暂时失败。命令输出:无法打开日志文件 /var/log/mail-dovecot.log: >权限被拒绝)
4 月 14 日 07:36:06 server1 postfix/pipe[3387]: 3C7A052052E: to=, >relay=dovecot, delay=38259, delays=38259/0.05/0/0.13, dsn=4.3.0, status=deferred >(暂时失败。命令输出:无法打开日志文件 /var/log/mail-dovecot.log: >权限被拒绝)
4 月 14 日 07:36:06 server1 postfix/pipe[3394]: BE01B520538: to=, >relay=dovecot, delay=37682, delays=37682/0.07/0/0.11, dsn=4.3.0, status=deferred >(暂时失败。命令输出:无法打开日志文件 /var/log/mail-dovecot.log: >权限被拒绝)
4 月 14 日 07:36:07 server1 postfix/pipe[3384]: 3C7A052052E: to=, >relay=dovecot, delay=38261, delays=38259/0.04/0/1.3, dsn=4.3.0, status=deferred >(暂时失败。命令输出:无法打开日志文件 /var/log/mail-dovecot.log: >权限被拒绝)
4 月 14 日 07:39:23 server1 postfix/anvil[3368]: 统计信息:4 月 14 日 07:35:32 时 (smtp:209.85.213.169) 的最大连接速率为 1/60 秒
4 月 14 日 07:39:23 server1 postfix/anvil[3368]: 统计信息:4 月 14 日 07:35:32 时 (smtp:209.85.213.169) 的最大连接数为 1
4 月 14 日 07:39:23 server1 postfix/anvil[3368]: 统计信息:最大缓存大小 1,时间为 4 月 14 日 07:35:32
4 月 14 日 07:41:06 server1 postfix/qmgr[1721]: ED6005203B7: from=, size=1463, nrcpt=1 (队列活跃)
4 月 14 日 07:41:06 server1 postfix/pipe[4594]: ED6005203B7: to=, reply=dovecot, delay=334, delays=334/0.01/0/0.13, dsn=4.3.0, status=deferred (暂时失败。命令输出: 无法打开日志文件 /var/log/mail-dovecot.log: 权限被拒绝)
4 月 14 日 07:51:06 server1 postfix/qmgr[1721]: ED6005203B7: from=, size=1463, nrcpt=1 (队列活跃)
4 月 14 日 07:51:06 server1 postfix/pipe[4604]: ED6005203B7: to=, reply=dovecot, delay=933, delays=933/0.02/0/0.12, dsn=4.3.0, status=deferred (暂时失败。命令输出: 无法打开日志文件 /var/log/mail-dovecot.log: 权限被拒绝)
mail-dovecot-log(我为调试设置的日志):
4 月 14 日 07:28:26 身份验证:信息:mysql(127.0.0.1):已连接到数据库 postfixadmin
4 月 14 日 07:28:26 身份验证:调试:sql([电子邮件保护],127.0.0.1): 查询:SELECT >password FROM mailbox WHERE username = '[电子邮件保护]‘
4 月 14 日 07:28:26 身份验证:调试:客户端输出:OK 1 [电子邮件保护]
4月14日 07:28:26 身份验证:调试:主控:请求 1809973249 3356 1 7cfb822db820fc5da67d0776b107cb3f
4 月 14 日 07:28:26 身份验证:调试:sql([电子邮件保护],127.0.0.1): 从邮箱中选择“/home/vmail/mydomain.com/some.user1”作为 home,5000 AS uid,5000 AS gid,其中用户名 = '[电子邮件保护]‘
4月14日 07:28:26 身份验证:调试:主控输出:用户 1809973249 [电子邮件保护]主页=/home/vmail/mydomain.com/some.user1 uid=5000 gid=5000
4 月 14 日 07:28:26 imap-login:信息:登录:用户 =,方法 = PLAIN,>rip=127.0.0.1,lip=127.0.0.1,mpid=3360,安全
4月14日 07:28:26 imap([电子邮件保护]): 调试:有效uid=5000,gid=5000,home=/home/vmail/mydomain.com/some.user1
4月14日 07:28:26 imap([电子邮件保护]):调试:maildir++:root=/home/vmail/mydomain.com/some.user1/Maildir,index=/home/vmail/mydomain.com/some.user1/Maildir/indexes,control=,inbox=/home/vmail/mydomain.com/some.user1/Maildir
4月14日 07:48:31 imap([电子邮件保护]): 信息:已断开连接:已注销字节数=85/681
从上面的输出结果来看,我很确定我的问题都源于(临时故障。命令输出:无法打开日志文件 /var/log/mail-dovecot.log:>Permission denied ),但我不知道为什么会出现这个错误。我已将该日志的权限设置为其他邮件日志的权限:
root@server1:~# ls -l /var/log/mail*
-rw-r----- 1 syslog adm 196653 2012-04-14 07:58 /var/log/mail-dovecot.log
-rw-r----- 1 syslog adm 62778 2012-04-13 21:04 /var/log/mail.err
-rw-r----- 1 syslog adm 497767 2012-04-14 08:01 /var/log/mail.log
有人知道我可能做错了什么吗?
这是我的 main.cf 和 master.cf 文件: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 (Ubuntu)
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
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = server1.mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
# Virtual Configs
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_mailbox_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
relay_domains = mysql:/etc/postfix/mysql_relay_domains.cf
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_hostname
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
virtual_transport=dovecot
dovecot_destination_recipient_limit = 1
master.cf:
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
#smtp inet n - - - 1 postscreen
#smtpd pass - - - - - smtpd
#dnsblog unix - - - - 0 dnsblog
#tlsproxy unix - - - - 0 tlsproxy
#submission inet n - - - - smtpd
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#smtps inet n - - - - smtpd
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - - 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - - - - smtp
-o smtp_fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
答案1
Postfix 将运行/usr/lib/dovecot/deliver
以传递邮件,但似乎deliver
失败了,因为它无法写入/var/log/mail-dovecot.log
。我不确定它以哪个用户身份运行,但我猜是postfix
,因此请尝试使mail-dovecot.log
该postfix
用户可以写入。