免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5676 | 回复: 12
打印 上一主题 下一主题

[Mail] postfix本地邮件投递的过程? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-07-26 12:26 |只看该作者 |倒序浏览
在配置好一个postfix邮件服务器后,对postfix本地邮件投递过程不是很明白,那位能给哪位能不能给讲解一下;
   我现在的邮件server也还有些问题,我配置的是
postfix+mysql+courier-authlib+courier-imap
通过虚拟域和虚拟用户来收发邮件,现在对外发送邮件没有问题,但是本地虚拟用户发送有问题,发送给本地虚拟用户的邮件,在投递时好像都在系统用户里去确认去了,如果系统用户(/etc/passwd)里没有则就投递失败;
下面是发送时的日志信息
Jul 26 11:54:07 testmail authdaemond: received auth request, service=smtp, authtype=login
Jul 26 11:54:07 testmail authdaemond: authmysql: trying this module
Jul 26 11:54:07 testmail authdaemond: SQL query: SELECT username, password, "", '89', '89', homedir, maildir, "", uid, "" FROM mailbox WHERE username = "huang@testhuang.com"
Jul 26 11:54:07 testmail authdaemond: password matches successfully
Jul 26 11:54:07 testmail authdaemond: authmysql: sysusername=<null>, sysuserid=89, sysgroupid=89, homedir=/home/mail, address=huang@testhuang.com, fullname=huang, maildir=testhuang.com/huang/Maildir/, quota=<null>, options=<null>
Jul 26 11:54:07 testmail authdaemond: authmysql: clearpasswd=<null>, passwd=EYjn8AK4PYrcw
Jul 26 11:54:07 testmail authdaemond: Authenticated: sysusername=<null>, sysuserid=89, sysgroupid=89, homedir=/home/mail, address=huang@testhuang.com, fullname=huang, maildir=testhuang.com/huang/Maildir/, quota=<null>, options=<null>
Jul 26 11:54:07 testmail authdaemond: Authenticated: clearpasswd=123456, passwd=EYjn8AK4PYrcw
Jul 26 11:54:07 testmail postfix/smtpd[10095]: NOQUEUE: reject: RCPT from unknown[192.168.0.16]: 550 <huang@testhuang.com>: Recipient address rejected: User unknown in local recipient table; from=<huang@testhuang.com> to=<huang@testhuang.com> proto=ESMTP helo=<TSS-HUANG>
Jul 26 11:54:08 testmail postfix/smtpd[10095]: lost connection after RCPT from unknown[192.168.0.16]

如果系统用户存在了,则邮件就投递到了用户相应的主目录下/home/test,我设置的虚拟用户的maildir在/home/mail/下,正常投递应该要投递到/home/mail/testhuang.com/huang/Maildir/new下去阿;可以确定的是接收时都是在/home/mail/testhuang.com/huang/Maildir/new这个目录下接收的,我试过将投递到/home/test/Maildir/new下的邮件拷贝到/home/mail/testhuang.com/huang/Maildir/new后可以接收走(outlook和extmail试验)
所以说问题就是投递的时候为什么会由系统用户来判断呢? 这个与mail.cf设置有关系吗?为什么发给本地虚拟用户的邮件不去mysql里确认呢?
我在里面添加上local_transport=virtual后还是一样的问题……
请各位有经验的同仁指教一下
谢了

