Why wildcards need DNS-01
A wildcard certificate such as *.example.com covers any single name under example.com. To issue one through ACME, the CA has to be sure you control the whole domain, not one web server. Let’s Encrypt’s challenge types page explains that HTTP-01 and TLS-ALPN-01 cannot be used for wildcards. DNS-01 can, and other ACME CAs follow the same rule.
How DNS-01 works
- Your ACME client asks the CA for a certificate and receives a token for each name.
- It creates a TXT record at
_acme-challenge.example.comwith a value derived from the token and the account key. - The CA looks up the record. If it matches, the name is validated.
- The client removes the record.
A certificate for both example.com and *.example.com needs two TXT values at the same _acme-challenge.example.com name, one per validation. Several TXT records on one name are allowed, but remove them afterwards, because too many make the DNS answer large.
Automating it
Renewal is only automatic if the client can create the TXT record by itself. A manual DNS step works once and then fails 60 days later. So:
- Use your ACME client’s plugin for your DNS provider, for example Certbot’s DNS plugins, lego’s providers or acme.sh’s DNS API scripts, with an API token for that zone.
- Allow for propagation. Some providers take minutes before every name server answers with the new record. Clients wait, and the wait may need to be longer for some providers.
- Run the renewal on a schedule, and deploy and reload after it, as with any certificate.
Protecting the DNS credentials
The DNS API token that can create the challenge record can often change any record in the zone. Let’s Encrypt warns that keeping it on a web server is risky. Two ways to limit that:
- Scope the token to one zone, and to TXT records if your provider allows it.
- Delegate the challenge. Point
_acme-challenge.example.comwith a CNAME to a name in a separate zone, or to an acme-dns server that can only answer challenges. The CA follows the CNAME, and the credentials you keep can only change challenge records.
When not to use a wildcard
- One key, many servers. The same private key is copied to every server that uses the wildcard. If one is compromised, every name it covers is exposed.
- One level only.
*.example.comcoverswww.example.combut notexample.comora.b.example.com. - Visibility. A wildcard hides which services exist, which can make your own inventory harder, a point we touch on in why certificate tracking spreadsheets fail.
Use CAA records to control which CAs may issue for your domain, and the issuewild tag for wildcards specifically.
Where clm.mt fits
clm.mt answers DNS-01 through your DNS provider’s API or through acme-dns delegation, so wildcards renew without a manual step, then deploys the certificate and checks what is served. Cloudflare DNS-01 is Supported, other providers are Preview: see the integrations board.