The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DKIM for main server hostname

Discussion in 'E-mail Discussions' started by Mads Nordholm, Jun 7, 2015.

  1. Mads Nordholm

    Mads Nordholm Member

    Joined:
    Jun 7, 2015
    Messages:
    20
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Thailand
    cPanel Access Level:
    Root Administrator
    Hi,

    I was trying to set up a DKIM record for my main server hostname today, but that doesn't really seem to be possible through the WHM interface. This post on the feature request board seems to back that theory: https://features.cpanel.net/topic/dkim-for-hostname

    So, does anybody know about a workaround for this issue?

    It must be possible to set this up manually, but I am just not sure which services on the server actually need to be configured for this to work. If anybody could point me in the right direction, I would be very grateful.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    The DKIM record is added in the DNS zone, so you can simply setup the DNS entry through the "Edit a DNS Zone" option in Web Host Manager.

    Thank you.
     
  3. Mads Nordholm

    Mads Nordholm Member

    Joined:
    Jun 7, 2015
    Messages:
    20
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Thailand
    cPanel Access Level:
    Root Administrator
    Thank you. That's great, but how do I generate a valid DKIM entry for the main hostname? For all other domains it's done automatically by cPanel just by ticking a checkbox, but how would I go about doing this for the main hostname?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You can temporarily add the following entry to /var/cpanel/users/nobody as a workaround:

    Code:
    DNS=hostname.domain.com
    Then, run this command:

    Code:
    /usr/local/cpanel/bin/dkim_keys_install nobody
    Thank you.
     
  5. max_payne

    max_payne Active Member

    Joined:
    Feb 1, 2013
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Wont simply adding a TXT entry in WHM>>Edit DNS Zone (granted you are using your own private nameservers) for the hostname subdomain create a DKIM record for it? So essentially, you would go to the DNS zone file for domain.com and create the following:

    hostname TXT "<dkim record>"

    Please correct me if I am wrong here.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, you can add the zone entry manually if you prefer. However, you must also ensure the key is properly generated, so the workaround is often easier.

    Thank you.
     
  7. max_payne

    max_payne Active Member

    Joined:
    Feb 1, 2013
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Thanks. Although if you need a DKIM record set up for your hostname then you are likely doing things wrong. It is likely a PHP mail sending script that is sending as user or nobody@hostname.domain.com. Enable SMTP authentication instead for your mail sending script. If you are running WordPress then enable the 'WP SMTP' plugin to automatically configure all mail sending scripts/plugins to send as a real email address instead of as an address with the hostname specified. This should prevent you from requiring DKIM records for the hostname in the first place.
     
  8. Mads Nordholm

    Mads Nordholm Member

    Joined:
    Jun 7, 2015
    Messages:
    20
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Thailand
    cPanel Access Level:
    Root Administrator
    Thanks for the input. You are of course right that there should be no DKIM record for the host. I was having an issue with cPanel system emails ending up in my spam folder, and I thought it would be worth a try to add a DKIM record. Turns out my PTR record was wrong, and that fixed the issue for me.

    Thanks for the input in this thread.
     
  9. nootkan

    nootkan Well-Known Member

    Joined:
    Oct 25, 2006
    Messages:
    129
    Likes Received:
    2
    Trophy Points:
    18
    Michael, when you say temporarily do you mean to remove the DNS=hostname.domain.com line from /var/cpanel/users/nobody after running the /usr/local/cpanel/bin/dkin_keys_install nobody command?
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, the goal is to simply have the DKIM record generated for the hostname, so you can remove the entry after making the edit.

    Thank you.
     
  11. allpar

    allpar Active Member

    Joined:
    Sep 16, 2005
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    I got: Cpanel::DnsUtils:608: Empty dns zone host2.domain.com at /usr/local/cpanel/bin/dkim_keys_install line 27, <$socket> line 3.
     
    #11 allpar, May 26, 2016
    Last edited by a moderator: May 27, 2016
  12. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page