Imagine your application is running perfectly fine, but one day, clients suddenly start failing to connect. Nothing changed in your application, yet HTTPS connections are being rejected.
The TLS certificate has expired.
Even if a certificate’s CA signature is valid, clients will still reject it once it expires. A valid signature alone doesn’t mean a certificate is valid for TLS.
Renewing certificates manually involves generating a Certificate Signing Request (CSR), proving domain control to a Certificate Authority (CA), and installing the issued certificate.
Doing this once is manageable, but what if we’re managing hundreds of services, each with certificates expiring at different times?
This is where ACME comes in.

What Is ACME?
ACME (Automatic Certificate Management Environment) is a protocol that automates communication between clients and Certificate Authorities.
Domain validation existed before ACME. ACME standardizes how a client requests and completes it automatically.
An ACME client like Certbot uses this protocol to request and renew TLS certificates from a CA such as Let’s Encrypt.
ACME defines how certificate management works, while Certbot is a tool that implements the protocol.
Here’s a simplified issuance process:
- Certbot registers an account with the CA.
- Certbot requests a certificate for
api.example.com. - The CA challenges Certbot to prove control of the domain.
- Certbot prepares the challenge response, and the CA verifies it through HTTP or DNS.
- Once validated, Certbot submits a CSR containing the TLS public key.
- The CA issues the signed certificate.
sequenceDiagram
autonumber
participant C as Certbot
participant CA as Let's Encrypt
C->>CA: Register account (newAccount)
CA-->>C: Account registered
C->>CA: Request certificate (newOrder)
CA-->>C: Return authorization challenges
rect rgba(37, 99, 235, 0.08)
Note over C,CA: Domain Control Validation
C->>C: Prepare HTTP-01 or DNS-01 response
C->>CA: Notify challenge is ready
CA->>CA: Verify domain through HTTP or DNS
C->>CA: Check validation status
CA-->>C: Domain validated
end
C->>CA: Submit CSR (finalize)
CA->>CA: Issue signed certificate
C->>CA: Retrieve issued certificate
CA-->>C: Return TLS certificate
But here’s an interesting question: How does the CA know we actually control api.example.com?
After all, anyone could install Certbot and request a certificate for google.com.
How Does ACME Verify Domain Control?
ACME uses challenges to prove domain control automatically. Two common methods are HTTP-01 and DNS-01.
Both serve the same purpose, but through different mechanisms.
HTTP-01: Proving Control Through HTTP
Imagine we’re hosting api.example.com on a publicly accessible Nginx server.
Let’s Encrypt provides Certbot with a challenge token. Certbot makes a specific response available at:
http://api.example.com/.well-known/acme-challenge/abc123
Let’s Encrypt sends an HTTP request to that endpoint. If the response matches the expected value, domain validation succeeds.
The response contains the challenge token and a thumbprint derived from the ACME account’s public key.
But doesn’t HTTP-01 require an existing TLS certificate?
No. HTTP-01 starts over ordinary HTTP on port 80, meaning we can obtain our first certificate without already having HTTPS configured.
Another interesting detail is that we don’t need to expose our entire application publicly. Only the challenge endpoint must be reachable by the CA.
sequenceDiagram
participant C as Certbot
participant W as Public Web Server
participant CA as Let's Encrypt
C->>W: 1. Make challenge response available
C->>CA: 2. Challenge is ready
rect rgba(37, 99, 235, 0.08)
CA->>W: 3. HTTP GET (port 80)
Note right of W: /.well-known/acme-challenge/{token}
W-->>CA: 4. Return expected response
end
Note over C,CA: Domain control verified
DNS-01: Proving Control Through DNS
Now imagine our application is hosted inside a private Kubernetes cluster, where Let’s Encrypt cannot reach its HTTP endpoint.
How can the CA verify that we control the domain?
Instead of using HTTP, DNS-01 requires us to publish a TXT record:
Type: TXT
Name: _acme-challenge.api.example.com
Value: "x7Qp9dL2vM..." # illustrative; not a real value
The record name stays the same for this domain. The TXT value changes for each challenge and is derived from the challenge token and the ACME account public-key thumbprint.
Let’s Encrypt queries public DNS to verify that the expected value exists.
Interestingly, our application doesn’t even need to be running for DNS-01 to succeed.
The CA only needs to verify the DNS record. It doesn’t communicate with the application at all.
To automate this process, Certbot can integrate with a DNS provider such as Cloudflare through its API, creating and removing challenge records without manual intervention. Certbot publishes through the provider’s API, while Let’s Encrypt checks the resulting TXT record through public DNS, not through that API.
sequenceDiagram
participant C as Certbot
participant D as Domain's DNS Provider
participant CA as Let's Encrypt
C->>D: 1. Create TXT via provider API
Note over D: _acme-challenge.api.example.com
C->>CA: 2. Challenge is ready
rect rgba(37, 99, 235, 0.08)
CA->>D: 3. Public DNS TXT lookup
D-->>CA: 4. Return expected value
end
Note over C,CA: Domain control verified
When Should We Use HTTP-01 or DNS-01?
| Scenario | Suitable challenge |
|---|---|
| Public web server with port 80 accessible | HTTP-01 |
| Private application with publicly accessible DNS | DNS-01 |
| Port 80 cannot be exposed | DNS-01 |
Wildcard certificate (*.example.com) | DNS-01 |
TLS-ALPN-01 is another option over port 443, although this article focuses on HTTP-01 and DNS-01.
HTTP-01 is often simpler because it can work directly with a public web server, without needing DNS API credentials.
DNS-01 is useful for private infrastructure and wildcard certificates, but automated validation requires access to the DNS provider.
Why Does ACME Use Random Challenges?
Why can’t the CA simply ask us to create a permanent DNS record like acme-verified=true?
Imagine a domain owner successfully validates example.com and forgets to remove that record.
If the CA accepted the same value for everyone, an attacker could request a certificate for example.com and reuse the existing record to pass validation.
ACME prevents this by using fresh challenge tokens and tying the expected responses to the requesting ACME account.
This brings us to two separate key pairs used for different purposes:
- ACME account key pair: Authenticates certificate management requests to the CA.
- TLS certificate key pair: Used by the server for TLS authentication.
Here’s another security implication: if someone steals DNS API credentials with enough permissions to modify our challenge records, they could potentially obtain a certificate for our domain using their own TLS key pair.
They wouldn’t even need our original TLS private key.
Having a certificate alone wouldn’t redirect traffic to the attacker; they’d also need a way to receive or intercept connections.
This is why DNS API credentials should have only the permissions required for validation.
Does ACME Handle Certificate Renewal Automatically?
Not entirely.
ACME supports certificate renewal, but the client still has to initiate it. Certbot can run on a schedule and determine when renewal is due, sometimes using renewal timing suggested by the CA (RFC 9773).
For example, a scheduler periodically runs certbot renew. Certbot checks whether its managed certificates need renewal and contacts the CA when necessary.
But there’s another distinction worth understanding.
A successfully renewed certificate doesn’t necessarily mean our application is using it.
Imagine Certbot successfully renews a certificate and saves it to disk, but Nginx fails to reload its configuration.
The CA has successfully issued the certificate, yet Nginx could still be serving the old one.
We can inspect the certificate actually presented to clients using:
echo | openssl s_client \
-connect api.example.com:443 \
-servername api.example.com \
2>/dev/null | openssl x509 -noout -dates
This shows the validity dates of the certificate presented by the endpoint we connected to, rather than the certificate stored on disk. It doesn’t by itself verify trust or check every backend behind a load balancer. If the connection fails, remove 2>/dev/null to see handshake errors.
Certificate renewal and certificate deployment are separate responsibilities, and deployment is handled by the web server or Certbot integration, not the ACME protocol itself. Both need to work to keep HTTPS reliable.
What I Learned
Before exploring ACME, I thought certificate automation was mainly about scheduling renewals before certificates expire.
What surprised me was how a CA can automatically verify domain control without knowing who operates the server.
With HTTP-01, it checks a response from a publicly accessible endpoint. With DNS-01, it verifies a DNS record, even when the application itself is private or offline.
And once a certificate is issued, ACME’s job is essentially complete. It’s still up to our infrastructure to make sure the application actually uses it.
ACME doesn’t eliminate the need for certificate management. It automates the process of proving domain control and obtaining certificates, leaving deployment and monitoring as separate responsibilities.