In my mailing list system (Mailman) I needed to make sure that no one else than a certain list of senders would be able to send commands via email to the email@example.com. Since I could not find this feature in Mailman I decided to go the Postfix way. So here is the configuration I made which works very well.
Note: The disadvantage of this solution is that only the system administrator can change the content of the protected receivers and permitted senders lists.
– Create a verification class which we will call: permitted_senders_list
– Create 2 lists and hash them:
– Tell postfix (in /etc/postfix/main.cf) to use a special test which will check if the recipient is a protected one and allow only certain senders to send to them.
smtpd_restriction_classes = permitted_senders_list
permitted_senders_list = check_sender_access hash:/etc/postfix/commands_permitted_senders, reject
Content of /etc/postfix/commands_protected_recipients
Content of /etc/postfix/commands_permitted_senders
Hash both files:
Reload Portfix configuration:
Now only user which have the
in their Mail Headers will get through to the accounts
All other senders will be refused.
Note: This setting will not interfere with any other sending/receiving of other email accounts at all.
That was it, Happy Postfixing