Le blogouille de Caro et Nico

Entre famille, sport et aventures !

Archive dans 4 avril 2019

Postfix : reject specific source domains

Edit the postfix main.cf configuration file to add a rejection on sender source :

smtpd_sender_restrictions = pcre:/etc/postfix/rejected_domains

Create the rejected_domains file, enter proper filtering like :

/facture.info$/ PERMIT specific sender from @facture.info
/\.info$/   REJECT All info other info domains are rejected

Compile the file into a database with postmap command :

postmap rejected_domains

This will update/create the postmap rejected_domains.db

Reload the postfix configuration

service postfix reload