How to Check TLS Certificate Expiry from Cron After Let's Encrypt Stopped Emailing You

2026-12-01来源 dev.toEnglish

On 4 June 2025, Let's Encrypt turned off the expiration-notification emails it had been sending since the start of the project. If your ACME client is renewing cleanly, you may not have noticed. If it is not, the email that used to arrive twenty days before expiry is gone.

Their own post is clear about the reasons (better automation, privacy, cost, complexity). The practical consequence for operators is also clear, and they say it in the monitoring docs: you should watch the certificate your site actually serves, not only the success of the renewal job.

Those are not the same check. certbot can fail after a config change, a DNS challenge can start failing, or a proxy can keep serving an old certificate while a new one sits unused on disk. The email was a backstop for that. It is no longer there.

I wrote a small open-source tool for the check I wanted instead: one Python file, standard library only (3.9+), no monitoring server, exit codes that cron or CI can use. Full disclosure: I wrote it. It is called pulseping-lite, and it is MIT-licensed.

One command, one target

python3 pulseping_lite.py https://example.com --warn-days 14 

If the HTTP status is below 400 and the certificate has at least 14 days left, it prints a single UP line and exits 0. If the site is down, the handshake fails, or the cert is inside the warning window, it exits 1.

I ran it on 25 November 2026 at 00:23 Europe/Rome:

$ python3 pulseping_lite.py https://example.com --warn-days 14 UP https://example.com status=200 62.4 ms cert expires in 30 days 

That run exited 0. Latency and days-left will be different when you run it.

--warn-days defaults to 14. There is no separate "warning" exit code: an expiring certificate is a failure (1), so a cron line can treat "down" and "expiring soon" the same way. For a TCP service that is not HTTP, pass host:port and add --tls when you also want the certificate:

python3 pulseping_lite.py example.com:443 --tls --warn-days 14 

JSON is available when you want to pipe the result into something else:

$ python3 pulseping_lite.py https://example.com --json { "target": "https://example.com", "up": true, "status_code": 200, "tls_days_left": 30, "issuer": null, "latency_ms": 71.4, "error": null } 

(issuer is present in the schema but was null on this run; do not depend on it.)

Put it in cron

pulseping-lite does not send alerts. It exits non-zero, and you decide what happens next:

# every 5 minutes: mail me if the site is down or the cert expires within 14 days */5 * * * * python3 /opt/pulseping_lite.py https://example.com/health --warn-days 14 || echo "example.com check failed" | mail -s "uptime" you@example.com 

Install is one file. No pip install is required:

curl -fsSLO https://raw.githubusercontent.com/alessio1999xx-debug/pulseping-lite/main/pulseping_lite.py python3 pulseping_lite.py https://example.com 

Inspect the file before you run it, as you would with any script you download.

What it does not do

  • One target per invocation. There is no scheduler, dashboard, or history.
  • No built-in alert delivery. Cron, CI, or your wrapper owns that.
  • Redirects are not followed.
  • --timeout bounds individual network operations, not the entire process wall time.
  • --insecure skips certificate verification. Use it only for a self-signed or internal cert you already trust. In that mode, the expiry date can be unavailable (null in JSON), so you may learn that the handshake happened and nothing about days-left.

It is a cron-sized check, not a replacement for Blackbox Exporter or Uptime Kuma.

Try it

Repo: https://github.com/alessio1999xx-debug/pulseping-lite

If you need many monitors, consecutive-failure thresholds, or built-in alerts, that is the paid PulsePing CLI: https://py-forge.com/products/pulseping-cli?utm_source=devto&utm_medium=article&utm_campaign=tls-cert-expiry-cron — one-time payment, no subscription. The lite repo stays free.

How are you watching certificate expiry now that the Let's Encrypt emails are gone? I am curious what people run on a single VPS, where a monitoring stack is more than the box.

Sources:

原文:https://www.a8q9.cn/en/article/how-to-check-tls-certificate-expiry-from-cron-after-let-s-encrypt-stopped-emaili-76b780.html

相关文章