Debugging dkim=fail using sendmail+dkim-milter

dkimsendmail

I'm setting up a CentOS server with the sendmail MTA to send DKIM-signed mail (sending domain is @brighter.do). I have succeeded in routing mails through the dkim milter; however, they arrive at my GMail account with dkim=fail authentication results and no further information. How do I begin to debug this (besides Googling 'debug failed dkim' and other such related terms)?

I used the config described in these instructions. The only additional config changes I made were adding my app user to /etc/mail/trusted-users, adding EXTRA_FLAGS=-R to /etc/sysconfig/dkim-milter, and switching Canonicalization to relaxed/relaxed (which didn't appear to change anything). I've verified that the key is 2048 bits using ssh-keygen -l -f app1. (It seems that a too-small key can cause GMail to reject a valid DKIM signature but that doesn't appear to be my problem.)

The contents of my relevant DNS records are:

APP1._DOMAINKEY.BRIGHTER.DO. TXT k=rsa; p=AAAAB3NzaC1yc2EAAAADAQABAAABAQC3pJ4UJW/KBQ2D6N/6kl37yqJ0F4NcKPGApyHw4wl2zohdOPp8rELvQnRgvmQUMu3hrgicD9W9LbnGx/CzakZAA4RcJk9kI51v+Y8L5j3lZURFC1ZIXoRFgfafyo31XN3rc+V0hNMXUGcxVI09oYtyS+2AuC9cULP4Nu030I3yYFd2NOwmKPY57PU3ybwGKEvuWsB/9PyWC6KVlULlkg7TB
APP1._DOMAINKEY.BRIGHTER.DO. TXT CwbMnGyavwIeoJpNlb1fINdDGWDAJvfTTpMGvIkQAehknbgBqL4IgciWQ/2xw6bMhma7MRJHzZsd7JfbNramQIpsxX6hZUkZja6HpoFJzBi1vbnLcM2n8Xhat/A1Q/F
_DOMAINKEY.BRIGHTER.DO. TXT o=~ r=angela@brighter.do

The headers I'm getting are:

Delivered-To: angela@brighter.do
Received: by 10.140.42.166 with SMTP id c35csp248278qga;
        Wed, 23 Mar 2016 14:10:12 -0700 (PDT)
X-Received: by 10.98.72.213 with SMTP id q82mr7347661pfi.164.1458767412258;
        Wed, 23 Mar 2016 14:10:12 -0700 (PDT)
Return-Path: <info@brighter.do>
Received: from DUALSTACK.PROD-API-478862527.US-WEST-2.ELB.AMAZONAWS.COM (outbound.brighter.do. [54.201.111.245])
        by mx.google.com with ESMTPS id m22si6801929pfi.43.2016.03.23.14.10.12
        for <angela@brighter.do>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 23 Mar 2016 14:10:12 -0700 (PDT)
Received-SPF: pass (google.com: domain of info@brighter.do designates 54.201.111.245 as permitted sender) client-ip=54.201.111.245;
Authentication-Results: mx.google.com;
       dkim=fail header.i=@brighter.do;
       spf=pass (google.com: domain of info@brighter.do designates 54.201.111.245 as permitted sender) smtp.mailfrom=info@brighter.do
Received: from DUALSTACK.PROD-API-478862527.US-WEST-2.ELB.AMAZONAWS.COM (localhost [127.0.0.1])
    by DUALSTACK.PROD-API-478862527.US-WEST-2.ELB.AMAZONAWS.COM (8.14.4/8.14.4) with ESMTP id u2NLAB8k007870
    for <angela@brighter.do>; Wed, 23 Mar 2016 21:10:11 GMT
X-DKIM: Sendmail DKIM Filter v2.8.3 DUALSTACK.PROD-API-478862527.US-WEST-2.ELB.AMAZONAWS.COM u2NLAB8k007870
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brighter.do; s=app1;
    t=1458767411; bh=HiluaVoCYKZyFY1h3gE73EqhCFuKBJzE8SqwhrLX5/c=;
    h=Date:Message-Id:To:Subject:MIME-Version:From;
    b=RfNNbBaAUNX+y3cdSqb+NkgC8GHa0wd/vV4LC72DQ8jbSWIHfqxZD6Qi3xGtKVnyU
     2j9FDAtI7X1B7dsPuFIw9F5m+1YoFuV+/3vCQ/zsXxCoExwml7DrxnYuWI0e5MeKma
     3K4T+R/tpNgKYVSU00RNCorLsvyia/fD8+wFTY4ZyoYOTZ4tK6gwcO4loPERiPAAOL
     HI11YagXgreCk3efJXanF8Df9ALLmTZMjMLXHHIHnSsypzhtEXYmua+EWQEZzIiVis
     paAmh9w8sRfeFww4PraRN7Caxznm51ZUIecdST29xRL276LsEgb5Nsy6TIEJyOov/N
     7AilYKXwuotHg==
Received: (from ec2-user@localhost)
    by DUALSTACK.PROD-API-478862527.US-WEST-2.ELB.AMAZONAWS.COM (8.14.4/8.14.4/Submit) id u2NLABrt007869;
    Wed, 23 Mar 2016 21:10:11 GMT
Date: Wed, 23 Mar 2016 21:10:11 GMT
Message-Id: <201603232110.u2NLABrt007869@DUALSTACK.PROD-API-478862527.US-WEST-2.ELB.AMAZONAWS.COM>
To: angela@brighter.do
Subject: Test message
X-PHP-Originating-Script: 500:PushComponent.php
MIME-Version: 1.0
From: Brighter <info@brighter.do>

Note: since I know almost nothing about e-mail admin, it's possible that I'm omitting some key details here. In that event please help me improve the question by mentioning what additional info would be useful – e.g., other config files to include.

Best Answer

I know this question is two months old, but it is a top Google search result for the subject so I figured it deserved an answer.

I don't know what your second and third TXT entries are for. I have DKIM working properly now and I only have a TXT entry similar to your first one.

I followed instructions from Digital Ocean when setting up DKIM on Ubuntu, but it didn't work properly right out of the box. I found this page to be very helpful in debugging my DKIM problem.

To verify that your DNS TXT entry is being read correctly, type the following on the linux command line:

dig +short TXT APP1._domainkey.brighter.do

I'm using GoDaddy for DNS and I didn't need the domain name as part of my domain key string. Instead, I just needed the subdomain portion in the name field, as follows:

mail._domainkey

(I'm using "mail" instead of "app1" to specify my domain key.)

I hope this helps anyone with a similar problem. Once you get DKIM working properly, you'll realize that it's not that confusing. Good luck!

Related Topic