[CentOS] restrict postfix to only certain users getting incoming mail

Bob Hoffman

bob at bobhoffman.com
Tue Mar 6 04:50:21 UTC 2012


Perhaps I am trying to do the impossible.
centos6, spamassassin, procmail, dovecot, postfix.

Postfix, by default, accepts all incoming mail to any user listed in the 
shadow/passwd and alias files.

I cannot find a way to stop that without manually blocking each non 
wanted user (like nobody, apache) without killing local delivery.

For most of the users listed in those files, who cares. However for one, 
root, this is a massive issue.

Root gets a lot of mail from errors on the system. Preventing local 
delivery (or through the alias file, delivery through root to another 
user) makes root never receive those important mails.

Not preventing root from incoming mails means root at example.com can be 
slammed with spam.

Local and external mail all seem to go through all of the programs 
(postfix, procmail, spamassassin, dovecot).

Local delivery of mails is needed for root.


What I would like is to just tell postfix to only allow incoming mail 
for user1 and user2 and reject all...but only from external sources, not 
locally sent mail.

Postfix does seem to allow you to limit who can send mail out of the 
server though...

I have 2 books on postfix here and spent many days online but I do not 
see the solution short of /dev/null or reject of all mail, local or 
external, of root.

perplexed.



More information about the CentOS mailing list