Source: http://www.linuxmail.info/postfix-restrict-sender-recipient/
This article describes how to configure Postfix to restrict mails from a sender, to a recipient, or both.
Restrict Sender
This section describes how to allow/reject a specific sender or a specific domain.
1. Edit the file
/etc/postfix/main.cf and add the line below.
smtpd_sender_restrictions =
check_sender_access hash:/etc/postfix/sender_access
2. Create the file
/etc/postfix/sender_access and review the example below.
janedoe@acme.local REJECT
bugsbunny@acme.com OK
acme.com REJECT
3. Type in the command below in a terminal window to create a hash file.
postmap /etc/postfix/sender_access
Restrict Recipient
This section describes how to allow/reject a specific recipient or a specific domain.
1. Edit the file
/etc/postfix/main.cf and add the line below.
smtpd_recipient_restrictions =
check_recipient_access hash:/etc/postfix/recipient_access,
reject_unauth_destinations
2. Create the file
/etc/postfix/recipient_access and review the example below.
janedoe@acme.local REJECT
bugsbunny@acme.com OK
acme.com REJECT
3. Type in the command below in a terminal window to create a hash file.
postmap /etc/postfix/recipient_access
Restrict Sender and Recipient
This section describes how to restrict both the sender and recipient. Example usage of this is when you have a private domain which should not be allowed to send to the internet.
1. Edit the file
/etc/postfix/main.cf and add the lines below.
smtpd_recipient_restrictions =
check_sender_access hash:/etc/postfix/sender_access,
reject_unauth_destinations
smtpd_restriction_classes = local_only
local_only = check_recipient_access hash:/etc/postfix/local_domains,
reject
2. Create the file
/etc/postfix/sender_access and review the example below.
acme.local local_only
3. Create the file
/etc/postfix/local_domains and review the example below.
acme.local OK
4. Type in the command belows in a terminal window to create the hash files.
postmap /etc/postfix/sender_access
postmap /etc/postfix/local_domains
No comments:
Post a Comment