add dkim_key to amavisd.conf from ISPConfig 3


Update: ISPConfig – DKIM-Patch

I’ve just blocked the sending of emails for a domain. Only short listed in ISPConfig a new domain and mailbox created, used the dns wizard to create the dns records. works as expacted? fault!

The first sent mail returned due to a spf-error.

SPF is on my servers automatically entered in the dns. I forget just to add the domain-key to /etc/amavisd.conf. Now I have a small php script that checks active dns zones for TXT-Records with “v=spf” and adds missing domains to amavisd.conf.

Since I use for all domains the same key, that’s no problem.

In the scripts only three lines need to be adjusted:

$ipaddress = '176.9.24.113';
$amavisd_conf='/etc/amavisd.conf';
$amavis_key_value=", 'default', '/etc/postfix/dkim/default.private');";

$ipaddress is the defined server-ip in ISPConfig.
$amavisd_conf is the complete path to your amavisd.conf
$amavis_key_value contains parts of dkim_key from the amavisd.conf. My complete entry is

dkim_key('schaal-24.de', 'default', '/etc/postfix/dkim/default.private');

As you can see dkim_key('schaal-24.de' is dropped here.

To get remote-access to the controlpanel from ISPConfig, you have to create or adjust /usr/local/ispconfig/server/lib/soap_config.php:


If you haven´t already defined a remote-user in ISPConfig, on the next step create one under

System -> Remote Users -> Add user

with minimum rights “DNS txt functions” and “Server functions”

You can run this script anytime by just typing php add_amavis.php – new entries to the amavisd.conf were added only if they are missing.

Download: add_amavis


Leave a comment

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

I confirm

3 thoughts on “add dkim_key to amavisd.conf from ISPConfig