Tracking Certificate Expiration and Validation Health Across Production Infrastructure

The "certificate expired" error is arguably the most preventable outage in modern infrastructure, yet it remains one of the most common. According to recent industry data from Keyfactor, 77% of organi...

Tim Henrich
November 26, 2026
6 min read
8 views

Tracking Certificate Expiration and Validation Health Across Production Infrastructure

The "certificate expired" error is arguably the most preventable outage in modern infrastructure, yet it remains one of the most common. According to recent industry data from Keyfactor, 77% of organizations have experienced at least one severe outage due to an expired certificate in the past 24 months.

High-profile incidents routinely make headlines. In early 2024, Rubrik issued a critical advisory when internal cluster certificates expired, causing nodes to lose communication and halting backup operations. Similarly, a massive Starlink global outage in 2023 was traced back to an expired certificate in their ground station infrastructure. Even highly advanced engineering organizations struggle with Public Key Infrastructure (PKI) visibility.

The stakes are getting higher. Google Chrome’s Root Program has announced its intention to reduce the maximum validity of public TLS certificates from 398 days to just 90 days. Concurrently, the explosion of Kubernetes microservices and Zero Trust Architectures has pushed the ratio of machine identities (mTLS certificates) to human identities to 45 to 1.

Relying on calendar reminders, spreadsheets, or CA-provided email alerts is no longer mathematically viable. This tutorial explores how to build a robust, automated monitoring pipeline for certificate health, covering expiration, cryptographic agility, and chain validation across both public and internal infrastructure.

The Anatomy of Certificate Health

When engineering teams think about certificate monitoring, they usually stop at the expiration date. However, a comprehensive health check must evaluate several cryptographic dimensions to ensure a service remains secure and accessible.

1. Days to Expiration (Time-to-Expiry)

This is the foundational metric. You must know exactly how many days, hours, and seconds remain before a certificate becomes invalid. Alerts should be tiered based on this timeline to prevent alert fatigue. A certificate expiring in 30 days might warrant a low-priority Jira ticket, while one expiring in 48 hours requires paging the on-call engineer.

2. Certificate Chain Validation

A leaf certificate (the one issued to your specific domain) is only trusted if the entire chain of trust up to the Root CA is valid. If an intermediate certificate expires before your leaf certificate, browsers and clients will reject the connection, even if your specific domain certificate is technically still valid. Monitoring must validate the expiration dates of the intermediate and root certificates in the chain.

3. Revocation Status

Certificates can be compromised. When this happens, the Certificate Authority (CA) revokes them using Certificate Revocation Lists (CRLs) or the Online Certificate Status Protocol (OCSP). If your monitoring only checks the expiration date, it will miss a revoked certificate. Modern monitoring should verify OCSP stapling to ensure the certificate remains trusted by the issuing CA.

4. Cryptographic Strength

In August 2024, NIST finalized the first three Post-Quantum Cryptography (PQC) standards (FIPS 203, 204, and 205). Organizations are now tasked with inventorying their infrastructure to identify legacy algorithms. Monitoring tools must evaluate cipher suites, flagging deprecated protocols (TLS 1.0/1.1), weak hashing algorithms (SHA-1), and identifying where traditional RSA and ECC keys are still in use to prepare for the PQC migration.

Technical Implementation: Prometheus and Blackbox Exporter

For organizations running cloud-native infrastructure, decoupling certificate monitoring from certificate issuance is a critical best practice. Do not rely solely on your CA's dashboard. If a developer provisions a certificate using a different CA, your centralized dashboard will be blind to it. Instead, monitor the endpoints.

Prometheus, paired with the Prometheus Blackbox Exporter, is the industry standard for probing external and internal endpoints over HTTP, HTTPS, DNS, and TCP.

Configuring the Blackbox Exporter

First, configure the Blackbox Exporter to probe HTTPS endpoints. You will need a blackbox.yml configuration file that defines an http module with TLS verification enabled.

