免费注册 查看新帖 |

Chinaunix

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

[Mail] 求助,postfix不可以给外域发邮件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-03-24 11:41 |只看该作者 |倒序浏览
postcon -n的结果
  1. broken_sasl_auth_clients = yes
  2. command_directory = /usr/sbin
  3. config_directory = /etc/postfix
  4. daemon_directory = /usr/libexec/postfix
  5. data_directory = /var/lib/postfix
  6. debug_peer_level = 3
  7. home_mailbox = .maildir/
  8. html_directory = /usr/share/doc/postfix
  9. inet_interfaces = all
  10. mail_owner = postfix
  11. mailq_path = /usr/bin/mailq
  12. manpage_directory = /usr/local/man
  13. mydestination =
  14. mydomain = example.com
  15. myhostname = mail.example.com
  16. mynetworks = 192.168.90.0/24, 127.0.0.0/8
  17. mynetworks_style = subnet
  18. myorigin = $myhostname
  19. newaliases_path = /usr/bin/newaliases
  20. queue_directory = /var/spool/postfix
  21. readme_directory = /usr/share/doc/postfix/readme
  22. sample_directory = /etc/postfix
  23. sendmail_path = /usr/sbin/sendmail
  24. setgid_group = postdrop
  25. smtpd_client_restrictions = permit_sasl_authenticated
  26. smtpd_recipient_restrictions = permit_sasl_authenticated        reject
  27. smtpd_sasl_auth_enable = yes
  28. smtpd_sasl_path = private/auth
  29. smtpd_sasl_security_options = noanonymous
  30. smtpd_sasl_type = dovecot
  31. unknown_local_recipient_reject_code = 550
  32. virtual_alias_maps = mysql:/etc/postfix/valias-mysql.cf
  33. virtual_gid_maps = static:500
  34. virtual_mailbox_base = /var/mailbox/
  35. virtual_mailbox_domains = static:example.com
  36. virtual_mailbox_maps = mysql:/etc/postfix/vmailbox-mysql.cf
  37. virtual_minimum_uid = 100
  38. virtual_transport = dovecot
  39. virtual_uid_maps = static:500
复制代码
vdomain-mysql.cf
  1. user = root
  2. password = 123456
  3. dbname = extmail
  4. query = select domain from domain;
复制代码
vmailbox-mysql.cf

  1. user = root
  2. password = 123456
  3. dbname = extmail
  4. query = select maildir from mailbox where uid='%u' and domain='%d' and active=1
复制代码
valias-mysql.cf

  1. user = root
  2. password = 123456
  3. dbname = extmail
  4. query = select goto  from alias where address='%s'
