#StackBounty: #postfix #opendkim Opendkim: fail (signature doesn't verify)

Bounty: 50

I had generated my public and private key using opendkim-genkey:

opendkim-genkey -s mail -d mylittlepony.com

It is supposed to be linked in the KeyTable file:

/etc/opendkim$ cat KeyTable
mail._domainkey.mylittlepony.com mylittlepony.com:mail:/etc/opendkim/keys/mylittlepony.com/mail.private

The files have the following permissions:

ls -l
total 8
-rw------- 1 opendkim opendkim 1675 May 14 00:40 mail.private
-rw------- 1 root     root      499 May 14 00:40 mail.txt

And the register in the DNS server matches the domain:

dig mail._domainkey.mylittlepony.com TXT                 
; <<>> DiG 9.10.3-P4-Debian <<>> mail._domainkey.mylittlepony.com TXT
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51597
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mail._domainkey.mylittlepony.com. IN    TXT

;; ANSWER SECTION:
mail._domainkey.mylittlepony.com. 3600 IN TXT    "v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApcDLjZ2yF4U9uC0Ux1LX+E1q9Ci1NW7oppJFENtr7mCGBecSgITDJN+E4Tfrycv5pAXMy5Ogp+3f4rBkbY2TiG9klB7tmppA7a1noNWIoK66Y5x2IuT133FeBnMzbsqjOHmzM3BRaIG7DStSgQ7wVsm77jdu8A1xp5l2b1bRBnYjiXPzngnZgUe" "zLAjOx45hOvgduTjpRiSWIZwSaLdu5zWC1q3oZLudFR0ZNM28HNIqkMgkn7UN0ja7Ktda3m+NpGDCufrut4r8A+7tAoFg//2aSz2y9nhnv1wBW9CLJAwQhS5MMF5XX2V0YAsukQKqgEEKLVETCI+za1r+w0uA8wIDAQAB"

;; Query time: 77 msec
;; SERVER: 213.186.33.99#53(213.186.33.99)
;; WHEN: Tue May 22 16:40:38 CEST 2018
;; MSG SIZE  rcvd: 494

However if I try to use check-auth@verifier.port25.com to verify the sign, it fails:

----------------------------------------------------------
DKIM check details:
----------------------------------------------------------
Result:         fail (signature doesn't verify)
ID(s) verified:

Canonicalized Headers:
    date:Tue,'20'22'20'May'20'2018'20'16:16:55'20'+0200'0D''0A'
    to:check-auth@verifier.port25.com,'20'contact@mylittlepony.com'0D''0A'
    subject:init'0D''0A'
    from:contact@mylittlepony.com'0D''0A'
    dkim-signature:v=1;'20'a=rsa-sha256;'20'c=relaxed/simple;'20'd=mylittlepony.com;'20's=mail;'20't=1526998615;'20'bh=hOh3Yp1dLyZGJvK8/42zF1kV1HY5R05meILkgey8wiA=;'20'h
=Date:To:Subject:From:From;'20'b=

Canonicalized Body:
    init'0D''0A'


DNS record(s):
    mail._domainkey.mylittlepony.com. 60 IN TXT "v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApcDLjZ2yF4U9uC0Ux1LX+E1q9Ci1NW7oppJFENtr7mCGBecS
gITDJN+E4Tfrycv5pAXMy5Ogp+3f4rBkbY2TiG9klB7tmppA7a1noNWIoK66Y5x2IuT133FeBnMzbsqjOHmzM3BRaIG7DStSgQ7wVsm77jdu8A1xp5l2b1bRBnYjiXPzngnZgUezLAjOx45hOvgduTjpRiSWIZwSaLdu5zWC
1q3oZLudFR0ZNM28HNIqkMgkn7UN0ja7Ktda3m+NpGDCufrut4r8A+7tAoFg//2aSz2y9nhnv1wBW9CLJAwQhS5MMF5XX2V0YAsukQKqgEEKLVETCI+za1r+w0uA8wIDAQAB"

Would you know why is it generating the error “fail (signature doesn’t verify)”?

— Update 1:

This is a sample of an email sent from my SMTP:

From contact@mylittlepony.com Thu May 24 10:44:28 2018
Return-Path: <contact@mylittlepony.com>
X-Original-To: contact@mylittlepony.com
Delivered-To: codingfree@mylittlepony.com
Received: from mylittlepony.com (localhost [127.0.0.1])
        by mylittlepony.com (Postfix) with ESMTP id AE1401FAD1;
        Thu, 24 May 2018 10:44:28 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mylittlepony.com;
        s=mail; t=1527151468;
        bh=hOh3Yp1dLyZGJvK8/42zF1kV1HY5R05meILkgey8wiA=;
        h=Date:To:Subject:From:From;
        b=RruMH7zhgZtAk+4eLx4SB0/rCBde+G43YPutbNq6UcIBg1R3lmyiF5biFPWz+Jb3q
         9OR9GMeDn1IDne1m9A3NH+c8AdjWEI3OYRvFYo8Ps8bv+QJrQgPOvxTXPbNvJWh98r
         wXS5DG6n9xBgd45gwHgX1r8X75ROJK5nXXGiUhIyy680INXewgFQ/P0zt4cK+d3hEp
         KiY25cfaU56q/bYgk3BAFw0tN/BzX7J29bNFs3uOv7gPd/7eYHNJNMqPlk8KNniMd/
         thiCAk9Q3qFkfY8ObznRTDyPO7m/iof3OQHMZHoXws1pksBEtJKs+la26aKEZr8PKs
         0X5TiGP93kOaw==
Received: by mylittlepony.com (Postfix, from userid 1001)
        id 8F36D1FAD9; Thu, 24 May 2018 10:44:28 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mylittlepony.com;
        s=mail; t=1527151468;
        bh=hOh3Yp1dLyZGJvK8/42zF1kV1HY5R05meILkgey8wiA=;
        h=Date:To:Subject:From:From;
        b=DvHuAbB+kAHVs9uJoG8ugYIyVcr455qupTuuNNu6kGlO30FwwA9FLlRaxG0Qms/mp
         2CbdbiiLF4MJFlc9idYb49hUBbmb9usF1KNO0YjZgHCySBjOcdUf23fwQoXAmZbqpH
         LrzpSlYAVDs+QCT4zGuSxgMbKCS9UeYvmtOS5QWAYhOLyStrsdZXbi8xirKqijQK33
         L4pVFpvhM6tzGYvyXJ/4uysHtZ1zoFyUf2Ae6NZ+mVAK5Je370hF2c1KxEe995UMu1
         XxSpAhOyjD7kPRm9fCfxbM1w6etPE9Io9M2ppjvLnovI1zj8b5UMP06GmsGS5zKqKY
         f7mq5UA3Xzm7A==
Date: Thu, 24 May 2018 10:44:28 +0200
To: check-auth@verifier.port25.com, contact@mylittlepony.com
Subject: init
User-Agent: s-nail v14.8.16
Message-Id: <20180524084428.8F36D1FAD9@mylittlepony.com>
From: contact@mylittlepony.com
X-Virus-Scanned: ClamAV using ClamSMTP
Status: R

init

I am not sure, but are there missing headers in this email, such as “h”?

h=Date:To:Subject:From:From;

According to the rfc4871, those are the signed headers, which seem to be empty. Is this the problem?

Thanks.


Get this bounty!!!

Leave a Reply