Introduction
By default, cPanel generates 2048-bit DKIM keys, which are more secure than 1024-bit keys. While unsupported, generating a 1024-bit DKIM key in cPanel is possible.
Please note that we do not advise that you reduce the security of any aspect of your server, including making less secure DKIM keys. This is no longer an option on servers running Enterprise Linux 8 or above, as the default key size cannot be reduced to a lower value without causing issues with running services.
Procedure
Please note that in the following directions, "$USERNAME" must be replaced with the cPanel user's username.
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Open this file in your preferred text editor:
/usr/local/cpanel/Cpanel/RSA/Constants.pm
- Locate the following line.
$DEFAULT_KEY_SIZE = 2048;
- Change the value to 1024.
$DEFAULT_KEY_SIZE = 1024;
- Save the changes and exit the text editor.
- Use the dkim_keys_uninstall script to uninstall the DKIM keys for the cPanel user.
/usr/local/cpanel/bin/dkim_keys_uninstall $USERNAME
- Use the dkim_keys_install to reinstall the DKIM keys.
/usr/local/cpanel/bin/dkim_keys_install $USERNAME