歡迎您光臨本站 註冊首頁

warning: unknown smtpd restriction:emailserver1.test/admin/MailDir/

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

warning: unknown smtpd restriction:emailserver1.test/admin/MailDir/

Hi, 大家好


我按照 http://www.postfixvirtual.net 上的方法安裝了一個Postfix+Courier-IMAP+OpenSSL的環境

但是在發送郵件的時候發生奇怪的錯誤

從maillog中獲得的錯誤信息:
Jul 27 20:07:29 emailserver postfix/smtpd: connect from unknown
Jul 27 20:07:29 emailserver postfix/smtpd: warning: unknown smtpd restriction: "emailserver1.test/admin/MailDir/"
Jul 27 20:07:29 emailserver postfix/smtpd: NOQUEUE: reject: RCPT from unknown: 451 Server configuration error; from=<admin@emailserver1.test> to=<admin@emailserver1.test> proto=ESMTP helo=<homecomputer>
Jul 27 20:07:29 emailserver postfix/cleanup: 556B586A4: message-id=<20090727120729.556B586A4@emailserver1>
Jul 27 20:07:29 emailserver postfix/qmgr: 556B586A4: from=<double-bounce@emailserver1.emailserver1.test>, size=1004, nrcpt=1 (queue active)
Jul 27 20:07:29 emailserver postfix/smtpd: disconnect from unknown

經過排查問題出在 main.cf 中的一句配置上:

smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-sender.cf

mysql-sender.cf的內容 :

user = vmailuser
password = password123
dbname = mail
query = SELECT maildir FROM postfix_users where email='%s' and postfix = 'y'
hosts = unix:/tmp/mysqld.sock


誰能給點建議?

我的main.cf文件 :

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = /usr/libexec/postfix

mail_owner = postfix

unknown_local_recipient_reject_code = 550

debug_peer_level = 2

debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail

newaliases_path = /usr/bin/newaliases

mailq_path = /usr/bin/mailq

setgid_group = postdrop

html_directory = no

manpage_directory = /usr/local/man

sample_directory = /etc/postfix

readme_directory = no

######################################################################################################

myhostname = emailserver1
mydomain = emailserver1.test
mydestination = $myhostname
local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname
home_mailbox = Maildir/

smtpd_sasl_auth_enable = yes
smtpd_sasl2_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes

smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,
            check_recipient_access mysql:/etc/postfix/mysql-recipient.cf,reject_unauth_destination,permit



# The above line must be fitted in one line DONT FORGET
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-sender.cf,permit
smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-client.cf,permit

alias_maps = mysql:/etc/postfix/mysql-aliases.cf
relocated_maps = mysql:/etc/postfix/mysql-relocated.cf

#for redirection
transport_maps = mysql:/etc/postfix/mysql-transport.cf
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop

#Domain storage
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-domains.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-alias-maps.cf
virtual_mailbox_base = /usr/local/vmail

#Email storage
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf
virtual_minimum_uid = 100
virtual_uid_maps = static:2000
virtual_gid_maps = static:2000

#Relayed domains
relay_domains = mysql:/etc/postfix/mysql-relay-domains.cf


# If you want to use TLS add three lines below
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/postfix/postfix.pem
smtpd_tls_key_file = $smtpd_tls_cert_file


# OPTIONAL PART
smtpd_helo_required = yes
disable_vrfy_command = yes
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_etrn_restrictions = reject

#Send user unknown for non-existent records.
show_user_unknown_table_name = no


[ 本帖最後由 jialiuonline 於 2009-7-29 12:58 編輯 ]
《解決方案》

將下面的註釋掉看看
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-sender.cf

[ 本帖最後由 ruochen 於 2009-7-29 15:24 編輯 ]
《解決方案》

回復 #2 ruochen 的帖子

註釋掉是可以解決這個問題,不過我想弄明白這個配置錯在哪裡
《解決方案》

SELECT maildir FROM postfix_users where email='%s' and postfix = 'y'

去你資料庫中查詢下
《解決方案》

資料庫中的postfix = 'y'這個條件有沒?
《解決方案》

原帖由 jialiuonline 於 2009-7-29 12:41 發表 http://bbs2.chinaunix.net/images/common/back.gif
註釋掉是可以解決這個問題,不過我想弄明白這個配置錯在哪裡


我想確認下是不是這個造成你問題的原因
《解決方案》

回復 #6 ruochen 的帖子

是這句話造成的這個問題,我在帖子里寫了,

SELECT maildir FROM postfix_users where email='%s' and postfix = 'y'
的查詢結果 是
emailserver1.test/admin/MailDir/


資料庫中的postfix = 'y'這個條件有沒?

有的
《解決方案》

原帖由 ruochen 於 2009-7-29 12:00 發表 http://bbs2.chinaunix.net/images/common/back.gif
將下面的註釋掉看看
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-sender.cf


在check前面加上下面的呢
permit_mynetworks,permit_sasl_authenticated,
《解決方案》

本帖最後由 mihello 於 2011-11-11 16:22 編輯

我也有類似的錯誤,解決了。是hash表與mysql表之間的差異造成的:
例如hash表裡的信息是
saber@example.com OK

那麼當使用mysql查詢表的時候 ,查詢結果只要 OK 不要加上saber@example.com
因為查詢的時候就是根據saber@example.com 來查詢有無 OK 。所以查詢結果里不可以有saber@example.com 信息。若加上就是,重複了!當然會報錯 configure error

[火星人 ] warning: unknown smtpd restriction:emailserver1.test/admin/MailDir/已經有821次圍觀

http://coctec.com/docs/service/show-post-13782.html