免费注册 查看新帖 |

Chinaunix

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

[Mail] 如何禁止postfix的smtp而只是用esmtp [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-06 00:44 |只看该作者 |倒序浏览
正在弄一个postfix的mailserver 看了marion 的文档,编译安装。装完测试发现一些问题,foxmail不管是否勾选通过smtp认证都可以发出邮件,看日志然后telnet感觉esmtp是有的,但是smtp没有禁止。不知如何禁止。下面是日志,希望碰到过同类问题的朋友们帮忙

不勾选认证的日志
Sep  5 23:58:39 ****** postfix/smtpd[16767]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Sep  5 23:58:39 ****** postfix/smtpd[16767]: warning: 58.33.157.147: address not listed for hostname 147.157.33.58.broad.xw.sh.dynamic.163data.com.cn
Sep  5 23:58:39 ****** postfix/smtpd[16767]: connect from unknown[58.33.157.147]
Sep  5 23:58:39 ****** postfix/trivial-rewrite[16770]: warning: do not list domain test.com in BOTH mydestination and virtual_mailbox_domains
Sep  5 23:58:39 ****** postfix/smtpd[16767]: NOQUEUE: reject: RCPT from unknown[58.33.157.147]: 504 5.5.2 <PC-200908251556>: Helo command rejected: need fully-qualified hostname; from=<test@test.com> to=<test@gmail.com> proto=SMTP helo=<PC-200908251556>
Sep  5 23:58:39 ****** postfix/smtpd[16767]: lost connection after RCPT from unknown[58.33.157.147]
Sep  5 23:58:39 ****** postfix/smtpd[16767]: disconnect from unknown[58.33.157.147]
Sep  5 23:58:39 ****** postfix/smtpd[16767]: warning: 58.33.157.147: address not listed for hostname 147.157.33.58.broad.xw.sh.dynamic.163data.com.cn
Sep  5 23:58:39 ****** postfix/smtpd[16767]: connect from unknown[58.33.157.147]
Sep  5 23:58:39 ****** postfix/smtpd[16767]: 9FA60F270032: client=unknown[58.33.157.147], sasl_method=LOGIN, [email=sasl_username=test@test.com]sasl_username=test@test.com[/email]
Sep  5 23:58:39 ****** postfix/cleanup[16774]: 9FA60F270032: message-id=<>
Sep  5 23:58:39 ****** postfix/qmgr[16776]: 9FA60F270032: from=<test@test.com>, size=643, nrcpt=1 (queue active)
Sep  5 23:58:39 ****** postfix/smtpd[16767]: disconnect from unknown[58.33.157.147]
Sep  5 23:58:44 ****** postfix/smtp[16777]: 9FA60F270032: to=<test@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.222.46]:25, delay=5, delays=0.1/0/2.5/2.5, dsn=2.0.0, status=sent (250 2.0.0 OK 1252166324 12si7091801pzk.74)
Sep  5 23:58:44 ****** postfix/qmgr[16776]: 9FA60F270032: removed



勾选后的日志

Sep  6 00:16:16 ****** postfix/smtpd[16822]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Sep  6 00:16:16 ****** postfix/smtpd[16822]: warning: 58.33.157.147: address not listed for hostname 147.157.33.58.broad.xw.sh.dynamic.163data.com.cn
Sep  6 00:16:16 ****** postfix/smtpd[16822]: connect from unknown[58.33.157.147]
Sep  6 00:16:17 ****** postfix/trivial-rewrite[16826]: warning: do not list domain test.com in BOTH mydestination and virtual_mailbox_domains
Sep  6 00:16:17 ****** postfix/smtpd[16822]: 070C7F270032: client=unknown[58.33.157.147], sasl_method=LOGIN, [email=sasl_username=test@test.com]sasl_username=test@test.com[/email]
Sep  6 00:16:17 ****** postfix/cleanup[16829]: 070C7F270032: message-id=<>
Sep  6 00:16:17 ****** postfix/qmgr[16776]: 070C7F270032: from=<test@test.com>, size=643, nrcpt=1 (queue active)
Sep  6 00:16:17 ****** postfix/smtpd[16822]: disconnect from unknown[58.33.157.147]
Sep  6 00:16:21 ****** postfix/smtp[16831]: 070C7F270032: to=<test@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.222.46]:25, delay=4.4, delays=0.1/0/1.7/2.6, dsn=2.0.0, status=sent (250 2.0.0 OK 1252167381 12si7096839pzk.6)
Sep  6 00:16:21 ****** postfix/qmgr[16776]: 070C7F270032: removed

