{"version":"https://jsonfeed.org/version/1.1","title":"Vic Demuzere - E-mail","home_page_url":"https://vic.demuzere.be/articles/tags/email/","feed_url":"https://vic.demuzere.be/articles/tags/email/feed.json","description":"Blog posts tagged E-mail by Vic Demuzere","language":"en","items":[{"id":"https://vic.demuzere.be/articles/forwarding-email-postfix-debian/","content_html":"<p>My personal e-mail address is managed by <a href=\"https://www.google.com/work/\" title=\"Google for Work (formerly Google Apps)\">Google for Work</a>, as the spam filtering in Gmail is better than anything I could do myself. The problem is that I have a few additional domains that don't have any e-mail users. I have to use an external forwarding service as my <em>grandfathered</em> Google account doesn't allow me to add more domains. Fortunately setting up <a href=\"http://www.postfix.org/\" title=\"Postfix SMTP server\">Postfix</a> to forward mail from my other domains was pretty easy.</p>\n<p><img src=\"https://vic.demuzere.be/assets/articles/images/cdS9v3btV7quai0cIHaCm1ubUdI98ZJQ.png\" alt=\"Forwarding an e-mail to another address.\" /></p>\n<p>This also works if you're using a normal hosted webmail service (gmail, hotmail, yahoo...) and want to receive e-mail from your own domain straight to your usual inbox. This allows you to use your favorite e-mail service yet look a bit more professional.</p>\n<p>The Postfix server in my example receives an e-mail addressed to <code>email@example.com</code> and forwards that to <code>vic@demuzere.be</code>. Note that this breaks SPF but keeps DKIM signatures intact. An intact DKIM signature is enough to <a href=\"https://vic.demuzere.be/articles/email-authentication-with-spf-dkim-and-dmarc/\" title=\"E-mail authentication with SPF, DKIM and DMARC\">pass DMARC validation</a>.</p>\n<h2 id=\"installing-postfix\">Installing Postfix<a href=\"#installing-postfix\" aria-label=\"Link to heading 'Installing Postfix'\" data-heading-content=\"Installing Postfix\" class=\"anchor\"></a></h2>\n<p>Postfix is included in the Debian repositories. Exim is installed by default and will be removed when you attempt to install Postfix. Unless you're already using e-mail on the server this shouldn't be an issue.</p>\n<pre><code>apt-get install postfix\n</code></pre>\n<p>When the configuration dialog pops up, simply select <code>No configuration</code>.</p>\n<h2 id=\"postfix-configuration\">Postfix configuration<a href=\"#postfix-configuration\" aria-label=\"Link to heading 'Postfix configuration'\" data-heading-content=\"Postfix configuration\" class=\"anchor\"></a></h2>\n<p>The relevant configuration is located in <code>/etc/postfix/main.cf</code>.</p>\n<p>Define for which domains you want to forward e-mail. Note that you can specify multiple virtual domains. We let Postfix know that our address mappings will be listed in the <code>virtual</code> file inside the configuration directory.</p>\n<pre><code>virtual_alias_domains = example.com example.net\nvirtual_alias_maps = hash:/etc/postfix/virtual\n</code></pre>\n<p>Now that postfix knows for which domains to accept e-mail, we can start creating the individual addresses inside the <code>virtual</code> file. The syntax is a simple key-value pair list. Note that it's also possible to define more complex regex-based addresses, but I didn't need that for my simple setup.</p>\n<pre><code>email@example.com vic@demuzere.be\nother@example.com destination@gmail.com\nthird@example.net hello@hotmail.com\n</code></pre>\n<p>In case you want to forward all e-mail (<a href=\"https://en.wikipedia.org/wiki/Catch-all\" title=\"Catch-all e-mail address; Wikipedia\">catch-all</a>) for a certain domain, simply leave away the user part. If you're setting both specific users <em>and</em> a catch-all address, the latter will only work for unknown users.</p>\n<pre><code>@example.com destination@gmail.com\n</code></pre>\n<p>Save the changes by running postmap on the <code>virtual</code> file.</p>\n<pre><code>postmap /etc/postfix/virtual\n</code></pre>\n<h2 id=\"issues-when-delivering-to-the-local-domain\">Issues when delivering to the local domain<a href=\"#issues-when-delivering-to-the-local-domain\" aria-label=\"Link to heading 'Issues when delivering to the local domain'\" data-heading-content=\"Issues when delivering to the local domain\" class=\"anchor\"></a></h2>\n<p>In my case, the destination e-mail address is on my own domain. Even though e-mail for the domain is hosted elsewhere, Postfix thought it was responsible and kept the e-mail instead of forwarding it. This was solved by setting the domain for the Postfix server to a subdomain that I don't actually use.</p>\n<pre><code>myhostname = myserver.demuzere.be\nmydomain = myserver.demuzere.be\nmyorigin = myserver.demuzere.be\n</code></pre>\n<p>Note that this solution only works if you're using the Postfix server to forward to external services. In case you're using the server for actual mailboxes, watch out when modifying these settings!</p>\n<div class=\"footer\"><hr><p>Thanks for subscribing to my feed!</p><p>Feel free to e-mail comments or corrections to <a href=\"mailto:vic@demuzere.be?subject=RE%3A%20Forwarding%20e-mails%20with%20Postfix%20on%20Debian\">vic@demuzere.be</a>.</p></div>","url":"https://vic.demuzere.be/articles/forwarding-email-postfix-debian/","date_published":"2015-04-16T10:50:00Z","date_modified":"2026-05-13T17:33:24Z","language":"en"},{"id":"https://vic.demuzere.be/articles/email-authentication-with-spf-dkim-and-dmarc/","content_html":"<p>The <a href=\"http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol\" title=\"SMTP on Wikipedia\">Simple Mail Transfer Protocol</a>, used for sending e-mail messages, has been written in the 1970s. It was not designed to be secure.</p>\n<p><a href=\"http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol\" title=\"SMTP on Wikipedia\">SMTP</a> is a pretty simple protocol, and it follows the idea of classic mail: You write the address on the front of the envelope, your own address on the back, and you send it. <em>There is no way for the recipient to check if the address you've written on the back is really yours.</em></p>\n<h2 id=\"so-whats-the-problem-it-always-worked-like-that\">So, what's the problem? It always worked like that.<a href=\"#so-whats-the-problem-it-always-worked-like-that\" aria-label=\"Link to heading 'So, what's the problem? It always worked like that.'\" data-heading-content=\"So, what's the problem? It always worked like that.\" class=\"anchor\"></a></h2>\n<p>E-mail has become the most important means of &quot;serious&quot; online communication. Accounts on most sites are connected to an e-mail address, including e-commerce. If you receive an e-mail from your bank, how do you know if it's really your bank that has sent the e-mail?</p>\n<p><strong>You can't</strong>, not automatically.</p>\n<p>You could phone your bank and ask them if they've sent it. <em>But that's not something most people would do</em>. People want to read their e-mail and usually trust the sender line shown in their mail client.</p>\n<h2 id=\"the-solution-for-geeks\">The solution for geeks!<a href=\"#the-solution-for-geeks\" aria-label=\"Link to heading 'The solution for geeks!'\" data-heading-content=\"The solution for geeks!\" class=\"anchor\"></a></h2>\n<p>There has been a solution for this problem for ages. Standards like <a href=\"http://en.wikipedia.org/wiki/S/MIME\" title=\"S/MIME on Wikipedia\">S/MIME</a> and <a href=\"http://en.wikipedia.org/wiki/Pretty_Good_Privacy\" title=\"Pretty Good Privacy on Wikipedia\">OpenPGP</a> allow you to sign e-mail messages. Everyone that trusts your public key can be pretty sure you are who you say you are.</p>\n<p>Most desktop e-mail clients support <a href=\"http://en.wikipedia.org/wiki/S/MIME\" title=\"S/MIME on Wikipedia\">S/MIME</a> and <a href=\"http://en.wikipedia.org/wiki/Pretty_Good_Privacy\" title=\"Pretty Good Privacy on Wikipedia\">OpenPGP</a>, but the number of users is small. A select group of people that really cares about privacy and security uses it for sending e-mails. (<a href=\"http://en.wikipedia.org/wiki/Pretty_Good_Privacy\" title=\"Pretty Good Privacy on Wikipedia\">OpenPGP</a> is used for other things as well: A lot of GNU/Linux packages <a href=\"http://www.toofishes.net/blog/real-story-behind-arch-linux-package-signing/\" title=\"Archlinux package signing\">are signed using OpenPGP</a>).</p>\n<p>This solution isn't suitable for the masses though. Keeping your private certificate secure (and maintaining a web of trust in the case of <a href=\"http://en.wikipedia.org/wiki/Pretty_Good_Privacy\" title=\"Pretty Good Privacy on Wikipedia\">OpenPGP</a>) is too much work. It should be easier!</p>\n<h2 id=\"the-solution-for-the-masses\">The solution for the masses!<a href=\"#the-solution-for-the-masses\" aria-label=\"Link to heading 'The solution for the masses!'\" data-heading-content=\"The solution for the masses!\" class=\"anchor\"></a></h2>\n<p>People that lack the required knowledge to set up their own e-mail server usually use the servers of their provider, or a webmail service. This is where we have to implement the authentication if we want to reach everyone.</p>\n<p>A few standards have been developed to make this happen.</p>\n<h3 id=\"sender-policy-framework-spf\">Sender Policy Framework (SPF)<a href=\"#sender-policy-framework-spf\" aria-label=\"Link to heading 'Sender Policy Framework (SPF)'\" data-heading-content=\"Sender Policy Framework (SPF)\" class=\"anchor\"></a></h3>\n<p><a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> allows server administrators to keep a <em>whitelist</em> of servers allowed to send e-mails for their domain. The server receiving the e-mail can then check if it came from an allowed IP.</p>\n<p>The whitelist is stored in a TXT or <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> record in DNS. As the domain administrator is (or should be) the only one able to change the <a href=\"http://en.wikipedia.org/wiki/Domain_Name_System\" title=\"DNS on Wikipedia\">DNS</a> records for his domain, this is considered a safe place to store the whitelist.</p>\n<p>For example, the <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> record for demuzere.be:</p>\n<pre><code>demuzere.be. IN TXT &quot;v=spf1 include:_spf.google.com -all&quot;\ndemuzere.be. IN SPF &quot;v=spf1 include:_spf.google.com -all&quot;\n</code></pre>\n<p>This record basically tells you that you should read the <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> record on _spf.google.com, and disallow all other servers.</p>\n<p>The <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">official SPF website</a> has a page with <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//Tools\" title=\"Tools for SPF on the official OpenSPF website\">tools for setting up and checking SPF records</a>.</p>\n<h3 id=\"domainkeys-identified-mail-dkim\">DomainKeys Identified Mail (DKIM)<a href=\"#domainkeys-identified-mail-dkim\" aria-label=\"Link to heading 'DomainKeys Identified Mail (DKIM)'\" data-heading-content=\"DomainKeys Identified Mail (DKIM)\" class=\"anchor\"></a></h3>\n<p>The problem with SPF is that it breaks when an e-mail forwarder forwards your e-mail.\nIn this case, the receiving server will see the IP of the forwarder, and not that of the original sender.\nFor the same reason, this also breaks mailing lists.</p>\n<p>One solution that does not break forwarders is <a href=\"http://en.wikipedia.org/wiki/S/MIME\" title=\"S/MIME on Wikipedia\">S/MIME</a> and <a href=\"http://en.wikipedia.org/wiki/Pretty_Good_Privacy\" title=\"Pretty Good Privacy on Wikipedia\">OpenPGP</a>, as the message containing the signature stays intact when forwarding an e-mail.\nSo why not use this same technique on the server?</p>\n<p><strong>That's where <a href=\"http://www.dkim.org/\" title=\"Official DKIM website\">DKIM</a> comes in!</strong>\nIt signs the e-mail body and a few critical headers on the server before sending it to the recipient.</p>\n<p>The public key is read from <a href=\"http://en.wikipedia.org/wiki/Domain_Name_System\" title=\"DNS on Wikipedia\">DNS</a> (for the same reasons the whitelist for <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> is stored there).\nThe receiving server can validate the message using the public key and a signature in the e-mail headers.\nForwarders and mailing lists keep these headers intact, and don't break <a href=\"http://www.dkim.org/\" title=\"Official DKIM website\">DKIM</a>.\n(Unless they're not configured correctly..)</p>\n<p>For example, the <a href=\"http://www.dkim.org/\" title=\"Official DKIM website\">DKIM</a> record for demuzere.be:</p>\n<pre><code>demunet._domainkey.demuzere.be. IN TXT &quot;v=DKIM1\\;k=rsa\\;p=MIGfMA [..] AQAB\\;t=s&quot;\n</code></pre>\n<p>DKIM allows you to set multiple public keys (the key name is &quot;demunet&quot; in the record shown above). The reason to allow this is simple: You might want to let a third party sign e-mails on your behalf. Companies using a third party service for sending bulk e-mail can give them a separate key, and revoke it if needed.</p>\n<h3 id=\"domain-based-message-authentication-reporting--conformance-dmarc\">Domain-based Message Authentication, Reporting &amp; Conformance (DMARC)<a href=\"#domain-based-message-authentication-reporting--conformance-dmarc\" aria-label=\"Link to heading 'Domain-based Message Authentication, Reporting &amp; Conformance (DMARC)'\" data-heading-content=\"Domain-based Message Authentication, Reporting &amp; Conformance (DMARC)\" class=\"anchor\"></a></h3>\n<p>But how should the receiving server know if it should check for <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> and <a href=\"http://www.dkim.org/\" title=\"Official DKIM website\">DKIM</a> records? <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> can be checked easily:\nIf there is no SPF record, the sender doesn't use it. But what for DKIM? You have to know the public key name in order to check if it exists.\nThere is no way to know if an unsigned e-mail should have been signed.</p>\n<p>There have been a few proposals on how to solve this. One of them was Author Domain Signing Policy (ADSP).\nIt wasn't popular: The biggest webmail providers didn't implement it, and then it simply doesn't work.</p>\n<p>The latest try is <a href=\"http://dmarc.org/\" title=\"Official DMARC website\">DMARC</a>.\nBehind the ridiculously long name hides yet another <a href=\"http://en.wikipedia.org/wiki/Domain_Name_System\" title=\"DNS on Wikipedia\">DNS</a> record.\nThis time it allows you to specify a policy as to how the receiving server should threat your messages.\nThe difference with ADSP is that <a href=\"http://dmarc.org/\" title=\"Official DMARC website\">DMARC</a> also supports reporting.\nReceiving servers can send you reports about the number of messages it received from your domain, what they did with them, and why they decided to do that.</p>\n<p>You can suggest what to do with messages that fail <a href=\"http://www.dkim.org/\" title=\"Official DKIM website\">DKIM</a> and <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> tests.\nPossible options are <em>reject</em>, <em>quarantine</em> (sends them to the spambox most of the time) and <em>none</em>.\nThis last option simply sends reports, but doesn't stop the e-mails from reaching the inbox if something is wrong with them.</p>\n<p>A last example, the <a href=\"http://dmarc.org/\" title=\"Official DMARC website\">DMARC</a> record for demuzere.be:</p>\n<pre><code>_dmarc.demuzere.be. IN TXT &quot;v=DMARC1\\;pct=100\\;p=reject\\;adkim=s\\;aspf=r&quot;\n</code></pre>\n<p>My policy is to reject messages that fail <a href=\"http://www.dkim.org/\" title=\"Official DKIM website\">DKIM</a> tests (all messages should be signed). My <a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a> policy isn't set to strict: As explained earlier, this might cause forwarders and mailing lists to fail.</p>\n<h2 id=\"more-information\">More information<a href=\"#more-information\" aria-label=\"Link to heading 'More information'\" data-heading-content=\"More information\" class=\"anchor\"></a></h2>\n<ul>\n<li><a href=\"http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol\" title=\"SMTP on Wikipedia\">SMTP on Wikipedia</a></li>\n<li><a href=\"http://en.wikipedia.org/wiki/S/MIME\" title=\"S/MIME on Wikipedia\">S/MIME on Wikipedia</a></li>\n<li><a href=\"http://en.wikipedia.org/wiki/Domain_Name_System\" title=\"DNS on Wikipedia\">DNS on Wikipedia</a></li>\n<li><a href=\"http://en.wikipedia.org/wiki/Pretty_Good_Privacy\" title=\"Pretty Good Privacy on Wikipedia\">OpenPGP</a></li>\n<li><a href=\"https://web.archive.org/web/20190227162028/http://openspf.org//\" title=\"Official OpenSPF website\">SPF</a></li>\n<li><a href=\"http://dmarc.org/\" title=\"Official DMARC website\">DMARC</a></li>\n<li><a href=\"http://www.dkim.org/\" title=\"Official DKIM website\">DKIM</a></li>\n</ul>\n<div class=\"footer\"><hr><p>Thanks for subscribing to my feed!</p><p>Feel free to e-mail comments or corrections to <a href=\"mailto:vic@demuzere.be?subject=RE%3A%20E-mail%20authentication%20with%20SPF%2C%20DKIM%20and%20DMARC\">vic@demuzere.be</a>.</p></div>","url":"https://vic.demuzere.be/articles/email-authentication-with-spf-dkim-and-dmarc/","date_published":"2012-03-09T18:00:00Z","date_modified":"2025-03-28T08:58:27Z","language":"en"}]}