<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>dmarc &amp;mdash; LinuxPizza</title>
    <link>https://blogs.linux.pizza/tag:dmarc</link>
    <description>Personal notes and occasional posts - 100% human, 0% AI generated</description>
    <pubDate>Tue, 14 Apr 2026 19:11:21 +0000</pubDate>
    <item>
      <title>Deploying OpenDMARC on your Postfix mailserver</title>
      <link>https://blogs.linux.pizza/deploying-opendmarc-on-your-postfix-mailserver</link>
      <description>&lt;![CDATA[As a MTA lover, I always try to encourage people (especially &#34;IT-people&#34;) to host their own mailserver. Mostly so they actually can learn something and also that I do not like how the big providers like Google, Microsoft, Amazon etc keep eating up the market.&#xA;Diversity is a key to a healthy market - but that is another topic.&#xA;&#xA;This guide will mostly apply to Debian-based distros like Debian (9 or newer), Ubuntu (16.04 or newer) or any other &#34;serverdistro&#34;. I do assume that you already have a working mailserver that do both deliver and receive emails that are DKIM signed (or atleast perform validation with OpenDKIM), otherwhise you can read my short guide here (coming soon).&#xA;&#xA;First, install OpenDMARC from the repository.&#xA;apt update&#xA;apt install opendmarc -y&#xA;Verify that the user and group opendmarc has been created by checking /etc/passwd and /etc/group. Otherwhise, create them.&#xA;When you have installed it, verify the installation by running this:&#xA;opendmarc -V&#xA;You will get something like this (the version number is not that important yet):&#xA;opendmarc: OpenDMARC Filter v1.3.2       &#xA;    SMFIVERSION 0x1000001       &#xA;    libmilter version 1.0.1       &#xA;    Active code options:               &#xA;    WITHSPF               &#xA;    WITHSPF2&#xA;&#xA;Great! Let&#39;s proceed to configuring opendmarc&#xA;First, take a backup of the current opendmarc.conf, it will save some headache in the future if you want to redo it:&#xA;cp /etc/opendmarc.conf /etc/opendmarc.conf.BAK&#xA;Edit /etc/opendmarc.conf with the following:&#xA;AuthservID [SERVERHOSTNAME]&#xA;FailureReports true&#xA;PidFile /var/run/opendmarc.pid&#xA;RejectFailures false&#xA;SPFSelfValidate yes&#xA;Socket inet:8893@localhost&#xA;SoftwareHeader true&#xA;Syslog true&#xA;SyslogFacility mail&#xA;TrustedAuthservIDs [SERVERHOSTNAME]&#xA;HistoryFile /var/run/opendmarc/opendmarc.dat&#xA;UMask 0002&#xA;UserID opendmarc&#xA;Dont forget to restart opendmarc&#xA;service opendmarc restart &#xA;Proceed with adding opendmarc as a milter in postfix. I am assuming that you already have opendkim enabled as a milter like this:&#xA;smtpdmilters = inet:localhost:8891&#xA;nonsmtpdmilters = inet:localhost:8891&#xA;We now need to add the opendmarc milter into the postfix configuration, it is important that you add it AFTER the opendkim milter, otherwhise opendmarc will not be able to check if the DKIM key is valid.&#xA;smtpdmilters = inet:localhost:8891,inet:localhost:8893&#xA;nonsmtpdmilters = inet:localhost:8891,inet:localhost:8893&#xA;milterdefaultaction = accept&#xA;The last one is pretty important, so if one of your milters does not work for some reason - Postfix will still let it throu.&#xA;Restart postfix&#xA;service postfix restart&#xA;We should now be able to test the configuration by sending an email from example a gmail.com account to an email address on your email-server and check your logs if opendmarc actually works.&#xA;tail -f /var/log/mail.log | grep &#34;opendmarc&#34;&#xA;You should be able to see this:&#xA;Apr 26 12:16:38 mx opendmarc[31490]: 5155751C32: SPF(mailfrom): dmarctest@linux.pizza pass&#xA;Apr 26 12:16:39 mx opendmarc[31490]: 5155751C32: linux.pizza pass&#xA;Great! Your server does now validate DMARC policies! If you just wanted this basic functionality, you are done now.&#xA;But there is always room for improvement!&#xA;&#xA;Adding a Public-suffix list&#xA;This can be achieved in the following simple steps:&#xA;Create a catalogue (and change ownership) for the list to be downloaded to:&#xA;mkdir -p /etc/opendmarc/&#xA;chown opendmarc: /etc/opendmarc&#xA;Set up a cronjob to download the suffix list once a week&#xA;crontab -u opendmarc -e&#xA;And this line:&#xA;@weekly/usr/bin/wget -k -q -N -P /etc/opendmarc https://publicsuffix.org/list/effectivetldnames.dat&#xA;Also, just download the list so you have it before you configure opendmarc to use it:&#xA;wget -k -q -N -P /etc/opendmarc https://publicsuffix.org/list/effectivetldnames.dat &#xA;Finally, configure opendmarc to actually use that list, put this on the bottom in /etc/opendmarc.conf and restart opendmarc&#xA;PublicSuffixList /etc/opendmarc/effectivetld_names.dat&#xA;service opendmarc restart &#xA;&#xA;Awesome! You are now done with the OpenDMARC.&#xA;Next up - adding DMARC reporting, this will be in an upcoming post.&#xA;&#xA;#postfix #dmarc #opendmarc #smtp #email #linux]]&gt;</description>
      <content:encoded><![CDATA[<p>As a MTA lover, I always try to encourage people (especially “IT-people”) to host their own mailserver. Mostly so they actually can learn something and also that I do not like how the big providers like Google, Microsoft, Amazon etc keep eating up the market.
Diversity is a key to a healthy market – but that is another topic.</p>

<p>This guide will mostly apply to Debian-based distros like Debian (9 or newer), Ubuntu (16.04 or newer) or any other “serverdistro”. I do assume that you already have a working mailserver that do both deliver and receive emails that are DKIM signed (or atleast perform validation with OpenDKIM), otherwhise you can read my short guide here (coming soon).</p>

<h3 id="first-install-opendmarc-from-the-repository" id="first-install-opendmarc-from-the-repository">First, install OpenDMARC from the repository.</h3>

<pre><code>apt update
apt install opendmarc -y
</code></pre>

<p>Verify that the user and group <code>opendmarc</code> has been created by checking <code>/etc/passw</code>d and <code>/etc/group</code>. Otherwhise, create them.
When you have installed it, verify the installation by running this:</p>

<pre><code>opendmarc -V
</code></pre>

<p>You will get something like this (the version number is not that important yet):</p>

<pre><code>opendmarc: OpenDMARC Filter v1.3.2       
    SMFI_VERSION 0x1000001       
    libmilter version 1.0.1       
    Active code options:               
    WITH_SPF               
    WITH_SPF2
</code></pre>

<p>Great! Let&#39;s proceed to configuring opendmarc
First, take a backup of the current opendmarc.conf, it will save some headache in the future if you want to redo it:</p>

<pre><code>cp /etc/opendmarc.conf /etc/opendmarc.conf.BAK
</code></pre>

<p>Edit /etc/opendmarc.conf with the following:</p>

<pre><code>AuthservID [SERVERHOSTNAME]
FailureReports true
PidFile /var/run/opendmarc.pid
RejectFailures false
SPFSelfValidate yes
Socket inet:8893@localhost
SoftwareHeader true
Syslog true
SyslogFacility mail
TrustedAuthservIDs [SERVERHOSTNAME]
HistoryFile /var/run/opendmarc/opendmarc.dat
UMask 0002
UserID opendmarc
</code></pre>

<p>Dont forget to restart opendmarc</p>

<pre><code>service opendmarc restart 
</code></pre>

<p>Proceed with adding opendmarc as a milter in postfix. I am assuming that you already have opendkim enabled as a milter like this:</p>

<pre><code>smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
</code></pre>

<p>We now need to add the opendmarc milter into the postfix configuration, it is important that you add it AFTER the opendkim milter, otherwhise opendmarc will not be able to check if the DKIM key is valid.</p>

<pre><code>smtpd_milters = inet:localhost:8891,inet:localhost:8893
non_smtpd_milters = inet:localhost:8891,inet:localhost:8893
milter_default_action = accept
</code></pre>

<p>The last one is pretty important, so if one of your milters does not work for some reason – Postfix will still let it throu.
Restart postfix</p>

<pre><code>service postfix restart
</code></pre>

<p>We should now be able to test the configuration by sending an email from example a gmail.com account to an email address on your email-server and check your logs if opendmarc actually works.</p>

<pre><code>tail -f /var/log/mail.log | grep &#34;opendmarc&#34;
</code></pre>

<p>You should be able to see this:</p>

<pre><code>Apr 26 12:16:38 mx opendmarc[31490]: 5155751C32: SPF(mailfrom): dmarctest@linux.pizza pass
Apr 26 12:16:39 mx opendmarc[31490]: 5155751C32: linux.pizza pass
</code></pre>

<p>Great! Your server does now validate DMARC policies! If you just wanted this basic functionality, you are done now.
But there is always room for improvement!</p>

<h3 id="adding-a-public-suffix-list" id="adding-a-public-suffix-list">Adding a Public-suffix list</h3>

<p>This can be achieved in the following simple steps:
Create a catalogue (and change ownership) for the list to be downloaded to:</p>

<pre><code>mkdir -p /etc/opendmarc/
chown opendmarc: /etc/opendmarc
</code></pre>

<p>Set up a cronjob to download the suffix list once a week</p>

<pre><code>crontab -u opendmarc -e
</code></pre>

<p>And this line:</p>

<pre><code>@weekly/usr/bin/wget -k -q -N -P /etc/opendmarc https://publicsuffix.org/list/effective_tld_names.dat
</code></pre>

<p>Also, just download the list so you have it before you configure opendmarc to use it:</p>

<pre><code>wget -k -q -N -P /etc/opendmarc https://publicsuffix.org/list/effective_tld_names.dat 
</code></pre>

<p>Finally, configure opendmarc to actually use that list, put this on the bottom in /etc/opendmarc.conf and restart opendmarc</p>

<pre><code>PublicSuffixList /etc/opendmarc/effective_tld_names.dat
</code></pre>

<pre><code>service opendmarc restart 
</code></pre>

<p>Awesome! You are now done with the OpenDMARC.
Next up – adding DMARC reporting, this will be in an upcoming post.</p>

<p><a href="https://blogs.linux.pizza/tag:postfix" class="hashtag"><span>#</span><span class="p-category">postfix</span></a> <a href="https://blogs.linux.pizza/tag:dmarc" class="hashtag"><span>#</span><span class="p-category">dmarc</span></a> <a href="https://blogs.linux.pizza/tag:opendmarc" class="hashtag"><span>#</span><span class="p-category">opendmarc</span></a> <a href="https://blogs.linux.pizza/tag:smtp" class="hashtag"><span>#</span><span class="p-category">smtp</span></a> <a href="https://blogs.linux.pizza/tag:email" class="hashtag"><span>#</span><span class="p-category">email</span></a> <a href="https://blogs.linux.pizza/tag:linux" class="hashtag"><span>#</span><span class="p-category">linux</span></a></p>
]]></content:encoded>
      <guid>https://blogs.linux.pizza/deploying-opendmarc-on-your-postfix-mailserver</guid>
      <pubDate>Mon, 24 Jun 2019 17:14:08 +0000</pubDate>
    </item>
  </channel>
</rss>