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.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF