So, I realized I hate email.
Then again, I really hate the idea of my personal email communications being used to “figure me out.”
I had this wild hair over the past two months to start hosting my own email again, after my email maintenance skill fatigued over the past 8 years of using a very popular email service.
From what I remembered, I did everything a good mail server should do… Here was my checklist:
- Setup MX record pointed at my mail-server
- Setup my mail-server host’s reverse IP to the A record forward for the host
- Be free of companies having, and harvesting my email ;)
Back In The Day this was all that I remember needed. Great. Send some emails to inform everyone that I was free from the evil big email companies.
WELL, a few days later, (with no responses from ANYONE) I had this feeling that something was wrong…
ALL MY MAIL WAS GOING TO PEOPLE’S SPAM FOLDERS! GAAAAHH!!!
Researching Online I found that I really shouldn’t be hosting my own mail, as it isn’t the same friendly kind internet it used to be when I hosted my own mail… Apparently the following items should have been on my checklist:
- Setup MX record pointed at my mail-server – CHECK!
- Setup reverse dns lookup to my forward – CHECK!
- Setup an SPF TXT dns record – WTF?
- Setup a DKIM TXT dns record – HUH??
- Setup a DMARC TXT dns record – Is this a joke??
The Internets told me that a SPF (Sender Policy Framework) entry should look as follows in DNS based on rfc 4408:
From What I can gather, this looks like a good idea as to allow for programmatic email to be allowable, and not marked as spam coming from something other than the MX record of the domain… but I am still not understanding why reverse DNS wouldn’t provide exactly the same protection as an SPF record for a single self hosted mail-server…
Great, I am now SPF-ed, should be good to go? YAY, check it out! Gmail accepts my SPF record!
Time to email everyone! Oh, crap, they are still getting my emails in their spam folder… Well, shoot, what else do I need to do? I decided to look at the headers of an email from one big email company to another to see what I am missing:
Hmm… Well, I see the SPF pass, just like mine so that is good. But WTF is dkim=pass… and WTF is dmarc=pass (p=REJECT dis=NONE)… And what is a DKIM-Signature?!?! Why is email so foreign to me all of a sudden… it used to be so clear…
Digging into DKIM on the Internets, I see DKIM (DomainKeys Identified Mail) is a cryptographic signing scheme made for mail-servers to sign emails going to remote mail servers. This actually makes a ton of sense to me. I personally like signing my emails with GPG, and totally understand this check. Learning about DKIM on the internet, basically you create an RSA keypair, and publish the public key as a DNS TXT entry on your DNS server! Wow, that kinda makes sense. This way a remote mail-server can do a single DNS lookup and verify that the email coming in is really and truly from the owner of the domain. Moreover in conjunction with the SPF record, one can tell if that mail-server is an authority to send emails for that domain based on dkim specifications
A few package installs and configurations, and I am now able to pass emails from my mail-server through a DKIM milter, and amazingly I get this header now when I send emails to gmail:
Whoa, I am starting to look like a real email service… Nice! I still notice one more “pass” in the previous email, DMARC.
DMARC (Domain-Based Message Authentication, Reporting and Conformance) seems to me to be a mechanism where email services communicated with (real or spammed messages sent) can send authentication failed reports. It seems to give the email Host the ability to specify how spam reports are sent back to the domain owner. Seems like I need to make a mailbox to handle all of the conformance reporting, as well as add a DNS entry that looks kind-of like this to have a valid dmarc:
Now, lets take a look at the headers from gmail!!! So Exciting!
YAY, all the checks I know about are being done successfully! I wonder if people will get my email now ;)
Hope this was helpful to anyone.