求助,postfix不可以給外域發郵件
postcon -n的結果broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 3
home_mailbox = .maildir/
html_directory = /usr/share/doc/postfix
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
mydestination =
mydomain = example.com
myhostname = mail.example.com
mynetworks = 192.168.90.0/24, 127.0.0.0/8
mynetworks_style = subnet
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/readme
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_recipient_restrictions = permit_sasl_authenticated reject
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/valias-mysql.cf
virtual_gid_maps = static:500
virtual_mailbox_base = /var/mailbox/
virtual_mailbox_domains = static:example.com
virtual_mailbox_maps = mysql:/etc/postfix/vmailbox-mysql.cf
virtual_minimum_uid = 100
virtual_transport = dovecot
virtual_uid_maps = static:500
vdomain-mysql.cfuser = root
password = 123456
dbname = extmail
query = select domain from domain;
vmailbox-mysql.cf
user = root
password = 123456
dbname = extmail
query = select maildir from mailbox where uid='%u' and domain='%d' and active=1
valias-mysql.cf
user = root
password = 123456
dbname = extmail
query = select goto from alias where address='%s'
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 - n - - smtpd
# -o content_filter=dspam
#submission inet n - 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 - 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 - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - n - - smtp
-o smtp_fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 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/local/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# 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}
#
# ====================================================================
#
# 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/local/sbin/bsmtp -f $sender $nexthop $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}
#smtp-amavis unix - - n - 2 smtp
# -o smtp_data_done_timeout=1200
# -o disable_dns_lookups=yes
#127.0.0.1:10025 inet n - n - - smtpd
# -o content_filter=
# -o local_recipient_maps=
# -o relay_recipient_maps=
# -o smtpd_restriction_classes=
# -o smtpd_client_restrictions=
# -o smtpd_helo_restrictions=
# -o smtpd_sender_restrictions=
# -o mynetworks=127.0.0.0/8
dovecot -n 的內容
# 1.0.7: /etc/dovecot.conf
protocols: imap pop3
login_dir: /var/run/dovecot/login
login_executable(default): /usr/libexec/dovecot/imap-login
login_executable(imap): /usr/libexec/dovecot/imap-login
login_executable(pop3): /usr/libexec/dovecot/pop3-login
mail_privileged_group: mailbox
mail_location: maildir:/var/mailbox/
mail_debug: yes
mail_executable(default): /usr/libexec/dovecot/imap
mail_executable(imap): /usr/libexec/dovecot/imap
mail_executable(pop3): /usr/libexec/dovecot/pop3
mail_plugin_dir(default): /usr/lib/dovecot/imap
mail_plugin_dir(imap): /usr/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/pop3
auth default:
mechanisms: plain login
debug: yes
debug_passwords: yes
passdb:
driver: sql
args: /etc/dovecot-mysql.conf
userdb:
driver: prefetch
socket:
type: listen
client:
path: /var/spool/postfix/private/auth
mode: 432
user: postfix
group: postfix
master:
path: /var/run/dovecot/auth-master
mode: 384
dovecot-mysql.conf
driver = mysql
connect = host=localhost dbname=extmail user=root password=123456
default_pass_scheme = PLAIN-MD5
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的內容
Mar 25 11:22:28 localhost postfix/smtpd: connect from unknown
Mar 25 11:22:28 localhost dovecot: auth(default): client in: AUTH 8 PLAIN ser
vice=smtp nologin lip=192.168.90.87 rip=192.168.90.87 resp=AHRlc3QxQHB1amlhL
mNvbQAxMjM0NTY=
Mar 25 11:22:28 localhost dovecot: auth-worker(default): sql(test1@example.com,192.168.90.87)
: query: SELECT username AS user,password,CONCAT('/var/mailbox/',TRIM(TRAILING '/' FROM mai
ldir)) AS userdb_mail,500 AS userdb_uid,500 AS userdb_gid FROM mailbox WHERE uid = 'test1'
AND domain = 'example.com' AND active = 1
Mar 25 11:22:28 localhost dovecot: auth(default): client out: OK 8 user=test1@
example.com
Mar 25 11:22:28 localhost postfix/smtpd: NOQUEUE: reject: RCPT from unknown[192.168.9
0.87]: 550 5.1.1 <li.xm87@gmail.com>: Recipient address rejected: User unknown in virtual m
ailbox table; from=<test1@example.com> to=<li.xm87@gmail.com> proto=ESMTP helo=<[192.168.90.8
7]>
Mar 25 11:22:28 localhost postfix/smtpd: disconnect from unknown
postfix使用dovecot做sasl驗證,example.com是在本地架了一個dns伺服器解析的,表現的癥狀為給外域發信的時候,回到資料庫里查看收件人信息,當然是找不到了,然後就出現了日誌中的錯誤了。小弟初學,求大牛指教
《解決方案》
補充一下
dig MX example.com的結果
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> MX example.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42604
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2
;; QUESTION SECTION:
;example.com. IN MX
;; ANSWER SECTION:
example.com. 600 IN MX 10 example.com.
;; AUTHORITY SECTION:
example.com. 600 IN NS ns.example.com.
;; ADDITIONAL SECTION:
example.com. 600 IN A 192.168.90.87
ns.example.com. 600 IN A 192.168.90.87
;; Query time: 1 msec
;; SERVER: 192.168.90.87#53(192.168.90.87)
;; WHEN: Thu Mar 25 11:54:18 2010
;; MSG SIZE rcvd: 92