LuaDNS: TXT records are in quotes. ACME fails

Issue Description

Noticed that DNS Management, specifically DKIM and ACME tasks were in a transient failure state. A Look at the debug logs revealed that the records didn’t propagate but were wrapped in Quotes.

Expected Behavior

the final record shouldn’t be in quotes.

Actual Behavior

the record is wrapped in quotes

Reproduction Steps

  1. Install stalwart 1.0.0 or 1.0.1 (both are affected)
  2. Set up a domain with it DNS over at LuaDNS
  3. enable DNS management for that domain and inspect the TXT records it creates
  4. Optionally try to complete a DNS-01 challenge

Relevant Log Output

WARN ACME authentication error (acme.auth-error) hostname = "domain.tld", type = "dns-01", url = "https://acme-v02.api.letsencrypt.org/acme/new-order", details = "https://acme-v02.api.letsencrypt.org/acme/authz/XXXXXXXXXXX/XXXXXXXXXX", reason = "Status: invalid; Challenge type: dns-01, error: urn:ietf:params:acme:error:unauthorized: Incorrect TXT record \"\\\\\\\"kyB2GNXXXXXXXXXXXXXXXXXXXXXXXXXX49B92GYPwLA\\\\\\\"\" found at _acme-challenge.domain.tld"

DEBUG DNS record not propagated (dns.record-not-propagated) hostname = "v1-rsa-20261029._domainkey.domain.tld.", domain = "domain.tld", result = "\"v=DKIM1;

Stalwart Version

v1.x

Installation Method

Binary (Linux)

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

Additional Context

  • Cloudflare works fine, I dont use any other DNS Providers.

I’ll happily provide an API key (limited to an unused domains zone) on my LuaDNS Nameserver for debugging/testing purposes to the stalwart team.

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Thanks for the detailed report. I couldn’t find an authoritative answer in the docs or the Stalwart source, so I can’t confirm a cause or a workaround.

The server only builds the LuaDNS updater in crates/common/src/network/dns/update.rs. It does this by calling dns_update::DnsUpdater::new_luadns(...) with the username and token. The TXT record content is formatted and sent by the external dns-update library, not by code in the Stalwart repositories I can search. That is probably where the quoting happens. The ACME error shows the value being stored with escaped quotes added, which fits the library wrapping TXT values in quotes for LuaDNS, which may already add its own. That is only a guess from the logs.

This isn’t covered in the current docs. A community member or staff member will follow up.

Your offer of a limited LuaDNS API key is useful for reproducing this. It would also help to note the exact TXT value shown in the LuaDNS dashboard for one affected record, so the team can see whether the quotes are stored literally.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Hi,

The LuaDNS provider sent TXT content in zone-file syntax, wrapped in double quotes and split into chunks. The LuaDNS API stores the content exactly as received, so those quotes ended up inside the record itself, which is what Let’s Encrypt and the DKIM propagation check saw. This was there from the first version of the provider, so 1.0.0 and 1.0.1 are both affected, and Cloudflare isn’t because its provider sends raw text.

I’ve fixed it in the dns-update library: TXT values now go to LuaDNS as plain text, long DKIM keys included, and are read back the same way. It will ship in an upcoming Stalwart release once the library update is pulled in. The test API key won’t be needed. After upgrading, Stalwart replaces the quoted records on its next DNS update, so there is nothing to clean up by hand.