modules:
  http_2xx:
    prober: http
    timeout: 5s
    http:
      valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
      valid_status_codes: []  # Defaults to 2xx
      method: GET
      tls_config:
        insecure_skip_verify: false # Ensure we validate the chain

Configuring Prometheus to Scrape Endpoints

Next, configure your prometheus.yml to pass your target URLs to the Blackbox Exporter. This configuration uses the http_2xx module to probe your production endpoints.

scrape_configs:
  - job_name: 'blackbox_https'
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets:
        - https://api.yourdomain.com
        - https://auth.yourdomain.com
        - https://app.yourdomain.com
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: blackbox-exporter:9115 # Address of your blackbox exporter

Writing PromQL Alerts for Expiration

Once Prometheus is scraping the Blackbox Exporter, it will generate the probe_ssl_earliest_cert_expiry metric. This metric returns the Unix timestamp of the earliest expiring certificate in the chain.

You can write PromQL queries to trigger alerts based on the time remaining. Here is an example of a tiered alerting strategy in a Prometheus alerting_rules.yml file:

groups:
  - name: certificate_health
    rules:
      - alert: CertificateExpiringSoon_Warning
        expr: probe_ssl_earliest_cert_expiry{job="blackbox_https"} - time() < (30 * 86400)
        for: 1h
        labels:
          severity: warning
        annotations:
          summary: "Certificate for {{ $labels.instance }} expires in less than 30 days"
          description: "The SSL certificate for {{ $labels.instance }} will expire in {{ $value | humanizeDuration }}. Ensure automated renewal is functioning."

      - alert: CertificateExpiringSoon_Critical
        expr: probe_ssl_earliest_cert_expiry{job="blackbox_https"} - time() < (7 * 86400)
        for: 1h
        labels:
          severity: critical
        annotations:
          summary: "CRITICAL: Certificate for {{ $labels.instance }} expires in less than 7 days"
          description: "Immediate action required. The SSL certificate for {{ $labels.instance }} expires in {{ $value | humanizeDuration }}."

By subtracting the current time (time()) from the expiration timestamp, we get the remaining validity in seconds. Multiplying 86,400 (seconds in a day) by the desired number of days gives us precise thresholds.

Monitoring Internal PKI and Kubernetes Workloads

While the Blackbox Exporter is excellent for public-facing ingress controllers and APIs, it cannot see inside your Kubernetes clusters. Internal mTLS certificates used by service meshes (like Istio or Linkerd) and internal microservices represent a massive blind spot.

For Kubernetes environments, cert-manager is the de facto standard for certificate lifecycle management. Fortunately, cert-manager natively exposes Prometheus metrics for every Certificate resource it manages.

Ensure the cert-manager controller is annotated for Prometheus scraping. Once scraped, you can monitor the certmanager_certificate_expiration_timestamp_seconds metric.

      - alert: K8sInternalCertificateExpiring
        expr: certmanager_certificate_expiration_timestamp_seconds - time() < (14 * 86400)
        for: 1h
        labels:
          severity: warning
        annotations:
          summary: "Internal K8s Certificate {{ $labels.name }} in namespace {{ $labels.namespace }} is expiring."

This ensures that internal database connections, gRPC endpoints, and pod-to-pod communications are monitored with the same rigor as your public web traffic.

Overcoming Alert Fatigue and Shadow IT

A technically perfect Prometheus setup can still fail organizationally if it suffers from alert fatigue or incomplete coverage.

Combating Shadow IT with Continuous Discovery

Developers frequently spin up shadow infrastructure, provisioning certificates outside of central IT's purview. If Prometheus isn't configured to scrape a new endpoint, it won't alert you when that endpoint's certificate expires.

To combat this, security teams should monitor Certificate Transparency (CT) logs. Every publicly trusted certificate issued by a CA must be logged in a public CT log. By monitoring these logs for your domain names (e.g., *.yourdomain.com), you can discover

Share This Insight

Related Posts