opendkim-testkey(8)
Test DKIM keys and configuration for OpenDKIM to verify they are properly set up and functional.
Synopsis
opendkim-testkey [-d domain] [-s selector] [-k keyfile] [-t testfile]Description
opendkim-testkey validates DKIM signing keys and DNS records for the OpenDKIM mail filter. It verifies that public keys are correctly published in DNS and that private keys can be loaded and used for signing.
This tool is essential for troubleshooting DKIM setup issues before deploying OpenDKIM in production. It tests the cryptographic key pair and confirms DNS records match the expected format.
Common options
| Flag | What it does |
|---|---|
-d domain | Specify the domain to test (e.g., example.com) |
-s selector | Specify the selector name (e.g., default, mail, or dkim1) |
-k keyfile | Path to the private key file to load and verify |
-t testfile | Path to test message file for signature verification |
-x | Test mode; don't actually sign messages |
-v | Verbose output with detailed diagnostic information |
Examples
Test the DKIM key for example.com using the 'default' selector and check DNS records
opendkim-testkey -d example.com -s defaultVerify a specific private key file can be loaded and matches the DNS public key
opendkim-testkey -d mail.example.com -s default -k /etc/opendkim/keys/mail.example.com/default.privateRun test with verbose output to see detailed key matching results
opendkim-testkey -d example.com -s selector1 -vTest signing a sample message file with the DKIM key configuration
opendkim-testkey -d example.com -s default -t /tmp/test-message.txt