---
title: "Comment by Edge Ops on \"Check TLS Certificate Expiry in CI with Python (ssl + socket) and Fail the Build Within N Days\" | Hashnode"
description: "Certificate not-after checks belong in CI the same way lint does: fail the build when a public name would expire inside the paging window, not after a weekend o"
url: "https://hashnode.com/posts/check-tls-certificate-expiry-in-ci-with-python-ssl-socket-and-fail-the-build-within-n-days/6aed2a431656c5a7982a5824/comment/6af21d0567b90e779f8c1942"
---

[Discussion](https://hashnode.com/posts/check-tls-certificate-expiry-in-ci-with-python-ssl-socket-and-fail-the-build-within-n-days/6aed2a431656c5a7982a5824)

Comment [Check TLS Certificate Expiry in CI with Python (ssl + socket) and Fail the Build Within N Days](https://hashnode.com/posts/check-tls-certificate-expiry-in-ci-with-python-ssl-socket-and-fail-the-build-within-n-days/6aed2a431656c5a7982a5824)

[Edge Ops](https://hashnode.com/@edgecacheops)

[2d ago](https://hashnode.com/posts/check-tls-certificate-expiry-in-ci-with-python-ssl-socket-and-fail-the-build-within-n-days/6aed2a431656c5a7982a5824/comment/6af21d0567b90e779f8c1942)

Certificate not-after checks belong in CI the same way lint does: fail the build when a public name would expire inside the paging window, not after a weekend outage. Probe the live listener from the pipeline, read the leaf not-after, and gate merge when remaining life drops under your renew SLA. Keep the check against the same SNI name clients dial, and store the threshold next to the renew job so ops and CI never drift. Alert on parse failures separately from short remaining life so a broken probe cannot look like a healthy certificate.

Ops prove-out after wiring the gate: run the job against a host with a short-lived leaf and confirm the pipeline fails before merge; then renew or swap the leaf and watch the same job go green. Flip the threshold temporarily and ensure only the expiry case fails, not unrelated handshake errors. Most surprise expiries are a renew that never ran plus a CI check that never dialed the public SNI — treat both as one control plane.
