Question
How to get the DKIM public key from Plesk if an external DNS is used and local DNS is not installed?
Answer
Starting from Plesk Obsidian 18.0.35 DKIM public key is shown in the pop-up window on the Mail Settings page of the particular domain.
-
Go to Domains > example.com > Mail Settings > How to configure external DNS:
- For Plesk Version lower than 18.0.35 it's possible to use a manual approach:
For Linux
-
Connect to the server via SSH
-
Private keys are located in the corresponding domain directory in
/etc/domainkeys/
, for example,/etc/domainkeys/**example.com**/default
(for selector "default") -
To extract a public key from a private, run the following:
# openssl rsa -in /etc/domainkeys/example.com/default -pubout
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+aOU9Dw2Qedi6qOEcpbGQ3pHV
I8SonKGNSBBgiImChx6k6I7s1UqeCzaHpKXKLIY4GA601gloVCnnTumZ/5TxnviB
Hg1a2lsatt/gCj2pl61a+uALM1oRdgPhxPYefloFpi0lau8thV6u9BYTfUgfqIF+
dvFIVlu0MULsWDDJfwIDAQAB
-----END PUBLIC KEY-----Merge the result of the command above into one string, and add it as a TXT record for the domain on external DNS server:
default._domainkey.example.com IN TXT "v=DKIM1;k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+aOU9Dw2Qedi6qOEcpbGQ3pHVI8SonKGNSBBgiImChx6k6I7s1UqeCzaHpKXKLIY4GA601gloVCnnTumZ/5TxnviBHg1a2lsatt/gCj2pl61a+uALM1oRdgPhxPYefloFpi0lau8thV6u9BYTfUgfqIF+dvFIVlu0MULsWDDJfwIDAQAB;"
For Windows
-
Connect to the server via RDP
-
In case of MailEnable mail server is used find it's configuration directory:
reg query "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMail EnableMail Enable" | findstr "CONFIG"
Configuration Directory REG_SZ C:Program Files (x86)Mail EnableCONFIGand execute below command, do not forget to replace -in path with found one plus add
DKIMdefault-example.com.key
:"%plesk_bin%openssl" rsa -in "C:Program Files (x86)Mail EnableConfigDKIMdefault-example.com.key" -pubout > C:public.key
The file
C:public.key
will look like:-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCj/lKsikGILTobyJySVXLe4vK2
Yvt82Gqk0og/p5XOXhDxxpjUgKig437UucQHwwVrmwFZ0bavMlg3QLQvRb0S94fE
5jRmikQ9I37v7BZtnxVXXbnrz/GDNLfWlHSugWcf0xY0xV5oi4mhhApwZOYq0SEM
zLt5kgMkCY50hNPuNQIDAQAB
-----END PUBLIC KEY-----Merge the result into one string and copy the data of the public key file into TXT record for the domain to add it on external DNS server.
default._domainkey.example.com. TXT v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCj/lKsikGILTobyJySVXLe4vK2Yvt82Gqk0og/p5XOXhDxxpjUgKig437UucQHwwVrm