Check SPF Records when receiving mail in postfix

Check SPF Records when receiving mail in postfix

This simple install assumes you already have policyd installed

apt-get install postfix-policyd-spf-perl

Another tutorial,  said that an executable file might be installed at /usr/sbin/policyd-spf,  however it was installed elsewhere on my ubuntu 14.04 system,  here is how I found it

#updatedb
#locate policyd-spf|bin
/usr/sbin/postfix-policyd-spf-perl

User the path to add this entry to your /etc/postfix/master.cfm

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

So,  now we need to update /etc/postfix/main.cf by adding the following line

spf-policyd_time_limit = 3600s

and updateing the ‘smtpd_receiptient_restrictions’ to have the following in the list of services,   I added mind after ‘permit_mynetworks’ and another ‘check_policy_service 127.0.0.1:10011’ entry I have.

smtpd_recipient_restrictions = permit_mynetworks, 
     check_policy_service inet:127.0.0.1:10011,
     check_policy_service unix:private/policy-spf,
     .....

Reload and watch your logs

/etc/init.d/postfix restart
grep spf /var/log/mail.log