Configuring your platform

Enabling DKIM

161 views 0

How to configure and enable DKIM support.


You can add a DKIM signature to emails sent from the Atomia platform. First, you need to configure the mail server to support DKIM. Then you should enable DKIM provisioning in the Atomia.

Configuring the postfix server

In order to configure the postfix server, you need to:

  1. install and configure OpenDKIM,
  2. configure postfix milters and
  3. create dkim table.

Installing OpenDKIM

Install the next packages, for example, with these commands:

apt-get install opendkim opendkim-tools
apt-get install libopendbx1-mysql

Edit the opendkim configuration file/etc/opendkim.conf to look like this:

UMask 002

Syslog yes
LogWhy yes

SigningTable dsn:mysql://vmail:*****@
KeyTable dsn:mysql://vmail:*****@,selector,private_key

ExternalIgnoreList /etc/opendkim/trusted_hosts
InternalHosts /etc/opendkim/trusted_hosts
AutoRestart Yes
AutoRestartRate 10/1h
Mode sv
PidFile /var/run/opendkim/
SignatureAlgorithm rsa-sha256
Canonicalization relaxed/relaxed
UserID opendkim:opendkim

In the example configuration above, you should replace ***** with the real password for the vmail database.

To use opendkim on inet sockets edit file /etc/default/opendkim and replace



SOCKET="inet:[email protected]"

Define opendkim trusted hosts in the file /etc/opendkim/trusted_hosts. For example:

#local host
# local subnets that are trusted and do not need to be verified

The service opendkim should be restart to apply the configuration.

Configuring postfix

Change the configuration file of postfix /etc/postfix/  You will need to add the opendkim milter to the list of active milters. For example:

milter_protocol = 6
milter_default_action = accept
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345

Create dkim table

Extend existing vmail database with table dkim:

`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
`domain_name` varchar(255) NOT NULL,
`selector` varchar(63) NOT NULL,
`private_key` text,
`public_key` text,

Enabling DKIM provisioning

You should modify the resource description and the provisioning description files to enable DKIM in Atomia.

Resource description

You should add OpenSSLBinary and OpenSSLConfig properties to the PostfixAndDovecot module in the resource description. The automation server uses these properties to locate OpenSSL and generate keys for  DKIM provisioning. Example PostfixAndDovecot section in the configuration file C:\Program Files (x86)\Atomia\AutomationServer\Common\Resources.xml:

        <module name="Atomia.Provisioning.Modules.PostfixAndDovecot.PostfixAndDovecot" resourceAsignmentPolicy="RoundRobin"  />
        <resource name="PostfixDovecotDB" >
            <property name="DatabaseHost"></property>
            <property name="DatabaseName">vmail</property>
            <property name="Username">postfix_agent</property>
            <property name="Password">1234567</property>
            <property name="MailIpAddress"></property>
            <property name="Mail2IpAddress"></property>
            <property name="SmtpIpAddress"></property>
            <property name="ImapIpAddress"></property>
            <property name="PopIpAddress"></property>
            <property name="WebmailIpAddress"></property>
            <property name="OpenSSLBinary">C:OpenSSL-Win64binopenssl.exe</property>
            <property name="OpenSSLConfig">C:OpenSSL-Win64binopenssl.cfg</property>

Provisioning description

You need to enable DKIM service provisioning. You can use the next file to enable provisioning in the provisioning description for the DKIM:

<?xml version="1.0" encoding="utf-8"?>
<provisioningDescription xmlns:xdt="">
    <complexServiceProperty xdt:Locator="XPath(//complexServiceProperty[@name='InitDkim'])" name="InitDkim" description="If set to true DKIM service will be provisioned" xdt:Transform="SetAttributes(defaultValue)" defaultValue="true" />

Was this helpful?