As I mentioned in an earlier post, Let's Encrypt is a wonderful platform. We fully support its mission to protect internet users "by lowering monetary, technological, and informational barriers to a more secure and privacy-respecting Internet." We've been running Let's Encrypt certificates for the better part of a year, and since the automation just works, we rarely think about them.
At the end of that post, I promised to explain what happens when HTTP-01 validation meets geoblocking. This is that story.
A renewal that wouldn't renew
One of the servers using a Let's Encrypt certificate is a test server for one of our line-of-business applications. We keep it as close to production as we can, with a few changes to go easier on the hardware, and it's where new features, patches and even full version upgrades go first.
During one of our regular upgrades we hit a snag. Troubleshooting with the vendor meant a lot of tinkering with the certificate bindings and the automation around them.
Once that was sorted out and the certificate was bound correctly again, I noticed it was close to expiring. I figured all that tinkering might have broken the automation, so I'd renew it by hand to buy some time, then test the automation properly afterward.
I kicked off a renewal in simple-acme, and it failed.
It failed? This had worked flawlessly for several renewals. I retried with verbose logging, and it showed the HTTP-01 validation was failing. That was new. A quick search of the error turned up the same answer over and over: a firewall problem.
A firewall problem
A firewall problem! After the low-and-slow brute-force attempt on our VPN, we added rules to drop traffic. The big one blocks everything from outside the United States, and we also block some known-bad sources inside it.
So I dug into how Let's Encrypt performs HTTP-01 validation, and from where. Let's Encrypt doesn't publish where its validation comes from, which makes sense for protecting the process. But its documentation is clear about how: validation requests come from multiple locations at the same time, and from all over the world. Most of those checks have to succeed before a certificate is issued.
That's a problem when you block everything outside the US. Some of those requests were being dropped at our firewall.
The fix: a narrow exception
The long-term answer will probably be DNS-01 validation, which doesn't need any inbound port at all. But this certificate was about to expire, so in the short term I needed HTTP-01 to work.
That meant letting the validation traffic in from anywhere. What I didn't want was to open port 80 to the whole world. The new rule had to be as narrow as possible, and it had to sit above the geoblocking rule, which was at the top of our list.
A quick aside: I made this change from the firewall's management web interface, which is not exposed to the internet. Yours shouldn't be either. Firewall management interfaces facing the public internet show up in advisory after advisory. Keep management private, and limit which addresses can reach it if you can.
Here's the rule I built in Policies → Security → Add:
| Setting | Value |
|---|---|
| Source zone | Untrust (internet) |
| Source address | Any. Let's Encrypt doesn't publish its addresses, so there's nothing narrower to use. |
| Destination zone | Trust |
| Destination address | Address objects for the servers that renew with HTTP-01 |
| Service | service-http (TCP 80) |
| URL category | A custom URL category matching only the ACME challenge path |
| Action | Allow, with Log at Session End on |
The key piece is the custom URL category. Every HTTP-01 challenge is served from the same well-known path, so a custom URL category containing:
*/.well-known/acme-challenge/*
lets the rule match requests for challenge files and nothing else on port 80. Unlike some fields, a URL category can't be created on the fly inside the rule: you build the object first, then pick it from the list. I'd use objects anyway. They're Palo Alto's recommended practice, and they make rules much easier for the next person to read.
The mistake I made first
My first version of the rule didn't use service-http. Palo Alto has an App-ID called acme-protocol, and I picked it, thinking that would be the tightest match for validation traffic.
Validation failed again. The traffic log showed why: the validation request arrived as plain HTTP, not as acme-protocol. That makes sense in hindsight. The ACME protocol is the conversation between your client and Let's Encrypt. The validation step is just Let's Encrypt's servers making an ordinary web request for a file on your server. As far as the firewall is concerned, it's web traffic.
I changed the rule to service-http, committed and ran the request again. This time validation passed, the new certificate was bound to the web server, and the site showed the new, valid certificate from my workstation. Back in business.
Last, I added the other servers that use HTTP-01 to the rule's destination addresses and committed one more time. Their next automatic renewals have run since then, simple-acme reported success on each, and every site shows its new certificate.
If you're doing the same
- Put the exception above the geoblocking rule. Rules are evaluated top-down; if the geoblock rule comes first, the exception never gets a chance.
- Match the challenge path, not all of port 80. A custom URL category on the challenge path keeps the opening narrow. Test the pattern on your firewall version. Using full host names in the entries is even tighter than a wildcard.
- Watch out for HTTP-to-HTTPS redirects. Let's Encrypt follows redirects. If your server sends the challenge request to HTTPS, it arrives on port 443, where your geoblock still applies. Serve the challenge path over plain HTTP, or allow it on 443 too.
- With NAT, check your addresses and zones. On Palo Alto firewalls, security rules use the original (public) destination address and the final (internal) destination zone. Getting that combination wrong is a common reason a rule never matches.
- Use the traffic log. It showed me in seconds what the traffic actually was, instead of what I assumed it would be.
- Plan for DNS-01. Moving to DNS-01 removes the inbound requirement entirely, and it's required for wildcard certificates anyway.
- Expect it to fail on renewal, not on setup. Firewall changes can break certificate renewal weeks later. Monitoring certificate expiry, like the status board we use, catches it before your users do.