Postfix whitelist

From vpsget wiki
Jump to: navigation, search

These steps will allow specified mailboxes to send mail from your postfix mailserver and restrict the others.

Tested on Centos 6

Create the whitelist

nano /etc/postfix/whitelist

You can allow specified mailboxes, all mailboxes of the domain or all mailboxes of the domain and subdomains.

Respective lines of these three types of permissions:

user@examlpe.com OK
@examlpe.com OK
.example.com OK

Let postfix know about your database:

postmap /etc/postfix/whitelist

Configure postfix:

nano /etc/postfix/main.cf

Add these lines:

smtpd_sender_restrictions =
    check_sender_access  hash:/etc/postfix/whitelist,
    permit_sasl_authenticated,
    permit_mynetworks,
    reject_non_fqdn_sender,
    reject_unknown_sender_domain,
    permit

Restart postfix

service postfix restart