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.

Firewall login page with a trusted certificate

Environment and design

ComponentRole
OPNsense on a repurposed WatchGuard applianceFirewall; 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 EncryptFree certificate authority; issues 90-day certificates
OPNsense Unbound DNSResolves firewall.dhaaselab.com to the firewall’s LAN address inside the network
TwingateZero-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.

  1. Created a scoped Cloudflare API token from the “Edit zone DNS” template, limited to the dhaaselab.com zone with DNS Edit only.

    Cloudflare token permissions, zone and DNS Edit only

  2. Installed the os-acme-client plugin from System → Firmware → Plugins, then enabled it with auto renewal.

    ACME client settings with the plugin and auto renewal enabled

  3. Registered two Let’s Encrypt accounts: one on the staging (test) CA and one on production.

    ACME accounts list, both registered

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

    Challenge types list

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

    Automations list

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

    Production issue log from Let’s Encrypt

    Certificates list with status OK

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

    Unbound host overrides

    Twingate resource with port restrictions

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

    Administration page with the ACME certificate selected

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

    Browser showing Connection is secure

Problems and fixes

ProblemFix
Staging issue failed in about 4 seconds with “domain validation failed (dns01)”; OPNsense couldn’t create the TXT recordThe 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 validBrave 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 tokenRotated the token in Cloudflare right away so the exposed value stopped working, then updated OPNsense with the new one

Failed staging log before the Zone ID fix

DNS rebind warning before the Alternate Hostnames fix

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