Issue Description
I’m setting up Stalwart with hostname mail.domain.tld and email domain domain.tld, using automatic DNS management via deSEC. Note that deSEC requires a minimum TTL of 3600 seconds, so I had to configure the TTL accordingly.
The goal is to have Stalwart automatically obtain TLS certificates via ACME for the mail hostname as well as the standard auto-config subdomains (autodiscover, autoconfig, mta-sts, ua-auto-config).
I’ve encountered several issues across both dns-01 and tls-alpn-01 challenge types, and ultimately ended up in a state where only some subdomains have valid certificates.
Expected Behavior
Using dns-01 with deSEC integration, Stalwart should be able to create the required _acme-challenge TXT records without conflicts (e.g., by updating existing records instead of attempting to create duplicates).
Using tls-alpn-01, Stalwart should successfully obtain certificates for all configured hostnames, including the standard subdomains (autodiscover, autoconfig, mta-sts, ua-auto-config, mail) without requiring me to manually add each one as an “Additional Hostname”.
All configured subdomains should end up with valid Let’s Encrypt certificates.
Actual Behavior
dns-01 with deSEC:
The challenge fails with a race condition / duplicate-record error. The WebUI reports:
DNS error: Failed to create DNS record: API error: BadRequest
{"non_field_errors":["Another RRset with the same subdomain and type exists for this domain. (Try modifying it.)"]}
The log output:
stalwart | 2026-05-17T14:36:15Z WARN No TLS certificates available (tls.no-certificates-available) total = 0
stalwart | 2026-05-17T14:36:28Z INFO ACME authentication started (acme.auth-start) hostname = "domain.tld", type = "dns-01", url = "https://acme-v02.api.letsencrypt.org/acme/new-order"
stalwart | 2026-05-17T14:36:28Z INFO ACME authentication started (acme.auth-start) hostname = "domain.tld", type = "dns-01", url = "https://acme-v02.api.letsencrypt.org/acme/new-order"
stalwart | 2026-05-17T14:36:45Z WARN No TLS certificates available (tls.no-certificates-available) total = 0
It looks like Stalwart attempts to create a new TXT record for _acme-challenge instead of replacing/modifying an existing one. Possibly also a race condition when multiple orders run concurrently.
tls-alpn-01:
Initial attempts failed with:
Authentication failed: "Status: invalid; Challenge type: tls-alpn-01,
error: urn:ietf:params:acme:error:unauthorized:
Cannot negotiate ALPN protocol \"acme-tls/1\" for tls-alpn-01 challenge"
Adding mail and mta-sts as additional hostnames under the domain section will create two certs.
stalwart | 2026-05-17T15:29:07Z INFO ACME order ready (acme.order-ready) url = "https://acme-v02.api.letsencrypt.org/acme/new-order", hostname = ["mail.domain.tld", "mta-sts.domain.tld"]
stalwart | 2026-05-17T15:29:09Z INFO ACME order valid (acme.order-valid) url = "https://acme-v02.api.letsencrypt.org/acme/new-order", hostname = ["mail.domain.tld", "mta-sts.domain.tld"]
stalwart | 2026-05-17T15:29:32Z WARN Multiple TLS certificates available (tls.multiple-certificates-available) total = 2
Reproduction Steps
- Configure Stalwart with hostname mail.domain.tld and email domain domain.tld.
- Enable automatic DNS with deSEC (TTL set to 3600).
- Configure ACME with dns-01 challenge → observe duplicate TXT record errors.
- Switch to tls-alpn-01 and create A/AAAA records for mail.domain.tld → observe “Cannot negotiate ALPN protocol” errors for all standard subdomains.
- Add mail as “Additional Hostname” in the WebUI → certificate is issued successfully for mail.domain.tld.
- Add mta-sts as “Additional Hostname” → certificate is issued successfully.
- Other subdomains (autodiscover, autoconfig, ua-auto-config) remain on self-signed certificates.
Stalwart Version
v0.16.x
Installation Method
Docker
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
Additional Context
I tried the setup with different domains, deSEC accounts and different server providers (like Hetzner and Ionos). The necessary ports are unblocked by the providers.
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