在上面的日志里也没看到用esmtp协议的样子,只有更sasl_method的login认证
自己也刚接触postfix,觉得如果客户端勾选esmtp认证的话在日志里应该会出现相应的字符才对。就像不是用出现smtp一样。

自己配的main.cf
broken_sasl_auth_clients = yes
command_directory = /usr/local/postfix/sbin
config_directory = /etc/postfix
daemon_directory = /usr/local/postfix/libexec
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = /var/www/postfix_html
inet_interfaces = all
mail_owner = vmail
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/postfix/man
message_size_limit = 14336000
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = test.com
myhostname = mail.test.com
mynetworks = 127.0.0.1
newaliases_path = /usr/bin/newaliases
queue_directory = /home/spool/postfix
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
unknown_local_recipient_reject_code = 550
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:1000
virtual_mailbox_base = /home/domains
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 20971520
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_transport = virtual
virtual_uid_maps = static:1000


不知道问题出在哪里。

论坛徽章:
0
2 [报告]
发表于 2009-09-06 22:00 |只看该作者
原帖由 minmig 于 2009-9-6 00:44 发表
正在弄一个postfix的mailserver 看了marion 的文档,编译安装。装完测试发现一些问题,foxmail不管是否勾选通过smtp认证都可以发出邮件,看日志然后telnet感觉esmtp是有的,但是smtp没有禁止。不知如何禁止。下 ...


别用foxmail测试,太智能了。

论坛徽章:
0
3 [报告]
发表于 2009-09-07 10:59 |只看该作者
多谢楼上回复



现在换用outlook explore测试

果然需要通过选中需要身份验证才能发件

看了一下日志和error信息。



不选身份验证如下:

outlook error信息是
  1. Helo command rejected: need fully-qualified hostname
复制代码
postfix日志是:
  1. Sep  7 10:09:03 ****** postfix/smtpd[4972]: connect from unknown[*.*.*.*]
  2. Sep  7 10:09:03 ****** postfix/trivial-rewrite[4975]: warning: do not list domain test.com in BOTH mydestination and virtual_mailbox_domains
  3. Sep  7 10:09:03 ****** postfix/smtpd[4972]: NOQUEUE: reject: RCPT from unknown[*.*.*.*]: 504 5.5.2 <PC200908251556>: Helo command rejected: need fully-qualified hostname; from=<test@test.com> to=<minmig@gmail.com> proto=SMTP helo=<PC200908251556>
  4. Sep  7 10:09:03 ****** postfix/smtpd[4972]: NOQUEUE: reject: RCPT from unknown[*.*.*.*]: 504 5.5.2 <PC200908251556>: Helo command rejected: need fully-qualified hostname; from=<test@test.com> to=<minmig@gmail.com> proto=SMTP helo=<PC200908251556>
  5. Sep  7 10:09:03 ****** postfix/smtpd[4972]: disconnect from unknown[*.*.*.*]
复制代码
根据以上日志感觉是 没有点认证时,没有获取fqdn,从而在无法再mysql数据库找到相应记录所以检测不过。而不是因为ESMTP认证不过造成的。

自己感觉,希望楼上指正。



