Postfix Liste blanche et liste noire

Librement traduit de http://www.linuxlasse.net/linux/howtos/Blacklist_and_Whitelist_with_Postfix

Nous pouvons jouer sur deux paramètres :

check_client_access
Bloque par IP, plage d'IP ou nom DNS

check_sender_access
Bloque par adresse email (champ FROM)

Il est important de définir check_client_access et check_sender_access en premier

smtpd_client_restrictions = permit_mynetworks, check_client_access hash:/etc/postfix/client_checks, check_sender_access hash:/etc/postfix/sender_checks

# Restricts which clients this system accepts SMTP connections from.
mondomain.com REJECT Fraud rejected
example.com REJECT No spammers
.example.com REJECT No spammers, from your subdomain
123.456.789.123 REJECT Your IP is spammer
123.456.789.0/24 REJECT Your IP range is spammer
321.987.654.321 OK
example1.com OK

# Restricts sender addresses this system accepts in MAIL FROM commands.
example.com REJECT env. from addr any@example.com rejected
.example.com REJECT env. from addr any@sub.example.com rejected
user@example.com REJECT We don't want your email
example2.com OK

postmap /etc/postfix/client_checks postmap /etc/postfix/sender_checks postfix reload

Postfix bloquer un domain ou une IP

Source : http://arnofear.free.fr/linux/template.php?tuto=22&page=1

# Permet de refuser la connexion SMTP pour les IP ou domaines contenus # dans ce fichier. smtpd_client_restrictions = check_client_access hash:/etc/postfix/blacklisted_sender

# Domaine ou IP.
rolexreplica.com REJECT You are blacklisted
90.123.456.78 REJECT You are blacklisted

postmap /etc/postfix/blacklisted_sender service postfix reload