Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a method to find a domain's DKIM and DMARC records using dig or nslookup?

I have attempted to do the following:

dig somedomain.org any

returns many records, but not the known DKIM and DMARC text records.

nslookup -type=txt somedomain.org

returns all the text records known except the DKIM and DMARC records.

share|improve this question
2  
DKIM records are applied to arbitrary subdomains (Google Apps uses google._domainkey.example.com) that you'd have to know/guess to look for. – ceejayoz Aug 29 '14 at 15:38
1  
It depends on the selector prefix used, part of the DKIM header in a signed email – Mathias R. Jessen Aug 29 '14 at 15:57
up vote 16 down vote accepted

To query the TXT record for DMARC, you can use:

dig TXT _dmarc.example.org

To query for a particular record for DKIM, you would need to know the selector prefix. You would then query it as TXT (for example with a google one):

dig TXT google._domainkey.example.org
share|improve this answer
4  
Worth mentioning is that in the DKIM-Signature header the selector name is found in the s= value. – andol Aug 29 '14 at 16:50

For DKIM records, if you have received a DKIM-signed email from that domain, look at the DKIM-Signature header line(s).

From the spec:

All DKIM keys are stored in a subdomain named _domainkey. Given a DKIM-Signature field with a "d=" tag of example.com and an "s=" tag of foo.bar, the DNS query will be for foo.bar._domainkey.example.com.

So in this example, you can then run:

dig TXT foo.bar._domainkey.example.com

Credit to andol, whose comment led me to this solution.

share|improve this answer

Using Windows built-in tool nslookup

  1. Open Command Prompt (cmd.exe)
  2. Enter nslookup
  3. Enter set type=txt
  4. Enter _dmarc.somedomain.org, replace somedomain.org

Example:

C:\Users\user>nslookup

Default Server:  localdns
Address:  192.168.1.1

> set type=txt

> _dmarc.somedomain.org

Non-authoritative answer:
_dmarc.somedomain.org text =

    "v=DMARC1; p=none; rua=mailto:postmaster@somedomain.org"

You may use server 8.8.8.8 (Google DNS) before lookup DMARC TXT record.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.