SPF, part 3: configuring Postfix to check SPF records when receiving mail

(for extra fun, read parts 1 and 2 first.)

Now that you know how to configure an SPF record for your domain(s), the natural next step, if you administer an email server, is to start checking SPF records for mails you receive.

Now, spammers are infamous for not respecting rules, not “playing nice”, so, you might ask, what makes me think they’ll set up SPF records for their domains, which would be kind of self-defeating? The obvious answer is that SPF doesn’t depend on the spammers’ collaboration. Since legitimate email senders use SPF to tell the world which servers they use to send email, it prevents others — such as the aforementioned spammers — from faking sender addresses to pretend they’re from those senders / domains.

To put it simply: if there’s an SPF record for the “gmail.com” domain, then you can — and should — reject mail purporting to be from something@gmail.com that doesn’t come from the servers listed in that record. In other words, anyone who fakes a @gmail.com address can’t fool your server, assuming you have it configured to use SPF.

Now, how to do that? There are many ways, of course, depending on the email server you use. The simple recipe below uses postfix-policyd-spf-perl to make Postfix reject mail from domains with properly configured SPF records, when the mail comes from an unauthorized server (that is, one not listed on the record.) This assumes you already have Postfix up and running.

  • install postfix-policyd-spf-perl. In Ubuntu, just do an apt-get install postfix-policyd-spf-perl .
  • add this line to /etc/postfix/main.cf:
    spf-policyd_time_limit = 3600s
  • add the following to /etc/postfix/master.cf:
    policy-spf  unix  -       n       n       -       -       spawn
         user=nobody argv=/usr/bin/policyd-spf

    (change the path of policyd-spf if it’s installed somewhere else; that’s where the Ubuntu package puts it.)

  • in /etc/postfix/main.cf, find the smtpd_recipient_restrictions section, and, immediately after permit_mynetworks (and permit_sasl_authenticated, if you’re using that), add:
    check_policy_service unix:private/policy-spf
  • restart Postfix. Check your logs to see if everything is working properly.

Now, remember when in part 2 I mentioned a lesser-known reason for configuring the SPF record for your domain? It’s this: it’ll stop a lot of incoming spam. These days, a lot of spam email pretends to be from you (that is, it uses your email address as both the “From:” and “To:”), or at least from your domain (e.g. administrator@yourdomain, manager@yourdomain, and so on.) I don’t know why spammers do that, but apparently it works, or else they wouldn’t do it (maybe victims get confused and think the email comes from someone in their company, or maybe webmail services tend — or at least did so once — to trust the user’s own address, I don’t know.) Well, if you have SPF for your domain and your email server checks SPF records for incoming mail, then spam messages such as these will be always rejected, even when other methods of stopping spam (RBL lists, SpamAssassin, etc.) fail. Never again will you receive emails pretending to be from your own address.

Tags: , , ,

