Skip to main content

Set Up DKIM

Configure DKIM to add a cryptographic signature header to outgoing emails processed by xorlab. Recipients can use the corresponding public key, stored in your domain’s DNS records, to verify this signature, confirming that our MTAs are authorized to send emails on your behalf. For further reading on DKIM:

Generating DKIM keys

You have to create one public and a private key and use this key pair for each MTA. Keys can be generated locally or on one of the MTAs via SSH. Commands to generate keys:
Available flags

Configure Opendkim

Once the keys are generated, you need to configure opendkim by creating six new files:
  • opendkim.local.conf: General configuration.
  • signing.table: Maps email domains to key IDs.
  • key.table: Maps key IDs to domains and private keys.
  • trusted: Lists trusted hosts whose emails should be signed.
  • *.private: The private key used for signing.
  • *.txt: DNS record containing the public key.
  1. Go to the Expert Editor on xorlab
  2. In activeguard/mta/opendkim/, create the folder: local
  3. In activeguard/mta/opendkim/local, create the 6 configuration files
  4. For each config file, copy/paste the content from the code blocks below
  5. Adjust the parameters, if necessary.
activeguard/mta/opendkim/local/opendkim.local.conf

Signing table

activeguard/mta/opendkim/local/signing.table

Key table

ImportantDo not alter the path in key.table.
activeguard/mta/opendkim/local/key.table

Trusted list

ImportantMake sure that each IP and hostname of your internal infrastructure is included in the trusted file.
activeguard/mta/opendkim/local/trusted

DKIM record

activeguard/mta/opendkim/local/202406.txt

Activate configurations

  1. Connect to each MTA via SSH.
  2. For each MTA, perform the following steps:
    1. Edit the file: /etc/xorlab/activeguard/docker-compose.yml
      • Go to servicesmtavolumes
      • Add the line ./mta/opendkim:/etc/opendkim/keys/
    2. Create the folder: /etc/xorlab/activeguard/mta/opendkim
      • Copy your private key file into this folder
      • The name of the file must be the same as specified in the key.table file (Although the path is different).
    3. Set the permissions for the private key
      • Only opendkim process should access it (0600, with 2021:2021)
      • Use the following commands:
  3. In the Expert Editor, click Publish. Then restart the MTAs so the new OpenDKIM configuration is loaded:
    • cd /etc/xorlab/activeguard
    • docker compose down && docker compose up -d

Configuring DNS Records

To complete the DKIM setup, you must update the DNS TXT record for your domain. This record can be found in the .txt file generated by opendkim-tools. It contains the public key and is used by receiving mail servers to verify your DKIM signatures.

DMARC Recommendations

DMARC Policies safeguard your domain against unauthorized use, like phishing or email spoofing. DMARC uses DNS records to define how a receiving MTA should handle SPF and DKIM failures (policy), report these failures (reporting), and align the From (5322.From) with the Mail From (Envelope From, 5321.MailFrom). While your domain’s DMARC policy doesn’t affect the operation of the xorlab security platform, we strongly recommend configuring DMARC as part of good email security practices. For more information, please refer to the following resources:

DMARC tags

A text DMARC record consists of name=value tags, separated with semicolons. The descriptions in the table above are mostly direct quotations of RFC 7489

Examples

To observe:
Reject:
In both examples, the DNS TXT record needs to be set for _dmarc.example.com.