सामग्री पर जाएँ
Email Authentication

Fix “opendkim-testkey: unexpected reply class/type (-1/-1)”

Add Nameservers 1.1.1.1,1.0.0.1 to /etc/opendkim.conf, restart opendkim, and run opendkim-testkey -d example.com -s default -vvv until it says “key OK”.

परखा गया Ubuntu 22.04 LTS, OpenDKIM 2.11

While setting up DKIM signing with OpenDKIM you run the key test and get:

Error
opendkim-testkey: 'default._domainkey.example.com' unexpected reply class/type (-1/-1)

The DKIM key itself is usually fine. The error means OpenDKIM’s own DNS lookup failed – it couldn’t get any answer, so it can’t compare the published key with your private key.

Step 1 – Give OpenDKIM working resolvers

Terminal
sudo nano /etc/opendkim.conf

Add (or edit) the Nameservers line:

/etc/opendkim.conf
Nameservers 1.1.1.1,1.0.0.1

Separate addresses with commas and no spaces. You can list more, e.g. 1.1.1.1,1.0.0.1,8.8.8.8,8.8.4.4.

Step 2 – Restart OpenDKIM

Terminal
sudo systemctl restart opendkim

Step 3 – Test the key

Terminal
sudo opendkim-testkey -d example.com -s default -vvv

Replace example.com and the selector (default) with yours. Success looks like:

Expected output
opendkim-testkey: key OK

“key not secure” just means the zone isn’t DNSSEC-signed – it’s normal and not an error.

Still failing? Check these

  • Is the record published? dig +short TXT default._domainkey.example.com should return your v=DKIM1; k=rsa; p=… record.
  • DNS propagation – new records can take time to appear, depending on TTL and provider (some providers publish within a minute).
  • Firewall – the server must be able to query outside DNS on UDP and TCP port 53.
  • Logs – sudo journalctl -u opendkim --since "10 min ago"

Check it from outside

The SPF, DKIM & DMARC Checker looks up your DKIM selector from the public internet, along with SPF and DMARC.

Inder Kochar

लेखक

Inder Kochar

सिस्टम्स और नेटवर्क इंजीनियर – मैं वही समाधान लिखता हूँ जो क्लाइंट्स के साथ इस्तेमाल करता हूँ, असली सिस्टम पर परखे हुए। ऐसी ही किसी समस्या में फँसे हैं?

आगे पढ़ें

सवाल पूछें या अपना समाधान बताएँ

आपका ईमेल प्रकाशित नहीं होगा। टिप्पणियाँ जाँची जाती हैं – कृपया विषय से जुड़ी रखें।