下面是勾选了smtp认证的日志
  1. Sep  7 10:27:34 ****** postfix/smtpd[5024]: connect from unknown[*.*.*.*]
  2. Sep  7 10:27:34 ****** authdaemond: received auth request, service=smtp, authtype=login
  3. Sep  7 10:27:34 ****** authdaemond: authmysql: trying this module
  4. Sep  7 10:27:34 ****** authdaemond: authmysqllib: connected. Versions: header 50045, client 50045, server 50045
  5. Sep  7 10:27:34 ****** authdaemond: SQL query: SELECT username, password, "", '1000', '1000', concat('/home/domains/',maildir), concat('/home/domains/',maildir), "", name, "" FROM mailbox WHERE username = 'test@test.com'
  6. Sep  7 10:27:34 ****** authdaemond: password matches successfully
  7. Sep  7 10:27:34 ****** authdaemond: authmysql: sysusername=<null>, sysuserid=1000, sysgroupid=1000, homedir=/home/domains/test.com/test/Maildir/, address=test@test.com, fullname=test, maildir=/home/domains/test.com/test/Maildir/, quota=<null>, options=<null>
  8. Sep  7 10:27:34 ****** authdaemond: authmysql: clearpasswd=<null>, passwd=$1$Xb14kEH9$lpc6pMVcskOs0ZEGri/We0
  9. Sep  7 10:27:34 ****** authdaemond: Authenticated: sysusername=<null>, sysuserid=1000, sysgroupid=1000, homedir=/home/domains/test.com/test/Maildir/, address=test@test.com, fullname=test, maildir=/home/domains/test.com/test/Maildir/, quota=<null>, options=<null>
  10. Sep  7 10:27:34 ****** authdaemond: Authenticated: clearpasswd=test, passwd=********
  11. Sep  7 10:27:34 ****** postfix/trivial-rewrite[5028]: warning: do not list domain test.com in BOTH mydestination and virtual_mailbox_domains
  12. Sep  7 10:27:34 ****** postfix/smtpd[5024]: 1B8CCF270034: client=unknown[*.*.*.*], sasl_method=LOGIN, sasl_username=test@test.com
  13. Sep  7 10:27:34 ****** postfix/cleanup[5031]: 1B8CCF270034: message-id=<5D4AEE77B429461FAE6BBE79F869C90E@PC200908251556>
  14. Sep  7 10:27:34 ****** postfix/qmgr[6055]: 1B8CCF270034: from=<test@test.com>, size=1401, nrcpt=1 (queue active)
  15. Sep  7 10:27:34 ****** postfix/smtpd[5024]: 2E4CCF270035: client=unknown[*.*.*.*], sasl_method=LOGIN, sasl_username=test@test.com
  16. Sep  7 10:27:34 ****** postfix/cleanup[5031]: 2E4CCF270035: message-id=<0B8F6BBFDBA048B2870B6BF359D2E35B@PC200908251556>
  17. Sep  7 10:27:34 ****** postfix/qmgr[6055]: 2E4CCF270035: from=<test@test.com>, size=2179, nrcpt=1 (queue active)
  18. Sep  7 10:27:34 ****** postfix/smtpd[5024]: 3970FF270036: client=unknown[*.*.*.*], sasl_method=LOGIN, sasl_username=test@test.com
  19. Sep  7 10:27:34 ****** postfix/cleanup[5031]: 3970FF270036: message-id=<562C77B577B04EA484DE796B76BDFA52@PC200908251556>
  20. Sep  7 10:27:34 ****** postfix/qmgr[6055]: 3970FF270036: from=<test@test.com>, size=2179, nrcpt=1 (queue active)
  21. Sep  7 10:27:34 ****** postfix/smtpd[5024]: disconnect from unknown[*.*.*.*]
  22. Sep  7 10:27:36 ****** postfix/smtp[5035]: 3970FF270036: to=<minmig@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.222.15]:25, delay=2.8, delays=0.04/0/1.6/1.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1252290456 15si14450451pzk.92)
  23. Sep  7 10:27:36 ****** postfix/qmgr[6055]: 3970FF270036: removed
  24. Sep  7 10:27:37 ****** postfix/smtp[5034]: 2E4CCF270035: to=<minmig@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.222.15]:25, delay=3.7, delays=0.03/0/2.6/1, dsn=2.0.0, status=sent (250 2.0.0 OK 1252290457 15si14651865pzk.58)
  25. Sep  7 10:27:37 ****** postfix/qmgr[6055]: 2E4CCF270035: removed
  26. Sep  7 10:27:37 ****** postfix/smtp[5033]: 1B8CCF270034: to=<minmig@gmail.com>, relay=gmail-smtp-in.l.google.com[209.85.222.15]:25, delay=3.8, delays=0.08/0/1.9/1.8, dsn=2.0.0, status=sent (250 2.0.0 OK 1252290457 15si14651774pzk.58)
  27. Sep  7 10:27:37 ****** postfix/qmgr[6055]: 1B8CCF270034: removed