45 Responses to “SPF, part 3: configuring Postfix to check SPF records when receiving mail”

  1. Freedom Mentor

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  2. speed up mac says:

    Over the life of our computers we could log thousands and
    thousands of hours of use and everything that we do
    on it can potentially be stored onto the computer itself.
    Hundreds of thousands of useless files and cache files can clog up the works and make your computer run very slow and sluggishly which
    can be super frustrating to anyone who just wants to get something done.

    Well there is a powerful new product on the
    market which will make light work of all of these files and many other things including unused language and broken file extensions and throw them all away for good which
    will make your computer truly run as fast as it can again. This product is called Detox my Mac and what
    it does is really get down to the heart of the slowing issue which really is
    just use itself. No matter what you do or where you go you will eventually run into this problem.
    So instead of stressing about how it takes forever to do anything on your
    computer how about being proactive and really taking care of it?
    You can do that with Detox my Mac. It’s an instant download program after
    you pay their very low one time fee you will be able to truly have the most
    powerful product on your computer for the life of it.

    It will allow you go through all the files on your Mac
    computer and it will with a sort of intuition and get rid of
    everything that doesn’t belong and it will also trash anything that is slowing the computer down and it just takes a few
    moments of time and then it’s over and you can see for yourself how much faster your computer is running how much faster
    you can upload or download something. It’s a singular one time fee which really
    does mean one time and once you pay for it you can actually get lots of extras to go along with it like free
    support 24 hours a day 7 days a week. People who are friendly and knowledgeable and
    who will walk you through a very easy step by step process to get your computer working at it’s best.
    No matter who you are or where you go on the internet you are sure to really enjoy this
    program because it keeps your computer healthy
    and clean and working the best that it can. A computer is one of
    those things we use all the time but sometimes neglect factoring in that they also like our
    houses or our bodies need a good cleaning and so this program does just that
    cleaning the inside of the computer and giving it a boost so that you can really just go back to enjoying
    what you do online without the frustration or having
    to buy a very expensive upgrade for your Mac computer.

    Instead you can try out this program for 60 days and
    if within those days you do not like what it does for your computer than you can get all of
    your money back which means that you can trust that what you are getting is
    really what you are going to get and you will
    really enjoy having your computer faster and better performing.
    Your computer will work better which means that you save
    time and money and you can really get the most out of your computer and the time you
    spend there. You will truly enjoy this program and what
    have you got to lose except for the slow speeds.

  3. Imperial Advance

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  4. Luigi Wewege says:

    Luigi Wewege

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  5. Foundation for Defense of Democracies

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  6. sp=show-clips

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  7. Freddom Mentor reviews

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  8. fruitcake says:

    Wonderful goods from you, man. I have understand your stuff previous to
    and you are just extremely wonderful. I really like what
    you’ve acquired here, really like what you
    are stating and the way in which you say it. You make it entertaining and you still take care of to keep it
    smart. I cant wait to read far more from you. This is
    actually a great site.

  9. Slap On Tracker

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  10. automobile says:


    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  11. Since then, Swellnomore is the only thing I use and my problem is gone.
    There is nothing quite like capturing a great moment in time with a beautiful
    photo. Rare prescriptions will most likely have to be ordered from the manufacturer and this can add day
    onto the shipping time frame.

  12. Firoz Patel says:

    Firoz Patel

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  13. What happens fifteen years or more after the fifteen minutes of fame fades.

    All you do is scan or draw an outline of your deployment area (walls,
    doors, etc. This new system covers all automated article marketing
    solutions and the system is completely automated.

  14. Les says:

    Exceptional post but I was wanting to know if you could write a litte
    more on this topic? I’d be very thankful if you could elaborate a little
    bit further. Kudos!

  15. As far as information is concerned, it was launched precisely six
    years after the inception of tv broadcasting.

  16. Tidal stream and wave energy firms continue to face big challenges”, says the report.

  17. Beats Pill says:

    Het goede nieuws is dat het niet te laat voor het Caribisch gebied. “De manier waarop lucht circuleert in een 3-D model zou water te houden tegen bevriezen grotere afstand van sterren dan voorheen gedacht,” Leconte gezegd .. Maar de private sector heeft zoveel gestalte verloren als gevolg van Wall Street schandalen en verhalen van hebzucht die zelfs zijn goede ideeën vallen grotendeels in dovemansoren.. “Intelligence” “Intelligence” is een dramatische thriller met in de hoofdrol Josh Hollow

  18. So all of our daily lives today and go to ‘Keyboard’ and under control for your cash and search
    engine cards. It’s really thin, that’s HomeKit. It’s packed with blls and
    whistles oof the most suitable deals. We used limestoine
    from a variety of iPhone Users – In recent past.

    My ste … website hoeting (http://www.jerryleventer.com)

  19. […] to attend in the autumn. ????? | AGA Export Corporation Grossi Louis Vuitton Auckland SPF, part 3: configuring Postfix to check SPF records when receiving mail Narty | Krzysztof – blog za Search | NPL Links Patrocinados […]

  20. Potong video flip Jika Anda hanya ingin satu atau lebih bagian dari video
    flip, Anda dapat mengklik ” Clip “tombol untuk memangkas video flip Anda.
    Dan intuitif, profesional namun menarik desain web e-commerce adalah solusi akhir untuk
    mengumpulkan daya tarik pengunjung kasual. Membangun sebuah situs otoritas, jika itu adalah tujuan Anda, Anda akan menghindari menciptakan sesuatu seperti ini.

  21. […] Manufacturing Extension Partnership – WMEP http://mcim.in/index.php?option=com_…mid=635#157502 SPF, part 3: configuring Postfix to check SPF records when receiving mail Links Patrocinados […]

  22. knurow says:

    It’s wonderful that you are getting thoughts from this post as well as from
    our argument made at this time.

  23. […] zou krijgen betaald voor moet bieden! Er zijn honderden van deze gratis artikel sites online. SPF, part 3: configuring Postfix to check SPF records when receiving mail Geef zo ??vele voorbeelden als je kunt. Ray Ban Winkel […]

  24. Thank you, I have reently been looking for info approximately this topic for ages and yours is
    the best I have discovered so far. However, what in regards to the bottom line?
    Are you sure about the supply?

    Feell free to visit my page – Student storage solutions

  25. My spouse and I stumbled over here from a different page and thought I might as well
    check things out. I like what I see so i am just following you.
    Look forward to looking over your web page for a second

  26. Yes! Finally someone writes about kursy reiki manchester.

  27. Mais pour la plus grande proportion des Américains, les conséquences financières d’un problème médical peuvent être dévastateurs. Nous avons étudié ces personnes dans notre recherche de la faillite, et que celui qui je considère comme fondamentalement injuste, et pas seulement dans le sens que le Seigneur se occupe des cartes différentes pour différentes personnes, et certains tombent malades et certains avoir des bébés trop t

  28. Roberta says:

    it just merely puts you in a position where you can comfortably BE.

    Due to purely herbal composition these can be used by person of any age
    and gender without any medical prescription. In more severe cases
    there could also be tendon damage as in torn tendons which connect
    your muscle to your bone.

  29. D?ch v? BPO – Business Process Outsourcing (BPO) là gì?

    Có nhi?u cách nói khác nhau v? BPO trong ti?ng Vi?t là: “Thuê ngoài quy trình kinh doanh” ho?c “D?ch v? nghi?p v? doanh nghi?p” ho?c “D?ch v? thuê ngoài”, ho?c “Gia công quy trình kinh doanh”.
    D?ch v? BPO là khái ni?m ?? ch? vi?c s? d?ng các d?ch v? liên quan c?a các nhà cung c?p chuyên nghi?p bên ngoài thay vì t? t? ch?c cung c?p (in-house) nh?m gi?m chi phí và t?ng kh? n?ng c?nh tranh c?ng nh? kh? n?ng t?p trung phát huy nh?ng m?t m?nh c?a doanh nghi?p.

  30. naturalne sposoby na potencje

    SPF, part 3: configuring Postfix to check SPF records when receiving mail

  31. Wohn: Küche umbaut Küche Bad Schränke Waschküche remodelsWasher Trockner Trockenbau recessionsHome umbaut Badezimmer umbaut Schränke Trockenbau, Schlamm und Band Farbe Trimmen Texture Painting Blei-Minderung durch die EPA und Washington stateInsulation Attic umbaut BalustersAttic Öffnungen Fans zertifiziert Energie auditsStairs Unterstützung, neu, Verstärkung, Nike Herrenschuhe remodelOlder Seattle Washington Startseite Restaurierung Ke

  32. Banks may require the borrower to have no outstanding payday loans or an lively checking account.

  33. Some issues to notice, the bobbin goes into the bobbin case in the opposite direction of
    all my other machines (see the guide), the needle goes in slightly off heart (the guide says 6 on the clock), and
    I am a needle changer, I alter usually and use ball
    level most frequently. Then I found that the one who
    offered it to me had put the mistaken size needle within the machine and it was too quick.

    Nothing fancy just a 3/4 thread machine.

  34. I’ve never recognized this degree of love in life and I’ve had several
    relationships and have even been married.

  35. Oui,Solde UGG Pas Cher, l’inscription à Wells est pitoyablement inférieure, suggère Karen Nadder Lago,UGG Beige Chaussures, une ancienne élève et maman d’un de l’étudiant en deuxième année. Quelque chose de drastique devrait survenir et il est vraiment pas n étudiante. Il est vraiment traitant notre la base. Wells ne semblent regarder apparaître comme dans une école financière budgétaire crise catastrophe.Araignée man gars,cha

  36. The job of the photographer is to carry a genuine second out of the individual
    and be adept enough to seize it. Photographer Chris Frampton has a wonderful article about actors and photographers and agents.
    Every individual has a different story, and every photo can inform it differently, but extra
    importantly the photographer needs to know how one
    can inform it to particular audiences.

  37. During our Nike Running Trainers Sale ongoing insurance policy coverage of the implosion of Hollywood, you might ask yourself, “What do I care if the bunch of movies lose money plus studios go bankrupt? So what when studio execs have to plunge to a lower quality of cocaine?” The problem is that the movies nearly all of you tend to like are very expensive to make, and now they aren’t making their money returning. Hollywood is about to start making diminished amount of what you like, and or making

  38. La DTD) .Bien que la déclaration XML est facultative, le W3C recommande que vous incluez Ceinture Gucci Pas Cher dans vos documents XML. Dans tous les cas, vous aurez besoin de la déclaration XML de valider avec succès votre type de document.Document Definition (DTD) La DTD définit les règles de votre Vibram Chaussures document XML. Lorsque vous vous inscrivez pour démarrer votre entreprise très propres Simply Said, vous recevrez jusqu’à 500 $ de produits

  39. Anonymous says:

    M.. Craigslist San Francisco Craigslist new york 88sears min personliga information lönecheckar 88sears informations personliga Barnes and Noble bokhandel platser butik locator gränser bokhandel platser covacations Continental Airlines semester resa semester hotell resor Craigslist San Francisco Craigslist los angelescraigwslistphiladelphia ämne: Bank of America nätbankskonton Kontoinformation Account aktivitet bebisar r oss gåva registret babiesrus Polo Ralph Lauren Cla

  40. Anonymous says:

    Dette kan være en slukke for nogle mennesker, og jeg tror, ​​vi vil have så mange Louboutin Outlet Danmark mennesker som muligt for at være en del af denne begivenhed. Lad os finde ud af hvad man skal kalde denne ting. Marc Moskowitz, 66, en kunde ad Bally i New York, indgav en retssag, efter at han brækkede sin skulder glider, sagde han, om alle de lykkelige slutninger, der går på regelmæssigt i området bruser af klubben. Todds værkt&#248

Leave a Reply

Sore Throat

It is a very attractive website built using wonderful features based in Wordpress. It is an informative health care blog regarding:


You can learn more about Simvastatin or Zocor which treats triglyceride and high cholesterol levels in blood. You might need medical attention for Simvastatin side effects.


As a beta blocker Atenolol is a drug used primarily in cardiovascular diseases. Be careful! Please be informed about Atenolol side effects.


It is a receptor blocker used in treatment of several diseases of the cardiovascular system, especially hypertension. Metoprolol side effects must be considered for this drug.


Known also as Yasmin is used for ovulation prevention. Before taking it, read Yaz side effects.


Also known as Sertraline is an antidepressant of the selective serotonin reuptake inhibitor. Consider the related topics:

Do not forget to read also Zoloft side effects since it is well described.


It is used in treatment of hypertension. Before using Lisinopril please refer to Lisinopril side effects to avoid heart problems.


Is an antidepressant medication that belongs to the group of drugs called selective serotonin reuptake inhibitors. Before using Citalopram please refer to Citalopram side effects to avoid problems.

Drug addiction

Be informed for drug addiction facts, drug addiction treatment, drug addicts. Look also for a rehab for heroin and cocaine or other drugs