Bobcares

Configuring DKIM For EXIM | Simple Method Revealed

by | Aug 27, 2022

Let’s take a closer look at configuring DKIM for EXIM. At Bobcares, with our Server Management Service, we can handle your DKIM issues.

Configuring DKIM For EXIM

DKIM is a protocol that enables an organization to accept responsibility for the transmission of a message by signing outbound mail messages and their headers and validating the signatures on incoming messages. The main functions of DKIM include:

  1. DKIM initially confirms that the signing domain starts the message exchange.
  2. DKIM validates signatures on incoming messages as early as possible and signs outbound messages as late as possible.
  3. The outcome of the validation procedure is added to the message in an “Authentication-Results” header, and DKIM does not block messages.
  4. Verify the message’s accompanying digital signature to see if it is authentic.

Configuring DKIM For EXIM: A Simple Method

 

configuring dkim for exim

 

The following steps from our Support team help us to configure DKIM for EXIM.

  1. Firstly, login to the Exim Server.
  2. Then create the Dkim folder using the below command:
    sudo mkdir /etc/exim4/dkim

     

  3. Now create a private key for each domain in the /etc/exim4/dkim folder.
    cd /etc/exim4/dkim
    sudo openssl genrsa -out domain.com-private.pem 2048 -outform PEM

     

  4. Then generate the Public key using the command:
    openssl rsa -in domain.com-private.pem -out domain.com-public.pem -pubout -outform PEM

     

  5. Also, create the /etc/exim4/conf.d/main/00_local_macros file with the command:
    sudo nano /etc/exim4/conf.d/main/00_local_macros

     

  6. Now, complete the content.
    DKIM_CANON = relaxed
    DKIM_SELECTOR = 20200422

     

    # Get the domain from the outgoing mail.
    DKIM_DOMAIN = ${sg{${lc:${domain:$h_from:}}}{^www\.}{}}

     

    # The file is based on the outgoing domain name in the From header.
    DKIM_FILE = /etc/exim4/dkim/{DKIM_DOMAIN}-private.pem

     

    # If a key exists then use it, else don't.
    DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}

     

  7. Now set the permissions on the file using the code:
    sudo chown -R Debian-exim:Debian-exim /etc/exim4/dkim/
    sudo chmod 640 /etc/exim4/dkim/*
    

     

  8. Then update the /etc/exim4/conf.d/transport/30_exim4-config_remote_smtp_smarthost file.
    sudo nano /etc/exim4/conf.d/transport/30_exim4-config_remote_smtp_smarthost

     

  9. Add the following code to the bottom of the file and save it.
    .ifdef DKIM_DOMAIN
    dkim_domain = DKIM_DOMAIN
    .endif
    .ifdef DKIM_SELECTOR
    dkim_selector = DKIM_SELECTOR
    .endif
    .ifdef DKIM_PRIVATE_KEY
    dkim_private_key = DKIM_PRIVATE_KEY
    .endif
    .ifdef DKIM_CANON
    dkim_canon = DKIM_CANON
    .endif
    .ifdef DKIM_STRICT
    dkim_strict = DKIM_STRICT
    .endif
    .ifdef DKIM_SIGN_HEADERS
    dkim_sign_headers = DKIM_SIGN_HEADERS
    .endif
    

     

  10. Now update the Exim4 Configuration using the command:
    sudo update-exim4.conf

     

  11. Finally, restart the Exim4 Service with the below command:
    sudo service exim4 restart

     

With these steps, the configuration of DKIM for EXIM is complete. Now, emails from DKIM-enabled domains will be signed.

[Need help with another query? We’re available 24/7.]

Conclusion

To summarize, we have briefly explained the steps from our Tech Support for configuring DKIM for EXIM.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

4 Comments

  1. Roger

    This used to work but with Exim 4.94 or later, it generates the “Tainted filename” error because the domain names are derived directly from the headers of the outgoing mail.

    Do you have a fix for this?

    Reply
    • Hiba Razak

      Hi Roger,
      Please contact our support team via live chat(click on the icon at right-bottom).

      Reply
      • ManuG

        Hi Roger, Hiba
        Could you please share the fix?

        Thank you

        Reply
        • Hiba Razak

          Hello ManuG,
          Our experts can help you with the issue.we will be happy to talk to you through our live chat(click on the icon at right-bottom).

          Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.