复制代码
弄了那么就对postfix的ESMTP认真模块的流程还是有点模糊



感觉是  outlook -->  smtpd --> sasl2 --> authlib --> mysql 。不知道对不对,Esmtp在哪里来获得支持,是smtpd还是sasl2还是authlib。感觉是在sasl上面做的,但是又不知道在哪里设置。

还有一点是当初在编译postfix的时候就直接支持mysql ,为什么还需要用通过authlib来连接mysql呢?

希望大牛或碰到过相关问题的朋友帮忙。

[ 本帖最后由 minmig 于 2009-9-7 11:03 编辑 ]

论坛徽章:
8
综合交流区版块每周发帖之星
日期:2015-12-02 15:03:53数据库技术版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-09-14 06:20:00金牛座
日期:2014-10-10 11:23:34CU十二周年纪念徽章
日期:2013-10-24 15:41:34酉鸡
日期:2013-10-19 10:17:1315-16赛季CBA联赛之北京
日期:2017-03-06 15:12:44
4 [报告]
发表于 2009-09-07 12:17 |只看该作者
原帖由 minmig 于 2009-9-7 10:59 发表
多谢楼上回复



现在换用outlook explore测试

果然需要通过选中需要身份验证才能发件

看了一下日志和error信息。



不选身份验证如下:

outlook error信息是Helo command rejected: need fu ...




如果你的mynetworks参数包括你的网段,勾不勾选需要认证都可以发信收信的

还有一点是当初在编译postfix的时候就直接支持mysql ,为什么还需要用通过authlib来连接mysql呢?
-------这个是起桥梁作用吧,postfix编译支持mysql只是支持这个backend而已

论坛徽章:
0
5 [报告]
发表于 2009-09-07 12:53 |只看该作者
原帖由 ruochen 于 2009-9-7 12:17 发表




如果你的mynetworks参数包括你的网段,勾不勾选需要认证都可以发信收信的

还有一点是当初在编译postfix的时候就直接支持mysql ,为什么还需要用通过authlib来连接mysql呢?
-------这个是起桥梁作用 ...



服务器是放在机房要加强安全,所以准备加ESMTP认证。要不要那个机器中毒了乱发邮件。虽然如果帐号泄密也会乱发邮件,如果用ESMTP在事后查起来能相对好一点。还有看到网上一些人利用mynetworks 的漏洞吧自己ip伪造成127.0.0.X 或 192.168.0.X吧服务器当成open relay。不知道是真是假。
第二个问题多谢版主。

论坛徽章:
0
6 [报告]
发表于 2009-09-07 13:53 |只看该作者
还有一点是当初在编译postfix的时候就直接支持mysql ,为什么还需要用通过authlib来连接mysql呢?


这个理解不太对。你的postfix是通过sasl认证的吧。sasl是调用的authlib来做认证的吧。那就是authlib读Mysql来认证的

论坛徽章:
0
7 [报告]
发表于 2009-09-07 14:20 |只看该作者
原帖由 scyzxp 于 2009-9-7 13:53 发表


这个理解不太对。你的postfix是通过sasl认证的吧。sasl是调用的authlib来做认证的吧。那就是authlib读Mysql来认证的


那就是说在编译postfix时不用加入mysql的目录在日后也能通过authlib来用mysql认证?
还有那个sals如何强制esmtp的问题...

论坛徽章:
0
8 [报告]
发表于 2009-09-07 14:41 |只看该作者
原帖由 minmig 于 2009-9-7 14:20 发表


那就是说在编译postfix时不用加入mysql的目录在日后也能通过authlib来用mysql认证?
还有那个sals如何强制esmtp的问题...



postfix+mysql与验证没有任何关系。

论坛徽章:
0
9 [报告]
发表于 2009-09-07 14:50 |只看该作者
原帖由 scyzxp 于 2009-9-7 14:41 发表



postfix+mysql与验证没有任何关系。


这个是另外一个问题,我有点疑问随口问的。
认证的问题还是要看sasl哪里配,让他体现出来。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP