Docs › Certificates

Wildcard certificates with lego

lego writes and reads acme-dns credentials from the JSON file at ACME_DNS_STORAGE_PATH.

Where the configuration lives

Command line

Configuration

lego
ACME_DNS_API_BASE=https://api.home.network/acmedns \
ACME_DNS_STORAGE_PATH=./acme-dns.json \
lego --dns acme-dns --email you@example.com \
     --domains 'alice.home.network' \
     --domains '*.alice.home.network' run

The username, password and subdomain come from the setup wizard, which shows them once. They are stored hashed, so a lost set is replaced rather than recovered.

Worth knowing. lego registers a brand new acme-dns account when the storage file has no entry for the domain, then stops rather than using your credentials. Write the file first.

Ask for both names

A wildcard does not cover the name it sits under, so a certificate for *.alice.home.network alone leaves alice.home.network without one. Request both in a single certificate.

Check it worked

verify
# the challenge value your client published
dig +short TXT _acme-challenge.alice.home.network @ns1.home.network

# what the certificate ended up covering
echo | openssl s_client -servername nas.alice.home.network \
  -connect nas.alice.home.network:443 2>/dev/null \
  | openssl x509 -noout -text | grep -A1 "Subject Alternative Name"

Why only wildcards

Challenge records are writable only at your label apex, so the only certificates obtainable are the wildcard and the label itself. Your individual device names never reach Certificate Transparency logs, which is a consequence of the design rather than a setting to remember.

← All documentation