[ 本帖最后由 boyhyc 于 2006-7-26 12:44 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-07-26 13:26 |只看该作者
SQL query: SELECT username, password, "", '89', '89', homedir, maildir, "", uid, "" FROM mailbox WHERE username = "huang@testhuang.com"
你看一下你的authmysqlrc文件的详细配置。

论坛徽章:
0
3 [报告]
发表于 2006-07-26 13:36 |只看该作者
MYSQL_SERVER            localhost
MYSQL_USERNAME          extmail
MYSQL_PASSWORD          extmail

MYSQL_PORT              3306
MYSQL_OPT               0
MYSQL_DATABASE          extmail

MYSQL_USER_TABLE        mailbox
MYSQL_CRYPT_PWFIELD     password
MYSQL_UID_FIELD         '89'
MYSQL_GID_FIELD         '89'
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        homedir

MYSQL_NAME_FIELD        uid
MYSQL_MAILDIR_FIELD     maildir

能是这个设置的问题吗?日志里不都显示password matches successfully么?
我的感觉就是在投递的时候并没有去mysql里确认,因为如果只要存在相应的系统用户,邮件就可以投递出去了。也就是本地投递时他到/etc/passwd里确认有无这个用户.奇怪……

[ 本帖最后由 boyhyc 于 2006-7-26 13:41 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-07-26 14:44 |只看该作者
附加上main.cf的设置
alias_maps = hash:/etc/postfix/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
disable_vrfy_command = yes
fallback_transport = cyrus
home_mailbox = Maildir/
html_directory = no
mail_owner = postfix
mailbox_size_limit = 14336000
mailbox_transport = cyrus
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
message_size_limit = 14336000
mydestination = $myhostname, $mydomain
mydomain = testhuang.com
myhostname = testhuang

mynetworks_style = host
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
relay_domains = com,cn,jp
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtp_helo_name = postfix.com
unknown_local_recipient_reject_code = 550

#############SMTP################
smtpd_recipient_limit = 100
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,
                                reject_rbl_client opm.blitzed.org,
                                     reject_rbl_client list.dsbl.org,
                                reject_rbl_client bl.spamcop.net,
                                       reject_rbl_client sbl-xbl.spamhaus.org
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous

##################MYSQL#########################
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_create_maildirsize = yes
virtual_mailbox_base = /home/mail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 102400000
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
virtual_minimum_uid = 89
virtual_gid_maps = postfix:89
virtual_uid_maps = postfix:89
virtual_overquota_bounce = yes
virtual_transport = virtual
virtual_trash_count = yes
virtual_trash_name = .Trash

如果加上
local_transport = virtual
则邮件可以从客户端发送到服务器上去,不过会一直停留在队列里,日志里还没有什么错误信息,……

[ 本帖最后由 boyhyc 于 2006-7-26 15:20 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2006-07-26 16:28 |只看该作者
把 mydestination = $myhostname, $mydomain
改成
mydestination = $myhostname
mydestination 里的表示本地域

论坛徽章:
0
6 [报告]
发表于 2006-07-26 16:38 |只看该作者
原帖由 Aryang 于 2006-7-26 16:28 发表
把 mydestination = $myhostname, $mydomain
改成
mydestination = $myhostname
mydestination 里的表示本地域

好像不是这里的问题,改了还是不行

论坛徽章:
0
7 [报告]
发表于 2006-07-26 18:31 |只看该作者
正常的情况下,如果收件域名在virtual_mailbox_domains里,并且
virtual_transport = virtual
那么应该是用系统的virtual进行投递,投递的时候要查询virtual_mailbox_maps 来确定用户名对应的投递目录
之前的esmtp认证和投递是两回事

可以通过下面的命令确定一下某地址到底投递到哪个目录去了

postmap -q huang@testhuang.com mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

正常的应该显示 testhuang.com/huang/Maildir 类似的东西

论坛徽章:
0
8 [报告]
发表于 2006-07-26 21:34 |只看该作者
先谢过楼上的朋友
但是现在我现在的状态还是比较奇怪,不知道是哪个地方的设置出了问题
邮件投递的时候好象并没有到virtual_mailbox_maps去确定目录,而是根据/etc/passwd来确定用户,所以邮件也自然就投递到了用户的家目录下。
好象就是在投递的过程中虚拟用户和域都没生效了,哪位高人能不能讲解一下postfix的具体投递过程呢?为什么在认证的时候都是通过虚拟域来实现了,而在投递的时候却不能呢!
郁闷
这样的问题好象都没人遇到过……

论坛徽章:
0
9 [报告]
发表于 2006-07-27 08:24 |只看该作者
经过楼上朋友和extmail老大的指点又明白了些
将mydestination里去掉$mydomain后,邮件可以投递到服务器上去了,但是还是一直在队列里没有发送成功,在日志里面显示
Jul 27 08:01:07 testmail postfix/smtpd[9984]: connect from unknown[192.168.0.16]
Jul 27 08:01:07 testmail postfix/smtpd[9984]: NOQUEUE: reject: RCPT from unknown[192.168.0.16]: 504 <TSS-HUANG>: Helo command rejected: need fully-qualified hostname; from=<test@testhuang.com> to=<huang@testhuang.com> proto=SMTP helo=<TSS-HUANG>
Jul 27 08:01:07 testmail postfix/smtpd[9984]: lost connection after RCPT from unknown[192.168.0.16]
Jul 27 08:01:07 testmail postfix/smtpd[9984]: disconnect from unknown[192.168.0.16]
Jul 27 08:01:12 testmail postfix/smtpd[9984]: connect from unknown[192.168.0.16]
Jul 27 08:01:12 testmail authdaemond: received auth request, service=smtp, authtype=login
Jul 27 08:01:12 testmail authdaemond: authmysql: trying this module
Jul 27 08:01:12 testmail authdaemond: SQL query: SELECT username, password, "", '89', '89', homedir, maildir, "", name, "" FROM mailbox WHERE username = "test@testhuang.com"
Jul 27 08:01:12 testmail authdaemond: password matches successfully
Jul 27 08:01:12 testmail authdaemond: authmysql: sysusername=<null>, sysuserid=89, sysgroupid=89, homedir=/home/mail, address=test@testhuang.com, fullname=test, maildir=testhuang.com/test/Maildir/, quota=<null>, options=<null>
Jul 27 08:01:12 testmail authdaemond: authmysql: clearpasswd=<null>, passwd=dmYQr5/Vbn34w
Jul 27 08:01:12 testmail authdaemond: Authenticated: sysusername=<null>, sysuserid=89, sysgroupid=89, homedir=/home/mail, address=test@testhuang.com, fullname=test, maildir=testhuang.com/test/Maildir/, quota=<null>, options=<null>
Jul 27 08:01:12 testmail authdaemond: Authenticated: clearpasswd=123456, passwd=dmYQr5/Vbn34w
Jul 27 08:01:12 testmail postfix/smtpd[9984]: 2F4D72C007: client=unknown[192.168.0.16], sasl_method=LOGIN, sasl_username=test@testhuang.com
Jul 27 08:01:12 testmail postfix/cleanup[9993]: 2F4D72C007: message-id=<20060727000112.2F4D72C007@testhuang>
Jul 27 08:01:12 testmail postfix/qmgr[9860]: 2F4D72C007: from=<test@testhuang.com>, size=567, nrcpt=1 (queue active)
Jul 27 08:01:12 testmail postfix/smtpd[9984]: disconnect from unknown[192.168.0.16]

并一会后就有如下的警告信息:
Jul 27 08:01:31 testmail postfix/virtual[10015]: fatal: unsupported dictionary type: postfix
Jul 27 08:01:32 testmail postfix/master[9559]: warning: process /usr/libexec/postfix/virtual pid 10015 exit status 1
Jul 27 08:01:32 testmail postfix/master[9559]: warning: /usr/libexec/postfix/virtual: bad command startup -- throttling

上面这个之前我也好像也遇到过,好像就是邮件一直试着去投但是就是没成功,显示未提供目录类型?
是指maildir的类型吗?还有下面两条就不太明白了。
那位朋友还能给解答一下……

论坛徽章:
0
10 [报告]
发表于 2006-07-27 10:06 |只看该作者
fatal: unsupported dictionary type: postfix
估计你哪的配置写错了,
在 virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf 这个里,mysql就是所谓的dictionary type,你是不是在某些地方写了 xxx_maps = postfix:/xxxxxxxxxxxxxxxxx

postconf | grep postfix:
看看是不是有这样的配置
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP