Sub topic 4
Proving Domain Control: HTTP-01, DNS-01, and TLS-ALPN-01
Assume you can use a Linux shell and sudo, manage DNS records for a domain, and understand basic HTTP and HTTPS. This chapter focuses on how the ACME protocol proves that you control a domain before a certificate authority issues a certificate.
Why domain validation is required
A certificate authority (CA) must not issue a certificate for example.com to an unrelated person. During validation, the ACME server gives your client a short-lived challenge. Your client publishes proof in a location that only the domain controller should be able to change.
The process is:
- Your ACME client requests a certificate.
- The CA returns a challenge.
- Your client publishes the challenge response.
- The CA checks the response over the network.
- The CA issues the certificate if the response is correct.
The challenge response proves control of the domain. It does not prove who owns the organization behind the domain.
Choosing a challenge type
Let's Encrypt commonly supports these challenge types:
| Challenge | Proof location | Required inbound access | Wildcard support |
|---|---|---|---|
| HTTP-01 | `http://domain/.well-known/acme-challenge/` | Port 80 | No |
| DNS-01 | TXT record at `_acme-challenge.domain` | DNS control | Yes |
| TLS-ALPN-01 | Temporary TLS response on port 443 | Port 443 | No |
HTTP-01
With HTTP-01, the ACME client places a file under:
http://example.com/.well-known/acme-challenge/<token>The CA connects to port 80 and compares the file content with the expected value. The web server must route this path to the ACME client, or Certbot's nginx plugin must be able to configure it temporarily.
Port 80 must be reachable from the public internet. An HTTP-to-HTTPS redirect usually works because the CA follows redirects, but the challenge path must remain publicly accessible. Proxies, authentication rules, and restrictive firewall rules often cause failures.
DNS-01
DNS-01 requires a TXT record:
_acme-challenge.example.com. TXT "<challenge-value>"The CA queries public DNS and checks the value. DNS-01 works when the web server is private or when port 80 cannot be opened. It is also the required method for wildcard names such as *.example.com.
DNS changes can take time to appear because resolvers cache records. Keep an existing TXT record until validation finishes. Multiple TXT records are allowed, which matters when validating several authorizations at once.
TLS-ALPN-01
TLS-ALPN-01 uses a temporary certificate and the special acme-tls/1 application-layer protocol negotiation (ALPN) value. The CA connects directly to port 443 and checks the response during the TLS handshake.
This method can be useful when port 80 is unavailable, but it requires the ACME client or a compatible proxy to control the TLS endpoint. A normal certificate configured in nginx is not enough by itself.
Diagnosing validation failures
Check the relevant public path before retrying:
- For HTTP-01, use
curl http://example.com/.well-known/acme-challenge/test. - For DNS-01, use
dig TXT _acme-challenge.example.com. - For TLS-ALPN-01, verify that port 443 reaches the intended server and that no proxy terminates the connection incorrectly.
- Confirm that the domain's A and AAAA records point to the server being validated.
- Check both IPv4 and IPv6. A broken AAAA record can make validation fail even when IPv4 works.
Exercise
You need a certificate for app.example.com and *.example.com, but the application server is not publicly reachable. Which challenge should you use, and where is its proof published?
Show answer
Use DNS-01. Publish the challenge as a TXT record at _acme-challenge.example.com. DNS-01 supports wildcard certificates and does not require the application server to accept inbound HTTP or HTTPS connections.