How to generate 1024-bit DKIM keys Cpanel

Latest version of cpanel uses 2048 key whereas a 1024 key from previous versions generated a key of 255 characters or less.

There might be some difficulties on using this long DKIM key.

This article explains the details to create 1024-bit DKIM keys Cpanel.

Step1: Login to the server as root.

Step2: Open DKIM config file.

#vi /usr/local/cpanel/Cpanel/DKIM.pm

Step3: Make the following changes in this file.

Around line 24,

our $_MYDNS_KEY_SIZE = 1024;

Around line 192 comment out current line and add the new one,

#local $Cpanel::OpenSSL::DEFAULT_KEY_SIZE = $_MYDNS_KEY_SIZE if _nameserver_is_mydns();
local $Cpanel::OpenSSL::DEFAULT_KEY_SIZE = 1024;
#my $keysize_min = $Cpanel::OpenSSL::DEFAULT_KEY_SIZE;
my $keysize_min = 1024;

Step4: Reinstall DKIM keys

#/usr/local/cpanel/bin/dkim_keys_uninstall username
#/usr/local/cpanel/bin/dkim_keys_install username

That's all....

Leave a Reply

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