??璐達?http://www.5dmail.net/html/2007-3-14/2007314195005.htm
postfix???剁?瑰???ㄦ?鋒?跺????浠剁??楂?绾ц?塊???у?舵?規?
??浠跺??ㄤ腑???藉????濡?涓???搴??ㄩ??姹?锛?
??????A???芥?跺?版?ヨ??163.com??sina.com????浠舵????????B???界????ㄧ?ㄦ?峰????浠訛?涓???璁稿??澶?缃?????浠訛?浣???浠ユ?跺?闆?缃???浠舵??涓葷?″??浠ユ?跺??????澶?缃???浠?.....
Hello!
I have the same problem:
1. I need to permit some internal users (not all) to send mail to any
external user (Internet)
2. I need to permite any external user to send mail to some my internal
users (not all)
In fact, the problem is: just "some" of my internal users have permission to
receive mail from and send mail to the Internet.
How can I solve this?
View this article only
?伴?葷兢缁?锛?mailing.postfix.users
?ユ??锛?2002-12-04 15:18:04 PST
In the example below, the same list of restricted_users is used for
controlling both who can send and who can receive internet mail. If you
don't require the local_plus feature, just leave that part out.
- in main.cf:
-
use restriction classes to make restricted_users file more readable.
smtpd_restriction_classes = local_only, local_plus
local_only =
reject_unauth_destination
permit_mynetworks
reject
local_plus =
check_recipient_access hash:/etc/postfix/local_plus
check_sender_access hash:/etc/postfix/local_plus
reject_unauth_destination
permit_mynetworks
reject
-
this is the default setting, required for this setup.
smtpd_delay_reject = yes
-
we'll do this in sender restrictions to avoid open relay problems.
smtpd_sender_restrictions =
check_sender_access hash:/etc/postfix/restricted_users
check_recipient_access hash:/etc/postfix/restricted_users
and in /etc/postfix/restricted_users
# /etc/postfix/restricted_users
# this file contains a list of users only allowed to send and receive local
# postmap this file after changes
# local users not listed here have no restrictions
[email?protected] local_only
[email?protected] local_plus
and in /etc/postfix/local_plus:
# /etc/postfix/local_plus
# this file contains allowed destinations and senders
# for users restricted to local_plus
# postmap this file after changes
miproveedor.com OK
Remember to "postmap local_plus" and "postmap restricted_users" after
making changes to them.
Remember to run "postfix reload" after changing main.cf
hzqbbc?????舵?規?锛?杞???hzqbbc??blog锛?
????涓??規?锛?
1) smtpd_restriction_classes = local_only
璁劇疆涓?涓????剁被????local_only锛??跺??????access(5)???煎???涓?涓?璁塊???у?訛?
local_only = check_recipient_access hash:/etc/postfix/maps/my_rcpt
??浠?y_rcpt??瀹癸?
163.com RELAY21cn.com RELAYhzqbbc.com RELAY
?跺??锛?璁劇疆锛?
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/maps/mysender
mysender??瀹癸?
[email?protected] local_only
杩??峰?℃??Mail from:
??杩?涓??規?锛?杩???浠ヨ?劇疆?村???绫誨??锛?渚?濡?remote_only浠ュ??涓????剁??甯??風????浣?杩?浜??藉??瀵?rom:???躲????涓?涓?绠℃????ASL????????浠ユ??涓?瀹?缂洪?楓??涓?杩?锛?宸茬?杈懼?扮????浜???
2)浣跨??napshot????policy绛????規????涓?hash琛ㄦ????缃???浠訛??ゆ??瀵瑰???sender??recipient?????歸??锛??歸??灏辮???OK????DUNNO????RELAY绛?锛?????ELAY宸茬?杩??訛?杩?涓???postfix 1.1.x??锛?濡???涓??歸??灏辮?????璇?浠g??
??postfix??甯???smtpd-policy.pl妯″?锛?淇??逛?涓?灏卞??浠ヤ嬌?ㄤ???璇??????POLICY_README绛???
????宸辯??渚?瀛?锛?
1)瀹?涔?绫?end2hrall锛?
smtpd_restriction_classes = send2hrall
send2hrall =
??? check_sender_access mysql:/usr/local/etc/postfix/mysql-send2hrall.cf,reject
??缃???浠?send2hrall.cf??瀹瑰?涓?锛?
hosts = localhost
user = mailuser
password = mailpasswd
dbname = maildatabase
query = select access from mysql-send2hrall where source = '%s'
2)瀵瑰??缁? [email?protected]????浠朵漢杩?琛?瀹℃?革? smtpd_sender_restrictions =涓?娣誨??锛? ??? ??? check_recipient_access hash:/usr/local/etc/postfix/hrallclass ??usr/local/etc/postfix??褰?涓?寤虹??璇ユ??浠? #?ee /usr/local/etc/postfix/hrallclass # postmap /usr/local/etc/postfix/hrallclass(浼?????hrallclass.db) ??浠?usr/local/etc/postfix/hrallclass??瀹瑰?涓?锛? [email?protected]??? send2hrall ? 3)璁懼???版??琛?ysql-send2hrall璁闆???浜?浜哄??浠ョ? [email?protected]??????浠? ?版??搴?涓?寤虹??琛?ysql-send2hrall涓?浣跨?ㄧ??琛?? 琛ㄧ???濡?涓?锛? CREATE TABLE `mysql_send2hrall` (
? `id` int(11) unsigned NOT NULL auto_increment,
? `ctime` int(11) unsigned default NULL,
? `source` varchar(128) NOT NULL default '',
? `access` varchar(16) NOT NULL default '',
? `type` char(1) NOT NULL default 'S',
? PRIMARY KEY? (`id`),
? KEY `source` (`source`,`type`,`access`,`ctime`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=gb2312;
瀵瑰??版???煎?濡?涓? source???????????????????? access [email?protected]???? OK [email?protected]???? OK ? 杩?绋?澶ф?濡?涓?锛? ?? ??mtp??????浠剁???跺??锛???杩? check_recipient_access 涓??風?ワ? [email?protected]璇ラ??浠舵?ユ?剁???跺????瑕??規??绫?end2hrall?告?ワ???璇ョ被涓?瀹?涔?浜???浠朵漢?告?ョ????姹?锛?浠??版??搴?琛ㄤ腑?峰??姝ら??姹????蜂?缁?????璀?濡?涓?渚?涓?锛?濡?????浠朵漢?? [email?protected]锛??峰????缁???灏變負ok锛?杩???mtp灏?姝や漢??缁? [email?protected]????浠惰?琛?姝e父????锛??朵?濡???涓??ㄦ?版??搴?琛?ysql-send2hrall涓???浜猴?灏??規??涓???eject??瀹?涔?杩?琛???缁??