我一直在使用postfix,dovecot和mysql来configuration我的邮件服务器。 我有一个虚拟域和几个虚拟邮箱。 使用松鼠邮件,我已经能够login到我的帐户,并发送电子邮件(例如,我可以发送到谷歌邮件就好了),但是我无法收到任何电子邮件 – 不是从外部世界,也不是在我自己的networking。
我可以telnet使用本地,我的私人IP和我的公共IP端口25没有任何问题(我已经尝试从服务器本身和从我的networking上的另一台计算机)。
当我从我的googlemail帐户发送邮件到我的邮件服务器时,
mail.log
Apr 14 07:36:06 server1 postfix / qmgr [1721]:BE01B520538:from =,> size = 733,nrcpt = 1(队列激活)
Apr 14 07:36:06 server1 postfix / pipe [3371]:78BC0520510:to =,relay = dovecot,delay = 45421,delayed = 45421/0/0 / 0.13,dsn = 4.3.0,status = deferred >失败。命令输出:无法打开日志文件/var/log/mail-dovecot.log:权限被拒绝)
Apr 14 07:36:06 server1 postfix / pipe [3391]:8261B520534:to =,relay = dovecot,delay = 38036,delay = 38036 / 0.06 / 0 / 0.12,dsn = 4.3.0,status = deferred>临时失败命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝)
Apr 14 07:36:06 server1 postfix / pipe [63427520532] to =,relay = dovecot,delay = 38105,delay = 38105 / 0.02 / 0 / 0.17,dsn = 4.3.0,status = deferred>(临时失败命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝)
Apr 14 07:36:06 server1 postfix / pipe [3375]:07F65520522:to =,relay = dovecot,delay = 39467,delay = 39467 / 0.01 / 0 / 0.17,dsn = 4.3.0,status = deferred>临时失败命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝)
Apr 14 07:36:06 server1 postfix / pipe [3381]:EEDE9520527:to =,relay = dovecot,delay = 38361,delay = 38360 / 0.04 / 0 / 0.15,dsn = 4.3.0,status = deferred>临时失败命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝)
Apr 14 07:36:06 server1 postfix / pipe [3379]:67DFF520517:to =,relay = dovecot,delay = 40475,delay = 40475 / 0.03 / 0 / 0.16,dsn = 4.3.0,status = deferred>临时失败命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝)
Apr 14 07:36:06 server1 postfix / pipe [3C]:3C7A052052E:to => relay = dovecot,delay = 38259,delay = 38259 / 0.05 / 0 / 0.13,dsn = 4.3.0,status = deferred>临时失败命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝)
Apr 14 07:36:06 server1 postfix / pipe [3394]:BE01B520538:to =,relay = dovecot,delay = 37682,delayed = 37682 / 0.07 / 0 / 0.11,dsn = 4.3.0,status = deferred>临时失败命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝)
Apr 14 07:36:07 server1 postfix / pipe [0384]:3C7A052052E:to =,relay = dovecot,delay = 38261,delay = 38259 / 0.04 / 0 / 1.3,dsn = 4.3.0,status = deferred>临时失败命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝)
Apr 14 07:39:23 server1 postfix / anvil [3368]:统计:最大连接速率1/60秒(smtp:209.85.213.169)at Apr 14 07:35:32
Apr 14 07:39:23 server1 postfix / anvil [3368]:statistics:max connection count 1 for(smtp:209.85.213.169)at Apr 14 07:35:32
Apr 14 07:39:23 server1 postfix / anvil [3368]:统计:最大caching大小1 Apr 14 07:35:32
Apr 14 07:41:06 server1 postfix / qmgr [1721]:ED6005203B7:from =,size = 1463,nrcpt = 1(队列激活)
Apr 14 07:41:06 server1 postfix / pipe [4594]:ED6005203B7:to =,relay = dovecot,delay = 334,delays = 334 / 0.01 / 0 / 0.13,dsn = 4.3.0,status = deferred 。命令输出:无法打开日志文件/var/log/mail-dovecot.log:权限被拒绝)
Apr 14 07:51:06 server1 postfix / qmgr [1721]:ED6005203B7:from =,size = 1463,nrcpt = 1(队列激活)
Apr15 07:51:06 server1 postfix / pipe [4604]:ED6005203B7:to =,relay = dovecot,delay = 933,delay = 933 / 0.02 / 0 / 0.12,dsn = 4.3.0,status = deferred 。命令输出:无法打开日志文件/var/log/mail-dovecot.log:权限被拒绝)
mail-dovecot-log(我为debugging设置的日志):
Apr 14 07:28:26 auth:Info:mysql(127.0.0.1):连接到数据库postfixadmin
4月14日07:28:26 auth:debugging:sql(some.user1 @ mydomain.com,127.0.0.1):查询:select>密码从邮箱WHERE用户名='[email protected]'
Apr 14 07:28:26 auth:Debug:client out:OK 1 user = [email protected]
Apr 14 07:28:26 auth:Debug:master in:REQUEST 1809973249 3356 1 7cfb822db820fc5da67d0776b107cb3f
Apr 14 07:28:26 auth:Debug:sql(some.user1 @ mydomain.com,127.0.0.1):SELECT'/home/vmail/mydomain.com/some.user1'as home,5000 AS uid,5000 AS gid FROM邮箱WHERE用户名='[email protected]'
Apr 14 07:28:26 auth:Debug:master out:USER 1809973249 [email protected] home = / home / vmail / mydomain.com / some.user1 uid = 5000 gid = 5000
Apr 14 07:28:26 imap-login:Info:Login:user =,method = PLAIN,> rip = 127.0.0.1,lip = 127.0.0.1,mpid = 3360,secured
4月14日07:28:26 imap([email protected]):debugging:有效的uid = 5000,gid = 5000,home = / home / vmail / mydomain.com / some.user1
4月14日07:28:26 imap([email protected]):debugging: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
Apr 14 07:48:31 imap([email protected]):信息:断开连接:退出字节= 85/681
从上面的输出我很确定,我的问题都来自(临时失败。命令输出:无法打开日志文件/var/log/mail-dovecot.log:>权限被拒绝),但我不知道为什么我得到这个错误。 我已经拥有对其他邮件日志的权限:
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 - nn - - local virtual unix - nn - - 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 - nn - - 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 - nn - - pipe # user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} # # ==================================================================== # Old example of delivery via Cyrus. # #old-cyrus unix - nn - - pipe # flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} # # ==================================================================== # # See the Postfix UUCP_README file for configuration details. # uucp unix - nn - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) # # Other external delivery methods. # ifmail unix - nn - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - nn - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix - nn - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - nn - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} dovecot unix - nn - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
Postfix将运行/usr/lib/dovecot/deliver来传递邮件,看起来deliver失败,因为它不能写入/var/log/mail-dovecot.log 。 我不知道它运行的是什么用户,但是我猜想是postfix ,所以请尝试使mail-dovecot.log用户mail-dovecot.log写mail-dovecot.log 。