{"id":1373,"date":"2017-07-19T14:13:06","date_gmt":"2017-07-19T19:13:06","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=1373"},"modified":"2026-05-15T14:05:46","modified_gmt":"2026-05-15T19:05:46","slug":"setting-up-a-new-email-domain-with-senderid-and-dkdkim-txt-records","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=1373","title":{"rendered":"Setting Up A New Email Domain \u2013 With SenderID and DK\/DKIM TXT Records"},"content":{"rendered":"<p>If you are going to begin using e-mail on a sub-domain of an existing zone, you do not need to do anything special to register the sub-domain. If this is a new domain, it needs to be publicly registered first. The examples used here-in will be a mail domain subordinate to example.com. If you are performing the tasks for a new zone, create the new zone first.<\/p>\n<p>To allow e-mail exchange with a domain, create MX record(s). For a third party vendor, they need to tell you what their mail exchangers <em>are<\/em>. For internally hosted services, define your own:<\/p>\n<p>example..com\u00a0 MX preference = 10, mail exchanger = primarymailhost.example.com<\/p>\n<p>example.com\u00a0 MX preference = 20, mail exchanger = secondarymailhost.example.com<\/p>\n<p>example.com\u00a0 MX preference = 110, mail exchanger = fallbackmailhost.example.com<\/p>\n<p>Within Infoblox, you need to be using the <em>external<\/em> DNS view. You <em>can<\/em> create matching records internally \u2013 we tend <em>not<\/em> to create internal MX records as it prevents internal multi-mailer infections from routing messages. In the proper zone, click Add =&gt; Record =&gt; MX Record<\/p>\n<p>The mail destination will be the subzone (here we are exchanging e-mail with @ljrtest.example.com)<\/p>\n<p>Save this change and create the other MX records. ** You need to clue the servers into the fact this domain is now valid. ** On each server, edit \/etc\/mail\/access and add<\/p>\n<p>Ljrtest.example.com\u00a0 RELAY<\/p>\n<p>If you want to use the virtusertable to map addresses within the domain, you also need to add the domain name to \/etc\/mail\/virtuser-domain<\/p>\n<p>Finally, you need to send the mail <em>somewhere. <\/em>Edit \/etc\/mail\/mailertable and set a relay destination of somewhere that knows about the domain and is processing mail for it (is that our Exchange server? Someone else\u2019s Unix server? An acquired company\u2019s mail server? \u2026 depends on what you are trying to do!)<\/p>\n<p>rushworth.us\u00a0\u00a0\u00a0 relay:[10.5.5.85]<\/p>\n<p>Save, make, and restart sendmail \u2026 now you have a fully functional external email domain.<\/p>\n<p>Now secure it \u2013 that means adding sender policy framework (SPF), domain key (DK), and domain key identified mail (DKIM) records.<\/p>\n<p><strong>SPF and SenderID Records<\/strong><\/p>\n<p>There are both sender policy framework (v1) and SenderID (v2) records \u2013 you can create both. Not too many people use SenderID anymore, but I invariably end up finding the\u00a0<em>one<\/em> guy who is evaluating mail validity purely on SenderID when I create just the SPFv1 record.<\/p>\n<p>In InfoBlox, select Add =&gt; Record =&gt; TXT record. The mail destination from the MX record needs to be put in the \u201cName\u201d field. Then the text value \u2013 what is that?<\/p>\n<p>Quick answer is it depends. A SPF record lists all mail servers that <em>should<\/em> be sending e-mail for a domain. Is that just our MX servers? The MX servers plus the netblocks for the internal relays? Some third-party vendor?<\/p>\n<p>Our MX servers and a few netblocks would be:<\/p>\n<p>SPF V1: &#8220;v=spf1 mx ip4:1.2.3.4\/26 ip4:2.3.4.5\/23 ?all&#8221;<\/p>\n<p>SPF V2: &#8220;spf2.0\/pra mx ip4:1.2.3.4\/26 ip4:2.3.4.5\/23 ?all&#8221;<\/p>\n<p>If there is a third-party vendor, they may provide an include statement for our SPF record \u2013 this is a way of referencing an external company\u2019s SPF record within your own. As an example, you might see \u201cinclude:mktomail.com\u201d in an SPF records where Marketo sends mail on the company&#8217;s behalf.<\/p>\n<p>The final bit \u2013 we use ?all which means these may not be all of the servers sending mail on our behalf \u2013 we are not making an assertion beyond saying the listed sources <em>are<\/em> good. You may see vendors requesting \u201c~all\u201d which is a soft fail &#8212; still allows mail to pass if the sender does not match the list. The strictest is \u201c-all\u201d which fails mail coming from any source not in the list.<\/p>\n<p>Does it matter? Depends \u2013 if a recipient has configured their mail servers to reject mail based on SPF <em>and <\/em>you use -all \u2026 mail from servers not on the list will be rejected. Not a lot of companies are thusly configured, though \u2026 so there\u2019s not a whole lot of effective difference.<\/p>\n<p>The final step is to test the SPF record. The easiest way to do so is an online SPF test site like <a href=\"http:\/\/tools.bevhost.com\/spf\/\">http:\/\/tools.bevhost.com\/spf\/<\/a><\/p>\n<p>I usually test both a host on the list and one not. The ones on the list will pass. The ones not on the list may fail (with -all) or report as neutral (?all).<\/p>\n<p><strong>DK\/DKIM Records<\/strong><\/p>\n<p>DK and DKIM are public\/private key based header signatures that assure the validity of the e-mail sender. The first thing you will need is a public\/private key pair \u2013 these do not have to be trusted keys from a public certificate authority. A vendor or another internal group may provide their own public key for inclusion in our DNS record. <strong>Do not provide our private key to anyone else \u2013 keys are free, and if they are unable to generate one of their own, make one for them!<\/strong><\/p>\n<p>You can use openssl (<strong>openssl genrsa -out dkimkey.private 1024<\/strong> followed by <strong>openssl rsa -in dkimkey.private -out dkimkey.public -pubout -outform PEM<\/strong>), an online generator, or the Web CA server. Once you have a key pair, you need a selector. This is because different mail servers may send mail for a domain whilst using unique private keys to sign the messages. The selector can be anything \u2013 the selector name is configured in the mail server. It <em>is<\/em> visible in the mail headers and mail logs, so don\u2019t elect to use anything rude. Stash the private key on your mail server (or provide it to the mail server owner) and put the public key in a DNS TXT record \u201cselectorname._domainkey.sub.domain.gTLD\u201d. The k= indicates the key type (rsa in the openssl example), you can indicate signatures are being tested \u201ct=y\u201d if desired, and then paste the bits between &#8212;-BEGIN PUBLIC KEY&#8212;- and &#8212;-END PUBLIC KEY&#8212;- into the p= part.<\/p>\n<p>k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0s07391Axpsi\/G0PTsO1 io1LOXSZ0bWAku4bgJ\/\/swZj8OlFvDo59n9qC2Wsd21afI3si\/PdDoDP69HNdgAT tIPaK6J0UqcCo9RNSiM3uA+GngdgTupwE2KrKn9\/WQbC0tDA8e64e0HBHXwcF\/ru OF+18LvpoA\/cu1TFUNk0z+GSvqQ4L79k+gZWALvJL7kvCMIu3Gy8ZJpNerRSdrYH l\/Nvg87dlZ+9yRI33IwNYpVl1UIrd6qLnGgM1xDMF+Sn21Obd06FOkV5ObXqKBPv 7gMhsUOPu8cIWK7wrd143wH5sWWX1VCBhhIEv1GFp6+SotvZayH5fQ\/ri+BjWYzf PwIDAQAB<\/p>\n<p>You should have an author domain signing practices record (_adsp._domainkey.sub.domain.gTLD) \u2013 this tells recipients what to do if a message is not signed. The content is \u201cdkim=all\u201d when all mail from the domain is signed. If all mail is signed and anything <em>not<\/em> signed should be dumped, then the content is \u201cdkim=discardable\u201d. This does not ensure that unsigned messages <em>are<\/em> discarded \u2013 that decision is up to the individual mail recipient configurations. To make no assertion, use \u201cdkim=unknown\u201d.<\/p>\n<p>You should also have a _domainkey.sub.domain.gTLD record \u2013 you can include \u201ct=y\u201d when you are testing \u2013 this instructs recipients to treat signed and unsigned mail no differently. You can include notes (n=), a responsible party for the domain (r=). The important one is o= \u2026 \u201co=-\u201c means all mail from the domain should be signed, \u201co=~\u201d means some mail from the domain may be unsigned.<\/p>\n<p>Then test the records \u2013 you can send a message to <a href=\"mailto:autorespond+dkim@dk.elandsys.com\">autorespond+dkim@dk.elandsys.com<\/a> and receive back a very detailed report on the DKIM validation, or you can use a web-based validation tool that checks only the DNS components.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are going to begin using e-mail on a sub-domain of an existing zone, you do not need to do anything special to register the sub-domain. If this is a new domain, it needs to be publicly registered first. The examples used here-in will be a mail domain subordinate to example.com. If you are &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[261,260,259,262],"class_list":["post-1373","post","type-post","status-publish","format-standard","hentry","category-system-administration","tag-dkim","tag-domain-keys","tag-sendmail","tag-spf"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1373"}],"version-history":[{"count":4,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1373\/revisions"}],"predecessor-version":[{"id":12233,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1373\/revisions\/12233"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}