复制代码
master.cf

  1. #
  2. # Postfix master process configuration file.  For details on the format
  3. # of the file, see the master(5) manual page (command: "man 5 master").
  4. #
  5. # Do not forget to execute "postfix reload" after editing this file.
  6. #
  7. # ==========================================================================
  8. # service type  private unpriv  chroot  wakeup  maxproc command + args
  9. #               (yes)   (yes)   (yes)   (never) (100)
  10. # ==========================================================================
  11. smtp      inet  n       -       n       -       -       smtpd
  12. #        -o content_filter=dspam
  13. #submission inet n       -       n       -       -       smtpd
  14. #  -o smtpd_tls_security_level=encrypt
  15. #  -o smtpd_sasl_auth_enable=yes
  16. #  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  17. #  -o milter_macro_daemon_name=ORIGINATING
  18. #smtps     inet  n       -       n       -       -       smtpd
  19. #  -o smtpd_tls_wrappermode=yes
  20. #  -o smtpd_sasl_auth_enable=yes
  21. #  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  22. #  -o milter_macro_daemon_name=ORIGINATING
  23. #628      inet  n       -       n       -       -       qmqpd
  24. pickup    fifo  n       -       n       60      1       pickup
  25. cleanup   unix  n       -       n       -       0       cleanup
  26. qmgr      fifo  n       -       n       300     1       qmgr
  27. #qmgr     fifo  n       -       n       300     1       oqmgr
  28. tlsmgr    unix  -       -       n       1000?   1       tlsmgr
  29. rewrite   unix  -       -       n       -       -       trivial-rewrite
  30. bounce    unix  -       -       n       -       0       bounce
  31. defer     unix  -       -       n       -       0       bounce
  32. trace     unix  -       -       n       -       0       bounce
  33. verify    unix  -       -       n       -       1       verify
  34. flush     unix  n       -       n       1000?   0       flush
  35. proxymap  unix  -       -       n       -       -       proxymap
  36. proxywrite unix -       -       n       -       1       proxymap
  37. smtp      unix  -       -       n       -       -       smtp
  38. # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
  39. relay     unix  -       -       n       -       -       smtp
  40.         -o smtp_fallback_relay=
  41. #       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
  42. showq     unix  n       -       n       -       -       showq
  43. error     unix  -       -       n       -       -       error
  44. retry     unix  -       -       n       -       -       error
  45. discard   unix  -       -       n       -       -       discard
  46. local     unix  -       n       n       -       -       local
  47. virtual   unix  -       n       n       -       -       virtual
  48. lmtp      unix  -       -       n       -       -       lmtp
  49. anvil     unix  -       -       n       -       1       anvil
  50. scache    unix  -       -       n       -       1       scache
  51. #
  52. # ====================================================================
  53. # Interfaces to non-Postfix software. Be sure to examine the manual
  54. # pages of the non-Postfix software to find out what options it wants.
  55. #
  56. # Many of the following services use the Postfix pipe(8) delivery
  57. # agent.  See the pipe(8) man page for information about ${recipient}
  58. # and other message envelope options.
  59. # ====================================================================
  60. #
  61. # maildrop. See the Postfix MAILDROP_README file for details.
  62. # Also specify in main.cf: maildrop_destination_recipient_limit=1
  63. #
  64. #maildrop  unix  -       n       n       -       -       pipe
  65. #  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
  66. #
  67. # ====================================================================
  68. #
  69. # The Cyrus deliver program has changed incompatibly, multiple times.
  70. #
  71. #old-cyrus unix  -       n       n       -       -       pipe
  72. #  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
  73. #
  74. # ====================================================================
  75. #
  76. # Cyrus 2.1.5 (Amos Gouaux)
  77. # Also specify in main.cf: cyrus_destination_recipient_limit=1
  78. #
  79. #cyrus     unix  -       n       n       -       -       pipe
  80. #  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
  81. #
  82. # ====================================================================
  83. #
  84. # See the Postfix UUCP_README file for configuration details.
  85. #
  86. #uucp      unix  -       n       n       -       -       pipe
  87. #  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
  88. #
  89. # ====================================================================
  90. #
  91. # Other external delivery methods.
  92. #
  93. #ifmail    unix  -       n       n       -       -       pipe
  94. #  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
  95. #
  96. #bsmtp     unix  -       n       n       -       -       pipe
  97. #  flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
  98. #
  99. #scalemail-backend unix -       n       n       -       2       pipe
  100. #  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
  101. #  ${nexthop} ${user} ${extension}
  102. #
  103. #mailman   unix  -       n       n       -       -       pipe
  104. #  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  105. #  ${nexthop} ${user}
  106. #smtp-amavis unix - - n - 2 smtp
  107. #        -o smtp_data_done_timeout=1200
  108. #        -o disable_dns_lookups=yes
  109. #127.0.0.1:10025 inet n - n - - smtpd
  110. #        -o content_filter=
  111. #        -o local_recipient_maps=
  112. #        -o relay_recipient_maps=
  113. #        -o smtpd_restriction_classes=
  114. #        -o smtpd_client_restrictions=
  115. #        -o smtpd_helo_restrictions=
  116. #        -o smtpd_sender_restrictions=
  117. #        -o mynetworks=127.0.0.0/8
