Skip to main content

Generate 1024-bit DKIM keys

Comments

12 comments

  • cPanelMichael
    Hello, I've moved this thread to our "Workarounds" forum. Keep in mind that cPanel updates will overwrite the /usr/local/cpanel/Cpanel/DKIM.pm file, so you may need to manually patch it after each update until a resolution is reached on the remote DNS provider's interface. Thank you.
    0
  • BottNet
    Great work around! This REALLY still needs to be address in CP itself as A LOT of places do not accept anything over 1024 including ENom. CP should allow you to select the key type 1024 or 2048 before generation. IMHO
    0
  • Xavier Crespin
    I agree, this issue needs a permanent fix ASAP, OVH DNS service does not support 2048 bit keys either.
    0
  • letmein
    Although my external DNS servers accept 2048 bit keys perfectly, I noticed that Microsoft (live.com, hotmail.com, etc.) is unable and/or unwilling to verify 2048 bit keys (dkim=temperror), which forced me to lower the size of DKIM keys for domains that use online mail forms. To avoid having to edit certain settings after updates, I use this method to create keys per domain:
      ]
    • in the user's home directory, generate a 1024 bit private and public key:
      # openssl genrsa -out private.key 1024 # openssl rsa -in private.key -pubout -out public.key
    • backup your old key:
      # mv /var/cpanel/domain_keys/private/domain.tld /var/cpanel/domain_keys/private/domaint.tld.old
    • move the newly generated private key to its proper location:
      # mv /home/user/private.key /var/cpanel/domain_keys/private/domain.tld
    • set ownership and permissions:
      # chown root:mail /var/cpanel/domain_keys/private/domain.tld # chmod 640 /var/cpanel/domain_keys/private/domain.tld
    • update your DNS record with the new public key that you will find in public.key:
      # cat public.key
    Tested on CentOS 6.8 x86_64 with cPanel 60.0 (build 26).
    0
  • lapsutrix
    Hi letmein Thank for that. following this, everything is ok now but when i do the email to gmail.com i see the error "DKIM: NEUTRAL with domain null" I have tested with dkimcore.org/c/keycheck, it is ok do you know where is the problem how can i check on it? thanks
    0
  • letmein
    I have tested with dkimcore.org/c/keycheck, it is ok

    I wouldn't rely on just one test. You can verify your settings with multiple parties like dkimvalidator.com and mail-tester.com. Enabling and keeping an eye on DMARC-reports may also provide more insight. Based on the single error (generated by which party? Google? what do other receiving parties say?) you posted, my guess would be that your SMTP does not sign your outgoing mails correctly or does not sign them at all.
    0
  • Loneweaver
    Around line 24, set the key size to 24:

    @cPanelMichael Is this a typo? Is it 1024 or 24?
    0
  • cPanelMichael
    Hello, Yes, it looks like a typo by the original poster. That should show "1024". Thank you.
    0
  • KaiserTom
    Thank you @letmein this has solved a problem we've been having for some time now.
    Although my external DNS servers accept 2048 bit keys perfectly, I noticed that Microsoft (live.com, hotmail.com, etc.) is unable and/or unwilling to verify 2048 bit keys (dkim=temperror), which forced me to lower the size of DKIM keys for domains that use online mail forms. To avoid having to edit certain settings after updates, I use this method to create keys per domain:
      ]
    • in the user's home directory, generate a 1024 bit private and public key:
      # openssl genrsa -out private.key 1024 # openssl rsa -in private.key -pubout -out public.key
    • backup your old key:
      # mv /var/cpanel/domain_keys/private/domain.tld /var/cpanel/domain_keys/private/domaint.tld.old
    • move the newly generated private key to its proper location:
      # mv /home/user/private.key /var/cpanel/domain_keys/private/domain.tld
    • set ownership and permissions:
      # chown root:mail /var/cpanel/domain_keys/private/domain.tld # chmod 640 /var/cpanel/domain_keys/private/domain.tld
    • update your DNS record with the new public key that you will find in public.key:
      # cat public.key
    Tested on CentOS 6.8 x86_64 with cPanel 60.0 (build 26).

    0
  • cPanelFelipe
    Just to float an idea, do eNom et al. handle ed25519 keys in DKIM? There is no standard for ECDSA keys in DKIM, but ed25519 would provide key sizes that easily fit within a DNS character-string, which I assume is the problem with 2,048-bit RSA in DKIM.
    0
  • Gabriele Lo Surdo
    I solved my issues with hover.com (not supporting 2048-bit records) following a slightly modified version of the @letmein instructions. Please find below the commands I used. Replace "user" and "domain.tld" with your username and your domain.
    cd /home/user

    openssl genrsa -out private.key 1024

    openssl rsa -in private.key -pubout -out public.key

    mv /var/cpanel/domain_keys/private/domain.tld /var/cpanel/domain_keys/private/domain.tld.old

    mv /home/user/private.key /var/cpanel/domain_keys/private/domain.tld

    mv /var/cpanel/domain_keys/public/domain.tld /var/cpanel/domain_keys/public/domain.tld.old

    mv /home/user/public.key /var/cpanel/domain_keys/public/domain.tld

    chown root:mail /var/cpanel/domain_keys/private/domain.tld

    chmod 640 /var/cpanel/domain_keys/private/domain.tld
    After entering all these commands go to your Cpanel dashboard, click on "Email Deliverability", and then on the "Manage" button next to your domain name. There you can find the DKIM record details.
    0
  • siteturbo
    I solved my issues with hover.com (not supporting 2048-bit records) following a slightly modified version of the @letmein instructions. Please find below the commands I used. Replace "user" and "domain.tld" with your username and your domain.
    cd /home/user

    openssl genrsa -out private.key 1024

    openssl rsa -in private.key -pubout -out public.key

    mv /var/cpanel/domain_keys/private/domain.tld /var/cpanel/domain_keys/private/domain.tld.old

    mv /home/user/private.key /var/cpanel/domain_keys/private/domain.tld

    mv /var/cpanel/domain_keys/public/domain.tld /var/cpanel/domain_keys/public/domain.tld.old

    mv /home/user/public.key /var/cpanel/domain_keys/public/domain.tld

    chown root:mail /var/cpanel/domain_keys/private/domain.tld

    chmod 640 /var/cpanel/domain_keys/private/domain.tld
    After entering all these commands go to your Cpanel dashboard, click on "Email Deliverability", and then on the "Manage" button next to your domain name. There you can find the DKIM record details.

    Worked perfectly. Thank you!!!
    0

Please sign in to leave a comment.