NAME

dmarc-check-mail.pl - send one test message from this host, so its authentication can be read

SYNOPSIS

dmarc-check-mail.pl

dmarc-check-mail.pl --plain

dmarc-check-mail.pl --keyfile ~/dkim/selector1.private --domain example.org

DESCRIPTION

Sends one message through sendmail(1) to a mailbox that can be read, and says what the Authentication-Results header at the far end should contain. The message is signed with Mail::Send::DKIM, the signer mail-dkim uses, so that what arrives is what this site's mail really looks like, rather than a test of a signing path nothing else uses. --plain sends the same message unsigned, which is what a cron job without the module looks like, so that both can be compared in the same mailbox.

The subject and body carry a token made of the host name and the time, so that the message can be found again among others.

OPTIONS

--to ADDR (-t)

Where to send it. Default DMARC_TEST_TO, or nigel@example.org. It is written into the message's To: header, so an address holding a space or a control character, or beginning with a -, is refused, as --from is.

--from ADDR (-f)

The envelope sender and the header From:. Default DMARC_TEST_FROM, or alerts@example.org. An address holding a space or a control character, or beginning with a -, is refused.

--domain DOMAIN

The domain to sign for. Default DMARC_TEST_DOMAIN, or example.org. The domain in the message's own From: is signed for as well, so that a test sent as an address from the domain being signed for still signs.

--selector SEL

The selector to sign with. Default DMARC_TEST_SELECTOR, or selector1. It also chooses the key when --keyfile is not given.

--keyfile FILE (-k)

The private key. Default DKIM_KEYFILE, or the first file under ~/dkim, ~/.dkim or ~/lib/dkim named *.private, *.key or *.pem whose name holds the selector or the domain.

--plain

Send the message unsigned, through sendmail(1) alone, which is what cron does. No key is looked for and Mail::DKIM need not be installed, so this still works on a host that cannot sign at all.

--dry-run (-n)

Sign the message, print it, and send nothing.

--save FILE

Also write the message, as it is sent, to FILE.

--sendmail PATH

The sendmail the message is handed to. Default SENDMAIL, or /usr/sbin/sendmail.

--help (-h)

Print the usage summary and exit 0.

Each default above is set by the variable named with it, and nothing else is read.

ENVIRONMENT

DMARC_TEST_TO

The default for --to.

DMARC_TEST_FROM

The default for --from.

DMARC_TEST_DOMAIN

The default for --domain.

DMARC_TEST_SELECTOR

The default for --selector, which also chooses the key.

SENDMAIL

The default for --sendmail.

DKIM_KEYFILE

The key, when --keyfile is not given.

HOME

Where the key is looked for when neither is given: ~/dkim, ~/.dkim and ~/lib/dkim.

EXIT STATUS

0 when the message was handed to sendmail, printed by --dry-run, or --help was asked for - and the first two do not mean it arrived, or that it authenticated: that is what the headers at the far end say. 1 when nothing was sent: no key was found, the key could not be read, Mail::DKIM is not installed for this perl, --save could not be written, or sendmail could not be run or reported a failure. Standard error says which. 2 when the options were not usable - an unknown option, no --to or --from, or a --to or --from that cannot be an address - so nothing was signed or sent, and no transport was asked to do anything. 2 never means that a message was attempted and failed.

SEE ALSO

Mail::Send::DKIM, the signer, and mail-dkim, the sendmail front end that dmarc-weekly.sh sends its alerts through.