Postfix - SPF

3:22 pm Postfix, SPF

Ce tutorial a pour but de permettre l’installation de SPF (Sender Policy Framework).
SPF est tres utile car il permets par exemple a vos e-mails de ne pas être considéré comme des spams par Gmail.


Dans un premier temps il faut installer un module perl: Mail::SPF

Pour cela lancer le shell perl:

  • # perl -MCPAN -e shell

Et installez le module qui nous intéresse Mail::SPF :

  • cpan> install Mail::SPF

Pour quitter le shell utilisez ‘q’

  • cpan> q

Installez a present postfix-policyd-spf-perl:

  • #cd /usr/src
  • #wget http://www.openspf.org/blobs/postfix-policyd-spf-perl-2.001.tar.gz
  • #tar xvfz postfix-policyd-spf-perl-2.001.tar.gz
  • #cd postfix-policyd-spf-perl-2.001
  • #cp postfix-policyd-spf-perl /usr/lib/postfix/policyd-spf-perl

Éditez le fichier master.cf:

  • # nano /etc/postfix/master.cf

Et rajoutez a la fin:

policy unix - n n - - spawn
user=nobody argv=/usr/bin/perl /usr/lib/postfix/policyd-spf-perl

Puis éditez le fichier main.cf et modifier la ligne smtpd_recipient_restrictions pour mettre apres reject_unauth_destination la directive check_policy_service unix:private/policy :

  • # nano /etc/postfix/main.cf

smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination,check_policy_service unix:private/policy

Redémarrez postif:

  • # /etc/init.d/postfix restart

Vous pouvez vérifier que postfix-policyd-spf-perl fonctionne en le lançant:

  • # perl /usr/lib/postfix/policyd-spf-perl

(vous devriez avoir un genre de “shell”)

Pour vérifiez que SPF est bien active regardez vos logs postifx, vous devriez y trouver quelque chose du genre:

postfix/policy-spf[18924]: handler sender_policy_framework: is decisive.

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.