DKIM / TXT scanner

What is it?

The TXT / DKIM (DomainKeys Identified Mail) scanner is a stand-alone script for quickly checking all your domains for TXT records corresponding to a specified list of selectors. You can specify the selectors in a text file that contains one entry per line. The script will automatically append ._domainkey to each selector before the DNS check. You can prevent this from happening by adding -nodk as a command line parameter.

The script is run from the terminal (after using SSH to connect to your server). You can also run it as a cron job at regular intervals. Make sure that you run it manually at first to find the approximate time it takes to run through all your domains.

The data obtained by the scanner is automatically inserted into the domain data table and you can access it from the Watch My Domains SED interface.

The advantage of the script is that you need not add the selectors using the user interface. If you add these using the interface the application will assume that these are valid sub-domains and perform all the other lookups. The scanner script checks the selectors only for TXT records.

DKIM / TXT Scanner for Watch My Domains SED

How to use the scanner

  • Copy the custom-dkim-scanner-sample.php file in lib/php/custom folder to another name, for example custom-dkim-scanner.php.
  • Create a text file called selectors.txt that contains the selectors you want to scan. These should be one entry per line. You can have entries like

    google
    dkim1
    mail
    dkim2
    
  • Run the script from your terminal after changing to the lib/php/custom folder
    php  custom-dkim-scanner.php f=<path to selectors.txt>
    
    For example,

    php  custom-dkim-scanner.php f=/home/data/selectors.txt
    php  custom-dkim-scanner.php f=/home/data/selectors.txt -nodk
    
    You can omit the f= part of you keep the selectors.txt file in the same folder as the script.
  • This will do the scanning and create the required table entries in the database. This will also take time because it has to do one DNS lookup for each selector in your list times the number of domains. If you are on a remote connection you may want to use the screen command before running the script.
  • You can now access the data from the sub-domain manager or the lower DNS pane of Watch My Domains SED.
  • You can also quickly view the data as a static report by opening the same script in your browser.

    Examples...

    http://<your install folder>/lib/php/custom/custom-dkim-scanner.php
    http://<your install folder>/lib/php/custom/custom-dkim-scanner.php?sort=domain
    http://<your install folder>/lib/php/custom/custom-dkim-scanner.php?sort=hostname
    http://<your install folder>/lib/php/custom/custom-dkim-scanner.php?sort=hostname&desc&dkim
    
    The sort option could be domain,subdomain,hostname,record_value or added_on The dkim option if used will display only the TXT records that start with 'v=DKIM' in it