19 Responses to “How to enable Domain Keys (DKIM) in Qmail toaster based mail server install on Debian Linux”

  1. admin Epiphany Debian GNU/Linux says:

    After setting the DKIM I’ve figured out my console mail command is not working :|

    # mail -s “testing 123″ hipo@pc-freak.net
    adsfadsffdsa
    .
    Cc:
    qmail-inject: fatal: mail server permanently rejected message (#5.3.0)
    Can’t send mail: sendmail process failed with error code 100

    Have to google around to see if there is a fix

  2. admin Epiphany Debian GNU/Linux says:

    Got the error:
    It was /var/qmail/bin/sendmail
    While I was experimenting it appears I set a sendmail wrapper script as an attempt to solve some old qmail trouble.

    My /var/qmail/bin/sendmail wrapper script looked like so:

    #!/bin/sh
    export QMAILQUEUE=/var/qmail/bin/qmail-dk
    export DKQUEUE=/var/qmail/bin/qmail-queue.orig
    export DKSIGN=/etc/domainkeys/mydomain.com/default
    exec /var/qmail/bin/sendmail.orig “$@”

    After restoring to the original /var/qmail/bin/sendmail.orig binary all is well e.g.:

    debian:~# cp -rpf /var/qmail/bin/sendmail.orig /var/qmail/bin/sendmail

  3. admin Epiphany Debian GNU/Linux says:

    Another good howto resource, which gives some genera tips how to enable qmail DKIM Signing is found on http://jeremy.kister.net/howto/dk.html.
    I have used chunks of it in order to write this tutorial

  4. admin Epiphany Debian GNU/Linux says:

    Using the qmail-remote bash wrapper from http://www.pc-freak.net/files/qmail-remote.wrapper.old I got the following headers:

    From - Wed May 25 13:13:32 2011
    X-Account-Key: account11
    X-UIDL: 1306318471.48009.pcfreak,S=1958
    X-Mozilla-Status: 0001
    X-Mozilla-Status2: 00000000
    X-Mozilla-Keys:
    Return-Path: <hipo@mydomain.com>
    Delivered-To: hipo@pc-freak.net
    Received: (qmail 48006 invoked by uid 1048); 25 May 2011 10:14:30 -0000
    Received: from mail.mydomain.com (83.170.105.141)
    by mail.pc-freak.net with SMTP; 25 May 2011 10:14:30 -0000
    DKIM-Signature: a=rsa-sha1; c=relaxed; d=mydomain.com;
    s=default; t=1306318395; x=1307182395; h=Received:From; b=k/hvkL
    zPXS4xwYaptsg9M8r3esJzQz71q7lK4uYV29VE35qghbmlXD2ShvwwwmElGK2mLR
    sFt/0b38dxjNZeu++R0UJ7jK3BJLqhbb/H3BeqdYgjnVloF693fxrwQOFxhSXk06
    KTuTrFwF+sVmFvdYIRDDLcsFJo7qBVuN8LPxI=
    DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=mydomain.com;
    s=default; t=1306318395; x=1307182395; h=Received:From; bh=uoq1o
    CgLlTqpdDX/iUbLy7J1Wic=; b=VLw/fJAMQzI2Ba9e5EEsGcjmsDxzhmvYWuAGM
    SgKmwpdfG1DXknYWs1aX1ia25dHINhPlCixhoGWBiQTHSL7hHXNaOHsFNp5wUifu
    0piuBkMvsOWjZt3tf3yhdBxoQEvE2tz2f7MWSkA6QOtGznBiI4A9zjyq8/Q3FcZR
    hYKSp0=
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mydomain.com;
    s=default; t=1306318395; x=1307182395; h=Received:From; bh=frcCV
    1k9oG9oKj3dpUqdJg1PxRT2RSN/XKdLCPjaYaY=; b=Cozq+28r4hnpZ+9IfM6pt
    l7vJSvRE5jsRfwMr/PyE3ubaII+LPDzcvBp4Do8UPvzQln31DM2Hkdu9uvxvh2po
    Qgi+eHWN6kW2bcH2HuqnIeFdURdJMVGA946I/eFKH5AB/1bcGXEumeKC0n84H+a7
    1596ArTCsGX3jRznvg/t6k=
    Received: (qmail 32713 invoked by uid 89); 25 May 2011 10:13:15 -0000
    Received: from unknown (HELO webmail.mydomain.com) (127.0.0.1)
    by 0 with SMTP; 25 May 2011 10:13:15 -0000
    Received: from 83.228.93.76
    (SquirrelMail authenticated user hipo@mydomain.com)
    by webmail.mydomain.com with HTTP;
    Wed, 25 May 2011 11:13:15 +0100 (BST)
    Message-ID: <59494.83.228.93.76.1306318395.squirrel@webmail.mydomain.com>
    Date: Wed, 25 May 2011 11:13:15 +0100 (BST)
    Subject: baklava
    From: hipo@mydomain.com
    To: hipo@pc-freak.net
    User-Agent: SquirrelMail/1.4.9a
    MIME-Version: 1.0
    Content-Type: text/plain;charset=UTF-8
    Content-Transfer-Encoding: 8bit
    X-Priority: 3 (Normal)
    Importance: Normal

    Notice the three DKIM-Signature sections in the header, this obviously means the DKIM-Signature of my outgoing mails is fine.
    What is weird is that the email gets a DKIM-Signature 3 times?
    I’m still investigating why is that asap as I have found why it’s like that I’ll explain it here.
    I’ve figured out why the DKIM-Signature gets signed three times within the mail header after a while.

    It seems the script that does the strange DKIM-Signature is signing my headers 3 times, once again script is found here http://www.pc-freak.net/files/qmail-remote.wrapper.old

    I’ll fix that in the toturial, right away

  5. admin Epiphany Debian GNU/Linux says:

    Just one more handy test which might be helpful to somebody.
    In order to make sure dkimsign.pl does issue correct DKIM-Signatures, create a new file with some content for instance:

    host# touch aaa
    host# echo ‘aaaaaa’ >> aaa
    host# /usr/local/bin/dkimsign.pl < aaa
    DKIM-Signature: v=1; a=rsa-sha1; c=simple; h=; s=selector1; bh=uoq1oCgLl
    TqpdDX/iUbLy7J1Wic=; b=Di1wbTcT1ZFMdsrJM12z9TX23uiLNtvBTSrJZArED
    GinESGM1ouZkkGduuj+wVKJq3xTdQ10eo68V8Af0P7UuzPLIncO9KUhagtrRqNSi
    Eie15+eQXi7QGYo2eA4thvs

    You see the DKIM-Signature appearing, this means dkimsign.pl works fine.

  6. admin Epiphany Debian GNU/Linux says:

    Another thing I’ve noticed is you might get troubles, where mails are not signed with DKIM-Signature or Domainkey-Signature, in case if your rsa private file (default) is missing (for example /etc/domainkeys/domainaname.com/default), where domainname.com is the vpopmail domain that physically the mail is sent from.

  7. admin Epiphany Debian GNU/Linux says:

    Also on domains not managed by a custom BIND DNS server but by some external mail reseller companies DNS servers like Godaddy.

    A TXT records which are necessery to set up are:
    TXT name is: _domainkey.yourdomain.com
    TXT value is: t=y; o=-
    TXT name is: private._domainkey.yourdomain.com
    TXT value is: k=rsa; p=XXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx………

  8. hip0 says:

    If you get a “DomainKey-Status: bad” in the headers in gmail.com. This means something is wrong with the configured domain key…

    • hip0 says:

      Most common reason for a “Domainkey-Status: bad” is improperly configured (pasted) TXT RSA key in the DNS server.
      I’ve experienced this on a couple of domains I was configuring domainkeys.

  9. hip0 says:

    Few very handy websites, to debug if finally the configured domainkeys are working properly are:
    http://www.mailradar.com/domainkeys/ (Domainkey Checker)
    http://domainkeys.sourceforge.net/policycheck.html (DomainKey Policy Record Tester)

    First website (Domainkey Checker) checks the header and matches against the created DNS record. If both the header values for domainkeys match certain criterias the domain key is considered valid. Many times, enabling domain keys and having a headers could still be invalid. It happened to me many times. Thus this online resource check is important indicator if DKIM is properly configured.

    Second one (DomainKey Policy Record Tester), checks and assures that the domain DNS configured TXT records for domainkeys are correct.

  10. hip0 says:

    Another good debugging tool helpful in checking domain record is correct:
    http://domainkeys.sourceforge.net/selectorcheck.html

  11. admin Mozilla Firefox Ubuntu Linux says:

    Another handy source of debug is sending mail to mail:
    check-auth2 [at] verifier.port25.com

    In less than minute an automated mail will be returned back giving hints on what might be causing the Domain key issues:
    You will get something like:

    hank you for using the verifier,

    The Port25 Solutions, Inc. team

    ==========================================================
    Summary of Results
    ==========================================================
    SPF check: pass
    DomainKeys check: pass
    DKIM check: permerror
    Sender-ID check: pass
    SpamAssassin check: ham

    ==========================================================
    Details:
    ==========================================================

  12. Cero says:

    Hey! great article. Im looking to do the same with postfix (latest version) and exim (latest version too). Is there any possibility that you may do an article as fine and complete as this for those mta? That would be really awesome of you. Keep the great working. Thanks.

  13. Cero says:

    Thanks Gerogi for your reply. Do you know how to do it on exim? For people it is still needed to use both DomainKeys AND DKIM. Hope your expertice can be share to all of us with that need. :)

  14. astma says:

    Od dawna szukałem artykułu na temat How to enable Domain Keys (DKIM) in Qmail toaster based mail server install on Debian Linux | Walking in Light with Christ – Faith, Computing, Diary . Dzięki

  15. Rodney says:

    You can also send an email to mailtest@unlocktheinbox.com

    It will auto-respond and give you details results of all your header records and link you to resources that can help you correct the issues you might have.

  16. Etta Majkut says:

    hello there and thanks in your info ? I’ve definitely picked up something new from right here. I did alternatively expertise several technical points the use of this web site, as I skilled to reload the website a lot of occasions previous to I could get it to load correctly. I were wondering in case your web host is OK? Not that I am complaining, but sluggish loading cases instances will sometimes affect your placement in google and could injury your quality score if ads and marketing with Adwords. Well I’m including this RSS to my email and can look out for a lot extra of your respective interesting content. Ensure that you replace this once more very soon..

Leave a Reply