← Back to Learning Hub

DNS Records • Intermediate • 6 min read

ACME DNS-01 Challenge: Issue Wildcard Certs With a TXT Record

How the ACME DNS-01 challenge proves domain control with an _acme-challenge TXT record, why wildcards require it, and how to automate it safely at scale.

The ACME DNS-01 challenge is how a certificate authority confirms you control a domain by watching you publish a specific TXT record under it. It is the method you must use to get a wildcard certificate from a free, automated CA, and it is the only ACME challenge that works when the host you are certifying is not reachable over the public web. This guide explains how DNS-01 proves control with an _acme-challenge TXT record, why wildcards force you onto it, how it differs from the HTTP-01 challenge, and how to automate it at scale without leaving dangerous permissions lying around.

What ACME and DNS-01 are

ACME, the Automatic Certificate Management Environment defined in RFC 8555, is the protocol that clients such as Certbot, acme.sh, and lego use to request and renew certificates automatically. Before a CA signs a certificate it must verify that you control the names in it, and ACME defines several challenge types to do that. DNS-01 is the challenge that proves control through DNS: the CA tells your client a token, the client computes a value from that token and your account key, and publishes it as a TXT record at a fixed name. When the CA queries DNS and sees the expected value, control is proven and the certificate is issued.

How the TXT record proves control

The record always lives at _acme-challenge prefixed to the name being validated. To validate example.com, the client publishes a TXT record at _acme-challenge.example.com; to validate www.example.com, it publishes at _acme-challenge.www.example.com. The record's value is a base64url-encoded SHA-256 digest derived from the challenge token and the account key, so only the party that requested the certificate can produce the correct string. The CA performs a normal DNS lookup for that TXT name, compares the value, and on a match considers the name authorized. Because the check is a standard public DNS query, the record must be visible to the CA's resolvers, which is where propagation timing matters.

Why wildcards require DNS-01

A wildcard certificate covers every host at one level under a domain, for example *.example.com. There is no single web server you could place a validation file on to prove you control all of those hosts at once, so the HTTP-01 challenge, which fetches a file over port 80, cannot validate a wildcard. The ACME specification therefore requires DNS-01 for any wildcard issuance, because publishing a TXT record under the parent domain is the only way to demonstrate authority over the whole namespace. The validation record for *.example.com is published at _acme-challenge.example.com, the same place as for the apex, so a wildcard plus its apex can validate together.

DNS-01 versus HTTP-01

The two most common challenges suit different situations. The table below compares them as of November 2026.

AspectDNS-01HTTP-01
Proof mechanismTXT record under _acme-challengeFile served at /.well-known/acme-challenge
WildcardsSupportedNot supported
Needs a public web serverNoYes, reachable on port 80
Works behind a firewall or CDNYesOften awkward
Main frictionDNS propagation and API accessPort 80 reachability

DNS-01 wins whenever the host is not directly reachable, such as an internal service, a mail server, or a load-balanced fleet, as well as for every wildcard.

Automating DNS-01 safely

Manual DNS-01 is fine for a one-off certificate, but renewals happen often, so you want it automated. Automation means giving your ACME client the ability to add and remove TXT records through your DNS provider's API, and that access is the main security concern.

  1. Pick an ACME client with a plugin for your DNS provider, such as Certbot DNS plugins, acme.sh, or lego.
  2. Create an API credential scoped as narrowly as the provider allows, ideally limited to editing TXT records in the specific zone rather than full account access.
  3. Store that credential with tight file permissions and keep it off any public or shared path.
  4. Run a test issuance against the CA staging environment first, so a misconfiguration does not burn rate limits on production.
  5. Confirm the TXT record appears and is removed cleanly after each run, leaving no stale _acme-challenge records behind.
  6. Schedule renewal well before expiry and alert on failure, since a silent renewal failure becomes an outage when the certificate lapses.

If propagation is slow or inconsistent, many clients support delegating validation to a dedicated acme-dns zone via CNAME, which lets you grant a minimal credential that can only touch the challenge records.

CAA, DNSSEC, and getting it right

Two DNS controls interact with issuance. First, if you publish a CAA record, the CA checks it before issuing and will refuse if its own identifier is not listed, so your CAA policy must permit the CA you are using. Our guide on CAA records and which CAs can issue your certificates covers that control. Second, if your zone is DNSSEC-signed, the TXT record you add is covered by signatures, and a broken or lagging signing setup can make the CA see a validation failure even when the record looks correct to you. Understanding your signing chain helps here, as laid out in our guide on DNSSEC basics: DS, DNSKEY, and RRSIG. You can confirm the challenge record resolves and your zone is healthy with the Valla DNS domain health check before you trigger issuance.

Frequently asked questions

Why can I not get a wildcard certificate with HTTP-01?

HTTP-01 proves control of one specific host by fetching a file from it, and there is no single host that represents an entire wildcard namespace. ACME therefore requires DNS-01 for wildcards, since a TXT record under the parent domain is the only way to prove authority over all subdomains at once.

Where exactly does the validation TXT record go?

At _acme-challenge prefixed to the validated name. For example.com and for *.example.com it is _acme-challenge.example.com; for www.example.com it is _acme-challenge.www.example.com. The value is a hash derived from the challenge token and your ACME account key.

How long does the challenge record need to stay published?

Only until the CA has queried it and completed validation, which is typically seconds to a few minutes. Automated clients add the record, wait for propagation, let the CA check, then remove it. Leaving stale challenge records does no harm but is untidy.

Is giving an ACME client DNS API access dangerous?

It is the main risk of DNS-01, so scope the credential tightly. Limit it to editing TXT records in the one zone if your provider allows, or delegate validation to a separate acme-dns zone so the credential can only touch challenge records, never your real DNS.

Does DNSSEC interfere with DNS-01?

Not when signing is healthy. The challenge TXT record is signed like any other record. But if your signing is broken or signatures lag the record, the CA's validating resolver may reject the lookup, so confirm your DNSSEC chain is sound before issuing.

DNS-01 is the bridge between your DNS and your certificates, and it is the one path to free automated wildcards. Scope its API access carefully, test against staging, and verify the zone resolves cleanly with the domain health check before you rely on automated renewal.

Troubleshooting box

If results look inconsistent, compare authoritative nameservers first, then recursive resolvers by region. Capture snapshots every 10 minutes for deterministic incident timelines.

Try VallaDNS free →

Intermediate • 6 min

How to Find a DNS Record's TTL (Current Value)

Find the TTL currently set on a DNS record: read the TTL column in dig and nslookup, tell the authoritative TTL from a resolver's countdown, and confirm a change.

Intermediate • 7 min

How to Check If Nameservers Have Propagated

Nameserver changes live at the parent TLD and follow the registry NS TTL, not your zone. Check the parent delegation and confirm the new NS set worldwide.