Overview
The OPNsense firewall’s web admin page had an expired certificate. I replaced it with a free, automatically renewing Let’s Encrypt certificate for firewall.dhaaselab.com. Before this, a Kemp LoadMaster sat in front of the firewall just to supply a trusted certificate. It was hard to maintain and had stopped working.
Goal: a padlock with no browser warning on the firewall login page, renewals that need no manual work, and no inbound ports opened to the internet.
Outcome: done November 14, 2026. https://firewall.dhaaselab.com loads with “Connection is secure” using a production Let’s Encrypt certificate that renews itself every 60 days.

Environment and design
| Component | Role |
|---|---|
| OPNsense on a repurposed WatchGuard appliance | Firewall; runs the ACME client that requests and renews the certificate |
Cloudflare (DNS for dhaaselab.com) | Holds the temporary TXT record that proves I own the domain |
| Let’s Encrypt | Free certificate authority; issues 90-day certificates |
| OPNsense Unbound DNS | Resolves firewall.dhaaselab.com to the firewall’s LAN address inside the network |
| Twingate | Zero-trust remote access; how I manage the lab from college |
Why DNS-01 instead of HTTP-01: with DNS-01, Let’s Encrypt checks a TXT record in Cloudflare instead of connecting to the firewall. That means no port 80 open to the internet, the admin page stays private, and it works from anywhere, which mattered because I did all of this remotely.
Steps
All done remotely over Twingate.
Created a scoped Cloudflare API token from the “Edit zone DNS” template, limited to the
dhaaselab.comzone with DNS Edit only.
Installed the
os-acme-clientplugin from System → Firmware → Plugins, then enabled it with auto renewal.
Registered two Let’s Encrypt accounts: one on the staging (test) CA and one on production.

Added the Cloudflare DNS-01 challenge using the API token, Account ID and Zone ID.

Added a “Restart OPNsense Web UI” automation so renewed certificates apply on their own.

Issued the certificate on staging first (after one fix, see below), then on production.


Added an Unbound host override pointing
firewall.dhaaselab.comat the firewall’s LAN address, and a Twingate resource limited to TCP 443.

Switched the web GUI to the new certificate and added the hostname under Alternate Hostnames.

Tested it: the login page loads with “Connection is secure”.

Problems and fixes
| Problem | Fix |
|---|---|
| Staging issue failed in about 4 seconds with “domain validation failed (dns01)”; OPNsense couldn’t create the TXT record | The token is scoped to one zone, so it can’t look up the zone ID by itself. Added the Cloudflare Zone ID to the challenge config, and the next attempt succeeded in about 33 seconds |
| Visiting the hostname showed “A potential DNS Rebind attack has been detected” | OPNsense only trusts hostnames it knows. Added firewall.dhaaselab.com under Alternate Hostnames instead of turning the protection off |
| The browser still said “Not secure” even though it reported the certificate as valid | Brave remembered that I had clicked through the old certificate’s warning. A private window showed “Connection is secure”, and restarting the browser cleared it |
| I accidentally exposed the Cloudflare API token | Rotated the token in Cloudflare right away so the exposed value stopped working, then updated OPNsense with the new one |


Security decisions
- Least-privilege token: DNS edit on one zone only, not the Global API Key. A leaked token can’t touch the rest of the Cloudflare account, and the rotation above proved why that matters.
- No inbound exposure: DNS-01 means the firewall’s admin page is never reachable from the internet. Remote access goes through Twingate only.
- Staging first: tested against Let’s Encrypt’s staging CA so failed attempts didn’t count against production rate limits.
- Safe remote change: kept a second session open while switching the GUI certificate, so a mistake couldn’t lock me out while I was away at college.
Results
The production certificate was issued in about 30 seconds. Total time from first click to a working padlock was about 1.5 hours, including two fixes. Renewal is automatic and restarts the GUI on its own, and the Kemp LoadMaster is no longer needed for this hostname.
What I’d do next
- Confirm the first automatic renewal works (mid-January 2027)
- Turn on HSTS once the hostname has been stable for a while
- Retire the Kemp LoadMaster completely