Find DKIM and DMARC Records?

3,745

Solution 1

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 will find it in the s value in an email's DKIM-Signature.

For example:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.org;
s=google; t=1615461277;
[…]

You would then query it as TXT:

dig TXT google._domainkey.example.org

Solution 2

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.

Solution 3

You should use +short with dig to get the DMARC record only.

dig +short TXT _dmarc.domain.com

Solution 4

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:[email protected]"

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

Share:
3,745

Related videos on Youtube

mstr
Author by

mstr

Updated on September 18, 2022

Comments

  • mstr
    mstr almost 2 years

    I imported a json file from google drive to Colab like this

    downloaded = drive.CreateFile({'id':'XXX'}) downloaded.GetContentFile('All_Beauty.json')

    and when I try reading the file with

    import pandas as pd
    beauty_df = pd.read_json('All_Beauty.json')
    beauty_df.head()
    

    I get this error:

        ValueError                                Traceback (most recent call last)
    <ipython-input-15-1acb00f4feed> in <module>()
    ----> 1 beauty_df = pd.read_json('All_Beauty.json')
          2 beauty_df.head()
    
    5 frames
    /usr/local/lib/python3.6/dist-packages/pandas/io/json/_json.py in _parse_no_numpy(self)
       1087         if orient == "columns":
       1088             self.obj = DataFrame(
    -> 1089                 loads(json, precise_float=self.precise_float), dtype=None
       1090             )
       1091         elif orient == "split":
    

    ValueError: Trailing data

    Any idea of what is going wrong? Many thanks

    • ceejayoz
      ceejayoz almost 10 years
      DKIM records are applied to arbitrary subdomains (Google Apps uses google._domainkey.example.com) that you'd have to know/guess to look for.
    • Mathias R. Jessen
      Mathias R. Jessen almost 10 years
      It depends on the selector prefix used, part of the DKIM header in a signed email
  • mwfearnley
    mwfearnley over 4 years
    Wouldn't nslookup -type=txt _dmarc.somedomain.org [8.8.8.8] be simpler?