Postfix: How to reject emails to anyone not listed in the virtual alias list?

1

I've set up a Postfix SMTP server on my Debian server and configured it to forward emails to my main email address using the virtual_alias_maps option. Sending and receiving emails works fine and emails addressed to non-existing users are rejected.

However, there are several users on the server that should not be able to receive emails. Is it possible to configure Postfix to reject emails to any user that is not mentioned in the virtual alias list (or some separate list, if that's easier)?

I've found some information on rejecting emails to specific users, but it would be much easier if I didn't have to add every user to a blacklist.

n.st

Posted 2013-02-11T02:11:18.707

Reputation: 1 538

Answers

1

Have a look at http://www.postfix.org/LOCAL_RECIPIENT_README.html for an answer. (Specifically look at the Local recipient table format).

IE, create a map with local recipients you want to receive email, add/modify the local_recipient_maps configuration variable to read from that file. (There are a number of ways of doing this, depending on your requirements - I tend to store mine in a database, but for a small system, just create a text file called /etc/postfix/local_recipientlist with the contents:

username@domain.name   exists
username2@domain.name  exists

Then run postmap /etc/postfix/local_recipientlist (And specify local_recipient_maps=hash:/etc/postfix/local_recipientlist in main.cf)

davidgo

Posted 2013-02-11T02:11:18.707

Reputation: 49 152