How to get the DKIM public key from Plesk if DNS is not installed

Follow

Comments

13 comments

  • Avatar
    Pascal Saul

    Is it possible to show the public key in the control panel under "Mail Settings" please. We're not all admins ;)

    Your example is not complete and should be:

    default._domainkey.example.com IN TXT "v=DKIM1;k=rsa;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+aOU9Dw2Qedi6qOEcpbGQ3pHVI8SonKGNSBBgiImChx6k6I7s1UqeCzaHpKXKLIY4GA601gloVCnnTumZ/5TxnviBHg1a2lsatt/gCj2pl61a+uALM1oRdgPhxPYefloFpi0lau8thV6u9BYTfUgfqIF+dvFIVlu0MULsWDDJfwIDAQAB

  • Avatar
    Ivan Postnikov

    @Pascal Saul

    Thank you for the feedback.

    The feature suggestion about showing public key in Plesk UI may be created at Plesk User Voice

  • Avatar
    Prodesignerch

    Error, no such file or directory. :( 

  • Avatar
    Ivan Postnikov

    @Prodesignerch, please, could you give more details about the issue?

    When do you have this error shown? During which step of resolution?

    Also, let us know what OS and Plesk versions do you use?

  • Avatar
    Adl

    Hi, on my test system seems that script not recognize ${NEW_DOMAIN_NAME} parameter.

    I can only see this in /tmp/dkim_keys, a file called

    "dkim_key_.txt"

    And inside this file only

    "default._domainkey. IN TXT "v=DKIM1;k=rsa; p="

    Thanks a lot.

     

  • Avatar
    Harm Jakob Tolsma

    I kept getting errors when verifying DKIM. "OpenSSL wrong tag"
    After some searching I found the reason.
    The script in zip-file seems to use the private key in the output for the record when it is actually the public key that needs to be included.

    ## recreate key:
    openssl rsa -in /etc/domainkeys/$new_domain_name/default -pubout -out public.key  --> Here we create a public key

    ## crop first and last line of keyfile
    sed '1d;$d' /etc/domainkeys/$new_domain_name/default > $tmp_path/$tmp_prefix$new_domain_name$tmp_fe   --> here we trim the private key

    Everything worked as expected after I changed the last line to:
    sed '1d;$d' public.key > $tmp_path/$tmp_prefix$new_domain_name$tmp_fe

  • Avatar
    Bato Tsydenov

    Hello Harm Jakob Tolsma

    Thank you for bringing this to our attention.

    I have updated the script so that it is working correctly now.

  • Avatar
    Alexandr Redikultsev

    Also, automatic script should be executed only via Tools & Settings > Event Manager, manual execution of the script via the command line will not work.

  • Avatar
    Janik R.

    I rewrote the script a little bit so that the keys can now be saved directly in the customer's document root.
    In addition, the script is no longer executed when creating subdomains.

    I've added a little description and installation guide in the readme.

    https://github.com/rabe0577/plesk-dkim-recreate

    I hope I can help you with that.

  • Avatar
    Alisa Kasyanova

    @Janik R.
    Thank you so much for sharing this! I am sure other Pleskians will find it helpful.

  • Avatar
    lydie_t (Edited )

    @Bato Tsydenov I have executed your script but I obtain this error :

    "Can't open /etc/domainkeys/example.com/default for reading, Permission denied

    139775231444224:error:0200100D:system library:fopen:Permission denied:../crypto/bio/bss_file.c:74:fopen('/etc/domainkeys/example.com/default','r')

    139775231444224:error:2006D002:BIO routines:BIO_new_file:system lib:../crypto/bio/bss_file.c:83:

    unable to load Private Key"

    Detailed info for default file are : 

    "-r--r----- 1 root popuser 891 Oct 24 18:06 default"

    How can I correct this error and get my DKIM public key ?

     

  • Avatar
    Alexandr Redikultsev (Edited )

    Hi @lydie_t.

    Please let me know your OS version.

    Also, clarify under what user you are executing the command, and whether or not it is working in case you are running it under root user via SSH, not via scheduled task.

  • Avatar
    lydie_t

    Hi @Alexandr Redikultsev,

    Connecting under root, I am now able to access "default" file (which is the private key), then execute the command indicated by @Bato Tsydenov. This creates the public key.

    Thank you. This helped.

Please sign in to leave a comment.

Have more questions? Submit a request