我在RHEL6上运行postfix :
# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.6 (Santiago) # rpm -q postfix postfix-2.6.6-6.el6_5.x86_64 #
我试图执行以下内容:
/etc/postfix/access – 访问 – postfix SMTP服务器访问表:
# /etc/postfix/main.cf: # smtpd_client_restrictions = # check_client_access hash:/etc/postfix/access # # /etc/postfix/access: # 1.2.3 REJECT # 1.2.3.4 OK # # Execute the command "postmap /etc/postfix/access" after # editing the file.
postconf – Postfixconfiguration实用程序:
# postconf -n | grep access smtpd_client_restrictions = check_client_access hash:/etc/postfix/access #
/etc/postfix/access(.db) :
# grep -v ^# access 10.52.11.97 OK #
postmap – Postfix查找表pipe理:
# postmap /etc/postfix/access # echo $? 0 #
每当试图中继电子邮件,我得到以下:
/var/log/maillog :
postfix/smtpd[1515]: connect from XXX[10.52.11.97] postfix/smtpd[1515]: NOQUEUE: reject: RCPT from XXX[10.52.11.97]: 554 5.7.1 <X@XX>: Relay access denied; from=<X@XX> to=<X@XX> proto=SMTP helo=<HELO> postfix/smtpd[1515]: lost connection after RCPT from XXX[10.52.11.97] postfix/smtpd[1515]: disconnect from XXX[10.52.11.97]
UPDATE
每@yoonix,@masegaloeh,我发布'smtpd _ * _ restrictions'以及:
$ egrep 'smtp.*restriction' * access:# text of smtpd_end_of_data_restrictions. access:# smtpd_client_restrictions = main.cf:# through Postfix. See the smtpd_recipient_restrictions parameter main.cf:# relay mail to. See the smtpd_recipient_restrictions description in master.cf:# -o smtpd_client_restrictions=$mua_client_restrictions master.cf:# -o smtpd_helo_restrictions=$mua_helo_restrictions master.cf:# -o smtpd_sender_restrictions=$mua_sender_restrictions master.cf:# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject master.cf:# -o smtpd_client_restrictions=$mua_client_restrictions master.cf:# -o smtpd_helo_restrictions=$mua_helo_restrictions master.cf:# -o smtpd_sender_restrictions=$mua_sender_restrictions master.cf:# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject $
似乎一切都被注释掉了。
那么,你应该告诉我们你的目标和尝试解决scheme。 没有目标,我们不能给你select的解决scheme。
从评论看,看起来像你想要白名单一些客户端通过您的服务器进行中继。 Postfix本身具有通过smtpd _ * _限制的ACL中继机制 。 要知道在postfix中启用了什么ACL,可以运行命令
postconf | grep _restrictions
默认情况下,postfix只能由permit_mynetworks , permit_sasl_authenticated和defer_unauth_destination smtpd_relay_restrictions 。 这意味着,后缀将
mynetworks参数中定义的IP地址,则允许中继 您也可以通过man 5 postconf页面获取有关该参数的信息。
这就解释了为什么当你将其IP地址放在mynetworks参数中时, postfix允许来自特定客户端的中继。
关于通过check_client_access你的初始解决scheme,如果你把它放在defer_unauth_destination之前,它也应该工作。 所以,你必须把这个configuration放在main.cf
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, check_client_access hash:/etc/postfix/access, defer_unauth_destination
把它smtpd_client_restrictions将无法正常工作,因为postfix将检查每个阶段(…,客户端,helo,发件人,中继,收件人,…)的限制。 有关更多信息,请参阅Postfix SMTP中继和访问控制页面