复制代码
dovecot -n 的内容

  1. # 1.0.7: /etc/dovecot.conf
  2. protocols: imap pop3
  3. login_dir: /var/run/dovecot/login
  4. login_executable(default): /usr/libexec/dovecot/imap-login
  5. login_executable(imap): /usr/libexec/dovecot/imap-login
  6. login_executable(pop3): /usr/libexec/dovecot/pop3-login
  7. mail_privileged_group: mailbox
  8. mail_location: maildir:/var/mailbox/
  9. mail_debug: yes
  10. mail_executable(default): /usr/libexec/dovecot/imap
  11. mail_executable(imap): /usr/libexec/dovecot/imap
  12. mail_executable(pop3): /usr/libexec/dovecot/pop3
  13. mail_plugin_dir(default): /usr/lib/dovecot/imap
  14. mail_plugin_dir(imap): /usr/lib/dovecot/imap
  15. mail_plugin_dir(pop3): /usr/lib/dovecot/pop3
  16. auth default:
  17.   mechanisms: plain login
  18.   debug: yes
  19.   debug_passwords: yes
  20.   passdb:
  21.     driver: sql
  22.     args: /etc/dovecot-mysql.conf
  23.   userdb:
  24.     driver: prefetch
  25.   socket:
  26.     type: listen
  27.     client:
  28.       path: /var/spool/postfix/private/auth
  29.       mode: 432
  30.       user: postfix
  31.       group: postfix
  32.     master:
  33.       path: /var/run/dovecot/auth-master
  34.       mode: 384
复制代码
dovecot-mysql.conf

  1. driver = mysql
  2. connect = host=localhost dbname=extmail user=root password=123456
  3. default_pass_scheme = PLAIN-MD5
  4. password_query = SELECT username AS user,password,CONCAT('/var/mailbox/',TRIM(TRAILING '/' FROM maildir)) AS userdb_mail,500 AS userdb_uid,500 AS userdb_gid  FROM mailbox WHERE uid = '%n' AND domain = '%d' AND active = 1
复制代码
maillog的内容

  1. Mar 25 11:22:28 localhost postfix/smtpd[8281]: connect from unknown[192.168.90.87]
  2. Mar 25 11:22:28 localhost dovecot: auth(default): client in: AUTH       8       PLAIN   ser
  3. vice=smtp    nologin lip=192.168.90.87       rip=192.168.90.87       resp=AHRlc3QxQHB1amlhL
  4. mNvbQAxMjM0NTY=
  5. Mar 25 11:22:28 localhost dovecot: auth-worker(default): sql(test1@example.com,192.168.90.87)
  6. : query: SELECT username AS user,password,CONCAT('/var/mailbox/',TRIM(TRAILING '/' FROM mai
  7. ldir)) AS userdb_mail,500 AS userdb_uid,500 AS userdb_gid  FROM mailbox WHERE uid = 'test1'
  8. AND domain = 'example.com' AND active = 1
  9. Mar 25 11:22:28 localhost dovecot: auth(default): client out: OK        8       user=test1@
  10. example.com
  11. Mar 25 11:22:28 localhost postfix/smtpd[8281]: NOQUEUE: reject: RCPT from unknown[192.168.9
  12. 0.87]: 550 5.1.1 <li.xm87@gmail.com>: Recipient address rejected: User unknown in virtual m
  13. ailbox table; from=<test1@example.com> to=<li.xm87@gmail.com> proto=ESMTP helo=<[192.168.90.8
  14. 7]>
  15. Mar 25 11:22:28 localhost postfix/smtpd[8281]: disconnect from unknown[192.168.90.87]
复制代码
postfix使用dovecot做sasl验证,example.com是在本地架了一个dns服务器解析的,表现的症状为给外域发信的时候,回到数据库里查看收件人信息,当然是找不到了,然后就出现了日志中的错误了。小弟初学,求大牛指教

论坛徽章:
0
2 [报告]
发表于 2010-03-24 11:57 |只看该作者
补充一下
dig MX example.com的结果

  1. ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> MX example.com
  2. ;; global options:  printcmd
  3. ;; Got answer:
  4. ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42604
  5. ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

  6. ;; QUESTION SECTION:
  7. ;example.com.                        IN        MX

  8. ;; ANSWER SECTION:
  9. example.com.                600        IN        MX        10 example.com.

  10. ;; AUTHORITY SECTION:
  11. example.com.                600        IN        NS        ns.example.com.

  12. ;; ADDITIONAL SECTION:
  13. example.com.                600        IN        A        192.168.90.87
  14. ns.example.com.                600        IN        A        192.168.90.87

  15. ;; Query time: 1 msec
  16. ;; SERVER: 192.168.90.87#53(192.168.90.87)
  17. ;; WHEN: Thu Mar 25 11:54:18 2010
  18. ;; MSG SIZE  rcvd: 92
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP