Manoj Yadav

The Breaking Part #3: The Silent SSL Expiration Trap

There is no worse way to start a Monday morning than waking up, opening your self-hosted dashboard on your phone, and being greeted by:

Your connection is not private
NET::ERR_CERT_DATE_INVALID
Attackers might be trying to steal your information...

I tapped my Nextcloud bookmark: same red warning. Home Assistant: broken. Internal Git server: SSL certificate problem: certificate has expired.

Every single service running under my *.home.example.com domain had simultaneously dropped dead over the weekend because of an expired Let’s Encrypt SSL certificate.

Here is why it happened, why it failed silently for 30 straight days, and how I fixed the architecture permanently.


The Trap: Relying on HTTP-01 for Private Infrastructure

When you set up automated Let’s Encrypt certificates using ACME clients (like Certbot or Traefik), the default validation mechanism is usually HTTP-01:

  1. Traefik asks Let’s Encrypt for a certificate.
  2. Let’s Encrypt responds: “Prove you own this domain by serving a random secret token at http://your-domain.com/.well-known/acme-challenge/<token> on port 80.”
  3. The Let’s Encrypt validation servers attempt an HTTP connection to your router’s public IP on port 80.
  4. If the router forwards port 80 to Traefik and returns the token, the certificate is renewed for 90 days.

Why This is Terrible for a Homelab

A month before the outage, I did a routine security audit of my router and firewall rules.

I asked myself: “Why do I have port 80 forwarded to my internal network when all my access happens over WireGuard or local Wi-Fi?”

Naturally, I closed port 80.

What I completely forgot was that Let’s Encrypt attempts renewals 30 days before expiration.

The moment I closed port 80, the automated renewal cron job started failing every night. But because everything was already working with the existing certificate, nothing broke that day. The system kept humming along quietly while the clock ticked down to zero.

On day 90 at midnight, the certificate expired. Every internal web app locked up under scary browser security warnings.


Why Self-Signed Private CAs Aren’t the Answer

When homelabbers run into certificate issues, the most common suggestion is: “Just spin up Step-CA or an internal OpenSSL root certificate authority!”

I tried that. It sounds clean in theory, but in practice, it’s an administrative nightmare:

  • You have to manually install and trust the root certificate on every MacBook, Windows laptop, Android phone, and iPhone in the house.
  • If you wipe your phone or get a new device, half your bookmarks stop working until you install the profile again.
  • Some devices (like smart TVs, game consoles, and IoT devices) make it practically impossible to inject custom root certificates.

The goal was simple: publicly trusted green-padlock certificates with zero open inbound router ports.


The Permanent Solution: DNS-01 Validation via Cloudflare

The correct architecture for private infrastructure is the DNS-01 Challenge.

Instead of requiring an inbound HTTP connection to port 80, DNS-01 proves domain ownership through your DNS registrar’s API:

[ Traefik (Homelab Server) ]
     │
     │ 1. Request cert for *.home.example.com
     ▼
[ Let's Encrypt CA ] ─── 2. "Set TXT record: _acme-challenge = xyz" ───┐
                                                                       │
┌──────────────────────────────────────────────────────────────────────┘
│
▼
[ Traefik ] ─── 3. Write TXT record via API ───► [ Cloudflare DNS (Public) ]
                                                         │
                                                         │ 4. Verify TXT record
                                                         ▼
[ Let's Encrypt CA ] ◄───────────────────────────────────┘
     │
     │ 5. Issue valid wildcard cert (*.home.example.com)
     ▼
[ Traefik ] ─── 6. Delete TXT record via API

The Beauty of this Setup:

  1. Zero Open Ports: Inbound ports 80 and 443 on your home router remain 100% closed. Let’s Encrypt never talks directly to your home server.
  2. Wildcard Certificates: DNS-01 allows you to issue a single wildcard cert (*.home.example.com). One cert covers all current and future subdomains automatically.
  3. Internal Isolation: In local DNS (Pi-hole), *.home.example.com resolves directly to the internal Traefik IP on the server VLAN (10.0.20.2). Traffic never leaves the local network.

The Traefik Configuration

Here is how simple this is to configure inside Traefik’s traefik.yml:

certificatesResolvers:
  cloudflare:
    acme:
      email: your-email@example.com
      storage: /etc/traefik/acme/acme.json
      dnsChallenge:
        provider: cloudflare
        resolvers:
          - "1.1.1.1:53"
          - "1.0.0.1:53"

You pass a scoped Cloudflare API token (with permissions restricted strictly to Zone:DNS:Edit for your specific domain) via an environment variable in your Docker Compose file:

services:
  traefik:
    image: traefik:v3.1
    environment:
      - CF_DNS_API_TOKEN=your_scoped_token_here

The Safeguard: Expiry Monitoring

Even with automated DNS-01 renewals running cleanly, silent failures can still happen if an API token expires or Cloudflare changes an endpoint.

To guarantee I never wake up to an expired cert again, I added automated SSL monitoring in Uptime Kuma:

  • It monitors https://dashboard.home.example.com.
  • If the TLS certificate certificate has fewer than 14 days of validity remaining, it fires an instant alert to my Telegram channel.

Key Takeaway

If you are running internal homelab services, stop opening port 80 for HTTP-01 challenges and stop fighting custom self-signed root certificates. Use DNS-01 challenges with a scoped Cloudflare API token — it keeps your firewall locked tight while giving you pristine, publicly trusted certificates across all your devices.